varvo=Object.create;varIr=Object.defineProperty;varbo=Object.getOwnPropertyDescriptor;varwo=Object.getOwnPropertyNames;varko=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;varga=e=>Ir(e,"__esModule",{value:!0});varTo=(e,t)=>{ga(e);for(varrint)Ir(e,r,{get:t[r],enumerable:!0})},Eo=(e,t,r)=>{if(t&&typeoft=="object"||typeoft=="function")for(letiofwo(t))!jo.call(e,i)&&i!=="default"&&Ir(e,i,{get:()=>t[i],enumerable:!(r=bo(t,i))||r.enumerable});returne},$=e=>Eo(ga(Ir(e!=null?vo(ko(e)):{},"default",e&&e.__esModule&&"default"ine?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);varAa=(()=>{for(vare=newUint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;returnr=>{for(vari=r.length,n=newUint8Array((i-(r[i-1]=="=")-(r[i-2]=="="))*3/4|0),a=0,s=0;a<i;){varc=e[r.charCodeAt(a++)],l=e[r.charCodeAt(a++)],h=e[r.charCodeAt(a++)],m=e[r.charCodeAt(a++)];n[s++]=c<<2|l>>4,n[s++]=l<<4|h>>2,n[s++]=h<<6|m}returnn}})();To(exports,{default:()=>ta});varer=$(require("obsidian"));varri=$(require("obsidian"));varte=function(){functione(){}returne.explainIfInvalidTSDocTagName=function(t){if(t[0]!=="@")return'A TSDoc tag name must start with an "@" symbol';if(!e._tsdocTagNameRegExp.test(t))return"A TSDoc tag name must start with a letter and contain only letters and numbers"},e.validateTSDocTagName=function(t){varr=e.explainIfInvalidTSDocTagName(t);if(r)thrownewError(r)},e.explainIfInvalidLinkUrl=function(t){if(t.length===0)return"The URL cannot be empty";if(!e._urlSchemeRegExp.test(t))return'An @link URL must begin with a scheme comprised only of letters and numbers followed by "://". (For general URLs, use an HTML "<a>" tag instead.)';if(!e._urlSchemeAfterRegExp.test(t))return'An @link URL must have at least one character after "://"'},e.explainIfInvalidHtmlName=function(t){if(!e._htmlNameRegExp.test(t))return"An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens"},e.validateHtmlName=function(t){varr=e.explainIfInvalidHtmlName(t);if(r)thrownewError(r)},e.explainIfInvalidPackageName=function(t){if(t.length===0)return"The package name cannot be an empty string";if(!e._validPackageNameRegExp.test(t))return"The package name ".concat(JSON.stringify(t)," is not a valid package name")},e.explainIfInvalidImportPath=function(t,r){if(t.length>0){if(t.indexOf("//")>=0)return'An import path must not contain "//"';if(t[t.length-1]==="/")return'An import path must not end with "/"';if(!r&&t[0]==="/")return'An import path must not start with "/" unless prefixed by a package name'}},e.isSystemSelector=function(t){returne._systemSelectors.has(t)},e.explainIfInvalidUnquotedIdentifier=function(t){if(t.length===0)return"The identifier cannot be an empty string";if(e._identifierBadCharRegExp.test(t))return"The identifier cannot non-word characters";if(e._identifierNumberStartRegExp.test(t))return"The identifier must not start with a number"},e.explainIfInvalidUnquotedMemberIdentifier=function(t){varr=e.explainIfInvalidUnquotedIdentifier(t);if(r!==void0)returnr;if(e.isSystemSelector(t))return'The identifier "'.concat(t,'" must be quoted because it is a TSDoc system selector name')},e._tsdocTagNameRegExp=/^@[a-z][a-z0-9]*$/i,e._urlSchemeRegExp=/^[a-z][a-z0-9]*\:\/\//i,e._urlSchemeAfterRegExp=/^[a-z][a-z0-9]*\:\/\/./i,e._htmlNameRegExp=/^[a-z]+[a-z0-9\-]*$/i,e._identifierBadCharRegExp=/[^a-z0-9_$]/i,e._identifierNumberStartRegExp=/^[0-9]/,e._validPackageNameRegExp=/^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i,e._systemSelectors=newSet(["instance","static","constructor","class","enum","function","interface","namespace","type","variable"]),e}();varDi=function(){functione(){this._docNodeDefinitionsByKind=newMap,this._docNodeDefinitionsByConstructor=newMap}returne.prototype.registerDocNodes=function(t,r){vari=te.explainIfInvalidPackageName(t);if(i)thrownewError("Invalid NPM package name: "+i);for(varn=0,a=r;n<a.length;n++){vars=a[n];if(!e._nodeKindRegExp.test(s.docNodeKind))thrownewError("The DocNode kind ".concat(JSON.stringify(s.docNodeKind)," is not a
`:this.range.toString()},e}();var Do=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Classextendsvalue"+String(r)+"isnotaconstructorornull");e(t,r);function i(){this.constructor=t}t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),v;(function(e){e.Spacing="Spacing",e.BlockTag="BlockTag",e.CodeSpan_OpeningDelimiter="CodeSpan_OpeningDelimiter",e.CodeSpan_Code="CodeSpan_Code",e.CodeSpan_ClosingDelimiter="CodeSpan_ClosingDelimiter",e.DeclarationReference_PackageName="DeclarationReference_PackageName",e.DeclarationReference_ImportPath="DeclarationReference_ImportPath",e.DeclarationReference_ImportHash="DeclarationReference_ImportHash",e.ErrorText="ErrorText",e.NonstandardText="NonstandardText",e.EscapedText="EscapedText",e.FencedCode_OpeningFence="FencedCode_OpeningFence",e.FencedCode_Language="FencedCode_Language",e.FencedCode_Code="FencedCode_Code",e.FencedCode_ClosingFence="FencedCode_ClosingFence",e.HtmlAttribute_Name="HtmlAttribute_Name",e.HtmlAttribute_Equals="HtmlAttribute_Equals",e.HtmlAttribute_Value="HtmlAttribute_Value",e.HtmlEndTag_OpeningDelimiter="HtmlEndTag_OpeningDelimiter",e.HtmlEndTag_Name="HtmlEndTag_Name",e.HtmlEndTag_ClosingDelimiter="HtmlEndTag_ClosingDelimiter",e.HtmlStartTag_OpeningDelimiter="HtmlStartTag_OpeningDelimiter",e.HtmlStartTag_Name="HtmlStartTag_Name",e.HtmlStartTag_ClosingDelimiter="HtmlStartTag_ClosingDelimiter",e.InlineTag_OpeningDelimiter="InlineTag_OpeningDelimiter",e.InlineTag_TagName="InlineTag_TagName",e.InlineTag_TagContent="InlineTag_TagContent",e.InlineTag_ClosingDelimiter="InlineTag_ClosingDelimiter",e.LinkTag_UrlDestination="LinkTag_UrlDestination",e.LinkTag_Pipe="LinkTag_Pipe",e.LinkTag_LinkText="LinkTag_LinkText",e.MemberIdentifier_LeftQuote="MemberIdentifier_LeftQuote",e.MemberIdentifier_Identifier="MemberIdentifier_Identifier",e.MemberIdentifier_RightQuote="MemberIdentifier_RightQuote",e.MemberReference_Dot="MemberReference_Dot",e.MemberReference_LeftParenthesis="MemberReference_LeftParenthesis",e.MemberReference_Colon="MemberReference_Colon",e.MemberReference_RightParenthesis="MemberReference_RightParenthesis",e.MemberSelector="MemberSelector",e.DocMemberSymbol_LeftBracket="DocMemberSymbol_LeftBracket",e.DocMemberSymbol_RightBracket="DocMemberSymbol_RightBracket",e.ParamBlock_ParameterName="ParamBlock_ParameterName",e.ParamBlock_Hyphen="ParamBlock_Hyphen",e.PlainText="PlainText",e.SoftBreak="SoftBreak"})(v||(v={}));var b=function(e){Do(t,e);function t(r){var i=e.call(this,r)||this;if(r.excerptKind===v.Spacing)for(var n=0,a=r.content.tokens;n<a.length;n++){var s=a[n];switch(s.kind){case f.Spacing:case f.Newline:case f.EndOfInput:break;default:throw new Error("TheexcerptKind=Spacingbuttherangecontainsanon-whitespacetoken")}}return i._excerptKind=r.excerptKind,i._content=r.content,i}return Object.defineProperty(t.prototype,"kind",{get:function(){return g.Excerpt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excerptKind",{get:function(){return this._excerptKind},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),t}(j);var Mo=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Classextendsvalue"+String(r)+"isnotaconstructorornull");e(t,r);function i(){this.constructor=t}t.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Nr=function(e){Mo(t,e);function t(r){var i=e.call(this,r)||this;return te.validateTSDocTagName(r.tagName),i._tagName=r.tagName,i._tagNameWithUpperCase=r.tagName.toUpperCase(),j.isParsedParameters(r
`?(++r,i=1):++i)}return{line:r,column:i}},e.prototype._validateBounds=function(){if(this.pos<0)throw new Error("TextRange.poscannotbenegative");if(this.end<0)throw new Error("TextRange.endcannotbenegative");if(this.end<this.pos)throw new Error("TextRange.endcannotbesmallerthanTextRange.pos");if(this.pos>this.buffer.length)throw new Error("TextRange.poscannotexceedtheassociatedtextbufferlength");if(this.end>this.buffer.length)throw new Error("TextRange.endcannotexceedtheassociatedtextbufferlength")},e.empty=new e("",0,0),e}();var pr=function(){function e(t){this.messageId=t.messageId,this.unformattedText=t.messageText,this.textRange=t.textRange,this.tokenSequence=t.tokenSequence,this.docNode=t.docNode,this._text=void 0}return e._formatMessageText=function(t,r){if(t||(t="Anunknownerroroccurred"),r.pos!==0||r.end!==0){var i=r.getLocation(r.pos);if(i.line)return"(".concat(i.line,",").concat(i.column,"):")+t}return t},Object.defineProperty(e.prototype,"text",{get:function(){return this._text===void 0&&(this._text=e._formatMessageText(this.unformattedText,this.textRange)),this._text},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.text},e}();var Vi=function(){function e(){this._messages=[]}return Object.defineProperty(e.prototype,"messages",{get:function(){return this._messages},enumerable:!1,configurable:!0}),e.prototype.addMessage=function(t){this._messages.push(t)},e.prototype.addMessageForTextRange=function(t,r,i){this.addMessage(new pr({messageId:t,messageText:r,textRange:i}))},e.prototype.addMessageForTokenSequence=function(t,r,i,n){this.addMessage(new pr({messageId:t,messageText:r,textRange:i.getContainingTextRange(),tokenSequence:i,docNode:n}))},e.prototype.addMessageForDocErrorText=function(t){var r;t.textExcerpt?r=t.textExcerpt:r=t.errorLocation,this.addMessage(new pr({messageId:t.messageId,messageText:t.errorMessage,textRange:r.getContainingTextRange(),tokenSequence:r,docNode:t}))},e}();var Hi=function(){function e(t,r){this.commentRange=Le.empty,this.lines=[],this.tokens=[],this.configuration=t,this.sourceRange=r,this.docComment=new Mr({configuration:this.configuration}),this.log=new Vi}return e}();var ut=function(){function e(t){this.parserContext=t.parserContext,this._startIndex=t.startIndex,this._endIndex=t.endIndex,this._validateBounds()}return e.createEmpty=function(t){return new e({parserContext:t,startIndex:0,endIndex:0})},Object.defineProperty(e.prototype,"startIndex",{get:function(){return this._startIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endIndex",{get:function(){return this._endIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tokens",{get:function(){return this.parserContext.tokens.slice(this._startIndex,this._endIndex)},enumerable:!1,configurable:!0}),e.prototype.getNewSequence=function(t,r){return new e({parserContext:this.parserContext,startIndex:t,endIndex:r})},e.prototype.getContainingTextRange=function(){return this.isEmpty()?Le.empty:this.parserContext.sourceRange.getNewRange(this.parserContext.tokens[this._startIndex].range.pos,this.parserContext.tokens[this._endIndex-1].range.end)},e.prototype.isEmpty=function(){return this._startIndex===this._endIndex},e.prototype.toString=function(){return this.tokens.map(function(t){return t.toString()}).join("")},e.prototype._validateBounds=function(){if(this.startIndex<0)throw new Error("TokenSequence.startIndexcannotbenegative");if(this.endIndex<0)throw new Error("TokenSequence.endIndexcannotbenegative");if(this.endIndex<this.startIndex)throw new Error("TokenSequence.endIndexcannotbesmallerthanTokenSequence.startIndex");if(this.startIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.startIndexcannotexceedtheassociatedtokenarray");if(this.endIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.endIndexcannotexceedtheassociatedtokenarray")},e}();var ie;(function(e){e[e.BeginComment1=0]="BeginComment1",e[e.BeginComment2=1]="BeginComment2",e[e.CollectingFirstLine=2]="CollectingFirstLine
`?(m.push(r.getNewRange(k,k)),s=l):e._whitespaceCharacterRegExp.test(_)||(c=l,h=ie.CollectingLine);break}}return t.commentRange=r.getNewRange(n,a),t.lines=m,!0},e._whitespaceCharacterRegExp=/^\s$/,e}();var fr=function(){function e(){}return e.readTokens=function(t){e._ensureInitialized();for(var r=[],i=void 0,n=0,a=t;n<a.length;n++){var s=a[n];e._pushTokensForLine(r,s),i=s}return i?r.push(new wt(f.EndOfInput,i.getNewRange(i.end,i.end),i)):r.push(new wt(f.EndOfInput,Le.empty,Le.empty)),r},e.isPunctuation=function(t){return e._ensureInitialized(),e._punctuationTokens[t]||!1},e._pushTokensForLine=function(t,r){for(var i=r.buffer,n=r.end,a=r.pos,s=void 0,c=a;a<n;){var l=i.charCodeAt(a),h=e._charCodeMap[l];h===void 0&&(h=f.Other),s!==void 0&&h===s&&e._isMultiCharacterToken(s)||(s!==void 0&&t.push(new wt(s,r.getNewRange(c,a),r)),c=a,s=h),++a}s!==void 0&&t.push(new wt(s,r.getNewRange(c,a),r)),t.push(new wt(f.Newline,r.getNewRange(r.end,r.end),r))},e._isMultiCharacterToken=function(t){switch(t){case f.Spacing:case f.AsciiWord:case f.Other:return!0}return!1},e._ensureInitialized=function(){if(!e._charCodeMap){e._charCodeMap={},e._punctuationTokens={};for(var t=e._commonMarkPunctuationCharacters,r=0;r<t.length;++r){var i=t.charCodeAt(r);e._charCodeMap[i]=f.OtherPunctuation}for(var n={"\\":f.Backslash,"<":f.LessThan,">":f.GreaterThan,"=":f.Equals,"'":f.SingleQuote,'"':f.DoubleQuote,"/":f.Slash,"-":f.Hyphen,"@":f.AtSign,"{":f.LeftCurlyBracket,"}":f.RightCurlyBracket,"`":f.Backtick,".":f.Period,":":f.Colon,",":f.Comma,"[":f.LeftSquareBracket,"]":f.RightSquareBracket,"|":f.Pipe,"(":f.LeftParenthesis,")":f.RightParenthesis,"#":f.PoundSymbol,"+":f.Plus,$:f.DollarSign},a=0,s=Object.getOwnPropertyNames(n);a<s.length;a++){var c=s[a];e._charCodeMap[c.charCodeAt(0)]=n[c],e._punctuationTokens[n[c]]=!0}e._punctuationTokens[f.OtherPunctuation]=!0;for(var l=e._wordCharacters,r=0;r<l.length;++r){var i=l.charCodeAt(r);e._charCodeMap[i]=f.AsciiWord}e._charCodeMap["".charCodeAt(0)]=f.Spacing,e._charCodeMap["".charCodeAt(0)]=f.Spacing}},e._commonMarkPunctuationCharacters="!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~",e._wordCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",e}();varKi=function(){functione(t,r){if(this._parserContext=t,this.tokens=t.tokens,r){if(r.parserContext!==this._parserContext)thrownewError("The embeddedTokenSequence must use the same parser context");this._readerStartIndex=r.startIndex,this._readerEndIndex=r.endIndex}elsethis._readerStartIndex=0,this._readerEndIndex=this.tokens.length;this._currentIndex=this._readerStartIndex,this._accumulatedStartIndex=this._readerStartIndex}returne.prototype.extractAccumulatedSequence=function(){if(this._accumulatedStartIndex===this._currentIndex)thrownewError("Parser assertion failed: The queue should not be empty when extractAccumulatedSequence() is called");vart=newut({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex});returnthis._accumulatedStartIndex=this._currentIndex,t},e.prototype.isAccumulatedSequenceEmpty=function(){returnthis._accumulatedStartIndex===this._currentIndex},e.prototype.tryExtractAccumulatedSequence=function(){if(!this.isAccumulatedSequenceEmpty())returnthis.extractAccumulatedSequence()},e.prototype.assertAccumulatedSequenceIsEmpty=function(){if(!this.isAccumulatedSequenceEmpty()){vart=newut({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex}),r=t.tokens.map(function(i){returni.toString()});thrownewError(`Parser assertion failed: The queue should be empty, but it contains:
`+JSON.stringify(r))}},e.prototype.peekToken=function(){returnthis.tokens[this._currentIndex]},e.prototype.peekTokenKind=function(){returnthis._currentIndex>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex].kind},e.prototype.peekTokenAfterKind=function(){returnthis._currentIndex+1>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex+1].kind},e.prototype.peekTokenAfterAfterKind=function(){returnthis._currentIndex+2>=this._readerEndIndex?f.EndOfInput:this.tokens[this._currentIndex+2].kind},e.prototype.readToken=function(){if(this._currentIndex>=this._readerEndIndex)thrownewError("Cannot read past end of stream");vart=this.tokens[this._currentIndex];if(t.kind===f.EndOfInput)thrownewError("The EndOfInput token cannot be read");returnthis._currentIndex++,t},e.prototype.peekPreviousTokenKind=function(){returnthis._currentIndex===0?f.EndOfInput:this.tokens[this._currentIndex-1].kind},e.prototype.createMarker=function(){returnthis._currentIndex},e.prototype.backtrackToMarker=function(t){if(t>this._currentIndex)thrownewError("The marker has expired");this._currentIndex=t,t<this._accumulatedStartIndex&&(this._accumulatedStartIndex=t)},e}();varQr=function(){returnQr=Object.assign||function(e){for(vart,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(varnint)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}returne},Qr.apply(this,arguments)};functionhr(e){returne!==void0&&Object.hasOwnProperty.call(e,"failureMessage")}varka=function(){functione(t){this._parserContext=t,this._configuration=t.configuration,this._currentSection=t.docComment.summarySection}returne.prototype.parse=function(){for(vart=newKi(this._parserContext),r=!1;!r;)switch(t.peekTokenKind()){casef.EndOfInput:r=!0;break;casef.Newline:this._pushAccumulatedPlainText(t),t.readToken(),this._pushNode(new$r({parsed:!0,configuration:this._configuration,softBreakExcerpt:t.extractAccumulatedSequence()}));break;casef.Backslash:this._pushAccumulatedPlainText(t),this._pushNode(this._parseBackslashEscape(t));break;casef.AtSign:this._pushAccumulatedPlainText(t),this._parseAndPushBlock(t);break;casef.LeftCurlyBracket:{this._pushAccumulatedPlainText(t);vari=t.createMarker(),n=this._parseInlineTag(t),a=this._parserContext.docComment;if(ninstanceofcr){vars=t.createMarker()-1;a.inheritDocTag===void0?this._parserContext.docComment.inheritDocTag=n:this._pushNode(this._backtrackAndCreateErrorRange(t,i,s,w.ExtraInheritDocTag,"A doc comment cannot have more than one @inheritDoc tag"))}elsethis._pushNode(n);break}casef.RightCurlyBracket:this._pushAccumulatedPlainText(t),this._pushNode(this._createError(t,w.EscapeRightBrace,'The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'));break;casef.LessThan:this._pushAccumulatedPlainText(t),t.peekTokenAfterKind()===f.Slash?this._pushNode(this._parseHtmlEndTag(t)):this._pushNode(this._parseHtmlStartTag(t));break;casef.GreaterThan:this._pushAccumulatedPlainText(t),this._pushNode(this._createError(t,w.EscapeGreaterThan,'The ">" character should be escaped using a backslash to avoid confusion with an HTML tag'));break;casef.Backtick:this._pushAccumulatedPlainText(t),t.peekTokenAfterKind()===f.Backtick&&t.peekTokenAfterAfterKind()===f.Backtick?this._pushNode(this._parseFencedCode(t)):this._pushNode(this._parseCodeSpan(t));break;default:t.readToken();break}this._pushAccumulatedPlainText(t),this._performValidationChecks()},e.prototype._performValidationChecks=function(){vart=this._parserContext.docComment;t.deprecatedBlock&&(Jr.hasAnyTextContent(t.deprecatedBlock)||this._parserContext.log.addMessageForTokenSequence(w.MissingDeprecationMessage,"The ".concat(t.deprecatedBlock.blockTag.tagName," block must include a deprecation message,")+" e.g. describing the recommended alternative",t.deprecatedBlock.blockTag.getTokenSequence(),t.deprecatedBlock)),t.inheritDocTag&&(t.remarksBlock&&this._parserContext.log.addMessageForTokenSequence(w.InheritDocIncompatibleTag,'A "'.concat(t.remarksBlock.blockTag.tagName,'" block must not be used, beca
`,e.console_msg))});t.messageEl.appendChild(r)}var C=class extends Error{constructor(t,r){super(t);this.console_msg=r;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function de(e,t){try{return await e()}catch(r){return r instanceof C?le(r):le(new C(t,r instanceof Error?r.message:void 0)),null}}function je(e,t){try{return e()}catch(r){return le(new C(t,r instanceof Error?r.message:void 0)),null}}var me=$(require("obsidian"));function lt(e){return new Promise(t=>window.setTimeout(t,e))}function Ea(){return/(<%(?:-|_)?\s*[*~]{0,1})\+((?:.|\s)*?%>)/g}function Yi(e,t){t=(0,me.normalizePath)(t);let r=e.vault.getAbstractFileByPath(t);if(!r)throw new C(`Folder "${t}" doesn'texist`);if(!(r instanceof me.TFolder))throw new C(`${t}isafile,notafolder`);return r}function pt(e,t){t=(0,me.normalizePath)(t);let r=e.vault.getAbstractFileByPath(t);if(!r)throw new C(`File"${t}"doesn't exist`);if(!(r instanceof me.TFile))throw new C(`${t} is a folder, not a file`);return r}function Re(e,t){let r=Yi(e,t),i=[];return me.Vault.recurseChildren(r,n=>{n instanceof me.TFile&&i.push(n)}),i.sort((n,a)=>n.path.localeCompare(a.path)),i}async function Sa(e,t){return await Promise.all(t.map(async i=>{let n=await e.vault.cachedRead(i);return ic(i,n)}))}function ic(e,t){let r=zi(t),i=new $i(e);return i.description=r.description,i.returns=r.returns,i.arguments=r.arguments,i}function zi(e){let r=new Ui().parseString(e);return{description:nc(r.docComment.summarySection),returns:ac(r.docComment.returnsBlock),arguments:sc(r.docComment.params)}}function nc(e){try{return e.nodes.map(r=>r.getChildNodes().filter(i=>i instanceof Me).map(i=>i.text).join(`
`)}catch{return console.error("Failed to parse summary section"),""}}function ac(e){if(!e)return"";try{let t=e.content.nodes[0]?.getChildNodes()[0];return t instanceof Me?t.text.trim():""}catch{return""}}function sc(e){try{return e.blocks.map(i=>{let n=i.parameterName,a=i.content.getChildNodes()[0].getChildNodes().filter(s=>s instanceof Me).map(s=>s.text).join(" ");return new Gi(n,a)})}catch{return[]}}function Wi(e,t,r){if(r<0||r===e.length)return;let i=e.splice(t,1)[0];e.splice(r,0,i)}function ft(e){return e.workspace.activeEditor?.file??e.workspace.getActiveFile()}function Xr(e){let t=e.lastIndexOf("/");return t!==-1?e.slice(0,t):""}function ue(e){return e!==null&&typeof e=="object"}function Ca(e){let t=e.toString(),r=t.indexOf("(");return t.substring(r+1,t.indexOf(")")).replace(/ /g,"").split(",")}function Ji(e,t,r){let i=e.instanceOf(HTMLOListElement)?"li":"p",n=e.createEl(i),a=e.createEl("b",{text:t});return n.appendChild(a),n.appendChild(activeDocument.createTextNode(`: ${r}`)),n}function Zr(e,t){if(Object.keys(t).length!==0){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r],n=t[r];if(Array.isArray(i)||Array.isArray(n)){let a=Array.isArray(i)?i:[i],s=Array.isArray(n)?n:[n];e[r]=a.concat(s).unique()}else ue(i)&&ue(n)?Zr(i,n):n!=null&&n!==""&&(e[r]=n)}else e[r]=t[r]}}function dr(e){let t={},r=(0,me.getFrontMatterInfo)(e);if(r.frontmatter)try{t=(0,me.parseYaml)(r.frontmatter)}catch{return{frontmatter:t,content:e}}return{frontmatter:t,content:e.slice(r.contentStart)}}var ei=$(require("obsidian")),Qi=class extends ei.ConfirmationModal{constructor(t,r,i,n){super(t);this.setTitle(r),this.modalEl.addClass("templater-confirm-dangerous-setting-modal"),this.contentEl.createEl("p",{text:i}),this.contentEl.createEl("p",{text:"Only enable this if you trust the current and future contents of this vault, including files you may later download, copy, or sync from other people.",cls:"mod-warning"}),this.contentEl.createEl("p",{text:"This setting is stored on this device only; enable it separately on each device where you use this vault."});let a;ei.Platform.isMobile?this.addButton(s=>{a=s,s.setButtonText("I understand the risks, enable").setCta().onClick(async()=>{await n()})}):this.addCheckbox("I understand the risks",s=>{a.setDisabled(!s)}).addButton(s=>{a=s,s.setButtonText("Enable").setCta().setDisabled(!0).onClick(async()=>{await n()})}),this.addCancelButton()}};var Ut=$(require("obsidian"));var ti=$(require("obsidian"));var ge;(function(r){r[r.TemplateFiles=0]="TemplateFiles",r[r.ScriptFiles=1]="ScriptFiles"})(ge||(ge={}));var Xe=class extends ti.AbstractInputSuggest{constructor(t,r,i){super(r.app,t);this.inputEl=t;this.plugin=r;this.mode=i}get_folder(t){switch(t){case 0:return this.plugin.settings.templates_folder;case 1:return this.plugin.settings.user_scripts_folder}}get_error_msg(t){switch(t){case 0:return"Templates folder doesn'texist";case 1:return"UserScriptsfolderdoesn't exist"}}getSuggestions(t){let r=je(()=>Re(this.plugin.app,this.get_folder(this.mode)),this.get_error_msg(this.mode));if(!r)return[];let i=[],n=t.toLowerCase();return r.forEach(a=>{a instanceof ti.TFile&&a.extension==="md"&&a.path.toLowerCase().includes(n)&&i.push(a)}),i.slice(0,1e3)}renderSuggestion(t,r){r.setText(t.path)}selectSuggestion(t){this.setValue(t.path),this.inputEl.trigger("input"),this.close()}};var Xi=class extends Ut.Modal{constructor(t,r,i,n){super(t);this.plugin=r;this.onSubmit=n;this.regex=i.regex,this.template=i.template}onOpen(){this.setTitle("File regex template"),this.modalEl.addClass("templater-file-regex-template-modal");let{contentEl:t}=this,r=new Ut.Setting(t).setName("File regex").setDesc("Regex to match on. Tests against full file path relative to the root of the vault, including file extension.").addText(n=>{n.setPlaceholder("File regex").setValue(this.regex).onChange(a=>{this.regex=a})}),i=new Ut.Setting(t).setName("Template").setDesc("Template to apply on match.").addText(n=>{new Xe(n.inputEl,this.plugin,ge.TemplateFiles),n.setPlaceholder("Template").se
> \u2014 ${l}`}catch{return new C("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(t,r,i=!1)=>{try{let n=await this.getRequest(`https://templater-unsplash-2.fly.dev/${r?"?q="+r:""}`).then(s=>s.json),a=n.full;if(t&&!i)if(t.includes("x")){let[s,c]=t.split("x");a=a.concat(`&w=${s}&h=${c}`)}else a=a.concat(`&w=${t}`);return i?``:``}catch{return new C("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(t,r)=>{try{let n=(await this.getRequest(t)).json;return r&&n?r.split(".").reduce((a,s)=>{if(Object.prototype.hasOwnProperty.call(a,s))return a[s];throw new Error(`Path ${r} not found in the JSON response`)},n):n}catch(i){throw console.error(i),new C("Error fetching and extracting value")}}}};var dn=class extends he{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(t=>{t.e.offref(t)}),this.event_refs=[]}generate_on_all_templates_executed(){return t=>{let r=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await lt(1),t()});r&&this.event_refs.push(r)}}};var mn=class extends he{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let t=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(t?.frontmatter||{}))}async teardown(){}};var He=$(require("obsidian"));var gn=class extends He.Modal{constructor(t,r,i,n,a){super(t);this.prompt_text=r;this.default_value=i;this.multi_line=n;this.select_default_value=a;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new C("Cancelled prompt"))}createForm(){let t=this.contentEl.createDiv();t.addClass("templater-prompt-div");let r;this.multi_line?r=new He.TextAreaComponent(t):r=new He.TextComponent(t);let i=this.contentEl.createDiv();i.addClass("templater-button-div");let n=new He.ButtonComponent(i);n.buttonEl.addClass("mod-cta"),n.setButtonText("Submit").onClick(a=>{this.resolveAndClose(a)}),this.value=this.default_value??"",r.inputEl.addClass("templater-prompt-input"),r.setPlaceholder("Type text here"),r.setValue(this.value),r.onChange(a=>this.value=a),r.inputEl.focus(),this.select_default_value&&r.inputEl.select(),r.inputEl.addEventListener("keydown",a=>this.enterCallback(a))}enterCallback(t){t.isComposing||t.keyCode===229||(this.multi_line?He.Platform.isDesktop&&t.key==="Enter"&&!t.shiftKey&&this.resolveAndClose(t):t.key==="Enter"&&this.resolveAndClose(t))}resolveAndClose(t){this.submitted=!0,t.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(t,r){this.resolve=t,this.reject=r,this.open()}};var $a=$(require("obsidian")),An=class extends $a.FuzzySuggestModal{constructor(t,r,i,n,a,s){super(t);this.text_items=r;this.items=i;this.default_value=s;this.submitted=!1;this.containerEl.addClass("templater-suggester-modal"),this.setPlaceholder(n),a&&(this.limit=a)}getItems(){return this.items}onOpen(){super.onOpen(),this.default_value!==void 0&&(this.inputEl.value=this.getItemText(this.default_value),this.inputEl.dispatchEvent(new InputEvent("input")))}onClose(){this.submitted||this.reject(new C("Cancelled prompt"))}selectSuggestion(t,r){this.submitted=!0,this.close(),this.onChooseSuggestion(t,r)}getItemText(t){return this.text_items instanceof Function?this.text_items(t):this.text_items[this.items.indexOf(t)]||"Undefined Text Item"}onChooseItem(t){this.resolve(t)}async openAndGetValue(t,r){this.resolve=t,this.reject=r,this.open()}};var be=$(require("obsidian")),_n=class extends be.Modal{constructor(t,r,i,n,a,s){super(t);this.text_items=r;this.items=i;this.submitted=!1;this.selectedItems=[]
})`)(i,a,n)}catch(l){throw new C(`Failed to load user script at "${t.path}".`,l instanceof Error?l.message:String(l))}let c=n.default??a.exports;if(!c)throw new C(`Failed to load user script at "${t.path}". No exports detected.`);if(typeof c=="function")r.set(t.basename,c);else if(typeof c=="object"&&c!==null){if(!Object.values(c).every(h=>typeof h=="function"))throw new C(`Exported object in "${t.path}" must contain only functions.`);r.set(t.basename,c)}else throw new C(`Invalid export in "${t.path}". Must be a function or object of functions.`)}async generate_object(){let t=await this.generate_user_script_functions();return Object.fromEntries(t)}};var kn=class{constructor(t){this.plugin=t;this.user_system_functions=new bn(t),this.user_script_functions=new wn(t)}async generate_object(t){let r={},i={};return Ve(this.plugin.app).enable_system_commands&&(r=await this.user_system_functions.generate_object(t)),this.plugin.settings.user_scripts_folder&&(i=await this.user_script_functions.generate_object()),{...r,...i}}};var cc=$(require("obsidian")),Ke;(function(r){r[r.INTERNAL=0]="INTERNAL",r[r.USER_INTERNAL=1]="USER_INTERNAL"})(Ke||(Ke={}));var jn=class{constructor(t){this.plugin=t;this.internal_functions=new vn(this.plugin),this.user_functions=new kn(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:cc}}async generate_object(t,r=1){let i={},n=this.additional_functions(),a=await this.internal_functions.generate_object(t),s={};switch(Object.assign(i,n),r){case 0:Object.assign(i,a);break;case 1:s=await this.user_functions.generate_object(t),Object.assign(i,{...a,user:s});break}return i}};var _c={},S,Fe=new Array(32).fill(void 0);Fe.push(void 0,null,!0,!1);function we(e){return Fe[e]}var _r=Fe.length;function uc(e){e<36||(Fe[e]=_r,_r=e)}function Tn(e){let t=we(e);return uc(e),t}var Ya=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Ya.decode();var ai=new Uint8Array;function si(){return ai.byteLength===0&&(ai=new Uint8Array(S.memory.buffer)),ai}function ht(e,t){return Ya.decode(si().subarray(e,e+t))}function dt(e){_r===Fe.length&&Fe.push(Fe.length+1);let t=_r;return _r=Fe[t],Fe[t]=e,t}var Be=0,oi=new TextEncoder("utf-8"),lc=typeof oi.encodeInto=="function"?function(e,t){return oi.encodeInto(e,t)}:function(e,t){let r=oi.encode(e);return t.set(r),{read:e.length,written:r.length}};function rt(e,t,r){if(r===void 0){let c=oi.encode(e),l=t(c.length);return si().subarray(l,l+c.length).set(c),Be=c.length,l}let i=e.length,n=t(i),a=si(),s=0;for(;s<i;s++){let c=e.charCodeAt(s);if(c>127)break;a[n+s]=c}if(s!==i){s!==0&&(e=e.slice(s)),n=r(n,i,i=s+e.length*3);let c=si().subarray(n+s,n+i);s+=lc(e,c).written}return Be=s,n}function pc(e){return e==null}var ci=new Int32Array;function ke(){return ci.byteLength===0&&(ci=new Int32Array(S.memory.buffer)),ci}function En(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let n=e.description;return n==null?"Symbol":`Symbol(${n})`}if(t=="function"){let n=e.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(e)){let n=e.length,a="[";n>0&&(a+=En(e[0]));for(let s=1;s<n;s++)a+=", "+En(e[s]);return a+="]",a}let r=/\[object ([^\]]+)\]/.exec(toString.call(e)),i;if(r.length>1)i=r[1];else return toString.call(e);if(i=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
${e.stack}`:i}function fc(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}var ui=32;function hc(e){if(ui==1)throw new Error("out of js stack");return Fe[--ui]=e,ui}function Sn(e,t){try{return e.apply(this,t)}catch(r){S.__wbindgen_exn_store(dt(r))}}var St=class{static __wrap(t){let r=Object.create(St.prototype);return r.ptr=t,r}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();S.__wbg_parserconfig_free(t)}get interpolate(){let t=S.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(t)}set interpolate(t){S.__wbg_set_parserconfig_interpolate(this.ptr,t.codePointAt(0))}get execution(){let t=S.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(t)}set execution(t){S.__wbg_set_parserconfig_execution(this.ptr,t.codePointAt(0))}get single_whitespace(){let t=S.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(t)}set single_whitespace(t){S.__wbg_set_parserconfig_single_whitespace(this.ptr,t.codePointAt(0))}get multiple_whitespace(){let t=S.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(t)}set multiple_whitespace(t){S.__wbg_set_parserconfig_multiple_whitespace(this.ptr,t.codePointAt(0))}constructor(t,r,i,n,a,s,c){let l=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),h=Be,m=rt(r,S.__wbindgen_malloc,S.__wbindgen_realloc),_=Be,k=rt(c,S.__wbindgen_malloc,S.__wbindgen_realloc),F=Be,O=S.parserconfig_new(l,h,m,_,i.codePointAt(0),n.codePointAt(0),a.codePointAt(0),s.codePointAt(0),k,F);return St.__wrap(O)}get opening_tag(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_opening_tag(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set opening_tag(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_opening_tag(this.ptr,r,i)}get closing_tag(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_closing_tag(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set closing_tag(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_closing_tag(this.ptr,r,i)}get global_var(){try{let i=S.__wbindgen_add_to_stack_pointer(-16);S.parserconfig_global_var(i,this.ptr);var t=ke()[i/4+0],r=ke()[i/4+1];return ht(t,r)}finally{S.__wbindgen_add_to_stack_pointer(16),S.__wbindgen_free(t,r)}}set global_var(t){let r=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),i=Be;S.parserconfig_set_global_var(this.ptr,r,i)}},zt=class{static __wrap(t){let r=Object.create(zt.prototype);return r.ptr=t,r}__destroy_into_raw(){let t=this.ptr;return this.ptr=0,t}free(){let t=this.__destroy_into_raw();S.__wbg_renderer_free(t)}constructor(t){fc(t,St);var r=t.ptr;t.ptr=0;let i=S.renderer_new(r);return zt.__wrap(i)}render_content(t,r){try{let s=S.__wbindgen_add_to_stack_pointer(-16),c=rt(t,S.__wbindgen_malloc,S.__wbindgen_realloc),l=Be;S.renderer_render_content(s,this.ptr,c,l,hc(r));var i=ke()[s/4+0],n=ke()[s/4+1],a=ke()[s/4+2];if(a)throw Tn(n);return Tn(i)}finally{S.__wbindgen_add_to_stack_pointer(16),Fe[ui++]=void 0}}};async function dc(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function mc(){let e={};return e.wbg={},e.wbg.__wbindgen_object_drop_ref=function(t){Tn(t)},e.wbg.__wbindgen_string_new=function(t,r){let i=ht(t,r);return dt(i)},e.wbg.__wbindgen_string_get=function(t,r){let i=we
`),cooked:this.value},this.next(),r.tail=this.type===u.backQuote,this.finishNode(r,"TemplateElement")};N.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(r.quasis=[i];!i.tail;)this.type===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(u.braceR),r.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};N.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!_e.test(this.input.slice(this.lastTokEnd,this.start))};N.parseObj=function(e,t){var r=this.startNode(),i=!0,n={};for(r.properties=[],this.next();!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,n,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};N.parseProperty=function(e,t){var r=this.startNode(),i,n,a,s;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===u.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(a=this.start,s=this.startLoc),e||(i=this.eat(u.star)));var c=this.containsEsc;return this.parsePropertyName(r),!e&&!c&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(r)?(n=!0,i=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(r)):n=!1,this.parsePropertyValue(r,e,i,n,a,s,t,c),this.finishNode(r,"Property")};N.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r=e.kind==="get"?0:1;if(e.value.params.length!==r){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};N.parsePropertyValue=function(e,t,r,i,n,a,s,c){(r||i)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,i),e.kind="init"):!t&&!c&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==u.comma&&this.type!==u.braceR&&this.type!==u.eq?((r||i)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||i)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=n),t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===u.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()};N.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};N.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};N.parseMethod=function(e,t,r){var i=this.startNode(
`,functions:{template_file:{name:"template_file",description:"The `TFile` object representing the template file.",definition:"tp.config.template_file"},target_file:{name:"target_file",description:"The `TFile` object representing the target file where the template will be inserted.",definition:"tp.config.target_file"},run_mode:{name:"run_mode",description:"The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...).",definition:"tp.config.run_mode"},active_file:{name:"active_file",description:"The active file (if existing) when launching Templater.",definition:"tp.config.active_file?"}}},date:{name:"date",description:"This module contains every internal function related to dates.",functions:{now:{name:"now",description:"Retrieves the date.",definition:'tp.date.now(format: string = "YYYY-MM-DD", offset?: number | string, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"offset",description:"Duration to offset the date from. If a number is provided, duration will be added to the date in days. You can also specify the offset as a string using the ISO 8601 format."},{name:"reference",description:"The date to use instead of today's date, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"Date now",example:"<% tp.date.now() %>"},{name:"Date now with format",example:'<% tp.date.now("Do MMMM YYYY") %>'},{name:"Last week",example:'<% tp.date.now("YYYY-MM-DD", -7) %>'},{name:"Next week",example:'<% tp.date.now("YYYY-MM-DD", 7) %>'},{name:"Last month",example:'<% tp.date.now("YYYY-MM-DD", "P-1M") %>'},{name:"Next year",example:'<% tp.date.now("YYYY-MM-DD", "P1Y") %>'},{name:"File's title date + 1 day (tomorrow)",example:'<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title date - 1 day (yesterday)",example:'<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>'}]},tomorrow:{name:"tomorrow",description:"Retrieves tomorrow's date.",definition:'tp.date.tomorrow(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date tomorrow",example:"<% tp.date.tomorrow() %>"},{name:"Date tomorrow with format",example:'<% tp.date.tomorrow("Do MMMM YYYY") %>'}]},yesterday:{name:"yesterday",description:"Retrieves yesterday's date.",definition:'tp.date.yesterday(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date yesterday",example:"<% tp.date.yesterday() %>"},{name:"Date yesterday with format",example:'<% tp.date.yesterday("Do MMMM YYYY") %>'}]},weekday:{name:"weekday",description:"",definition:'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"weekday",description:"Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day."},{name:"reference",description:"The reference date to use instead of today, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to the [Momentjs format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"This week's Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0) %>'},{name:"Next Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 7)
You can navigate between the different cursors using the configured hotkey in Obsidian settings.
`,definition:"tp.file.cursor(order?: number)",args:[{name:"order",description:`The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.
If you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.
The order can be any number, including a decimal one, so you can insert a new jump between two existing ones without renumbering them, e.g. 1.5 jumps after 1 and before 2.
`}],examples:[{name:"File cursor",example:"<% tp.file.cursor() %>"},{name:"File multi-cursor",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1) %>"},{name:"File cursor with a decimal order",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1.5) %>Content<% tp.file.cursor(2) %>"}]},cursor_append:{name:"cursor_append",description:"Appends some content after the active cursor in the file.",definition:"tp.file.cursor_append(content: string)",args:[{name:"content",description:"The content to append after the active cursor."}],examples:[{name:"File cursor append",example:'<% tp.file.cursor_append("Some text") %>'}]},exists:{name:"exists",description:"Check to see if a file exists by it's file path. The full path to the file, relative to the Vault and containing the extension, must be provided.",definition:"tp.file.exists(filepath: string)",args:[{name:"filepath",description:"The full file path of the file we want to check existence for."}],examples:[{name:"File existence",example:'<% await tp.file.exists("MyFolder/MyFile.md") %>'},{name:"File existence of current file",example:'<% await tp.file.exists(tp.file.folder(true) + "/" + tp.file.title + ".md") %>'}]},find_tfile:{name:"find_tfile",description:"Search for a file and returns its `TFile` instance.",definition:"tp.file.find_tfile(filename: string)",args:[{name:"filename",description:"The filename we want to search and resolve as a `TFile`."}],examples:[{name:"File find TFile",example:'<% tp.file.find_tfile("MyFile").basename %>'}]},folder:{name:"folder",description:"Retrieves the file's folder name.",definition:"tp.file.folder(absolute: boolean = false)",args:[{name:"absolute",description:"If set to `true`, returns the vault-absolute path of the folder. If `false`, only returns the basename of the folder (the last part). Defaults to `false`."}],examples:[{name:"File folder (Folder)",example:"<% tp.file.folder() %>"},{name:"File folder with vault-absolute path (Path/To/Folder)",example:"<% tp.file.folder(true) %>"}]},include:{name:"include",description:"Includes the file's link content. Templates in the included content will be resolved.",definition:"tp.file.include(include_link: string | TFile)",args:[{name:"include_link",description:'The link to the file to include, e.g. `"[[MyFile]]"`, or a TFile object. Also supports sections or blocks inclusions.'}],examples:[{name:"File include",example:'<% await tp.file.include("[[Template1]]") %>'},{name:"File include TFile",example:'<% await tp.file.include(tp.file.find_tfile("MyFile")) %>'},{name:"File include section",example:'<% await tp.file.include("[[MyFile#Section1]]") %>'},{name:"File include block",example:'<% await tp.file.include("[[MyFile#^block1]]") %>'}]},last_modified_date:{name:"last_modified_date",description:"Retrieves the file's last modification date.",definition:'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD HH:mm"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"File last modified date",example:"<% tp.file.last_modified_date() %>"},{name:"File last modified date with format",example:'<% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm") %>'}]},move:{name:"move",description:"Moves the file to the desired vault location.",definition:"tp.file.move(new_path: string, file_to_move?: TFile)",args:[{name:"new_path",description:'The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. `"/Notes/MyNote"`.'},{name:"file_to_move",description:"The file to move, defaults to the current file."}],examples:[{name:"File move",example:'<%* await tp.file.move("/A/B/" + tp.file.title) %>'},{name:"File move and rename",example:'<%* await tp.file.move("/A/B/NewTitle") %>'}]},path:{name:"path",description:"Retrieves the file's absolute path on the system.",definition:"tp.file.path(relative: boolean = false)",args:[{name:"relative",description:"If set to `true`, only retrieves the vau
selected value: <% value %>`}]},suggester:{name:"suggester",description:"Spawns a suggester prompt and returns the user's chosen item.",definition:'tp.system.suggester(text_items: string[] | ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "", limit?: number = undefined, default_value?: T = undefined)',args:[{name:"text_items",description:"Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation."},{name:"items",description:"Array containing the values of each item in the correct order."},{name:"throw_on_cancel",description:"Throws an error if the prompt is canceled, instead of returning a `null` value."},{name:"placeholder",description:"Placeholder string of the prompt."},{name:"limit",description:"Limit the number of items rendered at once (useful to improve performance when displaying large lists)."},{name:"default_value",description:"Default value to initialize the suggester with."}],examples:[{name:"Suggester",example:'<% await tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]) %>'},{name:"Suggester with mapping function (same as above example)",example:'<% await tp.system.suggester((item) => item, ["Happy", "Sad", "Confused"]) %>'},{name:"Suggester for files",example:"[[<% (await tp.system.suggester((item) => item.basename, tp.app.vault.getMarkdownFiles())).basename %>]]"},{name:"Suggester for tags",example:'<% await tp.system.suggester(item => item, Object.keys(tp.app.metadataCache.getTags()).map(x => x.replace("#", ""))) %>'},{name:"Reuse value from suggester",example:`<%*
selected value: <% selectedValue %>`}]},multi_suggester:{name:"multi_suggester",description:"Spawns a suggester prompt that supports selecting multiple items and returns the user's chosen items.",definition:'tp.system.multi_suggester(text_items: string[] | ((item: T) => string), items: T[], throw_on_cancel: boolean = false, title: string = "", limit?: number = undefined, default_values?: T[] = undefined)',args:[{name:"text_items",description:"Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation."},{name:"items",description:"Array containing the values of each item in the correct order."},{name:"throw_on_cancel",description:"Throws an error if the prompt is canceled, instead of returning a `null` value."},{name:"title",description:"Text placed at the top of the modal."},{name:"limit",description:"Limit the number of items rendered at once (useful to improve performance when displaying large lists)."},{name:"default_values",description:"Default values to initialize the suggester with."}],examples:[{name:"Multi-suggester",example:'<% await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]) %>'},{name:"Multi-suggester with mapping function (same as above example)",example:'<% await tp.system.multi_suggester((item) => item, ["Happy", "Sad", "Confused"]) %>'},{name:"Multi-suggester for files",example:"<% (await tp.system.multi_suggester((item) => item.basename, tp.app.vault.getMarkdownFiles())).map(f => `[[${f.basename}]]`) %>"},{name:"Multi-suggester for tags",example:'<% await tp.system.multi_suggester(item => item, Object.keys(tp.app.metadataCache.getTags()).map(x => x.replace("#", ""))) %>'},{name:"Reuse value from multi-suggester",example:`<%*
selected value: <% selectedValue %>`}]}}},web:{name:"web",description:"This modules contains every internal function related to the web (making web requests).",functions:{daily_quote:{name:"daily_quote",description:"Retrieves and parses a daily quote as a callout. Without arguments it uses the language configured in Obsidian (via `getLanguage()`), falling back to English. English quotes come from `https://github.com/Zachatoo/quotes-database` and Spanish quotes from `https://github.com/wulflo/frases-inventario`.",definition:"tp.web.daily_quote(language?: string)",args:[{name:"language",description:'Optional language code (e.g. `"en"`, `"es"`) selecting the quotes database. Defaults to Obsidian\'s display language, falling back to English when no database is registered for that language.'}],examples:[{name:"Daily quote",example:"<% await tp.web.daily_quote() %>"},{name:"Daily quote in Spanish",example:'<% await tp.web.daily_quote("es") %>'}]},random_picture:{name:"random_picture",description:"Gets a random image from `https://unsplash.com/`.",definition:"tp.web.random_picture(size?: string, query?: string, include_size?: boolean)",args:[{name:"size",description:"Image size in the format `<width>x<height>`."},{name:"query",description:"Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma."},{name:"include_size",description:"Optional argument to include the specified size in the image link markdown. Defaults to false."}],examples:[{name:"Random picture",example:"<% await tp.web.random_picture() %>"},{name:"Random picture with size",example:'<% await tp.web.random_picture("200x200") %>'},{name:"Random picture with size and query",example:'<% await tp.web.random_picture("200x200", "landscape,water") %>'}]},request:{name:"request",description:"Makes a HTTP request to the specified URL. Optionally, you can specify a path to extract specific data from the response.",definition:"tp.web.request(url: string, path?: string)",args:[{name:"url",description:"The URL to which the HTTP request will be made."},{name:"path",description:"A path within the response JSON to extract specific data."}],examples:[{name:"Simple request",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos/1") %>'},{name:"Request with path",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos", "0.title") %>'}]}}}},Rs={tp:iu};var nu=["app","config","date","file","frontmatter","hooks","obsidian","system","user","web"],au=new Set(nu);function zn(e){return typeof e=="string"&&au.has(e)}function Vs(e){return!!(e.definition||e.returns||e.args)}var Wn=class{constructor(t){this.plugin=t;this.documentation=Rs}get_all_modules_documentation(){let t=this.documentation.tp,r=Object.values(t);return(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)&&(r=r.filter(i=>i.name!=="user")),r.map(i=>(i.queryKey=i.name,i))}async get_all_functions_documentation(t,r){if(t==="app")return this.get_app_functions_documentation(this.plugin.app,r);if(t==="user"){if(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)return;let i=await de(()=>Promise.resolve(Re(this.plugin.app,this.plugin.settings.user_scripts_folder).filter(s=>s.extension==="js")),"User Scripts folder doesn't exist");if(!i||i.length===0)return;let n=su(r);if(n){let s=i.find(c=>c.basename===n.scriptName);return s?ou(this.plugin,s,n.scriptName):[]}let a=await de(()=>Sa(this.plugin.app,i),"Failed to parse user script documentation");return!a||a.length===0?void 0:a.reduce((s,c)=>[...s,{name:c.basename,queryKey:c.basename,definition:"",description:c.description??"",returns:c.returns??"",args:Ks(c.arguments??[]),example:""}],[])}if(!!this.documentation.tp[t].functions)return Object.values(this.documentation.tp[t].functions).map(i=>(i.queryKey=i.name,i))}get_app_functions_documentation(t,r){if(!ue(t))return[];let i=r.split(".");if(i.length===0)return[];let n=t;for(let l=0;l<i.length-1;l++){let h=i[l];if(h in n){let m=n[h];if(!ue(m))return[];n=m}}let a=["tp","app",...i.slice(0,i.length-1)].join("."),s=i.slic