"use strict";varg8=Object.create;varFp=Object.defineProperty;varv8=Object.getOwnPropertyDescriptor;vary8=Object.getOwnPropertyNames;varb8=Object.getPrototypeOf,x8=Object.prototype.hasOwnProperty;varOn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F_=(t,e)=>{for(varrine)Fp(t,r,{get:e[r],enumerable:!0})},I_=(t,e,r,n)=>{if(e&&typeofe=="object"||typeofe=="function")for(letiofy8(e))!x8.call(t,i)&&i!==r&&Fp(t,i,{get:()=>e[i],enumerable:!(n=v8(e,i))||n.enumerable});returnt};varTr=(t,e,r)=>(r=t!=null?g8(b8(t)):{},I_(e||!t||!t.__esModule?Fp(r,"default",{value:t,enumerable:!0}):r,t)),w8=t=>I_(Fp({},"__esModule",{value:!0}),t);varBp=On(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.P_HELPERS=Ui.ParserHelpers=Ui.validateRegexFlags=Ui.validateRange=Ui.getIndex=Ui.arrayUnion=void0;varAy=kp();function_8(t,e){if(t===void0&&e===void0)return;if(t===void0)returne;if(e===void0)returnt;letr=[...t];for(letnofe)r.includes(n)||r.push(n);returnr}Ui.arrayUnion=_8;functionA8(t){returnt===void0?-1:t.index}Ui.getIndex=A8;functionD8(t,e){if(e<t)thrownewError(`Invalid Range: max might not be smaller than min. Received [${t}, ${e}].`);if(t<0||e<0)thrownewError(`Invalid Range: max and min might not be smaller than 0. Received [${t}, ${e}].`);if(t===1/0||e===1/0)thrownewError(`Invalid Range: max and min might not be infinity. Received [${t}, ${e}].`);if(!Number.isInteger(t)||!Number.isInteger(e))thrownewError(`Invalid Range: max and min must be integers. Received [${t}, ${e}].`)}Ui.validateRange=D8;functionS8(t){for(leteoft)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")thrownewError(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}Ui.validateRegexFlags=S8;varIp=class{followedBy(e){returnnewAy.Parser(function(n){returne.p(n.copy())})}notFollowedBy(e){returnnewAy.Parser(function(n){leti=n.copy(),a=e.p(i),o=n.sliceTo(i.position.index);returna.success?n.fail("not '"+o+"'"):n.succeed(void0)})}test(e){returnnewAy.Parser(function(n){leti=n.input[n.position.index];return!n.atEOF()&&e(i)?n.succeedOffset(1,i):n.fail(`a character matching ${e}`)})}};Ui.ParserHelpers=Ip;Ui.P_HELPERS=newIp});varB_=On(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ParserContext=void0;varDy=Bp(),Sy=classt{constructor(e,r){this.input=e,this.position=r}moveToPosition(e){returnthis.position=e,this}copy(){returnnewt(this.input,{index:this.position.index,column:this.position.column,line:this.position.line})}getPosition(){return{index:this.position.index,column:this.position.column,line:this.position.line}}atEOF(){returnthis.position.index>=this.input.length}advanceTo(e){if(e<this.position.index)thrownewError(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(letr=this.position.index;r<e;r++)this.input[r]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,r){return this.succeedAt(this.position.index+e,r)}failOffset(e,r){return this.failAt(this.position.index+e,r)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,r){return this.advanceTo(e),{success:!0,value:r,furthest:void 0,expected:void 0}}failAt(e,r){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(r)?r:[r]}}merge(e,r){if(e===void 0)return r;let n=(0,Dy.getIndex)(e.furthest),i=(0,Dy.getIndex)(r.furthest);if(i>n)return r;let a=i===n?(0,Dy.arrayUnion)(e.expected,r.expected):e.expected;return r.furthest=e.furthest,r.expected=a,r}};Pp.ParserContext=Sy});var qi=On(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.P=void 0;var aa=kp(),$p=Bp(),Ey=class t{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new aa.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let l=e[o].p(n);if(i=n.merge(i,l),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...r){if(r.length===0)throw new Error("sequenceMap must have at least one parser argument");return new aa.Parser(function(i){let a,o=new Array(r.length);for(let s=0;s<r.length;s++){let u=r[s].p(i);if(a=i.merge(a,u),!a.success)return a;o[s]=a.value}return a.value=e(...o),a})}static createLanguage(e){let r={},n={},i={};for(let a in e)i[a]=t.reference(()=>e[a](r,i)),Object.defineProperty(n,a,{get:()=>{if(r[a]!==void 0)return r[a];throw new Error(`Cannotaccessrule'${a}'inlanguage.Ruleisnotyetdefined.Trytoaccessitvia'ref'.`)}});for(let a in e)r[a]=e[a](n,i);return r}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new aa.Parser(function(n){let i;for(let a of e){let o=a,s=n.copy(),l=o.p(s);if(i=n.merge(i,l),i.success)return n.moveToPosition(s.position),i}return i})}static separateBy(e,r){return this.separateByNotEmpty(e,r).or(t.succeed([]))}static separateByNotEmpty(e,r){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,r.then(e).many())}static string(e){let r="'"+e+"'";return new aa.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(r);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,r){(0,$p.validateRegexFlags)(e.flags);let n=e.source;return r!==void 0?new aa.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=r??0;if(l>=0&&l<=s.length){let c=s[0],f=s[l];return a.succeedOffset(c.length,f)}let u="expected valid match group (0 to "+s.length+") in "+n;return a.fail(u)}else return a.fail(n)}):new aa.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=s[0];return a.succeedOffset(l.length,l)}else return a.fail(n)})}static succeed(e){return new aa.Parser(function(n){return n.succeed(e)})}static fail(e){return new aa.Parser(function(n){return n.fail(e)})}static oneOf(e){return $p.P_HELPERS.test(function(n){return e.includes(n)}).describe(`onecharacterof'${e}'`)}static noneOf(e){return $p.P_HELPERS.test(function(n){return!e.includes(n)}).describe(`nocharacterof'${e}'`)}static oneStringOf(e){return this.or(...e.map(r=>this.string(r))).describe(e.map(r=>`'${r}'`).join(" or "))}static manyOf(e){return new aa.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static manyNotOf(e){return new aa.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&!e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static custom(e){return new aa.Parser(e)}static range(e,r){let n=e.charCodeAt(0),i=r.charCodeAt(0);return $p.P_HELPERS.test(function(o){let s=o.charCodeAt(0);return n<=s&&s<=i}).describe(`${e}-${r}`)}static takeWhile(e){return new aa.Parser(function(n){let i=n.position.index;for(;i<n.i
`+this.positionContext}getUnderline(e){let r=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^(${this.cause})`;return r+n}},Nn=class extends Rn{constructor(e,r,n,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:n,docs:o}),this.str=i,this.position=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}]"${this.effect}"causedbyerror"${this.cause.message}"
`+this.positionContext}}getUnderline(e,r){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:r,a="^".repeat(i-this.position.from.column);return n+a}};var mn=Tr(oa()),Py=Tr(qi());var V_=Tr(oa()),Ci=Tr(qi());var rf=Tr(oa()),sa=Tr(qi()),Ln=sa.P.sequence(sa.P.or(rf.P_UTILS.unicodeLetter(),sa.P.oneOf("_$")),sa.P.or(rf.P_UTILS.unicodeAlphanumeric(),sa.P.oneOf("-_$")).many()).map(t=>t[0]+t[1].join("")).describe("identifier"),$_=sa.P.sequenceMap((t,e)=>t+e.map(r=>r[0]+r[1]).join(""),Ln,sa.P.sequence(rf.P_UTILS.optionalWhitespace(),Ln).many()).describe("identifier with spaces"),M8=sa.P.string("\\").then(rf.P_UTILS.any()).map(t=>t==="'"?"'":t==="\\"?"\\":"\\"+t);function O_(t){return sa.P.or(M8,sa.P.noneOf(t+"\\")).many().map(e=>e.join("")).trim(sa.P.string(t))}var zp=O_("'"),R_=O_('"'),Dl=sa.P.manyNotOf("{}[]#^|:?").box("file path");function Mi(t,e){return{value:t,position:e}}function Fa(t){if(t!==void 0)return typeof t=="string"?{value:t}:t}var bu=(r=>(r.OBJECT="object",r.ARRAY="array",r))(bu||{}),Hp=class{constructor(e,r,n){this.parent=e,this.access=r,this.child=n}};function C8(t,e){return t[e]}function L_(t,e,r){t[e]=r}var yu=class{constructor(e,r){if(this.type=e,this.prop=e==="object"?r:"",this.index=e==="array"?Number(r):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new Hp(e,this,C8(e,this.prop))}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");return new Hp(e,this,e[this.index])}}set(e,r){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");L_(e,this.prop,r)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=r}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");L_(e,this.prop,void 0)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=void 0}}toUnvalidatedPropAccess(){return this.type==="object"?{type:this.type,prop:{value:this.prop}}:{type:this.type,prop:{value:this.index.toString()}}}};var U_=Ln.node((t,e)=>({type:"object",prop:Mi(t,e)})),Fy=Ci.P.or(V_.P_UTILS.digits().wrap(Ci.P.string("["),Ci.P.string("]")).node((t,e)=>({type:"array",prop:Mi(t,e)})),R_.wrap(Ci.P.string("["),Ci.P.string("]")).node((t,e)=>({type:"object",prop:Mi(t,e)}))),N8=Ci.P.or(Ci.P.sequenceMap(t=>({storagePath:void 0,listenToChildren:!0,storageProp:t}),Fy.atLeast(1)),Ci.P.sequenceMap((t,e)=>({storagePath:void 0,listenToChildren:!0,storageProp:[t,...e]}),U_,Fy.many())),F8=Ci.P.sequenceMap((t,e)=>[t,...e],U_,Fy.many()),Iy=Ci.P.sequenceMap((t,e)=>(t.storageProp=t.storageProp.concat(e.flat()),t),N8,Ci.P.string(".").then(F8).many()),_o=Ci.P.sequenceMap((t,e,r)=>(r.storageType=t,r.storagePath=e,r),Ln.describe("storage type").node(Mi).skip(Ci.P.string("^").describe('storage type separator "^"')).optional(),Dl.describe("storage path").node(Mi).skip(Ci.P.string("#").describe('storage/file path separator "#"')).optional(),Iy.describe("property path")).box("bind target");var Gp=Tr(oa()),Ao=Tr(qi());var By=Ao.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),I8=Ao.P.or(zp,By).node(Mi),B8=Ao.P.separateBy(I8,Ao.P.string(",").describe('argument value separator ","').trim(Gp.P_UTILS.optionalWhitespace())),k8=Ao.P.sequenceMap((t,e)=>({name:t,value:e}),Ln.node(Mi),B8.trim(Gp.P_UTILS.optionalWhitespace()).wrap(Ao.P.string("(").describe('argument value paren "("'),Ao.P.string(")").describe('argument value paren ")"')).optional([])),nf=Ao.P.separateBy(k8,Ao.P.string(",").describe('argument separator ","').trim(Gp.P_UTILS.optionalWhitespace()));var zi=Tr(oa()),Fn=Tr(qi());var P8=Fn.P.string("\\").then(zi.P_UTILS.any
`),c=this.mb.file.createLineNumberContext(l,i.position),f=s.evaluate(c);if(f<1||f>u.length)throw new Error("Line number out of bounds");return u=[...u.slice(0,f-1),o,...u.slice(f-1)],u.join(`
`)})}create(){return{type:"insertIntoNote",line:0,value:"Some text",templater:!1}}getActionLabel(){return"Insert text into the note"}};var um=class extends Lr{constructor(e){super("js",e)}async run(e,r,n,i,a){if(!this.mb.getSettings().enableJs)throw new ro({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.mb.internal.jsEngineRunFile(r.file,n,o))()}create(){return{type:"js",file:"",args:{}}}getActionLabel(){return"Run a JavaScript file"}};var Q_=Tr(oa()),Qn=Tr(qi());var K_=Qn.P.sequence(Dl,Qn.P.or(Qn.P.string("#").then(Qn.P.manyNotOf("[]#|:")),Qn.P.string("#").result(void 0),Qn.P.succeed(void 0)),Qn.P.string("|").then(Qn.P.manyNotOf("[]")).optional()),lm=Qn.P.or(Qn.P.sequenceMap((t,e)=>new xu(t!==void 0,e[0],e[1],e[2],!0),Qn.P.string("!").optional(),K_.wrapString("[[","]]")),Qn.P.sequenceMap((t,e,r)=>{let n=!Cl(r);return new xu(t!==void 0,r,void 0,e,n)},Qn.P.string("!").optional(),Qn.P.manyNotOf("[]").wrapString("[","]"),Qn.P.manyNotOf("()").wrapString("(",")"))),X8=Qn.P.separateBy(lm,Qn.P.string(",").trim(Q_.P_UTILS.optionalWhitespace())),xu=class t{constructor(e,r,n,i,a){this.isEmbed=e,this.target=r,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new t(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,r,n){this.internal?e.file.open(this.fullTarget(),r,n):Xp(this.target)}toString(){let e=this.isEmbed?"!":"";if(this.internal){let r=this.alias?`|${this.alias}`:"";return`${e}[[${this.fullTarget()}${r}]]`}else{let r=this.alias??this.fullTarget();return`${e}[${r}](${this.fullTarget()})`}}},vn=class t{static parseLink(e){return on(lm.thenEof(),e)}static parseLinkList(e){return on(X8.thenEof(),e)}static isLink(e){return lm.thenEof().tryParse(e).success}static urlToLink(e){return xu.fromUrl(e)}static parseLinkOrUrl(e){return Cl(e)?t.urlToLink(new URL(e)):t.parseLink(e)}static interpretAsLink(e){let r=lm.thenEof().tryParse(e);if(r.success)return r.value;let n=K_.thenEof().tryParse(e);if(n.success)return new xu(!1,n.value[0],n.value[1],n.value[2],!0);if(Cl(e)){let i=new URL(e);return xu.fromUrl(i)}}};var cm=class extends Lr{constructor(e){super("open",e)}async run(e,r,n,i,a){let o=a.openInNewTab()||(r.newTab??!1),s=vn.interpretAsLink(r.link);if(!s)throw new Error("Invalid link");s.open(this.mb,n,o)}create(){return{type:"open",link:"",newTab:!0}}getActionLabel(){return"Open a link"}};var fm=class extends Lr{constructor(e){super("regexpReplaceInNote",e)}async run(e,r,n,i,a){if(r.regexp==="")throw new Error("Regexp cannot be empty");await this.mb.file.atomicModify(n,o=>o.replace(new RegExp(r.regexp,r.regexpFlags??"g"),r.replacement))}create(){return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"}}getActionLabel(){return"Replace text in note using regexp"}};var pm=class extends Lr{constructor(e){super("replaceInNote",e)}async run(e,r,n,i,a){let o=r.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(r.replacement),n):r.replacement,s=on(uf,r.fromLine.toString()),l=on(uf,r.toLine.toString());await this.mb.file.atomicModify(n,u=>{let c=u.split(`
`),f=this.mb.file.createLineNumberContext(u,i.position),m=s.evaluate(f),p=l.evaluate(f);if(m>p)throw new Error(`Fromline(${m})can't be greater than to line (${p})`);if(m<1)throw new Error(`From line (${m}) can'tsmallerthan1.`);if(p>c.length)throw new Error(`Toline(${p})can'tgreaterthanthefilelength${c.length}.`);return c=[...c.slice(0,m-1),o,...c.slice(p)],c.join(`
`)})}create(){return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace text in note"}};var mm=class extends Lr{constructor(e){super("replaceSelf",e)}async run(e,r,n,i,a){if(i.isInline)throw new Error("Replace self action not supported for inline buttons");if(i.position===void 0)throw new Error("Position of the button in the note is unknown");if(i.position.lineStart>i.position.lineEnd)throw new Error("Position of the button in the note is invalid");let o=i.position,s=r.templater?await this.mb.internal.evaluateTemplaterTemplate(this.mb.file.resolveFilePathLike(r.replacement),n):r.replacement;await this.mb.file.atomicModify(n,l=>{let u=l.split(`
`);if(o.lineStart<0||o.lineEnd>u.length)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,o.lineStart),s,...u.slice(o.lineEnd+1)],u.join(`
`)})}create(){return{type:"replaceSelf",replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace button with text"}};var dm=class extends Lr{constructor(e){super("runTemplaterFile",e)}async run(e,r,n,i,a){let o=this.mb.file.resolveFilePathLike(r.templateFile);await this.mb.internal.evaluateTemplaterTemplate(o,n)}create(){return{type:"runTemplaterFile",templateFile:""}}getActionLabel(){return"Run a templater file"}};var hm=class extends Lr{constructor(e){super("sleep",e)}async run(e,r,n,i,a){await new Promise(o=>setTimeout(o,r.ms))}create(){return{type:"sleep",ms:0}}getActionLabel(){return"Sleep for some time"}};var gm=class extends Lr{constructor(e){super("templaterCreateNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists&&r.fileName){let o=Kp(Qp(r.folderPath??"",r.fileName),"md");if(await this.mb.file.exists(o)){await this.mb.file.open(o,"",!1);return}}await this.mb.internal.createNoteWithTemplater(r.templateFile,r.folderPath,r.fileName,r.openNote,a.openInNewTab())}create(){return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note using Templater"}};function la(t){if(t.toLowerCase()==="null")return null;if(t==="true")return!0;if(t==="false")return!1;{let e=zy.tryParse(t);return e.success?e.value:t}}function dn(t){return t===void 0||t===null?"":typeof t=="string"?t:typeof t=="boolean"?t?"true":"false":t.toString()}function Os(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"}function Ia(t){if(t!=null){if(Os(t))return[t];if(typeof t=="object"&&Array.isArray(t))return t.filter(e=>Os(e))}}function Il(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=zy.tryParse(t);if(e.success)return e.value}}function Do(t){return Os(t)?dn(t):void 0}function Rs(t){return Os(t)?t:void 0}function wu(t,e){return Array.isArray(t)?t.map(r=>Hy(r,e)).filter(r=>r!=="").join(", "):Hy(t,e)}function Hy(t,e){return t==null?e?"":"null":typeof t=="function"?"<function>":typeof t=="object"||Array.isArray(t)?JSON.stringify(t):t.toString()}function t1(t,e){return Array.isArray(t)?t.map(r=>e1(r,e)).filter(r=>r!==""):e1(t,e)}function e1(t,e){return typeof t=="string"?vn.isLink(t)?vn.parseLink(t):Cl(t)?vn.urlToLink(new URL(t)):t:Hy(t,e)}var vm=class extends Lr{constructor(e){super("updateMetadata",e)}async run(e,r,n,i,a){let o=this.mb.bindTargetParser.fromStringAndValidate(r.bindTarget,n);if(r.evaluate){if(!this.mb.getSettings().enableJs)throw new ro({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let s=new Function("x","getMetadata",`return${r.value};`);this.mb.api.updateMetadata(o,l=>s(l,u=>this.mb.api.getMetadata(this.mb.api.parseBindTarget(u,n))))}else this.mb.api.setMetadata(o,la(r.value))}create(){return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""}}getActionLabel(){return"Update metadata"}};var ym=class{constructor(e){this.mb=e,this.actionContexts={command:new nm(e),open:new cm(e),js:new um(e),input:new om(e),sleep:new hm(e),templaterCreateNote:new gm(e),updateMetadata:new vm(e),createNote:new im(e),replaceInNote:new pm(e),replaceSelf:new mm(e),regexpReplaceInNote:new fm(e),insertIntoNote:new sm(e),inlineJS:new am(e),runTemplaterFile:new dm(e)}}createDefaultButtonConfig(){return{label:"This is a button",icon:"",style:"default",class:"",cssStyle:"",backgroundImage:"",tooltip:"",id:"",hidden:!1,actions:[]}}async runButtonActions(e,r,n,i){try{if(e.action)await this.runAction(e,e.action,r,n,i);else if(e.actions)for(let a of e.actions)await this.runAction(e,a,r,n,i);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(a){console.warn("meta-bind | ButtonMDRC >> error while running action",a),this.mb.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){return this.actionContexts[e].create()}async runAction(e,r,n,i,a){let o=r.type;await this.actionContexts[o].run(e,r,n,i,a)}getActionLabel(e){return this.
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function s1(){if(Xe){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function u1(t){if(Xe){let e=new Error(`effect_orphan
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function f1(){if(Xe){let t=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/invalid_snippet")}function p1(t){if(Xe){let e=new Error(`props_invalid_value
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function h1(){if(Xe){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function g1(){if(Xe){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function v1(){if(Xe){let t=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var ns=!1,So=!1;var Vs="[",Us="[!",Du="]",qs={};var In=Symbol(),no=Symbol("filename"),y1=Symbol("hmr"),b1="http://www.w3.org/1999/xhtml";var K8="font-weight: bold",e6="font-weight: normal";function Zy(t){Xe?console.warn(`%c[svelte] state_snapshot_uncloneable
%cThe\`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
%cReactive\`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
OR`,issueSeparator:" AND ",prefix:null,includePath:!1});throw new es({errorLevel:"ERROR",effect:"The validation for the button config failed.",cause:"Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.",positionContext:n.message,docs:[qt.linkToButtonConfig()]})}return r.data}validate(e){let r=new er("Button"),n;try{n=this.validateConfig(e)}catch(i){r.add(i)}return{declarationString:void 0,config:n,errorCollection:r}}};var cc=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(en))e[r]=0;for(let r of this.arguments){let n=r.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new $r({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument'${n.type}'doesnotallowduplicates`,docs:[qt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let r of e.arguments){let n=r.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(r)}return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){let n=r.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new $r({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var Vd=class extends cc{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var fc=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,r){if(r.find(n=>n.length===e.length)===void 0)throw new $r({errorLevel:"WARNING",effect:`Failedtoparseargumentvalueforargument'${this.getConfig().type}'.`,cause:`Expectedargumentvaluestofollowtheform${r.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}.Receivedargumentsoflength${e.length}.`,docs:[qt.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?"all":this.getConfig().allowedFieldTypes.join(", ")}};var yr=class extends fc{};var Ud=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.addLabels}};var qd=class extends yr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Ar.allowOther}};var zd=class extends yr{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Ar.class}};var Hd=class extends yr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=la(r[0].value)}getConfig(){return Ar.defaultValue}};var Gd=class extends yr{constructor(){super(...arguments);this.value=void 0}_parseValue(r){if(this.value=Number.parseInt(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.limit}};var Wd=class extends yr{constructor(){super(...arguments);this.value=100}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new $r({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Ar.maxValue}};var Yd=class
`||(s==="+"?i++:s==="-"?a++:s==="i"||s==="I"?(i+a===0&&bc(),n[o+1]!==" "&&!isNaN(n[o+1])?(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++):r.im+=parseFloat((a%2?"-":"")+"1"),i=a=0):((i+a===0||isNaN(s))&&bc(),n[o+1]==="i"||n[o+1]==="I"?(r.im+=parseFloat((a%2?"-":"")+s),o++):r.re+=parseFloat((a%2?"-":"")+s),i=a=0))}i+a>0&&bc();break;case"number":r.im=0,r.re=t;break;default:bc()}return isNaN(r.re)||isNaN(r.im),r};function Fe(t,e){if(!(this instanceof Fe))return new Fe(t,e);let r=Ju(t,e);this.re=r.re,this.im=r.im}Fe.prototype={re:0,im:0,sign:function(){let t=kx(this.re,this.im);return new Fe(this.re/t,this.im/t)},add:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Fe.NAN:Fe.INFINITY:new Fe(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Fe.NAN:Fe.INFINITY:new Fe(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;return n&&o||i&&a?Fe.NAN:n||i?Fe.INFINITY:r.im===0&&this.im===0?new Fe(this.re*r.re,0):new Fe(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=Ju(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;if(a&&o||n&&i)return Fe.NAN;if(o||n)return Fe.INFINITY;if(a||i)return Fe.ZERO;if(r.im===0)return new Fe(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,l=r.re*s+r.im;return new Fe((this.re*s+this.im)/l,(this.im*s-this.re)/l)}else{let s=r.im/r.re,l=r.im*s+r.re;return new Fe((this.re+this.im*s)/l,(this.im-this.re*s)/l)}},pow:function(t,e){let r=Ju(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return Fe.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new Fe(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new Fe(Math.pow(this.im,r.re),0);case 1:return new Fe(0,Math.pow(this.im,r.re));case 2:return new Fe(-Math.pow(this.im,r.re),0);case 3:return new Fe(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Fe.ZERO;let a=Math.atan2(this.im,this.re),o=Px(this.re,this.im),s=Math.exp(r.re*o-r.im*a),l=r.im*o+r.re*a;return new Fe(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,e=this.im;if(e===0)return t>=0?new Fe(Math.sqrt(t),0):new Fe(0,Math.sqrt(-t));let r=kx(t,e),n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new Fe(n,e<0?-i:i):new Fe(i,e<0?-n:n)},exp:function(){let t=Math.exp(this.re);return this.im===0?new Fe(t,0):new Fe(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new Fe(Math.expm1(t)*Math.cos(e)+$H(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return e===0&&t>0?new Fe(Math.log(t),0):new Fe(Px(t,e),Math.atan2(e,t))},abs:function(){return kx(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new Fe(Math.sin(t)*_i(e),Math.cos(t)*Ga(e))},cos:function(){let t=this.re,e=this.im;return new Fe(Math.cos(t)*_i(e),-Math.sin(t)*Ga(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+_i(e);return new Fe(Math.sin(t)/r,Ga(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-_i(e);return new Fe(-Math.sin(t)/r,Ga(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*_i(2*e)+.5*Math.cos(2*t);return new Fe(Math.cos(t)*_i(e)/r,Math.sin(t)*Ga(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*_i(2*e)-.5*Math.cos(2*t);return new Fe(Math.sin(t)*_i(e)/r,-Math.cos(t)*Ga(e)/r)},asin:function(){let t=this.re,e=this.im,r=new Fe(e*e-t*t+1,-2*t*e).sqrt(),n=new Fe(r.re-e,r.im+t).log();return new Fe(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new Fe(e*e-t*t+1,-2*t*e).sqrt(),n=new Fe(r.re-e,r.im+t).log();return new Fe(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(t===0){if(e===1)return new Fe(0,1/0);if(e===-1)return new Fe(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new Fe((1-e*e-t*t)/r,-2*t/r).log();return new Fe(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(e===0)r
(`+Dt(T,h)+", "+Dt(A,h)+") ==> "+(this._values?Dt(this._values[E],h):"X")}return v},i.prototype.toString=function(){return Dt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(h){if(h){if(ot(h)&&(h=h.toNumber()),!bt(h)||!He(h))throw new TypeError("The parameter k must be an integer number")}else h=0;var b=h>0?h:0,y=h<0?-h:0,D=this._size[0],v=this._size[1],A=Math.min(D-y,v-b),w=[],x=[],E=[];E[0]=0;for(var T=b;T<v&&w.length<A;T++)for(var _=this._ptr[T],C=this._ptr[T+1],N=_;N<C;N++){var I=this._index[N];if(I===T-b+y){w.push(this._values[N]),x[w.length-1]=I-y;break}}return E.push(w.length),new i({values:w,index:x,ptr:E,size:[A,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,b,y,D,v){if(!sr(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(O){if(ot(O)&&(O=O.toNumber()),!bt(O)||!He(O)||O<1)throw new Error("Size values must be positive integers");return O}),y){if(ot(y)&&(y=y.toNumber()),!bt(y)||!He(y))throw new TypeError("The parameter k must be an integer number")}else y=0;var A=r,w=0;Jr(v)&&(A=e.find(r,[v,v])||r,w=e.convert(0,v));var x=y>0?y:0,E=y<0?-y:0,T=h[0],_=h[1],C=Math.min(T-E,_-x),N;if(sr(b)){if(b.length!==C)throw new Error("Invalid value array length");N=function(Q){return b[Q]}}else if(Ye(b)){var I=b.size();if(I.length!==1||I[0]!==C)throw new Error("Invalid matrix length");N=function(Q){return b.get([Q])}}else N=function(){return b};for(var R=[],L=[],V=[],P=0;P<_;P++){V.push(R.length);var k=P-x;if(k>=0&&k<C){var W=N(k);A(W,w)||(L.push(k+E),R.push(W))}}return V.push(R.length),new i({values:R,index:L,ptr:V,size:[T,_]})},i.prototype.swapRows=function(h,b){if(!bt(h)||!He(h)||!bt(b)||!He(b))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Cr(h,this._size[0]),Cr(b,this._size[0]),i._swapRows(h,b,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(h,b,y,D,v){for(var A=D[h],w=D[h+1],x=A;x<w;x++)v(y[x],b[x])},i._swapRows=function(h,b,y,D,v,A){for(var w=0;w<y;w++){var x=A[w],E=A[w+1],T=u(h,x,E,v),_=u(b,x,E,v);if(T<E&&_<E&&v[T]===h&&v[_]===b){if(D){var C=D[T];D[T]=D[_],D[_]=C}continue}if(T<E&&v[T]===h&&(_>=E||v[_]!==b)){var N=D?D[T]:void 0;v.splice(_,0,b),D&&D.splice(_,0,N),v.splice(_<=T?T+1:T,1),D&&D.splice(_<=T?T+1:T,1);continue}if(_<E&&v[_]===b&&(T>=E||v[T]!==h)){var I=D?D[_]:void 0;v.splice(T,0,h),D&&D.splice(T,0,I),v.splice(T<=_?_+1:_,1),D&&D.splice(T<=_?_+1:_,1)}}},i},{isClass:!0});var zG="number",HG=["typed"];function GG(t){var e=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var r={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:t,radix:r,integerPart:n,fractionalPart:i}}else return null}function WG(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is not a valid number');return a}var GE=M(zG,HG,t=>{var{typed:e}=t,r=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=GG(i);if(a)return WG(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>Ke(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var YG="bigint",jG=["typed"],WE=
`)}}return dr(n,"name",Gg),n},{isClass:!0,isNode:!0});var Wg="ConditionalNode",FJ=["Node"],VI=M(Wg,FJ,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ot(i))return!i.isZero();if(Hn(i))return!!(i.re||i.im);if(En(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+ir(i)+'"')}class n extends e{constructor(a,o,s){if(super(),!Gt(a))throw new TypeError("Parameter condition must be a Node");if(!Gt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!Gt(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return Wg}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,m,p){return r(s(f,m,p))?l(f,m,p):u(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.condition.toString(a),u=xr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=xr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var m=this.falseExpr.toString(a),p=xr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m="("+m+")"),l+" ? "+c+" : "+m}toJSON(){return{mathjs:Wg,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=xr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=xr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=xr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=xr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return dr(n,"name",Wg),n},{isClass:!0,isNode:!0});var HI=Tr(qI(),1);var j0={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"
`)+"\\end{array}\\right\\}";return s}}return dr(r,"name",Qg),r},{isClass:!0,isNode:!0});function al(t,e){return new pc(t,new Ks(e),new Set(Object.keys(e)))}var Kg="OperatorNode",LJ=["Node"],JI=M(Kg,LJ,t=>{var{Node:e}=t;function r(a,o){var s=a;if(o==="auto")for(;Wn(s);)s=s.content;return kt(s)?!0:Rr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=xr(a,o,s),f=Pc(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(C){switch(C.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(l.length){case 0:m=[];break;case 1:{var p=xr(l[0],o,s,a);if(u&&p!==null){var d,h;if(o==="keep"?(d=l[0].getIdentifier(),h=a.getIdentifier()):(d=l[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),Xa[c][h].latexLeftParens===!1){m=[!1];break}if(Xa[p][d].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=c){m=[!0];break}m=[!1]}break;case 2:{var b,y=xr(l[0],o,s,a),D=zg(a,l[0],o);y===null?b=!1:y===c&&f==="right"&&!D||y<c?b=!0:b=!1;var v,A=xr(l[1],o,s,a),w=zg(a,l[1],o);if(A===null?v=!1:A===c&&f==="left"&&!w||A<c?v=!0:v=!1,u){var x,E,T;o==="keep"?(x=a.getIdentifier(),E=a.args[0].getIdentifier(),T=a.args[1].getIdentifier()):(x=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),T=a.args[1].getContent().getIdentifier()),y!==null&&(Xa[c][x].latexLeftParens===!1&&(b=!1),Xa[y][E].latexParens===!1&&(b=!1)),A!==null&&(Xa[c][x].latexRightParens===!1&&(v=!1),Xa[A][T].latexParens===!1&&(v=!1))}m=[b,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=l.map(function(C){var N=xr(C,o,s,a),I=zg(a,C,o),R=Pc(C,o);return N===null?!1:c===N&&f===R&&!I?!0:N<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<m.length;++_)r(l[_],o)&&!m[_-1]&&(o!=="keep"||!Wn(l[_-1]))&&(m[_]=!0);return m}class i extends e{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(Gt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Kg}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!yh(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=jr(o,this.fn),u=Wa(this.args,function(d){return d._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(h,b,y){return l(c,o,al(h,b))}}else if(u.length===1){var f=u[0];return function(h,b,y){return l(f(h,b,y))}}else if(u.length===2){var m=u[0],p=u[1];return function(h,b,y){return l(m(h,b,y),p(h,b,y))}}else return function(h,b,y){return l.apply(null,Wa(u,function(D){return D(h,b,y)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=Pc(this,s),m=u[0].toString(o);c[0]&&(m="("+m+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+m:f==="left"?m+(p?" ":"")+this.op:m+this.op}else if(u.length===2){var d=u[0].toString(o),h=u[1].toString(o);return c[0]&&(d="("+d+")"),c[1]&&(h="("+h+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?d+" "+h:d+" "+this.op+" "+h}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="O
`).concat(a(_)))};if(d){var b=this.args;return function(_,C,N){var I=h(_);if(I.rawArgs===!0)return I(b,u,al(_,C));var R=f.map(L=>L(_,C,N));return I(...R)}}else switch(f.length){case 0:return function(_,C,N){var I=h(_);return I()};case 1:return function(_,C,N){var I=h(_),R=f[0];return I(R(_,C,N))};case 2:return function(_,C,N){var I=h(_),R=f[0],L=f[1];return I(R(_,C,N),L(_,C,N))};default:return function(_,C,N){var I=h(_),R=f.map(L=>L(_,C,N));return I(...R)}}}}else if($i(this.fn)&&Xi(this.fn.index)&&this.fn.index.isObjectProperty()){var D=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),A=this.args;return function(_,C,N){var I=D(_,C,N),R=cS(I,v);if(R!=null&&R.rawArgs)return R(A,u,al(_,C));var L=f.map(V=>V(_,C,N));return R.apply(I,L)}}else{var w=this.fn.toString(),x=this.fn._compile(u,c),E=this.args;return function(_,C,N){var I=x(_,C,N);if(typeof I!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
`),i},r.prototype.toJSON=function(){var n=ut(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var hX="Chain",gX=["?on","math","typed"],k2=M(hX,gX,t=>{var{on:e,math:r,typed:n}=t;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");dc(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Dt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){_s(i.prototype,u,function(){var m=c();if(typeof m=="function")return s(m)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(u)){var m=n.resolve(u,c);if(m.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var f=function(d){Ze(u,d)&&l[d]===void 0&&o(d,()=>u[d])};for(var m in u)f(m)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var Q0={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};var P2={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var $2={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};var O2={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};var R2={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var L2={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var V2={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};var U2={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};var q2={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var z2={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var H2={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1+sqrt(5))/2` and is approximately 1.618034...",examples:["phi"],seealso:[]};var K0={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};var G2={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the
Incaseofa(multidimensional)arrayormatrix,theproborderquantileofallelementswillbecalculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var d$={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]};var h$={name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var g$={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]};var v$={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};var y$={name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]};var b$={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};var x$={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x)=ln(sqrt(x^2-1)+x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};var w$={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};var _$={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x)=(ln((x+1)/x)+ln(x/(x-1)))/2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var A$={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};var D$={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x)=ln(1/x+sqrt(1/x^2+1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var S$={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};var E$={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant
`,e.push([i,a])}return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function v4(t){let e=[];for(let r of Object.values(hw))for(let n of r)e.push([n.title,`\`${n.display}\``]);returne.sort((r,n)=>r[0].localeCompare(n[0])),e}functionb4(t,e,r){letn=g4(r),i=v4(r);t.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");leto=a.setSubmenu();o.addItem(s=>{s.setTitle("Input Field");letl=s.setSubmenu();for(let[u,c]ofn)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Av(e,c))})}),o.addItem(s=>{s.setTitle("View Field");letl=s.setSubmenu();for(let[u,c]ofi)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Av(e,c))})}),o.addItem(s=>{s.setTitle("Inline Button"),s.onClick(()=>{Av(e,"`BUTTON[example-id]`")})}),o.addItem(s=>{s.setTitle("Button"),s.onClick(()=>{r.internal.openButtonBuilderModal({onOkay:l=>{Av(e,`\`\`\`meta-bind-button
${(0,y4.stringifyYaml)(l)}
\`\`\``)},submitText:"Insert"})})})})}functionAv(t,e){t.replaceSelection(e)}varL4=require("obsidian");varkn=classextendsvi{constructor(e,r,n){super(),this.mb=e,this.filePath=n,this.uuid=r}getUuid(){returnthis.uuid}getFilePath(){returnthis.filePath}onMount(e){this.mb.mountableManager.registerMountable(this)}onUnmount(e){this.mb.mountableManager.unregisterMountable(this)}};varVc=class{constructor(e){this.scope=e}};varEa=Bt()(he.string()),Uc=Bt()(he.nativeEnum(Ti)),mp=Bt()(he.nativeEnum(_l)),w4=Bt()(he.nativeEnum(Ls)),_4=Bt()(he.instanceof(HTMLElement)),qc=Bt()(he.instanceof(Vc)),rot=Bt()(he.instanceof(hn)),not=Bt()(he.function().args().returns(he.void())),iot=Bt()(he.instanceof(kn)),A4=Bt()(he.instanceof(vi)),D4=Bt()(he.instanceof($s)),x4=Bt()(he.object({index:he.number(),line:he.number(),column:he.number()})),TK=Bt()(he.object({from:x4,to:x4})),cu=Bt()(he.object({value:he.string(),position:TK.optional()})),S4=Bt()(he.object({name:cu,value:cu.array()})),MK=Bt()(he.object({type:he.nativeEnum(bu),prop:cu})),gw=Bt()(he.object({storageType:cu.optional(),storagePath:cu.optional(),storageProp:MK.array(),listenToChildren:he.boolean()})),aot=Bt()(he.object({declarationString:he.string().optional(),inputFieldType:cu.optional(),templateName:cu.optional(),bindTarget:gw.optional(),arguments:S4.array(),errorCollection:he.instanceof(er)})),oot=Bt()(he.object({declarationString:he.string().optional(),templateDeclaration:he.array(he.union([he.string(),gw])).optional(),viewFieldType:cu.optional(),arguments:S4.array(),writeToBindTarget:gw.optional(),errorCollection:he.instanceof(er)})),Sa=Bt()(he.object({storageType:he.string(),storagePath:he.string(),storageProp:he.instanceof(js),listenToChildren:he.boolean()})),E4=Bt()(he.object({name:he.string(),value:he.string().array()})),sot=Bt()(he.object({type:he.nativeEnum(bu),prop:he.string()})),T4=Bt()(he.object({inputFieldType:w4.optional(),templateName:he.string().optional(),bindTarget:Sa.optional(),arguments:E4.array().optional()})),M4=Bt()(he.object({viewFieldType:w4.optional(),templateDeclaration:he.union([he.string(),Sa]).array().optional(),arguments:E4.array().optional(),writeToBindTarget:Sa.optional()})),CK=Bt()(he.object({bindTarget:Sa,name:he.string()})),NK=Bt()(he.object({bindTargetMappings:CK.array(),writeToBindTarget:Sa.optional(),code:he.string()})),FK=Bt()(he.object({referencedButtonIds:he.string().array()})),C4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),T4]),scope:qc.optional()})),N4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),M4]),scope:qc.optional()})),F4=Bt()(he.object({declaration:he.union([he.string(),NK])})),I4=Bt()(he.object({bindTarget:Sa,tableHead:he.string().array(),columns:he.array(he.union([T4,M4,he.string()]))})),B4=Bt()(he.object({renderChildType:Uc,declaration:he.union([he.string(),FK]),position:D4.optional()})),k4=Bt()(he.object({declaration:he.union([he.string(),lc]),position:D4.optional(),isPreview:he.boolean()})),P4=Bt()(he.object({depth:he.number(),content:he.string()}));varBK=(t,e)=>e(t,"left"),kK=se("<button><!> </button>");functiondp(t,e){Se(e,!0);letr=at(e,"variant",19,()=>"default"),n=at(e,"disabled",7,!1),i=at(e,"tooltip",3,""),a=at(e,"label",3,""),o=at(e,"icon",3,""),s=at(e,"cssStyle",3,""),l=at(e,"backgroundImage",3,""),u=at(e,"error",3,!1),c=at(e,"onclick",3,()=>{}),f=at(e,"onauxclick",3,()=>{});asyncfunctionm(v,A){if(!n()){n(!0);try{A==="left"?awaitc()(v):A==="middle"&&awaitf()(v)}catch(w){console.warn("failed to run button component on click",w)}finally{n(!1)}}}varp=kK();letd,h;p.__click=[BK,m];varb=ve(p);{vary=v=>{Or(v,{getmb(){returne.mb},geticonName(){returno()}})};et(b,v=>{o()&&v(y)})}varD=ue(b);le(p),Le(v=>{d=Vr(p,1,"mb-button-inner",null,d,v),h=jl(p,s(),h,{"background-image":l()?`url("${l()}")`:void0}),rt(p,"aria-label",i()),p.disabled=n(),vt(D,`${a()??""}`)},[()=>({"mod-cta":r()==="primary","mod-warning":r()==="destructive","mod-plain":r()==="plain",disabled:n(),"mb-error":u()})]),gi("auxclick",p,v=>m(v,"middle")),K(t,p),Ee()}Mt(["click"]);varfu=classextendsvi{co
`).map(a=>a.trim()).filter(a=>a.length>0);if(e.length===0)return{content:""};if(e.length>1)return{error:"Embed may only contain one link"};let r=e[0],n=vn.parseLink(r);if(!n.internal)return{error:`${r}isnotaninternallink`};let i=this.mb.file.getPathByName(n.target,this.getFilePath());return i===void 0?{error:`"${n.target}"isnotcreatedyet`}:{content:await this.mb.file.read(i)}}exceedsMaxDepth(){return this.depth>_m}createEmbedMessage(e,r){e.createSpan({text:r,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let r=await this.parseContent();if(r.error){this.createEmbedMessage(e,r.error);return}if(r.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=r.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=awaitthis.mb.internal.renderMarkdown(n,e,this.getFilePath())}catch(r){letn=newer("Embed");n.add(r),this.mb.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass("mb-embed"),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass("mb-embed"),this.markdownUnloadCallback?.(),ui(e,"Embed")}};varMv=classextendskn{constructor(e,r,n){super(e,r,n)}onMount(e){super.onMount(e),lt.empty(e),lt.createElement(e,"span",{text:"[META_BIND]Thisfolderhasbeenexcludedinthesettings",class:"mb-error"})}onUnmount(e){super.onUnmount(e),lt.empty(e),ui(e,"Excluded")}};varzc=classextendskn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=newer(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){returnthis.getArguments(e).length>0}getArgument(e){returnthis.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())thrownewLt({errorLevel:"CRITICAL",effect:"cannotretrievearguments",cause:"inputFieldDeclarationhaserrors"});returnthis.declaration.argumentContainer.getAll(e)}getBindTarget(){returnthis.declaration.bindTarget}shouldAddCardContainer(){lete=this.declaration.inputFieldType==="select"||this.declaration.inputFieldType==="multiSelect"||this.declaration.inputFieldType==="list",r=this.hasArgument("showcase")||this.hasArgument("title");returnthis.renderChildType==="block"&&(e||r)}createContainer(e){if(this.shouldAddCardContainer()){letr=lt.createElement(e,"div");lt.addClass(r,"mb-card");letn=this.getArgument("title");returnn&<.createElement(r,"h3",{text:n.value}),r}returne}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){letn=lt.createElement(e,"code",{class:"mb-none"}),i=lt.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=qt.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.mb.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(newLt({errorLevel:"CRITICAL",effect:"can'trenderinputfield",cause:"inputfieldisundefined"}))}createErrorIndicator(e){this.mb.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errorscausedthecreationofthefieldtofail.Sometimesoneerroronlyoccursbecauseofanother.",warningText:"Warningswillnotcausethecreationofafieldtofail,buttheyindicatethatapartofthedeclarationwasinvalidorusesdeprecatedfunctionality.",code:this.declarationString})}onMount(e){if(super.onMount(e),lt.empty(e),lt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}letr=this.createContainer(e);this.createErrorIndicator(r);letn=lt.createElement(r,"div",{class:"mb-input-wrapper"});this.inputField?.mount(n);leti=this.getArguments("class");for(letaofi)lt.addClasses(n,a.value);lt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildTy
`);if(r.at(0)==="---"){for(let n=1;n<r.length;n++)if(r.at(n)==="---")return{lineStart:1,lineEnd:n+1}}}isExcludedFromRendering(e){for(let r of this.mb.getSettings().excludedFolders)if(e.startsWith(r))return!0;return!1}resolveFilePathLike(e,r){let n=vn.isLink(e)?vn.parseLink(e).target:e,i=this.mb.file.getPathByName(n,r);if(i===void 0)throw new to({errorLevel:"ERROR",cause:`Couldnotfindafilethatmatches"${e}".`,effect:`Couldnotresolvepathorlink"${e}"relativeto"${r}".`});return i}createLineNumberContext(e,r){let i=e.split(`
OR`,issueSeparator:" AND ",prefix:null});console.warn(new es({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:D.message,docs:[qt.linkToButtonConfig()]})),console.warn(D),new bp.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}q(n).push(b)}function s(){ke(r,e.modal.save(ft(q(n))),!0),q(r)===void 0&&e.modal.close()}function l(){e.modal.close()}var u=Ste(),c=ue(ve(u),2);Ut(c,17,()=>q(n),Zt,(b,y,D)=>{Gw(b,{get mb(){return e.modal.mb},onDelete:i,get template(){return q(n)[D]},set template(v){q(n)[D]=v}})});var f=ue(c,2);yt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(b,y)=>{_t();var D=Vt("Add Template");K(b,D)},$$slots:{default:!0}});var m=ue(f,2);yt(m,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(b,y)=>{_t();var D=Vt("Add Template from Clipboard");K(b,D)},$$slots:{default:!0}});var p=ue(m,2);{var d=b=>{var y=Ate(),D=ue(ve(y),2);let v=cr(()=>({errorCollection:q(r)}));Fs(D,{get settings(){return q(v)}}),le(y),K(b,y)};et(p,b=>{q(r)&&b(d)})}var h=ue(p,2);Ma(h,{children:(b,y)=>{var D=Dte(),v=We(D);yt(v,{onclick:()=>s(),get variant(){return"primary"},tooltip:"Save changes",children:(w,x)=>{_t();var E=Vt("Save");K(w,E)},$$slots:{default:!0}});var A=ue(v,2);yt(A,{onclick:()=>l(),tooltip:"Revert changes",children:(w,x)=>{_t();var E=Vt("Cancel");K(w,E)},$$slots:{default:!0}}),K(b,D)},$$slots:{default:!0}}),le(u),K(t,u),Ee()}var ey=class extends J4.Modal{constructor(e,r){super(e),this.mb=r}onOpen(){this.contentEl.empty(),this.component&&Dr(this.component),this.component=Br(Ww,{target:this.contentEl,props:{buttonConfigs:structuredClone(this.mb.getSettings().buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Dr(this.component)}save(e){let r=this.mb.buttonManager.setButtonTemplates(e);if(r.hasErrors())return r;this.mb.updateSettings(n=>{n.buttonTemplates=e})}};var X4=require("obsidian");var Ete=se('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),Tte=se('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),Mte=se("<!> <!>",1),Cte=se('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function Yw(t,e){Se(e,!0);let r=it(void 0),n=it(dt(e.excludedFolders));function i(h){ke(n,q(n).filter(b=>b!==h),!0)}function a(){q(n).push("")}function o(){ke(r,e.modal.save(ft(q(n))),!0),q(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=Cte(),u=ve(l),c=ue(ve(u));Ut(c,21,()=>q(n),Zt,(h,b,y)=>{var D=Ete(),v=ve(D),A=ve(v);At(A),le(v);var w=ue(v),x=ve(w);yt(x,{onclick:()=>i(q(b)),tooltip:"Delete",children:(E,T)=>{Or(E,{get mb(){return e.mb},iconName:"x"})},$$slots:{default:!0}}),le(w),le(D),xt(A,()=>q(n)[y],E=>q(n)[y]=E),K(h,D)}),le(c),le(u);var f=ue(u,2);yt(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(h,b)=>{_t();var y=Vt("Add folder");K(h,y)},$$slots:{default:!0}});var m=ue(f,2);{var p=h=>{var b=Tte(),y=ue(ve(b),2);let D=cr(()=>({errorCollection:q(r)}));Fs(y,{get settings(){return q(D)}}),le(b),K(h,b)};et(m,h=>{q(r)&&h(p)})}var d=ue(m,2);Ma(d,{children:(h,b)=>{var y=Mte(),D=We(y);yt(D,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(A,w)=>{_t();var x=Vt("Save");K(A,x)},$$slots:{default:!0}});var v=ue(D,2);yt(v,{onclick:()=>s(),tooltip:"Revert changes",children:(A,w)=>{_t();var x=Vt("Cancel");K(A,x)},$$slots:{default:!0}}),K(h,y)},$$slots:{default:!0}}),le(l),K(t,l),Ee()}var ty=class extends X4.Modal{constructor(e,r){super(e),this.mb=r}onOpen(){this.contentEl.empty(),this.component&&Dr(this.component),this.component=Br(Yw,{target:this.contentEl,props:{excludedFolders:structuredClone(this.mb.getSettings().excludedFolders),modal:this,mb:this.mb}})}onClose(){this.contentEl.empty(),this.component&&D
${(0,zo.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.plugin.addCommand({id:"copy-command-id",name:"Select and copy command id",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){lete=this.plugin.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.plugin.register(()=>e.remove())}if(this.build==="canary"){lete=this.plugin.addStatusBarItem();e.setText("Meta Bind Canary Build (1.4.2)"),e.addClass("mb-error"),this.plugin.register(()=>e.remove())}}asyncactivateView(e){let{workspace:r}=this.app,n,i=r.getLeavesOfType(e);i.length>0?n=i[0]:(n=r.getLeaf("tab"),awaitn.setViewState({type:e,active:!0})),awaitr.revealLeaf(n)}getSettings(){returnthis.plugin.settings}saveSettings(e){this.plugin.settings=e,this.plugin.saveSettings()}},ay=classextendszo.Plugin{asynconload(){console.log("meta-bind | Main >> loading"),console.time("meta-bind | Main >> load-time"),awaitthis.loadSettings(),this.mb=newiy(this),this.api=this.mb.api,this.mb.updateInternalSettings(this.settings),console.timeEnd("meta-bind | Main >> load-time")}onunload(){this.mb.destroy(),console.log("meta-bind | Main >> unload")}asyncloadSettings(){console.log("meta-bind | Main >> loading settings");lete=awaitthis.loadData()??{};typeofe=="object"&&e!=null&&(deletee.inputTemplates,deletee.useUsDateInputOrder),this.settings=Object.assign({},zf,e),rs(e,this.settings)||awaitthis.saveSettings()}asyncsaveSettings(){console.log("meta-bind | Main >> settings save"),awaitthis.saveData(this.settings)}asynconExternalSettingsChange(){awaitthis.loadSettings(),this.mb.updateInternalSettings(this.settings)}};