Oscar Plaisant 44cacee75b update
2024-03-27 15:59:45 +01:00

145 lines
990 KiB
JavaScript

/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://mprojectscode.github.io/)
Time: Tue, 20 Feb 2024 09:14:34 GMT
Version: 0.12.5
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";var z8=Object.create;var Vu=Object.defineProperty;var H8=Object.getOwnPropertyDescriptor;var G8=Object.getOwnPropertyNames;var W8=Object.getPrototypeOf,j8=Object.prototype.hasOwnProperty;var Z8=(r,e,t)=>e in r?Vu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Gr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),J8=(r,e)=>{for(var t in e)Vu(r,t,{get:e[t],enumerable:!0})},bA=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of G8(e))!j8.call(r,i)&&i!==t&&Vu(r,i,{get:()=>e[i],enumerable:!(n=H8(e,i))||n.enumerable});return r};var fr=(r,e,t)=>(t=r!=null?z8(W8(r)):{},bA(e||!r||!r.__esModule?Vu(t,"default",{value:r,enumerable:!0}):t,r)),Y8=r=>bA(Vu({},"__esModule",{value:!0}),r);var Rr=(r,e,t)=>(Z8(r,typeof e!="symbol"?e+"":e,t),t);var Yc=Gr(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.P_HELPERS=Pn.ParserHelpers=Pn.validateRegexFlags=Pn.validateRange=Pn.getIndex=Pn.arrayUnion=void 0;var nh=Xc();function w$(r,e){if(r===void 0&&e===void 0)return;if(r===void 0)return e;if(e===void 0)return r;let t=[...r];for(let n of e)t.includes(n)||t.push(n);return t}Pn.arrayUnion=w$;function _$(r){return r===void 0?-1:r.index}Pn.getIndex=_$;function A$(r,e){if(e<r)throw new Error(`Invalid Range: max might not be smaller than min. Received [${r}, ${e}].`);if(r<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${r}, ${e}].`);if(r===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${r}, ${e}].`);if(!Number.isInteger(r)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${r}, ${e}].`)}Pn.validateRange=A$;function S$(r){for(let e of r)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")throw new Error(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}Pn.validateRegexFlags=S$;var Jc=class{followedBy(e){return new nh.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new nh.Parser(function(n){let i=n.copy(),a=e.p(i),o=n.sliceTo(i.position.index);return a.success?n.fail("not '"+o+"'"):n.succeed(void 0)})}test(e){return new nh.Parser(function(n){let i=n.input[n.position.index];return!n.atEOF()&&e(i)?n.succeedOffset(1,i):n.fail(`a character matching ${e}`)})}};Pn.ParserHelpers=Jc;Pn.P_HELPERS=new Jc});var sE=Gr(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.ParserContext=void 0;var ih=Yc(),ah=class r{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new r(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(){return this.position.index>=this.input.length}advanceTo(e){if(e<this.position.index)throw new Error(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(let t=this.position.index;t<e;t++)this.input[t]===`
`?(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,t){return this.succeedAt(this.position.index+e,t)}failOffset(e,t){return this.failAt(this.position.index+e,t)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t,furthest:void 0,expected:void 0}}failAt(e,t){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(t)?t:[t]}}merge(e,t){if(e===void 0)return t;let n=(0,ih.getIndex)(e.furthest),i=(0,ih.getIndex)(t.furthest);if(i>n)return t;let a=i===n?(0,ih.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};Qc.ParserContext=ah});var Yn=Gr(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.P_UTILS=void 0;var Kc=Xc(),dr=On(),oh=class r{static position(){return new Kc.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Kc.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Kc.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Kc.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return dr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return dr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return dr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return dr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return dr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return dr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return dr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return dr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return dr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return dr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return dr.P.string("\r")}static lf(){return dr.P.string(`
`)}static crlf(){return dr.P.string(`\r
`)}static newline(){return dr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,n){return dr.P.sequenceMap((i,a)=>i.reduce((o,l)=>n(l,o),a),e.many(),t)}static postfix(e,t,n){return dr.P.sequenceMap((i,a)=>a.reduce((o,l)=>n(l,o),i),t,e.many())}static binaryRight(e,t,n){return dr.P.sequenceMap((i,a)=>i.reverse().reduce((o,l)=>{let[u,s]=l;return n(u,s,o)},a),dr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,n){return dr.P.sequenceMap((i,a)=>a.reduce((o,l)=>{let[u,s]=l;return n(o,u,s)},i),t,dr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,n){return dr.P.sequenceMap((i,a,o)=>i.reverse().reduce((l,u)=>{let[s,c,f]=u;return n({from:s,to:o},c,f,l)},a),dr.P.sequence(r.position(),t,e.trim(this.optionalWhitespace())).many(),t,r.position())}static binaryLeftRange(e,t,n){return dr.P.sequenceMap((i,a,o)=>o.reduce((l,u)=>{let[s,c,f]=u;return n({from:i,to:f},l,s,c)},a),r.position(),t,dr.P.sequence(e.trim(this.optionalWhitespace()),t,r.position()).many())}static func(e,t,n){let i=typeof e=="string"?dr.P.string(e):e;return dr.P.sequenceMap((a,o,l,u,s,c)=>n(a,u),i,dr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),dr.P.string(")"))}};ef.P_UTILS=oh});var lE=Gr(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.ParsingError=Ls.createParsingErrorMessage=void 0;function uE(r,e,t){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=r.split(`
`)[e.furthest.line-1],l=`${e.furthest.line} | `;i+=`
${l}${o}`,i+=`
${" ".repeat(e.furthest.column-1+l.length)}^ (${n})`}return i}Ls.createParsingErrorMessage=uE;var sh=class extends Error{constructor(e,t){super(uE(e,t,!0))}};Ls.ParsingError=sh});var Xc=Gr(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.Parser=void 0;var E$=sE(),mi=On(),uh=Yc(),Us=Yn(),D$=lE(),lh=class r{constructor(e){this.p=e}tryParse(e){return this.p(new E$.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new D$.ParsingError(e,t)}or(e){return mi.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(mi.P.string(e))}wrap(e,t){let n=this;return new r(function(a){let o=e.p(a);if(!o.success)return o;let l=a.merge(o,n.p(a));if(!l.success)return l;let u=a.merge(l,t.p(a));return u.success?a.merge(u,a.succeed(l.value)):u})}wrapString(e,t){return this.wrap(mi.P.string(e),mi.P.string(t))}then(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success?i.merge(o,i.succeed(a.value)):o})}and(e){return mi.P.sequence(this,e)}many(){let e=this;return new r(function(n){let i,a=n.position.index,o=[];for(;;){let l=n.copy(),u=e.p(l);if(i=n.merge(i,u),i.success){if(l.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(l.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,t){(0,uh.validateRange)(e,t);let n=this;return new r(function(a){let o,l,u=[],s=0;for(;s<e;s++)if(o=n.p(a),l=a.merge(l,o),o.success)u.push(o.value);else return l;for(;s<t;s++){let c=a.copy();if(o=n.p(c),l=a.merge(l,o),o.success)a.moveToPosition(c.position),u.push(o.value);else break}return a.merge(l,a.succeed(u))})}atMost(e){return this.repeat(0,e)}atLeast(e){return mi.P.sequenceMap((t,n)=>t.concat(n),this.repeat(e,e),this.many())}separateBy(e){return mi.P.separateBy(this,e)}separateByNotEmpty(e){return mi.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new r(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return mi.P.sequenceMap(function(t,n,i){return{value:n,range:{from:t,to:i}}},Us.P_UTILS.position(),this,Us.P_UTILS.position())}namedMarker(e){return mi.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},Us.P_UTILS.position(),this,Us.P_UTILS.position())}node(e){return mi.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},Us.P_UTILS.position(),this,Us.P_UTILS.position())}followedBy(e){return this.skip(uh.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(uh.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new r(function(i){let a=t.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let t=this;return new r(function(i){var a;let o=t.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=[`(${(a=o.expected)===null||a===void 0?void 0:a.join(" or ")} as part of ${e})`]),o})}optional(e){return this.or(mi.P.succeed(e))}chain(e){let t=this;return new r(function(i){let a=t.p(i);if(!a.success)return a;let l=e(a.value).p(i);return i.merge(a,l)})}thenEof(){let e=this;return new r(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,t="",n=new Map,i=new Map;return new r(function(o){let l=o.position.index;if(o.input!==t)t=o.input,n.clear(),i.clear();else{let s=n.get(l),c=i.get(l);if(s!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},s)}let u=e.p(o);return n.set(l,Object.assign({},u)),i.set(l,o.getPosition()),u})}};tf.Parser=lh});var On=Gr(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.P=void 0;var Xn=Xc(),rf=Yc(),ch=class r{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Xn.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let u=e[o].p(n);if(i=n.merge(i,u),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...t){if(t.length===0)throw new Error("sequenceMap must have at least one parser argument");return new Xn.Parser(function(i){let a,o=new Array(t.length);for(let l=0;l<t.length;l++){let s=t[l].p(i);if(a=i.merge(a,s),!a.success)return a;o[l]=a.value}return a.value=e(...o),a})}static createLanguage(e){let t={},n={},i={};for(let a in e)i[a]=r.reference(()=>e[a](t,i)),Object.defineProperty(n,a,{get:()=>{if(t[a]!==void 0)return t[a];throw new Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let a in e)t[a]=e[a](n,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Xn.Parser(function(n){let i;for(let a of e){let o=a,l=n.copy(),u=o.p(l);if(i=n.merge(i,u),i.success)return n.moveToPosition(l.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(r.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,t.then(e).many())}static string(e){let t="'"+e+"'";return new Xn.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(t);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,t){(0,rf.validateRegexFlags)(e.flags);let n=e.source;return t!==void 0?new Xn.Parser(function(a){let o=a.input.slice(a.position.index),l=e.exec(o);if(l!==null){let u=t!=null?t:0;if(u>=0&&u<=l.length){let c=l[0],f=l[u];return a.succeedOffset(c.length,f)}let s="expected valid match group (0 to "+l.length+") in "+n;return a.fail(s)}else return a.fail(n)}):new Xn.Parser(function(a){let o=a.input.slice(a.position.index),l=e.exec(o);if(l!==null){let u=l[0];return a.succeedOffset(u.length,u)}else return a.fail(n)})}static succeed(e){return new Xn.Parser(function(n){return n.succeed(e)})}static fail(e){return new Xn.Parser(function(n){return n.fail(e)})}static oneOf(e){return rf.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return rf.P_HELPERS.test(function(n){return!e.includes(n)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(t=>this.string(t))).describe(e.map(t=>`'${t}'`).join(" or "))}static manyOf(e){return new Xn.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 Xn.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 Xn.Parser(e)}static range(e,t){let n=e.charCodeAt(0),i=t.charCodeAt(0);return rf.P_HELPERS.test(function(o){let l=o.charCodeAt(0);return n<=l&&l<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new Xn.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e(n.input[i]);)i++;return n.succeedAt(i,n.input.slice(n.position.index,i))})}static reference(e){return new Xn.Parser(function(n){return e().p(n)})}};nf.P=ch});var Qh=Gr((Yh,Xh)=>{(function(r,e){typeof Yh=="object"&&typeof Xh!="undefined"?Xh.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis!="undefined"?globalThis:r||self,r["'typed'"]=e())})(Yh,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function o(Y){return typeof Y=="object"&&Y!==null&&Y.constructor===Object}let l=[{name:"number",test:function(Y){return typeof Y=="number"}},{name:"string",test:function(Y){return typeof Y=="string"}},{name:"boolean",test:function(Y){return typeof Y=="boolean"}},{name:"Function",test:function(Y){return typeof Y=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(Y){return Y instanceof Date}},{name:"RegExp",test:function(Y){return Y instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(Y){return Y===null}},{name:"undefined",test:function(Y){return Y===void 0}}],u={name:"any",test:r,isAny:!0},s,c,f=0,p={createCount:0};function m(Y){let oe=s.get(Y);if(oe)return oe;let pe='Unknown type "'+Y+'"',Ee=Y.toLowerCase(),Fe;for(Fe of c)if(Fe.toLowerCase()===Ee){pe+='. Did you mean "'+Fe+'" ?';break}throw new TypeError(pe)}function h(Y){let oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",pe=oe?m(oe).index:c.length,Ee=[];for(let Ne=0;Ne<Y.length;++Ne){if(!Y[Ne]||typeof Y[Ne].name!="string"||typeof Y[Ne].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Te=Y[Ne].name;if(s.has(Te))throw new TypeError('Duplicate type name "'+Te+'"');Ee.push(Te),s.set(Te,{name:Te,test:Y[Ne].test,isAny:Y[Ne].isAny,index:pe+Ne,conversionsTo:[]})}let Fe=c.slice(pe);c=c.slice(0,pe).concat(Ee).concat(Fe);for(let Ne=pe+Ee.length;Ne<c.length;++Ne)s.get(c[Ne]).index=Ne}function d(){s=new Map,c=[],f=0,h([u],!1)}d(),h(l);function g(){let Y;for(Y of c)s.get(Y).conversionsTo=[];f=0}function v(Y){let oe=c.filter(pe=>{let Ee=s.get(pe);return!Ee.isAny&&Ee.test(Y)});return oe.length?oe:["any"]}function w(Y){return Y&&typeof Y=="function"&&"_typedFunctionData"in Y}function y(Y,oe,pe){if(!w(Y))throw new TypeError(n);let Ee=pe&&pe.exact,Fe=Array.isArray(oe)?oe.join(","):oe,Ne=S(Fe),Te=b(Ne);if(!Ee||Te in Y.signatures){let ce=Y._typedFunctionData.signatureMap.get(Te);if(ce)return ce}let Re=Ne.length,C;if(Ee){C=[];let ce;for(ce in Y.signatures)C.push(Y._typedFunctionData.signatureMap.get(ce))}else C=Y._typedFunctionData.signatures;for(let ce=0;ce<Re;++ce){let Ce=Ne[ce],rt=[],ut;for(ut of C){let gr=R(ut.params,ce);if(!(!gr||Ce.restParam&&!gr.restParam)){if(!gr.hasAny){let Gn=A(gr);if(Ce.types.some(Ni=>!Gn.has(Ni.name)))continue}rt.push(ut)}}if(C=rt,C.length===0)break}let q;for(q of C)if(q.params.length<=Re)return q;throw new TypeError("Signature not found (signature: "+(Y.name||"unnamed")+"("+b(Ne,", ")+"))")}function x(Y,oe,pe){return y(Y,oe,pe).implementation}function _(Y,oe){let pe=m(oe);if(pe.test(Y))return Y;let Ee=pe.conversionsTo;if(Ee.length===0)throw new Error("There are no conversions to "+oe+" defined.");for(let Fe=0;Fe<Ee.length;Fe++)if(m(Ee[Fe].from).test(Y))return Ee[Fe].convert(Y);throw new Error("Cannot convert "+Y+" to "+oe)}function b(Y){let oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return Y.map(pe=>pe.name).join(oe)}function E(Y){let oe=Y.indexOf("...")===0,Ee=(oe?Y.length>3?Y.slice(3):"any":Y).split("|").map(Re=>m(Re.trim())),Fe=!1,Ne=oe?"...":"";return{types:Ee.map(function(Re){return Fe=Re.isAny||Fe,Ne+=Re.name+"|",{name:Re.name,typeIndex:Re.index,test:Re.test,isAny:Re.isAny,conversion:null,conversionIndex:-1}}),name:Ne.slice(0,-1),hasAny:Fe,hasConversion:!1,restParam:oe}}function D(Y){let oe=Y.types.map(Te=>Te.name),pe=L(oe),Ee=Y.hasAny,Fe=Y.name,Ne=pe.map(function(Te){let Re=m(Te.from);return Ee=Re.isAny||Ee,Fe+="|"+Te.from,{name:Te.from,typeIndex:Re.index,test:Re.test,isAny:Re.isAny,conversion:Te,conversionIndex:Te.index}});return{types:Y.types.concat(Ne),name:Fe,hasAny:Ee,hasConversion:Ne.length>0,restParam:Y.restParam}}function A(Y){return Y.typeSet||(Y.typeSet=new Set,Y.types.forEach(oe=>Y.typeSet.add(oe.name))),Y.typeSet}function S(Y){let oe=[];if(typeof Y!="string")throw new TypeError("Signatures must be strings");let pe=Y.trim();if(pe==="")return oe;let Ee=pe.split(",");for(let Fe=0;Fe<Ee.length;++Fe){let Ne=E(Ee[Fe].trim());if(Ne.restParam&&Fe!==Ee.length-1)throw new SyntaxError('Unexpected rest parameter "'+Ee[Fe]+'": only allowed for the last parameter');if(Ne.types.length===0)return null;oe.push(Ne)}return oe}function M(Y){let oe=V(Y);return oe?oe.restParam:!1}function F(Y){if(!Y||Y.types.length===0)return r;if(Y.types.length===1)return m(Y.types[0].name).test;if(Y.types.length===2){let oe=m(Y.types[0].name).test,pe=m(Y.types[1].name).test;return function(Fe){return oe(Fe)||pe(Fe)}}else{let oe=Y.types.map(function(pe){return m(pe.name).test});return function(Ee){for(let Fe=0;Fe<oe.length;Fe++)if(oe[Fe](Ee))return!0;return!1}}}function P(Y){let oe,pe,Ee;if(M(Y)){oe=Se(Y).map(F);let Fe=oe.length,Ne=F(V(Y)),Te=function(Re){for(let C=Fe;C<Re.length;C++)if(!Ne(Re[C]))return!1;return!0};return function(C){for(let q=0;q<oe.length;q++)if(!oe[q](C[q]))return!1;return Te(C)&&C.length>=Fe+1}}else return Y.length===0?function(Ne){return Ne.length===0}:Y.length===1?(pe=F(Y[0]),function(Ne){return pe(Ne[0])&&Ne.length===1}):Y.length===2?(pe=F(Y[0]),Ee=F(Y[1]),function(Ne){return pe(Ne[0])&&Ee(Ne[1])&&Ne.length===2}):(oe=Y.map(F),function(Ne){for(let Te=0;Te<oe.length;Te++)if(!oe[Te](Ne[Te]))return!1;return Ne.length===oe.length})}function R(Y,oe){return oe<Y.length?Y[oe]:M(Y)?V(Y):null}function O(Y,oe){let pe=R(Y,oe);return pe?A(pe):new Set}function I(Y){return Y.conversion===null||Y.conversion===void 0}function T(Y,oe){let pe=new Set;return Y.forEach(Ee=>{let Fe=O(Ee.params,oe),Ne;for(Ne of Fe)pe.add(Ne)}),pe.has("any")?["any"]:Array.from(pe)}function $(Y,oe,pe){let Ee,Fe,Ne=Y||"unnamed",Te=pe,Re;for(Re=0;Re<oe.length;Re++){let Ce=[];if(Te.forEach(rt=>{let ut=R(rt.params,Re),gr=F(ut);(Re<rt.params.length||M(rt.params))&&gr(oe[Re])&&Ce.push(rt)}),Ce.length===0){if(Fe=T(Te,Re),Fe.length>0){let rt=v(oe[Re]);return Ee=new TypeError("Unexpected type of argument in function "+Ne+" (expected: "+Fe.join(" or ")+", actual: "+rt.join(" | ")+", index: "+Re+")"),Ee.data={category:"wrongType",fn:Ne,index:Re,actual:rt,expected:Fe},Ee}}else Te=Ce}let C=Te.map(function(Ce){return M(Ce.params)?1/0:Ce.params.length});if(oe.length<Math.min.apply(null,C))return Fe=T(Te,Re),Ee=new TypeError("Too few arguments in function "+Ne+" (expected: "+Fe.join(" or ")+", index: "+oe.length+")"),Ee.data={category:"tooFewArgs",fn:Ne,index:oe.length,expected:Fe},Ee;let q=Math.max.apply(null,C);if(oe.length>q)return Ee=new TypeError("Too many arguments in function "+Ne+" (expected: "+q+", actual: "+oe.length+")"),Ee.data={category:"tooManyArgs",fn:Ne,index:oe.length,expectedLength:q},Ee;let ce=[];for(let Ce=0;Ce<oe.length;++Ce)ce.push(v(oe[Ce]).join("|"));return Ee=new TypeError('Arguments of type "'+ce.join(", ")+'" do not match any of the defined signatures of function '+Ne+"."),Ee.data={category:"mismatch",actual:ce},Ee}function B(Y){let oe=c.length+1;for(let pe=0;pe<Y.types.length;pe++)I(Y.types[pe])&&(oe=Math.min(oe,Y.types[pe].typeIndex));return oe}function U(Y){let oe=f+1;for(let pe=0;pe<Y.types.length;pe++)I(Y.types[pe])||(oe=Math.min(oe,Y.types[pe].conversionIndex));return oe}function G(Y,oe){if(Y.hasAny){if(!oe.hasAny)return 1}else if(oe.hasAny)return-1;if(Y.restParam){if(!oe.restParam)return 1}else if(oe.restParam)return-1;if(Y.hasConversion){if(!oe.hasConversion)return 1}else if(oe.hasConversion)return-1;let pe=B(Y)-B(oe);if(pe<0)return-1;if(pe>0)return 1;let Ee=U(Y)-U(oe);return Ee<0?-1:Ee>0?1:0}function H(Y,oe){let pe=Y.params,Ee=oe.params,Fe=V(pe),Ne=V(Ee),Te=M(pe),Re=M(Ee);if(Te&&Fe.hasAny){if(!Re||!Ne.hasAny)return 1}else if(Re&&Ne.hasAny)return-1;let C=0,q=0,ce;for(ce of pe)ce.hasAny&&++C,ce.hasConversion&&++q;let Ce=0,rt=0;for(ce of Ee)ce.hasAny&&++Ce,ce.hasConversion&&++rt;if(C!==Ce)return C-Ce;if(Te&&Fe.hasConversion){if(!Re||!Ne.hasConversion)return 1}else if(Re&&Ne.hasConversion)return-1;if(q!==rt)return q-rt;if(Te){if(!Re)return 1}else if(Re)return-1;let ut=(pe.length-Ee.length)*(Te?-1:1);if(ut!==0)return ut;let gr=[],Gn=0;for(let gs=0;gs<pe.length;++gs){let cc=G(pe[gs],Ee[gs]);gr.push(cc),Gn+=cc}if(Gn!==0)return Gn;let Ni;for(Ni of gr)if(Ni!==0)return Ni;return 0}function L(Y){if(Y.length===0)return[];let oe=Y.map(m);Y.length>1&&oe.sort((Fe,Ne)=>Fe.index-Ne.index);let pe=oe[0].conversionsTo;if(Y.length===1)return pe;pe=pe.concat([]);let Ee=new Set(Y);for(let Fe=1;Fe<oe.length;++Fe){let Ne;for(Ne of oe[Fe].conversionsTo)Ee.has(Ne.from)||(pe.push(Ne),Ee.add(Ne.from))}return pe}function ae(Y,oe){let pe=oe;if(Y.some(Fe=>Fe.hasConversion)){let Fe=M(Y),Ne=Y.map(ve);pe=function(){let Re=[],C=Fe?arguments.length-1:arguments.length;for(let q=0;q<C;q++)Re[q]=Ne[q](arguments[q]);return Fe&&(Re[C]=arguments[C].map(Ne[C])),oe.apply(this,Re)}}let Ee=pe;if(M(Y)){let Fe=Y.length-1;Ee=function(){return pe.apply(this,X(arguments,0,Fe).concat([X(arguments,Fe)]))}}return Ee}function ve(Y){let oe,pe,Ee,Fe,Ne=[],Te=[];switch(Y.types.forEach(function(Re){Re.conversion&&(Ne.push(m(Re.conversion.from).test),Te.push(Re.conversion.convert))}),Te.length){case 0:return function(C){return C};case 1:return oe=Ne[0],Ee=Te[0],function(C){return oe(C)?Ee(C):C};case 2:return oe=Ne[0],pe=Ne[1],Ee=Te[0],Fe=Te[1],function(C){return oe(C)?Ee(C):pe(C)?Fe(C):C};default:return function(C){for(let q=0;q<Te.length;q++)if(Ne[q](C))return Te[q](C);return C}}}function se(Y){function oe(pe,Ee,Fe){if(Ee<pe.length){let Ne=pe[Ee],Te=[];if(Ne.restParam){let Re=Ne.types.filter(I);Re.length<Ne.types.length&&Te.push({types:Re,name:"..."+Re.map(C=>C.name).join("|"),hasAny:Re.some(C=>C.isAny),hasConversion:!1,restParam:!0}),Te.push(Ne)}else Te=Ne.types.map(function(Re){return{types:[Re],name:Re.name,hasAny:Re.isAny,hasConversion:Re.conversion,restParam:!1}});return W(Te,function(Re){return oe(pe,Ee+1,Fe.concat([Re]))})}else return[Fe]}return oe(Y,0,[])}function le(Y,oe){let pe=Math.max(Y.length,oe.length);for(let Re=0;Re<pe;Re++){let C=O(Y,Re),q=O(oe,Re),ce=!1,Ce;for(Ce of q)if(C.has(Ce)){ce=!0;break}if(!ce)return!1}let Ee=Y.length,Fe=oe.length,Ne=M(Y),Te=M(oe);return Ne?Te?Ee===Fe:Fe>=Ee:Te?Ee>=Fe:Ee===Fe}function he(Y){return Y.map(oe=>qe(oe)?ge(oe.referToSelf.callback):ye(oe)?ie(oe.referTo.references,oe.referTo.callback):oe)}function K(Y,oe,pe){let Ee=[],Fe;for(Fe of Y){let Ne=pe[Fe];if(typeof Ne!="number")throw new TypeError('No definition for referenced signature "'+Fe+'"');if(Ne=oe[Ne],typeof Ne!="function")return!1;Ee.push(Ne)}return Ee}function ne(Y,oe,pe){let Ee=he(Y),Fe=new Array(Ee.length).fill(!1),Ne=!0;for(;Ne;){Ne=!1;let Te=!0;for(let Re=0;Re<Ee.length;++Re){if(Fe[Re])continue;let C=Ee[Re];if(qe(C))Ee[Re]=C.referToSelf.callback(pe),Ee[Re].referToSelf=C.referToSelf,Fe[Re]=!0,Te=!1;else if(ye(C)){let q=K(C.referTo.references,Ee,oe);q?(Ee[Re]=C.referTo.callback.apply(this,q),Ee[Re].referTo=C.referTo,Fe[Re]=!0,Te=!1):Ne=!0}}if(Te&&Ne)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Ee}function me(Y){let oe=/\bthis(\(|\.signatures\b)/;Object.keys(Y).forEach(pe=>{let Ee=Y[pe];if(oe.test(Ee.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function de(Y,oe){if(p.createCount++,Object.keys(oe).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&me(oe);let pe=[],Ee=[],Fe={},Ne=[],Te;for(Te in oe){if(!Object.prototype.hasOwnProperty.call(oe,Te))continue;let cr=S(Te);if(!cr)continue;pe.forEach(function(Uu){if(le(Uu,cr))throw new TypeError('Conflicting signatures "'+b(Uu)+'" and "'+b(cr)+'".')}),pe.push(cr);let In=Ee.length;Ee.push(oe[Te]);let $8=cr.map(D),fc;for(fc of se($8)){let Uu=b(fc);Ne.push({params:fc,name:Uu,fn:In}),fc.every(q8=>!q8.hasConversion)&&(Fe[Uu]=In)}}Ne.sort(H);let Re=ne(Ee,Fe,Lu),C;for(C in Fe)Object.prototype.hasOwnProperty.call(Fe,C)&&(Fe[C]=Re[Fe[C]]);let q=[],ce=new Map;for(C of Ne)ce.has(C.name)||(C.fn=Re[C.fn],q.push(C),ce.set(C.name,C));let Ce=q[0]&&q[0].params.length<=2&&!M(q[0].params),rt=q[1]&&q[1].params.length<=2&&!M(q[1].params),ut=q[2]&&q[2].params.length<=2&&!M(q[2].params),gr=q[3]&&q[3].params.length<=2&&!M(q[3].params),Gn=q[4]&&q[4].params.length<=2&&!M(q[4].params),Ni=q[5]&&q[5].params.length<=2&&!M(q[5].params),gs=Ce&&rt&&ut&&gr&&Gn&&Ni;for(let cr=0;cr<q.length;++cr)q[cr].test=P(q[cr].params);let cc=Ce?F(q[0].params[0]):e,m8=rt?F(q[1].params[0]):e,d8=ut?F(q[2].params[0]):e,h8=gr?F(q[3].params[0]):e,g8=Gn?F(q[4].params[0]):e,v8=Ni?F(q[5].params[0]):e,y8=Ce?F(q[0].params[1]):e,b8=rt?F(q[1].params[1]):e,x8=ut?F(q[2].params[1]):e,w8=gr?F(q[3].params[1]):e,_8=Gn?F(q[4].params[1]):e,A8=Ni?F(q[5].params[1]):e;for(let cr=0;cr<q.length;++cr)q[cr].implementation=ae(q[cr].params,q[cr].fn);let S8=Ce?q[0].implementation:t,E8=rt?q[1].implementation:t,D8=ut?q[2].implementation:t,N8=gr?q[3].implementation:t,C8=Gn?q[4].implementation:t,M8=Ni?q[5].implementation:t,T8=Ce?q[0].params.length:-1,F8=rt?q[1].params.length:-1,I8=ut?q[2].params.length:-1,B8=gr?q[3].params.length:-1,P8=Gn?q[4].params.length:-1,O8=Ni?q[5].params.length:-1,k8=gs?6:0,R8=q.length,L8=q.map(cr=>cr.test),U8=q.map(cr=>cr.implementation),V8=function(){for(let In=k8;In<R8;In++)if(L8[In](arguments))return U8[In].apply(this,arguments);return p.onMismatch(Y,arguments,q)};function Lu(cr,In){return arguments.length===T8&&cc(cr)&&y8(In)?S8.apply(this,arguments):arguments.length===F8&&m8(cr)&&b8(In)?E8.apply(this,arguments):arguments.length===I8&&d8(cr)&&x8(In)?D8.apply(this,arguments):arguments.length===B8&&h8(cr)&&w8(In)?N8.apply(this,arguments):arguments.length===P8&&g8(cr)&&_8(In)?C8.apply(this,arguments):arguments.length===O8&&v8(cr)&&A8(In)?M8.apply(this,arguments):V8.apply(this,arguments)}try{Object.defineProperty(Lu,"name",{value:Y})}catch(cr){}return Lu.signatures=Fe,Lu._typedFunctionData={signatures:q,signatureMap:ce},Lu}function Oe(Y,oe,pe){throw $(Y,oe,pe)}function Se(Y){return X(Y,0,Y.length-1)}function V(Y){return Y[Y.length-1]}function X(Y,oe,pe){return Array.prototype.slice.call(Y,oe,pe)}function fe(Y,oe){for(let pe=0;pe<Y.length;pe++)if(oe(Y[pe]))return Y[pe]}function W(Y,oe){return Array.prototype.concat.apply([],Y.map(oe))}function te(){let Y=Se(arguments).map(pe=>b(S(pe))),oe=V(arguments);if(typeof oe!="function")throw new TypeError("Callback function expected as last argument");return ie(Y,oe)}function ie(Y,oe){return{referTo:{references:Y,callback:oe}}}function ge(Y){if(typeof Y!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:Y}}}function ye(Y){return Y&&typeof Y.referTo=="object"&&Array.isArray(Y.referTo.references)&&typeof Y.referTo.callback=="function"}function qe(Y){return Y&&typeof Y.referToSelf=="object"&&typeof Y.referToSelf.callback=="function"}function De(Y,oe){if(!Y)return oe;if(oe&&oe!==Y){let pe=new Error("Function names do not match (expected: "+Y+", actual: "+oe+")");throw pe.data={actual:oe,expected:Y},pe}return Y}function ft(Y){let oe;for(let pe in Y)Object.prototype.hasOwnProperty.call(Y,pe)&&(w(Y[pe])||typeof Y[pe].signature=="string")&&(oe=De(oe,Y[pe].name));return oe}function wt(Y,oe){let pe;for(pe in oe)if(Object.prototype.hasOwnProperty.call(oe,pe)){if(pe in Y&&oe[pe]!==Y[pe]){let Ee=new Error('Signature "'+pe+'" is defined twice');throw Ee.data={signature:pe,sourceFunction:oe[pe],destFunction:Y[pe]},Ee}Y[pe]=oe[pe]}}let jt=p;p=function(Y){let oe=typeof Y=="string",pe=oe?1:0,Ee=oe?Y:"",Fe={};for(let Ne=pe;Ne<arguments.length;++Ne){let Te=arguments[Ne],Re={},C;if(typeof Te=="function"?(C=Te.name,typeof Te.signature=="string"?Re[Te.signature]=Te:w(Te)&&(Re=Te.signatures)):o(Te)&&(Re=Te,oe||(C=ft(Te))),Object.keys(Re).length===0){let q=new TypeError("Argument to 'typed' at index "+Ne+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw q.data={index:Ne,argument:Te},q}oe||(Ee=De(Ee,C)),wt(Fe,Re)}return de(Ee||"",Fe)},p.create=i,p.createCount=jt.createCount,p.onMismatch=Oe,p.throwMismatchError=Oe,p.createError=$,p.clear=d,p.clearConversions=g,p.addTypes=h,p._findType=m,p.referTo=te,p.referToSelf=ge,p.convert=_,p.findSignature=y,p.find=x,p.isTypedFunction=w,p.warnAgainstDeprecatedThis=!0,p.addType=function(Y,oe){let pe="any";oe!==!1&&s.has("Object")&&(pe="Object"),p.addTypes([Y],pe)};function nr(Y){if(!Y||typeof Y.from!="string"||typeof Y.to!="string"||typeof Y.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(Y.to===Y.from)throw new SyntaxError('Illegal to define conversion from "'+Y.from+'" to itself.')}return p.addConversion=function(Y){nr(Y);let oe=m(Y.to);if(oe.conversionsTo.every(function(pe){return pe.from!==Y.from}))oe.conversionsTo.push({from:Y.from,convert:Y.convert,index:f++});else throw new Error('There is already a conversion from "'+Y.from+'" to "'+oe.name+'"')},p.addConversions=function(Y){Y.forEach(p.addConversion)},p.removeConversion=function(Y){nr(Y);let oe=m(Y.to),pe=fe(oe.conversionsTo,Fe=>Fe.from===Y.from);if(!pe)throw new Error("Attempt to remove nonexistent conversion from "+Y.from+" to "+Y.to);if(pe.convert!==Y.convert)throw new Error("Conversion to remove does not match existing conversion");let Ee=oe.conversionsTo.indexOf(pe);oe.conversionsTo.splice(Ee,1)},p.resolve=function(Y,oe){if(!w(Y))throw new TypeError(n);let pe=Y._typedFunctionData.signatures;for(let Ee=0;Ee<pe.length;++Ee)if(pe[Ee].test(oe))return pe[Ee];return null},p}var a=i();return a})});var WN=Gr((wg,GN)=>{(function(r){"use strict";var e=Math.cosh||function(s){return Math.abs(s)<1e-9?1-s:(Math.exp(s)+Math.exp(-s))*.5},t=Math.sinh||function(s){return Math.abs(s)<1e-9?s:(Math.exp(s)-Math.exp(-s))*.5},n=function(s){var c=Math.PI/4;if(-c>s||s>c)return Math.cos(s)-1;var f=s*s;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(s,c){var f=Math.abs(s),p=Math.abs(c);return f<3e3&&p<3e3?Math.sqrt(f*f+p*p):(f<p?(f=p,p=s/c):p=c/s,f*Math.sqrt(1+p*p))},a=function(){throw SyntaxError("Invalid Param")};function o(s,c){var f=Math.abs(s),p=Math.abs(c);return s===0?Math.log(p):c===0?Math.log(f):f<3e3&&p<3e3?Math.log(s*s+c*c)*.5:(s=s/2,c=c/2,.5*Math.log(s*s+c*c)+Math.LN2)}var l=function(s,c){var f={re:0,im:0};if(s==null)f.re=f.im=0;else if(c!==void 0)f.re=s,f.im=c;else switch(typeof s){case"object":if("im"in s&&"re"in s)f.re=s.re,f.im=s.im;else if("abs"in s&&"arg"in s){if(!Number.isFinite(s.abs)&&Number.isFinite(s.arg))return u.INFINITY;f.re=s.abs*Math.cos(s.arg),f.im=s.abs*Math.sin(s.arg)}else if("r"in s&&"phi"in s){if(!Number.isFinite(s.r)&&Number.isFinite(s.phi))return u.INFINITY;f.re=s.r*Math.cos(s.phi),f.im=s.r*Math.sin(s.phi)}else s.length===2?(f.re=s[0],f.im=s[1]):a();break;case"string":f.im=f.re=0;var p=s.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),m=1,h=0;p===null&&a();for(var d=0;d<p.length;d++){var g=p[d];g===" "||g===" "||g===`
`||(g==="+"?m++:g==="-"?h++:g==="i"||g==="I"?(m+h===0&&a(),p[d+1]!==" "&&!isNaN(p[d+1])?(f.im+=parseFloat((h%2?"-":"")+p[d+1]),d++):f.im+=parseFloat((h%2?"-":"")+"1"),m=h=0):((m+h===0||isNaN(g))&&a(),p[d+1]==="i"||p[d+1]==="I"?(f.im+=parseFloat((h%2?"-":"")+g),d++):f.re+=parseFloat((h%2?"-":"")+g),m=h=0))}m+h>0&&a();break;case"number":f.im=0,f.re=s;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function u(s,c){if(!(this instanceof u))return new u(s,c);var f=l(s,c);this.re=f.re,this.im=f.im}u.prototype={re:0,im:0,sign:function(){var s=this.abs();return new u(this.re/s,this.im/s)},add:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re+f.re,this.im+f.im)},sub:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:new u(this.re-f.re,this.im-f.im)},mul:function(s,c){var f=new u(s,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?u.NAN:this.isInfinite()||f.isInfinite()?u.INFINITY:f.im===0&&this.im===0?new u(this.re*f.re,0):new u(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(s,c){var f=new u(s,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return u.NAN;if(this.isInfinite()||f.isZero())return u.INFINITY;if(this.isZero()||f.isInfinite())return u.ZERO;s=this.re,c=this.im;var p=f.re,m=f.im,h,d;return m===0?new u(s/p,c/p):Math.abs(p)<Math.abs(m)?(d=p/m,h=p*d+m,new u((s*d+c)/h,(c*d-s)/h)):(d=m/p,h=m*d+p,new u((s+c*d)/h,(c-s*d)/h))},pow:function(s,c){var f=new u(s,c);if(s=this.re,c=this.im,f.isZero())return u.ONE;if(f.im===0){if(c===0&&s>0)return new u(Math.pow(s,f.re),0);if(s===0)switch((f.re%4+4)%4){case 0:return new u(Math.pow(c,f.re),0);case 1:return new u(0,Math.pow(c,f.re));case 2:return new u(-Math.pow(c,f.re),0);case 3:return new u(0,-Math.pow(c,f.re))}}if(s===0&&c===0&&f.re>0&&f.im>=0)return u.ZERO;var p=Math.atan2(c,s),m=o(s,c);return s=Math.exp(f.re*m-f.im*p),c=f.im*m+f.re*p,new u(s*Math.cos(c),s*Math.sin(c))},sqrt:function(){var s=this.re,c=this.im,f=this.abs(),p,m;if(s>=0){if(c===0)return new u(Math.sqrt(s),0);p=.5*Math.sqrt(2*(f+s))}else p=Math.abs(c)/Math.sqrt(2*(f-s));return s<=0?m=.5*Math.sqrt(2*(f-s)):m=Math.abs(c)/Math.sqrt(2*(f+s)),new u(p,c<0?-m:m)},exp:function(){var s=Math.exp(this.re);return this.im,new u(s*Math.cos(this.im),s*Math.sin(this.im))},expm1:function(){var s=this.re,c=this.im;return new u(Math.expm1(s)*Math.cos(c)+n(c),Math.exp(s)*Math.sin(c))},log:function(){var s=this.re,c=this.im;return c===0&&s>0,new u(o(s,c),Math.atan2(c,s))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var s=this.re,c=this.im;return new u(Math.sin(s)*e(c),Math.cos(s)*t(c))},cos:function(){var s=this.re,c=this.im;return new u(Math.cos(s)*e(c),-Math.sin(s)*t(c))},tan:function(){var s=2*this.re,c=2*this.im,f=Math.cos(s)+e(c);return new u(Math.sin(s)/f,t(c)/f)},cot:function(){var s=2*this.re,c=2*this.im,f=Math.cos(s)-e(c);return new u(-Math.sin(s)/f,t(c)/f)},sec:function(){var s=this.re,c=this.im,f=.5*e(2*c)+.5*Math.cos(2*s);return new u(Math.cos(s)*e(c)/f,Math.sin(s)*t(c)/f)},csc:function(){var s=this.re,c=this.im,f=.5*e(2*c)-.5*Math.cos(2*s);return new u(Math.sin(s)*e(c)/f,-Math.cos(s)*t(c)/f)},asin:function(){var s=this.re,c=this.im,f=new u(c*c-s*s+1,-2*s*c).sqrt(),p=new u(f.re-c,f.im+s).log();return new u(p.im,-p.re)},acos:function(){var s=this.re,c=this.im,f=new u(c*c-s*s+1,-2*s*c).sqrt(),p=new u(f.re-c,f.im+s).log();return new u(Math.PI/2-p.im,p.re)},atan:function(){var s=this.re,c=this.im;if(s===0){if(c===1)return new u(0,1/0);if(c===-1)return new u(0,-1/0)}var f=s*s+(1-c)*(1-c),p=new u((1-c*c-s*s)/f,-2*s/f).log();return new u(-.5*p.im,.5*p.re)},acot:function(){var s=this.re,c=this.im;if(c===0)return new u(Math.atan2(1,s),0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).atan():new u(s!==0?s/0:0,c!==0?-c/0:0).atan()},asec:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(0,1/0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).acos():new u(s!==0?s/0:0,c!==0?-c/0:0).acos()},acsc:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(Math.PI/2,1/0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).asin():new u(s!==0?s/0:0,c!==0?-c/0:0).asin()},sinh:function(){var s=this.re,c=this.im;return new u(t(s)*Math.cos(c),e(s)*Math.sin(c))},cosh:function(){var s=this.re,c=this.im;return new u(e(s)*Math.cos(c),t(s)*Math.sin(c))},tanh:function(){var s=2*this.re,c=2*this.im,f=e(s)+Math.cos(c);return new u(t(s)/f,Math.sin(c)/f)},coth:function(){var s=2*this.re,c=2*this.im,f=e(s)-Math.cos(c);return new u(t(s)/f,-Math.sin(c)/f)},csch:function(){var s=this.re,c=this.im,f=Math.cos(2*c)-e(2*s);return new u(-2*t(s)*Math.cos(c)/f,2*e(s)*Math.sin(c)/f)},sech:function(){var s=this.re,c=this.im,f=Math.cos(2*c)+e(2*s);return new u(2*e(s)*Math.cos(c)/f,-2*t(s)*Math.sin(c)/f)},asinh:function(){var s=this.im;this.im=-this.re,this.re=s;var c=this.asin();return this.re=-this.im,this.im=s,s=c.re,c.re=-c.im,c.im=s,c},acosh:function(){var s=this.acos();if(s.im<=0){var c=s.re;s.re=-s.im,s.im=c}else{var c=s.im;s.im=-s.re,s.re=c}return s},atanh:function(){var s=this.re,c=this.im,f=s>1&&c===0,p=1-s,m=1+s,h=p*p+c*c,d=h!==0?new u((m*p-c*c)/h,(c*p+m*c)/h):new u(s!==-1?s/0:0,c!==0?c/0:0),g=d.re;return d.re=o(d.re,d.im)/2,d.im=Math.atan2(d.im,g)/2,f&&(d.im=-d.im),d},acoth:function(){var s=this.re,c=this.im;if(s===0&&c===0)return new u(0,Math.PI/2);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).atanh():new u(s!==0?s/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var s=this.re,c=this.im;if(c===0)return new u(s!==0?Math.log(s+Math.sqrt(s*s+1)):1/0,0);var f=s*s+c*c;return f!==0?new u(s/f,-c/f).asinh():new u(s!==0?s/0:0,c!==0?-c/0:0).asinh()},asech:function(){var s=this.re,c=this.im;if(this.isZero())return u.INFINITY;var f=s*s+c*c;return f!==0?new u(s/f,-c/f).acosh():new u(s!==0?s/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return u.INFINITY;if(this.isInfinite())return u.ZERO;var s=this.re,c=this.im,f=s*s+c*c;return new u(s/f,-c/f)},conjugate:function(){return new u(this.re,-this.im)},neg:function(){return new u(-this.re,-this.im)},ceil:function(s){return s=Math.pow(10,s||0),new u(Math.ceil(this.re*s)/s,Math.ceil(this.im*s)/s)},floor:function(s){return s=Math.pow(10,s||0),new u(Math.floor(this.re*s)/s,Math.floor(this.im*s)/s)},round:function(s){return s=Math.pow(10,s||0),new u(Math.round(this.re*s)/s,Math.round(this.im*s)/s)},equals:function(s,c){var f=new u(s,c);return Math.abs(f.re-this.re)<=u.EPSILON&&Math.abs(f.im-this.im)<=u.EPSILON},clone:function(){return new u(this.re,this.im)},toString:function(){var s=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(s)<u.EPSILON&&(s=0),Math.abs(c)<u.EPSILON&&(c=0),c===0?f+s:(s!==0?(f+=s,f+=" ",c<0?(c=-c,f+="-"):f+="+",f+=" "):c<0&&(c=-c,f+="-"),c!==1&&(f+=c),f+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},u.ZERO=new u(0,0),u.ONE=new u(1,0),u.I=new u(0,1),u.PI=new u(Math.PI,0),u.E=new u(Math.E,0),u.INFINITY=new u(1/0,1/0),u.NAN=new u(NaN,NaN),u.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return u}):typeof wg=="object"?(Object.defineProperty(u,"__esModule",{value:!0}),u.default=u,u.Complex=u,GN.exports=u):r.Complex=u})(wg)});var ZN=Gr((Ag,jN)=>{(function(r){"use strict";var e=2e3,t={s:1,n:0,d:1};function n(d,g){if(isNaN(d=parseInt(d,10)))throw m();return d*g}function i(d,g){if(g===0)throw p();var v=Object.create(f.prototype);v.s=d<0?-1:1,d=d<0?-d:d;var w=c(d,g);return v.n=d/w,v.d=g/w,v}function a(d){for(var g={},v=d,w=2,y=4;y<=v;){for(;v%w===0;)v/=w,g[w]=(g[w]||0)+1;y+=1+2*w++}return v!==d?v>1&&(g[v]=(g[v]||0)+1):g[d]=(g[d]||0)+1,g}var o=function(d,g){var v=0,w=1,y=1,x=0,_=0,b=0,E=1,D=1,A=0,S=1,M=1,F=1,P=1e7,R;if(d!=null)if(g!==void 0){if(v=d,w=g,y=v*w,v%1!==0||w%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)v=d.n,w=d.d,"s"in d&&(v*=d.s);else if(0 in d)v=d[0],1 in d&&(w=d[1]);else throw m();y=v*w;break}case"number":{if(d<0&&(y=d,d=-d),d%1===0)v=d;else if(d>0){for(d>=1&&(D=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=D);S<=P&&F<=P;)if(R=(A+M)/(S+F),d===R){S+F<=P?(v=A+M,w=S+F):F>S?(v=M,w=F):(v=A,w=S);break}else d>R?(A+=M,S+=F):(M+=A,F+=S),S>P?(v=M,w=F):(v=A,w=S);v*=D}else(isNaN(d)||isNaN(g))&&(w=v=NaN);break}case"string":{if(S=d.match(/\d+|./g),S===null)throw m();if(S[A]==="-"?(y=-1,A++):S[A]==="+"&&A++,S.length===A+1?_=n(S[A++],y):S[A+1]==="."||S[A]==="."?(S[A]!=="."&&(x=n(S[A++],y)),A++,(A+1===S.length||S[A+1]==="("&&S[A+3]===")"||S[A+1]==="'"&&S[A+3]==="'")&&(_=n(S[A],y),E=Math.pow(10,S[A].length),A++),(S[A]==="("&&S[A+2]===")"||S[A]==="'"&&S[A+2]==="'")&&(b=n(S[A+1],y),D=Math.pow(10,S[A+1].length)-1,A+=3)):S[A+1]==="/"||S[A+1]===":"?(_=n(S[A],y),E=n(S[A+2],1),A+=3):S[A+3]==="/"&&S[A+1]===" "&&(x=n(S[A],y),_=n(S[A+2],y),E=n(S[A+4],1),A+=5),S.length<=A){w=E*D,y=v=b+w*x+D*_;break}}default:throw m()}if(w===0)throw p();t.s=y<0?-1:1,t.n=Math.abs(v),t.d=Math.abs(w)};function l(d,g,v){for(var w=1;g>0;d=d*d%v,g>>=1)g&1&&(w=w*d%v);return w}function u(d,g){for(;g%2===0;g/=2);for(;g%5===0;g/=5);if(g===1)return 0;for(var v=10%g,w=1;v!==1;w++)if(v=v*10%g,w>e)return 0;return w}function s(d,g,v){for(var w=1,y=l(10,v,g),x=0;x<300;x++){if(w===y)return x;w=w*10%g,y=y*10%g}return 0}function c(d,g){if(!d)return g;if(!g)return d;for(;;){if(d%=g,!d)return g;if(g%=d,!g)return d}}function f(d,g){if(o(d,g),this instanceof f)d=c(t.d,t.n),this.s=t.s,this.n=t.n/d,this.d=t.d/d;else return i(t.s*t.n,t.d)}var p=function(){return new Error("Division by Zero")},m=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(d,g){return o(d,g),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(d,g){return o(d,g),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(d,g){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(d===void 0)return i(this.s*this.n%this.d,1);if(o(d,g),t.n===0&&this.d===0)throw p();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(d,g){return o(d,g),i(c(t.n,this.n)*c(t.d,this.d),t.d*this.d)},lcm:function(d,g){return o(d,g),t.n===0&&this.n===0?i(0,1):i(t.n*this.n,c(t.n,this.n)*c(t.d,this.d))},ceil:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(d*this.s*this.n/this.d),d)},floor:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(d*this.s*this.n/this.d),d)},round:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(d*this.s*this.n/this.d),d)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(d,g){if(o(d,g),t.d===1)return t.s<0?i(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):i(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var v=a(this.n),w=a(this.d),y=1,x=1;for(var _ in v)if(_!=="1"){if(_==="0"){y=0;break}if(v[_]*=t.n,v[_]%t.d===0)v[_]/=t.d;else return null;y*=Math.pow(_,v[_])}for(var _ in w)if(_!=="1"){if(w[_]*=t.n,w[_]%t.d===0)w[_]/=t.d;else return null;x*=Math.pow(_,w[_])}return t.s<0?i(x,y):i(y,x)},equals:function(d,g){return o(d,g),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(d,g){o(d,g);var v=this.s*this.n*t.d-t.s*t.n*this.d;return(0<v)-(v<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var g=this.abs(),v=g.toContinued(),w=1;w<v.length;w++){for(var y=i(v[w-1],1),x=w-2;x>=0;x--)y=y.inverse().add(v[x]);if(Math.abs(y.sub(g).valueOf())<d)return y.mul(this.s)}return this},divisible:function(d,g){return o(d,g),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(d){var g,v="",w=this.n,y=this.d;return this.s<0&&(v+="-"),y===1?v+=w:(d&&(g=Math.floor(w/y))>0&&(v+=g,v+=" ",w%=y),v+=w,v+="/",v+=y),v},toLatex:function(d){var g,v="",w=this.n,y=this.d;return this.s<0&&(v+="-"),y===1?v+=w:(d&&(g=Math.floor(w/y))>0&&(v+=g,w%=y),v+="\\frac{",v+=w,v+="}{",v+=y,v+="}"),v},toContinued:function(){var d,g=this.n,v=this.d,w=[];if(isNaN(g)||isNaN(v))return w;do w.push(Math.floor(g/v)),d=g%v,g=v,v=d;while(g!==1);return w},toString:function(d){var g=this.n,v=this.d;if(isNaN(g)||isNaN(v))return"NaN";d=d||15;var w=u(g,v),y=s(g,v,w),x=this.s<0?"-":"";if(x+=g/v|0,g%=v,g*=10,g&&(x+="."),w){for(var _=y;_--;)x+=g/v|0,g%=v,g*=10;x+="(";for(var _=w;_--;)x+=g/v|0,g%=v,g*=10;x+=")"}else for(var _=d;g&&_--;)x+=g/v|0,g%=v,g*=10;return x}},typeof Ag=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,jN.exports=f):r.Fraction=f})(Ag)});var lT=Gr((g_e,uT)=>{uT.exports=function r(e,t){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,l=/^0/,u=function(y){return r.insensitive&&(""+y).toLowerCase()||""+y},s=u(e).replace(i,"")||"",c=u(t).replace(i,"")||"",f=s.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(s.match(o),16)||f.length!==1&&s.match(a)&&Date.parse(s),h=parseInt(c.match(o),16)||m&&c.match(a)&&Date.parse(c)||null,d,g;if(h){if(m<h)return-1;if(m>h)return 1}for(var v=0,w=Math.max(f.length,p.length);v<w;v++){if(d=!(f[v]||"").match(l)&&parseFloat(f[v])||f[v]||0,g=!(p[v]||"").match(l)&&parseFloat(p[v])||p[v]||0,isNaN(d)!==isNaN(g))return isNaN(d)?1:-1;if(typeof d!=typeof g&&(d+="",g+=""),d<g)return-1;if(d>g)return 1}return 0}});var p2=Gr((BNe,f2)=>{"use strict";var Gb=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},aZ={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},oZ={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},sZ=function(e,t){return Gb({},e,t)};f2.exports=function(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,n=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?sZ:i,o=String(r),l="",u=a(Gb({},aZ),n?Gb({},oZ):{}),s=Object.keys(u),c=function(){var p=!1;s.forEach(function(m,h){p||o.length>=m.length&&o.slice(0,m.length)===m&&(l+=u[s[h]],o=o.slice(m.length,o.length),p=!0)}),p||(l+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return l}});var qO=Gr(($O,Wx)=>{(function(r,e,t){function n(l){var u=this,s=o();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=s(" "),u.s1=s(" "),u.s2=s(" "),u.s0-=s(l),u.s0<0&&(u.s0+=1),u.s1-=s(l),u.s1<0&&(u.s1+=1),u.s2-=s(l),u.s2<0&&(u.s2+=1),s=null}function i(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function a(l,u){var s=new n(l),c=u&&u.state,f=s.next;return f.int32=function(){return s.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,s),f.state=function(){return i(s,{})}),f}function o(){var l=4022871197,u=function(s){s=String(s);for(var c=0;c<s.length;c++){l+=s.charCodeAt(c);var f=.02519603282416938*l;l=f>>>0,f-=l,f*=l,l=f>>>0,f-=l,l+=f*4294967296}return(l>>>0)*23283064365386963e-26};return u}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.alea=a})($O,typeof Wx=="object"&&Wx,typeof define=="function"&&define)});var HO=Gr((zO,jx)=>{(function(r,e,t){function n(o){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var c=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^c^c>>>8},o===(o|0)?l.x=o:u+=o;for(var s=0;s<u.length+64;s++)l.x^=u.charCodeAt(s)|0,l.next()}function i(o,l){return l.x=o.x,l.y=o.y,l.z=o.z,l.w=o.w,l}function a(o,l){var u=new n(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor128=a})(zO,typeof jx=="object"&&jx,typeof define=="function"&&define)});var WO=Gr((GO,Zx)=>{(function(r,e,t){function n(o){var l=this,u="";l.next=function(){var c=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(c^c<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,o===(o|0)?l.x=o:u+=o;for(var s=0;s<u.length+64;s++)l.x^=u.charCodeAt(s)|0,s==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function i(o,l){return l.x=o.x,l.y=o.y,l.z=o.z,l.w=o.w,l.v=o.v,l.d=o.d,l}function a(o,l){var u=new n(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorwow=a})(GO,typeof Zx=="object"&&Zx,typeof define=="function"&&define)});var ZO=Gr((jO,Jx)=>{(function(r,e,t){function n(o){var l=this;l.next=function(){var s=l.x,c=l.i,f,p,m;return f=s[c],f^=f>>>7,p=f^f<<24,f=s[c+1&7],p^=f^f>>>10,f=s[c+3&7],p^=f^f>>>3,f=s[c+4&7],p^=f^f<<7,f=s[c+7&7],f=f^f<<13,p^=f^f<<9,s[c]=p,l.i=c+1&7,p};function u(s,c){var f,p,m=[];if(c===(c|0))p=m[0]=c;else for(c=""+c,f=0;f<c.length;++f)m[f&7]=m[f&7]<<15^c.charCodeAt(f)+m[f+1&7]<<13;for(;m.length<8;)m.push(0);for(f=0;f<8&&m[f]===0;++f);for(f==8?p=m[7]=-1:p=m[f],s.x=m,s.i=0,f=256;f>0;--f)s.next()}u(l,o)}function i(o,l){return l.x=o.x.slice(),l.i=o.i,l}function a(o,l){o==null&&(o=+new Date);var u=new n(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(s.x&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorshift7=a})(jO,typeof Jx=="object"&&Jx,typeof define=="function"&&define)});var YO=Gr((JO,Yx)=>{(function(r,e,t){function n(o){var l=this;l.next=function(){var s=l.w,c=l.X,f=l.i,p,m;return l.w=s=s+1640531527|0,m=c[f+34&127],p=c[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=c[f]=m^p,l.i=f,m+(s^s>>>16)|0};function u(s,c){var f,p,m,h,d,g=[],v=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,v=Math.max(v,c.length)),m=0,h=-32;h<v;++h)c&&(p^=c.charCodeAt((h+32)%c.length)),h===0&&(d=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,h>=0&&(d=d+1640531527|0,f=g[h&127]^=p+d,m=f==0?m+1:0);for(m>=128&&(g[(c&&c.length||0)&127]=-1),m=127,h=4*128;h>0;--h)p=g[m+34&127],f=g[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,g[m]=p^f;s.w=d,s.X=g,s.i=m}u(l,o)}function i(o,l){return l.i=o.i,l.w=o.w,l.X=o.X.slice(),l}function a(o,l){o==null&&(o=+new Date);var u=new n(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(s.X&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor4096=a})(JO,typeof Yx=="object"&&Yx,typeof define=="function"&&define)});var QO=Gr((XO,Xx)=>{(function(r,e,t){function n(o){var l=this,u="";l.next=function(){var c=l.b,f=l.c,p=l.d,m=l.a;return c=c<<25^c>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-c|0,l.b=c=c<<20^c>>>12^f,l.c=f=f-p|0,l.d=p<<16^f>>>16^m,l.a=m-c|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,o===Math.floor(o)?(l.a=o/4294967296|0,l.b=o|0):u+=o;for(var s=0;s<u.length+20;s++)l.b^=u.charCodeAt(s)|0,l.next()}function i(o,l){return l.a=o.a,l.b=o.b,l.c=o.c,l.d=o.d,l}function a(o,l){var u=new n(o),s=l&&l.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var f=u.next()>>>11,p=(u.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=u.next,c.quick=c,s&&(typeof s=="object"&&i(s,u),c.state=function(){return i(u,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.tychei=a})(XO,typeof Xx=="object"&&Xx,typeof define=="function"&&define)});var ek=Gr((KO,ym)=>{(function(r,e,t){var n=256,i=6,a=52,o="random",l=t.pow(n,i),u=t.pow(2,a),s=u*2,c=n-1,f;function p(y,x,_){var b=[];x=x==!0?{entropy:!0}:x||{};var E=g(d(x.entropy?[y,w(e)]:y==null?v():y,3),b),D=new m(b),A=function(){for(var S=D.g(i),M=l,F=0;S<u;)S=(S+F)*n,M*=n,F=D.g(1);for(;S>=s;)S/=2,M/=2,F>>>=1;return(S+F)/M};return A.int32=function(){return D.g(4)|0},A.quick=function(){return D.g(4)/4294967296},A.double=A,g(w(D.S),e),(x.pass||_||function(S,M,F,P){return P&&(P.S&&h(P,D),S.state=function(){return h(D,{})}),F?(t[o]=S,M):S})(A,E,"global"in x?x.global:this==t,x.state)}function m(y){var x,_=y.length,b=this,E=0,D=b.i=b.j=0,A=b.S=[];for(_||(y=[_++]);E<n;)A[E]=E++;for(E=0;E<n;E++)A[E]=A[D=c&D+y[E%_]+(x=A[E])],A[D]=x;(b.g=function(S){for(var M,F=0,P=b.i,R=b.j,O=b.S;S--;)M=O[P=c&P+1],F=F*n+O[c&(O[P]=O[R=c&R+M])+(O[R]=M)];return b.i=P,b.j=R,F})(n)}function h(y,x){return x.i=y.i,x.j=y.j,x.S=y.S.slice(),x}function d(y,x){var _=[],b=typeof y,E;if(x&&b=="object")for(E in y)try{_.push(d(y[E],x-1))}catch(D){}return _.length?_:b=="string"?y:y+"\0"}function g(y,x){for(var _=y+"",b,E=0;E<_.length;)x[c&E]=c&(b^=x[c&E]*19)+_.charCodeAt(E++);return w(x)}function v(){try{var y;return f&&(y=f.randomBytes)?y=y(n):(y=new Uint8Array(n),(r.crypto||r.msCrypto).getRandomValues(y)),w(y)}catch(b){var x=r.navigator,_=x&&x.plugins;return[+new Date,r,_,r.screen,w(e)]}}function w(y){return String.fromCharCode.apply(0,y)}if(g(t.random(),e),typeof ym=="object"&&ym.exports){ym.exports=p;try{f=require("crypto")}catch(y){}}else typeof define=="function"&&define.amd?define(function(){return p}):t["seed"+o]=p})(typeof self!="undefined"?self:KO,[],Math)});var rk=Gr((Q4e,tk)=>{var SJ=qO(),EJ=HO(),DJ=WO(),NJ=ZO(),CJ=YO(),MJ=QO(),us=ek();us.alea=SJ;us.xor128=EJ;us.xorwow=DJ;us.xorshift7=NJ;us.xor4096=CJ;us.tychei=MJ;tk.exports=us});var JX={};J8(JX,{MetaBindBuild:()=>th,default:()=>xd});module.exports=Y8(JX);var Ru=require("obsidian");var jr=require("obsidian");var xA=["January","February","March","April","May","June","July","August","September","October","November","December"],Co=[{index:0,name:"Sunday",shortName:"Su"},{index:1,name:"Monday",shortName:"Mo"},{index:2,name:"Tuesday",shortName:"Tu"},{index:3,name:"Wednesday",shortName:"We"},{index:4,name:"Thursday",shortName:"Th"},{index:5,name:"Friday",shortName:"Fr"},{index:6,name:"Saturday",shortName:"Sa"}],Ci={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",useUsDateInputOrder:!1,firstWeekday:Co[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"],inputTemplates:void 0};var rS=require("obsidian");function Me(){}function X8(r,e){for(let t in e)r[t]=e[t];return r}function wd(r){return r()}function mc(){return Object.create(null)}function ot(r){r.forEach(wd)}function dc(r){return typeof r=="function"}function Ve(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}var pc;function vs(r,e){return r===e?!0:(pc||(pc=document.createElement("a")),pc.href=e,r===pc.href)}function wA(r){return Object.keys(r).length===0}function Mi(r,e,t,n){if(r){let i=_A(r,e,t,n);return r[0](i)}}function _A(r,e,t,n){return r[1]&&n?X8(t.ctx.slice(),r[1](n(e))):t.ctx}function Ti(r,e,t,n){if(r[2]&&n){let i=r[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){let a=[],o=Math.max(e.dirty.length,i.length);for(let l=0;l<o;l+=1)a[l]=e.dirty[l]|i[l];return a}return e.dirty|i}return e.dirty}function Fi(r,e,t,n,i,a){if(i){let o=_A(e,t,n,a);r.p(o,i)}}function Ii(r){if(r.ctx.length>32){let e=[],t=r.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}var $u=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var hc=class r{constructor(e){Rr(this,"_listeners","WeakMap"in $u?new WeakMap:void 0);Rr(this,"_observer");Rr(this,"options");this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(t=>{var n;for(let i of t)r.entries.set(i.target,i),(n=this._listeners.get(i.target))==null||n(i)})}};hc.entries="WeakMap"in $u?new WeakMap:void 0;var AA=!1;function SA(){AA=!0}function EA(){AA=!1}function z(r,e){r.appendChild(e)}function en(r,e,t){let n=DA(r);if(!n.getElementById(e)){let i=Z("style");i.id=e,i.textContent=t,eU(n,i)}}function DA(r){if(!r)return document;let e=r.getRootNode?r.getRootNode():r.ownerDocument;return e&&e.host?e:r.ownerDocument}function eU(r,e){return z(r.head||r,e),e.sheet}function J(r,e,t){r.insertBefore(e,t||null)}function j(r){r.parentNode&&r.parentNode.removeChild(r)}function At(r,e){for(let t=0;t<r.length;t+=1)r[t]&&r[t].d(e)}function Z(r){return document.createElement(r)}function Wn(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Ie(r){return document.createTextNode(r)}function ue(){return Ie(" ")}function pr(){return Ie("")}function Ae(r,e,t,n){return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function k(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function ui(r){return r===""?null:+r}function NA(r){return Array.from(r.childNodes)}function Ke(r,e){e=""+e,r.data!==e&&(r.data=e)}function Ye(r,e){r.value=e==null?"":e}function Mo(r,e,t,n){t==null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function Fr(r,e,t){for(let n=0;n<r.options.length;n+=1){let i=r.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(r.selectedIndex=-1)}function jn(r){let e=r.querySelector(":checked");return e&&e.__value}function St(r,e,t){r.classList.toggle(e,!!t)}function gc(r,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(r,{detail:e,bubbles:t,cancelable:n})}function CA(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Ia;function la(r){Ia=r}function vc(){if(!Ia)throw new Error("Function called outside component initialization");return Ia}function sn(r){vc().$$.on_mount.push(r)}function To(r){vc().$$.on_destroy.push(r)}function Fo(){let r=vc();return(e,t,{cancelable:n=!1}={})=>{let i=r.$$.callbacks[e];if(i){let a=gc(e,t,{cancelable:n});return i.slice().forEach(o=>{o.call(r,a)}),!a.defaultPrevented}return!0}}function MA(r,e){let t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var Io=[];var Ir=[],bs=[],Ad=[],oU=Promise.resolve(),Sd=!1;function TA(){Sd||(Sd=!0,oU.then(yc))}function tn(r){bs.push(r)}function Ba(r){Ad.push(r)}var _d=new Set,ys=0;function yc(){if(ys!==0)return;let r=Ia;do{try{for(;ys<Io.length;){let e=Io[ys];ys++,la(e),sU(e.$$)}}catch(e){throw Io.length=0,ys=0,e}for(la(null),Io.length=0,ys=0;Ir.length;)Ir.pop()();for(let e=0;e<bs.length;e+=1){let t=bs[e];_d.has(t)||(_d.add(t),t())}bs.length=0}while(Io.length);for(;Ad.length;)Ad.pop()();Sd=!1,_d.clear(),la(r)}function sU(r){if(r.fragment!==null){r.update(),ot(r.before_update);let e=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,e),r.after_update.forEach(tn)}}function FA(r){let e=[],t=[];bs.forEach(n=>r.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),bs=e}var bc=new Set,Bo;function pt(){Bo={r:0,c:[],p:Bo}}function mt(){Bo.r||ot(Bo.c),Bo=Bo.p}function ee(r,e){r&&r.i&&(bc.delete(r),r.i(e))}function re(r,e,t,n){if(r&&r.o){if(bc.has(r))return;bc.add(r),Bo.c.push(()=>{bc.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function We(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function IA(r,e){r.d(1),e.delete(r.key)}function xc(r,e){re(r,1,1,()=>{e.delete(r.key)})}function xs(r,e,t,n,i,a,o,l,u,s,c,f){let p=r.length,m=a.length,h=p,d={};for(;h--;)d[r[h].key]=h;let g=[],v=new Map,w=new Map,y=[];for(h=m;h--;){let E=f(i,a,h),D=t(E),A=o.get(D);A?n&&y.push(()=>A.p(E,e)):(A=s(D,E),A.c()),v.set(D,g[h]=A),D in d&&w.set(D,Math.abs(h-d[D]))}let x=new Set,_=new Set;function b(E){ee(E,1),E.m(l,c),o.set(E.key,E),c=E.first,m--}for(;p&&m;){let E=g[m-1],D=r[p-1],A=E.key,S=D.key;E===D?(c=E.first,p--,m--):v.has(S)?!o.has(A)||x.has(A)?b(E):_.has(S)?p--:w.get(A)>w.get(S)?(_.add(A),b(E)):(x.add(S),p--):(u(D,o),p--)}for(;p--;){let E=r[p];v.has(E.key)||u(E,o)}for(;m;)b(g[m-1]);return ot(y),g}var uU=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],lU=new Set([...uU]);function Pa(r,e,t){let n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function we(r){r&&r.c()}function be(r,e,t){let{fragment:n,after_update:i}=r.$$;n&&n.m(e,t),tn(()=>{let a=r.$$.on_mount.map(wd).filter(dc);r.$$.on_destroy?r.$$.on_destroy.push(...a):ot(a),r.$$.on_mount=[]}),i.forEach(tn)}function xe(r,e){let t=r.$$;t.fragment!==null&&(FA(t.after_update),ot(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function fU(r,e){r.$$.dirty[0]===-1&&(Io.push(r),TA(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<<e%31}function $e(r,e,t,n,i,a,o=null,l=[-1]){let u=Ia;la(r);let s=r.$$={fragment:null,ctx:[],props:a,update:Me,not_equal:i,bound:mc(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:mc(),dirty:l,skip_bound:!1,root:e.target||u.$$.root};o&&o(s.root);let c=!1;if(s.ctx=t?t(r,e.props||{},(f,p,...m)=>{let h=m.length?m[0]:p;return s.ctx&&i(s.ctx[f],s.ctx[f]=h)&&(!s.skip_bound&&s.bound[f]&&s.bound[f](h),c&&fU(r,f)),p}):[],s.update(),c=!0,ot(s.before_update),s.fragment=n?n(s.ctx):!1,e.target){if(e.hydrate){SA();let f=NA(e.target);s.fragment&&s.fragment.l(f),f.forEach(j)}else s.fragment&&s.fragment.c();e.intro&&ee(r.$$.fragment),be(r,e.target,e.anchor),EA(),yc()}la(u)}var pU;typeof HTMLElement=="function"&&(pU=class extends HTMLElement{constructor(e,t,n){super();Rr(this,"$$ctor");Rr(this,"$$s");Rr(this,"$$c");Rr(this,"$$cn",!1);Rr(this,"$$d",{});Rr(this,"$$r",!1);Rr(this,"$$p_d",{});Rr(this,"$$l",{});Rr(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,n&&this.attachShadow({mode:"open"})}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let o;return{c:function(){o=Z("slot"),a!=="default"&&k(o,"name",a)},m:function(s,c){J(s,o,c)},d:function(s){s&&j(o)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},n=CA(this);for(let a of this.$$s)a in n&&(t[a]=[e(a)]);for(let a of this.attributes){let o=this.$$g_p(a.name);o in this.$$d||(this.$$d[o]=Ed(o,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let o=Ed(a,this.$$d[a],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,o)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let o of this.$$l[a]){let l=this.$$c.$on(a,o);this.$$l_u.set(o,l)}this.$$l={}}}attributeChangedCallback(e,t,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ed(e,n,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Ed(r,e,t,n){var a;let i=(a=t[r])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Le=class{constructor(){Rr(this,"$$");Rr(this,"$$set")}$destroy(){xe(this,1),this.$destroy=Me}$on(e,t){if(!dc(t))return Me;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!wA(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var BA="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(BA);var Vr=class extends Error{constructor(e){super(""),this.errorLevel=e.errorLevel,this.effect=e.effect,this.cause=e.cause,this.tip=e.tip,this.docs=e.docs,this.context=e.context,this.positionContext=e.positionContext,this.updateMessage()}updateMessage(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"`}log(){console.log(this.message,this.stack,this.context)}},zt=class extends Vr{getErrorType(){return"MB_INTERNAL"}},ca=class extends Vr{getErrorType(){return"MB_PARSING"}},qu=class extends Vr{getErrorType(){return"MB_VALIDATION"}},wc=class extends Vr{getErrorType(){return"MB_BIND_TARGET"}};var ir=class extends Vr{getErrorType(){return"MB_ARGUMENT"}},zu=class extends Vr{getErrorType(){return"MB_JS"}},fa=class extends Vr{getErrorType(){return"MB_EXPRESSION"}};var Hu=class extends Vr{getErrorType(){return"MB_EXAMPLE"}},ws=class extends Vr{getErrorType(){return"MB_EMBED"}},pa=class extends Vr{getErrorType(){return"MB_BUTTON"}},Po=class extends Vr{getErrorType(){return"MB_DEPENDENCY"}};function PA(r,e,t){let n=r.slice();return n[1]=e[t],n}function mU(r){let e,t,n,i=r[0].stack+"",a;return{c(){e=Z("div"),t=Z("pre"),n=Z("code"),a=Ie(i),k(n,"class","language-none mb-none"),k(t,"class","mb-pre"),k(e,"class","mb-card")},m(o,l){J(o,e,l),z(e,t),z(t,n),z(n,a)},p(o,l){l&1&&i!==(i=o[0].stack+"")&&Ke(a,i)},d(o){o&&j(e)}}}function dU(r){let e,t,n,i=r[0].errorLevel+"",a,o,l=r[0].getErrorType()+"",u,s,c,f,p=r[0].effect+"",m,h,d,g,v,w,y,x,_,b=r[0].cause+"",E,D,A,S,M,F,P=r[0].effect+"",R,O,I,T,$=r[0].positionContext&&OA(r),B=r[0].tip&&kA(r),U=r[0].docs&&RA(r),G=r[0].context&&UA(r);return{c(){e=Z("div"),t=Z("h6"),n=Z("span"),a=Ie(i),o=Ie(`
[`),u=Ie(l),s=Ie("]"),f=Ie(`
- `),m=Ie(p),h=ue(),$&&$.c(),d=ue(),g=Z("table"),v=Z("tbody"),w=Z("tr"),y=Z("td"),y.textContent="Cause",x=ue(),_=Z("td"),E=Ie(b),D=ue(),A=Z("tr"),S=Z("td"),S.textContent="Effect",M=ue(),F=Z("td"),R=Ie(P),O=ue(),B&&B.c(),I=ue(),U&&U.c(),T=ue(),G&&G.c(),k(n,"class",c=r[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),k(e,"class","mb-card mb-card-full-width markdown-rendered")},m(H,L){J(H,e,L),z(e,t),z(t,n),z(n,a),z(n,o),z(n,u),z(n,s),z(t,f),z(t,m),z(e,h),$&&$.m(e,null),z(e,d),z(e,g),z(g,v),z(v,w),z(w,y),z(w,x),z(w,_),z(_,E),z(v,D),z(v,A),z(A,S),z(A,M),z(A,F),z(F,R),z(v,O),B&&B.m(v,null),z(v,I),U&&U.m(v,null),z(v,T),G&&G.m(v,null)},p(H,L){L&1&&i!==(i=H[0].errorLevel+"")&&Ke(a,i),L&1&&l!==(l=H[0].getErrorType()+"")&&Ke(u,l),L&1&&c!==(c=H[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")&&k(n,"class",c),L&1&&p!==(p=H[0].effect+"")&&Ke(m,p),H[0].positionContext?$?$.p(H,L):($=OA(H),$.c(),$.m(e,d)):$&&($.d(1),$=null),L&1&&b!==(b=H[0].cause+"")&&Ke(E,b),L&1&&P!==(P=H[0].effect+"")&&Ke(R,P),H[0].tip?B?B.p(H,L):(B=kA(H),B.c(),B.m(v,I)):B&&(B.d(1),B=null),H[0].docs?U?U.p(H,L):(U=RA(H),U.c(),U.m(v,T)):U&&(U.d(1),U=null),H[0].context?G?G.p(H,L):(G=UA(H),G.c(),G.m(v,null)):G&&(G.d(1),G=null)},d(H){H&&j(e),$&&$.d(),B&&B.d(),U&&U.d(),G&&G.d()}}}function OA(r){let e,t,n=r[0].positionContext+"",i;return{c(){e=Z("pre"),t=Z("code"),i=Ie(n),k(t,"class","language-none mb-none"),k(e,"class","mb-pre")},m(a,o){J(a,e,o),z(e,t),z(t,i)},p(a,o){o&1&&n!==(n=a[0].positionContext+"")&&Ke(i,n)},d(a){a&&j(e)}}}function kA(r){let e,t,n,i,a=r[0].tip+"",o;return{c(){e=Z("tr"),t=Z("td"),t.textContent="Tip",n=ue(),i=Z("td"),o=Ie(a)},m(l,u){J(l,e,u),z(e,t),z(e,n),z(e,i),z(i,o)},p(l,u){u&1&&a!==(a=l[0].tip+"")&&Ke(o,a)},d(l){l&&j(e)}}}function RA(r){let e,t,n,i,a=We(r[0].docs),o=[];for(let l=0;l<a.length;l+=1)o[l]=LA(PA(r,a,l));return{c(){e=Z("tr"),t=Z("td"),t.textContent="Docs",n=ue(),i=Z("td");for(let l=0;l<o.length;l+=1)o[l].c()},m(l,u){J(l,e,u),z(e,t),z(e,n),z(e,i);for(let s=0;s<o.length;s+=1)o[s]&&o[s].m(i,null)},p(l,u){if(u&1){a=We(l[0].docs);let s;for(s=0;s<a.length;s+=1){let c=PA(l,a,s);o[s]?o[s].p(c,u):(o[s]=LA(c),o[s].c(),o[s].m(i,null))}for(;s<o.length;s+=1)o[s].d(1);o.length=a.length}},d(l){l&&j(e),At(o,l)}}}function LA(r){let e,t=r[1]+"",n,i,a;return{c(){e=Z("a"),n=Ie(t),a=Z("br"),k(e,"href",i=r[1])},m(o,l){J(o,e,l),z(e,n),J(o,a,l)},p(o,l){l&1&&t!==(t=o[1]+"")&&Ke(n,t),l&1&&i!==(i=o[1])&&k(e,"href",i)},d(o){o&&(j(e),j(a))}}}function UA(r){let e,t,n,i,a,o,l=JSON.stringify(r[0].context,null,4)+"",u;return{c(){e=Z("tr"),t=Z("td"),t.textContent="Context",n=ue(),i=Z("td"),a=Z("pre"),o=Z("code"),u=Ie(l),k(o,"class","language-none mb-none"),k(a,"class","mb-pre")},m(s,c){J(s,e,c),z(e,t),z(e,n),z(e,i),z(i,a),z(a,o),z(o,u)},p(s,c){c&1&&l!==(l=JSON.stringify(s[0].context,null,4)+"")&&Ke(u,l)},d(s){s&&j(e)}}}function hU(r){let e;function t(a,o){return a[0]instanceof Vr?dU:mU}let n=t(r,-1),i=n(r);return{c(){i.c(),e=pr()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Me,o:Me,d(a){a&&j(e),i.d(a)}}}function gU(r,e,t){let{error:n}=e;return r.$$set=i=>{"error"in i&&t(0,n=i.error)},[n]}var Dd=class extends Le{constructor(e){super(),$e(this,e,gU,hU,Ve,{error:0})}},Nd=Dd;function VA(r,e,t){let n=r.slice();return n[1]=e[t],n}function $A(r,e,t){let n=r.slice();return n[4]=e[t],n}function qA(r){let e,t=r[0].text+"",n;return{c(){e=Z("p"),n=Ie(t)},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&1&&t!==(t=i[0].text+"")&&Ke(n,t)},d(i){i&&j(e)}}}function zA(r){let e,t,n=r[0].code+"",i;return{c(){e=Z("pre"),t=Z("code"),i=Ie(n),k(t,"class","language-none meta-bind-none"),k(e,"class","mb-pre")},m(a,o){J(a,e,o),z(e,t),z(t,i)},p(a,o){o&1&&n!==(n=a[0].code+"")&&Ke(i,n)},d(a){a&&j(e)}}}function HA(r){let e,t,n,i,a,o=r[0].errorText&&GA(r),l=We(r[0].errorCollection.getErrors()),u=[];for(let c=0;c<l.length;c+=1)u[c]=WA($A(r,l,c));let s=c=>re(u[c],1,1,()=>{u[c]=null});return{c(){e=Z("h6"),e.textContent="Errors",t=ue(),o&&o.c(),n=ue();for(let c=0;c<u.length;c+=1)u[c].c();i=pr()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,n,f);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].errorText?o?o.p(c,f):(o=GA(c),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),f&1){l=We(c[0].errorCollection.getErrors());let p;for(p=0;p<l.length;p+=1){let m=$A(c,l,p);u[p]?(u[p].p(m,f),ee(u[p],1)):(u[p]=WA(m),u[p].c(),ee(u[p],1),u[p].m(i.parentNode,i))}for(pt(),p=l.length;p<u.length;p+=1)s(p);mt()}},i(c){if(!a){for(let f=0;f<l.length;f+=1)ee(u[f]);a=!0}},o(c){u=u.filter(Boolean);for(let f=0;f<u.length;f+=1)re(u[f]);a=!1},d(c){c&&(j(e),j(t),j(n),j(i)),o&&o.d(c),At(u,c)}}}function GA(r){let e,t=r[0].errorText+"",n;return{c(){e=Z("p"),n=Ie(t)},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&1&&t!==(t=i[0].errorText+"")&&Ke(n,t)},d(i){i&&j(e)}}}function WA(r){let e,t;return e=new Nd({props:{error:r[4]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.error=n[4]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function jA(r){let e,t,n,i,a,o=r[0].warningText&&ZA(r),l=We(r[0].errorCollection.getWarnings()),u=[];for(let c=0;c<l.length;c+=1)u[c]=JA(VA(r,l,c));let s=c=>re(u[c],1,1,()=>{u[c]=null});return{c(){e=Z("h6"),e.textContent="Warnings",t=ue(),o&&o.c(),n=ue();for(let c=0;c<u.length;c+=1)u[c].c();i=pr()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,n,f);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].warningText?o?o.p(c,f):(o=ZA(c),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),f&1){l=We(c[0].errorCollection.getWarnings());let p;for(p=0;p<l.length;p+=1){let m=VA(c,l,p);u[p]?(u[p].p(m,f),ee(u[p],1)):(u[p]=JA(m),u[p].c(),ee(u[p],1),u[p].m(i.parentNode,i))}for(pt(),p=l.length;p<u.length;p+=1)s(p);mt()}},i(c){if(!a){for(let f=0;f<l.length;f+=1)ee(u[f]);a=!0}},o(c){u=u.filter(Boolean);for(let f=0;f<u.length;f+=1)re(u[f]);a=!1},d(c){c&&(j(e),j(t),j(n),j(i)),o&&o.d(c),At(u,c)}}}function ZA(r){let e,t=r[0].warningText+"",n;return{c(){e=Z("p"),n=Ie(t)},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&1&&t!==(t=i[0].warningText+"")&&Ke(n,t)},d(i){i&&j(e)}}}function JA(r){let e,t;return e=new Nd({props:{error:r[1]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.error=n[1]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function vU(r){let e,t,n=r[0].errorCollection.hasErrors(),i,a=r[0].errorCollection.hasWarnings(),o,l,u=r[0].text&&qA(r),s=r[0].code&&zA(r),c=n&&HA(r),f=a&&jA(r);return{c(){u&&u.c(),e=ue(),s&&s.c(),t=ue(),c&&c.c(),i=ue(),f&&f.c(),o=pr()},m(p,m){u&&u.m(p,m),J(p,e,m),s&&s.m(p,m),J(p,t,m),c&&c.m(p,m),J(p,i,m),f&&f.m(p,m),J(p,o,m),l=!0},p(p,[m]){p[0].text?u?u.p(p,m):(u=qA(p),u.c(),u.m(e.parentNode,e)):u&&(u.d(1),u=null),p[0].code?s?s.p(p,m):(s=zA(p),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),m&1&&(n=p[0].errorCollection.hasErrors()),n?c?(c.p(p,m),m&1&&ee(c,1)):(c=HA(p),c.c(),ee(c,1),c.m(i.parentNode,i)):c&&(pt(),re(c,1,1,()=>{c=null}),mt()),m&1&&(a=p[0].errorCollection.hasWarnings()),a?f?(f.p(p,m),m&1&&ee(f,1)):(f=jA(p),f.c(),ee(f,1),f.m(o.parentNode,o)):f&&(pt(),re(f,1,1,()=>{f=null}),mt())},i(p){l||(ee(c),ee(f),l=!0)},o(p){re(c),re(f),l=!1},d(p){p&&(j(e),j(t),j(i),j(o)),u&&u.d(p),s&&s.d(p),c&&c.d(p),f&&f.d(p)}}}function yU(r,e,t){let{settings:n}=e;return r.$$set=i=>{"settings"in i&&t(0,n=i.settings)},[n]}var Cd=class extends Le{constructor(e){super(),$e(this,e,yU,vU,Ve,{settings:0})}},Oa=Cd;function bU(r){let e,t,n=r[1].default,i=Mi(n,r,r[0],null);return{c(){e=Z("div"),i&&i.c(),k(e,"class","modal-button-container")},m(a,o){J(a,e,o),i&&i.m(e,null),t=!0},p(a,[o]){i&&i.p&&(!t||o&1)&&Fi(i,n,a,a[0],t?Ti(n,a[0],o,null):Ii(a[0]),null)},i(a){t||(ee(i,a),t=!0)},o(a){re(i,a),t=!1},d(a){a&&j(e),i&&i.d(a)}}}function xU(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,n]}var Md=class extends Le{constructor(e){super(),$e(this,e,xU,bU,Ve,{})}},ka=Md;var li=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(li||{}),_s=(l=>(l.COMMAND="command",l.JS="js",l.OPEN="open",l.INPUT="input",l.SLEEP="sleep",l.TEMPLATER_CREATE_NOTE="templaterCreateNote",l.UPDATE_METADATA="updateMetadata",l))(_s||{});function wU(r){en(r,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function _U(r){let e,t,n,i,a=r[4].default,o=Mi(a,r,r[3],null);return{c(){e=Z("button"),o&&o.c(),k(e,"aria-label",r[2]),e.disabled=r[1],k(e,"class","svelte-12xcpmj"),St(e,"mod-cta",r[0]==="primary"),St(e,"mod-warning",r[0]==="destructive"),St(e,"mod-plain",r[0]==="plain"),St(e,"disabled",r[1])},m(l,u){J(l,e,u),o&&o.m(e,null),t=!0,n||(i=Ae(e,"click",r[5]),n=!0)},p(l,[u]){o&&o.p&&(!t||u&8)&&Fi(o,a,l,l[3],t?Ti(a,l[3],u,null):Ii(l[3]),null),(!t||u&4)&&k(e,"aria-label",l[2]),(!t||u&2)&&(e.disabled=l[1]),(!t||u&1)&&St(e,"mod-cta",l[0]==="primary"),(!t||u&1)&&St(e,"mod-warning",l[0]==="destructive"),(!t||u&1)&&St(e,"mod-plain",l[0]==="plain"),(!t||u&2)&&St(e,"disabled",l[1])},i(l){t||(ee(o,l),t=!0)},o(l){re(o,l),t=!1},d(l){l&&j(e),o&&o.d(l),n=!1,i()}}}function AU(r,e,t){let{$$slots:n={},$$scope:i}=e,{variant:a="default"}=e,{disabled:o=!1}=e,{tooltip:l=""}=e;function u(s){MA.call(this,r,s)}return r.$$set=s=>{"variant"in s&&t(0,a=s.variant),"disabled"in s&&t(1,o=s.disabled),"tooltip"in s&&t(2,l=s.tooltip),"$$scope"in s&&t(3,i=s.$$scope)},[a,o,l,i,n,u]}var Td=class extends Le{constructor(e){super(),$e(this,e,AU,_U,Ve,{variant:0,disabled:1,tooltip:2},wU)}},Et=Td;var XA=require("obsidian");function YA(r){let e;return{c(){e=Z("div"),k(e,"class","mb-icon-wrapper")},m(t,n){J(t,e,n),r[2](e)},p:Me,d(t){t&&j(e),r[2](null)}}}function SU(r){let e,t=r[0].length>0&&YA(r);return{c(){t&&t.c(),e=pr()},m(n,i){t&&t.m(n,i),J(n,e,i)},p(n,[i]){n[0].length>0?t?t.p(n,i):(t=YA(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Me,o:Me,d(n){n&&j(e),t&&t.d(n)}}}function EU(r,e,t){let{iconName:n=""}=e,i;sn(()=>{(0,XA.setIcon)(i,n)});function a(o){Ir[o?"unshift":"push"](()=>{i=o,t(1,i)})}return r.$$set=o=>{"iconName"in o&&t(0,n=o.iconName)},[n,i,a]}var Fd=class extends Le{constructor(e){super(),$e(this,e,EU,SU,Ve,{iconName:0})}},Qt=Fd;function QA(r,e,t){let n=r.slice();return n[12]=e[t],n[13]=e,n[14]=t,n}function DU(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function KA(r){let e,t,n,i,a,o,l,u,s,c;function f(){r[7].call(n,r[13],r[14])}function p(){return r[8](r[12])}return o=new Et({props:{tooltip:"Delete",$$slots:{default:[DU]},$$scope:{ctx:r}}}),o.$on("click",p),{c(){e=Z("tr"),t=Z("td"),n=Z("input"),i=ue(),a=Z("td"),we(o.$$.fragment),l=ue(),k(n,"type","text"),k(n,"placeholder","path/to/folder"),Mo(n,"width","100%"),Mo(t,"width","100%")},m(m,h){J(m,e,h),z(e,t),z(t,n),Ye(n,r[12]),z(e,i),z(e,a),be(o,a,null),z(e,l),u=!0,s||(c=Ae(n,"input",f),s=!0)},p(m,h){r=m,h&1&&n.value!==r[12]&&Ye(n,r[12]);let d={};h&32768&&(d.$$scope={dirty:h,ctx:r}),o.$set(d)},i(m){u||(ee(o.$$.fragment,m),u=!0)},o(m){re(o.$$.fragment,m),u=!1},d(m){m&&j(e),xe(o),s=!1,c()}}}function NU(r){let e;return{c(){e=Ie("Add Folder")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function eS(r){let e,t,n,i,a;return i=new Oa({props:{errorCollection:r[1],declaration:void 0}}),{c(){e=Z("div"),t=Z("h3"),t.textContent="Some Folder Paths are invalid",n=ue(),we(i.$$.fragment),k(t,"class","mod-error")},m(o,l){J(o,e,l),z(e,t),z(e,n),be(i,e,null),a=!0},p(o,l){let u={};l&2&&(u.errorCollection=o[1]),i.$set(u)},i(o){a||(ee(i.$$.fragment,o),a=!0)},o(o){re(i.$$.fragment,o),a=!1},d(o){o&&j(e),xe(i)}}}function CU(r){let e;return{c(){e=Ie("Save")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function MU(r){let e;return{c(){e=Ie("Cancel")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function TU(r){let e,t,n,i;return e=new Et({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[CU]},$$scope:{ctx:r}}}),e.$on("click",r[10]),n=new Et({props:{tooltip:"Revert Changes",$$slots:{default:[MU]},$$scope:{ctx:r}}}),n.$on("click",r[11]),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment)},m(a,o){be(e,a,o),J(a,t,o),be(n,a,o),i=!0},p(a,o){let l={};o&32768&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o&32768&&(u.$$scope={dirty:o,ctx:a}),n.$set(u)},i(a){i||(ee(e.$$.fragment,a),ee(n.$$.fragment,a),i=!0)},o(a){re(e.$$.fragment,a),re(n.$$.fragment,a),i=!1},d(a){a&&j(t),xe(e,a),xe(n,a)}}}function FU(r){let e,t,n,i,a,o,l,u,s,c,f,p=We(r[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=KA(QA(r,p,g));let h=g=>re(m[g],1,1,()=>{m[g]=null});l=new Et({props:{variant:"primary",tooltip:"Add new excluded Folder",$$slots:{default:[NU]},$$scope:{ctx:r}}}),l.$on("click",r[9]);let d=r[1]&&eS(r);return c=new ka({props:{$$slots:{default:[TU]},$$scope:{ctx:r}}}),{c(){e=Z("div"),t=Z("table"),n=Z("thead"),n.innerHTML="<tr><th>Folder Path</th> <th></th></tr>",i=ue(),a=Z("tbody");for(let g=0;g<m.length;g+=1)m[g].c();o=ue(),we(l.$$.fragment),u=ue(),d&&d.c(),s=ue(),we(c.$$.fragment)},m(g,v){J(g,e,v),z(e,t),z(t,n),z(t,i),z(t,a);for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(a,null);z(e,o),be(l,e,null),z(e,u),d&&d.m(e,null),z(e,s),be(c,e,null),f=!0},p(g,[v]){if(v&5){p=We(g[0]);let x;for(x=0;x<p.length;x+=1){let _=QA(g,p,x);m[x]?(m[x].p(_,v),ee(m[x],1)):(m[x]=KA(_),m[x].c(),ee(m[x],1),m[x].m(a,null))}for(pt(),x=p.length;x<m.length;x+=1)h(x);mt()}let w={};v&32768&&(w.$$scope={dirty:v,ctx:g}),l.$set(w),g[1]?d?(d.p(g,v),v&2&&ee(d,1)):(d=eS(g),d.c(),ee(d,1),d.m(e,s)):d&&(pt(),re(d,1,1,()=>{d=null}),mt());let y={};v&32768&&(y.$$scope={dirty:v,ctx:g}),c.$set(y)},i(g){if(!f){for(let v=0;v<p.length;v+=1)ee(m[v]);ee(l.$$.fragment,g),ee(d),ee(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let v=0;v<m.length;v+=1)re(m[v]);re(l.$$.fragment,g),re(d),re(c.$$.fragment,g),f=!1},d(g){g&&j(e),At(m,g),xe(l),d&&d.d(),xe(c)}}}function IU(r,e,t){let{excludedFolders:n}=e,{modal:i}=e,a;function o(d){t(0,n=n.filter(g=>g!==d))}function l(){n.push(""),t(0,n)}function u(){t(1,a=i.save(n)),a===void 0&&i.close()}function s(){i.close()}function c(d,g){d[g]=this.value,t(0,n)}let f=d=>o(d),p=()=>l(),m=()=>u(),h=()=>s();return r.$$set=d=>{"excludedFolders"in d&&t(0,n=d.excludedFolders),"modal"in d&&t(6,i=d.modal)},[n,a,o,l,u,s,i,c,f,p,m,h]}var Id=class extends Le{constructor(e){super(),$e(this,e,IU,FU,Ve,{excludedFolders:0,modal:6})}},tS=Id;var Rt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Vr?this.errors.push(e):this.otherError=e,console.warn(e)):console.warn("[MB_ERROR_CONTAINER] received invalid error type",e)}merge(e){return this.errors=this.errors.concat(e.errors),e.otherError&&(this.otherError=e.otherError),this}hasErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="ERROR"||e.errorLevel==="CRITICAL")return!0;return!1}hasCriticalErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="CRITICAL")return!0;return!1}hasWarnings(){for(let e of this.errors)if(e.errorLevel==="WARNING")return!0;return!1}isEmpty(){return this.errors.length===0&&!this.otherError}getErrors(){let e=this.errors.filter(t=>t.errorLevel==="ERROR"||t.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var _c=class extends rS.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new tS({target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){for(let t of e)if(t===""){let n=new Rt("Excluded Folders");return n.add(new Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),n}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var uS=require("obsidian");function BU(r){let e,t,n=r[1].default,i=Mi(n,r,r[0],null);return{c(){e=Z("div"),i&&i.c(),k(e,"class","mb-flex-row")},m(a,o){J(a,e,o),i&&i.m(e,null),t=!0},p(a,[o]){i&&i.p&&(!t||o&1)&&Fi(i,n,a,a[0],t?Ti(n,a[0],o,null):Ii(a[0]),null)},i(a){t||(ee(i,a),t=!0)},o(a){re(i,a),t=!1},d(a){a&&j(e),i&&i.d(a)}}}function PU(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,n]}var Bd=class extends Le{constructor(e){super(),$e(this,e,PU,BU,Ve,{})}},Ac=Bd;function OU(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function kU(r){let e,t,n,i,a,o;return n=new Et({props:{variant:"destructive",tooltip:"Delete Template",$$slots:{default:[OU]},$$scope:{ctx:r}}}),n.$on("click",r[3]),{c(){e=Z("input"),t=ue(),we(n.$$.fragment),k(e,"type","text"),k(e,"placeholder","template-name")},m(l,u){J(l,e,u),Ye(e,r[0].name),J(l,t,u),be(n,l,u),i=!0,a||(o=Ae(e,"input",r[2]),a=!0)},p(l,u){u&1&&e.value!==l[0].name&&Ye(e,l[0].name);let s={};u&64&&(s.$$scope={dirty:u,ctx:l}),n.$set(s)},i(l){i||(ee(n.$$.fragment,l),i=!0)},o(l){re(n.$$.fragment,l),i=!1},d(l){l&&(j(e),j(t)),xe(n,l),a=!1,o()}}}function RU(r){let e,t,n,i,a,o,l;return t=new Ac({props:{$$slots:{default:[kU]},$$scope:{ctx:r}}}),{c(){e=Z("div"),we(t.$$.fragment),n=ue(),i=Z("textarea"),k(i,"type","text"),k(i,"placeholder","INPUT[slider(addLabels)]"),Mo(i,"width","100%"),Mo(i,"height","100px"),Mo(i,"resize","vertical"),k(e,"class","mb-card")},m(u,s){J(u,e,s),be(t,e,null),z(e,n),z(e,i),Ye(i,r[0].declaration),a=!0,o||(l=Ae(i,"input",r[4]),o=!0)},p(u,[s]){let c={};s&65&&(c.$$scope={dirty:s,ctx:u}),t.$set(c),s&1&&Ye(i,u[0].declaration)},i(u){a||(ee(t.$$.fragment,u),a=!0)},o(u){re(t.$$.fragment,u),a=!1},d(u){u&&j(e),xe(t),o=!1,l()}}}function LU(r,e,t){let{template:n}=e,i=Fo();function a(){i("delete-template",{template:n})}function o(){n.name=this.value,t(0,n)}let l=()=>a();function u(){n.declaration=this.value,t(0,n)}return r.$$set=s=>{"template"in s&&t(0,n=s.template)},[n,a,o,l,u]}var Pd=class extends Le{constructor(e){super(),$e(this,e,LU,RU,Ve,{template:0})}},nS=Pd;function iS(r,e,t){let n=r.slice();return n[11]=e[t],n}function aS(r){let e,t;return e=new nS({props:{template:r[11]}}),e.$on("delete-template",r[7]),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.template=n[11]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function UU(r){let e;return{c(){e=Ie("Add Template")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function oS(r){let e,t,n,i,a;return i=new Oa({props:{settings:{errorCollection:r[1]}}}),{c(){e=Z("div"),t=Z("h3"),t.textContent="Some Templates Failed to Parse",n=ue(),we(i.$$.fragment),k(t,"class","mod-error")},m(o,l){J(o,e,l),z(e,t),z(e,n),be(i,e,null),a=!0},p(o,l){let u={};l&2&&(u.settings={errorCollection:o[1]}),i.$set(u)},i(o){a||(ee(i.$$.fragment,o),a=!0)},o(o){re(i.$$.fragment,o),a=!1},d(o){o&&j(e),xe(i)}}}function VU(r){let e;return{c(){e=Ie("Save")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function $U(r){let e;return{c(){e=Ie("Cancel")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function qU(r){let e,t,n,i;return e=new Et({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[VU]},$$scope:{ctx:r}}}),e.$on("click",r[9]),n=new Et({props:{tooltip:"Revert Changes",$$slots:{default:[$U]},$$scope:{ctx:r}}}),n.$on("click",r[10]),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment)},m(a,o){be(e,a,o),J(a,t,o),be(n,a,o),i=!0},p(a,o){let l={};o&16384&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o&16384&&(u.$$scope={dirty:o,ctx:a}),n.$set(u)},i(a){i||(ee(e.$$.fragment,a),ee(n.$$.fragment,a),i=!0)},o(a){re(e.$$.fragment,a),re(n.$$.fragment,a),i=!1},d(a){a&&j(t),xe(e,a),xe(n,a)}}}function zU(r){let e,t,n,i,a,o,l,u,s,c=We(r[0]),f=[];for(let h=0;h<c.length;h+=1)f[h]=aS(iS(r,c,h));let p=h=>re(f[h],1,1,()=>{f[h]=null});a=new Et({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[UU]},$$scope:{ctx:r}}}),a.$on("click",r[8]);let m=r[1]&&oS(r);return u=new ka({props:{$$slots:{default:[qU]},$$scope:{ctx:r}}}),{c(){e=Z("div"),t=Z("h2"),t.textContent="Meta Bind Input Field Templates",n=ue();for(let h=0;h<f.length;h+=1)f[h].c();i=ue(),we(a.$$.fragment),o=ue(),m&&m.c(),l=ue(),we(u.$$.fragment)},m(h,d){J(h,e,d),z(e,t),z(e,n);for(let g=0;g<f.length;g+=1)f[g]&&f[g].m(e,null);z(e,i),be(a,e,null),z(e,o),m&&m.m(e,null),z(e,l),be(u,e,null),s=!0},p(h,[d]){if(d&5){c=We(h[0]);let w;for(w=0;w<c.length;w+=1){let y=iS(h,c,w);f[w]?(f[w].p(y,d),ee(f[w],1)):(f[w]=aS(y),f[w].c(),ee(f[w],1),f[w].m(e,i))}for(pt(),w=c.length;w<f.length;w+=1)p(w);mt()}let g={};d&16384&&(g.$$scope={dirty:d,ctx:h}),a.$set(g),h[1]?m?(m.p(h,d),d&2&&ee(m,1)):(m=oS(h),m.c(),ee(m,1),m.m(e,l)):m&&(pt(),re(m,1,1,()=>{m=null}),mt());let v={};d&16384&&(v.$$scope={dirty:d,ctx:h}),u.$set(v)},i(h){if(!s){for(let d=0;d<c.length;d+=1)ee(f[d]);ee(a.$$.fragment,h),ee(m),ee(u.$$.fragment,h),s=!0}},o(h){f=f.filter(Boolean);for(let d=0;d<f.length;d+=1)re(f[d]);re(a.$$.fragment,h),re(m),re(u.$$.fragment,h),s=!1},d(h){h&&j(e),At(f,h),xe(a),m&&m.d(),xe(u)}}}function HU(r,e,t){let{inputFieldTemplates:n}=e,{modal:i}=e,a;function o(h){t(0,n=n.filter(d=>d!==h))}function l(){n.push({name:"",declaration:""}),t(0,n)}function u(){t(1,a=i.save(n)),a===void 0&&i.close()}function s(){i.close()}let c=h=>o(h.detail.template),f=()=>l(),p=()=>u(),m=()=>s();return r.$$set=h=>{"inputFieldTemplates"in h&&t(0,n=h.inputFieldTemplates),"modal"in h&&t(6,i=h.modal)},[n,a,o,l,u,s,i,c,f,p,m]}var Od=class extends Le{constructor(e){super(),$e(this,e,HU,zU,Ve,{inputFieldTemplates:0,modal:6})}},sS=Od;var Sc=class extends uS.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new sS({target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){let t=this.plugin.api.inputFieldParser.parseTemplates(e);if(t.hasErrors())return t;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};function Gu(r,e,t){return Math.min(Math.max(r,e),t)}function Ec(r,e,t){return r!==void 0?Math.min(Math.max(r,e),t):void 0}function kd(r,e,t,n,i){return(r-e)/(t-e)*(i-n)+n}function Rd(r,e){return(r%e+e)%e}function lS(r,e){if(r==null&&e==null)return!0;if(r==null||e==null||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Ld(r,e){for(let t=0;t<e.length;t++)if(r[t]!==e[t])return!1;return!0}function cS(r){return!!r}function Ud(r){let e=Reflect.ownKeys(r);for(let t of e){let n=r[t];(n&&typeof n=="object"||typeof n=="function")&&Ud(n)}return Object.freeze(r)}function fS(r){return structuredClone(r)}function mr(){return window.crypto.randomUUID()}function As(r){try{return new URL(r),!0}catch(e){return!1}}function Dc(r){window.open(r,"_blank")}function pS(r,e,t=", ",n="and"){return r.length===0?"":(r=r.map(e),r.length===1?r[0]:r.length===2?`${r[0]} ${n} ${r[1]}`:`${r.slice(0,-1).join(t)} ${n} ${r.slice(-1)}`)}function ci(r,e){r.innerHTML="",r.className="";let t=document.createElement("span");t.className="mb-warning mb-unloaded",t.innerText=`[MB_UNLOADED] ${e}`,r.appendChild(t)}var Bt=class{static createElement(e,t,n){let i=document.createElement(t);return n!=null&&n.text&&(i.innerText=n.text),n!=null&&n.class&&(i.className=n.class),e.appendChild(i),i}static addClass(e,t){e.classList.add(...t.split(" "))}static addClasses(e,t){e.classList.add(...t)}static removeClass(e,t){e.classList.remove(...t.split(" "))}static hasClass(e,t){return e.classList.contains(t)}static removeAllClasses(e){e.className=""}static empty(e){e.innerHTML=""}};var bt=class{static linkToInputField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfields/${e.toLowerCase()}/`}static linkToInputFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfieldarguments/${e.toLowerCase()}/`}static linkToViewField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/${e.toLowerCase()}/`}static linkToViewFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfieldarguments/${e.toLowerCase()}/`}static linkToInputFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/inputfields/"}static linkToViewFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/viewfields/"}static linkToButtons(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToButtonConfig(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToSearch(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/?s=${encodeURIComponent(e)}`}static linkToHome(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/"}static linkToGithub(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin"}static linkToIssues(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues"}static linkToCanaryBuilds(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/installation/#canary-builds"}static open(e){Dc(e)}};var _S=require("obsidian");var mS=require("obsidian");var Ss=class extends mS.Modal{constructor(e,t){super(e),this.settings=t}onOpen(){this.modalEl.addClass("mb-error-collection-modal","markdown-rendered"),this.titleEl.innerText="Meta Bind Error Overview",this.component=new Oa({target:this.contentEl,props:{settings:this.settings}})}onClose(){var e;(e=this.component)==null||e.$destroy()}};function GU(r){let e,t,n,i,a;function o(s,c){return s[0].hasErrors()?ZU:s[0].hasWarnings()?jU:WU}let u=o(r,-1)(r);return{c(){e=Z("div"),u.c(),k(e,"class","mb-error-collection"),k(e,"role","button"),k(e,"tabindex","0")},m(s,c){J(s,e,c),u.m(e,null),i||(a=[Ae(e,"click",r[4]),Ae(e,"keydown",r[5])],i=!0)},p:Me,d(s){s&&j(e),u.d(),i=!1,ot(a)}}}function WU(r){let e,t,n,i;return{c(){e=Wn("svg"),t=Wn("circle"),n=Wn("path"),i=Wn("path"),k(t,"cx","12"),k(t,"cy","12"),k(t,"r","10"),k(n,"d","M12 16v-4"),k(i,"d","M12 8h.01"),k(e,"xmlns","http://www.w3.org/2000/svg"),k(e,"width","24"),k(e,"height","24"),k(e,"viewBox","0 0 24 24"),k(e,"fill","none"),k(e,"stroke","currentColor"),k(e,"stroke-width","2"),k(e,"stroke-linecap","round"),k(e,"stroke-linejoin","round"),k(e,"class","lucide lucide-info")},m(a,o){J(a,e,o),z(e,t),z(e,n),z(e,i)},d(a){a&&j(e)}}}function jU(r){let e,t,n,i;return{c(){e=Wn("svg"),t=Wn("path"),n=Wn("line"),i=Wn("line"),k(t,"d","m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"),k(n,"x1","12"),k(n,"x2","12"),k(n,"y1","9"),k(n,"y2","13"),k(i,"x1","12"),k(i,"x2","12.01"),k(i,"y1","17"),k(i,"y2","17"),k(e,"xmlns","http://www.w3.org/2000/svg"),k(e,"width","24"),k(e,"height","24"),k(e,"viewBox","0 0 24 24"),k(e,"fill","none"),k(e,"stroke","currentColor"),k(e,"stroke-width","2"),k(e,"stroke-linecap","round"),k(e,"stroke-linejoin","round"),k(e,"class","lucide lucide-alert-triangle")},m(a,o){J(a,e,o),z(e,t),z(e,n),z(e,i)},d(a){a&&j(e)}}}function ZU(r){let e,t,n,i,a,o;return{c(){e=Wn("svg"),t=Wn("circle"),n=Wn("line"),i=Wn("line"),a=ue(),o=Z("span"),o.textContent="[META_BIND_ERROR]",k(t,"cx","12"),k(t,"cy","12"),k(t,"r","10"),k(n,"x1","12"),k(n,"x2","12"),k(n,"y1","8"),k(n,"y2","12"),k(i,"x1","12"),k(i,"x2","12.01"),k(i,"y1","16"),k(i,"y2","16"),k(e,"xmlns","http://www.w3.org/2000/svg"),k(e,"width","24"),k(e,"height","24"),k(e,"viewBox","0 0 24 24"),k(e,"fill","none"),k(e,"stroke","currentColor"),k(e,"stroke-width","2"),k(e,"stroke-linecap","round"),k(e,"stroke-linejoin","round"),k(e,"class","lucide lucide-alert-circle"),k(o,"class","mb-error")},m(l,u){J(l,e,u),z(e,t),z(e,n),z(e,i),J(l,a,u),J(l,o,u)},d(l){l&&(j(e),j(a),j(o))}}}function JU(r){let e=!r[0].isEmpty(),t,n=e&&GU(r);return{c(){n&&n.c(),t=pr()},m(i,a){n&&n.m(i,a),J(i,t,a)},p(i,[a]){e&&n.p(i,a)},i:Me,o:Me,d(i){i&&j(t),n&&n.d(i)}}}function YU(r,e,t){let{app:n}=e,{props:i}=e,a=i.errorCollection;function o(){new Ss(n,i).open()}let l=()=>o(),u=s=>{s.key===" "&&o()};return r.$$set=s=>{"app"in s&&t(2,n=s.app),"props"in s&&t(3,i=s.props)},[a,o,n,i,l,u]}var Vd=class extends Le{constructor(e){super(),$e(this,e,YU,JU,Ve,{app:2,props:3})}},Wu=Vd;var Es=(x=>(x.TOGGLE="toggle",x.SLIDER="slider",x.TEXT="text",x.TEXT_AREA="textArea",x.SELECT="select",x.MULTI_SELECT="multiSelect",x.DATE="date",x.TIME="time",x.DATE_PICKER="datePicker",x.NUMBER="number",x.SUGGESTER="suggester",x.EDITOR="editor",x.IMAGE_SUGGESTER="imageSuggester",x.PROGRESS_BAR="progressBar",x.INLINE_SELECT="inlineSelect",x.LIST="list",x.LIST_SUGGESTER="listSuggester",x.INLINE_LIST_SUGGESTER="inlineListSuggester",x.INLINE_LIST="inlineList",x.INVALID="invalid",x))(Es||{}),Br=(g=>(g.CLASS="class",g.ADD_LABELS="addLabels",g.MIN_VALUE="minValue",g.MAX_VALUE="maxValue",g.STEP_SIZE="stepSize",g.OPTION="option",g.TITLE="title",g.OPTION_QUERY="optionQuery",g.SHOWCASE="showcase",g.ON_VALUE="onValue",g.OFF_VALUE="offValue",g.DEFAULT_VALUE="defaultValue",g.PLACEHOLDER="placeholder",g.USE_LINKS="useLinks",g.LIMIT="limit",g.INVALID="invalid",g))(Br||{}),Nc={toggle:{type:"toggle",allowInBlock:!0,allowInline:!0},slider:{type:"slider",allowInBlock:!0,allowInline:!0},text:{type:"text",allowInBlock:!0,allowInline:!0},textArea:{type:"textArea",allowInBlock:!0,allowInline:!0},select:{type:"select",allowInBlock:!0,allowInline:!1},multiSelect:{type:"multiSelect",allowInBlock:!0,allowInline:!1},date:{type:"date",allowInBlock:!0,allowInline:!0},time:{type:"time",allowInBlock:!0,allowInline:!0},datePicker:{type:"datePicker",allowInBlock:!0,allowInline:!0},number:{type:"number",allowInBlock:!0,allowInline:!0},suggester:{type:"suggester",allowInBlock:!0,allowInline:!0},editor:{type:"editor",allowInBlock:!0,allowInline:!1},imageSuggester:{type:"imageSuggester",allowInBlock:!0,allowInline:!1},progressBar:{type:"progressBar",allowInBlock:!0,allowInline:!1},inlineSelect:{type:"inlineSelect",allowInBlock:!0,allowInline:!0},list:{type:"list",allowInBlock:!0,allowInline:!1},listSuggester:{type:"listSuggester",allowInBlock:!0,allowInline:!1},inlineListSuggester:{type:"inlineListSuggester",allowInBlock:!0,allowInline:!0},inlineList:{type:"inlineList",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}};var or={addLabels:{type:"addLabels",allowedFieldTypes:["slider","progressBar"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},defaultValue:{type:"defaultValue",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},maxValue:{type:"maxValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the maximally allowed value"}]],allowMultiple:!1},minValue:{type:"minValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the minimally allowed value"}]],allowMultiple:!1},stepSize:{type:"stepSize",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the step size for sliders"}]],allowMultiple:!1},offValue:{type:"offValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},onValue:{type:"onValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},option:{type:"option",allowedFieldTypes:["select","multiSelect","suggester","imageSuggester","inlineSelect","listSuggester","inlineListSuggester"],values:[[{name:"value",allowed:[],description:"the value and display name of the option"}],[{name:"value",allowed:[],description:"the value of the option"},{name:"name",allowed:[],description:"the display name of the option"}]],allowMultiple:!0},optionQuery:{type:"optionQuery",allowedFieldTypes:["suggester","imageSuggester","listSuggester","inlineListSuggester"],values:[[{name:"value",allowed:[],description:"the query for options"}]],allowMultiple:!0},placeholder:{type:"placeholder",allowedFieldTypes:["text","textArea","number","list","inlineList"],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},showcase:{type:"showcase",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},title:{type:"title",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},useLinks:{type:"useLinks",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","partial","false"],description:""}]],allowMultiple:!1},limit:{type:"limit",allowedFieldTypes:["text","textArea","list","inlineList"],values:[[{name:"value",allowed:["number"],description:"a character limit for text fields"}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},ju=(i=>(i.MATH="math",i.TEXT="text",i.LINK="link",i.INVALID="invalid",i))(ju||{}),Ds=(n=>(n.RENDER_MARKDOWN="renderMarkdown",n.HIDDEN="hidden",n.INVALID="invalid",n))(Ds||{}),Cc={renderMarkdown:{type:"renderMarkdown",allowedFieldTypes:["text"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},hidden:{type:"hidden",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},Bi=(t=>(t.INLINE="inline",t.BLOCK="block",t))(Bi||{});var dS={date:"date",datePicker:"datePicker",editor:"editor",imageSuggester:'imageSuggester(optionQuery(""))',inlineList:"inlineList",inlineListSuggester:"inlineListSuggester(option(apple), option(banana), option(lemon))",inlineSelect:"inlineSelect(option(apple), option(banana), option(lemon))",list:"list",listSuggester:"listSuggester(option(apple), option(banana), option(lemon))",multiSelect:"multiSelect(option(apple), option(banana), option(lemon))",number:"number",progressBar:"progressBar",select:"select(option(apple), option(banana), option(lemon))",slider:"slider(addLabels)",suggester:"suggester(option(apple), option(banana), option(lemon))",text:"text",textArea:"textArea",time:"time",toggle:"toggle",invalid:""},XU={math:"VIEW[{exampleProperty} + 2][math]",text:"VIEW[some text {exampleProperty}][text]",link:"VIEW[{exampleProperty}][link]",invalid:""};function $d(r){let e=[];for(let[t,n]of Object.entries(dS)){if(n==="")continue;let i=r.api.inputField.createInputFieldDeclarationFromString(`INPUT[${n}]`);i=r.api.inputField.addArgument(i,{name:"showcase",value:["true"]}),i=r.api.inputField.addArgument(i,{name:"title",value:[t]}),e.push([t,i])}return e}function hS(r){let e=[];for(let[t,n]of Object.entries(dS)){if(n==="")continue;let i=t,a="";Nc[i].allowInline?a=`\`INPUT[${n}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${n}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((t,n)=>t[0].localeCompare(n[0])),e}function gS(r){let e=[];for(let[t,n]of Object.entries(XU)){if(n==="")continue;let i=t,a=`\`${n}\``;e.push([i,a])}return e.push(["markdown","`VIEW[**some markdown** {exampleProperty}][text(renderMarkdown)]`"]),e.sort((t,n)=>t[0].localeCompare(n[0])),e}var vS=require("obsidian");function QU(r){let e;return{c(){e=Z("div")},m(t,n){J(t,e,n),r[4](e)},p:Me,i:Me,o:Me,d(t){t&&j(e),r[4](null)}}}function KU(r,e,t){let{type:n}=e,{declaration:i}=e,{plugin:a}=e,o,l;sn(()=>{o=new vS.Component,a.api.createInputField(i,"block","",l,o),o.load()}),To(()=>{o.unload()});function u(s){Ir[s?"unshift":"push"](()=>{l=s,t(0,l)})}return r.$$set=s=>{"type"in s&&t(1,n=s.type),"declaration"in s&&t(2,i=s.declaration),"plugin"in s&&t(3,a=s.plugin)},[l,n,i,a,u]}var qd=class extends Le{constructor(e){super(),$e(this,e,KU,QU,Ve,{type:1,declaration:2,plugin:3})}},yS=qd;function bS(r,e,t){let n=r.slice();return n[7]=e[t],n}function e6(r){let e;return{c(){e=Ie("Docs")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function t6(r){let e;return{c(){e=Ie("GitHub")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function r6(r){let e;return{c(){e=Ie("Report Issue")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function xS(r){let e,t;return e=new yS({props:{type:r[7][0],declaration:r[7][1],plugin:r[1]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&2&&(a.type=n[7][0]),i&2&&(a.declaration=n[7][1]),i&2&&(a.plugin=n[1]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function n6(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h,d,g,v,w,y,x,_,b,E,D,A,S,M,F,P,R,O,I,T,$,B,U,G,H,L,ae,ve,se,le,he,K,ne;l=new Et({props:{variant:"primary",$$slots:{default:[e6]},$$scope:{ctx:r}}}),l.$on("click",r[4]),s=new Et({props:{variant:"default",$$slots:{default:[t6]},$$scope:{ctx:r}}}),s.$on("click",r[5]),f=new Et({props:{variant:"default",$$slots:{default:[r6]},$$scope:{ctx:r}}}),f.$on("click",r[6]),A=new Wu({props:{app:r[0],declaration:i6,errorCollection:r[2]}}),P=new Wu({props:{app:r[0],declaration:a6,errorCollection:r[3]}});let me=We($d(r[1])),de=[];for(let Se=0;Se<me.length;Se+=1)de[Se]=xS(bS(r,me,Se));let Oe=Se=>re(de[Se],1,1,()=>{de[Se]=null});return{c(){e=Z("div"),t=Z("h1"),t.textContent="Meta Bind FAQ",n=ue(),i=Z("h2"),i.textContent="Quick Access",a=ue(),o=Z("p"),we(l.$$.fragment),u=ue(),we(s.$$.fragment),c=ue(),we(f.$$.fragment),p=ue(),m=Z("h2"),m.textContent="Error Messages",h=ue(),d=Z("p"),g=Ie("When creating "),v=Z("a"),v.textContent="Input Fields",y=Ie(` or
`),x=Z("a"),x.textContent="View Fields",b=ue(),E=Z("strong"),E.textContent="warnings",D=Ie(` (
`),we(A.$$.fragment),S=Ie(`
) and `),M=Z("strong"),M.textContent="errors",F=Ie(` (
`),we(P.$$.fragment),R=Ie(`
) can occur. These are `),O=Z("strong"),O.textContent="clickable",I=Ie(` and will show a modal with detailed information about the error
when clicked.`),T=ue(),$=Z("h2"),$.textContent="Input Fields",B=ue(),U=Z("p"),U.innerHTML=`<a href="${bt.linkToInputFields()}">Input Fields</a> let you change the frontmatter of your notes from inside
of notes.`,G=ue();for(let Se=0;Se<de.length;Se+=1)de[Se].c();H=ue(),L=Z("h2"),L.textContent="View Fields",ae=ue(),ve=Z("p"),ve.innerHTML=`<a href="${bt.linkToViewFields()}">View Fields</a> let you view and perform calculations using the frontmatter
of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
fields and as fast as obsidian allows it for changes from other sources.`,se=ue(),le=Z("h2"),le.textContent="Bind Targets",he=ue(),K=Z("p"),K.innerHTML=`<a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a>
let the plugin know what frontmatter properties to bind
<a href="${bt.linkToInputFields()}">Input Fields</a>
and
<a href="${bt.linkToViewFields()}">View Fields</a> to.`,k(v,"href",w=bt.linkToInputFields()),k(x,"href",_=bt.linkToViewFields()),k(e,"class","mb-faq-view markdown-rendered")},m(Se,V){J(Se,e,V),z(e,t),z(e,n),z(e,i),z(e,a),z(e,o),be(l,o,null),z(o,u),be(s,o,null),z(o,c),be(f,o,null),z(e,p),z(e,m),z(e,h),z(e,d),z(d,g),z(d,v),z(d,y),z(d,x),z(d,b),z(d,E),z(d,D),be(A,d,null),z(d,S),z(d,M),z(d,F),be(P,d,null),z(d,R),z(d,O),z(d,I),z(e,T),z(e,$),z(e,B),z(e,U),z(e,G);for(let X=0;X<de.length;X+=1)de[X]&&de[X].m(e,null);z(e,H),z(e,L),z(e,ae),z(e,ve),z(e,se),z(e,le),z(e,he),z(e,K),ne=!0},p(Se,[V]){let X={};V&1024&&(X.$$scope={dirty:V,ctx:Se}),l.$set(X);let fe={};V&1024&&(fe.$$scope={dirty:V,ctx:Se}),s.$set(fe);let W={};V&1024&&(W.$$scope={dirty:V,ctx:Se}),f.$set(W);let te={};V&1&&(te.app=Se[0]),V&4&&(te.errorCollection=Se[2]),A.$set(te);let ie={};if(V&1&&(ie.app=Se[0]),V&8&&(ie.errorCollection=Se[3]),P.$set(ie),V&2){me=We($d(Se[1]));let ge;for(ge=0;ge<me.length;ge+=1){let ye=bS(Se,me,ge);de[ge]?(de[ge].p(ye,V),ee(de[ge],1)):(de[ge]=xS(ye),de[ge].c(),ee(de[ge],1),de[ge].m(e,H))}for(pt(),ge=me.length;ge<de.length;ge+=1)Oe(ge);mt()}},i(Se){if(!ne){ee(l.$$.fragment,Se),ee(s.$$.fragment,Se),ee(f.$$.fragment,Se),ee(A.$$.fragment,Se),ee(P.$$.fragment,Se);for(let V=0;V<me.length;V+=1)ee(de[V]);ne=!0}},o(Se){re(l.$$.fragment,Se),re(s.$$.fragment,Se),re(f.$$.fragment,Se),re(A.$$.fragment,Se),re(P.$$.fragment,Se),de=de.filter(Boolean);for(let V=0;V<de.length;V+=1)re(de[V]);ne=!1},d(Se){Se&&j(e),xe(l),xe(s),xe(f),xe(A),xe(P),At(de,Se)}}}var i6="INPUT[someInputFieldDeclaration]",a6="INPUT[someInputFieldDeclaration]";function o6(r,e,t){let{app:n}=e,{plugin:i}=e,a=new Rt("exampleWarningErrorCollection"),o=new Rt("exampleErrorErrorCollection");sn(()=>{a.add(new Hu({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),t(2,a),o.add(new Hu({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"})),t(3,o)});let l=()=>{bt.open(bt.linkToHome())},u=()=>{bt.open(bt.linkToGithub())},s=()=>{bt.open(bt.linkToIssues())};return r.$$set=c=>{"app"in c&&t(0,n=c.app),"plugin"in c&&t(1,i=c.plugin)},[n,i,a,o,l,u,s]}var zd=class extends Le{constructor(e){super(),$e(this,e,o6,n6,Ve,{app:0,plugin:1})}},wS=zd;var Oo="mb-faq-view-type",Mc=class extends _S.ItemView{constructor(e,t){super(e),this.plugin=t}getViewType(){return Oo}getDisplayText(){return"Meta Bind FAQ"}async onOpen(){let e=this.containerEl.children[1];e.empty(),this.component=new wS({target:e,props:{app:this.app,plugin:this.plugin}})}async onClose(){var e;(e=this.component)==null||e.$destroy()}};var oE=require("obsidian");function Zu(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})}var Rs=require("obsidian");var eE=require("obsidian");function s6(r){en(r,"svelte-17mpvkc",".vertical.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1)}.vertical-control.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1);width:100%}")}function u6(r){var d,g;let e,t,n,i=((d=r[0])!=null?d:"")+"",a,o,l,u=((g=r[1])!=null?g:"")+"",s,c,f,p,m=r[5].default,h=Mi(m,r,r[4],null);return{c(){e=Z("div"),t=Z("div"),n=Z("div"),a=Ie(i),o=ue(),l=Z("div"),s=Ie(u),c=ue(),f=Z("div"),h&&h.c(),k(n,"class","setting-item-name"),k(l,"class","setting-item-description"),k(t,"class","setting-item-info"),k(f,"class","setting-item-control svelte-17mpvkc"),St(f,"vertical-control",r[3]),k(e,"class","setting-item svelte-17mpvkc"),St(e,"setting-item-heading",r[2]),St(e,"vertical",r[3])},m(v,w){J(v,e,w),z(e,t),z(t,n),z(n,a),z(t,o),z(t,l),z(l,s),z(e,c),z(e,f),h&&h.m(f,null),p=!0},p(v,[w]){var y,x;(!p||w&1)&&i!==(i=((y=v[0])!=null?y:"")+"")&&Ke(a,i),(!p||w&2)&&u!==(u=((x=v[1])!=null?x:"")+"")&&Ke(s,u),h&&h.p&&(!p||w&16)&&Fi(h,m,v,v[4],p?Ti(m,v[4],w,null):Ii(v[4]),null),(!p||w&8)&&St(f,"vertical-control",v[3]),(!p||w&4)&&St(e,"setting-item-heading",v[2]),(!p||w&8)&&St(e,"vertical",v[3])},i(v){p||(ee(h,v),p=!0)},o(v){re(h,v),p=!1},d(v){v&&j(e),h&&h.d(v)}}}function l6(r,e,t){let{$$slots:n={},$$scope:i}=e,{name:a=void 0}=e,{description:o=void 0}=e,{heading:l=!1}=e,{vertical:u=!1}=e;return r.$$set=s=>{"name"in s&&t(0,a=s.name),"description"in s&&t(1,o=s.description),"heading"in s&&t(2,l=s.heading),"vertical"in s&&t(3,u=s.vertical),"$$scope"in s&&t(4,i=s.$$scope)},[a,o,l,u,i,n]}var Hd=class extends Le{constructor(e){super(),$e(this,e,l6,u6,Ve,{name:0,description:1,heading:2,vertical:3},s6)}},Wr=Hd;var QS=require("obsidian");var AS=require("obsidian"),Tc=class extends AS.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.commands.listCommands()}getItemText(e){return e.name}onChooseItem(e,t){this.selectCallback(e)}};var Ic=require("obsidian"),Fc=class extends Ic.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Ic.TFolder)}getItemText(e){return e.path}onChooseItem(e,t){this.selectCallback(e)}};var Pc=require("obsidian"),Bc=class extends Pc.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.selectCallback=t}getItems(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Pc.TFile)}getItemText(e){return e.path}onChooseItem(e,t){this.selectCallback(e)}};function c6(r){let e,t,n,i;return{c(){e=Z("div"),t=Z("input"),k(t,"type","checkbox"),k(t,"tabindex","-1"),t.checked=r[0],k(e,"class","checkbox-container"),k(e,"role","switch"),k(e,"tabindex","0"),k(e,"aria-checked",r[0]),St(e,"is-enabled",r[0])},m(a,o){J(a,e,o),z(e,t),n||(i=Ae(e,"click",r[1]),n=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&k(e,"aria-checked",a[0]),o&1&&St(e,"is-enabled",a[0])},i:Me,o:Me,d(a){a&&j(e),n=!1,i()}}}function f6(r,e,t){let{checked:n}=e,i=()=>t(0,n=!n);return r.$$set=a=>{"checked"in a&&t(0,n=a.checked)},[n,i]}var Gd=class extends Le{constructor(e){super(),$e(this,e,f6,c6,Ve,{checked:0})}},Oc=Gd;var Ra=class{constructor(){this.mounted=!1}isMounted(){return this.mounted}getTargetEl(){return this.targetEl}mount(e){if(this.mounted||this.targetEl)throw new Error("Mountable is already mounted");this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl)throw new Error("Mountable is not mounted");this.mounted=!1,this.onUnmount(this.targetEl),this.targetEl=void 0}};var fi=class extends Ra{constructor(e,t,n){super(),this.plugin=e,this.filePath=n,this.uuid=t}getUuid(){return this.uuid}getFilePath(){return this.filePath}};function p6(r){en(r,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function m6(r){let e,t,n,i;return{c(){e=Z("button"),t=Ie(r[3]),k(e,"class","mb-button-inner svelte-12xcpmj"),k(e,"aria-label",r[2]),e.disabled=r[0],St(e,"mod-cta",r[1]==="primary"),St(e,"mod-warning",r[1]==="destructive"),St(e,"mod-plain",r[1]==="plain"),St(e,"disabled",r[0]),St(e,"mb-error",r[4])},m(a,o){J(a,e,o),z(e,t),n||(i=Ae(e,"click",r[7]),n=!0)},p(a,[o]){o&8&&Ke(t,a[3]),o&4&&k(e,"aria-label",a[2]),o&1&&(e.disabled=a[0]),o&2&&St(e,"mod-cta",a[1]==="primary"),o&2&&St(e,"mod-warning",a[1]==="destructive"),o&2&&St(e,"mod-plain",a[1]==="plain"),o&1&&St(e,"disabled",a[0]),o&16&&St(e,"mb-error",a[4])},i:Me,o:Me,d(a){a&&j(e),n=!1,i()}}}function d6(r,e,t){let{variant:n="default"}=e,{disabled:i=!1}=e,{tooltip:a=""}=e,{label:o=""}=e,{error:l=!1}=e,{onClick:u=()=>Zu(void 0,void 0,void 0,function*(){})}=e;function s(){return Zu(this,void 0,void 0,function*(){if(!i){t(0,i=!0);try{yield u()}catch(f){console.warn("failed to run button component on click",f)}finally{t(0,i=!1)}}})}let c=()=>s();return r.$$set=f=>{"variant"in f&&t(1,n=f.variant),"disabled"in f&&t(0,i=f.disabled),"tooltip"in f&&t(2,a=f.tooltip),"label"in f&&t(3,o=f.label),"error"in f&&t(4,l=f.error),"onClick"in f&&t(6,u=f.onClick)},[i,n,a,o,l,s,u,c]}var Wd=class extends Le{constructor(e){super(),$e(this,e,d6,m6,Ve,{variant:1,disabled:0,tooltip:2,label:3,error:4,onClick:6},p6)}},kc=Wd;var Kt;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},r.getValidEnumValues=i=>{let a=r.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(let l of a)o[l]=i[l];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(a){return i[a]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},r.find=(i,a)=>{for(let o of i)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Kt||(Kt={}));var Zd;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Zd||(Zd={}));var Qe=Kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),La=r=>{switch(typeof r){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return isNaN(r)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(r)?Qe.array:r===null?Qe.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Qe.promise:typeof Map!="undefined"&&r instanceof Map?Qe.map:typeof Set!="undefined"&&r instanceof Set?Qe.set:typeof Date!="undefined"&&r instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},He=Kt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),h6=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Zn=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let l=n,u=0;for(;u<o.path.length;){let s=o.path[u];u===o.path.length-1?(l[s]=l[s]||{_errors:[]},l[s]._errors.push(t(o))):l[s]=l[s]||{_errors:[]},l=l[s],u++}}};return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Zn.create=r=>new Zn(r);var Ju=(r,e)=>{let t;switch(r.code){case He.invalid_type:r.received===Qe.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case He.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Kt.jsonStringifyReplacer)}`;break;case He.unrecognized_keys:t=`Unrecognized key(s) in object: ${Kt.joinValues(r.keys,", ")}`;break;case He.invalid_union:t="Invalid input";break;case He.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Kt.joinValues(r.options)}`;break;case He.invalid_enum_value:t=`Invalid enum value. Expected ${Kt.joinValues(r.options)}, received '${r.received}'`;break;case He.invalid_arguments:t="Invalid function arguments";break;case He.invalid_return_type:t="Invalid function return type";break;case He.invalid_date:t="Invalid date";break;case He.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Kt.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case He.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case He.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case He.custom:t="Invalid input";break;case He.invalid_intersection_types:t="Intersection results could not be merged";break;case He.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case He.not_finite:t="Number must be finite";break;default:t=e.defaultError,Kt.assertNever(r)}return{message:t}},DS=Ju;function g6(r){DS=r}function Lc(){return DS}var Uc=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,a=[...t,...i.path||[]],o={...i,path:a},l="",u=n.filter(s=>!!s).slice().reverse();for(let s of u)l=s(o,{data:e,defaultError:l}).message;return{...i,path:a,message:i.message||l}},v6=[];function tt(r,e){let t=Uc({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Lc(),Ju].filter(n=>!!n)});r.common.issues.push(t)}var hn=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Ft;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t)n.push({key:await i.key,value:await i.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Ft;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value!="undefined"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Ft=Object.freeze({status:"aborted"}),NS=r=>({status:"dirty",value:r}),Dn=r=>({status:"valid",value:r}),Jd=r=>r.status==="aborted",Yd=r=>r.status==="dirty",Yu=r=>r.status==="valid",Vc=r=>typeof Promise!="undefined"&&r instanceof Promise,dt;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(dt||(dt={}));var pi=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},SS=(r,e)=>{if(Yu(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Zn(r.common.issues);return this._error=t,this._error}}};function Pt(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,l)=>o.code!=="invalid_type"?{message:l.defaultError}:typeof l.data=="undefined"?{message:n!=null?n:l.defaultError}:{message:t!=null?t:l.defaultError},description:i}}var Ot=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return La(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:La(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new hn,ctx:{common:e.parent.common,data:e.data,parsedType:La(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Vc(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:La(e)},a=this._parseSync({data:e,path:i.path,parent:i});return SS(i,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:La(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Vc(i)?i:Promise.resolve(i));return SS(n,a)}refine(e,t){let n=i=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{let o=e(i),l=()=>a.addIssue({code:He.custom,...n(i)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Jn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Pi.create(this,this._def)}nullable(){return ha.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return da.create(this,this._def)}promise(){return $a.create(this,this._def)}or(e){return qo.create([this,e],this._def)}and(e){return zo.create(this,e,this._def)}transform(e){return new Jn({...Pt(this._def),schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Zo({...Pt(this._def),innerType:this,defaultValue:t,typeName:xt.ZodDefault})}brand(){return new Hc({typeName:xt.ZodBranded,type:this,...Pt(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Is({...Pt(this._def),innerType:this,catchValue:t,typeName:xt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xu.create(this,e)}readonly(){return Ps.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},y6=/^c[^\s-]{8,}$/i,b6=/^[a-z][a-z0-9]*$/,x6=/^[0-9A-HJKMNP-TV-Z]{26}$/,w6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_6=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",jd,S6=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,E6=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,D6=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function N6(r,e){return!!((e==="v4"||!e)&&S6.test(r)||(e==="v6"||!e)&&E6.test(r))}var Ua=class r extends Ot{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Qe.string){let a=this._getOrReturnCtx(e);return tt(a,{code:He.invalid_type,expected:Qe.string,received:a.parsedType}),Ft}let n=new hn,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:He.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:He.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,l=e.data.length<a.value;(o||l)&&(i=this._getOrReturnCtx(e,i),o?tt(i,{code:He.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&tt(i,{code:He.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")_6.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"email",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")jd||(jd=new RegExp(A6,"u")),jd.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"emoji",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")w6.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"uuid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")y6.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"cuid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")b6.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"cuid2",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")x6.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"ulid",code:He.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(o){i=this._getOrReturnCtx(e,i),tt(i,{validation:"url",code:He.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"regex",code:He.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),tt(i,{code:He.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),tt(i,{code:He.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),tt(i,{code:He.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?D6(a).test(e.data)||(i=this._getOrReturnCtx(e,i),tt(i,{code:He.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?N6(e.data,a.version)||(i=this._getOrReturnCtx(e,i),tt(i,{validation:"ip",code:He.invalid_string,message:a.message}),n.dirty()):Kt.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:He.invalid_string,...dt.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...dt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...dt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...dt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...dt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...dt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...dt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...dt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...dt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...dt.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...dt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...dt.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...dt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...dt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...dt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...dt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...dt.errToObj(t)})}nonempty(e){return this.min(1,dt.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ua.create=r=>{var e;return new Ua({checks:[],typeName:xt.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Pt(r)})};function C6(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var ko=class r extends Ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Qe.number){let a=this._getOrReturnCtx(e);return tt(a,{code:He.invalid_type,expected:Qe.number,received:a.parsedType}),Ft}let n,i=new hn;for(let a of this._def.checks)a.kind==="int"?Kt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),tt(n,{code:He.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?C6(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),tt(n,{code:He.not_finite,message:a.message}),i.dirty()):Kt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,dt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,dt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,dt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,dt.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:dt.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:dt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:dt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:dt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:dt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Kt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ko.create=r=>new ko({checks:[],typeName:xt.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...Pt(r)});var Ro=class r extends Ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Qe.bigint){let a=this._getOrReturnCtx(e);return tt(a,{code:He.invalid_type,expected:Qe.bigint,received:a.parsedType}),Ft}let n,i=new hn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),tt(n,{code:He.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Kt.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,dt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,dt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,dt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,dt.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:dt.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:dt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:dt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ro.create=r=>{var e;return new Ro({checks:[],typeName:xt.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...Pt(r)})};var Lo=class extends Ot{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Qe.boolean){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.boolean,received:n.parsedType}),Ft}return Dn(e.data)}};Lo.create=r=>new Lo({typeName:xt.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...Pt(r)});var Uo=class r extends Ot{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Qe.date){let a=this._getOrReturnCtx(e);return tt(a,{code:He.invalid_type,expected:Qe.date,received:a.parsedType}),Ft}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return tt(a,{code:He.invalid_date}),Ft}let n=new hn,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:He.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),tt(i,{code:He.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Kt.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:dt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:dt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Uo.create=r=>new Uo({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:xt.ZodDate,...Pt(r)});var Cs=class extends Ot{_parse(e){if(this._getType(e)!==Qe.symbol){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.symbol,received:n.parsedType}),Ft}return Dn(e.data)}};Cs.create=r=>new Cs({typeName:xt.ZodSymbol,...Pt(r)});var Vo=class extends Ot{_parse(e){if(this._getType(e)!==Qe.undefined){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.undefined,received:n.parsedType}),Ft}return Dn(e.data)}};Vo.create=r=>new Vo({typeName:xt.ZodUndefined,...Pt(r)});var $o=class extends Ot{_parse(e){if(this._getType(e)!==Qe.null){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.null,received:n.parsedType}),Ft}return Dn(e.data)}};$o.create=r=>new $o({typeName:xt.ZodNull,...Pt(r)});var Va=class extends Ot{constructor(){super(...arguments),this._any=!0}_parse(e){return Dn(e.data)}};Va.create=r=>new Va({typeName:xt.ZodAny,...Pt(r)});var ma=class extends Ot{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Dn(e.data)}};ma.create=r=>new ma({typeName:xt.ZodUnknown,...Pt(r)});var Oi=class extends Ot{_parse(e){let t=this._getOrReturnCtx(e);return tt(t,{code:He.invalid_type,expected:Qe.never,received:t.parsedType}),Ft}};Oi.create=r=>new Oi({typeName:xt.ZodNever,...Pt(r)});var Ms=class extends Ot{_parse(e){if(this._getType(e)!==Qe.undefined){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.void,received:n.parsedType}),Ft}return Dn(e.data)}};Ms.create=r=>new Ms({typeName:xt.ZodVoid,...Pt(r)});var da=class r extends Ot{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Qe.array)return tt(t,{code:He.invalid_type,expected:Qe.array,received:t.parsedType}),Ft;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,l=t.data.length<i.exactLength.value;(o||l)&&(tt(t,{code:o?He.too_big:He.too_small,minimum:l?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(tt(t,{code:He.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(tt(t,{code:He.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>i.type._parseAsync(new pi(t,o,t.path,l)))).then(o=>hn.mergeArray(n,o));let a=[...t.data].map((o,l)=>i.type._parseSync(new pi(t,o,t.path,l)));return hn.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:dt.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:dt.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:dt.toString(t)}})}nonempty(e){return this.min(1,e)}};da.create=(r,e)=>new da({type:r,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Pt(e)});function Ns(r){if(r instanceof Bn){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Pi.create(Ns(n))}return new Bn({...r._def,shape:()=>e})}else return r instanceof da?new da({...r._def,type:Ns(r.element)}):r instanceof Pi?Pi.create(Ns(r.unwrap())):r instanceof ha?ha.create(Ns(r.unwrap())):r instanceof Zi?Zi.create(r.items.map(e=>Ns(e))):r}var Bn=class r extends Ot{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Kt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Qe.object){let s=this._getOrReturnCtx(e);return tt(s,{code:He.invalid_type,expected:Qe.object,received:s.parsedType}),Ft}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Oi&&this._def.unknownKeys==="strip"))for(let s in i.data)o.includes(s)||l.push(s);let u=[];for(let s of o){let c=a[s],f=i.data[s];u.push({key:{status:"valid",value:s},value:c._parse(new pi(i,f,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof Oi){let s=this._def.unknownKeys;if(s==="passthrough")for(let c of l)u.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(s==="strict")l.length>0&&(tt(i,{code:He.unrecognized_keys,keys:l}),n.dirty());else if(s!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let s=this._def.catchall;for(let c of l){let f=i.data[c];u.push({key:{status:"valid",value:c},value:s._parse(new pi(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let s=[];for(let c of u){let f=await c.key;s.push({key:f,value:await c.value,alwaysSet:c.alwaysSet})}return s}).then(s=>hn.mergeObjectSync(n,s)):hn.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return dt.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,a,o,l;let u=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(l=dt.errToObj(e).message)!==null&&l!==void 0?l:u}:{message:u}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return Kt.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return Kt.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return Ns(this)}partial(e){let t={};return Kt.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return Kt.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Pi;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return CS(Kt.objectKeys(this.shape))}};Bn.create=(r,e)=>new Bn({shape:()=>r,unknownKeys:"strip",catchall:Oi.create(),typeName:xt.ZodObject,...Pt(e)});Bn.strictCreate=(r,e)=>new Bn({shape:()=>r,unknownKeys:"strict",catchall:Oi.create(),typeName:xt.ZodObject,...Pt(e)});Bn.lazycreate=(r,e)=>new Bn({shape:r,unknownKeys:"strip",catchall:Oi.create(),typeName:xt.ZodObject,...Pt(e)});var qo=class extends Ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(a){for(let l of a)if(l.result.status==="valid")return l.result;for(let l of a)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let o=a.map(l=>new Zn(l.ctx.common.issues));return tt(t,{code:He.invalid_union,unionErrors:o}),Ft}if(t.common.async)return Promise.all(n.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let u of n){let s={...t,common:{...t.common,issues:[]},parent:null},c=u._parseSync({data:t.data,path:t.path,parent:s});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:s}),s.common.issues.length&&o.push(s.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let l=o.map(u=>new Zn(u));return tt(t,{code:He.invalid_union,unionErrors:l}),Ft}}get options(){return this._def.options}};qo.create=(r,e)=>new qo({options:r,typeName:xt.ZodUnion,...Pt(e)});var Rc=r=>r instanceof Ho?Rc(r.schema):r instanceof Jn?Rc(r.innerType()):r instanceof Go?[r.value]:r instanceof Wo?r.options:r instanceof jo?Object.keys(r.enum):r instanceof Zo?Rc(r._def.innerType):r instanceof Vo?[void 0]:r instanceof $o?[null]:null,$c=class r extends Ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qe.object)return tt(t,{code:He.invalid_type,expected:Qe.object,received:t.parsedType}),Ft;let n=this.discriminator,i=t.data[n],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(tt(t,{code:He.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ft)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let a of t){let o=Rc(a.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of o){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,a)}}return new r({typeName:xt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Pt(n)})}};function Xd(r,e){let t=La(r),n=La(e);if(r===e)return{valid:!0,data:r};if(t===Qe.object&&n===Qe.object){let i=Kt.objectKeys(e),a=Kt.objectKeys(r).filter(l=>i.indexOf(l)!==-1),o={...r,...e};for(let l of a){let u=Xd(r[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===Qe.array&&n===Qe.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<r.length;a++){let o=r[a],l=e[a],u=Xd(o,l);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===Qe.date&&n===Qe.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var zo=class extends Ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Jd(a)||Jd(o))return Ft;let l=Xd(a.value,o.value);return l.valid?((Yd(a)||Yd(o))&&t.dirty(),{status:t.value,value:l.data}):(tt(n,{code:He.invalid_intersection_types}),Ft)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};zo.create=(r,e,t)=>new zo({left:r,right:e,typeName:xt.ZodIntersection,...Pt(t)});var Zi=class r extends Ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.array)return tt(n,{code:He.invalid_type,expected:Qe.array,received:n.parsedType}),Ft;if(n.data.length<this._def.items.length)return tt(n,{code:He.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ft;!this._def.rest&&n.data.length>this._def.items.length&&(tt(n,{code:He.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new pi(n,o,n.path,l)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>hn.mergeArray(t,o)):hn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Zi.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zi({items:r,typeName:xt.ZodTuple,rest:null,...Pt(e)})};var qc=class r extends Ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.object)return tt(n,{code:He.invalid_type,expected:Qe.object,received:n.parsedType}),Ft;let i=[],a=this._def.keyType,o=this._def.valueType;for(let l in n.data)i.push({key:a._parse(new pi(n,l,n.path,l)),value:o._parse(new pi(n,n.data[l],n.path,l))});return n.common.async?hn.mergeObjectAsync(t,i):hn.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Ot?new r({keyType:e,valueType:t,typeName:xt.ZodRecord,...Pt(n)}):new r({keyType:Ua.create(),valueType:e,typeName:xt.ZodRecord,...Pt(t)})}},Ts=class extends Ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.map)return tt(n,{code:He.invalid_type,expected:Qe.map,received:n.parsedType}),Ft;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([l,u],s)=>({key:i._parse(new pi(n,l,n.path,[s,"key"])),value:a._parse(new pi(n,u,n.path,[s,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of o){let s=await u.key,c=await u.value;if(s.status==="aborted"||c.status==="aborted")return Ft;(s.status==="dirty"||c.status==="dirty")&&t.dirty(),l.set(s.value,c.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let u of o){let s=u.key,c=u.value;if(s.status==="aborted"||c.status==="aborted")return Ft;(s.status==="dirty"||c.status==="dirty")&&t.dirty(),l.set(s.value,c.value)}return{status:t.value,value:l}}}};Ts.create=(r,e,t)=>new Ts({valueType:e,keyType:r,typeName:xt.ZodMap,...Pt(t)});var Fs=class r extends Ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qe.set)return tt(n,{code:He.invalid_type,expected:Qe.set,received:n.parsedType}),Ft;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(tt(n,{code:He.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(tt(n,{code:He.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let s=new Set;for(let c of u){if(c.status==="aborted")return Ft;c.status==="dirty"&&t.dirty(),s.add(c.value)}return{status:t.value,value:s}}let l=[...n.data.values()].map((u,s)=>a._parse(new pi(n,u,n.path,s)));return n.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new r({...this._def,minSize:{value:e,message:dt.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:dt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Fs.create=(r,e)=>new Fs({valueType:r,minSize:null,maxSize:null,typeName:xt.ZodSet,...Pt(e)});var zc=class r extends Ot{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qe.function)return tt(t,{code:He.invalid_type,expected:Qe.function,received:t.parsedType}),Ft;function n(l,u){return Uc({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Lc(),Ju].filter(s=>!!s),issueData:{code:He.invalid_arguments,argumentsError:u}})}function i(l,u){return Uc({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Lc(),Ju].filter(s=>!!s),issueData:{code:He.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof $a){let l=this;return Dn(async function(...u){let s=new Zn([]),c=await l._def.args.parseAsync(u,a).catch(m=>{throw s.addIssue(n(u,m)),s}),f=await Reflect.apply(o,this,c);return await l._def.returns._def.type.parseAsync(f,a).catch(m=>{throw s.addIssue(i(f,m)),s})})}else{let l=this;return Dn(function(...u){let s=l._def.args.safeParse(u,a);if(!s.success)throw new Zn([n(u,s.error)]);let c=Reflect.apply(o,this,s.data),f=l._def.returns.safeParse(c,a);if(!f.success)throw new Zn([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Zi.create(e).rest(ma.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Zi.create([]).rest(ma.create()),returns:t||ma.create(),typeName:xt.ZodFunction,...Pt(n)})}},Ho=class extends Ot{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ho.create=(r,e)=>new Ho({getter:r,typeName:xt.ZodLazy,...Pt(e)});var Go=class extends Ot{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return tt(t,{received:t.data,code:He.invalid_literal,expected:this._def.value}),Ft}return{status:"valid",value:e.data}}get value(){return this._def.value}};Go.create=(r,e)=>new Go({value:r,typeName:xt.ZodLiteral,...Pt(e)});function CS(r,e){return new Wo({values:r,typeName:xt.ZodEnum,...Pt(e)})}var Wo=class r extends Ot{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return tt(t,{expected:Kt.joinValues(n),received:t.parsedType,code:He.invalid_type}),Ft}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return tt(t,{received:t.data,code:He.invalid_enum_value,options:n}),Ft}return Dn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};Wo.create=CS;var jo=class extends Ot{_parse(e){let t=Kt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Qe.string&&n.parsedType!==Qe.number){let i=Kt.objectValues(t);return tt(n,{expected:Kt.joinValues(i),received:n.parsedType,code:He.invalid_type}),Ft}if(t.indexOf(e.data)===-1){let i=Kt.objectValues(t);return tt(n,{received:n.data,code:He.invalid_enum_value,options:i}),Ft}return Dn(e.data)}get enum(){return this._def.values}};jo.create=(r,e)=>new jo({values:r,typeName:xt.ZodNativeEnum,...Pt(e)});var $a=class extends Ot{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qe.promise&&t.common.async===!1)return tt(t,{code:He.invalid_type,expected:Qe.promise,received:t.parsedType}),Ft;let n=t.parsedType===Qe.promise?t.data:Promise.resolve(t.data);return Dn(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};$a.create=(r,e)=>new $a({type:r,typeName:xt.ZodPromise,...Pt(e)});var Jn=class extends Ot{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{tt(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(o).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}if(i.type==="refinement"){let o=l=>{let u=i.refinement(l,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Ft:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Ft:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Yu(o))return o;let l=i.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Yu(o)?Promise.resolve(i.transform(o.value,a)).then(l=>({status:t.value,value:l})):o);Kt.assertNever(i)}};Jn.create=(r,e,t)=>new Jn({schema:r,typeName:xt.ZodEffects,effect:e,...Pt(t)});Jn.createWithPreprocess=(r,e,t)=>new Jn({schema:e,effect:{type:"preprocess",transform:r},typeName:xt.ZodEffects,...Pt(t)});var Pi=class extends Ot{_parse(e){return this._getType(e)===Qe.undefined?Dn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pi.create=(r,e)=>new Pi({innerType:r,typeName:xt.ZodOptional,...Pt(e)});var ha=class extends Ot{_parse(e){return this._getType(e)===Qe.null?Dn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ha.create=(r,e)=>new ha({innerType:r,typeName:xt.ZodNullable,...Pt(e)});var Zo=class extends Ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Qe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Zo.create=(r,e)=>new Zo({innerType:r,typeName:xt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pt(e)});var Is=class extends Ot{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Vc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Is.create=(r,e)=>new Is({innerType:r,typeName:xt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pt(e)});var Bs=class extends Ot{_parse(e){if(this._getType(e)!==Qe.nan){let n=this._getOrReturnCtx(e);return tt(n,{code:He.invalid_type,expected:Qe.nan,received:n.parsedType}),Ft}return{status:"valid",value:e.data}}};Bs.create=r=>new Bs({typeName:xt.ZodNaN,...Pt(r)});var M6=Symbol("zod_brand"),Hc=class extends Ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Xu=class r extends Ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ft:a.status==="dirty"?(t.dirty(),NS(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ft:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:xt.ZodPipeline})}},Ps=class extends Ot{_parse(e){let t=this._def.innerType._parse(e);return Yu(t)&&(t.value=Object.freeze(t.value)),t}};Ps.create=(r,e)=>new Ps({innerType:r,typeName:xt.ZodReadonly,...Pt(e)});var MS=(r,e={},t)=>r?Va.create().superRefine((n,i)=>{var a,o;if(!r(n)){let l=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(o=(a=l.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0,s=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...s,fatal:u})}}):Va.create(),T6={object:Bn.lazycreate},xt;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(xt||(xt={}));var F6=(r,e={message:`Input not instance of ${r.name}`})=>MS(t=>t instanceof r,e),TS=Ua.create,FS=ko.create,I6=Bs.create,B6=Ro.create,IS=Lo.create,P6=Uo.create,O6=Cs.create,k6=Vo.create,R6=$o.create,L6=Va.create,U6=ma.create,V6=Oi.create,$6=Ms.create,q6=da.create,z6=Bn.create,H6=Bn.strictCreate,G6=qo.create,W6=$c.create,j6=zo.create,Z6=Zi.create,J6=qc.create,Y6=Ts.create,X6=Fs.create,Q6=zc.create,K6=Ho.create,eV=Go.create,tV=Wo.create,rV=jo.create,nV=$a.create,ES=Jn.create,iV=Pi.create,aV=ha.create,oV=Jn.createWithPreprocess,sV=Xu.create,uV=()=>TS().optional(),lV=()=>FS().optional(),cV=()=>IS().optional(),fV={string:r=>Ua.create({...r,coerce:!0}),number:r=>ko.create({...r,coerce:!0}),boolean:r=>Lo.create({...r,coerce:!0}),bigint:r=>Ro.create({...r,coerce:!0}),date:r=>Uo.create({...r,coerce:!0})},pV=Ft,Pe=Object.freeze({__proto__:null,defaultErrorMap:Ju,setErrorMap:g6,getErrorMap:Lc,makeIssue:Uc,EMPTY_PATH:v6,addIssueToContext:tt,ParseStatus:hn,INVALID:Ft,DIRTY:NS,OK:Dn,isAborted:Jd,isDirty:Yd,isValid:Yu,isAsync:Vc,get util(){return Kt},get objectUtil(){return Zd},ZodParsedType:Qe,getParsedType:La,ZodType:Ot,ZodString:Ua,ZodNumber:ko,ZodBigInt:Ro,ZodBoolean:Lo,ZodDate:Uo,ZodSymbol:Cs,ZodUndefined:Vo,ZodNull:$o,ZodAny:Va,ZodUnknown:ma,ZodNever:Oi,ZodVoid:Ms,ZodArray:da,ZodObject:Bn,ZodUnion:qo,ZodDiscriminatedUnion:$c,ZodIntersection:zo,ZodTuple:Zi,ZodRecord:qc,ZodMap:Ts,ZodSet:Fs,ZodFunction:zc,ZodLazy:Ho,ZodLiteral:Go,ZodEnum:Wo,ZodNativeEnum:jo,ZodPromise:$a,ZodEffects:Jn,ZodTransformer:Jn,ZodOptional:Pi,ZodNullable:ha,ZodDefault:Zo,ZodCatch:Is,ZodNaN:Bs,BRAND:M6,ZodBranded:Hc,ZodPipeline:Xu,ZodReadonly:Ps,custom:MS,Schema:Ot,ZodSchema:Ot,late:T6,get ZodFirstPartyTypeKind(){return xt},coerce:fV,any:L6,array:q6,bigint:B6,boolean:IS,date:P6,discriminatedUnion:W6,effect:ES,enum:tV,function:Q6,instanceof:F6,intersection:j6,lazy:K6,literal:eV,map:Y6,nan:I6,nativeEnum:rV,never:V6,null:R6,nullable:aV,number:FS,object:z6,oboolean:cV,onumber:lV,optional:iV,ostring:uV,pipeline:sV,preprocess:oV,promise:nV,record:J6,set:X6,strictObject:H6,string:TS,symbol:O6,transformer:ES,tuple:Z6,undefined:k6,union:G6,unknown:U6,void:$6,NEVER:pV,ZodIssueCode:He,quotelessJson:h6,ZodError:Zn});var mV=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function BS(r){return r.length===1?r[0].toString():r.reduce((e,t)=>{if(typeof t=="number")return e+"["+t.toString()+"]";if(t.includes('"'))return e+'["'+dV(t)+'"]';if(!mV.test(t))return e+'["'+t+'"]';let n=e.length===0?"":".";return e+n+t},"")}function dV(r){return r.replace(/"/g,'\\"')}function PS(r){return r.length!==0}var hV=99,gV="; ",vV=", or ",OS="Validation error",yV=": ",Gc=class extends Error{constructor(t,n=[]){super(t);Rr(this,"details");Rr(this,"name");this.details=n,this.name="ZodValidationError"}toString(){return this.message}};function kS(r){let{issue:e,issueSeparator:t,unionSeparator:n,includePath:i}=r;if(e.code==="invalid_union")return e.unionErrors.reduce((a,o)=>{let l=o.issues.map(u=>kS({issue:u,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return a.includes(l)||a.push(l),a},[]).join(n);if(i&&PS(e.path)){if(e.path.length===1){let a=e.path[0];if(typeof a=="number")return`${e.message} at index ${a}`}return`${e.message} at "${BS(e.path)}"`}return e.message}function bV(r,e,t){return e!==null?r.length>0?[e,r].join(t):e:r.length>0?r:OS}function Jo(r,e={}){let{maxIssuesInMessage:t=hV,issueSeparator:n=gV,unionSeparator:i=vV,prefixSeparator:a=yV,prefix:o=OS,includePath:l=!0}=e,u=r.errors.slice(0,t).map(c=>kS({issue:c,issueSeparator:n,unionSeparator:i,includePath:l})).join(n),s=bV(u,o,a);return new Gc(s,r.errors)}function RS(r,e){return(t,n)=>t[r]===void 0==(t[e]===void 0)?(n.addIssue({code:Pe.ZodIssueCode.custom,message:`Either ${r} or ${e} must be filled, but not both`}),!1):!0}function $t(){return function(r){return r}}function ki(r,e){let t=r.safeParse(e);if(!t.success)throw new zt({errorLevel:"CRITICAL",effect:"invalid arguments supplied to function",cause:Jo(t.error)})}var xV=$t()(Pe.object({type:Pe.literal("command"),command:Pe.string()})),wV=$t()(Pe.object({type:Pe.literal("js"),file:Pe.string()})),_V=$t()(Pe.object({type:Pe.literal("open"),link:Pe.string(),newTab:Pe.boolean().optional()})),AV=$t()(Pe.object({type:Pe.literal("input"),str:Pe.string()})),SV=$t()(Pe.object({type:Pe.literal("sleep"),ms:Pe.number()})),EV=$t()(Pe.object({type:Pe.literal("templaterCreateNote"),templateFile:Pe.string(),folderPath:Pe.string().optional(),fileName:Pe.string().optional(),openNote:Pe.boolean().optional()})),DV=$t()(Pe.object({type:Pe.literal("updateMetadata"),bindTarget:Pe.string(),evaluate:Pe.boolean(),value:Pe.coerce.string()})),LS=$t()(Pe.union([xV,wV,_V,AV,SV,EV,DV])),NV=Pe.nativeEnum(li),Wc=$t()(Pe.object({label:Pe.string(),style:NV,class:Pe.string().optional(),tooltip:Pe.string().optional(),id:Pe.string().optional(),hidden:Pe.boolean().optional(),action:LS.optional(),actions:LS.array().optional()}).superRefine(RS("action","actions")));var Os=class{constructor(e,t,n,i,a){this.plugin=e,this.unvalidatedConfig=t,this.filePath=n,this.inline=i,this.config=void 0,this.isPreview=a}renderButton(e){if(this.config===void 0)return;let t=this.config;this.buttonComponent=new kc({target:e,props:{variant:t.style,label:t.label,tooltip:cS(t.tooltip)?t.tooltip:t.label,onClick:async()=>{await this.plugin.api.buttonActionRunner.runButtonAction(t,this.filePath)}}})}mount(e){Bt.empty(e),Bt.addClasses(e,["mb-button",this.inline?"mb-button-inline":"mb-button-block"]);let t=Wc.safeParse(this.unvalidatedConfig);if(!t.success){let n=Jo(t.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});throw new pa({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:n.message,docs:[bt.linkToButtonConfig()]})}this.config=t.data,!(!this.inline&&!this.isPreview&&(this.config.id&&this.plugin.api.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&e.addClass(...this.config.class.split(" ").filter(n=>n!=="")),this.renderButton(e))}unmount(){var e,t;(e=this.buttonComponent)==null||e.$destroy(),this.inline||(t=this.config)!=null&&t.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var ks=class extends fi{constructor(e,t,n,i,a){super(e,t,n),this.declarationString=i,this.isPreview=a,this.errorCollection=new Rt(this.getUuid())}onMount(e){console.debug("meta-bind | ButtonBase >> mount",this.declarationString),Bt.removeAllClasses(e);let t=this.plugin.internal.parseYaml(this.declarationString);this.buttonField=new Os(this.plugin,t,this.getFilePath(),!1,this.isPreview);try{this.buttonField.mount(e)}catch(n){this.errorCollection.add(n),this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}}onUnmount(e){var t;console.debug("meta-bind | ButtonBase >> destroy",this.declarationString),(t=this.buttonField)==null||t.unmount(),ci(e,"button")}};function US(r,e,t){let n=r.slice();return n[42]=e[t],n[43]=e,n[44]=t,n}function VS(r,e,t){let n=r.slice();return n[45]=e[t],n}function $S(r,e,t){let n=r.slice();return n[45]=e[t],n}function CV(r){let e,t,n;return{c(){e=Z("input"),k(e,"type","text")},m(i,a){J(i,e,a),Ye(e,r[0].label),t||(n=Ae(e,"input",r[10]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].label&&Ye(e,i[0].label)},d(i){i&&j(e),t=!1,n()}}}function qS(r){let e,t=r[45]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[45],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p:Me,d(a){a&&j(e)}}}function MV(r){let e,t,n,i=We(Object.values(li)),a=[];for(let o=0;o<i.length;o+=1)a[o]=qS($S(r,i,o));return{c(){e=Z("select");for(let o=0;o<a.length;o+=1)a[o].c();k(e,"class","dropdown"),r[0].style===void 0&&tn(()=>r[11].call(e))},m(o,l){J(o,e,l);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(e,null);Fr(e,r[0].style,!0),t||(n=Ae(e,"change",r[11]),t=!0)},p(o,l){if(l&0){i=We(Object.values(li));let u;for(u=0;u<i.length;u+=1){let s=$S(o,i,u);a[u]?a[u].p(s,l):(a[u]=qS(s),a[u].c(),a[u].m(e,null))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}l[0]&1&&Fr(e,o[0].style)},d(o){o&&j(e),At(a,o),t=!1,n()}}}function TV(r){let e,t,n;return{c(){e=Z("input"),k(e,"type","text")},m(i,a){J(i,e,a),Ye(e,r[0].class),t||(n=Ae(e,"input",r[12]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].class&&Ye(e,i[0].class)},d(i){i&&j(e),t=!1,n()}}}function FV(r){let e,t,n;return{c(){e=Z("input"),k(e,"type","text")},m(i,a){J(i,e,a),Ye(e,r[0].tooltip),t||(n=Ae(e,"input",r[13]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].tooltip&&Ye(e,i[0].tooltip)},d(i){i&&j(e),t=!1,n()}}}function IV(r){let e,t,n;return{c(){e=Z("input"),k(e,"type","text")},m(i,a){J(i,e,a),Ye(e,r[0].id),t||(n=Ae(e,"input",r[14]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].id&&Ye(e,i[0].id)},d(i){i&&j(e),t=!1,n()}}}function BV(r){let e,t,n;function i(o){r[15](o)}let a={};return r[0].hidden!==void 0&&(a.checked=r[0].hidden),e=new Oc({props:a}),Ir.push(()=>Pa(e,"checked",i)),{c(){we(e.$$.fragment)},m(o,l){be(e,o,l),n=!0},p(o,l){let u={};!t&&l[0]&1&&(t=!0,u.checked=o[0].hidden,Ba(()=>t=!1)),e.$set(u)},i(o){n||(ee(e.$$.fragment,o),n=!0)},o(o){re(e.$$.fragment,o),n=!1},d(o){xe(e,o)}}}function zS(r){let e,t=r[45]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[45],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p:Me,d(a){a&&j(e)}}}function PV(r){let e;return{c(){e=Ie("Add Action")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function HS(r){let e,t;return e=new Wr({props:{name:"Command: "+(r[42].command||"none"),description:"The command to execute when this action runs.",$$slots:{default:[RV]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i[0]&1&&(a.name="Command: "+(n[42].command||"none")),i[0]&1|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function OV(r){let e;return{c(){e=Ie("Change")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function kV(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function RV(r){let e,t,n,i;function a(){return r[18](r[42])}e=new Et({props:{variant:"primary",$$slots:{default:[OV]},$$scope:{ctx:r}}}),e.$on("click",a);function o(){return r[19](r[44])}return n=new Et({props:{variant:"destructive",$$slots:{default:[kV]},$$scope:{ctx:r}}}),n.$on("click",o),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment)},m(l,u){be(e,l,u),J(l,t,u),be(n,l,u),i=!0},p(l,u){r=l;let s={};u[1]&524288&&(s.$$scope={dirty:u,ctx:r}),e.$set(s);let c={};u[1]&524288&&(c.$$scope={dirty:u,ctx:r}),n.$set(c)},i(l){i||(ee(e.$$.fragment,l),ee(n.$$.fragment,l),i=!0)},o(l){re(e.$$.fragment,l),re(n.$$.fragment,l),i=!1},d(l){l&&j(t),xe(e,l),xe(n,l)}}}function GS(r){let e,t;return e=new Wr({props:{name:"Link",description:"The link to open.",$$slots:{default:[UV]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i[0]&1|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function LV(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function UV(r){let e,t,n,i,a,o;function l(){r[20].call(e,r[43],r[44])}function u(){return r[21](r[44])}return n=new Et({props:{variant:"destructive",$$slots:{default:[LV]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=ue(),we(n.$$.fragment),k(e,"type","text"),k(e,"placeholder","[[Some Note]] or https://www.example.com")},m(s,c){J(s,e,c),Ye(e,r[42].link),J(s,t,c),be(n,s,c),i=!0,a||(o=Ae(e,"input",l),a=!0)},p(s,c){r=s,c[0]&1&&e.value!==r[42].link&&Ye(e,r[42].link);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(ee(n.$$.fragment,s),i=!0)},o(s){re(n.$$.fragment,s),i=!1},d(s){s&&(j(e),j(t)),xe(n,s),a=!1,o()}}}function WS(r){let e,t;return e=new Wr({props:{name:"JS File",description:"The JavaScript file to run.",$$slots:{default:[$V]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i[0]&1|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function VV(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function $V(r){let e,t,n,i,a,o;function l(){r[22].call(e,r[43],r[44])}function u(){return r[23](r[44])}return n=new Et({props:{variant:"destructive",$$slots:{default:[VV]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=ue(),we(n.$$.fragment),k(e,"type","text"),k(e,"placeholder","someJsFile.js")},m(s,c){J(s,e,c),Ye(e,r[42].file),J(s,t,c),be(n,s,c),i=!0,a||(o=Ae(e,"input",l),a=!0)},p(s,c){r=s,c[0]&1&&e.value!==r[42].file&&Ye(e,r[42].file);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(ee(n.$$.fragment,s),i=!0)},o(s){re(n.$$.fragment,s),i=!1},d(s){s&&(j(e),j(t)),xe(n,s),a=!1,o()}}}function jS(r){let e,t;return e=new Wr({props:{name:"Text",description:"The text to input at the cursor.",$$slots:{default:[zV]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i[0]&1|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function qV(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function zV(r){let e,t,n,i,a,o;function l(){r[24].call(e,r[43],r[44])}function u(){return r[25](r[44])}return n=new Et({props:{variant:"destructive",$$slots:{default:[qV]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=ue(),we(n.$$.fragment),k(e,"type","text"),k(e,"placeholder","some text")},m(s,c){J(s,e,c),Ye(e,r[42].str),J(s,t,c),be(n,s,c),i=!0,a||(o=Ae(e,"input",l),a=!0)},p(s,c){r=s,c[0]&1&&e.value!==r[42].str&&Ye(e,r[42].str);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(ee(n.$$.fragment,s),i=!0)},o(s){re(n.$$.fragment,s),i=!1},d(s){s&&(j(e),j(t)),xe(n,s),a=!1,o()}}}function ZS(r){let e,t;return e=new Wr({props:{name:"Sleep Time",description:"The time to sleep in milliseconds.",$$slots:{default:[GV]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i[0]&1|i[1]&524288&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function HV(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function GV(r){let e,t,n,i,a,o;function l(){r[26].call(e,r[43],r[44])}function u(){return r[27](r[44])}return n=new Et({props:{variant:"destructive",$$slots:{default:[HV]},$$scope:{ctx:r}}}),n.$on("click",u),{c(){e=Z("input"),t=ue(),we(n.$$.fragment),k(e,"type","number"),k(e,"placeholder","100 ms")},m(s,c){J(s,e,c),Ye(e,r[42].ms),J(s,t,c),be(n,s,c),i=!0,a||(o=Ae(e,"input",l),a=!0)},p(s,c){r=s,c[0]&1&&ui(e.value)!==r[42].ms&&Ye(e,r[42].ms);let f={};c[1]&524288&&(f.$$scope={dirty:c,ctx:r}),n.$set(f)},i(s){i||(ee(n.$$.fragment,s),i=!0)},o(s){re(n.$$.fragment,s),i=!1},d(s){s&&(j(e),j(t)),xe(n,s),a=!1,o()}}}function JS(r){let e,t,n,i,a,o,l,u,s,c;function f(){return r[28](r[44])}return e=new Et({props:{variant:"destructive",$$slots:{default:[WV]},$$scope:{ctx:r}}}),e.$on("click",f),n=new Wr({props:{name:"Template File: "+(r[42].templateFile||"none"),description:"The template file to create a new note of.",$$slots:{default:[ZV]},$$scope:{ctx:r}}}),a=new Wr({props:{name:"Folder: "+(r[42].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[YV]},$$scope:{ctx:r}}}),l=new Wr({props:{name:"File Name: "+(r[42].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[XV]},$$scope:{ctx:r}}}),s=new Wr({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[QV]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment),i=ue(),we(a.$$.fragment),o=ue(),we(l.$$.fragment),u=ue(),we(s.$$.fragment)},m(p,m){be(e,p,m),J(p,t,m),be(n,p,m),J(p,i,m),be(a,p,m),J(p,o,m),be(l,p,m),J(p,u,m),be(s,p,m),c=!0},p(p,m){r=p;let h={};m[1]&524288&&(h.$$scope={dirty:m,ctx:r}),e.$set(h);let d={};m[0]&1&&(d.name="Template File: "+(r[42].templateFile||"none")),m[0]&1|m[1]&524288&&(d.$$scope={dirty:m,ctx:r}),n.$set(d);let g={};m[0]&1&&(g.name="Folder: "+(r[42].folderPath||"none")),m[0]&1|m[1]&524288&&(g.$$scope={dirty:m,ctx:r}),a.$set(g);let v={};m[0]&1&&(v.name="File Name: "+(r[42].fileName||"default")),m[0]&1|m[1]&524288&&(v.$$scope={dirty:m,ctx:r}),l.$set(v);let w={};m[0]&1|m[1]&524288&&(w.$$scope={dirty:m,ctx:r}),s.$set(w)},i(p){c||(ee(e.$$.fragment,p),ee(n.$$.fragment,p),ee(a.$$.fragment,p),ee(l.$$.fragment,p),ee(s.$$.fragment,p),c=!0)},o(p){re(e.$$.fragment,p),re(n.$$.fragment,p),re(a.$$.fragment,p),re(l.$$.fragment,p),re(s.$$.fragment,p),c=!1},d(p){p&&(j(t),j(i),j(o),j(u)),xe(e,p),xe(n,p),xe(a,p),xe(l,p),xe(s,p)}}}function WV(r){let e;return{c(){e=Ie("Remove Action")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function jV(r){let e;return{c(){e=Ie("Change")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function ZV(r){let e,t;function n(){return r[29](r[42])}return e=new Et({props:{variant:"primary",$$slots:{default:[jV]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){we(e.$$.fragment)},m(i,a){be(e,i,a),t=!0},p(i,a){r=i;let o={};a[1]&524288&&(o.$$scope={dirty:a,ctx:r}),e.$set(o)},i(i){t||(ee(e.$$.fragment,i),t=!0)},o(i){re(e.$$.fragment,i),t=!1},d(i){xe(e,i)}}}function JV(r){let e;return{c(){e=Ie("Change")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function YV(r){let e,t;function n(){return r[30](r[42])}return e=new Et({props:{variant:"primary",$$slots:{default:[JV]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){we(e.$$.fragment)},m(i,a){be(e,i,a),t=!0},p(i,a){r=i;let o={};a[1]&524288&&(o.$$scope={dirty:a,ctx:r}),e.$set(o)},i(i){t||(ee(e.$$.fragment,i),t=!0)},o(i){re(e.$$.fragment,i),t=!1},d(i){xe(e,i)}}}function XV(r){let e,t,n;function i(){r[31].call(e,r[43],r[44])}return{c(){e=Z("input"),k(e,"type","text"),k(e,"placeholder","some name")},m(a,o){J(a,e,o),Ye(e,r[42].fileName),t||(n=Ae(e,"input",i),t=!0)},p(a,o){r=a,o[0]&1&&e.value!==r[42].fileName&&Ye(e,r[42].fileName)},d(a){a&&j(e),t=!1,n()}}}function QV(r){let e,t,n;function i(o){r[32](o,r[42])}let a={};return r[42].openNote!==void 0&&(a.checked=r[42].openNote),e=new Oc({props:a}),Ir.push(()=>Pa(e,"checked",i)),{c(){we(e.$$.fragment)},m(o,l){be(e,o,l),n=!0},p(o,l){r=o;let u={};!t&&l[0]&1&&(t=!0,u.checked=r[42].openNote,Ba(()=>t=!1)),e.$set(u)},i(o){n||(ee(e.$$.fragment,o),n=!0)},o(o){re(e.$$.fragment,o),n=!1},d(o){xe(e,o)}}}function YS(r){let e,t,n,i,a,o,l,u;function s(){return r[33](r[44])}return e=new Et({props:{variant:"destructive",$$slots:{default:[KV]},$$scope:{ctx:r}}}),e.$on("click",s),n=new Wr({props:{name:"Metadata Property",description:"The metadata property in form of a bind target.",$$slots:{default:[e$]},$$scope:{ctx:r}}}),a=new Wr({props:{name:"Value",description:"The new value.",$$slots:{default:[t$]},$$scope:{ctx:r}}}),l=new Wr({props:{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",$$slots:{default:[r$]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment),i=ue(),we(a.$$.fragment),o=ue(),we(l.$$.fragment)},m(c,f){be(e,c,f),J(c,t,f),be(n,c,f),J(c,i,f),be(a,c,f),J(c,o,f),be(l,c,f),u=!0},p(c,f){r=c;let p={};f[1]&524288&&(p.$$scope={dirty:f,ctx:r}),e.$set(p);let m={};f[0]&1|f[1]&524288&&(m.$$scope={dirty:f,ctx:r}),n.$set(m);let h={};f[0]&1|f[1]&524288&&(h.$$scope={dirty:f,ctx:r}),a.$set(h);let d={};f[0]&1|f[1]&524288&&(d.$$scope={dirty:f,ctx:r}),l.$set(d)},i(c){u||(ee(e.$$.fragment,c),ee(n.$$.fragment,c),ee(a.$$.fragment,c),ee(l.$$.fragment,c),u=!0)},o(c){re(e.$$.fragment,c),re(n.$$.fragment,c),re(a.$$.fragment,c),re(l.$$.fragment,c),u=!1},d(c){c&&(j(t),j(i),j(o)),xe(e,c),xe(n,c),xe(a,c),xe(l,c)}}}function KV(r){let e;return{c(){e=Ie("Remove Action")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function e$(r){let e,t,n;function i(){r[34].call(e,r[43],r[44])}return{c(){e=Z("input"),k(e,"type","text"),k(e,"placeholder","some value")},m(a,o){J(a,e,o),Ye(e,r[42].bindTarget),t||(n=Ae(e,"input",i),t=!0)},p(a,o){r=a,o[0]&1&&e.value!==r[42].bindTarget&&Ye(e,r[42].bindTarget)},d(a){a&&j(e),t=!1,n()}}}function t$(r){let e,t,n;function i(){r[35].call(e,r[43],r[44])}return{c(){e=Z("input"),k(e,"type","text"),k(e,"placeholder","some value")},m(a,o){J(a,e,o),Ye(e,r[42].value),t||(n=Ae(e,"input",i),t=!0)},p(a,o){r=a,o[0]&1&&e.value!==r[42].value&&Ye(e,r[42].value)},d(a){a&&j(e),t=!1,n()}}}function r$(r){let e,t,n;function i(o){r[36](o,r[42])}let a={};return r[42].evaluate!==void 0&&(a.checked=r[42].evaluate),e=new Oc({props:a}),Ir.push(()=>Pa(e,"checked",i)),{c(){we(e.$$.fragment)},m(o,l){be(e,o,l),n=!0},p(o,l){r=o;let u={};!t&&l[0]&1&&(t=!0,u.checked=r[42].evaluate,Ba(()=>t=!1)),e.$set(u)},i(o){n||(ee(e.$$.fragment,o),n=!0)},o(o){re(e.$$.fragment,o),n=!1},d(o){xe(e,o)}}}function XS(r,e){let t,n=e[9](e[42].type)+"",i,a,o,l,u,s,c,f,p,m,h=e[42].type==="command"&&HS(e),d=e[42].type==="open"&&GS(e),g=e[42].type==="js"&&WS(e),v=e[42].type==="input"&&jS(e),w=e[42].type==="sleep"&&ZS(e),y=e[42].type==="templaterCreateNote"&&JS(e),x=e[42].type==="updateMetadata"&&YS(e);return{key:r,first:null,c(){t=Z("h5"),i=Ie(n),a=ue(),h&&h.c(),o=ue(),d&&d.c(),l=ue(),g&&g.c(),u=ue(),v&&v.c(),s=ue(),w&&w.c(),c=ue(),y&&y.c(),f=ue(),x&&x.c(),p=pr(),this.first=t},m(_,b){J(_,t,b),z(t,i),J(_,a,b),h&&h.m(_,b),J(_,o,b),d&&d.m(_,b),J(_,l,b),g&&g.m(_,b),J(_,u,b),v&&v.m(_,b),J(_,s,b),w&&w.m(_,b),J(_,c,b),y&&y.m(_,b),J(_,f,b),x&&x.m(_,b),J(_,p,b),m=!0},p(_,b){e=_,(!m||b[0]&1)&&n!==(n=e[9](e[42].type)+"")&&Ke(i,n),e[42].type==="command"?h?(h.p(e,b),b[0]&1&&ee(h,1)):(h=HS(e),h.c(),ee(h,1),h.m(o.parentNode,o)):h&&(pt(),re(h,1,1,()=>{h=null}),mt()),e[42].type==="open"?d?(d.p(e,b),b[0]&1&&ee(d,1)):(d=GS(e),d.c(),ee(d,1),d.m(l.parentNode,l)):d&&(pt(),re(d,1,1,()=>{d=null}),mt()),e[42].type==="js"?g?(g.p(e,b),b[0]&1&&ee(g,1)):(g=WS(e),g.c(),ee(g,1),g.m(u.parentNode,u)):g&&(pt(),re(g,1,1,()=>{g=null}),mt()),e[42].type==="input"?v?(v.p(e,b),b[0]&1&&ee(v,1)):(v=jS(e),v.c(),ee(v,1),v.m(s.parentNode,s)):v&&(pt(),re(v,1,1,()=>{v=null}),mt()),e[42].type==="sleep"?w?(w.p(e,b),b[0]&1&&ee(w,1)):(w=ZS(e),w.c(),ee(w,1),w.m(c.parentNode,c)):w&&(pt(),re(w,1,1,()=>{w=null}),mt()),e[42].type==="templaterCreateNote"?y?(y.p(e,b),b[0]&1&&ee(y,1)):(y=JS(e),y.c(),ee(y,1),y.m(f.parentNode,f)):y&&(pt(),re(y,1,1,()=>{y=null}),mt()),e[42].type==="updateMetadata"?x?(x.p(e,b),b[0]&1&&ee(x,1)):(x=YS(e),x.c(),ee(x,1),x.m(p.parentNode,p)):x&&(pt(),re(x,1,1,()=>{x=null}),mt())},i(_){m||(ee(h),ee(d),ee(g),ee(v),ee(w),ee(y),ee(x),m=!0)},o(_){re(h),re(d),re(g),re(v),re(w),re(y),re(x),m=!1},d(_){_&&(j(t),j(a),j(o),j(l),j(u),j(s),j(c),j(f),j(p)),h&&h.d(_),d&&d.d(_),g&&g.d(_),v&&v.d(_),w&&w.d(_),y&&y.d(_),x&&x.d(_)}}}function n$(r){let e=r[1].submitText+"",t;return{c(){t=Ie(e)},m(n,i){J(n,t,i)},p(n,i){i[0]&2&&e!==(e=n[1].submitText+"")&&Ke(t,e)},d(n){n&&j(t)}}}function i$(r){let e;return{c(){e=Ie("Cancel")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function a$(r){let e,t,n,i;return e=new Et({props:{variant:"primary",$$slots:{default:[n$]},$$scope:{ctx:r}}}),e.$on("click",r[38]),n=new Et({props:{variant:"default",$$slots:{default:[i$]},$$scope:{ctx:r}}}),n.$on("click",r[39]),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment)},m(a,o){be(e,a,o),J(a,t,o),be(n,a,o),i=!0},p(a,o){let l={};o[0]&2|o[1]&524288&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o[1]&524288&&(u.$$scope={dirty:o,ctx:a}),n.$set(u)},i(a){i||(ee(e.$$.fragment,a),ee(n.$$.fragment,a),i=!0)},o(a){re(e.$$.fragment,a),re(n.$$.fragment,a),i=!1},d(a){a&&j(t),xe(e,a),xe(n,a)}}}function o$(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h,d,g,v,w,y,x,_=[],b=new Map,E,D,A,S,M,F,P,R,O;n=new Wr({props:{name:"Label",description:"The label shown on the button.",$$slots:{default:[CV]},$$scope:{ctx:r}}}),a=new Wr({props:{name:"Style",description:"The style variant of the button",$$slots:{default:[MV]},$$scope:{ctx:r}}}),l=new Wr({props:{name:"CSS Classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",$$slots:{default:[TV]},$$scope:{ctx:r}}}),s=new Wr({props:{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",$$slots:{default:[FV]},$$scope:{ctx:r}}}),f=new Wr({props:{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",$$slots:{default:[IV]},$$scope:{ctx:r}}}),m=new Wr({props:{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",$$slots:{default:[BV]},$$scope:{ctx:r}}});let I=We(Object.values(_s)),T=[];for(let U=0;U<I.length;U+=1)T[U]=zS(VS(r,I,U));y=new Et({props:{variant:"primary",$$slots:{default:[PV]},$$scope:{ctx:r}}}),y.$on("click",r[17]);let $=We(r[0].actions),B=U=>U[44];for(let U=0;U<$.length;U+=1){let G=US(r,$,U),H=B(G);b.set(H,_[U]=XS(H,G))}return F=new ka({props:{$$slots:{default:[a$]},$$scope:{ctx:r}}}),{c(){e=Z("h2"),e.textContent="Meta Bind Button Builder",t=ue(),we(n.$$.fragment),i=ue(),we(a.$$.fragment),o=ue(),we(l.$$.fragment),u=ue(),we(s.$$.fragment),c=ue(),we(f.$$.fragment),p=ue(),we(m.$$.fragment),h=ue(),d=Z("h4"),d.textContent="Actions",g=Ie(`
Add action of type
`),v=Z("select");for(let U=0;U<T.length;U+=1)T[U].c();w=ue(),we(y.$$.fragment),x=ue();for(let U=0;U<_.length;U+=1)_[U].c();E=ue(),D=Z("h4"),D.textContent="Preview",A=ue(),S=Z("div"),M=ue(),we(F.$$.fragment),k(v,"class","dropdown"),r[3]===void 0&&tn(()=>r[16].call(v))},m(U,G){J(U,e,G),J(U,t,G),be(n,U,G),J(U,i,G),be(a,U,G),J(U,o,G),be(l,U,G),J(U,u,G),be(s,U,G),J(U,c,G),be(f,U,G),J(U,p,G),be(m,U,G),J(U,h,G),J(U,d,G),J(U,g,G),J(U,v,G);for(let H=0;H<T.length;H+=1)T[H]&&T[H].m(v,null);Fr(v,r[3],!0),J(U,w,G),be(y,U,G),J(U,x,G);for(let H=0;H<_.length;H+=1)_[H]&&_[H].m(U,G);J(U,E,G),J(U,D,G),J(U,A,G),J(U,S,G),r[37](S),J(U,M,G),be(F,U,G),P=!0,R||(O=Ae(v,"change",r[16]),R=!0)},p(U,G){let H={};G[0]&1|G[1]&524288&&(H.$$scope={dirty:G,ctx:U}),n.$set(H);let L={};G[0]&1|G[1]&524288&&(L.$$scope={dirty:G,ctx:U}),a.$set(L);let ae={};G[0]&1|G[1]&524288&&(ae.$$scope={dirty:G,ctx:U}),l.$set(ae);let ve={};G[0]&1|G[1]&524288&&(ve.$$scope={dirty:G,ctx:U}),s.$set(ve);let se={};G[0]&1|G[1]&524288&&(se.$$scope={dirty:G,ctx:U}),f.$set(se);let le={};if(G[0]&1|G[1]&524288&&(le.$$scope={dirty:G,ctx:U}),m.$set(le),G&0){I=We(Object.values(_s));let ne;for(ne=0;ne<I.length;ne+=1){let me=VS(U,I,ne);T[ne]?T[ne].p(me,G):(T[ne]=zS(me),T[ne].c(),T[ne].m(v,null))}for(;ne<T.length;ne+=1)T[ne].d(1);T.length=I.length}G[0]&8&&Fr(v,U[3]);let he={};G[1]&524288&&(he.$$scope={dirty:G,ctx:U}),y.$set(he),G[0]&993&&($=We(U[0].actions),pt(),_=xs(_,G,B,1,U,$,b,E.parentNode,xc,XS,E,US),mt());let K={};G[0]&3|G[1]&524288&&(K.$$scope={dirty:G,ctx:U}),F.$set(K)},i(U){if(!P){ee(n.$$.fragment,U),ee(a.$$.fragment,U),ee(l.$$.fragment,U),ee(s.$$.fragment,U),ee(f.$$.fragment,U),ee(m.$$.fragment,U),ee(y.$$.fragment,U);for(let G=0;G<$.length;G+=1)ee(_[G]);ee(F.$$.fragment,U),P=!0}},o(U){re(n.$$.fragment,U),re(a.$$.fragment,U),re(l.$$.fragment,U),re(s.$$.fragment,U),re(f.$$.fragment,U),re(m.$$.fragment,U),re(y.$$.fragment,U);for(let G=0;G<_.length;G+=1)re(_[G]);re(F.$$.fragment,U),P=!1},d(U){U&&(j(e),j(t),j(i),j(o),j(u),j(c),j(p),j(h),j(d),j(g),j(v),j(w),j(x),j(E),j(D),j(A),j(S),j(M)),xe(n,U),xe(a,U),xe(l,U),xe(s,U),xe(f,U),xe(m,U),At(T,U),xe(y,U);for(let G=0;G<_.length;G+=1)_[G].d(U);r[37](null),xe(F,U),R=!1,O()}}}function s$(r,e,t){let{modal:n}=e,{buttonConfig:i}=e,a,o,l;To(()=>{o==null||o.unmount()});function u(K,ne){o==null||o.unmount(),ne&&(ne.empty(),o=new ks(n.plugin,mr(),"",(0,QS.stringifyYaml)(K),!0),o.mount(ne))}function s(){var K;(K=i.actions)===null||K===void 0||K.push(n.plugin.api.buttonActionRunner.createDefaultAction(l)),t(0,i)}function c(K){i.actions.splice(K,1),t(0,i)}function f(K){new Tc(n.plugin,ne=>{K.command=ne.id,t(0,i)}).open()}function p(K){new Bc(n.plugin,ne=>{K.templateFile=ne.path,t(0,i)}).open()}function m(K){new Fc(n.plugin,ne=>{K.folderPath=ne.path,t(0,i)}).open()}function h(K){return K==="command"?"Run a Command":K==="open"?"Open a Link":K==="js"?"Run a JavaScript File":K==="input"?"Insert Text at Cursor":K==="sleep"?"Sleep for Some Time":K==="templaterCreateNote"?"Create a New Note Using Templater":K==="updateMetadata"?"Update Metadata":"CHANGE ME"}function d(){i.label=this.value,t(0,i)}function g(){i.style=jn(this),t(0,i)}function v(){i.class=this.value,t(0,i)}function w(){i.tooltip=this.value,t(0,i)}function y(){i.id=this.value,t(0,i)}function x(K){r.$$.not_equal(i.hidden,K)&&(i.hidden=K,t(0,i))}function _(){l=jn(this),t(3,l)}let b=()=>s(),E=K=>f(K),D=K=>c(K);function A(K,ne){K[ne].link=this.value,t(0,i)}let S=K=>c(K);function M(K,ne){K[ne].file=this.value,t(0,i)}let F=K=>c(K);function P(K,ne){K[ne].str=this.value,t(0,i)}let R=K=>c(K);function O(K,ne){K[ne].ms=ui(this.value),t(0,i)}let I=K=>c(K),T=K=>c(K),$=K=>p(K),B=K=>m(K);function U(K,ne){K[ne].fileName=this.value,t(0,i)}function G(K,ne){r.$$.not_equal(ne.openNote,K)&&(ne.openNote=K,t(0,i))}let H=K=>c(K);function L(K,ne){K[ne].bindTarget=this.value,t(0,i)}function ae(K,ne){K[ne].value=this.value,t(0,i)}function ve(K,ne){r.$$.not_equal(ne.evaluate,K)&&(ne.evaluate=K,t(0,i))}function se(K){Ir[K?"unshift":"push"](()=>{a=K,t(2,a)})}let le=()=>n.okay(i),he=()=>n.cancel();return r.$$set=K=>{"modal"in K&&t(1,n=K.modal),"buttonConfig"in K&&t(0,i=K.buttonConfig)},r.$$.update=()=>{r.$$.dirty[0]&5&&u(i,a)},[i,n,a,l,s,c,f,p,m,h,d,g,v,w,y,x,_,b,E,D,A,S,M,F,P,R,O,I,T,$,B,U,G,H,L,ae,ve,se,le,he]}var Qd=class extends Le{constructor(e){super(),$e(this,e,s$,o$,Ve,{modal:1,buttonConfig:0},null,[-1,-1])}},KS=Qd;var qa=class extends eE.Modal{constructor(e){super(e.plugin.app),this.plugin=e.plugin,this.onOkay=e.onOkay,this.submitText=e.submitText,this.config=e.config}onOpen(){var e;this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new KS({target:this.contentEl,props:{modal:this,buttonConfig:(e=this.config)!=null?e:this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}okay(e){this.close(),this.onOkay(e)}cancel(){this.close()}};function u$(r){let e,t;return e=new Qt({props:{iconName:"pen-line"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function l$(r){let e,t;return e=new Qt({props:{iconName:"copy"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function c$(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function f$(r){let e,t=r[0].id+"",n,i,a,o,l,u,s,c;return a=new Et({props:{variant:"primary",tooltip:"Edit",$$slots:{default:[u$]},$$scope:{ctx:r}}}),a.$on("click",r[5]),l=new Et({props:{variant:"default",tooltip:"Copy",$$slots:{default:[l$]},$$scope:{ctx:r}}}),l.$on("click",r[6]),s=new Et({props:{variant:"destructive",tooltip:"Delete",$$slots:{default:[c$]},$$scope:{ctx:r}}}),s.$on("click",r[7]),{c(){e=Z("span"),n=Ie(t),i=ue(),we(a.$$.fragment),o=ue(),we(l.$$.fragment),u=ue(),we(s.$$.fragment)},m(f,p){J(f,e,p),z(e,n),J(f,i,p),be(a,f,p),J(f,o,p),be(l,f,p),J(f,u,p),be(s,f,p),c=!0},p(f,p){(!c||p&1)&&t!==(t=f[0].id+"")&&Ke(n,t);let m={};p&512&&(m.$$scope={dirty:p,ctx:f}),a.$set(m);let h={};p&512&&(h.$$scope={dirty:p,ctx:f}),l.$set(h);let d={};p&512&&(d.$$scope={dirty:p,ctx:f}),s.$set(d)},i(f){c||(ee(a.$$.fragment,f),ee(l.$$.fragment,f),ee(s.$$.fragment,f),c=!0)},o(f){re(a.$$.fragment,f),re(l.$$.fragment,f),re(s.$$.fragment,f),c=!1},d(f){f&&(j(e),j(i),j(o),j(u)),xe(a,f),xe(l,f),xe(s,f)}}}function p$(r){let e,t,n,i,a,o=(0,Rs.stringifyYaml)(r[0])+"",l,u;return t=new Ac({props:{$$slots:{default:[f$]},$$scope:{ctx:r}}}),{c(){e=Z("div"),we(t.$$.fragment),n=ue(),i=Z("pre"),a=Z("code"),l=Ie(o),k(a,"class","mb-none"),k(i,"class","mb-pre"),k(e,"class","mb-card markdown-rendered")},m(s,c){J(s,e,c),be(t,e,null),z(e,n),z(e,i),z(i,a),z(a,l),u=!0},p(s,[c]){let f={};c&513&&(f.$$scope={dirty:c,ctx:s}),t.$set(f),(!u||c&1)&&o!==(o=(0,Rs.stringifyYaml)(s[0])+"")&&Ke(l,o)},i(s){u||(ee(t.$$.fragment,s),u=!0)},o(s){re(t.$$.fragment,s),u=!1},d(s){s&&j(e),xe(t)}}}function m$(r,e,t){let{template:n}=e,{plugin:i}=e,a=Fo();function o(){a("delete-template",{template:n})}function l(){new qa({plugin:i,onOkay:p=>{t(0,n)},submitText:"Submit",config:n}).open()}function u(){let p=(0,Rs.stringifyYaml)(n);navigator.clipboard.writeText(p),new Rs.Notice("meta-bind | Copied to Clipboard")}let s=()=>l(),c=()=>u(),f=()=>o();return r.$$set=p=>{"template"in p&&t(0,n=p.template),"plugin"in p&&t(4,i=p.plugin)},[n,o,l,u,i,s,c,f]}var Kd=class extends Le{constructor(e){super(),$e(this,e,m$,p$,Ve,{template:0,plugin:4})}},tE=Kd;var Qu=require("obsidian");function rE(r,e,t){let n=r.slice();return n[13]=e[t],n}function nE(r){let e,t;return e=new tE({props:{plugin:r[1].plugin,template:r[13]}}),e.$on("delete-template",r[8]),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&2&&(a.plugin=n[1].plugin),i&1&&(a.template=n[13]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function d$(r){let e;return{c(){e=Ie("Add Template")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function h$(r){let e;return{c(){e=Ie("Add Template from Clipboard")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function iE(r){let e,t,n,i,a;return i=new Oa({props:{settings:{errorCollection:r[2]}}}),{c(){e=Z("div"),t=Z("h3"),t.textContent="Some Templates Failed to Parse",n=ue(),we(i.$$.fragment),k(t,"class","mod-error")},m(o,l){J(o,e,l),z(e,t),z(e,n),be(i,e,null),a=!0},p(o,l){let u={};l&4&&(u.settings={errorCollection:o[2]}),i.$set(u)},i(o){a||(ee(i.$$.fragment,o),a=!0)},o(o){re(i.$$.fragment,o),a=!1},d(o){o&&j(e),xe(i)}}}function g$(r){let e;return{c(){e=Ie("Save")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function v$(r){let e;return{c(){e=Ie("Cancel")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function y$(r){let e,t,n,i;return e=new Et({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[g$]},$$scope:{ctx:r}}}),e.$on("click",r[11]),n=new Et({props:{tooltip:"Revert Changes",$$slots:{default:[v$]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{c(){we(e.$$.fragment),t=ue(),we(n.$$.fragment)},m(a,o){be(e,a,o),J(a,t,o),be(n,a,o),i=!0},p(a,o){let l={};o&65536&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);let u={};o&65536&&(u.$$scope={dirty:o,ctx:a}),n.$set(u)},i(a){i||(ee(e.$$.fragment,a),ee(n.$$.fragment,a),i=!0)},o(a){re(e.$$.fragment,a),re(n.$$.fragment,a),i=!1},d(a){a&&j(t),xe(e,a),xe(n,a)}}}function b$(r){let e,t,n,i,a,o,l,u,s,c,f,p=We(r[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=nE(rE(r,p,g));let h=g=>re(m[g],1,1,()=>{m[g]=null});a=new Et({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[d$]},$$scope:{ctx:r}}}),a.$on("click",r[9]),l=new Et({props:{variant:"default",tooltip:"Create New Template from YAML in Clipboard",$$slots:{default:[h$]},$$scope:{ctx:r}}}),l.$on("click",r[10]);let d=r[2]&&iE(r);return c=new ka({props:{$$slots:{default:[y$]},$$scope:{ctx:r}}}),{c(){e=Z("div"),t=Z("h2"),t.textContent="Meta Bind Button Templates",n=ue();for(let g=0;g<m.length;g+=1)m[g].c();i=ue(),we(a.$$.fragment),o=ue(),we(l.$$.fragment),u=ue(),d&&d.c(),s=ue(),we(c.$$.fragment)},m(g,v){J(g,e,v),z(e,t),z(e,n);for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(e,null);z(e,i),be(a,e,null),z(e,o),be(l,e,null),z(e,u),d&&d.m(e,null),z(e,s),be(c,e,null),f=!0},p(g,[v]){if(v&11){p=We(g[0]);let _;for(_=0;_<p.length;_+=1){let b=rE(g,p,_);m[_]?(m[_].p(b,v),ee(m[_],1)):(m[_]=nE(b),m[_].c(),ee(m[_],1),m[_].m(e,i))}for(pt(),_=p.length;_<m.length;_+=1)h(_);mt()}let w={};v&65536&&(w.$$scope={dirty:v,ctx:g}),a.$set(w);let y={};v&65536&&(y.$$scope={dirty:v,ctx:g}),l.$set(y),g[2]?d?(d.p(g,v),v&4&&ee(d,1)):(d=iE(g),d.c(),ee(d,1),d.m(e,s)):d&&(pt(),re(d,1,1,()=>{d=null}),mt());let x={};v&65536&&(x.$$scope={dirty:v,ctx:g}),c.$set(x)},i(g){if(!f){for(let v=0;v<p.length;v+=1)ee(m[v]);ee(a.$$.fragment,g),ee(l.$$.fragment,g),ee(d),ee(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let v=0;v<m.length;v+=1)re(m[v]);re(a.$$.fragment,g),re(l.$$.fragment,g),re(d),re(c.$$.fragment,g),f=!1},d(g){g&&j(e),At(m,g),xe(a),xe(l),d&&d.d(),xe(c)}}}function x$(r,e,t){let{buttonConfigs:n}=e,{modal:i}=e,a;function o(g){t(0,n=n.filter(v=>v!==g))}function l(){n.push(i.plugin.api.buttonActionRunner.createDefaultButtonConfig()),t(0,n)}function u(){return Zu(this,void 0,void 0,function*(){let g;try{g=(0,Qu.parseYaml)(yield navigator.clipboard.readText())}catch(w){console.warn(w),new Qu.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let v=Wc.safeParse(g);if(!v.success){let w=Jo(v.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new pa({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:w.message,docs:[bt.linkToButtonConfig()]})),console.warn(w),new Qu.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}n.push(g),t(0,n)})}function s(){t(2,a=i.save(n)),a===void 0&&i.close()}function c(){i.close()}let f=g=>o(g.detail.template),p=()=>l(),m=()=>u(),h=()=>s(),d=()=>c();return r.$$set=g=>{"buttonConfigs"in g&&t(0,n=g.buttonConfigs),"modal"in g&&t(1,i=g.modal)},[n,i,a,o,l,u,s,c,f,p,m,h,d]}var eh=class extends Le{constructor(e){super(),$e(this,e,x$,b$,Ve,{buttonConfigs:0,modal:1})}},aE=eh;var jc=class extends oE.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new aE({target:this.contentEl,props:{buttonConfigs:fS(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){let t=this.plugin.api.buttonManager.setButtonTemplates(e);if(t.hasErrors())return t;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var Zc=class extends jr.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;if(e.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){e.createEl("p",{text:`You are using a ${this.plugin.build} build (${this.plugin.manifest.version}). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let t=new jr.ButtonComponent(e);t.setButtonText("Learn About Canary Builds"),t.setCta(),t.onClick(()=>{bt.open(bt.linkToCanaryBuilds())})}new jr.Setting(e).setName("Quick access").addButton(t=>{t.setCta(),t.setButtonText("Docs"),t.onClick(()=>{bt.open(bt.linkToHome())})}).addButton(t=>{t.setButtonText("Open FAQ"),t.onClick(()=>{this.plugin.activateView(Oo)})}).addButton(t=>{t.setButtonText("GitHub"),t.onClick(()=>{bt.open(bt.linkToGithub())})}).addButton(t=>{t.setButtonText("Report Issue"),t.onClick(()=>{bt.open(bt.linkToIssues())})}),e.createEl("h2",{text:"General Settings"}),new jr.Setting(e).setName("Enable Syntax Highlighting").setDesc("Enable syntax highlighting for. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableSyntaxHighlighting),t.onChange(n=>{this.plugin.settings.enableSyntaxHighlighting=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Enable Editor Right Click Menu").setDesc("Enable a meta bind menu section in the editor right click menu. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableEditorRightClickMenu),t.onChange(n=>{this.plugin.settings.enableEditorRightClickMenu=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Input Field Templates").setDesc("You can specify input field templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.").addButton(t=>{t.setButtonText("Edit Templates"),t.onClick(()=>{new Sc(this.app,this.plugin).open()})}),new jr.Setting(e).setName("Button Templates").setDesc("You can specify button field templates here, and access them in inline buttons.").addButton(t=>{t.setButtonText("Edit Templates"),t.onClick(()=>{new jc(this.app,this.plugin).open()})}),new jr.Setting(e).setName("Excluded Folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(t=>{t.setButtonText("Edit Excluded Folders"),t.onClick(()=>{new _c(this.app,this.plugin).open()})}),new jr.Setting(e).setName("View Fields display null as empty").setDesc("Display nothing instead of null, if the frontmatter value is empty, in text view fields.").addToggle(t=>{t.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),t.onChange(n=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Enable JS Input Fields").setDesc("Enable the processing of JavaScript input fields. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableJs),t.onChange(n=>{this.plugin.settings.enableJs=n,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and Time Settings"}),new jr.Setting(e).setName("Date format").setDesc("The date format to be used by this plugin. Changing this setting will break the parsing of existing date inputs. Here is a list of all available date tokes https://momentjs.com/docs/#/displaying/.").addText(t=>{t.setValue(this.plugin.settings.preferredDateFormat),t.onChange(n=>{this.plugin.settings.preferredDateFormat=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Use US date input field order").setDesc("When enabled the month input is before the day input.").addToggle(t=>{t.setValue(this.plugin.settings.useUsDateInputOrder),t.onChange(n=>{this.plugin.settings.useUsDateInputOrder=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(t=>{for(let n of Co)t.addOption(n.name,n.name);t.setValue(this.plugin.settings.firstWeekday.name),t.onChange(n=>{this.plugin.settings.firstWeekday=Co.find(i=>i.name===n),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced Settings"}),new jr.Setting(e).setName("Dev Mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(t=>{t.setValue(this.plugin.settings.devMode),t.onChange(n=>{this.plugin.settings.devMode=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Disable Code Block Restrictions").setDesc("Disable restrictions on which input fields can be created in which code blocks. Not recommended unless you know what you are doing.").addToggle(t=>{t.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),t.onChange(n=>{this.plugin.settings.ignoreCodeBlockRestrictions=n,this.plugin.saveSettings()})}),new jr.Setting(e).setName("Sync interval").setDesc(`The interval in milli-seconds between disk writes. Changing this number is not recommended except if your hard drive is exceptionally slow. Standard: ${Ci.syncInterval}; Minimum: ${Ci.minSyncInterval}; Maximum: ${Ci.maxSyncInterval}`).addText(t=>{t.setValue(this.plugin.settings.syncInterval.toString()),t.onChange(n=>{this.plugin.settings.syncInterval=Number.parseInt(n),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=Ci.syncInterval),this.plugin.settings.syncInterval<Ci.minSyncInterval&&(this.plugin.settings.syncInterval=Ci.minSyncInterval),this.plugin.settings.syncInterval>Ci.maxSyncInterval&&(this.plugin.settings.syncInterval=Ci.maxSyncInterval),this.plugin.saveSettings()})})}};var rh=require("obsidian"),Zr=class r{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,rh.moment)(e,r.dateFormat)}static getDefaultDate(){return(0,rh.moment)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var Ha=fr(On()),rl=fr(Yn());var Cn=fr(On());var gn=fr(On()),dE=fr(Yn());var Lr=fr(On()),za=fr(Yn()),Nn=Lr.P.sequence(Lr.P.or(za.P_UTILS.unicodeLetter(),Lr.P.oneOf("_$")),Lr.P.or(za.P_UTILS.unicodeAlphanumeric(),Lr.P.oneOf("-_$")).many()).map(r=>r[0]+r[1].join("")).describe("identifier"),cE=Lr.P.sequenceMap((r,e)=>r+e.map(t=>t[0]+t[1]).join(""),Nn,Lr.P.sequence(za.P_UTILS.optionalWhitespace(),Nn).many()).describe("identifier with spaces"),N$=Lr.P.string("\\").then(za.P_UTILS.any()).map(r=>r==="'"?"'":r==="\\"?"\\":"\\"+r);function fE(r){return Lr.P.or(N$,Lr.P.noneOf(r+"\\")).many().map(e=>e.join("")).trim(Lr.P.string(r))}var fh=fE("'"),pE=fE('"');function kn(r,e){return{value:r,position:e}}var ph=Lr.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),C$=Lr.P.or(fh,ph).node(kn),M$=Lr.P.separateBy(C$,Lr.P.string(",").describe('argument value separator ","').trim(za.P_UTILS.optionalWhitespace())),T$=Lr.P.sequenceMap((r,e)=>({name:r,value:e}),Nn.node(kn),M$.trim(za.P_UTILS.optionalWhitespace()).wrap(Lr.P.string("(").describe('argument value paren "("'),Lr.P.string(")").describe('argument value paren ")"')).optional([])),Ku=Lr.P.separateBy(T$,Lr.P.string(",").describe('argument separator ","').trim(za.P_UTILS.optionalWhitespace()));var Xo=(t=>(t.OBJECT="object",t.ARRAY="array",t))(Xo||{}),af=class{constructor(e,t,n){this.parent=e,this.access=t,this.child=n}};function F$(r,e){return r[e]}function mE(r,e,t){r[e]=t}var Yo=class{constructor(e,t){if(this.type=e,this.prop=e==="object"?t:"",this.index=e==="array"?Number(t):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 af(e,this,F$(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 af(e,this,e[this.index])}}set(e,t){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");mE(e,this.prop,t)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=t}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");mE(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}}};var el=gn.P.manyNotOf("{}[]#^|:?").box("file path"),hE=Nn.node((r,e)=>({type:"object",prop:kn(r,e)})),mh=gn.P.or(dE.P_UTILS.digits().wrap(gn.P.string("["),gn.P.string("]")).node((r,e)=>({type:"array",prop:kn(r,e)})),pE.wrap(gn.P.string("["),gn.P.string("]")).node((r,e)=>({type:"object",prop:kn(r,e)}))),I$=gn.P.or(gn.P.sequenceMap(r=>({storagePath:void 0,listenToChildren:!1,storageProp:r}),mh.atLeast(1)),gn.P.sequenceMap((r,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[r,...e]}),hE,mh.many())),B$=gn.P.sequenceMap((r,e)=>[r,...e],hE,mh.many()),dh=gn.P.sequenceMap((r,e)=>(r.storageProp=r.storageProp.concat(e.flat()),r),I$,gn.P.string(".").then(B$).many()),Ji=gn.P.sequenceMap((r,e,t)=>(t.storageType=r,t.storagePath=e,t),Nn.describe("storage type").node(kn).skip(gn.P.string("^").describe('storage type separator "^"')).optional(),el.describe("storage path").node(kn).skip(gn.P.string("#").describe('storage/file path separator "#"')).optional(),dh.describe("property path")).box("bind target");function qr(r,e){let t=r.tryParse(e);if(t.success)return t.value;throw new tl("ERROR","parsiNOM parser",e,t)}var tl=class extends Vr{constructor(e,t,n,i){super({errorLevel:e,effect:"failed to parse",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=n,this.parseFailure=i,this.source=t,this.updateMessage2()}getErrorType(){return"MB_PARSINOM"}updateMessage2(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`;let t=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} | `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let t=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return t+n}},$r=class extends Vr{constructor(e,t,n,i,a,o){super({errorLevel:e,effect:"failed to validate parser result",cause:n,docs:o}),this.str=i,this.position=a,this.source=t,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let t=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} | `;this.positionContext=`${n}${t}`,this.positionContext+=`
${this.getUnderline(n.length,t.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,t){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:t,a="^".repeat(i-this.position.from.column);return n+a}};var gE=fr(Yn());var P$=Cn.P.sequence(el,Cn.P.string("#").then(Cn.P.manyNotOf("[]#|^:")).optional(),Cn.P.string("|").then(Cn.P.manyNotOf("[]")).optional()),hh=Cn.P.or(Cn.P.sequenceMap((r,e)=>({isEmbed:r!==void 0,target:e[0],block:e[1],alias:e[2],internal:!0}),Cn.P.string("!").optional(),P$.wrapString("[[","]]")),Cn.P.sequenceMap((r,e,t)=>{let n=!As(t);return{isEmbed:r!==void 0,target:t,block:void 0,alias:e,internal:n}},Cn.P.string("!").optional(),Cn.P.manyNotOf("[]").wrapString("[","]"),Cn.P.manyNotOf("()").wrapString("(",")"))),O$=Cn.P.separateBy(hh,Cn.P.string(",").trim(gE.P_UTILS.optionalWhitespace())),un=class r{static parseLink(e){return qr(hh.thenEof(),e)}static parseLinkList(e){return qr(O$.thenEof(),e)}static isLink(e){return hh.thenEof().tryParse(e).success}static urlToLink(e){return{isEmbed:!1,target:e.href,block:void 0,alias:e.hostname,internal:!1}}static parseLinkOrUrl(e){return As(e)?r.urlToLink(new URL(e)):r.parseLink(e)}static convertToLinkString(e){return r.isLink(e)?e:As(e)?`[${new URL(e).hostname}](${e})`:r.isLink(`[[${e}]]`)?`[[${e}]]`:""}};var yE=Ha.P.sequenceMap((r,e)=>r===void 0?e:-e,Ha.P.string("-").optional(),Ha.P.or(Ha.P.sequenceMap((r,e,t)=>Number(r+e+t),rl.P_UTILS.digits(),Ha.P.string("."),rl.P_UTILS.digits()),rl.P_UTILS.digits().map(r=>Number(r)))).thenEof(),bE=Ha.P.sequenceMap((r,e)=>r===void 0?e:-e,Ha.P.string("-").optional(),rl.P_UTILS.digits().map(r=>Number(r))).thenEof();function Qn(r){if(r.toLowerCase()==="null")return null;if(r==="true")return!0;if(r==="false")return!1;{let e=yE.tryParse(r);return e.success?e.value:r}}function nl(r){return r===void 0||r===null?"":typeof r=="string"?r:typeof r=="boolean"?r?"true":"false":r.toString()}function Ga(r){return r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"}function Yi(r){if(r!==void 0){if(Ga(r))return[r];if(typeof r=="object"&&Array.isArray(r))return r.filter(e=>Ga(e))}}function Vs(r){if(typeof r=="number")return r;if(typeof r=="string"){let e=yE.tryParse(r);if(e.success)return e.value}}function $s(r){return Ga(r)?nl(r):void 0}function Wa(r){return Ga(r)?r:void 0}function of(r,e){return Array.isArray(r)?r.map(t=>gh(t,e)).filter(t=>t!=="").join(", "):gh(r,e)}function gh(r,e){return r==null?e?"":"null":typeof r=="function"?"<function>":typeof r=="object"||Array.isArray(r)?JSON.stringify(r):r.toString()}function xE(r,e){return Array.isArray(r)?r.map(t=>vE(t,e)).filter(t=>t!==""):vE(r,e)}function vE(r,e){return typeof r=="string"?un.isLink(r)?un.parseLink(r):As(r)?un.urlToLink(new URL(r)):r:gh(r,e)}function wE(r,e){return r.evaluate?new Function("x",`return ${r.value};`)(e):Qn(r.value)}var sf=class{constructor(e,t,n,i,a){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}update(e){this.metadataManager.update(e,this)}applyUpdate(e){let t=this.callbackSignal.get(),n=wE(e,t);this.update(n)}notify(e){this.callbackSignal.set(e)}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var uf=class{constructor(e,t,n,i,a,o,l){this.uuid=e,this.callbackSignal=t,this.metadataManager=n,this.bindTarget=i,this.dependencies=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=l,this.deleted=!1}init(){for(let e of this.dependencies){let t=this.uuid+"/"+mr();this.dependencySubscriptions.push(this.metadataManager.subscribe(t,e.callbackSignal,e.bindTarget,()=>this.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){let e=this.dependencySubscriptions.map(n=>n.callbackSignal.get()),t=await this.computeFunction(e);this.callbackSignal.set(t),this.metadataManager.update(t,this)}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}notify(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var _E=5,k$=5*60;function vh(r,e){return r===void 0||e===void 0||r.storageType!==e.storageType||r.storagePath!==e.storagePath?!1:AE(r.storageProp.toStringArray(),e.storageProp.toStringArray(),e.listenToChildren)}function AE(r,e,t){return lS(r,e)||Ld(e,r)?!0:t&&Ld(r,e)}function R$(r){return r===void 0?"undefined":`${r.storagePath}#${r.storageProp.toString()}`}var lf=class{constructor(){this.sources=new Map,this.defaultSource="CHANGE_THE_DEFAULT_SOURCE"}registerSource(e){this.sources.set(e.id,e)}setDefaultSource(e){if(this.sources.has(e))this.defaultSource=e;else throw new zt({errorLevel:"CRITICAL",effect:"can not set default source",cause:`Source "${e}" does not exist`})}unregisterSource(e){this.sources.delete(e.id)}getSource(e){return this.sources.get(e)}iterateSources(){return this.sources.keys()}subscribe(e,t,n,i){let a=new sf(e,t,this,n,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,n,i,a,o){let l=new uf(e,t,this,n,i,a,o);return this.checkForLoops(l),l.init(),this.subscribeSubscription(l),l}unsubscribe(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new zt({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});t.unsubscribe(e)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new zt({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=t.subscribe(e);n.inactive=!1,n.cyclesSinceInactive=0,e.notify(t.readCacheItem(n,e.bindTarget.storageProp))}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.first(),n=e.last();if(!(n===void 0||t===void 0)){if(vh(t.bindTarget,n.bindTarget))throw new wc({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${R$(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(n))this.recCheckForLoops([...e,i])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(t=>this.getAllSubscriptionsToBindTarget(t.bindTarget)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let t=this.getCacheItemForBindTarget(e);if(!t)return[];let n=[];for(let i of t.subscriptions)vh(i.bindTarget,e)&&n.push(i);return t.subscriptions.filter(i=>vh(i.bindTarget,e))}getCacheItemForBindTarget(e){var t;return(t=this.getSource(e.storageType))==null?void 0:t.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let t=[];for(let n of e.iterateCacheItems()){if(e.onCycle(n),n.pendingInternalChange){try{e.syncExternal(n)}catch(i){console.warn("failed to update frontmatter",i)}n.pendingInternalChange=!1}n.cyclesSinceInternalChange+=1,n.inactive&&(n.cyclesSinceInactive+=1),n.cyclesSinceInactive>k$&&e.shouldDelete(n)&&t.push(n)}for(let n of t)e.delete(n)}}update(e,t){if(t.bindTarget===void 0)return;let n=this.getSource(t.bindTarget.storageType);if(n===void 0)throw new zt({errorLevel:"ERROR",effect:"can not update metadata",cause:`Source "${t.bindTarget.storageType}" does not exist`});let i=n.update(e,t);i.pendingInternalChange=!0,i.cyclesSinceInternalChange=0,this.notifyListeners(n,t)}isCacheExternalWriteLocked(e){return e.cyclesSinceInternalChange<_E}notifyListeners(e,t){if(t.bindTarget===void 0)return;let n=e.getCacheItemForStoragePath(t.bindTarget.storagePath);if(n!==void 0){for(let i of n.subscriptions)if(!(t.uuid===i.uuid||i.bindTarget===void 0)&&AE(t.bindTarget.storageProp.toStringArray(),i.bindTarget.storageProp.toStringArray(),i.bindTarget.listenToChildren)){let a=e.readCache(i.bindTarget);i.notify(a)}}}notifyAllListeners(e,t){for(let n of t.subscriptions){if(n.bindTarget===void 0)continue;let i=e.readCache(n.bindTarget);n.notify(i)}}deleteCachesForStoragePath(e){for(let t of this.sources.values()){let n=t.getCacheItemForStoragePath(e);n!==void 0&&(n.subscriptions.forEach(i=>i.delete()),t.delete(n))}}getDefaultCacheItem(){return{subscriptions:[],cyclesSinceInternalChange:_E+1,pendingInternalChange:!1,cyclesSinceInactive:0,inactive:!0}}onExternalUpdate(e,t,n){let i=e.getCacheItemForStoragePath(t);i===void 0||this.isCacheExternalWriteLocked(i)||(e.updateEntireCache(n,i),this.notifyAllListeners(e,i))}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,t){this.deleteCachesForStoragePath(e)}};var qs=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(Br))e[t]=0;for(let t of this.arguments){let n=t.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new ir({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[bt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let t of e.arguments){let n=t.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let n=t.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new ir({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(t)}return this.validate(),this}getAll(e){return this.arguments.filter(t=>t.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var zs=class extends qs{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Hs=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(n=>n.length===e.length)===void 0)throw new ir({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[bt.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 er=class extends Hs{};var cf=class extends er{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return or.class}};var ff=class extends er{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return or.addLabels}};var pf=class extends er{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return or.minValue}};var mf=class extends er{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return or.maxValue}};var df=class extends er{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=Qn(t[0].value),this.name=t[0].value):t.length===2&&(this.value=Qn(t[0].value),this.name=t[1].value)}getConfig(){return or.option}};var hf=class extends er{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return or.title}};var gf=class extends er{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return or.optionQuery}};var vf=class extends er{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return or.showcase}};var yf=class extends er{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=Qn(t[0].value)}getConfig(){return or.offValue}};var bf=class extends er{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=Qn(t[0].value)}getConfig(){return or.onValue}};var xf=class extends er{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=Qn(t[0].value)}getConfig(){return or.defaultValue}};var wf=class extends er{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return or.placeholder}};function SE(r,e,t){return t==="true"?`[[${r}|${e}]]`:t==="partial"?`[[${e}]]`:`${e}`}var _f=class extends er{constructor(){super(...arguments);this.value="true"}_parseValue(t){var i;let n=(i=t[0])==null?void 0:i.value.toLowerCase();if(n===void 0){this.value="true";return}if(n==="true"||n==="partial"||n==="false"){this.value=n;return}throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${pS(["true","partial","false"],a=>`'${a}'`,", ","or")}`,docs:[bt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return or.useLinks}};var Af=class extends er{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return or.stepSize}};var Sf=class extends er{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new ir({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[bt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return or.limit}};var EE={class:cf,addLabels:ff,minValue:pf,maxValue:mf,stepSize:Af,option:df,title:hf,optionQuery:gf,showcase:vf,offValue:yf,onValue:bf,defaultValue:xf,placeholder:wf,useLinks:_f,limit:Sf},Ef=class{static createInputFieldArgument(e){if(e in EE){let t=EE[e];if(t)return new t}throw new ca({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var il=class{constructor(e,t,n){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=n,this.errorCollection=new Rt("input field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,inputFieldType:t,bindTarget:n,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let t of Object.entries(Es))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new $r("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be an input field type but received '${e==null?void 0:e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e==null?void 0:e.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.bindTarget!==void 0)return this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}validateArguments(e){let t=new zs;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Ef.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new $r("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.fullDeclaration,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(Br))if(t[1]===e.value)return t[1];return this.errorCollection.add(new $r("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}};var vr=fr(On());var vn=fr(Yn());var U$=vr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},Nn.node(kn).trim(vn.P_UTILS.optionalWhitespace()).describe("input field type"),Ku.trim(vn.P_UTILS.optionalWhitespace()).wrap(vr.P.string("(").describe('arguments paren "("'),vr.P.string(")").describe('arguments paren ")"')).trim(vn.P_UTILS.optionalWhitespace()).optional([]),vr.P.sequence(vr.P.string(":").trim(vn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Ji).trim(vn.P_UTILS.optionalWhitespace()).optional()),DE=vr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{inputFieldType:r,arguments:e,bindTarget:n}},Nn.node(kn).trim(vn.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Ku.trim(vn.P_UTILS.optionalWhitespace()).wrap(vr.P.string("(").describe('arguments paren "("'),vr.P.string(")").describe('arguments paren ")"')).trim(vn.P_UTILS.optionalWhitespace()).optional([]),vr.P.sequence(vr.P.string(":").trim(vn.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),Ji).trim(vn.P_UTILS.optionalWhitespace()).optional()),yh=vr.P.or(vr.P.sequenceMap((r,e,t)=>(t.templateName=e,t),vr.P.string("INPUT"),vr.P.sequenceMap((r,e,t)=>e,vr.P.string("["),cE.node(kn).trim(vn.P_UTILS.optionalWhitespace()).describe("template name"),vr.P.string("]").skip(vn.P_UTILS.optionalWhitespace())),DE.wrap(vr.P.string("["),vr.P.string("]")),vn.P_UTILS.eof()),vr.P.sequenceMap((r,e)=>e,vr.P.string("INPUT"),U$.wrap(vr.P.string("["),vr.P.string("]")),vn.P_UTILS.eof())),NE=vr.P.sequenceMap((r,e)=>e,vr.P.string("INPUT"),DE.wrap(vr.P.string("["),vr.P.string("]")),vn.P_UTILS.eof());var Df=class{constructor(e){this.plugin=e,this.templates=[]}parseString(e,t,n){let i=new Rt("InputFieldParser");try{let a=qr(yh,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],a=this.applyTemplate(a),new il(this.plugin,a,t).validate(n)}catch(a){i.add(a)}return{fullDeclaration:e,inputFieldType:"invalid",bindTarget:void 0,argumentContainer:new zs,errorCollection:i}}parseStringWithoutValidation(e){let t=new Rt("InputFieldParser");try{let n=qr(yh,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}validateDeclaration(e,t,n){return new il(this.plugin,e,t).validate(n)}parseTemplateString(e){let t=new Rt("InputFieldParser");try{let n=qr(NE,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new Rt("input field template parser");for(let n of e){let i=this.parseTemplateString(n.declaration);t.merge(i.errorCollection);let a={name:n.name,template:i};this.templates.push(Ud(a))}return t}getTemplate(e){var t;return(t=this.templates.find(n=>n.name===e))==null?void 0:t.template}applyTemplate(e){if(e.templateName===void 0)return e;let t=this.getTemplate(e.templateName.value);return t===void 0?(e.errorCollection.add(new $r("WARNING","Input Field Parser",`Invalid template name. Could not find template with name '${e.templateName.value}'`,e.fullDeclaration,e.templateName.position,["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/"])),e):this.plugin.api.inputField.merge(t,e)}};var Jr=fr(On()),Kn=fr(Yn());var V$=Jr.P.string("\\").then(Kn.P_UTILS.any()).map(r=>r==="["?"[":r==="]"?"]":r==="{"?"{":r==="}"?"}":r==="\\"?"\\":"\\"+r),Nf=Jr.P.sequenceMap((r,e)=>r+e.flat().join(""),Jr.P.manyNotOf("{}[]\\"),Jr.P.sequence(V$,Jr.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),$$=Jr.P.sequenceMap((r,e)=>[r,...e.flat()],Nf,Jr.P.sequence(Ji.wrapString("{","}"),Nf).many()),q$=Jr.P.sequenceMap((r,e,t)=>{let n=t===void 0?void 0:t[1];return{viewFieldType:r,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},Nn.node(kn).trim(Kn.P_UTILS.optionalWhitespace()).optional().describe("input field type"),Ku.trim(Kn.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(Kn.P_UTILS.optionalWhitespace()).optional([]),Jr.P.sequence(Jr.P.string(":").trim(Kn.P_UTILS.optionalWhitespace()),Ji).trim(Kn.P_UTILS.optionalWhitespace()).optional()),bh=Jr.P.sequenceMap((r,e,t,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),Jr.P.string("VIEW"),$$.wrapString("[","]"),Kn.P_UTILS.optionalWhitespace(),q$.wrapString("[","]").optional(),Kn.P_UTILS.eof()),z$=Jr.P.sequenceMap((r,e,t,n)=>(e!==void 0&&(r.listenToChildren=!0),{bindTarget:r,name:n}),Ji.wrapString("{","}"),Jr.P.string(" and children").optional(),Jr.P.string(" as "),Nn),CE=Jr.P.sequenceMap((r,e,t)=>({bindTargetMappings:r,writeToBindTarget:e,code:t}),z$.separateBy(Kn.P_UTILS.whitespace()).skip(Kn.P_UTILS.whitespace()),Jr.P.string("save to ").then(Ji.wrapString("{","}")).skip(Kn.P_UTILS.whitespace()).optional(),Jr.P.string("---").then(Kn.P_UTILS.remaining()));var Gs=class extends qs{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Ws=class extends Hs{};var Cf=class extends Ws{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return Cc.renderMarkdown}};var Mf=class extends Ws{constructor(){super(...arguments);this.value=!0}_parseValue(t){var n;this.value=t[0]===void 0||((n=t[0])==null?void 0:n.value.toLowerCase())==="true"}getConfig(){return Cc.hidden}};var ME={renderMarkdown:Cf,hidden:Mf},Tf=class{static createViewFieldArgument(e){if(e in ME){let t=ME[e];if(t)return new t}throw new ca({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var Ff=class{constructor(e,t,n){this.unvalidatedDeclaration=e,this.plugin=n,this.filePath=t,this.errorCollection=new Rt("view field declaration")}validate(e){let t=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={fullDeclaration:this.unvalidatedDeclaration.fullDeclaration,viewFieldType:t,writeToBindTarget:n,argumentContainer:i,templateDeclaration:a,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(o),o}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return"math";for(let t of Object.entries(ju))if(t[1]===(e==null?void 0:e.value))return t[1];return this.errorCollection.add(new $r("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be a view field type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.writeToBindTarget!==void 0)return this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let t=new Gs;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Tf.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new $r("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.fullDeclaration,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(n){this.errorCollection.add(n)}return t}validateArgumentType(e){for(let t of Object.entries(Ds))if(t[1]===e.value)return t[1];return this.errorCollection.add(new $r("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.fullDeclaration,e.position)),"invalid"}validateTemplateDeclaration(e){var t,n;try{return(n=(t=this.unvalidatedDeclaration.templateDeclaration)==null?void 0:t.map(i=>typeof i=="string"?i:this.plugin.api.bindTargetParser.validateBindTarget(this.unvalidatedDeclaration.fullDeclaration,i,this.filePath,e)))!=null?n:[]}catch(i){return this.errorCollection.add(i),[]}}};var If=class{constructor(e){this.plugin=e}parseString(e,t,n){let i=new Rt("ViewFieldDeclaration");try{let a=qr(bh,e);return a.fullDeclaration=e,a.errorCollection=i,a.arguments=[...a.arguments],this.validateDeclaration(a,t,n)}catch(a){i.add(a)}return{fullDeclaration:e,errorCollection:i,templateDeclaration:[],viewFieldType:"invalid",argumentContainer:new Gs,writeToBindTarget:void 0}}parseStringWithoutValidation(e){let t=new Rt("ViewFieldDeclaration");try{let n=qr(bh,e);return n.fullDeclaration=e,n.errorCollection=t,n.arguments=[...n.arguments],n}catch(n){t.add(n)}return{fullDeclaration:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}validateDeclaration(e,t,n){return new Ff(e,t,this.plugin).validate(n)}parseJsString(e,t){let n={};n.errorCollection=new Rt("JsViewFieldDeclaration"),n.fullDeclaration=e;try{let i=qr(CE,e);n.bindTargetMappings=i.bindTargetMappings.map(a=>({bindTarget:this.plugin.api.bindTargetParser.validateBindTarget(e,a.bindTarget,t),name:a.name})),i.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.plugin.api.bindTargetParser.validateBindTarget(e,i.writeToBindTarget,t)),n.code=i.code}catch(i){n.errorCollection.add(i)}return n}};var ja=class r{constructor(e){this.path=e}get(e){if(this.path.length===0)throw new Error("can not use empty path to access object");let t=this.path[0].get(e);for(let n of this.path.slice(1))t=n.get(t.child);return t}tryGet(e){try{return this.get(e)}catch(t){return}}set(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);for(let i of this.path.slice(1))n=i.get(n.child);n.access.set(n.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(0,t)),n=n.access.get(n.parent));for(let i=1;i<this.path.length;i++)n=this.path[i].get(n.child),n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(i,t)),n=n.access.get(n.parent));n.access.set(n.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let n=this.getNextPathElement(e);return n===void 0?t:n.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new r(this.path.concat(e.path))}};var Bf=class{constructor(e){this.plugin=e}parseAndValidateBindTarget(e,t,n){return this.validateBindTarget(e,this.parseBindTarget(e),t,n)}parseBindTarget(e){return qr(Ji,e)}validateBindTarget(e,t,n,i){var s;let a={};a.listenToChildren=t.listenToChildren,a.storageProp=new ja(t.storageProp.map(c=>new Yo(c.type,c.prop.value))),t.storageType===void 0?a.storageType=this.plugin.metadataManager.defaultSource:a.storageType=this.validateStorageType(t.storageType,e);let o=t.storagePath!==void 0,l=(s=t.storagePath)!=null?s:{value:n},u=this.plugin.metadataManager.getSource(a.storageType);if(u===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not validate bind target",cause:`Source '${a.storageType}' not found. But validation was successful. This should not happen.`,context:{fullDeclaration:e,sources:[...this.plugin.metadataManager.sources.keys()]}});return a.storagePath=u.validateStoragePath(l,o,e,this),u.resolveBindTargetScope(a,i,this)}resolveScope(e,t){if(t===void 0)throw new $r("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return e.storageType=t.scope.storageType,e.storagePath=t.scope.storagePath,e.storageProp=t.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,t){for(let n of this.plugin.metadataManager.iterateSources())if(n===e.value)return n;throw new $r("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e==null?void 0:e.value}'.`,t,e==null?void 0:e.position)}validateStoragePathAsFilePath(e,t){let n=e==null?void 0:e.value;if(n===void 0)throw new $r("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",t,e==null?void 0:e.position);let i=this.plugin.internal.getFilePathByName(n);if(i===void 0)throw new $r("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,t,e==null?void 0:e.position);return i}};var Pf=class{constructor(e){this.plugin=e}createInputFieldDeclaration(e,t){let n=new Rt("input field declaration"),i=(t!=null?t:[]).map(a=>({name:{value:a.name},value:a.value.map(o=>({value:o}))}));return{fullDeclaration:"",inputFieldType:e?{value:e}:void 0,bindTarget:void 0,arguments:i,errorCollection:n}}createInputFieldDeclarationFromString(e){return this.plugin.api.inputFieldParser.parseStringWithoutValidation(e)}setType(e,t){return e.inputFieldType={value:t},e}setArguments(e,t){return e.arguments=t.map(n=>({name:{value:n.name},value:n.value.map(i=>({value:i}))})),e}addArgument(e,t){return Array.isArray(t)?e.arguments=e.arguments.concat(t.map(n=>({name:{value:n.name},value:n.value.map(i=>({value:i}))}))):e.arguments.push({name:{value:t.name},value:t.value.map(n=>({value:n}))}),e}setBindTargetFile(e,t){return e.bindTarget?e.bindTarget.storagePath={value:t}:e.bindTarget={storagePath:{value:t},storageProp:[],listenToChildren:!1},e}setBindTargetMetadataField(e,t){return typeof t=="string"&&(t=[t]),e.bindTarget?e.bindTarget.storageProp=t.map(n=>({type:"object",prop:{value:n}})):e.bindTarget={storagePath:void 0,storageProp:t.map(n=>({type:"object",prop:{value:n}})),listenToChildren:!1},e}setTemplateName(e,t){return e.templateName={value:t},e}applyTemplate(e){return this.plugin.api.inputFieldParser.applyTemplate(e)}getTemplate(e){return this.plugin.api.inputFieldParser.getTemplate(e)}merge(e,t){var i,a,o;let n;return e.bindTarget===void 0?n=t.bindTarget:(n=e.bindTarget,((i=t.bindTarget)==null?void 0:i.storagePath)!==void 0&&(n.storagePath=t.bindTarget.storagePath),((a=t.bindTarget)==null?void 0:a.storageProp)!==void 0&&(n.storageProp=t.bindTarget.storageProp)),{fullDeclaration:t.fullDeclaration,inputFieldType:(o=t.inputFieldType)!=null?o:e.inputFieldType,bindTarget:n,arguments:t.arguments.concat(e.arguments).reduce((l,u)=>(l.find(s=>s.name===u.name)===void 0&&l.push(u),l),[]),errorCollection:new Rt("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}};var js=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=mr(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let t of this.listeners)t.callback(e)}},_r=class extends js{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},Of=class extends js{constructor(e,t){super(),this.dependency=e,this.value=t(e.get()),this.dependencyListener=e.registerListener({callback:n=>this.set(t(n))})}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};var kf=class extends js{constructor(e){super(),this.mounted=!1,this.svelteComponent=e}setValue(e){var t;(t=this.svelteComponentInstance)==null||t.setValue(e)}mount(e,t,n={}){let i=Object.assign({value:t,onValueChange:a=>{this.notifyListeners(a)}},n);this.svelteComponentInstance=new this.svelteComponent({target:e,props:i}),this.mounted=!0}unmount(){var e;this.unregisterAllListeners(),(e=this.svelteComponentInstance)==null||e.$destroy(),this.mounted=!1}isMounted(){return this.mounted}};var Lt=class extends Ra{constructor(e){super(),this.base=e,this.inputSignal=new _r(void 0),this.inputFieldComponent=new kf(this.getSvelteComponent()),this.computedSignal=new Of(this.inputSignal,t=>{let n=this.filterValue(t);return n!==void 0?n:this.getDefaultValue()})}destroy(){this.inputFieldComponent.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.computedSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.computedSignal.set(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){var t;(t=this.metadataSubscription)==null||t.update(e)}getDefaultValue(){let e=this.base.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let t=this.filterValue(e.value);return t!==void 0?t:this.mapValue(this.getFallbackDefaultValue())}getMountArgs(){return{}}onMount(e){this.computedSignal.registerListener({callback:n=>this.inputFieldComponent.setValue(this.reverseMapValue(n))});let t=this.base.getBindTarget();t&&(this.inputFieldComponent.registerListener({callback:n=>{this.notifySubscription(this.mapValue(n))}}),this.metadataSubscription=this.base.plugin.metadataManager.subscribe(this.base.getUuid(),this.inputSignal,t,()=>this.base.unmount())),this.inputFieldComponent.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){var e;this.computedSignal.unregisterAllListeners(),(e=this.metadataSubscription)==null||e.unsubscribe(),this.inputFieldComponent.unmount()}};function H$(r){let e,t,n,i;return{c(){e=Z("div"),t=Z("input"),k(t,"type","checkbox"),k(t,"tabindex","-1"),t.checked=r[0],k(e,"class","checkbox-container"),k(e,"role","switch"),k(e,"tabindex","0"),k(e,"aria-checked",r[0]),St(e,"is-enabled",r[0])},m(a,o){J(a,e,o),z(e,t),n||(i=[Ae(e,"click",r[5]),Ae(e,"keypress",r[6])],n=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&k(e,"aria-checked",a[0]),o&1&&St(e,"is-enabled",a[0])},i:Me,o:Me,d(a){a&&j(e),n=!1,ot(i)}}}function G$(r,e,t){let{value:n}=e,{onValueChange:i}=e;function a(c){t(0,n=c)}function o(){t(0,n=!n),i(n)}function l(c){c.key===" "&&o()}let u=()=>o(),s=c=>l(c);return r.$$set=c=>{"value"in c&&t(0,n=c.value),"onValueChange"in c&&t(3,i=c.onValueChange)},[n,o,l,i,a,u,s]}var xh=class extends Le{constructor(e){super(),$e(this,e,G$,H$,Ve,{value:0,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},TE=xh;var Rf=class extends Lt{constructor(e){var t,n,i,a;super(e),this.onValue=(n=(t=this.base.getArgument("onValue"))==null?void 0:t.value)!=null?n:!0,this.offValue=(a=(i=this.base.getArgument("offValue"))==null?void 0:i.value)!=null?a:!1}filterValue(e){return e===this.onValue||e===this.offValue?Wa(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return TE}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};function FE(r){let e,t=IE(r[0].length,r[2])+"",n,i;return{c(){e=Z("span"),n=Ie(t),k(e,"class",i=`mb-content-limit-indicator ${r[0].length>r[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o&5&&t!==(t=IE(a[0].length,a[2])+"")&&Ke(n,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&k(e,"class",i)},d(a){a&&j(e)}}}function W$(r){let e,t,n,i,a,o=r[2]!==void 0&&FE(r);return{c(){e=Z("input"),t=ue(),o&&o.c(),n=pr(),k(e,"type","text"),k(e,"tabindex","0"),k(e,"placeholder",r[1]),k(e,"maxlength",r[2])},m(l,u){J(l,e,u),Ye(e,r[0]),J(l,t,u),o&&o.m(l,u),J(l,n,u),i||(a=[Ae(e,"input",r[5]),Ae(e,"input",r[6])],i=!0)},p(l,[u]){u&2&&k(e,"placeholder",l[1]),u&4&&k(e,"maxlength",l[2]),u&1&&e.value!==l[0]&&Ye(e,l[0]),l[2]!==void 0?o?o.p(l,u):(o=FE(l),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},i:Me,o:Me,d(l){l&&(j(e),j(t),j(n)),o&&o.d(l),i=!1,ot(a)}}}function IE(r,e){let t=e.toString();return`${r.toString().padStart(t.length,"0")}/${t}`}function j$(r,e,t){let{value:n}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(){n=this.value,t(0,n)}let s=()=>o(n);return r.$$set=c=>{"value"in c&&t(0,n=c.value),"placeholder"in c&&t(1,i=c.placeholder),"limit"in c&&t(2,a=c.limit),"onValueChange"in c&&t(3,o=c.onValueChange)},[n,i,a,o,l,u,s]}var wh=class extends Le{constructor(e){super(),$e(this,e,j$,W$,Ve,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},BE=wh;var Lf=class extends Lt{filterValue(e){return $s(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return BE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function Z$(r){let e,t,n;return{c(){e=Z("input"),k(e,"class","mb-slider-input"),k(e,"type","range"),k(e,"tabindex","0"),k(e,"min",r[1]),k(e,"max",r[2]),k(e,"step",r[3])},m(i,a){J(i,e,a),Ye(e,r[0]),t||(n=[Ae(e,"change",r[9]),Ae(e,"input",r[9]),Ae(e,"input",r[10])],t=!0)},p(i,a){a&2&&k(e,"min",i[1]),a&4&&k(e,"max",i[2]),a&8&&k(e,"step",i[3]),a&1&&Ye(e,i[0])},d(i){i&&j(e),t=!1,ot(n)}}}function J$(r){let e,t,n,i,a,o,l,u,s;return{c(){e=Z("span"),t=Ie(r[1]),n=ue(),i=Z("input"),a=ue(),o=Z("span"),l=Ie(r[2]),k(e,"class","mb-slider-input-label"),k(i,"class","mb-slider-input"),k(i,"type","range"),k(i,"tabindex","0"),k(i,"min",r[1]),k(i,"max",r[2]),k(i,"step",r[3]),k(o,"class","mb-slider-input-label")},m(c,f){J(c,e,f),z(e,t),J(c,n,f),J(c,i,f),Ye(i,r[0]),J(c,a,f),J(c,o,f),z(o,l),u||(s=[Ae(i,"change",r[7]),Ae(i,"input",r[7]),Ae(i,"input",r[8])],u=!0)},p(c,f){f&2&&Ke(t,c[1]),f&2&&k(i,"min",c[1]),f&4&&k(i,"max",c[2]),f&8&&k(i,"step",c[3]),f&1&&Ye(i,c[0]),f&4&&Ke(l,c[2])},d(c){c&&(j(e),j(n),j(i),j(a),j(o)),u=!1,ot(s)}}}function Y$(r){let e;function t(a,o){return a[4]?J$:Z$}let n=t(r,-1),i=n(r);return{c(){i.c(),e=pr()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Me,o:Me,d(a){a&&j(e),i.d(a)}}}function X$(r,e,t){let{value:n}=e,{minValue:i}=e,{maxValue:a}=e,{stepSize:o}=e,{addLabels:l}=e,{onValueChange:u}=e;function s(h){t(0,n=h)}function c(){n=ui(this.value),t(0,n)}let f=()=>u(n);function p(){n=ui(this.value),t(0,n)}let m=()=>u(n);return r.$$set=h=>{"value"in h&&t(0,n=h.value),"minValue"in h&&t(1,i=h.minValue),"maxValue"in h&&t(2,a=h.maxValue),"stepSize"in h&&t(3,o=h.stepSize),"addLabels"in h&&t(4,l=h.addLabels),"onValueChange"in h&&t(5,u=h.onValueChange)},[n,i,a,o,l,u,s,c,f,p,m]}var _h=class extends Le{constructor(e){super(),$e(this,e,X$,Y$,Ve,{value:0,minValue:1,maxValue:2,stepSize:3,addLabels:4,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},PE=_h;var Uf=class extends Lt{constructor(e){var t,n,i,a,o,l;if(super(e),this.minValue=(n=(t=this.base.getArgument("minValue"))==null?void 0:t.value)!=null?n:0,this.maxValue=(a=(i=this.base.getArgument("maxValue"))==null?void 0:i.value)!=null?a:100,this.stepSize=(l=(o=this.base.getArgument("stepSize"))==null?void 0:o.value)!=null?l:1,this.minValue>=this.maxValue)throw new ir({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Ec(Vs(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return PE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e;return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:((e=this.base.getArgument("addLabels"))==null?void 0:e.value)===!0}}};function Q$(r){let e,t,n;return{c(){e=Z("textarea"),k(e,"tabindex","0"),k(e,"placeholder",r[1]),k(e,"maxlength",r[2])},m(i,a){J(i,e,a),Ye(e,r[0]),t||(n=[Ae(e,"input",r[5]),Ae(e,"input",r[6])],t=!0)},p(i,[a]){a&2&&k(e,"placeholder",i[1]),a&4&&k(e,"maxlength",i[2]),a&1&&Ye(e,i[0])},i:Me,o:Me,d(i){i&&j(e),t=!1,ot(n)}}}function K$(r,e,t){let{value:n}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(){n=this.value,t(0,n)}let s=()=>o(n);return r.$$set=c=>{"value"in c&&t(0,n=c.value),"placeholder"in c&&t(1,i=c.placeholder),"limit"in c&&t(2,a=c.limit),"onValueChange"in c&&t(3,o=c.onValueChange)},[n,i,a,o,l,u,s]}var Ah=class extends Le{constructor(e){super(),$e(this,e,K$,Q$,Ve,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},OE=Ah;var Vf=class extends Lt{filterValue(e){return $s(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return OE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"Text",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function eq(r){let e,t;return{c(){e=Z("a"),t=Ie(r[2]),k(e,"data-href",r[2]),k(e,"href",r[2]),k(e,"class",r[1]),k(e,"target","_blank"),k(e,"rel","noopener")},m(n,i){J(n,e,i),z(e,t)},p(n,i){i&4&&Ke(t,n[2]),i&4&&k(e,"data-href",n[2]),i&4&&k(e,"href",n[2]),i&2&&k(e,"class",n[1])},d(n){n&&j(e)}}}function tq(r){let e,t=r[0].alias+"",n;return{c(){e=Z("a"),n=Ie(t),k(e,"data-href",r[2]),k(e,"href",r[2]),k(e,"class",r[1]),k(e,"target","_blank"),k(e,"rel","noopener"),k(e,"aria-label",r[2])},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&1&&t!==(t=i[0].alias+"")&&Ke(n,t),a&4&&k(e,"data-href",i[2]),a&4&&k(e,"href",i[2]),a&2&&k(e,"class",i[1]),a&4&&k(e,"aria-label",i[2])},d(i){i&&j(e)}}}function rq(r){let e;function t(a,o){return a[0].alias?tq:eq}let n=t(r,-1),i=n(r);return{c(){i.c(),e=pr()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){n===(n=t(a,o))&&i?i.p(a,o):(i.d(1),i=n(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Me,o:Me,d(a){a&&j(e),i.d(a)}}}function nq(r,e,t){let n,i,{mdLink:a}=e;return r.$$set=o=>{"mdLink"in o&&t(0,a=o.mdLink)},r.$$.update=()=>{r.$$.dirty&1&&t(2,n=a.block?`${a.target}#${a.block}`:a.target),r.$$.dirty&1&&t(1,i=a.internal?"internal-link":"external-link")},[a,i,n]}var Sh=class extends Le{constructor(e){super(),$e(this,e,nq,rq,Ve,{mdLink:0})}},Za=Sh;var iq=r=>({element:r&1}),kE=r=>({element:r[0][r[0].length-1]});function RE(r,e,t){let n=r.slice();return n[3]=e[t],n}var aq=r=>({element:r&1}),LE=r=>({element:r[3]});function UE(r){let e,t,n,i,a,o=r[2].default,l=Mi(o,r,r[1],LE);return{c(){l&&l.c(),e=ue(),t=Z("span"),t.textContent=",",n=ue(),i=Z("span")},m(u,s){l&&l.m(u,s),J(u,e,s),J(u,t,s),J(u,n,s),J(u,i,s),a=!0},p(u,s){l&&l.p&&(!a||s&3)&&Fi(l,o,u,u[1],a?Ti(o,u[1],s,aq):Ii(u[1]),LE)},i(u){a||(ee(l,u),a=!0)},o(u){re(l,u),a=!1},d(u){u&&(j(e),j(t),j(n),j(i)),l&&l.d(u)}}}function oq(r){let e,t,n=We(r[0].slice(0,r[0].length-1)),i=[];for(let u=0;u<n.length;u+=1)i[u]=UE(RE(r,n,u));let a=u=>re(i[u],1,1,()=>{i[u]=null}),o=r[2].default,l=Mi(o,r,r[1],kE);return{c(){for(let u=0;u<i.length;u+=1)i[u].c();e=ue(),l&&l.c()},m(u,s){for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(u,s);J(u,e,s),l&&l.m(u,s),t=!0},p(u,[s]){if(s&3){n=We(u[0].slice(0,u[0].length-1));let c;for(c=0;c<n.length;c+=1){let f=RE(u,n,c);i[c]?(i[c].p(f,s),ee(i[c],1)):(i[c]=UE(f),i[c].c(),ee(i[c],1),i[c].m(e.parentNode,e))}for(pt(),c=n.length;c<i.length;c+=1)a(c);mt()}l&&l.p&&(!t||s&3)&&Fi(l,o,u,u[1],t?Ti(o,u[1],s,iq):Ii(u[1]),kE)},i(u){if(!t){for(let s=0;s<n.length;s+=1)ee(i[s]);ee(l,u),t=!0}},o(u){i=i.filter(Boolean);for(let s=0;s<i.length;s+=1)re(i[s]);re(l,u),t=!1},d(u){u&&j(e),At(i,u),l&&l.d(u)}}}function sq(r,e,t){let{$$slots:n={},$$scope:i}=e,{elements:a=[]}=e;return r.$$set=o=>{"elements"in o&&t(0,a=o.elements),"$$scope"in o&&t(1,i=o.$$scope)},[a,i,n]}var Eh=class extends Le{constructor(e){super(),$e(this,e,sq,oq,Ve,{elements:0})}},$f=Eh;function uq(r){let e,t,n;return t=new Za({props:{mdLink:r[0]}}),{c(){e=Z("span"),we(t.$$.fragment)},m(i,a){J(i,e,a),be(t,e,null),n=!0},p(i,a){let o={};a&1&&(o.mdLink=i[0]),t.$set(o)},i(i){n||(ee(t.$$.fragment,i),n=!0)},o(i){re(t.$$.fragment,i),n=!1},d(i){i&&j(e),xe(t)}}}function lq(r){let e,t,n;return t=new $f({props:{elements:r[0],$$slots:{default:[mq,({element:i})=>({2:i}),({element:i})=>i?4:0]},$$scope:{ctx:r}}}),{c(){e=Z("span"),we(t.$$.fragment)},m(i,a){J(i,e,a),be(t,e,null),n=!0},p(i,a){let o={};a&1&&(o.elements=i[0]),a&12&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){n||(ee(t.$$.fragment,i),n=!0)},o(i){re(t.$$.fragment,i),n=!1},d(i){i&&j(e),xe(t)}}}function cq(r){let e,t;return{c(){e=Z("span"),t=Ie(r[0])},m(n,i){J(n,e,i),z(e,t)},p(n,i){i&1&&Ke(t,n[0])},i:Me,o:Me,d(n){n&&j(e)}}}function fq(r){let e,t;return e=new Za({props:{mdLink:r[2]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&4&&(a.mdLink=n[2]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function pq(r){let e,t=r[2]+"",n;return{c(){e=Z("span"),n=Ie(t)},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&4&&t!==(t=i[2]+"")&&Ke(n,t)},i:Me,o:Me,d(i){i&&j(e)}}}function mq(r){let e,t,n,i,a=[pq,fq],o=[];function l(u,s){return typeof u[2]=="string"?0:1}return e=l(r,-1),t=o[e]=a[e](r),{c(){t.c(),n=pr()},m(u,s){o[e].m(u,s),J(u,n,s),i=!0},p(u,s){let c=e;e=l(u,s),e===c?o[e].p(u,s):(pt(),re(o[c],1,1,()=>{o[c]=null}),mt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),ee(t,1),t.m(n.parentNode,n))},i(u){i||(ee(t),i=!0)},o(u){re(t),i=!1},d(u){u&&j(n),o[e].d(u)}}}function dq(r){let e,t,n,i,a,o=[cq,lq,uq],l=[];function u(s,c){return c&1&&(e=null),typeof s[0]=="string"?0:(e==null&&(e=!!Array.isArray(s[0])),e?1:2)}return t=u(r,-1),n=l[t]=o[t](r),{c(){n.c(),i=pr()},m(s,c){l[t].m(s,c),J(s,i,c),a=!0},p(s,[c]){let f=t;t=u(s,c),t===f?l[t].p(s,c):(pt(),re(l[f],1,1,()=>{l[f]=null}),mt(),n=l[t],n?n.p(s,c):(n=l[t]=o[t](s),n.c()),ee(n,1),n.m(i.parentNode,i))},i(s){a||(ee(n),a=!0)},o(s){re(n),a=!1},d(s){s&&j(i),l[t].d(s)}}}function hq(r,e,t){let n,{value:i=void 0}=e;return r.$$set=a=>{"value"in a&&t(1,i=a.value)},r.$$.update=()=>{r.$$.dirty&2&&t(0,n=xE(i))},[n,i]}var Dh=class extends Le{constructor(e){super(),$e(this,e,hq,dq,Ve,{value:1})}},di=Dh;function VE(r,e,t){let n=r.slice();return n[8]=e[t],n}function $E(r){let e,t,n,i,a,o;t=new di({props:{value:r[8].name}});function l(){return r[6](r[8])}function u(...s){return r[7](r[8],...s)}return{c(){e=Z("div"),we(t.$$.fragment),n=ue(),k(e,"class","mb-select-input-element"),k(e,"role","button"),k(e,"tabindex","0"),St(e,"is-selected",r[8].value===r[0])},m(s,c){J(s,e,c),be(t,e,null),z(e,n),i=!0,a||(o=[Ae(e,"click",l),Ae(e,"keypress",u)],a=!0)},p(s,c){r=s;let f={};c&2&&(f.value=r[8].name),t.$set(f),(!i||c&3)&&St(e,"is-selected",r[8].value===r[0])},i(s){i||(ee(t.$$.fragment,s),i=!0)},o(s){re(t.$$.fragment,s),i=!1},d(s){s&&j(e),xe(t),a=!1,ot(o)}}}function gq(r){let e,t,n=We(r[1]),i=[];for(let o=0;o<n.length;o+=1)i[o]=$E(VE(r,n,o));let a=o=>re(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=pr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);J(o,e,l),t=!0},p(o,[l]){if(l&15){n=We(o[1]);let u;for(u=0;u<n.length;u+=1){let s=VE(o,n,u);i[u]?(i[u].p(s,l),ee(i[u],1)):(i[u]=$E(s),i[u].c(),ee(i[u],1),i[u].m(e.parentNode,e))}for(pt(),u=n.length;u<i.length;u+=1)a(u);mt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)ee(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)re(i[l]);t=!1},d(o){o&&j(e),At(i,o)}}}function vq(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(f){t(0,n=f)}function l(f){n===f?t(0,n=null):t(0,n=f),a(n)}function u(f,p){f.key===" "&&l(p)}let s=f=>l(f.value),c=(f,p)=>u(p,f.value);return r.$$set=f=>{"value"in f&&t(0,n=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[n,i,l,u,a,o,s,c]}var Nh=class extends Le{constructor(e){super(),$e(this,e,vq,gq,Ve,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},qE=Nh;var qf=class extends Lt{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return Wa(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return qE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function zE(r,e,t){let n=r.slice();return n[8]=e[t],n}function HE(r){let e,t,n,i,a,o;t=new di({props:{value:r[8].name}});function l(){return r[6](r[8])}function u(...s){return r[7](r[8],...s)}return{c(){e=Z("div"),we(t.$$.fragment),n=ue(),k(e,"class","mb-select-input-element"),k(e,"role","button"),k(e,"tabindex","0"),St(e,"is-selected",r[0].includes(r[8].value))},m(s,c){J(s,e,c),be(t,e,null),z(e,n),i=!0,a||(o=[Ae(e,"click",l),Ae(e,"keypress",u)],a=!0)},p(s,c){r=s;let f={};c&2&&(f.value=r[8].name),t.$set(f),(!i||c&3)&&St(e,"is-selected",r[0].includes(r[8].value))},i(s){i||(ee(t.$$.fragment,s),i=!0)},o(s){re(t.$$.fragment,s),i=!1},d(s){s&&j(e),xe(t),a=!1,ot(o)}}}function yq(r){let e,t,n=We(r[1]),i=[];for(let o=0;o<n.length;o+=1)i[o]=HE(zE(r,n,o));let a=o=>re(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=pr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);J(o,e,l),t=!0},p(o,[l]){if(l&15){n=We(o[1]);let u;for(u=0;u<n.length;u+=1){let s=zE(o,n,u);i[u]?(i[u].p(s,l),ee(i[u],1)):(i[u]=HE(s),i[u].c(),ee(i[u],1),i[u].m(e.parentNode,e))}for(pt(),u=n.length;u<i.length;u+=1)a(u);mt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)ee(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)re(i[l]);t=!1},d(o){o&&j(e),At(i,o)}}}function bq(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(f){t(0,n=f)}function l(f){n.includes(f)?t(0,n=n.filter(p=>p!==f)):(n.push(f),t(0,n)),a(n)}function u(f,p){f.key===" "&&l(p)}let s=f=>l(f.value),c=(f,p)=>u(p,f.value);return r.$$set=f=>{"value"in f&&t(0,n=f.value),"options"in f&&t(1,i=f.options),"onValueChange"in f&&t(4,a=f.onValueChange)},[n,i,l,u,a,o,s,c]}var Ch=class extends Le{constructor(e){super(),$e(this,e,bq,yq,Ve,{value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},GE=Ch;var zf=class extends Lt{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return Yi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return GE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function xq(r){en(r,"svelte-f2wb67",".date-picker-input.svelte-f2wb67{background:var(--background-modifier-form-field);border-radius:var(--mb-border-radius);border:var(--mb-border-width) solid var(--background-modifier-border);padding:5px 5px 5px 7px;cursor:pointer;position:relative;color:var(--text-normal);display:inline-flex;align-items:center;gap:5px;font-size:var(--font-ui-small)}.date-picker-text.svelte-f2wb67{display:inline-block}")}function wq(r){let e,t,n=(r[0]?r[0].format(r[1]):"none")+"",i,a,o,l,u,s;return o=new Qt({props:{iconName:"calendar"}}),{c(){e=Z("div"),t=Z("span"),i=Ie(n),a=ue(),we(o.$$.fragment),k(t,"class","date-picker-text svelte-f2wb67"),k(e,"class","date-picker-input svelte-f2wb67"),k(e,"role","button"),k(e,"tabindex","0")},m(c,f){J(c,e,f),z(e,t),z(t,i),z(e,a),be(o,e,null),l=!0,u||(s=[Ae(e,"click",r[2]),Ae(e,"keydown",r[3])],u=!0)},p(c,[f]){(!l||f&3)&&n!==(n=(c[0]?c[0].format(c[1]):"none")+"")&&Ke(i,n)},i(c){l||(ee(o.$$.fragment,c),l=!0)},o(c){re(o.$$.fragment,c),l=!1},d(c){c&&j(e),xe(o),u=!1,ot(s)}}}function _q(r,e,t){let{value:n}=e,{dateFormat:i}=e,{showDatePicker:a}=e,{onValueChange:o}=e;function l(c){t(0,n=c)}function u(c){a()}function s(c){c.key===" "&&a()}return r.$$set=c=>{"value"in c&&t(0,n=c.value),"dateFormat"in c&&t(1,i=c.dateFormat),"showDatePicker"in c&&t(4,a=c.showDatePicker),"onValueChange"in c&&t(5,o=c.onValueChange)},[n,i,u,s,a,o,l]}var Mh=class extends Le{constructor(e){super(),$e(this,e,_q,wq,Ve,{value:0,dateFormat:1,showDatePicker:4,onValueChange:5,setValue:6},xq)}get setValue(){return this.$$.ctx[6]}},WE=Mh;var Hf=class extends Lt{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!="string")return;let t=Zr.parse(e);if(t.isValid())return Zr.stringify(t)}getFallbackDefaultValue(){return Zr.getDefaultDate()}getSvelteComponent(){return WE}rawMapValue(e){return e===null?null:Zr.stringify(e)}rawReverseMapValue(e){if(e===null)return null;let t=Zr.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.base.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.base.plugin.internal.openDatePickerModal(this)}}}};function Aq(r){let e,t,n;return{c(){e=Z("input"),k(e,"type","number"),k(e,"tabindex","0"),k(e,"placeholder",r[1])},m(i,a){J(i,e,a),Ye(e,r[0]),t||(n=[Ae(e,"input",r[4]),Ae(e,"input",r[5])],t=!0)},p(i,[a]){a&2&&k(e,"placeholder",i[1]),a&1&&ui(e.value)!==i[0]&&Ye(e,i[0])},i:Me,o:Me,d(i){i&&j(e),t=!1,ot(n)}}}function Sq(r,e,t){let{value:n}=e,{placeholder:i}=e,{onValueChange:a}=e;function o(s){t(0,n=s)}function l(){n=ui(this.value),t(0,n)}let u=()=>a(n);return r.$$set=s=>{"value"in s&&t(0,n=s.value),"placeholder"in s&&t(1,i=s.placeholder),"onValueChange"in s&&t(2,a=s.onValueChange)},[n,i,a,o,l,u]}var Th=class extends Le{constructor(e){super(),$e(this,e,Sq,Aq,Ve,{value:0,placeholder:1,onValueChange:2,setValue:3})}get setValue(){return this.$$.ctx[3]}},jE=Th;var Gf=class extends Lt{filterValue(e){return Vs(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return jE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){var e;return{placeholder:(e=this.base.getArgument("placeholder"))!=null?e:"Number"}}};function Eq(r){let e,t;return{c(){e=Z("span"),t=Ie(r[1])},m(n,i){J(n,e,i),z(e,t)},p(n,i){i&2&&Ke(t,n[1])},i:Me,o:Me,d(n){n&&j(e)}}}function Dq(r){let e,t,n;function i(o){r[9](o)}let a={};return r[0]!==void 0&&(a.mdLink=r[0]),e=new Za({props:a}),Ir.push(()=>Pa(e,"mdLink",i)),{c(){we(e.$$.fragment)},m(o,l){be(e,o,l),n=!0},p(o,l){let u={};!t&&l&1&&(t=!0,u.mdLink=o[0],Ba(()=>t=!1)),e.$set(u)},i(o){n||(ee(e.$$.fragment,o),n=!0)},o(o){re(e.$$.fragment,o),n=!1},d(o){xe(e,o)}}}function Nq(r){let e,t,n,i,a,o,l,u,s,c=[Dq,Eq],f=[];function p(m,h){return m[2]?0:1}return n=p(r,-1),i=f[n]=c[n](r),o=new Qt({props:{iconName:"list"}}),{c(){e=Z("div"),t=Z("div"),i.c(),a=ue(),we(o.$$.fragment),k(t,"class","mb-suggest-text"),k(e,"class","mb-suggest-input"),k(e,"role","button"),k(e,"tabindex","0")},m(m,h){J(m,e,h),z(e,t),f[n].m(t,null),z(e,a),be(o,e,null),l=!0,u||(s=[Ae(e,"click",r[3]),Ae(e,"keydown",r[4])],u=!0)},p(m,[h]){let d=n;n=p(m,h),n===d?f[n].p(m,h):(pt(),re(f[d],1,1,()=>{f[d]=null}),mt(),i=f[n],i?i.p(m,h):(i=f[n]=c[n](m),i.c()),ee(i,1),i.m(t,null))},i(m){l||(ee(i),ee(o.$$.fragment,m),l=!0)},o(m){re(i),re(o.$$.fragment,m),l=!1},d(m){m&&j(e),f[n].d(),xe(o),u=!1,ot(s)}}}function Cq(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e,o,l,u=!1;sn(()=>{s(n)});function s(m){var h;let d=(h=m==null?void 0:m.toString())!==null&&h!==void 0?h:"null";if(t(2,u=un.isLink(d)),u)try{t(0,o=un.parseLink(d))}catch(g){console.warn(g)}else t(1,l=d)}function c(m){m.target instanceof HTMLAnchorElement||i()}function f(m){m.key===" "&&i()}function p(m){o=m,t(0,o)}return r.$$set=m=>{"value"in m&&t(5,n=m.value),"showSuggester"in m&&t(6,i=m.showSuggester),"onValueChange"in m&&t(7,a=m.onValueChange)},[o,l,u,c,f,n,i,a,s,p]}var Fh=class extends Le{constructor(e){super(),$e(this,e,Cq,Nq,Ve,{value:5,showSuggester:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},ZE=Fh;var Wf=class extends Lt{filterValue(e){return Wa(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return ZE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}};function Mq(r){en(r,"svelte-1tfnqy0",".editor-input.svelte-1tfnqy0.svelte-1tfnqy0{background:var(--background-secondary);width:100%;height:500px;padding:0;position:relative;margin-left:0;overflow:scroll}.editor-input.svelte-1tfnqy0>textarea.svelte-1tfnqy0{background:var(--background-secondary);border:none;padding:var(--size-4-4) var(--size-4-8);margin:0;position:absolute;inset:0;resize:none;border-radius:0}.editor-input.svelte-1tfnqy0>div.svelte-1tfnqy0{padding:var(--size-4-4) var(--size-4-8);position:absolute;inset:0}")}function Tq(r){let e,t,n,i,a,o;return{c(){e=Z("div"),t=Z("textarea"),n=ue(),i=Z("div"),k(t,"class","svelte-1tfnqy0"),k(i,"class","svelte-1tfnqy0"),k(e,"class","editor-input card svelte-1tfnqy0"),k(e,"role","button"),k(e,"tabindex","0")},m(l,u){J(l,e,u),z(e,t),r[9](t),Ye(t,r[0]),z(e,n),z(e,i),r[13](i),a||(o=[Ae(t,"input",r[10]),Ae(t,"focusout",r[11]),Ae(t,"input",r[12]),Ae(e,"click",r[14]),Ae(e,"keypress",r[15])],a=!0)},p(l,[u]){u&1&&Ye(t,l[0])},i:Me,o:Me,d(l){l&&j(e),r[9](null),r[13](null),a=!1,ot(o)}}}function Fq(r,e,t){let{value:n}=e,{onValueChange:i}=e,{render:a}=e,o,l;sn(()=>{t(2,o.style.display="block",o),t(3,l.style.display="none",l),a(o,n)});function u(y){t(0,n=y),a(o,y)}function s(){t(2,o.style.display="block",o),t(3,l.style.display="none",l),a(o,n)}function c(){t(2,o.style.display="none",o),t(3,l.style.display="block",l),l.focus()}function f(y){y.key===" "&&c()}function p(y){Ir[y?"unshift":"push"](()=>{l=y,t(3,l)})}function m(){n=this.value,t(0,n)}let h=()=>s(),d=()=>i(n);function g(y){Ir[y?"unshift":"push"](()=>{o=y,t(2,o)})}let v=()=>c(),w=y=>f(y);return r.$$set=y=>{"value"in y&&t(0,n=y.value),"onValueChange"in y&&t(1,i=y.onValueChange),"render"in y&&t(7,a=y.render)},[n,i,o,l,s,c,f,a,u,p,m,h,d,g,v,w]}var Ih=class extends Le{constructor(e){super(),$e(this,e,Fq,Tq,Ve,{value:0,onValueChange:1,render:7,setValue:8},Mq)}get setValue(){return this.$$.ctx[8]}},JE=Ih;var jf=class extends Lt{filterValue(e){return Ga(e)?e==null?void 0:e.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return JE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t)}}async renderInElement(e,t){var n;(n=this.mdUnloadCallback)==null||n.call(this),e.innerHTML="",this.mdUnloadCallback=await this.base.plugin.internal.renderMarkdown(t,e,this.base.getFilePath())}onUnmount(){var e;super.onUnmount(),(e=this.mdUnloadCallback)==null||e.call(this)}};var{window:al}=$u;function Iq(r){let e,t,n,i,a,o,l,u,s,c,f,p,m,h;return{c(){e=Z("div"),t=Z("div"),i=ue(),a=Z("span"),o=Ie(r[0]),l=ue(),u=Z("span"),s=Ie(r[1]),c=ue(),f=Z("span"),p=Ie(r[2]),k(t,"class","mb-progress-bar-progress"),k(t,"style",n=`width: ${r[5](r[0])}%`),k(t,"role","slider"),k(t,"aria-valuemin",r[1]),k(t,"aria-valuemax",r[2]),k(t,"aria-valuenow",r[0]),k(t,"tabindex","0"),k(a,"class","mb-progress-bar-value"),k(u,"class","mb-progress-bar-label-left"),k(f,"class","mb-progress-bar-label-right"),k(e,"class","mb-progress-bar-input"),k(e,"tabindex","0"),k(e,"role","button")},m(d,g){J(d,e,g),z(e,t),z(e,i),z(e,a),z(a,o),z(e,l),z(e,u),z(u,s),z(e,c),z(e,f),z(f,p),r[14](e),m||(h=[Ae(al,"touchmove",r[8],{passive:!1}),Ae(al,"touchcancel",r[6]),Ae(al,"touchend",r[6]),Ae(al,"mousemove",r[8]),Ae(al,"mouseup",r[6]),Ae(t,"dragstart",r[13]),Ae(e,"keydown",r[9]),Ae(e,"mousedown",r[7]),Ae(e,"touchstart",r[7])],m=!0)},p(d,[g]){g&1&&n!==(n=`width: ${d[5](d[0])}%`)&&k(t,"style",n),g&2&&k(t,"aria-valuemin",d[1]),g&4&&k(t,"aria-valuemax",d[2]),g&1&&k(t,"aria-valuenow",d[0]),g&1&&Ke(o,d[0]),g&2&&Ke(s,d[1]),g&4&&Ke(p,d[2])},i:Me,o:Me,d(d){d&&j(e),r[14](null),m=!1,ot(h)}}}function Bq(r,e){return Number.parseFloat((Math.round(r/e)*e).toFixed(10))}function Pq(r,e,t){let{onValueChange:n}=e,{value:i}=e,{minValue:a}=e,{maxValue:o}=e,{stepSize:l}=e,u=!1,s,c=0,f;function p(E){t(0,i=E)}function m(E){t(0,i=E),n(E)}function h(E){return E=Gu(E,a,o),kd(E,a,o,0,100)}function d(){t(3,u=!0)}function g(){t(3,u=!1)}function v(E){d(),w(E)}function w(E){if(!u)return;E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault();let D=E instanceof TouchEvent?E.touches[0].clientX:E.clientX;y(D)}function y(E){let D=s.getBoundingClientRect();E=Gu(E,D.left,D.right);let A=kd(E,D.left,D.right,a,o);A=Bq(A,l),m(A)}function x(E){c<50&&(c+=1);let D=Math.ceil(c/5);if(E.key==="ArrowUp"||E.key==="ArrowRight"){let A=Gu(i+D,a,o);m(A)}if(E.key==="ArrowDown"||E.key==="ArrowLeft"){let A=Gu(i-D,a,o);m(A)}window.clearTimeout(f),f=window.setTimeout(()=>c=1,100)}let _=()=>t(3,u=!0);function b(E){Ir[E?"unshift":"push"](()=>{s=E,t(4,s)})}return r.$$set=E=>{"onValueChange"in E&&t(10,n=E.onValueChange),"value"in E&&t(0,i=E.value),"minValue"in E&&t(1,a=E.minValue),"maxValue"in E&&t(2,o=E.maxValue),"stepSize"in E&&t(11,l=E.stepSize)},[i,a,o,u,s,h,g,v,w,x,n,l,p,_,b]}var Bh=class extends Le{constructor(e){super(),$e(this,e,Pq,Iq,Ve,{onValueChange:10,value:0,minValue:1,maxValue:2,stepSize:11,setValue:12})}get setValue(){return this.$$.ctx[12]}},YE=Bh;var Zf=class extends Lt{constructor(e){var t,n,i,a,o,l;if(super(e),this.minValue=(n=(t=this.base.getArgument("minValue"))==null?void 0:t.value)!=null?n:0,this.maxValue=(a=(i=this.base.getArgument("maxValue"))==null?void 0:i.value)!=null?a:100,this.stepSize=(l=(o=this.base.getArgument("stepSize"))==null?void 0:o.value)!=null?l:1,this.minValue>=this.maxValue)throw new ir({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Ec(Vs(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return YE}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};function XE(r,e,t){let n=r.slice();return n[7]=e[t],n}function QE(r){let e,t=r[7].name+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[7].value,Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o&2&&t!==(t=a[7].name+"")&&Ke(n,t),o&2&&i!==(i=a[7].value)&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function Oq(r){let e,t,n,i=We(r[1]),a=[];for(let o=0;o<i.length;o+=1)a[o]=QE(XE(r,i,o));return{c(){e=Z("select");for(let o=0;o<a.length;o+=1)a[o].c();k(e,"class","dropdown"),r[0]===void 0&&tn(()=>r[5].call(e))},m(o,l){J(o,e,l);for(let u=0;u<a.length;u+=1)a[u]&&a[u].m(e,null);Fr(e,r[0],!0),t||(n=[Ae(e,"change",r[5]),Ae(e,"change",r[6])],t=!0)},p(o,[l]){if(l&2){i=We(o[1]);let u;for(u=0;u<i.length;u+=1){let s=XE(o,i,u);a[u]?a[u].p(s,l):(a[u]=QE(s),a[u].c(),a[u].m(e,null))}for(;u<a.length;u+=1)a[u].d(1);a.length=i.length}l&3&&Fr(e,o[0])},i:Me,o:Me,d(o){o&&j(e),At(a,o),t=!1,ot(n)}}}function kq(r,e,t){let{value:n}=e,{options:i}=e,{onValueChange:a}=e;function o(c){t(0,n=c)}function l(){a(n)}function u(){n=jn(this),t(0,n),t(1,i)}let s=()=>l();return r.$$set=c=>{"value"in c&&t(0,n=c.value),"options"in c&&t(1,i=c.options),"onValueChange"in c&&t(3,a=c.onValueChange)},[n,i,l,a,o,u,s]}var Ph=class extends Le{constructor(e){super(),$e(this,e,kq,Oq,Ve,{value:0,options:1,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},KE=Ph;var Jf=class extends Lt{constructor(e){super(e),this.options=this.base.getArguments("option")}filterValue(e){return Wa(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return KE}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function Zs(r){return app.vault.adapter.getResourcePath(r)}function eD(r){return r.dependencyManager.checkDependency("dataview").api}function Js(r){return r.dependencyManager.checkDependency("js-engine").api}function Rq(r){en(r,"svelte-hrm3dz",".mb-image-suggest-input.svelte-hrm3dz{background:var(--background-secondary);border-radius:var(--mb-border-radius);border:var(--mb-border-width) solid var(--background-modifier-border);padding:var(--size-4-2);width:100%}.mb-image-suggest-image.svelte-hrm3dz{width:100%;height:fit-content;max-height:500px;object-fit:contain}.mb-image-suggest-footer.svelte-hrm3dz{display:flex;flex-direction:row;color:var(--text-normal);align-items:baseline}.mb-image-suggest-footer-text.svelte-hrm3dz{flex:1;margin-left:var(--size-4-2)}")}function tD(r){let e,t;return{c(){e=Z("img"),k(e,"class","mb-image-suggest-image svelte-hrm3dz"),vs(e.src,t=Zs(r[0]))||k(e,"src",t),k(e,"alt",r[0])},m(n,i){J(n,e,i)},p(n,i){i&1&&!vs(e.src,t=Zs(n[0]))&&k(e,"src",t),i&1&&k(e,"alt",n[0])},d(n){n&&j(e)}}}function Lq(r){let e,t,n,i,a=(r[0]||"no image selected")+"",o,l,u,s,c,f=r[0]&&tD(r);return{c(){e=Z("div"),f&&f.c(),t=ue(),n=Z("div"),i=Z("span"),o=Ie(a),l=ue(),u=Z("button"),u.textContent="Change Image",k(i,"class","mb-image-suggest-footer-text svelte-hrm3dz"),k(u,"class","btn btn-active"),k(n,"class","mb-image-suggest-footer svelte-hrm3dz"),k(e,"class","mb-image-suggest-input svelte-hrm3dz")},m(p,m){J(p,e,m),f&&f.m(e,null),z(e,t),z(e,n),z(n,i),z(i,o),z(n,l),z(n,u),s||(c=[Ae(u,"click",r[1]),Ae(u,"keydown",r[2])],s=!0)},p(p,[m]){p[0]?f?f.p(p,m):(f=tD(p),f.c(),f.m(e,t)):f&&(f.d(1),f=null),m&1&&a!==(a=(p[0]||"no image selected")+"")&&Ke(o,a)},i:Me,o:Me,d(p){p&&j(e),f&&f.d(),s=!1,ot(c)}}}function Uq(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(s){t(0,n=s)}function l(s){i()}function u(s){s.key===" "&&i()}return r.$$set=s=>{"value"in s&&t(0,n=s.value),"showSuggester"in s&&t(3,i=s.showSuggester),"onValueChange"in s&&t(4,a=s.onValueChange)},[n,l,u,i,a,o]}var Oh=class extends Le{constructor(e){super(),$e(this,e,Uq,Lq,Ve,{value:0,showSuggester:3,onValueChange:4,setValue:5},Rq)}get setValue(){return this.$$.ctx[5]}},rD=Oh;var Yf=class extends Lt{filterValue(e){return Ga(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return rD}rawMapValue(e){return e}rawReverseMapValue(e){return nl(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};function nD(r,e,t){let n=r.slice();return n[11]=e[t],n[13]=t,n}function iD(r){let e;return{c(){e=Z("span"),e.textContent="Empty",k(e,"class","mb-list-empty")},m(t,n){J(t,e,n)},p:Me,d(t){t&&j(e)}}}function Vq(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function aD(r){let e,t,n,i,a,o;t=new di({props:{value:r[11]}});function l(){return r[8](r[13])}return i=new Et({props:{$$slots:{default:[Vq]},$$scope:{ctx:r}}}),i.$on("click",l),{c(){e=Z("div"),we(t.$$.fragment),n=ue(),we(i.$$.fragment),a=ue(),k(e,"class","mb-list-item")},m(u,s){J(u,e,s),be(t,e,null),z(e,n),be(i,e,null),z(e,a),o=!0},p(u,s){r=u;let c={};s&1&&(c.value=r[11]),t.$set(c);let f={};s&16384&&(f.$$scope={dirty:s,ctx:r}),i.$set(f)},i(u){o||(ee(t.$$.fragment,u),ee(i.$$.fragment,u),o=!0)},o(u){re(t.$$.fragment,u),re(i.$$.fragment,u),o=!1},d(u){u&&j(e),xe(t),xe(i)}}}function oD(r){let e,t=sD(r[0].length,r[1])+"",n,i;return{c(){e=Z("span"),n=Ie(t),k(e,"class",i=`mb-content-limit-indicator ${r[0].length>r[1]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o&3&&t!==(t=sD(a[0].length,a[1])+"")&&Ke(n,t),o&3&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[1]?"mb-content-limit-indicator-overflow":""}`)&&k(e,"class",i)},d(a){a&&j(e)}}}function $q(r){let e,t;return e=new Qt({props:{iconName:"plus"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function qq(r){let e,t,n,i,a,o,l,u,s,c,f=We(r[0]),p=[];for(let g=0;g<f.length;g+=1)p[g]=aD(nD(r,f,g));let m=g=>re(p[g],1,1,()=>{p[g]=null}),h=null;f.length||(h=iD(r));let d=r[1]!==void 0&&oD(r);return l=new Et({props:{disabled:!r[3],$$slots:{default:[$q]},$$scope:{ctx:r}}}),l.$on("click",r[10]),{c(){e=Z("div");for(let g=0;g<p.length;g+=1)p[g].c();h&&h.c(),t=ue(),n=Z("div"),i=Z("input"),a=ue(),d&&d.c(),o=ue(),we(l.$$.fragment),k(e,"class","mb-list-items"),k(i,"type","text"),k(i,"tabindex","0"),k(i,"placeholder",r[2]),k(i,"maxlength",r[1]),k(n,"class","mb-list-input")},m(g,v){J(g,e,v);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(e,null);h&&h.m(e,null),J(g,t,v),J(g,n,v),z(n,i),Ye(i,r[3]),z(n,a),d&&d.m(n,null),z(n,o),be(l,n,null),u=!0,s||(c=Ae(i,"input",r[9]),s=!0)},p(g,[v]){if(v&33){f=We(g[0]);let y;for(y=0;y<f.length;y+=1){let x=nD(g,f,y);p[y]?(p[y].p(x,v),ee(p[y],1)):(p[y]=aD(x),p[y].c(),ee(p[y],1),p[y].m(e,null))}for(pt(),y=f.length;y<p.length;y+=1)m(y);mt(),!f.length&&h?h.p(g,v):f.length?h&&(h.d(1),h=null):(h=iD(g),h.c(),h.m(e,null))}(!u||v&4)&&k(i,"placeholder",g[2]),(!u||v&2)&&k(i,"maxlength",g[1]),v&8&&i.value!==g[3]&&Ye(i,g[3]),g[1]!==void 0?d?d.p(g,v):(d=oD(g),d.c(),d.m(n,o)):d&&(d.d(1),d=null);let w={};v&8&&(w.disabled=!g[3]),v&16384&&(w.$$scope={dirty:v,ctx:g}),l.$set(w)},i(g){if(!u){for(let v=0;v<f.length;v+=1)ee(p[v]);ee(l.$$.fragment,g),u=!0}},o(g){p=p.filter(Boolean);for(let v=0;v<p.length;v+=1)re(p[v]);re(l.$$.fragment,g),u=!1},d(g){g&&(j(e),j(t),j(n)),At(p,g),h&&h.d(),d&&d.d(),xe(l),s=!1,c()}}}function sD(r,e){let t=e.toString();return`${r.toString().padStart(t.length,"0")}/${t}`}function zq(r,e,t){let{value:n}=e,{limit:i}=e,{placeholder:a}=e,{onValueChange:o}=e,l="";function u(h){t(0,n=h)}function s(){n.push(l),o(n),t(3,l=""),t(0,n)}function c(h){n.splice(h,1),o(n),t(0,n)}let f=h=>c(h);function p(){l=this.value,t(3,l)}let m=()=>s();return r.$$set=h=>{"value"in h&&t(0,n=h.value),"limit"in h&&t(1,i=h.limit),"placeholder"in h&&t(2,a=h.placeholder),"onValueChange"in h&&t(6,o=h.onValueChange)},[n,i,a,l,s,c,o,u,f,p,m]}var kh=class extends Le{constructor(e){super(),$e(this,e,zq,qq,Ve,{value:0,limit:1,placeholder:2,onValueChange:6,setValue:7})}get setValue(){return this.$$.ctx[7]}},uD=kh;var Xf=class extends Lt{filterValue(e){return Yi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return uD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){var e,t,n;return{placeholder:(t=(e=this.base.getArgument("placeholder"))==null?void 0:e.value)!=null?t:"New Entry...",limit:(n=this.base.getArgument("limit"))==null?void 0:n.value}}};function lD(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function cD(r){let e;return{c(){e=Z("span"),e.textContent="Empty",k(e,"class","mb-list-empty")},m(t,n){J(t,e,n)},p:Me,d(t){t&&j(e)}}}function Hq(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function fD(r){let e,t,n,i,a,o;t=new di({props:{value:r[9]}});function l(){return r[8](r[11])}return i=new Et({props:{$$slots:{default:[Hq]},$$scope:{ctx:r}}}),i.$on("click",l),{c(){e=Z("div"),we(t.$$.fragment),n=ue(),we(i.$$.fragment),a=ue(),k(e,"class","mb-list-item")},m(u,s){J(u,e,s),be(t,e,null),z(e,n),be(i,e,null),z(e,a),o=!0},p(u,s){r=u;let c={};s&1&&(c.value=r[9]),t.$set(c);let f={};s&4096&&(f.$$scope={dirty:s,ctx:r}),i.$set(f)},i(u){o||(ee(t.$$.fragment,u),ee(i.$$.fragment,u),o=!0)},o(u){re(t.$$.fragment,u),re(i.$$.fragment,u),o=!1},d(u){u&&j(e),xe(t),xe(i)}}}function Gq(r){let e,t,n,i,a,o,l,u,s,c,f=We(r[0]),p=[];for(let d=0;d<f.length;d+=1)p[d]=fD(lD(r,f,d));let m=d=>re(p[d],1,1,()=>{p[d]=null}),h=null;return f.length||(h=cD(r)),l=new Qt({props:{iconName:"list"}}),{c(){e=Z("div");for(let d=0;d<p.length;d+=1)p[d].c();h&&h.c(),t=ue(),n=Z("div"),i=Z("div"),a=Z("div"),a.innerHTML="<span>Add Element...</span>",o=ue(),we(l.$$.fragment),k(e,"class","mb-list-items"),k(a,"class","mb-suggest-text"),k(i,"class","mb-suggest-input"),k(i,"role","button"),k(i,"tabindex","0"),k(n,"class","mb-list-input")},m(d,g){J(d,e,g);for(let v=0;v<p.length;v+=1)p[v]&&p[v].m(e,null);h&&h.m(e,null),J(d,t,g),J(d,n,g),z(n,i),z(i,a),z(i,o),be(l,i,null),u=!0,s||(c=[Ae(i,"click",r[2]),Ae(i,"keydown",r[3])],s=!0)},p(d,[g]){if(g&3){f=We(d[0]);let v;for(v=0;v<f.length;v+=1){let w=lD(d,f,v);p[v]?(p[v].p(w,g),ee(p[v],1)):(p[v]=fD(w),p[v].c(),ee(p[v],1),p[v].m(e,null))}for(pt(),v=f.length;v<p.length;v+=1)m(v);mt(),!f.length&&h?h.p(d,g):f.length?h&&(h.d(1),h=null):(h=cD(d),h.c(),h.m(e,null))}},i(d){if(!u){for(let g=0;g<f.length;g+=1)ee(p[g]);ee(l.$$.fragment,d),u=!0}},o(d){p=p.filter(Boolean);for(let g=0;g<p.length;g+=1)re(p[g]);re(l.$$.fragment,d),u=!1},d(d){d&&(j(e),j(t),j(n)),At(p,d),h&&h.d(),xe(l),s=!1,ot(c)}}}function Wq(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var Rh=class extends Le{constructor(e){super(),$e(this,e,Wq,Gq,Ve,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},pD=Rh;var Qf=class extends Lt{filterValue(e){return Yi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return pD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}};function mD(r,e,t){let n=r.slice();return n[26]=e[t][0],n[27]=e[t][1],n}function dD(r,e,t){let n=r.slice();return n[23]=e[t],n}function hD(r,e,t){let n=r.slice();return n[23]=e[t],n}function gD(r,e,t){let n=r.slice();return n[26]=e[t][0],n[27]=e[t][1],n}function jq(r){let e,t,n,i,a,o=We(Object.values(r[2])),l=[];for(let c=0;c<o.length;c+=1)l[c]=vD(dD(r,o,c));let u=We(Object.entries(r[1])),s=[];for(let c=0;c<u.length;c+=1)s[c]=yD(mD(r,u,c));return{c(){e=Z("select");for(let c=0;c<l.length;c+=1)l[c].c();t=ue(),n=Z("select");for(let c=0;c<s.length;c+=1)s[c].c();k(e,"class","dropdown mb-input-element-group-element"),r[5]===void 0&&tn(()=>r[16].call(e)),k(n,"class","dropdown mb-input-element-group-element"),r[4]===void 0&&tn(()=>r[18].call(n))},m(c,f){J(c,e,f);for(let p=0;p<l.length;p+=1)l[p]&&l[p].m(e,null);Fr(e,r[5],!0),J(c,t,f),J(c,n,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(n,null);Fr(n,r[4],!0),i||(a=[Ae(e,"change",r[16]),Ae(e,"change",r[17]),Ae(n,"change",r[18]),Ae(n,"change",r[19])],i=!0)},p(c,f){if(f[0]&4){o=We(Object.values(c[2]));let p;for(p=0;p<o.length;p+=1){let m=dD(c,o,p);l[p]?l[p].p(m,f):(l[p]=vD(m),l[p].c(),l[p].m(e,null))}for(;p<l.length;p+=1)l[p].d(1);l.length=o.length}if(f[0]&36&&Fr(e,c[5]),f[0]&2){u=We(Object.entries(c[1]));let p;for(p=0;p<u.length;p+=1){let m=mD(c,u,p);s[p]?s[p].p(m,f):(s[p]=yD(m),s[p].c(),s[p].m(n,null))}for(;p<s.length;p+=1)s[p].d(1);s.length=u.length}f[0]&18&&Fr(n,c[4])},d(c){c&&(j(e),j(t),j(n)),At(l,c),At(s,c),i=!1,ot(a)}}}function Zq(r){let e,t,n,i,a,o=We(Object.entries(r[1])),l=[];for(let c=0;c<o.length;c+=1)l[c]=bD(gD(r,o,c));let u=We(Object.values(r[2])),s=[];for(let c=0;c<u.length;c+=1)s[c]=xD(hD(r,u,c));return{c(){e=Z("select");for(let c=0;c<l.length;c+=1)l[c].c();t=ue(),n=Z("select");for(let c=0;c<s.length;c+=1)s[c].c();k(e,"class","dropdown mb-input-element-group-element"),r[4]===void 0&&tn(()=>r[12].call(e)),k(n,"class","dropdown mb-input-element-group-element"),r[5]===void 0&&tn(()=>r[14].call(n))},m(c,f){J(c,e,f);for(let p=0;p<l.length;p+=1)l[p]&&l[p].m(e,null);Fr(e,r[4],!0),J(c,t,f),J(c,n,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(n,null);Fr(n,r[5],!0),i||(a=[Ae(e,"change",r[12]),Ae(e,"change",r[13]),Ae(n,"change",r[14]),Ae(n,"change",r[15])],i=!0)},p(c,f){if(f[0]&2){o=We(Object.entries(c[1]));let p;for(p=0;p<o.length;p+=1){let m=gD(c,o,p);l[p]?l[p].p(m,f):(l[p]=bD(m),l[p].c(),l[p].m(e,null))}for(;p<l.length;p+=1)l[p].d(1);l.length=o.length}if(f[0]&18&&Fr(e,c[4]),f[0]&4){u=We(Object.values(c[2]));let p;for(p=0;p<u.length;p+=1){let m=hD(c,u,p);s[p]?s[p].p(m,f):(s[p]=xD(m),s[p].c(),s[p].m(n,null))}for(;p<s.length;p+=1)s[p].d(1);s.length=u.length}f[0]&36&&Fr(n,c[5])},d(c){c&&(j(e),j(t),j(n)),At(l,c),At(s,c),i=!1,ot(a)}}}function vD(r){let e,t=r[23]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[23],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o[0]&4&&t!==(t=a[23]+"")&&Ke(n,t),o[0]&4&&i!==(i=a[23])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function yD(r){let e,t=r[27]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[26],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o[0]&2&&t!==(t=a[27]+"")&&Ke(n,t),o[0]&2&&i!==(i=a[26])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function bD(r){let e,t=r[27]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[26],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o[0]&2&&t!==(t=a[27]+"")&&Ke(n,t),o[0]&2&&i!==(i=a[26])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function xD(r){let e,t=r[23]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[23],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o[0]&4&&t!==(t=a[23]+"")&&Ke(n,t),o[0]&4&&i!==(i=a[23])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function Jq(r){let e,t,n,i,a;function o(s,c){return s[0]?Zq:jq}let l=o(r,[-1,-1]),u=l(r);return{c(){e=Z("div"),u.c(),t=ue(),n=Z("input"),k(n,"class","mb-date-input-year-input mb-input-element-group-element"),k(n,"type","number"),k(n,"tabindex","0"),k(n,"max","9999"),k(n,"min","0"),k(e,"class","mb-input-element-group")},m(s,c){J(s,e,c),u.m(e,null),z(e,t),z(e,n),Ye(n,r[3]),i||(a=[Ae(n,"input",r[20]),Ae(n,"input",r[21])],i=!0)},p(s,c){l===(l=o(s,c))&&u?u.p(s,c):(u.d(1),u=l(s),u&&(u.c(),u.m(e,t))),c[0]&8&&ui(n.value)!==s[3]&&Ye(n,s[3])},i:Me,o:Me,d(s){s&&j(e),u.d(),i=!1,ot(a)}}}function Yq(r,e,t){let{value:n}=e,{useUsInputOrder:i}=e,{onValueChange:a}=e,o={},l={},u,s,c;sn(()=>{t(1,o={0:"January",1:"February",2:"March",3:"April",4:"May",5:"June",6:"July",7:"August",8:"September",9:"October",10:"November",11:"December"});for(let S=1;S<=31;S++)t(2,l[S.toString()]=S.toString(),l);t(3,u=n.year().toString()),t(4,s=n.month().toString()),t(5,c=n.date().toString())});function f(S){t(9,n=S),t(3,u=n.year().toString()),t(4,s=n.month().toString()),t(5,c=n.date().toString())}function p(){let S=Number.parseInt(u),M=Number.isNaN(S)?Zr.getDefaultYear():S;n.year(M),a(n)}function m(){n.month(s);let S=d(n.date());n.date(S),t(5,c=S.toString()),a(n)}function h(){let S=Number.parseInt(c),M=d(S);n.date(M),t(5,c=M.toString()),a(n)}function d(S){return Number.isNaN(S)?Zr.getDefaultDay():S<1?1:S>n.daysInMonth()?n.daysInMonth():S}function g(){s=jn(this),t(4,s),t(1,o)}let v=()=>m();function w(){c=jn(this),t(5,c),t(2,l)}let y=()=>h();function x(){c=jn(this),t(5,c),t(2,l)}let _=()=>h();function b(){s=jn(this),t(4,s),t(1,o)}let E=()=>m();function D(){u=ui(this.value),t(3,u)}let A=()=>p();return r.$$set=S=>{"value"in S&&t(9,n=S.value),"useUsInputOrder"in S&&t(0,i=S.useUsInputOrder),"onValueChange"in S&&t(10,a=S.onValueChange)},[i,o,l,u,s,c,p,m,h,n,a,f,g,v,w,y,x,_,b,E,D,A]}var Lh=class extends Le{constructor(e){super(),$e(this,e,Yq,Jq,Ve,{value:9,useUsInputOrder:0,onValueChange:10,setValue:11},null,[-1,-1])}get setValue(){return this.$$.ctx[11]}},wD=Lh;var Kf=class extends Lt{filterValue(e){if(e==null||typeof e!="string")return;let t=Zr.parse(e);if(t.isValid())return Zr.stringify(t)}getFallbackDefaultValue(){return Zr.getDefaultDate()}getSvelteComponent(){return wD}rawMapValue(e){return Zr.stringify(e)}rawReverseMapValue(e){return Zr.parse(e)}getMountArgs(){return{useUsInputOrder:this.base.plugin.settings.useUsDateInputOrder}}};var Uh=fr(On()),ol=fr(Yn()),Vh=class{constructor(){this._hour=ei.getDefaultHour(),this._minute=ei.getDefaultHour()}getHour(){return this._hour}setHour(e){if(e<0||e>24){this._hour=ei.getDefaultHour();return}this._hour=e}getMinute(){return this._minute}setMinute(e){if(e<0||e>59){this._minute=ei.getDefaultMinute();return}this._minute=e}getUniformHour(){return this.getHour().toString().padStart(2,"0")}getUniformMinute(){return this.getMinute().toString().padStart(2,"0")}setHourFromString(e){let t=Number.parseInt(e);this.setHour(Number.isNaN(t)?ei.getDefaultHour():t)}setMinuteFromString(e){let t=Number.parseInt(e);this.setMinute(Number.isNaN(t)?ei.getDefaultMinute():t)}},Xq=Uh.P.sequenceMap((r,e,t,n,i)=>({hour:Number.parseInt(r+e),minute:Number.parseInt(n+i)}),ol.P_UTILS.digit(),ol.P_UTILS.digit(),Uh.P.string(":"),ol.P_UTILS.digit(),ol.P_UTILS.digit()),ei=class r{static parse(e){if(!e)return;let t=r.getDefaultTime(),n=Xq.tryParse(e);if(n.success&&!(Number.isNaN(n.value.hour)||Number.isNaN(n.value.minute))&&!(n.value.hour<0||n.value.hour>=24)&&!(n.value.minute<0||n.value.minute>=60))return t.setHour(n.value.hour),t.setMinute(n.value.minute),t}static stringify(e){return`${e.getUniformHour()}:${e.getUniformMinute()}`}static getDefaultTime(){return new Vh}static getDefaultHour(){return 0}static getDefaultMinute(){return 0}};function _D(r,e,t){let n=r.slice();return n[13]=e[t][0],n[14]=e[t][1],n}function AD(r,e,t){let n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function SD(r){let e,t=r[18]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[17],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o&1&&t!==(t=a[18]+"")&&Ke(n,t),o&1&&i!==(i=a[17])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function ED(r){let e,t=r[14]+"",n,i;return{c(){e=Z("option"),n=Ie(t),e.__value=i=r[13],Ye(e,e.__value)},m(a,o){J(a,e,o),z(e,n)},p(a,o){o&2&&t!==(t=a[14]+"")&&Ke(n,t),o&2&&i!==(i=a[13])&&(e.__value=i,Ye(e,e.__value))},d(a){a&&j(e)}}}function Qq(r){let e,t,n,i,a,o,l=We(Object.entries(r[0])),u=[];for(let f=0;f<l.length;f+=1)u[f]=SD(AD(r,l,f));let s=We(Object.entries(r[1])),c=[];for(let f=0;f<s.length;f+=1)c[f]=ED(_D(r,s,f));return{c(){e=Z("div"),t=Z("select");for(let f=0;f<u.length;f+=1)u[f].c();n=ue(),i=Z("select");for(let f=0;f<c.length;f+=1)c[f].c();k(t,"class","dropdown mb-input-element-group-element"),r[2]===void 0&&tn(()=>r[9].call(t)),k(i,"class","dropdown mb-input-element-group-element"),r[3]===void 0&&tn(()=>r[11].call(i)),k(e,"class","mb-input-element-group")},m(f,p){J(f,e,p),z(e,t);for(let m=0;m<u.length;m+=1)u[m]&&u[m].m(t,null);Fr(t,r[2],!0),z(e,n),z(e,i);for(let m=0;m<c.length;m+=1)c[m]&&c[m].m(i,null);Fr(i,r[3],!0),a||(o=[Ae(t,"change",r[9]),Ae(t,"change",r[10]),Ae(i,"change",r[11]),Ae(i,"change",r[12])],a=!0)},p(f,[p]){if(p&1){l=We(Object.entries(f[0]));let m;for(m=0;m<l.length;m+=1){let h=AD(f,l,m);u[m]?u[m].p(h,p):(u[m]=SD(h),u[m].c(),u[m].m(t,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=l.length}if(p&5&&Fr(t,f[2]),p&2){s=We(Object.entries(f[1]));let m;for(m=0;m<s.length;m+=1){let h=_D(f,s,m);c[m]?c[m].p(h,p):(c[m]=ED(h),c[m].c(),c[m].m(i,null))}for(;m<c.length;m+=1)c[m].d(1);c.length=s.length}p&10&&Fr(i,f[3])},i:Me,o:Me,d(f){f&&j(e),At(u,f),At(c,f),a=!1,ot(o)}}}function Kq(r,e,t){let{value:n}=e,{onValueChange:i}=e,a={},o={},l,u;sn(()=>{for(let g=0;g<=24;g++)t(0,a[g.toString()]=g.toString().padStart(2,"0"),a);for(let g=0;g<=59;g++)t(1,o[g.toString()]=g.toString().padStart(2,"0"),o);t(3,u=n.getMinute().toString()),t(2,l=n.getHour().toString())});function s(g){t(6,n=g),t(3,u=n.getMinute().toString()),t(2,l=n.getHour().toString())}function c(){n.setMinuteFromString(u),i(n)}function f(){n.setHourFromString(l),i(n)}function p(){l=jn(this),t(2,l),t(0,a)}let m=()=>f();function h(){u=jn(this),t(3,u),t(1,o)}let d=()=>c();return r.$$set=g=>{"value"in g&&t(6,n=g.value),"onValueChange"in g&&t(7,i=g.onValueChange)},[a,o,l,u,c,f,n,i,s,p,m,h,d]}var $h=class extends Le{constructor(e){super(),$e(this,e,Kq,Qq,Ve,{value:6,onValueChange:7,setValue:8})}get setValue(){return this.$$.ctx[8]}},DD=$h;var ep=class extends Lt{filterValue(e){let t=$s(e);return ei.parse(t)?t:void 0}getFallbackDefaultValue(){return ei.getDefaultTime()}getSvelteComponent(){return DD}rawMapValue(e){return ei.stringify(e)}rawReverseMapValue(e){return ei.parse(e)}};function ND(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function CD(r){let e,t,n,i,a,o,l,u;t=new di({props:{value:r[9]}}),a=new Qt({props:{iconName:"x"}});function s(){return r[8](r[11])}return{c(){e=Z("div"),we(t.$$.fragment),n=ue(),i=Z("button"),we(a.$$.fragment),k(i,"class","mb-inline-list-item-button"),k(e,"class","mb-inline-list-item")},m(c,f){J(c,e,f),be(t,e,null),z(e,n),z(e,i),be(a,i,null),o=!0,l||(u=Ae(i,"click",s),l=!0)},p(c,f){r=c;let p={};f&1&&(p.value=r[9]),t.$set(p)},i(c){o||(ee(t.$$.fragment,c),ee(a.$$.fragment,c),o=!0)},o(c){re(t.$$.fragment,c),re(a.$$.fragment,c),o=!1},d(c){c&&j(e),xe(t),xe(a),l=!1,u()}}}function e7(r){let e,t,n,i,a,o,l,u,s,c=We(r[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=CD(ND(r,c,m));let p=m=>re(f[m],1,1,()=>{f[m]=null});return o=new Qt({props:{iconName:"plus"}}),{c(){e=Z("div");for(let m=0;m<f.length;m+=1)f[m].c();t=ue(),n=Z("div"),i=Z("span"),i.textContent="\u200B",a=ue(),we(o.$$.fragment),k(n,"class","mb-inline-list-add"),k(n,"role","button"),k(n,"tabindex","0"),k(e,"class","mb-inline-list")},m(m,h){J(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);z(e,t),z(e,n),z(n,i),z(n,a),be(o,n,null),l=!0,u||(s=[Ae(n,"click",r[2]),Ae(n,"keydown",r[3])],u=!0)},p(m,[h]){if(h&3){c=We(m[0]);let d;for(d=0;d<c.length;d+=1){let g=ND(m,c,d);f[d]?(f[d].p(g,h),ee(f[d],1)):(f[d]=CD(g),f[d].c(),ee(f[d],1),f[d].m(e,t))}for(pt(),d=c.length;d<f.length;d+=1)p(d);mt()}},i(m){if(!l){for(let h=0;h<c.length;h+=1)ee(f[h]);ee(o.$$.fragment,m),l=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)re(f[h]);re(o.$$.fragment,m),l=!1},d(m){m&&j(e),At(f,m),xe(o),u=!1,ot(s)}}}function t7(r,e,t){let{value:n}=e,{showSuggester:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showSuggester"in p&&t(4,i=p.showSuggester),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var qh=class extends Le{constructor(e){super(),$e(this,e,t7,e7,Ve,{value:0,showSuggester:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},MD=qh;var tp=class extends Lt{filterValue(e){return Yi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return MD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.base.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}};function TD(r,e,t){let n=r.slice();return n[9]=e[t],n[11]=t,n}function FD(r){let e,t,n,i,a,o,l,u;t=new di({props:{value:r[9]}}),a=new Qt({props:{iconName:"x"}});function s(){return r[8](r[11])}return{c(){e=Z("div"),we(t.$$.fragment),n=ue(),i=Z("button"),we(a.$$.fragment),k(i,"class","mb-inline-list-item-button"),k(e,"class","mb-inline-list-item")},m(c,f){J(c,e,f),be(t,e,null),z(e,n),z(e,i),be(a,i,null),o=!0,l||(u=Ae(i,"click",s),l=!0)},p(c,f){r=c;let p={};f&1&&(p.value=r[9]),t.$set(p)},i(c){o||(ee(t.$$.fragment,c),ee(a.$$.fragment,c),o=!0)},o(c){re(t.$$.fragment,c),re(a.$$.fragment,c),o=!1},d(c){c&&j(e),xe(t),xe(a),l=!1,u()}}}function r7(r){let e,t,n,i,a,o,l,u,s,c=We(r[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=FD(TD(r,c,m));let p=m=>re(f[m],1,1,()=>{f[m]=null});return o=new Qt({props:{iconName:"plus"}}),{c(){e=Z("div");for(let m=0;m<f.length;m+=1)f[m].c();t=ue(),n=Z("div"),i=Z("span"),i.textContent="\u200B",a=ue(),we(o.$$.fragment),k(n,"class","mb-inline-list-add"),k(n,"role","button"),k(n,"tabindex","0"),k(e,"class","mb-inline-list")},m(m,h){J(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);z(e,t),z(e,n),z(n,i),z(n,a),be(o,n,null),l=!0,u||(s=[Ae(n,"click",r[2]),Ae(n,"keydown",r[3])],u=!0)},p(m,[h]){if(h&3){c=We(m[0]);let d;for(d=0;d<c.length;d+=1){let g=TD(m,c,d);f[d]?(f[d].p(g,h),ee(f[d],1)):(f[d]=FD(g),f[d].c(),ee(f[d],1),f[d].m(e,t))}for(pt(),d=c.length;d<f.length;d+=1)p(d);mt()}},i(m){if(!l){for(let h=0;h<c.length;h+=1)ee(f[h]);ee(o.$$.fragment,m),l=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)re(f[h]);re(o.$$.fragment,m),l=!1},d(m){m&&j(e),At(f,m),xe(o),u=!1,ot(s)}}}function n7(r,e,t){let{value:n}=e,{showInput:i}=e,{onValueChange:a}=e;function o(p){t(0,n=p)}function l(p){n.push(p),t(0,n)}function u(p){n.splice(p,1),a(n),t(0,n)}function s(p){p.target instanceof HTMLAnchorElement||i()}function c(p){p.key===" "&&i()}let f=p=>u(p);return r.$$set=p=>{"value"in p&&t(0,n=p.value),"showInput"in p&&t(4,i=p.showInput),"onValueChange"in p&&t(5,a=p.onValueChange)},[n,u,s,c,i,a,o,l,f]}var zh=class extends Le{constructor(e){super(),$e(this,e,n7,r7,Ve,{value:0,showInput:4,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},ID=zh;var rp=class extends Lt{filterValue(e){return Yi(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return ID}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.base.plugin.internal.openTextPromptModal("","Meta Bind List","New List Element","",e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},()=>{})}};var np=class{constructor(e){this.plugin=e}createInputField(e){let t=e.declaration.inputFieldType,n=e.renderChildType;if(t!=="invalid"&&this.checkRenderChildTypeAllowed(t,n),t==="toggle")return new Rf(e);if(t==="slider")return new Uf(e);if(t==="text")return new Lf(e);if(t==="textArea")return new Vf(e);if(t==="select")return new qf(e);if(t==="multiSelect")return new zf(e);if(t==="datePicker")return new Hf(e);if(t==="number")return new Gf(e);if(t==="suggester")return new Wf(e);if(t==="editor")return new jf(e);if(t==="progressBar")return new Zf(e);if(t==="inlineSelect")return new Jf(e);if(t==="imageSuggester")return new Yf(e);if(t==="list")return new Xf(e);if(t==="listSuggester")return new Qf(e);if(t==="date")return new Kf(e);if(t==="time")return new ep(e);if(t==="inlineListSuggester")return new tp(e);if(t==="inlineList")return new rp(e)}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let n=Nc[e];if(t==="block"&&!n.allowInBlock)throw new ca({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[bt.linkToInputField(e)]});if(t==="inline"&&!n.allowInline)throw new ca({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[bt.linkToInputField(e)]})}};var Ys=class{constructor(e){this.plugin=e}createDefaultButtonConfig(){return{label:"This is a button",hidden:!1,class:"",tooltip:"",id:"",style:"default",actions:[]}}async runButtonAction(e,t){try{if(e.action)await this.plugin.api.buttonActionRunner.runAction(e.action,t);else if(e.actions)for(let n of e.actions)await this.plugin.api.buttonActionRunner.runAction(n,t);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(n){console.warn("meta-bind | ButtonMDRC >> error while running action",n),this.plugin.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){if(e==="command")return{type:"command",command:""};if(e==="open")return{type:"open",link:""};if(e==="js")return{type:"js",file:""};if(e==="input")return{type:"input",str:""};if(e==="sleep")return{type:"sleep",ms:0};if(e==="templaterCreateNote")return{type:"templaterCreateNote",templateFile:"",folderPath:"",fileName:"",openNote:!0};if(e==="updateMetadata")return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""};throw new Error(`Unknown button action type: ${e}`)}async runAction(e,t){if(e.type==="command"){await this.runCommandAction(e);return}else if(e.type==="js"){await this.runJSAction(e,t);return}else if(e.type==="open"){await this.runOpenAction(e,t);return}else if(e.type==="input"){await this.runInputAction(e);return}else if(e.type==="sleep"){await this.runSleepAction(e);return}else if(e.type==="templaterCreateNote"){await this.runTemplaterCreateNoteAction(e);return}else if(e.type==="updateMetadata"){await this.runUpdateMetadataAction(e,t);return}throw new Error("Unknown button action type")}async runCommandAction(e){this.plugin.internal.executeCommandById(e.command)}async runJSAction(e,t){(await this.plugin.internal.jsEngineRunFile(e.file,t))()}async runOpenAction(e,t){var i;let n=un.parseLinkOrUrl(e.link);n.internal?this.plugin.internal.openFile(n.target,t,(i=e.newTab)!=null?i:!1):Dc(n.target)}async runInputAction(e){let t=document.activeElement;t&&t instanceof HTMLInputElement&&(t.setRangeText(e.str,t.selectionStart,t.selectionEnd,"end"),t.trigger("input"))}async runSleepAction(e){await new Promise(t=>setTimeout(t,e.ms))}async runTemplaterCreateNoteAction(e){throw new Error("Not supported")}async runUpdateMetadataAction(e,t){let n=this.plugin.api.bindTargetParser.parseAndValidateBindTarget(e.bindTarget,t),i=mr(),a=new _r(void 0),o=this.plugin.metadataManager.subscribe(i,a,n,()=>{});o.applyUpdate({value:e.value,evaluate:e.evaluate}),o.unsubscribe()}};var ip=class{constructor(e){this.value=e,this.count=1}getValue(){return this.value}increment(){return this.count+=1,this.count}decrement(){return this.count-=1,this.count}getCount(){return this.count}isEmpty(){return this.count===0}};var ap=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let t=new Set,n=new Rt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?n.add(new pa({errorLevel:"ERROR",cause:`Button with label "${i.label}" has no id, but button templates must have an id.`,effect:"Button templates could not be saved."})):t.has(i.id)?n.add(new pa({errorLevel:"ERROR",cause:`Button id "${i.id}" is not unique. The same id is used by multiple buttons.`,effect:"Button templates could not be saved."})):(t.add(i.id),this.buttonTemplates.set(i.id,i));return n.hasErrors()&&this.buttonTemplates.clear(),n}registerButtonLoadListener(e,t,n){let i=this.getButton(e,t);i&&n(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(t)||a.set(t,new Map);let o=a.get(t),l=mr();return o.set(l,n),()=>this.removeButtonLoadListener(e,t,l)}notifyButtonLoadListeners(e,t){let n=this.getButton(e,t);if(!n)throw new Error(`ButtonManager | button with id ${t} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);if(a)for(let[o,l]of a)l(n)}removeButtonLoadListener(e,t,n){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(n),a.size===0&&i.delete(t),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){var i,a;if(t.id===void 0||t.id==="")throw new Error("ButtonManager | button id is undefined");if(this.buttonTemplates.has(t.id))throw new Error(`ButtonManager | button with id "${t.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map);let n=this.buttons.get(e);if(n.has(t.id))if(JSON.stringify((i=n.get(t.id))==null?void 0:i.getValue())===JSON.stringify(t)){(a=n.get(t.id))==null||a.increment();return}else throw new Error(`ButtonManager | button with id "${t.id}" already exists`);n.set(t.id,new ip(t)),this.notifyButtonLoadListeners(e,t.id)}getButton(e,t){var i;if(this.buttonTemplates.has(t))return this.buttonTemplates.get(t);let n=this.buttons.get(e);if(n)return(i=n.get(t))==null?void 0:i.getValue()}removeButton(e,t){var i,a;let n=this.buttons.get(e);n&&((i=n.get(t))==null||i.decrement(),(a=n.get(t))!=null&&a.isEmpty()&&n.delete(t),n.size===0&&this.buttons.delete(e))}};var RD=fr(Yn());var Xs=class{constructor(e,t){this.range=e,this.tokenClass=t}};var Hh=fr(On());var gt=class r{static sequence(...e){return Hh.P.sequenceMap((...t)=>t.flat(2).filter(n=>n!==void 0),...e)}static separateBy(e,t){return r.sequence(e,r.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((n,i)=>[new Xs(i,t)])}static highlightStr(e,t){return r.highlight(Hh.P.string(e),t)}};var ga=class{constructor(e,t,n){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=n}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e;return this.str[this.parsingError.parseFailure.furthest.index]===`
`?e={index:this.parsingError.parseFailure.furthest.index+1,column:1,line:this.parsingError.parseFailure.furthest.line+1}:e={index:this.parsingError.parseFailure.furthest.index+1,column:this.parsingError.parseFailure.furthest.column+1,line:this.parsingError.parseFailure.furthest.line},[new Xs({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};var Nr=fr(Yn());var Gh=fr(On());var Wh=gt.highlight(Nn,"ident"),op=gt.highlight(Nn,"keyword"),jh=gt.highlightStr(",","control"),sp=gt.highlightStr("(","control"),up=gt.highlightStr(")","control"),Qs=gt.highlightStr("[","control"),Ks=gt.highlightStr("]","control"),a7=gt.highlight(fh,"string"),o7=gt.highlight(ph,"ident"),s7=Gh.P.or(o7,a7),u7=gt.separateBy(s7,jh.trim(Nr.P_UTILS.optionalWhitespace())),l7=gt.sequence(op,gt.sequence(sp,u7.trim(Nr.P_UTILS.optionalWhitespace()),up).optional()),Zh=gt.separateBy(l7,jh.trim(Nr.P_UTILS.optionalWhitespace())),eu=gt.sequence(gt.sequence(Wh,gt.highlightStr("^","control")).optional(),gt.sequence(gt.highlight(el,"ident"),gt.highlightStr("#","control")).optional(),gt.highlight(dh,"ident")),c7=gt.sequence(op.trim(Nr.P_UTILS.optionalWhitespace()),gt.sequence(sp,Zh.trim(Nr.P_UTILS.optionalWhitespace()),up).trim(Nr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Nr.P_UTILS.optionalWhitespace()),eu).trim(Nr.P_UTILS.optionalWhitespace()).optional()),f7=gt.sequence(op.trim(Nr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(sp,Zh.trim(Nr.P_UTILS.optionalWhitespace()),up).trim(Nr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Nr.P_UTILS.optionalWhitespace()),eu).trim(Nr.P_UTILS.optionalWhitespace()).optional()),PD=Gh.P.or(gt.sequence(gt.highlightStr("INPUT","control"),Qs,Wh.trim(Nr.P_UTILS.optionalWhitespace()),Ks.skip(Nr.P_UTILS.optionalWhitespace()),Qs,f7,Ks),gt.sequence(gt.highlightStr("INPUT","control"),Qs,c7,Ks)),BD=gt.highlight(Nf,"ident"),p7=gt.sequence(gt.highlightStr("{","string"),eu,gt.highlightStr("}","string")),m7=gt.sequence(BD,gt.sequence(p7,BD).many()),d7=gt.sequence(op.trim(Nr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(sp,Zh.trim(Nr.P_UTILS.optionalWhitespace()).optional(),up).trim(Nr.P_UTILS.optionalWhitespace()).optional(),gt.sequence(gt.highlightStr(":","control").trim(Nr.P_UTILS.optionalWhitespace()),eu).trim(Nr.P_UTILS.optionalWhitespace()).optional()),OD=gt.sequence(gt.highlightStr("VIEW","control"),Qs,m7,Ks,gt.sequence(Qs.skip(Nr.P_UTILS.optionalWhitespace()),d7,Ks).optional()),kD=gt.sequence(gt.highlightStr("BUTTON","control"),Qs,gt.separateBy(Wh,jh.trim(Nr.P_UTILS.optionalWhitespace())),Ks);var lp=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,PD)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,OD)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,kD)}highlight(e,t,n){if(t==="INPUT_FIELD")return this.highlightInputFieldDeclaration(e,n);if(t==="VIEW_FIELD")return this.highlightViewFieldDeclaration(e,n);if(t==="INLINE_BUTTON")return this.highlightInlineButtonDeclaration(e,n);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,eu)}highlightWithParser(e,t,n){try{return t?new ga(e,qr(n.trim(RD.P_UTILS.optionalWhitespace()).thenEof(),e)):new ga(e,qr(n.thenEof(),e))}catch(i){return i instanceof tl?new ga(e,[],i):(console.error(i),new ga(e,[]))}}};var Ja=class extends Ra{constructor(e){super(),this.base=e,this.inputSignal=new _r(void 0),this.variables=[],this.hidden=!1}async initialRender(e){var t,n;Bt.addClass(e,"mb-view-text"),this.hidden=(n=(t=this.base.getArgument("hidden"))==null?void 0:t.value)!=null?n:!1,this.hidden&&Bt.addClass(e,"mb-view-hidden"),await this.onInitialRender(e),await this.rerender(e,"")}async rerender(e,t){var n;if(!this.hidden){let i=(n=of(t,this.base.plugin.settings.viewFieldDisplayNullAsEmpty))!=null?n:"";Bt.empty(e),await this.onRerender(e,i)}}onMount(e){this.buildVariables(),this.inputSignal.registerListener({callback:t=>void this.rerender(e,t)}),this.metadataSubscription=this.base.plugin.metadataManager.subscribeComputed(this.base.getUuid(),this.inputSignal,this.base.getDeclaration().writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.computeValue(),()=>this.base.unmount()),this.initialRender(e)}onUnmount(){var e;this.inputSignal.unregisterAllListeners(),(e=this.metadataSubscription)==null||e.unsubscribe()}};function yr(){return yr=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},yr.apply(this,arguments)}var Jh={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function it(r){return typeof r=="number"}function Xe(r){return!r||typeof r!="object"||typeof r.constructor!="function"?!1:r.isBigNumber===!0&&typeof r.constructor.prototype=="object"&&r.constructor.prototype.isBigNumber===!0||typeof r.constructor.isDecimal=="function"&&r.constructor.isDecimal(r)===!0}function Mn(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isComplex===!0||!1}function va(r){return r&&typeof r=="object"&&Object.getPrototypeOf(r).isFraction===!0||!1}function ln(r){return r&&r.constructor.prototype.isUnit===!0||!1}function Ar(r){return typeof r=="string"}var It=Array.isArray;function Ge(r){return r&&r.constructor.prototype.isMatrix===!0||!1}function Cr(r){return Array.isArray(r)||Ge(r)}function Qo(r){return r&&r.isDenseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function Ri(r){return r&&r.isSparseMatrix&&r.constructor.prototype.isMatrix===!0||!1}function tu(r){return r&&r.constructor.prototype.isRange===!0||!1}function Ya(r){return r&&r.constructor.prototype.isIndex===!0||!1}function LD(r){return typeof r=="boolean"}function UD(r){return r&&r.constructor.prototype.isResultSet===!0||!1}function cp(r){return r&&r.constructor.prototype.isHelp===!0||!1}function VD(r){return typeof r=="function"}function $D(r){return r instanceof Date}function qD(r){return r instanceof RegExp}function Xa(r){return!!(r&&typeof r=="object"&&r.constructor===Object&&!Mn(r)&&!va(r))}function zD(r){return r===null}function HD(r){return r===void 0}function ti(r){return r&&r.isAccessorNode===!0&&r.constructor.prototype.isNode===!0||!1}function cn(r){return r&&r.isArrayNode===!0&&r.constructor.prototype.isNode===!0||!1}function GD(r){return r&&r.isAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function WD(r){return r&&r.isBlockNode===!0&&r.constructor.prototype.isNode===!0||!1}function jD(r){return r&&r.isConditionalNode===!0&&r.constructor.prototype.isNode===!0||!1}function _t(r){return r&&r.isConstantNode===!0&&r.constructor.prototype.isNode===!0||!1}function ul(r){return _t(r)||hr(r)&&r.args.length===1&&_t(r.args[0])&&"-+~".includes(r.op)}function Xi(r){return r&&r.isFunctionAssignmentNode===!0&&r.constructor.prototype.isNode===!0||!1}function Tn(r){return r&&r.isFunctionNode===!0&&r.constructor.prototype.isNode===!0||!1}function hi(r){return r&&r.isIndexNode===!0&&r.constructor.prototype.isNode===!0||!1}function Dt(r){return r&&r.isNode===!0&&r.constructor.prototype.isNode===!0||!1}function Qa(r){return r&&r.isObjectNode===!0&&r.constructor.prototype.isNode===!0||!1}function hr(r){return r&&r.isOperatorNode===!0&&r.constructor.prototype.isNode===!0||!1}function fn(r){return r&&r.isParenthesisNode===!0&&r.constructor.prototype.isNode===!0||!1}function ZD(r){return r&&r.isRangeNode===!0&&r.constructor.prototype.isNode===!0||!1}function JD(r){return r&&r.isRelationalNode===!0&&r.constructor.prototype.isNode===!0||!1}function ar(r){return r&&r.isSymbolNode===!0&&r.constructor.prototype.isNode===!0||!1}function fp(r){return r&&r.constructor.prototype.isChain===!0||!1}function Mt(r){var e=typeof r;return e==="object"?r===null?"null":Xe(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function et(r){var e=typeof r;if(e==="number"||e==="string"||e==="boolean"||r===null||r===void 0)return r;if(typeof r.clone=="function")return r.clone();if(Array.isArray(r))return r.map(function(t){return et(t)});if(r instanceof Date)return new Date(r.valueOf());if(Xe(r))return r;if(Xa(r))return h7(r,et);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function h7(r,e){var t={};for(var n in r)Ze(r,n)&&(t[n]=e(r[n]));return t}function pp(r,e){for(var t in e)Ze(e,t)&&(r[t]=e[t]);return r}function Li(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!Li(r[n],e[n]))return!1;return!0}else{if(typeof r=="function")return r===e;if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!Li(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}else return r===e}}function YD(r,e,t){var n=!0,i;Object.defineProperty(r,e,{get:function(){return n&&(i=t(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function Ze(r,e){return r&&Object.hasOwnProperty.call(r,e)}function XD(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],a=r[i];a!==void 0&&(t[i]=a)}return t}var QD=["Matrix","Array"],KD=["number","BigNumber","Fraction"];var _e=function(e){if(e)throw new Error(`The global config is readonly.
Please create a mathjs instance if you want to change the default configuration.
Example:
import { create, all } from 'mathjs';
const mathjs = create(all);
mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(Jh)};yr(_e,Jh,{MATRIX_OPTIONS:QD,NUMBER_OPTIONS:KD});var fg=fr(Qh(),1);function ze(r){return typeof r=="boolean"?!0:isFinite(r)?r===Math.round(r):!1}var gi=Math.sign||function(r){return r>0?1:r<0?-1:0},rN=Math.log2||function(e){return Math.log(e)/Math.LN2},nN=Math.log10||function(e){return Math.log(e)/Math.LN10},mp=Math.log1p||function(r){return Math.log(r+1)},iN=Math.cbrt||function(e){if(e===0)return e;var t=e<0,n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},aN=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Kh(r,e,t){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ze(t))throw new Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!ze(r))throw new Error("Value must be an integer");r<0&&(r=r+2**t),a="i".concat(t)}var o="";return r<0&&(r=-r,o="-"),"".concat(o).concat(i).concat(r.toString(e)).concat(a)}function Ui(r,e){if(typeof e=="function")return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var{notation:t,precision:n,wordSize:i}=eg(e);switch(t){case"fixed":return tg(r,n);case"exponential":return oN(r,n);case"engineering":return g7(r,n);case"bin":return Kh(r,2,i);case"oct":return Kh(r,8,i);case"hex":return Kh(r,16,i);case"auto":return v7(r,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function eg(r){var e="auto",t,n;if(r!==void 0)if(it(r))t=r;else if(Xe(r))t=r.toNumber();else if(Xa(r))r.precision!==void 0&&(t=eN(r.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),r.wordSize!==void 0&&(n=eN(r.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),r.notation&&(e=r.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:n}}function dp(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(l){return i-=l.length,""}).replace(/0*$/,"").split("").map(function(l){return parseInt(l)});return o.length===0&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function g7(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=dp(r),n=hp(t,e),i=n.exponent,a=n.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(it(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var l=Math.abs(i-o)-(a.length-1),u=0;u<l;u++)a.push(0);for(var s=Math.abs(i-o),c=1;s>0;)c++,s--;var f=a.slice(c).join(""),p=it(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,c).join("")+p+"e"+(i>=0?"+":"")+o.toString();return n.sign+m}function tg(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=dp(r),n=typeof e=="number"?hp(t,t.exponent+1+e):t,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(ru(o-i.length))),a<0&&(i=ru(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function oN(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=dp(r),n=e?hp(t,e):t,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(ru(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function v7(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=tN(t==null?void 0:t.lowerExp,-3),i=tN(t==null?void 0:t.upperExp,5),a=dp(r),o=e?hp(a,e):a;if(o.exponent<n||o.exponent>=i)return oN(r,e);var l=o.coefficients,u=o.exponent;l.length<e&&(l=l.concat(ru(e-l.length))),l=l.concat(ru(u-l.length+1+(l.length<e?e-l.length:0))),l=ru(-u).concat(l);var s=u>0?u:0;return s<l.length-1&&l.splice(s+1,0,"."),o.sign+l.join("")}function hp(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),t.exponent++,a++),a--,n[a]++}}return t}function ru(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}function sN(r){return r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var y7=Number.EPSILON||2220446049250313e-31;function Pr(r,e,t){if(t==null)return r===e;if(r===e)return!0;if(isNaN(r)||isNaN(e))return!1;if(isFinite(r)&&isFinite(e)){var n=Math.abs(r-e);return n<=y7?!0:n<=Math.max(Math.abs(r),Math.abs(e))*t}return!1}var uN=Math.acosh||function(r){return Math.log(Math.sqrt(r*r-1)+r)},lN=Math.asinh||function(r){return Math.log(Math.sqrt(r*r+1)+r)},cN=Math.atanh||function(r){return Math.log((1+r)/(1-r))/2},gp=Math.cosh||function(r){return(Math.exp(r)+Math.exp(-r))/2},fN=Math.sinh||function(r){return(Math.exp(r)-Math.exp(-r))/2},vp=Math.tanh||function(r){var e=Math.exp(2*r);return(e-1)/(e+1)};function pN(r,e){var t=r>0?!0:r<0?!1:1/r===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return t^n?-r:r}function eN(r,e){if(it(r))return r;if(Xe(r))return r.toNumber();e()}function tN(r,e){return it(r)?r:Xe(r)?r.toNumber():e}function rg(r,e,t){var n=r.constructor,i=new n(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ze(t))throw new Error("size must be an integer");if(r.greaterThan(i.pow(t-1).sub(1))||r.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!r.isInteger())throw new Error("Value must be an integer");r.lessThan(0)&&(r=r.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(a);case 8:return"".concat(r.toOctal()).concat(a);case 16:return"".concat(r.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function hN(r,e){if(typeof e=="function")return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=eg(e);switch(t){case"fixed":return x7(r,n);case"exponential":return mN(r,n);case"engineering":return b7(r,n);case"bin":return rg(r,2,i);case"oct":return rg(r,8,i);case"hex":return rg(r,16,i);case"auto":{var a=dN(e==null?void 0:e.lowerExp,-3),o=dN(e==null?void 0:e.upperExp,5);if(r.isZero())return"0";var l,u=r.toSignificantDigits(n),s=u.e;return s>=a&&s<o?l=u.toFixed():l=mN(r,n),l.replace(/((\.\d*?)(0+))($|e)/,function(){var c=arguments[2],f=arguments[4];return c!=="."?c+f:f})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function b7(r,e){var t=r.e,n=t%3===0?t:t<0?t-3-t%3:t-t%3,i=r.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.indexOf("e")!==-1){var o=r.constructor;a=new o(a).toFixed()}return a+"e"+(t>=0?"+":"")+n.toString()}function mN(r,e){return e!==void 0?r.toExponential(e-1):r.toExponential()}function x7(r,e){return r.toFixed(e)}function dN(r,e){return it(r)?r:Xe(r)?r.toNumber():e}function vN(r,e){var t=r.length-e.length,n=r.length;return r.substring(t,n)===e}function at(r,e){var t=w7(r,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function w7(r,e){if(typeof r=="number")return Ui(r,e);if(Xe(r))return hN(r,e);if(_7(r))return!e||e.fraction!=="decimal"?r.s*r.n+"/"+r.d:r.toString();if(Array.isArray(r))return yN(r,e);if(Ar(r))return Ko(r);if(typeof r=="function")return r.syntax?String(r.syntax):"function";if(r&&typeof r=="object"){if(typeof r.format=="function")return r.format(e);if(r&&r.toString(e)!=={}.toString())return r.toString(e);var t=Object.keys(r).map(n=>Ko(n)+": "+at(r[n],e));return"{"+t.join(", ")+"}"}return String(r)}function Ko(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in gN?gN[i]:i,n++}return'"'+t+'"'}var gN={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Yr(r){var e=String(r);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function yN(r,e){if(Array.isArray(r)){for(var t="[",n=r.length,i=0;i<n;i++)i!==0&&(t+=", "),t+=yN(r[i],e);return t+="]",t}else return at(r,e)}function _7(r){return r&&typeof r=="object"&&typeof r.s=="number"&&typeof r.n=="number"&&typeof r.d=="number"||!1}function yp(r,e){if(!Ar(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Mt(r)+", index: 0)");if(!Ar(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Mt(e)+", index: 1)");return r===e?0:r>e?1:-1}function st(r,e,t){if(!(this instanceof st))throw new SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}st.prototype=new RangeError;st.prototype.constructor=RangeError;st.prototype.name="DimensionError";st.prototype.isDimensionError=!0;function pn(r,e,t){if(!(this instanceof pn))throw new SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}pn.prototype=new RangeError;pn.prototype.constructor=RangeError;pn.prototype.name="IndexError";pn.prototype.isIndexError=!0;function nt(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function bN(r,e,t){var n,i=r.length;if(i!==e[t])throw new st(i,e[t]);if(t<e.length-1){var a=t+1;for(n=0;n<i;n++){var o=r[n];if(!Array.isArray(o))throw new st(e.length-1,e.length,"<");bN(r[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(r[n]))throw new st(e.length+1,e.length,">")}function ig(r,e){var t=e.length===0;if(t){if(Array.isArray(r))throw new st(r.length,0)}else bN(r,e,0)}function ll(r,e){var t=r.isMatrix?r._size:nt(r),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new st(i,t[a])})}function Jt(r,e){if(r!==void 0){if(!it(r)||!ze(r))throw new TypeError("Index must be an integer (value: "+r+")");if(r<0||typeof e=="number"&&r>=e)throw new pn(r,e)}}function es(r){for(var e=0;e<r._dimensions.length;++e){var t=r._dimensions[e];if(t._data&&It(t._data)){if(t._size[0]===0)return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(Ar(t)&&t.length===0)return!0}return!1}function Vi(r,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!it(i)||!ze(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+at(e)+")")}),(it(r)||Xe(r))&&(r=[r]);var n=t!==void 0?t:0;return ng(r,e,0,n),r}function ng(r,e,t,n){var i,a,o=r.length,l=e[t],u=Math.min(o,l);if(r.length=l,t<e.length-1){var s=t+1;for(i=0;i<u;i++)a=r[i],Array.isArray(a)||(a=[a],r[i]=a),ng(a,e,s,n);for(i=u;i<l;i++)a=[],r[i]=a,ng(a,e,s,n)}else{for(i=0;i<u;i++)for(;Array.isArray(r[i]);)r[i]=r[i][0];for(i=u;i<l;i++)r[i]=n}}function cl(r,e){var t=ht(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new st(0,n,"!=");e=fl(e,n);var i=xN(e);if(n!==i)throw new st(i,n,"!=");try{return A7(t,e)}catch(a){throw a instanceof st?new st(i,n,"!="):a}}function fl(r,e){var t=xN(r),n=r.slice(),i=-1,a=r.indexOf(i),o=r.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var l=a>=0,u=e%t===0;if(l)if(u)n[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function xN(r){return r.reduce((e,t)=>e*t,1)}function A7(r,e){for(var t=r,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=t.length/a,l=0;l<o;l++)n.push(t.slice(l*a,(l+1)*a));t=n}return t}function nu(r,e){for(var t=e||nt(r);Array.isArray(r)&&r.length===1;)r=r[0],t.shift();for(var n=t.length;t[n-1]===1;)n--;return n<t.length&&(r=wN(r,n,0),t.length=n),r}function wN(r,e,t){var n,i;if(t<e){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=wN(r[n],e,a)}else for(;Array.isArray(r);)r=r[0];return r}function bp(r,e,t,n){var i=n||nt(r);if(t)for(var a=0;a<t;a++)r=[r],i.unshift(1);for(r=_N(r,e,0);i.length<e;)i.push(1);return r}function _N(r,e,t){var n,i;if(Array.isArray(r)){var a=t+1;for(n=0,i=r.length;n<i;n++)r[n]=_N(r[n],e,a)}else for(var o=t;o<e;o++)r=[r];return r}function ht(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function t(n){Array.isArray(n)?n.forEach(t):e.push(n)}),e}function Rn(r,e){return Array.prototype.map.call(r,e)}function Ka(r,e){Array.prototype.forEach.call(r,e)}function xp(r,e){if(nt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,e)}function iu(r,e){if(nt(r).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,t=>e.test(t))}function ag(r,e){return Array.prototype.join.call(r,e)}function ya(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;var e=[],t=0;e[0]={value:r[0],identifier:0};for(var n=1;n<r.length;n++)r[n]===r[n-1]?t++:t=0,e.push({value:r[n],identifier:t});return e}function au(r){if(!Array.isArray(r))throw new TypeError("Array input expected");if(r.length===0)return r;for(var e=[],t=0;t<r.length;t++)e.push(r[t].value);return e}function eo(r,e){for(var t,n=0,i=0;i<r.length;i++){var a=r[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var l=o?eo(a,e):e(a);if(t===void 0)t=l;else if(t!==l)return"mixed"}return t}function AN(r,e,t,n){if(n<t){if(r.length!==e.length)throw new st(r.length,e.length);for(var i=[],a=0;a<r.length;a++)i[a]=AN(r[a],e[a],t,n+1);return i}else return r.concat(e)}function og(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(r.length===1)return r[0];if(r.length>1)return r.slice(1).reduce(function(t,n){return AN(t,n,e,0)},r[0]);throw new Error("Wrong number of arguments in function concat")}function S7(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(p=>p.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var l=e[o],u=n[o],s=0;s<u;s++){var c=i-u+s;l[s]>a[c]&&(a[c]=l[s])}for(var f=0;f<e.length;f++)pl(e[f],a);return a}function pl(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var a=t-n+i;if(r[i]<e[a]&&r[i]>1||r[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[a]))}}function sg(r,e){var t=nt(r);if(Li(t,e))return r;pl(t,e);var n=S7(t,e),i=n.length,a=[...Array(i-t.length).fill(1),...t],o=D7(r);t.length<i&&(o=cl(o,a),t=nt(o));for(var l=0;l<i;l++)t[l]<n[l]&&(o=E7(o,n[l],l),t=nt(o));return o}function E7(r,e,t){return og(...Array(e).fill(r),t)}function D7(r){return yr([],r)}function N(r,e,t,n){function i(a){var o=XD(a,e.map(M7));return N7(r,e,a),t(o)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function N7(r,e,t){var n=e.filter(a=>!C7(a)).every(a=>t[a]!==void 0);if(!n){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function C7(r){return r&&r[0]==="?"}function M7(r){return r&&r[0]==="?"?r.slice(1):r}function br(r,e){if(NN(r)&&EN(r,e))return r[e];throw typeof r[e]=="function"&&wp(r,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Qi(r,e,t){if(NN(r)&&EN(r,e))return r[e]=t,t;throw new Error('No access to property "'+e+'"')}function SN(r,e){return e in r}function EN(r,e){return!r||typeof r!="object"?!1:Ze(T7,e)?!0:!(e in Object.prototype||e in Function.prototype)}function DN(r,e){if(!wp(r,e))throw new Error('No access to method "'+e+'"');return r[e]}function wp(r,e){return r==null||typeof r[e]!="function"||Ze(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r)?!1:Ze(F7,e)?!0:!(e in Object.prototype||e in Function.prototype)}function NN(r){return typeof r=="object"&&r&&r.constructor===Object}var T7={length:!0,name:!0},F7={toString:!0,valueOf:!0,toLocaleString:!0};var ts=class{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject).values()}get(e){return br(this.wrappedObject,e)}set(e,t){return Qi(this.wrappedObject,e,t),this}has(e){return SN(this.wrappedObject,e)}entries(){return CN(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},ou=class{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return CN(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function CN(r,e){return{next:()=>{var t=r.next();return t.done?t:{value:e(t.value),done:!1}}}}function to(){return new Map}function ba(r){if(!r)return to();if(ug(r))return r;if(Xa(r))return new ts(r);throw new Error("createMap can create maps from objects or Maps")}function MN(r){if(r instanceof ts)return r.wrappedObject;var e={};for(var t of r.keys()){var n=r.get(t);Qi(e,t,n)}return e}function ug(r){return r?r instanceof Map||r instanceof ts||typeof r.set=="function"&&typeof r.get=="function"&&typeof r.keys=="function"&&typeof r.has=="function":!1}var TN=function(){return TN=fg.default.create,fg.default},I7=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],pg=N("typed",I7,function(e){var{BigNumber:t,Complex:n,DenseMatrix:i,Fraction:a}=e,o=TN();return o.clear(),o.addTypes([{name:"number",test:it},{name:"Complex",test:Mn},{name:"BigNumber",test:Xe},{name:"Fraction",test:va},{name:"Unit",test:ln},{name:"identifier",test:l=>Ar&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(l)},{name:"string",test:Ar},{name:"Chain",test:fp},{name:"Array",test:It},{name:"Matrix",test:Ge},{name:"DenseMatrix",test:Qo},{name:"SparseMatrix",test:Ri},{name:"Range",test:tu},{name:"Index",test:Ya},{name:"boolean",test:LD},{name:"ResultSet",test:UD},{name:"Help",test:cp},{name:"function",test:VD},{name:"Date",test:$D},{name:"RegExp",test:qD},{name:"null",test:zD},{name:"undefined",test:HD},{name:"AccessorNode",test:ti},{name:"ArrayNode",test:cn},{name:"AssignmentNode",test:GD},{name:"BlockNode",test:WD},{name:"ConditionalNode",test:jD},{name:"ConstantNode",test:_t},{name:"FunctionNode",test:Tn},{name:"FunctionAssignmentNode",test:Xi},{name:"IndexNode",test:hi},{name:"Node",test:Dt},{name:"ObjectNode",test:Qa},{name:"OperatorNode",test:hr},{name:"ParenthesisNode",test:fn},{name:"RangeNode",test:ZD},{name:"RelationalNode",test:JD},{name:"SymbolNode",test:ar},{name:"Map",test:ug},{name:"Object",test:Xa}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(u){if(t||lg(u),sN(u)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+u+"). Use function bignumber(x) to convert to BigNumber.");return new t(u)}},{from:"number",to:"Complex",convert:function(u){return n||_p(u),new n(u,0)}},{from:"BigNumber",to:"Complex",convert:function(u){return n||_p(u),new n(u.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(u){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(u){return n||_p(u),new n(u.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(u){a||cg(u);var s=new a(u);if(s.valueOf()!==u)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+u+"). Use function fraction(x) to convert to Fraction.");return s}},{from:"string",to:"number",convert:function(u){var s=Number(u);if(isNaN(s))throw new Error('Cannot convert "'+u+'" to a number');return s}},{from:"string",to:"BigNumber",convert:function(u){t||lg(u);try{return new t(u)}catch(s){throw new Error('Cannot convert "'+u+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(u){a||cg(u);try{return new a(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(u){n||_p(u);try{return new n(u)}catch(s){throw new Error('Cannot convert "'+u+'" to Complex')}}},{from:"boolean",to:"number",convert:function(u){return+u}},{from:"boolean",to:"BigNumber",convert:function(u){return t||lg(u),new t(+u)}},{from:"boolean",to:"Fraction",convert:function(u){return a||cg(u),new a(+u)}},{from:"boolean",to:"string",convert:function(u){return String(u)}},{from:"Array",to:"Matrix",convert:function(u){return i||B7(),new i(u)}},{from:"Matrix",to:"Array",convert:function(u){return u.valueOf()}}]),o.onMismatch=(l,u,s)=>{var c=o.createError(l,u,s);if(["wrongType","mismatch"].includes(c.data.category)&&u.length===1&&Cr(u[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(l,u,s)=>{var c=o.createError(l,u,s);if(["wrongType","mismatch"].includes(c.data.category)&&u.length===1&&Cr(u[0])&&s.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(l,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(l,")'."));throw f.data=c.data,f}throw c},o});function lg(r){throw new Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function _p(r){throw new Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function B7(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function cg(r){throw new Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}var P7="ResultSet",O7=[],mg=N(P7,O7,()=>{function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return r.prototype.type="ResultSet",r.prototype.isResultSet=!0,r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},r.fromJSON=function(e){return new r(e.entries)},r},{isClass:!0});var su=9e15,ao=1e9,dg="0123456789abcdef",Sp="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ep="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",hg={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-su,maxE:su,crypto:!1},PN,xa,Nt=!0,Np="[DecimalError] ",io=Np+"Invalid argument: ",ON=Np+"Precision limit exceeded",kN=Np+"crypto unavailable",RN="[object Decimal]",yn=Math.floor,Xr=Math.pow,k7=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,R7=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,L7=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,LN=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qi=1e7,vt=7,U7=9007199254740991,V7=Sp.length-1,gg=Ep.length-1,Be={toStringTag:RN};Be.absoluteValue=Be.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),lt(r)};Be.ceil=function(){return lt(new this.constructor(this),this.e+1,2)};Be.clampedTo=Be.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(io+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};Be.comparedTo=Be.cmp=function(r){var e,t,n,i,a=this,o=a.d,l=(r=new a.constructor(r)).d,u=a.s,s=r.s;if(!o||!l)return!u||!s?NaN:u!==s?u:o===l?0:!o^u<0?1:-1;if(!o[0]||!l[0])return o[0]?u:l[0]?-s:0;if(u!==s)return u;if(a.e!==r.e)return a.e>r.e^u<0?1:-1;for(n=o.length,i=l.length,e=0,t=n<i?n:i;e<t;++e)if(o[e]!==l[e])return o[e]>l[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};Be.cosine=Be.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+vt,n.rounding=1,t=$7(n,zN(n,t)),n.precision=r,n.rounding=e,lt(xa==2||xa==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Be.cubeRoot=Be.cbrt=function(){var r,e,t,n,i,a,o,l,u,s,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Nt=!1,a=c.s*Xr(c.s*c,1/3),!a||Math.abs(a)==1/0?(t=mn(c.d),r=c.e,(a=(r-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=Xr(t,1/3),r=yn((r+1)/3)-(r%3==(r<0?-1:2)),a==1/0?t="5e"+r:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new f(t),n.s=c.s):n=new f(a.toString()),o=(r=f.precision)+3;;)if(l=n,u=l.times(l).times(l),s=u.plus(c),n=xr(s.plus(c).times(l),s.plus(u),o+2,1),mn(l.d).slice(0,o)===(t=mn(n.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(lt(l,r+1,0),l.times(l).times(l).eq(c))){n=l;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(lt(n,r+1,1),e=!n.times(n).times(n).eq(c));break}return Nt=!0,lt(n,r,f.rounding,e)};Be.decimalPlaces=Be.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-yn(this.e/vt))*vt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Be.dividedBy=Be.div=function(r){return xr(this,new this.constructor(r))};Be.dividedToIntegerBy=Be.divToInt=function(r){var e=this,t=e.constructor;return lt(xr(e,new t(r),0,1,1),t.precision,t.rounding)};Be.equals=Be.eq=function(r){return this.cmp(r)===0};Be.floor=function(){return lt(new this.constructor(this),this.e+1,3)};Be.greaterThan=Be.gt=function(r){return this.cmp(r)>0};Be.greaterThanOrEqualTo=Be.gte=function(r){var e=this.cmp(r);return e==1||e===0};Be.hyperbolicCosine=Be.cosh=function(){var r,e,t,n,i,a=this,o=a.constructor,l=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return l;t=o.precision,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(r=Math.ceil(i/3),e=(1/Mp(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),a=uu(o,1,a.times(e),new o(1),!0);for(var u,s=r,c=new o(8);s--;)u=a.times(a),a=l.minus(u.times(c.minus(u.times(c))));return lt(a,o.precision=t,o.rounding=n,!0)};Be.hyperbolicSine=Be.sinh=function(){var r,e,t,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,t=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=uu(a,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/Mp(5,r)),i=uu(a,2,i,i,!0);for(var o,l=new a(5),u=new a(16),s=new a(20);r--;)o=i.times(i),i=i.times(l.plus(o.times(u.times(o).plus(s))))}return a.precision=e,a.rounding=t,lt(i,e,t,!0)};Be.hyperbolicTangent=Be.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,xr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Be.inverseCosine=Be.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,a=t.rounding;return n!==-1?n===0?e.isNeg()?$i(t,i,a):new t(0):new t(NaN):e.isZero()?$i(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=$i(t,i+4,a).times(.5),t.precision=i,t.rounding=a,r.minus(e))};Be.inverseHyperbolicCosine=Be.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,Nt=!1,t=t.times(t).minus(1).sqrt().plus(t),Nt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Be.inverseHyperbolicSine=Be.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,Nt=!1,t=t.times(t).plus(1).sqrt().plus(t),Nt=!0,n.precision=r,n.rounding=e,t.ln())};Be.inverseHyperbolicTangent=Be.atanh=function(){var r,e,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=a.precision,e=a.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?lt(new a(i),r,e,!0):(a.precision=t=n-i.e,i=xr(i.plus(1),new a(1).minus(i),t+r,1),a.precision=r+4,a.rounding=1,i=i.ln(),a.precision=r,a.rounding=e,i.times(.5))):new a(NaN)};Be.inverseSine=Be.asin=function(){var r,e,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,n=a.rounding,e!==-1?e===0?(r=$i(a,t+4,n).times(.5),r.s=i.s,r):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=n,i.times(2)))};Be.inverseTangent=Be.atan=function(){var r,e,t,n,i,a,o,l,u,s=this,c=s.constructor,f=c.precision,p=c.rounding;if(s.isFinite()){if(s.isZero())return new c(s);if(s.abs().eq(1)&&f+4<=gg)return o=$i(c,f+4,p).times(.25),o.s=s.s,o}else{if(!s.s)return new c(NaN);if(f+4<=gg)return o=$i(c,f+4,p).times(.5),o.s=s.s,o}for(c.precision=l=f+10,c.rounding=1,t=Math.min(28,l/vt+2|0),r=t;r;--r)s=s.div(s.times(s).plus(1).sqrt().plus(1));for(Nt=!1,e=Math.ceil(l/vt),n=1,u=s.times(s),o=new c(s),i=s;r!==-1;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(r=e;o.d[r]===a.d[r]&&r--;);return t&&(o=o.times(2<<t-1)),Nt=!0,lt(o,c.precision=f,c.rounding=p,!0)};Be.isFinite=function(){return!!this.d};Be.isInteger=Be.isInt=function(){return!!this.d&&yn(this.e/vt)>this.d.length-2};Be.isNaN=function(){return!this.s};Be.isNegative=Be.isNeg=function(){return this.s<0};Be.isPositive=Be.isPos=function(){return this.s>0};Be.isZero=function(){return!!this.d&&this.d[0]===0};Be.lessThan=Be.lt=function(r){return this.cmp(r)<0};Be.lessThanOrEqualTo=Be.lte=function(r){return this.cmp(r)<1};Be.logarithm=Be.log=function(r){var e,t,n,i,a,o,l,u,s=this,c=s.constructor,f=c.precision,p=c.rounding,m=5;if(r==null)r=new c(10),e=!0;else{if(r=new c(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new c(NaN);e=r.eq(10)}if(t=s.d,s.s<0||!t||!t[0]||s.eq(1))return new c(t&&!t[0]?-1/0:s.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)a=!0;else{for(i=t[0];i%10===0;)i/=10;a=i!==1}if(Nt=!1,l=f+m,o=no(s,l),n=e?Dp(c,l+10):no(r,l),u=xr(o,n,l,1),ml(u.d,i=f,p))do if(l+=10,o=no(s,l),n=e?Dp(c,l+10):no(r,l),u=xr(o,n,l,1),!a){+mn(u.d).slice(i+1,i+15)+1==1e14&&(u=lt(u,f+1,0));break}while(ml(u.d,i+=10,p));return Nt=!0,lt(u,f,p)};Be.minus=Be.sub=function(r){var e,t,n,i,a,o,l,u,s,c,f,p,m=this,h=m.constructor;if(r=new h(r),!m.d||!r.d)return!m.s||!r.s?r=new h(NaN):m.d?r.s=-r.s:r=new h(r.d||m.s!==r.s?m:NaN),r;if(m.s!=r.s)return r.s=-r.s,m.plus(r);if(s=m.d,p=r.d,l=h.precision,u=h.rounding,!s[0]||!p[0]){if(p[0])r.s=-r.s;else if(s[0])r=new h(m);else return new h(u===3?-0:0);return Nt?lt(r,l,u):r}if(t=yn(r.e/vt),c=yn(m.e/vt),s=s.slice(),a=c-t,a){for(f=a<0,f?(e=s,a=-a,o=p.length):(e=p,t=c,o=s.length),n=Math.max(Math.ceil(l/vt),o)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=s.length,o=p.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(s[n]!=p[n]){f=s[n]<p[n];break}a=0}for(f&&(e=s,s=p,p=e,r.s=-r.s),o=s.length,n=p.length-o;n>0;--n)s[o++]=0;for(n=p.length;n>a;){if(s[--n]<p[n]){for(i=n;i&&s[--i]===0;)s[i]=qi-1;--s[i],s[n]+=qi}s[n]-=p[n]}for(;s[--o]===0;)s.pop();for(;s[0]===0;s.shift())--t;return s[0]?(r.d=s,r.e=Cp(s,t),Nt?lt(r,l,u):r):new h(u===3?-0:0)};Be.modulo=Be.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?lt(new n(t),n.precision,n.rounding):(Nt=!1,n.modulo==9?(e=xr(t,r.abs(),0,3,1),e.s*=r.s):e=xr(t,r,0,n.modulo,1),e=e.times(r),Nt=!0,t.minus(e))};Be.naturalExponential=Be.exp=function(){return vg(this)};Be.naturalLogarithm=Be.ln=function(){return no(this)};Be.negated=Be.neg=function(){var r=new this.constructor(this);return r.s=-r.s,lt(r)};Be.plus=Be.add=function(r){var e,t,n,i,a,o,l,u,s,c,f=this,p=f.constructor;if(r=new p(r),!f.d||!r.d)return!f.s||!r.s?r=new p(NaN):f.d||(r=new p(r.d||f.s===r.s?f:NaN)),r;if(f.s!=r.s)return r.s=-r.s,f.minus(r);if(s=f.d,c=r.d,l=p.precision,u=p.rounding,!s[0]||!c[0])return c[0]||(r=new p(f)),Nt?lt(r,l,u):r;if(a=yn(f.e/vt),n=yn(r.e/vt),s=s.slice(),i=a-n,i){for(i<0?(t=s,i=-i,o=c.length):(t=c,n=a,o=s.length),a=Math.ceil(l/vt),o=a>o?a+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=s.length,i=c.length,o-i<0&&(i=o,t=c,c=s,s=t),e=0;i;)e=(s[--i]=s[i]+c[i]+e)/qi|0,s[i]%=qi;for(e&&(s.unshift(e),++n),o=s.length;s[--o]==0;)s.pop();return r.d=s,r.e=Cp(s,n),Nt?lt(r,l,u):r};Be.precision=Be.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(io+r);return t.d?(e=UN(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Be.round=function(){var r=this,e=r.constructor;return lt(new e(r),r.e+1,e.rounding)};Be.sine=Be.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+vt,n.rounding=1,t=z7(n,zN(n,t)),n.precision=r,n.rounding=e,lt(xa>2?t.neg():t,r,e,!0)):new n(NaN)};Be.squareRoot=Be.sqrt=function(){var r,e,t,n,i,a,o=this,l=o.d,u=o.e,s=o.s,c=o.constructor;if(s!==1||!l||!l[0])return new c(!s||s<0&&(!l||l[0])?NaN:l?o:1/0);for(Nt=!1,s=Math.sqrt(+o),s==0||s==1/0?(e=mn(l),(e.length+u)%2==0&&(e+="0"),s=Math.sqrt(e),u=yn((u+1)/2)-(u<0||u%2),s==1/0?e="5e"+u:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new c(e)):n=new c(s.toString()),t=(u=c.precision)+3;;)if(a=n,n=a.plus(xr(o,a,t+2,1)).times(.5),mn(a.d).slice(0,t)===(e=mn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(lt(a,u+1,0),a.times(a).eq(o))){n=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(lt(n,u+1,1),r=!n.times(n).eq(o));break}return Nt=!0,lt(n,u,c.rounding,r)};Be.tangent=Be.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=xr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,lt(xa==2||xa==4?t.neg():t,r,e,!0)):new n(NaN)};Be.times=Be.mul=function(r){var e,t,n,i,a,o,l,u,s,c=this,f=c.constructor,p=c.d,m=(r=new f(r)).d;if(r.s*=c.s,!p||!p[0]||!m||!m[0])return new f(!r.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?r.s/0:r.s*0);for(t=yn(c.e/vt)+yn(r.e/vt),u=p.length,s=m.length,u<s&&(a=p,p=m,m=a,o=u,u=s,s=o),a=[],o=u+s,n=o;n--;)a.push(0);for(n=s;--n>=0;){for(e=0,i=u+n;i>n;)l=a[i]+m[n]*p[i-n-1]+e,a[i--]=l%qi|0,e=l/qi|0;a[i]=(a[i]+e)%qi|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),r.d=a,r.e=Cp(a,t),Nt?lt(r,f.precision,f.rounding):r};Be.toBinary=function(r,e){return bg(this,2,r,e)};Be.toDecimalPlaces=Be.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Ln(r,0,ao),e===void 0?e=n.rounding:Ln(e,0,8),lt(t,r+t.e+1,e))};Be.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ki(n,!0):(Ln(r,0,ao),e===void 0?e=i.rounding:Ln(e,0,8),n=lt(new i(n),r+1,e),t=Ki(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Be.toFixed=function(r,e){var t,n,i=this,a=i.constructor;return r===void 0?t=Ki(i):(Ln(r,0,ao),e===void 0?e=a.rounding:Ln(e,0,8),n=lt(new a(i),r+i.e+1,e),t=Ki(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Be.toFraction=function(r){var e,t,n,i,a,o,l,u,s,c,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(s=t=new d(1),n=u=new d(0),e=new d(n),a=e.e=UN(h)-m.e-1,o=a%vt,e.d[0]=Xr(10,o<0?vt+o:o),r==null)r=a>0?e:s;else{if(l=new d(r),!l.isInt()||l.lt(s))throw Error(io+l);r=l.gt(e)?a>0?e:s:l}for(Nt=!1,l=new d(mn(h)),c=d.precision,d.precision=a=h.length*vt*2;f=xr(l,e,0,1,1),i=t.plus(f.times(n)),i.cmp(r)!=1;)t=n,n=i,i=s,s=u.plus(f.times(i)),u=i,i=e,e=l.minus(f.times(i)),l=i;return i=xr(r.minus(t),n,0,1,1),u=u.plus(i.times(s)),t=t.plus(i.times(n)),u.s=s.s=m.s,p=xr(s,n,a,1).minus(m).abs().cmp(xr(u,t,a,1).minus(m).abs())<1?[s,n]:[u,t],d.precision=c,Nt=!0,p};Be.toHexadecimal=Be.toHex=function(r,e){return bg(this,16,r,e)};Be.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Ln(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(Nt=!1,t=xr(t,r,0,e,1).times(r),Nt=!0,lt(t)):(r.s=t.s,t=r),t};Be.toNumber=function(){return+this};Be.toOctal=function(r,e){return bg(this,8,r,e)};Be.toPower=Be.pow=function(r){var e,t,n,i,a,o,l=this,u=l.constructor,s=+(r=new u(r));if(!l.d||!r.d||!l.d[0]||!r.d[0])return new u(Xr(+l,s));if(l=new u(l),l.eq(1))return l;if(n=u.precision,a=u.rounding,r.eq(1))return lt(l,n,a);if(e=yn(r.e/vt),e>=r.d.length-1&&(t=s<0?-s:s)<=U7)return i=VN(u,l,t,n),r.s<0?new u(1).div(i):lt(i,n,a);if(o=l.s,o<0){if(e<r.d.length-1)return new u(NaN);if(r.d[e]&1||(o=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=o,l}return t=Xr(+l,s),e=t==0||!isFinite(t)?yn(s*(Math.log("0."+mn(l.d))/Math.LN10+l.e+1)):new u(t+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?o/0:0):(Nt=!1,u.rounding=l.s=1,t=Math.min(12,(e+"").length),i=vg(r.times(no(l,n+t)),n),i.d&&(i=lt(i,n+5,1),ml(i.d,n,a)&&(e=n+10,i=lt(vg(r.times(no(l,e+t)),e),e+5,1),+mn(i.d).slice(n+1,n+15)+1==1e14&&(i=lt(i,n+1,0)))),i.s=o,Nt=!0,u.rounding=a,lt(i,n,a))};Be.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ki(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ln(r,1,ao),e===void 0?e=i.rounding:Ln(e,0,8),n=lt(new i(n),r,e),t=Ki(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Be.toSignificantDigits=Be.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Ln(r,1,ao),e===void 0?e=n.rounding:Ln(e,0,8)),lt(new n(t),r,e)};Be.toString=function(){var r=this,e=r.constructor,t=Ki(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Be.truncated=Be.trunc=function(){return lt(new this.constructor(this),this.e+1,1)};Be.valueOf=Be.toJSON=function(){var r=this,e=r.constructor,t=Ki(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function mn(r){var e,t,n,i=r.length-1,a="",o=r[0];if(i>0){for(a+=o,e=1;e<i;e++)n=r[e]+"",t=vt-n.length,t&&(a+=ro(t)),a+=n;o=r[e],n=o+"",t=vt-n.length,t&&(a+=ro(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Ln(r,e,t){if(r!==~~r||r<e||r>t)throw Error(io+r)}function ml(r,e,t,n){var i,a,o,l;for(a=r[0];a>=10;a/=10)--e;return--e<0?(e+=vt,i=0):(i=Math.ceil((e+1)/vt),e%=vt),a=Xr(10,vt-e),l=r[i]%a|0,n==null?e<3?(e==0?l=l/100|0:e==1&&(l=l/10|0),o=t<4&&l==99999||t>3&&l==49999||l==5e4||l==0):o=(t<4&&l+1==a||t>3&&l+1==a/2)&&(r[i+1]/a/100|0)==Xr(10,e-2)-1||(l==a/2||l==0)&&(r[i+1]/a/100|0)==0:e<4?(e==0?l=l/1e3|0:e==1?l=l/100|0:e==2&&(l=l/10|0),o=(n||t<4)&&l==9999||!n&&t>3&&l==4999):o=((n||t<4)&&l+1==a||!n&&t>3&&l+1==a/2)&&(r[i+1]/a/1e3|0)==Xr(10,e-3)-1,o}function Ap(r,e,t){for(var n,i=[0],a,o=0,l=r.length;o<l;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=dg.indexOf(r.charAt(o++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function $7(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/Mp(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=uu(r,1,e.times(i),new r(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return r.precision-=t,e}var xr=function(){function r(n,i,a){var o,l=0,u=n.length;for(n=n.slice();u--;)o=n[u]*i+l,n[u]=o%a|0,l=o/a|0;return l&&n.unshift(l),n}function e(n,i,a,o){var l,u;if(a!=o)u=a>o?1:-1;else for(l=u=0;l<a;l++)if(n[l]!=i[l]){u=n[l]>i[l]?1:-1;break}return u}function t(n,i,a,o){for(var l=0;a--;)n[a]-=l,l=n[a]<i[a]?1:0,n[a]=l*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,l,u){var s,c,f,p,m,h,d,g,v,w,y,x,_,b,E,D,A,S,M,F,P=n.constructor,R=n.s==i.s?1:-1,O=n.d,I=i.d;if(!O||!O[0]||!I||!I[0])return new P(!n.s||!i.s||(O?I&&O[0]==I[0]:!I)?NaN:O&&O[0]==0||!I?R*0:R/0);for(u?(m=1,c=n.e-i.e):(u=qi,m=vt,c=yn(n.e/m)-yn(i.e/m)),M=I.length,A=O.length,v=new P(R),w=v.d=[],f=0;I[f]==(O[f]||0);f++);if(I[f]>(O[f]||0)&&c--,a==null?(b=a=P.precision,o=P.rounding):l?b=a+(n.e-i.e)+1:b=a,b<0)w.push(1),h=!0;else{if(b=b/m+2|0,f=0,M==1){for(p=0,I=I[0],b++;(f<A||p)&&b--;f++)E=p*u+(O[f]||0),w[f]=E/I|0,p=E%I|0;h=p||f<A}else{for(p=u/(I[0]+1)|0,p>1&&(I=r(I,p,u),O=r(O,p,u),M=I.length,A=O.length),D=M,y=O.slice(0,M),x=y.length;x<M;)y[x++]=0;F=I.slice(),F.unshift(0),S=I[0],I[1]>=u/2&&++S;do p=0,s=e(I,y,M,x),s<0?(_=y[0],M!=x&&(_=_*u+(y[1]||0)),p=_/S|0,p>1?(p>=u&&(p=u-1),d=r(I,p,u),g=d.length,x=y.length,s=e(d,y,g,x),s==1&&(p--,t(d,M<g?F:I,g,u))):(p==0&&(s=p=1),d=I.slice()),g=d.length,g<x&&d.unshift(0),t(y,d,x,u),s==-1&&(x=y.length,s=e(I,y,M,x),s<1&&(p++,t(y,M<x?F:I,x,u))),x=y.length):s===0&&(p++,y=[0]),w[f++]=p,s&&y[0]?y[x++]=O[D]||0:(y=[O[D]],x=1);while((D++<A||y[0]!==void 0)&&b--);h=y[0]!==void 0}w[0]||w.shift()}if(m==1)v.e=c,PN=h;else{for(f=1,p=w[0];p>=10;p/=10)f++;v.e=f+c*m-1,lt(v,l?a+v.e+1:a,o,h)}return v}}();function lt(r,e,t,n){var i,a,o,l,u,s,c,f,p,m=r.constructor;e:if(e!=null){if(f=r.d,!f)return r;for(i=1,l=f[0];l>=10;l/=10)i++;if(a=e-i,a<0)a+=vt,o=e,c=f[p=0],u=c/Xr(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/vt),l=f.length,p>=l)if(n){for(;l++<=p;)f.push(0);c=u=0,i=1,a%=vt,o=a-vt+1}else break e;else{for(c=l=f[p],i=1;l>=10;l/=10)i++;a%=vt,o=a-vt+i,u=o<0?0:c/Xr(10,i-o-1)%10|0}if(n=n||e<0||f[p+1]!==void 0||(o<0?c:c%Xr(10,i-o-1)),s=t<4?(u||n)&&(t==0||t==(r.s<0?3:2)):u>5||u==5&&(t==4||n||t==6&&(a>0?o>0?c/Xr(10,i-o):0:f[p-1])%10&1||t==(r.s<0?8:7)),e<1||!f[0])return f.length=0,s?(e-=r.e+1,f[0]=Xr(10,(vt-e%vt)%vt),r.e=-e||0):f[0]=r.e=0,r;if(a==0?(f.length=p,l=1,p--):(f.length=p+1,l=Xr(10,vt-a),f[p]=o>0?(c/Xr(10,i-o)%Xr(10,o)|0)*l:0),s)for(;;)if(p==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=l,l=1;o>=10;o/=10)l++;a!=l&&(r.e++,f[0]==qi&&(f[0]=1));break}else{if(f[p]+=l,f[p]!=qi)break;f[p--]=0,l=1}for(a=f.length;f[--a]===0;)f.pop()}return Nt&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}function Ki(r,e,t){if(!r.isFinite())return qN(r);var n,i=r.e,a=mn(r.d),o=a.length;return e?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+ro(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r.e<0?"e":"e+")+r.e):i<0?(a="0."+ro(-i-1)+a,t&&(n=t-o)>0&&(a+=ro(n))):i>=o?(a+=ro(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+ro(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=ro(n))),a}function Cp(r,e){var t=r[0];for(e*=vt;t>=10;t/=10)e++;return e}function Dp(r,e,t){if(e>V7)throw Nt=!0,t&&(r.precision=t),Error(ON);return lt(new r(Sp),e,1,!0)}function $i(r,e,t){if(e>gg)throw Error(ON);return lt(new r(Ep),e,t,!0)}function UN(r){var e=r.length-1,t=e*vt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function ro(r){for(var e="";r--;)e+="0";return e}function VN(r,e,t,n){var i,a=new r(1),o=Math.ceil(n/vt+4);for(Nt=!1;;){if(t%2&&(a=a.times(e),IN(a.d,o)&&(i=!0)),t=yn(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),IN(e.d,o)}return Nt=!0,a}function FN(r){return r.d[r.d.length-1]&1}function $N(r,e,t){for(var n,i=new r(e[0]),a=0;++a<e.length;)if(n=new r(e[a]),n.s)i[t](n)&&(i=n);else{i=n;break}return i}function vg(r,e){var t,n,i,a,o,l,u,s=0,c=0,f=0,p=r.constructor,m=p.rounding,h=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(Nt=!1,u=h):u=e,l=new p(.03125);r.e>-2;)r=r.times(l),f+=5;for(n=Math.log(Xr(2,f))/Math.LN10*2+5|0,u+=n,t=a=o=new p(1),p.precision=u;;){if(a=lt(a.times(r),u,1),t=t.times(++c),l=o.plus(xr(a,t,u,1)),mn(l.d).slice(0,u)===mn(o.d).slice(0,u)){for(i=f;i--;)o=lt(o.times(o),u,1);if(e==null)if(s<3&&ml(o.d,u-n,m,s))p.precision=u+=10,t=a=l=new p(1),c=0,s++;else return lt(o,p.precision=h,m,Nt=!0);else return p.precision=h,o}o=l}}function no(r,e){var t,n,i,a,o,l,u,s,c,f,p,m=1,h=10,d=r,g=d.d,v=d.constructor,w=v.rounding,y=v.precision;if(d.s<0||!g||!g[0]||!d.e&&g[0]==1&&g.length==1)return new v(g&&!g[0]?-1/0:d.s!=1?NaN:g?0:d);if(e==null?(Nt=!1,c=y):c=e,v.precision=c+=h,t=mn(g),n=t.charAt(0),Math.abs(a=d.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)d=d.times(r),t=mn(d.d),n=t.charAt(0),m++;a=d.e,n>1?(d=new v("0."+t),a++):d=new v(n+"."+t.slice(1))}else return s=Dp(v,c+2,y).times(a+""),d=no(new v(n+"."+t.slice(1)),c-h).plus(s),v.precision=y,e==null?lt(d,y,w,Nt=!0):d;for(f=d,u=o=d=xr(d.minus(1),d.plus(1),c,1),p=lt(d.times(d),c,1),i=3;;){if(o=lt(o.times(p),c,1),s=u.plus(xr(o,new v(i),c,1)),mn(s.d).slice(0,c)===mn(u.d).slice(0,c))if(u=u.times(2),a!==0&&(u=u.plus(Dp(v,c+2,y).times(a+""))),u=xr(u,new v(m),c,1),e==null)if(ml(u.d,c-h,w,l))v.precision=c+=h,s=o=d=xr(f.minus(1),f.plus(1),c,1),p=lt(d.times(d),c,1),i=l=1;else return lt(u,v.precision=y,w,Nt=!0);else return v.precision=y,u;u=s,i+=2}}function qN(r){return String(r.s*r.s/0)}function yg(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%vt,t<0&&(n+=vt),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=vt;n<i;)r.d.push(+e.slice(n,n+=vt));e=e.slice(n),n=vt-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),Nt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function q7(r,e){var t,n,i,a,o,l,u,s,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),LN.test(e))return yg(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(R7.test(e))t=16,e=e.toLowerCase();else if(k7.test(e))t=2;else if(L7.test(e))t=8;else throw Error(io+e);for(a=e.search(/p/i),a>0?(u=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,n=r.constructor,o&&(e=e.replace(".",""),l=e.length,a=l-a,i=VN(n,new n(t),a,a*2)),s=Ap(e,t,qi),c=s.length-1,a=c;s[a]===0;--a)s.pop();return a<0?new n(r.s*0):(r.e=Cp(s,c),r.d=s,Nt=!1,o&&(r=xr(r,i,l*4)),u&&(r=r.times(Math.abs(u)<54?Xr(2,u):dl.pow(2,u))),Nt=!0,r)}function z7(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:uu(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Mp(5,t)),e=uu(r,2,e,e);for(var i,a=new r(5),o=new r(16),l=new r(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(l))));return e}function uu(r,e,t,n,i){var a,o,l,u,s=1,c=r.precision,f=Math.ceil(c/vt);for(Nt=!1,u=t.times(t),l=new r(n);;){if(o=xr(l.times(u),new r(e++*e++),c,1),l=i?n.plus(o):n.minus(o),n=xr(o.times(u),new r(e++*e++),c,1),o=l.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===l.d[a]&&a--;);if(a==-1)break}a=l,l=n,n=o,o=a,s++}return Nt=!0,o.d.length=f+1,o}function Mp(r,e){for(var t=r;--e;)t*=r;return t}function zN(r,e){var t,n=e.s<0,i=$i(r,r.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return xa=n?4:1,e;if(t=e.divToInt(i),t.isZero())xa=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return xa=FN(t)?n?2:3:n?4:1,e;xa=FN(t)?n?1:4:n?3:2}return e.minus(i).abs()}function bg(r,e,t,n){var i,a,o,l,u,s,c,f,p,m=r.constructor,h=t!==void 0;if(h?(Ln(t,1,ao),n===void 0?n=m.rounding:Ln(n,0,8)):(t=m.precision,n=m.rounding),!r.isFinite())c=qN(r);else{for(c=Ki(r),o=c.indexOf("."),h?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,o>=0&&(c=c.replace(".",""),p=new m(1),p.e=c.length-o,p.d=Ap(Ki(p),10,i),p.e=p.d.length),f=Ap(c,10,i),a=u=f.length;f[--u]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(r=new m(r),r.d=f,r.e=a,r=xr(r,p,t,n,0,i),f=r.d,a=r.e,s=PN),o=f[t],l=i/2,s=s||f[t+1]!==void 0,s=n<4?(o!==void 0||s)&&(n===0||n===(r.s<0?3:2)):o>l||o===l&&(n===4||s||n===6&&f[t-1]&1||n===(r.s<0?8:7)),f.length=t,s)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,c="";o<u;o++)c+=dg.charAt(f[o]);if(h){if(u>1)if(e==16||e==8){for(o=e==16?4:3,--u;u%o;u++)c+="0";for(f=Ap(c,i,e),u=f.length;!f[u-1];--u);for(o=1,c="1.";o<u;o++)c+=dg.charAt(f[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return r.s<0?"-"+c:c}function IN(r,e){if(r.length>e)return r.length=e,!0}function H7(r){return new this(r).abs()}function G7(r){return new this(r).acos()}function W7(r){return new this(r).acosh()}function j7(r,e){return new this(r).plus(e)}function Z7(r){return new this(r).asin()}function J7(r){return new this(r).asinh()}function Y7(r){return new this(r).atan()}function X7(r){return new this(r).atanh()}function Q7(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,a=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=$i(this,a,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?$i(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=$i(this,a,1).times(.5),t.s=r.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(xr(r,e,a,1)),e=$i(this,a,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(xr(r,e,a,1)),t}function K7(r){return new this(r).cbrt()}function e9(r){return lt(r=new this(r),r.e+1,2)}function t9(r,e,t){return new this(r).clamp(e,t)}function r9(r){if(!r||typeof r!="object")throw Error(Np+"Object expected");var e,t,n,i=r.defaults===!0,a=["precision",1,ao,"rounding",0,8,"toExpNeg",-su,0,"toExpPos",0,su,"maxE",0,su,"minE",-su,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(t=a[e],i&&(this[t]=hg[t]),(n=r[t])!==void 0)if(yn(n)===n&&n>=a[e+1]&&n<=a[e+2])this[t]=n;else throw Error(io+t+": "+n);if(t="crypto",i&&(this[t]=hg[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(kN);else this[t]=!1;else throw Error(io+t+": "+n);return this}function n9(r){return new this(r).cos()}function i9(r){return new this(r).cosh()}function HN(r){var e,t,n;function i(a){var o,l,u,s=this;if(!(s instanceof i))return new i(a);if(s.constructor=i,BN(a)){s.s=a.s,Nt?!a.d||a.e>i.maxE?(s.e=NaN,s.d=null):a.e<i.minE?(s.e=0,s.d=[0]):(s.e=a.e,s.d=a.d.slice()):(s.e=a.e,s.d=a.d?a.d.slice():a.d);return}if(u=typeof a,u==="number"){if(a===0){s.s=1/a<0?-1:1,s.e=0,s.d=[0];return}if(a<0?(a=-a,s.s=-1):s.s=1,a===~~a&&a<1e7){for(o=0,l=a;l>=10;l/=10)o++;Nt?o>i.maxE?(s.e=NaN,s.d=null):o<i.minE?(s.e=0,s.d=[0]):(s.e=o,s.d=[a]):(s.e=o,s.d=[a]);return}else if(a*0!==0){a||(s.s=NaN),s.e=NaN,s.d=null;return}return yg(s,a.toString())}else if(u!=="string")throw Error(io+a);return(l=a.charCodeAt(0))===45?(a=a.slice(1),s.s=-1):(l===43&&(a=a.slice(1)),s.s=1),LN.test(a)?yg(s,a):q7(s,a)}if(i.prototype=Be,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=r9,i.clone=HN,i.isDecimal=BN,i.abs=H7,i.acos=G7,i.acosh=W7,i.add=j7,i.asin=Z7,i.asinh=J7,i.atan=Y7,i.atanh=X7,i.atan2=Q7,i.cbrt=K7,i.ceil=e9,i.clamp=t9,i.cos=n9,i.cosh=i9,i.div=a9,i.exp=o9,i.floor=s9,i.hypot=u9,i.ln=l9,i.log=c9,i.log10=p9,i.log2=f9,i.max=m9,i.min=d9,i.mod=h9,i.mul=g9,i.pow=v9,i.random=y9,i.round=b9,i.sign=x9,i.sin=w9,i.sinh=_9,i.sqrt=A9,i.sub=S9,i.sum=E9,i.tan=D9,i.tanh=N9,i.trunc=C9,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function a9(r,e){return new this(r).div(e)}function o9(r){return new this(r).exp()}function s9(r){return lt(r=new this(r),r.e+1,3)}function u9(){var r,e,t=new this(0);for(Nt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Nt=!0,new this(1/0);t=e}return Nt=!0,t.sqrt()}function BN(r){return r instanceof dl||r&&r.toStringTag===RN||!1}function l9(r){return new this(r).ln()}function c9(r,e){return new this(r).log(e)}function f9(r){return new this(r).log(2)}function p9(r){return new this(r).log(10)}function m9(){return $N(this,arguments,"lt")}function d9(){return $N(this,arguments,"gt")}function h9(r,e){return new this(r).mod(e)}function g9(r,e){return new this(r).mul(e)}function v9(r,e){return new this(r).pow(e)}function y9(r){var e,t,n,i,a=0,o=new this(1),l=[];if(r===void 0?r=this.precision:Ln(r,1,ao),n=Math.ceil(r/vt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:l[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);a<n;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(l.push(i%1e7),a+=4);a=n/4}else throw Error(kN);else for(;a<n;)l[a++]=Math.random()*1e7|0;for(n=l[--a],r%=vt,n&&r&&(i=Xr(10,vt-r),l[a]=(n/i|0)*i);l[a]===0;a--)l.pop();if(a<0)t=0,l=[0];else{for(t=-1;l[0]===0;t-=vt)l.shift();for(n=1,i=l[0];i>=10;i/=10)n++;n<vt&&(t-=vt-n)}return o.e=t,o.d=l,o}function b9(r){return lt(r=new this(r),r.e+1,this.rounding)}function x9(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function w9(r){return new this(r).sin()}function _9(r){return new this(r).sinh()}function A9(r){return new this(r).sqrt()}function S9(r,e){return new this(r).sub(e)}function E9(){var r=0,e=arguments,t=new this(e[r]);for(Nt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return Nt=!0,lt(t,this.precision,this.rounding)}function D9(r){return new this(r).tan()}function N9(r){return new this(r).tanh()}function C9(r){return lt(r=new this(r),r.e+1,1)}Be[Symbol.for("nodejs.util.inspect.custom")]=Be.toString;Be[Symbol.toStringTag]="Decimal";var dl=Be.constructor=HN(hg);Sp=new dl(Sp);Ep=new dl(Ep);var rs=dl;var M9="BigNumber",T9=["?on","config"],xg=N(M9,T9,r=>{var{on:e,config:t}=r,n=rs.clone({precision:t.precision,modulo:rs.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var rn=fr(WN(),1);var F9="Complex",I9=[],_g=N(F9,I9,()=>(Object.defineProperty(rn.default,"name",{value:"Complex"}),rn.default.prototype.constructor=rn.default,rn.default.prototype.type="Complex",rn.default.prototype.isComplex=!0,rn.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},rn.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},rn.default.prototype.format=function(r){var e="",t=this.im,n=this.re,i=Ui(this.re,r),a=Ui(this.im,r),o=it(r)?r:r?r.precision:null;if(o!==null){var l=Math.pow(10,-o);Math.abs(n/t)<l&&(n=0),Math.abs(t/n)<l&&(t=0)}return t===0?e=i:n===0?t===1?e="i":t===-1?e="-i":e=a+"i":t<0?t===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+a+"i",e},rn.default.fromPolar=function(r){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,rn.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],n=arguments[1];if(it(t)){if(ln(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),it(n))return new rn.default({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},rn.default.prototype.valueOf=rn.default.prototype.toString,rn.default.fromJSON=function(r){return new rn.default(r)},rn.default.compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},rn.default),{isClass:!0});var ea=fr(ZN(),1);var B9="Fraction",P9=[],Sg=N(B9,P9,()=>(Object.defineProperty(ea.default,"name",{value:"Fraction"}),ea.default.prototype.constructor=ea.default,ea.default.prototype.type="Fraction",ea.default.prototype.isFraction=!0,ea.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ea.default.fromJSON=function(r){return new ea.default(r)},ea.default),{isClass:!0});var O9="Range",k9=[],Eg=N(O9,k9,()=>{function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=n!=null;if(i){if(Xe(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(Xe(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(Xe(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(t):0,this.step=o?parseFloat(n):1}return r.prototype.type="Range",r.prototype.isRange=!0,r.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),n=t.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new r(n[0],n[1]);case 3:return new r(n[0],n[2],n[1]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.end,this.step)},r.prototype.size=function(){var e=0,t=this.start,n=this.step,i=this.end,a=i-t;return gi(n)===gi(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},r.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},r.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},r.prototype.forEach=function(e){var t=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;t<i;)e(t,[a],this),t+=n,a++;else if(n<0)for(;t>i;)e(t,[a],this),t+=n,a++},r.prototype.map=function(e){var t=[];return this.forEach(function(n,i,a){t[i[0]]=e(n,i,a)}),t},r.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n[0]]=t}),e},r.prototype.valueOf=function(){return this.toArray()},r.prototype.format=function(e){var t=Ui(this.start,e);return this.step!==1&&(t+=":"+Ui(this.step,e)),t+=":"+Ui(this.end,e),t},r.prototype.toString=function(){return this.format()},r.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},r.fromJSON=function(e){return new r(e.start,e.end,e.step)},r},{isClass:!0});var R9="Matrix",L9=[],Dg=N(R9,L9,()=>{function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function JN(r){var e=0,t=1,n=Object.create(null),i=Object.create(null),a=0,o=function(u){var s=i[u];if(s&&(delete n[s],delete i[u],--e,t===s)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return r=Math.abs(r),{hit:function(u){var s=i[u],c=++a;if(n[c]=u,i[u]=c,!s)return++e,e<=r?void 0:(u=n[t],o(u),u);if(delete n[s],t===s)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:o,clear:function(){e=a=0,t=1,n=Object.create(null),i=Object.create(null)}}}function ns(r){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t==null?Number.POSITIVE_INFINITY:t,e=e==null?JSON.stringify:e,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:JN(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var l=r.apply(r,i);return n.cache.values.set(o,l),n.cache.values.delete(n.cache.lru.hit(o)),l}}function Tp(r){return Object.keys(r.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var U9="DenseMatrix",V9=["Matrix"],Ng=N(U9,V9,r=>{var{Matrix:e}=r;function t(c,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!Ar(f))throw new Error("Invalid datatype: "+f);if(Ge(c))c.type==="DenseMatrix"?(this._data=et(c._data),this._size=et(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&It(c.data)&&It(c.size))this._data=c.data,this._size=c.size,ig(this._data,this._size),this._datatype=f||c.datatype;else if(It(c))this._data=s(c),this._size=nt(this._data),ig(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+Mt(c)+")");this._data=[],this._size=[0],this._datatype=f}}t.prototype=new e,t.prototype.createDenseMatrix=function(c,f){return new t(c,f)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return eo(this._data,Mt)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(c,f){return new t(c,f)},t.prototype.subset=function(c,f,p){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,f,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(c){if(!It(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new st(c.length,this._size.length);for(var f=0;f<c.length;f++)Jt(c[f],this._size[f]);for(var p=this._data,m=0,h=c.length;m<h;m++){var d=c[m];Jt(d,p.length),p=p[d]}return p},t.prototype.set=function(c,f,p){if(!It(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new st(c.length,this._size.length,"<");var m,h,d,g=c.map(function(w){return w+1});u(this,g,p);var v=this._data;for(m=0,h=c.length-1;m<h;m++)d=c[m],Jt(d,v.length),v=v[d];return d=c[c.length-1],Jt(d,v.length),v[d]=f,this};function n(c,f){if(!Ya(f))throw new TypeError("Invalid index");var p=f.isScalar();if(p)return c.get(f.min());var m=f.size();if(m.length!==c._size.length)throw new st(m.length,c._size.length);for(var h=f.min(),d=f.max(),g=0,v=c._size.length;g<v;g++)Jt(h[g],c._size[g]),Jt(d[g],c._size[g]);return new t(i(c._data,f,m.length,0),c._datatype)}function i(c,f,p,m){var h=m===p-1,d=f.dimension(m);return h?d.map(function(g){return Jt(g,c.length),c[g]}).valueOf():d.map(function(g){Jt(g,c.length);var v=c[g];return i(v,f,p,m+1)}).valueOf()}function a(c,f,p,m){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var h=f.size(),d=f.isScalar(),g;if(Ge(p)?(g=p.size(),p=p.valueOf()):g=nt(p),d){if(g.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),p,m)}else{if(!Li(g,h))try{g.length===0?p=sg([p],h):p=sg(p,h),g=nt(p)}catch(b){}if(h.length<c._size.length)throw new st(h.length,c._size.length,"<");if(g.length<h.length){for(var v=0,w=0;h[v]===1&&g[v]===1;)v++;for(;h[v]===1;)w++,v++;p=bp(p,h.length,w,g)}if(!Li(h,g))throw new st(h,g,">");var y=f.max().map(function(b){return b+1});u(c,y,m);var x=h.length,_=0;o(c._data,f,p,x,_)}return c}function o(c,f,p,m,h){var d=h===m-1,g=f.dimension(h);d?g.forEach(function(v,w){Jt(v),c[v]=p[w[0]]}):g.forEach(function(v,w){Jt(v),o(c[v],f,p[w[0]],m,h+1)})}t.prototype.resize=function(c,f,p){if(!Cr(c))throw new TypeError("Array or Matrix expected");var m=c.valueOf().map(d=>Array.isArray(d)&&d.length===1?d[0]:d),h=p?this.clone():this;return l(h,m,f)};function l(c,f,p){if(f.length===0){for(var m=c._data;It(m);)m=m[0];return m}return c._size=f.slice(0),c._data=Vi(c._data,c._size,p),c}t.prototype.reshape=function(c,f){var p=f?this.clone():this;p._data=cl(p._data,c);var m=p._size.reduce((h,d)=>h*d);return p._size=fl(c,m),p};function u(c,f,p){for(var m=c._size.slice(0),h=!1;m.length<f.length;)m.push(0),h=!0;for(var d=0,g=f.length;d<g;d++)f[d]>m[d]&&(m[d]=f[d],h=!0);h&&l(c,m,p)}t.prototype.clone=function(){var c=new t({data:et(this._data),size:et(this._size),datatype:this._datatype});return c},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(c){var f=this,p=Tp(c),m=function g(v,w){return It(v)?v.map(function(y,x){return g(y,w.concat(x))}):p===1?c(v):p===2?c(v,w):c(v,w,f)},h=m(this._data,[]),d=this._datatype!==void 0?eo(h,Mt):void 0;return new t(h,d)},t.prototype.forEach=function(c){var f=this,p=function m(h,d){It(h)?h.forEach(function(g,v){m(g,d.concat(v))}):c(h,d,f)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var c=function*f(p,m){if(It(p))for(var h=0;h<p.length;h++)yield*f(p[h],m.concat(h));else yield{value:p,index:m}};yield*c(this._data,[])},t.prototype.rows=function(){var c=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var m of p)c.push(new t([m],this._datatype));return c},t.prototype.columns=function(){var c=this,f=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var m=this._data,h=function(v){var w=m.map(y=>[y[v]]);f.push(new t(w,c._datatype))},d=0;d<p[1];d++)h(d);return f},t.prototype.toArray=function(){return et(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(c){return at(this._data,c)},t.prototype.toString=function(){return at(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(c){if(c){if(Xe(c)&&(c=c.toNumber()),!it(c)||!ze(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var f=c>0?c:0,p=c<0?-c:0,m=this._size[0],h=this._size[1],d=Math.min(m-p,h-f),g=[],v=0;v<d;v++)g[v]=this._data[v+p][v+f];return new t({data:g,size:[d],datatype:this._datatype})},t.diagonal=function(c,f,p,m){if(!It(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(E){if(Xe(E)&&(E=E.toNumber()),!it(E)||!ze(E)||E<1)throw new Error("Size values must be positive integers");return E}),p){if(Xe(p)&&(p=p.toNumber()),!it(p)||!ze(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var h=p>0?p:0,d=p<0?-p:0,g=c[0],v=c[1],w=Math.min(g-d,v-h),y;if(It(f)){if(f.length!==w)throw new Error("Invalid value array length");y=function(D){return f[D]}}else if(Ge(f)){var x=f.size();if(x.length!==1||x[0]!==w)throw new Error("Invalid matrix length");y=function(D){return f.get([D])}}else y=function(){return f};m||(m=Xe(y(0))?y(0).mul(0):0);var _=[];if(c.length>0){_=Vi(_,c,m);for(var b=0;b<w;b++)_[b+d][b+h]=y(b)}return new t({data:_,size:[g,v]})},t.fromJSON=function(c){return new t(c)},t.prototype.swapRows=function(c,f){if(!it(c)||!ze(c)||!it(f)||!ze(f))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Jt(c,this._size[0]),Jt(f,this._size[0]),t._swapRows(c,f,this._data),this},t._swapRows=function(c,f,p){var m=p[c];p[c]=p[f],p[f]=m};function s(c){return Ge(c)?s(c.valueOf()):It(c)?c.map(s):c}return t},{isClass:!0});var YN="clone",$9=["typed"],Cg=N(YN,$9,r=>{var{typed:e}=r;return e(YN,{any:et})});function Fp(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}function vi(r){for(var e=0;e<r.length;e++)if(Cr(r[e]))return!0;return!1}function bn(r,e){Ge(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?bn(i,e):e(i)}}function Je(r,e,t){return r&&typeof r.map=="function"?r.map(function(n){return Je(n,e,t)}):e(r)}function oo(r,e,t){var n=Array.isArray(r)?nt(r):r.size();if(e<0||e>=n.length)throw new pn(e,n.length);return Ge(r)?r.create(Ip(r.valueOf(),e,t)):Ip(r,e,t)}function Ip(r,e,t){var n,i,a,o;if(e<=0)if(Array.isArray(r[0])){for(o=Fp(r),i=[],n=0;n<o.length;n++)i[n]=Ip(o[n],e-1,t);return i}else{for(a=r[0],n=1;n<r.length;n++)a=t(a,r[n]);return a}else{for(i=[],n=0;n<r.length;n++)i[n]=Ip(r[n],e-1,t);return i}}function Mg(r,e,t,n,i,a,o,l,u,s,c){var f=r._values,p=r._index,m=r._ptr,h,d,g,v;if(n)for(d=m[e],g=m[e+1],h=d;h<g;h++)v=p[h],t[v]!==a?(t[v]=a,o.push(v),s?(n[v]=u?l(f[h],c):l(c,f[h]),i[v]=a):n[v]=f[h]):(n[v]=u?l(f[h],n[v]):l(n[v],f[h]),i[v]=a);else for(d=m[e],g=m[e+1],h=d;h<g;h++)v=p[h],t[v]!==a?(t[v]=a,o.push(v)):i[v]=a}var XN="isInteger",q9=["typed"],Tg=N(XN,q9,r=>{var{typed:e}=r;return e(XN,{number:ze,BigNumber:function(n){return n.isInt()},Fraction:function(n){return n.d===1&&isFinite(n.n)},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var Un="number",wa="number, number";function Fg(r){return Math.abs(r)}Fg.signature=Un;function Ig(r,e){return r+e}Ig.signature=wa;function Bg(r,e){return r-e}Bg.signature=wa;function Pg(r,e){return r*e}Pg.signature=wa;function z9(r,e){return r/e}z9.signature=wa;function Og(r){return-r}Og.signature=Un;function kg(r){return r}kg.signature=Un;function lu(r){return iN(r)}lu.signature=Un;function Rg(r){return r*r*r}Rg.signature=Un;function Lg(r){return Math.exp(r)}Lg.signature=Un;function Ug(r){return aN(r)}Ug.signature=Un;function H9(r,e){if(!ze(r)||!ze(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=r%e,r=e,e=t;return r<0?-r:r}H9.signature=wa;function Vg(r,e){if(!ze(r)||!ze(e))throw new Error("Parameters in function lcm must be integer numbers");if(r===0||e===0)return 0;for(var t,n=r*e;e!==0;)t=e,e=r%t,r=t;return Math.abs(n/r)}Vg.signature=wa;function QN(r,e){return e?Math.log(r)/Math.log(e):Math.log(r)}function $g(r){return nN(r)}$g.signature=Un;function qg(r){return rN(r)}qg.signature=Un;function G9(r){return mp(r)}G9.signature=Un;function W9(r,e){return e===0?r:r-e*Math.floor(r/e)}W9.signature=wa;function zg(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=e<0;if(t&&(e=-e),e===0)throw new Error("Root must be non-zero");if(r<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(r===0)return t?1/0:0;if(!isFinite(r))return t?0:r;var n=Math.pow(Math.abs(r),1/e);return n=r<0?-n:n,t?1/n:n}function Bp(r){return gi(r)}Bp.signature=Un;function j9(r){return Math.sqrt(r)}j9.signature=Un;function Hg(r){return r*r}Hg.signature=Un;function Gg(r,e){var t,n,i,a=0,o=1,l=1,u=0;if(!ze(r)||!ze(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=a,a=o-n*a,o=t,t=l,l=u-n*l,u=t,r=e,e=i;var s;return r<0?s=[-r,-o,-u]:s=[r,r?o:0,u],s}Gg.signature=wa;function Wg(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}Wg.signature=wa;function jg(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!ze(e)||e<0||e>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(tg(r,e))}function Z9(r){return Math.abs(r)}Z9.signature=Un;var J9="number",cu="number, number";function Zg(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function bitAnd");return r&e}Zg.signature=cu;function Jg(r){if(!ze(r))throw new Error("Integer expected in function bitNot");return~r}Jg.signature=J9;function Yg(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function bitOr");return r|e}Yg.signature=cu;function Xg(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function bitXor");return r^e}Xg.signature=cu;function Qg(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function leftShift");return r<<e}Qg.signature=cu;function Kg(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function rightArithShift");return r>>e}Kg.signature=cu;function ev(r,e){if(!ze(r)||!ze(e))throw new Error("Integers expected in function rightLogShift");return r>>>e}ev.signature=cu;function ri(r,e){if(e<r)return 1;if(e===r)return e;var t=e+r>>1;return ri(r,t)*ri(t+1,e)}function tv(r,e){if(!ze(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(!ze(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>r)throw new TypeError("k must be less than or equal to n");for(var t=r-e,n=1,i=e<t?t+1:e+1,a=2,o=e<t?e:t,l=i;l<=r;++l)for(n*=l;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=ri(a,o)),n}tv.signature="number, number";var KN=Math.PI,eC=2*Math.PI,tC=Math.E,rC=1.618033988749895;var Y9="number",rv="number, number";function nv(r){return!r}nv.signature=Y9;function iv(r,e){return!!(r||e)}iv.signature=rv;function av(r,e){return!!r!=!!e}av.signature=rv;function ov(r,e){return!!(r&&e)}ov.signature=rv;function hl(r){var e;if(ze(r))return r<=0?isFinite(r)?1/0:NaN:r>171?1/0:ri(1,r-1);if(r<.5)return Math.PI/(Math.sin(Math.PI*r)*hl(1-r));if(r>=171.35)return 1/0;if(r>85){var t=r*r,n=t*r,i=n*r,a=i*r;return Math.sqrt(2*Math.PI/r)*Math.pow(r/Math.E,r)*(1+1/(12*r)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*r))}--r,e=is[0];for(var o=1;o<is.length;++o)e+=is[o]/(r+o);var l=r+sv+.5;return Math.sqrt(2*Math.PI)*Math.pow(l,r+.5)*Math.exp(-l)*e}hl.signature="number";var sv=4.7421875,is=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],uv=.9189385332046728,X9=5,Q9=7,nC=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function gl(r){if(r<0)return NaN;if(r===0)return 1/0;if(!isFinite(r))return r;if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-gl(1-r);r=r-1;for(var e=r+X9+.5,t=nC[0],n=Q9-1;n>=1;n--)t+=nC[n]/(r+n);return uv+(r+.5)*Math.log(e)-e+Math.log(t)}gl.signature="number";var Sr="number",K9="number, number";function ez(r){return Math.acos(r)}ez.signature=Sr;function lv(r){return uN(r)}lv.signature=Sr;function cv(r){return Math.atan(1/r)}cv.signature=Sr;function fv(r){return isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0}fv.signature=Sr;function pv(r){return Math.asin(1/r)}pv.signature=Sr;function mv(r){var e=1/r;return Math.log(e+Math.sqrt(e*e+1))}mv.signature=Sr;function dv(r){return Math.acos(1/r)}dv.signature=Sr;function hv(r){var e=1/r,t=Math.sqrt(e*e-1);return Math.log(t+e)}hv.signature=Sr;function tz(r){return Math.asin(r)}tz.signature=Sr;function gv(r){return lN(r)}gv.signature=Sr;function rz(r){return Math.atan(r)}rz.signature=Sr;function nz(r,e){return Math.atan2(r,e)}nz.signature=K9;function vv(r){return cN(r)}vv.signature=Sr;function iz(r){return Math.cos(r)}iz.signature=Sr;function az(r){return gp(r)}az.signature=Sr;function yv(r){return 1/Math.tan(r)}yv.signature=Sr;function bv(r){var e=Math.exp(2*r);return(e+1)/(e-1)}bv.signature=Sr;function xv(r){return 1/Math.sin(r)}xv.signature=Sr;function wv(r){return r===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*gi(r)}wv.signature=Sr;function _v(r){return 1/Math.cos(r)}_v.signature=Sr;function Av(r){return 2/(Math.exp(r)+Math.exp(-r))}Av.signature=Sr;function oz(r){return Math.sin(r)}oz.signature=Sr;function Sv(r){return fN(r)}Sv.signature=Sr;function sz(r){return Math.tan(r)}sz.signature=Sr;function uz(r){return vp(r)}uz.signature=Sr;var vl="number";function lz(r){return ze(r)}lz.signature=vl;function Ev(r){return r<0}Ev.signature=vl;function Dv(r){return r>0}Dv.signature=vl;function Nv(r){return r===0}Nv.signature=vl;function Cv(r){return Number.isNaN(r)}Cv.signature=vl;var iC="isNegative",cz=["typed"],Mv=N(iC,cz,r=>{var{typed:e}=r;return e(iC,{number:Ev,BigNumber:function(n){return n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s<0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var aC="isNumeric",fz=["typed"],Tv=N(aC,fz,r=>{var{typed:e}=r;return e(aC,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var oC="hasNumericValue",pz=["typed","isNumeric"],Fv=N(oC,pz,r=>{var{typed:e,isNumeric:t}=r;return e(oC,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var sC="isPositive",mz=["typed"],Iv=N(sC,mz,r=>{var{typed:e}=r;return e(sC,{number:Dv,BigNumber:function(n){return!n.isNeg()&&!n.isZero()&&!n.isNaN()},Fraction:function(n){return n.s>0&&n.n>0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var uC="isZero",dz=["typed"],Bv=N(uC,dz,r=>{var{typed:e}=r;return e(uC,{number:Nv,BigNumber:function(n){return n.isZero()},Complex:function(n){return n.re===0&&n.im===0},Fraction:function(n){return n.d===1&&n.n===0},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var lC="isNaN",hz=["typed"],Pv=N(lC,hz,r=>{var{typed:e}=r;return e(lC,{number:Cv,BigNumber:function(n){return n.isNaN()},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":function(n){return Je(n,Number.isNaN)}})});var cC="typeOf",gz=["typed"],Ov=N(cC,gz,r=>{var{typed:e}=r;return e(cC,{any:Mt})});function nn(r,e,t){if(t==null)return r.eq(e);if(r.eq(e))return!0;if(r.isNaN()||e.isNaN())return!1;if(r.isFinite()&&e.isFinite()){var n=r.minus(e).abs();if(n.isZero())return!0;var i=r.constructor.max(r.abs(),e.abs());return n.lte(i.times(t))}return!1}function fC(r,e,t){return Pr(r.re,e.re,t)&&Pr(r.im,e.im,t)}var yi=N("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[n.valueType(),i.valueType()])(n.value,i.value)})}});var Pp="equalScalar",vz=["typed","config"],kv=N(Pp,vz,r=>{var{typed:e,config:t}=r,n=yi({typed:e});return e(Pp,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Pr(a,o,t.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||nn(a,o,t.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return fC(a,o,t.epsilon)}},n)}),Hme=N(Pp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(Pp,{"number, number":function(i,a){return Pr(i,a,t.epsilon)}})});var yz="SparseMatrix",bz=["typed","equalScalar","Matrix"],Rv=N(yz,bz,r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(d,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!Ar(g))throw new Error("Invalid datatype: "+g);if(Ge(d))a(this,d,g);else if(d&&It(d.index)&&It(d.ptr)&&It(d.size))this._values=d.values,this._index=d.index,this._ptr=d.ptr,this._size=d.size,this._datatype=g||d.datatype;else if(It(d))o(this,d,g);else{if(d)throw new TypeError("Unsupported type of data ("+Mt(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(d,g,v){g.type==="SparseMatrix"?(d._values=g._values?et(g._values):void 0,d._index=et(g._index),d._ptr=et(g._ptr),d._size=et(g._size),d._datatype=v||g._datatype):o(d,g.valueOf(),v||g._datatype)}function o(d,g,v){d._values=[],d._index=[],d._ptr=[],d._datatype=v;var w=g.length,y=0,x=t,_=0;if(Ar(v)&&(x=e.find(t,[v,v])||t,_=e.convert(0,v)),w>0){var b=0;do{d._ptr.push(d._index.length);for(var E=0;E<w;E++){var D=g[E];if(It(D)){if(b===0&&y<D.length&&(y=D.length),b<D.length){var A=D[b];x(A,_)||(d._values.push(A),d._index.push(E))}}else b===0&&y<1&&(y=1),x(D,_)||(d._values.push(D),d._index.push(E))}b++}while(b<y)}d._ptr.push(d._index.length),d._size=[w,y]}i.prototype=new n,i.prototype.createSparseMatrix=function(d,g){return new i(d,g)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return eo(this._values,Mt)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(d,g){return new i(d,g)},i.prototype.density=function(){var d=this._size[0],g=this._size[1];return d!==0&&g!==0?this._index.length/(d*g):0},i.prototype.subset=function(d,g,v){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return l(this,d);case 2:case 3:return u(this,d,g,v);default:throw new SyntaxError("Wrong number of arguments")}};function l(d,g){if(!Ya(g))throw new TypeError("Invalid index");var v=g.isScalar();if(v)return d.get(g.min());var w=g.size();if(w.length!==d._size.length)throw new st(w.length,d._size.length);var y,x,_,b,E=g.min(),D=g.max();for(y=0,x=d._size.length;y<x;y++)Jt(E[y],d._size[y]),Jt(D[y],d._size[y]);var A=d._values,S=d._index,M=d._ptr,F=g.dimension(0),P=g.dimension(1),R=[],O=[];F.forEach(function(B,U){O[B]=U[0],R[B]=!0});var I=A?[]:void 0,T=[],$=[];return P.forEach(function(B){for($.push(T.length),_=M[B],b=M[B+1];_<b;_++)y=S[_],R[y]===!0&&(T.push(O[y]),I&&I.push(A[_]))}),$.push(T.length),new i({values:I,index:T,ptr:$,size:w,datatype:d._datatype})}function u(d,g,v,w){if(!g||g.isIndex!==!0)throw new TypeError("Invalid index");var y=g.size(),x=g.isScalar(),_;if(Ge(v)?(_=v.size(),v=v.toArray()):_=nt(v),x){if(_.length!==0)throw new TypeError("Scalar expected");d.set(g.min(),v,w)}else{if(y.length!==1&&y.length!==2)throw new st(y.length,d._size.length,"<");if(_.length<y.length){for(var b=0,E=0;y[b]===1&&_[b]===1;)b++;for(;y[b]===1;)E++,b++;v=bp(v,y.length,E,_)}if(!Li(y,_))throw new st(y,_,">");if(y.length===1){var D=g.dimension(0);D.forEach(function(M,F){Jt(M),d.set([M,0],v[F[0]],w)})}else{var A=g.dimension(0),S=g.dimension(1);A.forEach(function(M,F){Jt(M),S.forEach(function(P,R){Jt(P),d.set([M,P],v[F[0]][R[0]],w)})})}}return d}i.prototype.get=function(d){if(!It(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new st(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=d[0],v=d[1];Jt(g,this._size[0]),Jt(v,this._size[1]);var w=s(g,this._ptr[v],this._ptr[v+1],this._index);return w<this._ptr[v+1]&&this._index[w]===g?this._values[w]:0},i.prototype.set=function(d,g,v){if(!It(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new st(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var w=d[0],y=d[1],x=this._size[0],_=this._size[1],b=t,E=0;Ar(this._datatype)&&(b=e.find(t,[this._datatype,this._datatype])||t,E=e.convert(0,this._datatype)),(w>x-1||y>_-1)&&(p(this,Math.max(w+1,x),Math.max(y+1,_),v),x=this._size[0],_=this._size[1]),Jt(w,x),Jt(y,_);var D=s(w,this._ptr[y],this._ptr[y+1],this._index);return D<this._ptr[y+1]&&this._index[D]===w?b(g,E)?c(D,y,this._values,this._index,this._ptr):this._values[D]=g:b(g,E)||f(D,w,y,g,this._values,this._index,this._ptr),this};function s(d,g,v,w){if(v-g===0)return v;for(var y=g;y<v;y++)if(w[y]===d)return y;return g}function c(d,g,v,w,y){v.splice(d,1),w.splice(d,1);for(var x=g+1;x<y.length;x++)y[x]--}function f(d,g,v,w,y,x,_){y.splice(d,0,w),x.splice(d,0,g);for(var b=v+1;b<_.length;b++)_[b]++}i.prototype.resize=function(d,g,v){if(!Cr(d))throw new TypeError("Array or Matrix expected");var w=d.valueOf().map(x=>Array.isArray(x)&&x.length===1?x[0]:x);if(w.length!==2)throw new Error("Only two dimensions matrix are supported");w.forEach(function(x){if(!it(x)||!ze(x)||x<0)throw new TypeError("Invalid size, must contain positive integers (size: "+at(w)+")")});var y=v?this.clone():this;return p(y,w[0],w[1],g)};function p(d,g,v,w){var y=w||0,x=t,_=0;Ar(d._datatype)&&(x=e.find(t,[d._datatype,d._datatype])||t,_=e.convert(0,d._datatype),y=e.convert(y,d._datatype));var b=!x(y,_),E=d._size[0],D=d._size[1],A,S,M;if(v>D){for(S=D;S<v;S++)if(d._ptr[S]=d._values.length,b)for(A=0;A<E;A++)d._values.push(y),d._index.push(A);d._ptr[v]=d._values.length}else v<D&&(d._ptr.splice(v+1,D-v),d._values.splice(d._ptr[v],d._values.length),d._index.splice(d._ptr[v],d._index.length));if(D=v,g>E){if(b){var F=0;for(S=0;S<D;S++){d._ptr[S]=d._ptr[S]+F,M=d._ptr[S+1]+F;var P=0;for(A=E;A<g;A++,P++)d._values.splice(M+P,0,y),d._index.splice(M+P,0,A),F++}d._ptr[D]=d._values.length}}else if(g<E){var R=0;for(S=0;S<D;S++){d._ptr[S]=d._ptr[S]-R;var O=d._ptr[S],I=d._ptr[S+1]-R;for(M=O;M<I;M++)A=d._index[M],A>g-1&&(d._values.splice(M,1),d._index.splice(M,1),R++)}d._ptr[S]=d._values.length}return d._size[0]=g,d._size[1]=v,d}i.prototype.reshape=function(d,g){if(!It(d))throw new TypeError("Array expected");if(d.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");d.forEach(function(B){if(!it(B)||!ze(B)||B<=-2||B===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+at(d)+")")});var v=this._size[0]*this._size[1];d=fl(d,v);var w=d[0]*d[1];if(v!==w)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var y=g?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return y;for(var x=[],_=0;_<y._ptr.length;_++)for(var b=0;b<y._ptr[_+1]-y._ptr[_];b++)x.push(_);for(var E=y._values.slice(),D=y._index.slice(),A=0;A<y._index.length;A++){var S=D[A],M=x[A],F=S*y._size[1]+M;x[A]=F%d[1],D[A]=Math.floor(F/d[1])}y._values.length=0,y._index.length=0,y._ptr.length=d[1]+1,y._size=d.slice();for(var P=0;P<y._ptr.length;P++)y._ptr[P]=0;for(var R=0;R<E.length;R++){var O=D[R],I=x[R],T=E[R],$=s(O,y._ptr[I],y._ptr[I+1],y._index);f($,O,I,T,y._values,y._index,y._ptr)}return y},i.prototype.clone=function(){var d=new i({values:this._values?et(this._values):void 0,index:et(this._index),ptr:et(this._ptr),size:et(this._size),datatype:this._datatype});return d},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(d,g){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var v=this,w=this._size[0],y=this._size[1],x=Tp(d),_=function(E,D,A){return x===1?d(E):x===2?d(E,[D,A]):d(E,[D,A],v)};return m(this,0,w-1,0,y-1,_,g)};function m(d,g,v,w,y,x,_){var b=[],E=[],D=[],A=t,S=0;Ar(d._datatype)&&(A=e.find(t,[d._datatype,d._datatype])||t,S=e.convert(0,d._datatype));for(var M=function(L,ae,ve){L=x(L,ae,ve),A(L,S)||(b.push(L),E.push(ae))},F=w;F<=y;F++){D.push(b.length);var P=d._ptr[F],R=d._ptr[F+1];if(_)for(var O=P;O<R;O++){var I=d._index[O];I>=g&&I<=v&&M(d._values[O],I-g,F-w)}else{for(var T={},$=P;$<R;$++){var B=d._index[$];T[B]=d._values[$]}for(var U=g;U<=v;U++){var G=U in T?T[U]:0;M(G,U-g,F-w)}}}return D.push(b.length),new i({values:b,index:E,ptr:D,size:[v-g+1,y-w+1]})}i.prototype.forEach=function(d,g){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var v=this,w=this._size[0],y=this._size[1],x=0;x<y;x++){var _=this._ptr[x],b=this._ptr[x+1];if(g)for(var E=_;E<b;E++){var D=this._index[E];d(this._values[E],[D,x],v)}else{for(var A={},S=_;S<b;S++){var M=this._index[S];A[M]=this._values[S]}for(var F=0;F<w;F++){var P=F in A?A[F]:0;d(P,[F,x],v)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var d=this._size[1],g=0;g<d;g++)for(var v=this._ptr[g],w=this._ptr[g+1],y=v;y<w;y++){var x=this._index[y];yield{value:this._values[y],index:[x,g]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)};function h(d,g,v,w,y){var x=w[0],_=w[1],b=[],E,D;for(E=0;E<x;E++)for(b[E]=[],D=0;D<_;D++)b[E][D]=0;for(D=0;D<_;D++)for(var A=v[D],S=v[D+1],M=A;M<S;M++)E=g[M],b[E][D]=d?y?et(d[M]):d[M]:1;return b}return i.prototype.format=function(d){for(var g=this._size[0],v=this._size[1],w=this.density(),y="Sparse Matrix ["+at(g,d)+" x "+at(v,d)+"] density: "+at(w,d)+`
`,x=0;x<v;x++)for(var _=this._ptr[x],b=this._ptr[x+1],E=_;E<b;E++){var D=this._index[E];y+=`
(`+at(D,d)+", "+at(x,d)+") ==> "+(this._values?at(this._values[E],d):"X")}return y},i.prototype.toString=function(){return at(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(d){if(d){if(Xe(d)&&(d=d.toNumber()),!it(d)||!ze(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var g=d>0?d:0,v=d<0?-d:0,w=this._size[0],y=this._size[1],x=Math.min(w-v,y-g),_=[],b=[],E=[];E[0]=0;for(var D=g;D<y&&_.length<x;D++)for(var A=this._ptr[D],S=this._ptr[D+1],M=A;M<S;M++){var F=this._index[M];if(F===D-g+v){_.push(this._values[M]),b[_.length-1]=F-v;break}}return E.push(_.length),new i({values:_,index:b,ptr:E,size:[x,1]})},i.fromJSON=function(d){return new i(d)},i.diagonal=function(d,g,v,w,y){if(!It(d))throw new TypeError("Array expected, size parameter");if(d.length!==2)throw new Error("Only two dimensions matrix are supported");if(d=d.map(function(B){if(Xe(B)&&(B=B.toNumber()),!it(B)||!ze(B)||B<1)throw new Error("Size values must be positive integers");return B}),v){if(Xe(v)&&(v=v.toNumber()),!it(v)||!ze(v))throw new TypeError("The parameter k must be an integer number")}else v=0;var x=t,_=0;Ar(y)&&(x=e.find(t,[y,y])||t,_=e.convert(0,y));var b=v>0?v:0,E=v<0?-v:0,D=d[0],A=d[1],S=Math.min(D-E,A-b),M;if(It(g)){if(g.length!==S)throw new Error("Invalid value array length");M=function(U){return g[U]}}else if(Ge(g)){var F=g.size();if(F.length!==1||F[0]!==S)throw new Error("Invalid matrix length");M=function(U){return g.get([U])}}else M=function(){return g};for(var P=[],R=[],O=[],I=0;I<A;I++){O.push(P.length);var T=I-b;if(T>=0&&T<S){var $=M(T);x($,_)||(R.push(T+E),P.push($))}}return O.push(P.length),new i({values:P,index:R,ptr:O,size:[D,A]})},i.prototype.swapRows=function(d,g){if(!it(d)||!ze(d)||!it(g)||!ze(g))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return Jt(d,this._size[0]),Jt(g,this._size[0]),i._swapRows(d,g,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(d,g,v,w,y){for(var x=w[d],_=w[d+1],b=x;b<_;b++)y(v[b],g[b])},i._swapRows=function(d,g,v,w,y,x){for(var _=0;_<v;_++){var b=x[_],E=x[_+1],D=s(d,b,E,y),A=s(g,b,E,y);if(D<E&&A<E&&y[D]===d&&y[A]===g){if(w){var S=w[D];w[D]=w[A],w[A]=S}continue}if(D<E&&y[D]===d&&(A>=E||y[A]!==g)){var M=w?w[D]:void 0;y.splice(A,0,g),w&&w.splice(A,0,M),y.splice(A<=D?D+1:D,1),w&&w.splice(A<=D?D+1:D,1);continue}if(A<E&&y[A]===g&&(D>=E||y[D]!==d)){var F=w?w[A]:void 0;y.splice(D,0,d),w&&w.splice(D,0,F),y.splice(D<=A?A+1:A,1),w&&w.splice(D<=A?A+1:A,1)}}},i},{isClass:!0});var xz="number",wz=["typed"];function _z(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:r,radix:t,integerPart:n,fractionalPart:i}}else return null}function Az(r){for(var e=parseInt(r.integerPart,r.radix),t=0,n=0;n<r.fractionalPart.length;n++){var i=parseInt(r.fractionalPart[n],r.radix);t+=i/Math.pow(r.radix,n+1)}var a=e+t;if(isNaN(a))throw new SyntaxError('String "'+r.input+'" is not a valid number');return a}var Lv=N(xz,wz,r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=_z(i);if(a)return Az(a);var o=0,l=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(o=Number(l[2]),i=l[1]);var u=Number(i);if(isNaN(u))throw new SyntaxError('String "'+i+'" is not a valid number');if(l){if(u>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));u>=2**(o-1)&&(u=u-2**o)}return u},BigNumber:function(i){return i.toNumber()},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=>Je(i,n))});return t.fromJSON=function(n){return parseFloat(n.value)},t});var pC="string",Sz=["typed"],Uv=N(pC,Sz,r=>{var{typed:e}=r;return e(pC,{"":function(){return""},number:Ui,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t)),any:function(n){return String(n)}})});var mC="boolean",Ez=["typed"],Vv=N(mC,Ez,r=>{var{typed:e}=r;return e(mC,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var Dz="bignumber",Nz=["typed","BigNumber"],$v=N(Dz,Nz,r=>{var{typed:e,BigNumber:t}=r;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],l=t(a[1]),u=new t(2).pow(Number(o));if(l.gt(u.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var s=new t(2).pow(Number(o)-1);return l.gte(s)?l.sub(u):l}return new t(i)},BigNumber:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var Cz="complex",Mz=["typed","Complex"],qv=N(Cz,Mz,r=>{var{typed:e,Complex:t}=r;return e("complex",{"":function(){return t.ZERO},number:function(i){return new t(i,0)},"number, number":function(i,a){return new t(i,a)},"BigNumber, BigNumber":function(i,a){return new t(i.toNumber(),a.toNumber())},Fraction:function(i){return new t(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return t(i)},null:function(i){return t(0)},Object:function(i){if("re"in i&&"im"in i)return new t(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new t(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var Tz="fraction",Fz=["typed","Fraction"],zv=N(Tz,Fz,r=>{var{typed:e,Fraction:t}=r;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,a){return new t(i,a)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var dC="matrix",Iz=["typed","Matrix","DenseMatrix","SparseMatrix"],Hv=N(dC,Iz,r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(dC,{"":function(){return a([])},string:function(l){return a([],l)},"string, string":function(l,u){return a([],l,u)},Array:function(l){return a(l)},Matrix:function(l){return a(l,l.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,l,u){if(l==="dense"||l==="default"||l===void 0)return new n(o,u);if(l==="sparse")return new i(o,u);throw new TypeError("Unknown matrix type "+JSON.stringify(l)+".")}});var hC="matrixFromFunction",Bz=["typed","matrix","isZero"],Gv=N(hC,Bz,r=>{var{typed:e,matrix:t,isZero:n}=r;return e(hC,{"Array | Matrix, function, string, string":function(o,l,u,s){return i(o,l,u,s)},"Array | Matrix, function, string":function(o,l,u){return i(o,l,u)},"Matrix, function":function(o,l){return i(o,l,"dense")},"Array, function":function(o,l){return i(o,l,"dense").toArray()},"Array | Matrix, string, function":function(o,l,u){return i(o,u,l)},"Array | Matrix, string, string, function":function(o,l,u,s){return i(o,s,l,u)}});function i(a,o,l,u){var s;return u!==void 0?s=t(l,u):s=t(l),s.resize(a),s.forEach(function(c,f){var p=o(f);n(p)||s.set(f,p)}),s}});var gC="matrixFromRows",Pz=["typed","matrix","flatten","size"],Wv=N(gC,Pz,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(gC,{"...Array":function(u){return a(u)},"...Matrix":function(u){return t(a(u.map(s=>s.toArray())))}});function a(l){if(l.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var u=o(l[0]),s=[];for(var c of l){var f=o(c);if(f!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(f|0));s.push(n(c))}return s}function o(l){var u=i(l);if(u.length===1)return u[0];if(u.length===2){if(u[0]===1)return u[1];if(u[1]===1)return u[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var vC="matrixFromColumns",Oz=["typed","matrix","flatten","size"],jv=N(vC,Oz,r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(vC,{"...Array":function(u){return a(u)},"...Matrix":function(u){return t(a(u.map(s=>s.toArray())))}});function a(l){if(l.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var u=o(l[0]),s=[],c=0;c<u;c++)s[c]=[];for(var f of l){var p=o(f);if(p!==u)throw new TypeError("The vectors had different length: "+(u|0)+" \u2260 "+(p|0));for(var m=n(f),h=0;h<u;h++)s[h].push(m[h])}return s}function o(l){var u=i(l);if(u.length===1)return u[0];if(u.length===2){if(u[0]===1)return u[1];if(u[1]===1)return u[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var yC="splitUnit",kz=["typed"],Zv=N(yC,kz,r=>{var{typed:e}=r;return e(yC,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var bC="unaryMinus",Rz=["typed"],Jv=N(bC,Rz,r=>{var{typed:e}=r;return e(bC,{number:Og,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>n=>{var i=n.clone();return i.value=e.find(t,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t,!0))})});var xC="unaryPlus",Lz=["typed","config","BigNumber"],Yv=N(xC,Lz,r=>{var{typed:e,config:t,BigNumber:n}=r;return e(xC,{number:kg,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>Je(a,i,!0)),"boolean | string":function(a){return t.number==="BigNumber"?new n(+a):+a}})});var wC="abs",Uz=["typed"],Xv=N(wC,Uz,r=>{var{typed:e}=r;return e(wC,{number:Fg,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t,!0))})});var _C="apply",Vz=["typed","isInteger"],as=N(_C,Vz,r=>{var{typed:e,isInteger:t}=r;return e(_C,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!t(a))throw new TypeError("Integer number expected for dimension");var l=Array.isArray(i)?nt(i):i.size();if(a<0||a>=l.length)throw new pn(a,l.length);return Ge(i)?i.create(Op(i.valueOf(),a,o)):Op(i,a,o)}})});function Op(r,e,t){var n,i,a;if(e<=0)if(Array.isArray(r[0])){for(a=$z(r),i=[],n=0;n<a.length;n++)i[n]=Op(a[n],e-1,t);return i}else return t(r);else{for(i=[],n=0;n<r.length;n++)i[n]=Op(r[n],e-1,t);return i}}function $z(r){var e=r.length,t=r[0].length,n,i,a=[];for(i=0;i<t;i++){var o=[];for(n=0;n<e;n++)o.push(r[n][i]);a.push(o)}return a}var AC="addScalar",qz=["typed"],Qv=N(AC,qz,r=>{var{typed:e}=r;return e(AC,{"number, number":Ig,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var SC="subtractScalar",zz=["typed"],Kv=N(SC,zz,r=>{var{typed:e}=r;return e(SC,{"number, number":Bg,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(t=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var EC="cbrt",Hz=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],ey=N(EC,Hz,r=>{var{config:e,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:l,Fraction:u}=r;return t(EC,{number:lu,Complex:s,"Complex, boolean":s,BigNumber:function(p){return p.cbrt()},Unit:c});function s(f,p){var m=f.arg()/3,h=f.abs(),d=new o(lu(h),0).mul(new o(0,m).exp());if(p){var g=[d,new o(lu(h),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(lu(h),0).mul(new o(0,m-Math.PI*2/3).exp())];return e.matrix==="Array"?g:a(g)}else return d}function c(f){if(f.value&&Mn(f.value)){var p=f.clone();return p.value=1,p=p.pow(1/3),p.value=s(f.value),p}else{var m=n(f.value);m&&(f.value=i(f.value));var h;Xe(f.value)?h=new l(1).div(3):va(f.value)?h=new u(1,3):h=1/3;var d=f.pow(h);return m&&(d.value=i(d.value)),d}}});var Gz="matAlgo11xS0s",Wz=["typed","equalScalar"],Yt=N(Gz,Wz,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=t,v=0,w=o;typeof p=="string"&&(d=p,g=e.find(t,[d,d]),v=e.convert(0,d),a=e.convert(a,d),w=e.find(o,[d,d]));for(var y=[],x=[],_=[],b=0;b<h;b++){_[b]=x.length;for(var E=c[b],D=c[b+1],A=E;A<D;A++){var S=s[A],M=l?w(a,u[A]):w(u[A],a);g(M,v)||(x.push(S),y.push(M))}}return _[h]=x.length,i.createSparseMatrix({values:y,index:x,ptr:_,size:[m,h],datatype:d})}});var jz="matAlgo12xSfs",Zz=["typed","DenseMatrix"],qt=N(jz,Zz,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var v=[],w=[],y=[],x=0;x<h;x++){for(var _=x+1,b=c[x],E=c[x+1],D=b;D<E;D++){var A=s[D];w[A]=u[D],y[A]=_}for(var S=0;S<m;S++)x===0&&(v[S]=[]),y[S]===_?v[S][x]=l?g(a,w[S]):g(w[S],a):v[S][x]=l?g(a,0):g(0,a)}return new t({data:v,size:[m,h],datatype:d})}});var Jz="matAlgo14xDs",Yz=["typed"],Or=N(Jz,Yz,r=>{var{typed:e}=r;return function(i,a,o,l){var u=i._data,s=i._size,c=i._datatype,f,p=o;typeof c=="string"&&(f=c,a=e.convert(a,f),p=e.find(o,[f,f]));var m=s.length>0?t(p,0,s,s[0],u,a,l):[];return i.createDenseMatrix({data:m,size:et(s),datatype:f})};function t(n,i,a,o,l,u,s){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=s?n(u,l[f]):n(l[f],u);else for(var p=0;p<o;p++)c[p]=t(n,i+1,a,a[i+1],l[p],u,s);return c}});var ty="ceil",Xz=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Qz=N(ty,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(ty,{number:function(a){return Pr(a,n(a),t.epsilon)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Pr(a,n(a,o),t.epsilon))return n(a,o);var[l,u]="".concat(a,"e").split("e"),s=Math.ceil(Number("".concat(l,"e").concat(Number(u)+o)));return[l,u]="".concat(s,"e").split("e"),Number("".concat(l,"e").concat(Number(u)-o))}})}),ry=N(ty,Xz,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=r,u=Yt({typed:e,equalScalar:a}),s=qt({typed:e,DenseMatrix:l}),c=Or({typed:e}),f=Qz({typed:e,config:t,round:n});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.ceil()},"Complex, number":function(m,h){return m.ceil(h)},"Complex, BigNumber":function(m,h){return m.ceil(h.toNumber())},BigNumber:function(m){return nn(m,n(m),t.epsilon)?n(m):m.ceil()},"BigNumber, BigNumber":function(m,h){return nn(m,n(m,h),t.epsilon)?n(m,h):m.toDecimalPlaces(h.toNumber(),rs.ROUND_CEIL)},Fraction:function(m){return m.ceil()},"Fraction, number":function(m,h){return m.ceil(h)},"Fraction, BigNumber":function(m,h){return m.ceil(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>Je(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>u(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var DC="cube",Kz=["typed"],ny=N(DC,Kz,r=>{var{typed:e}=r;return e(DC,{number:Rg,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var NC="exp",eH=["typed"],iy=N(NC,eH,r=>{var{typed:e}=r;return e(NC,{number:Lg,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var CC="expm1",tH=["typed","Complex"],ay=N(CC,tH,r=>{var{typed:e,Complex:t}=r;return e(CC,{number:Ug,Complex:function(i){var a=Math.exp(i.re);return new t(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var oy="fix",rH=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],nH=N(oy,["typed","ceil","floor"],r=>{var{typed:e,ceil:t,floor:n}=r;return e(oy,{number:function(a){return a>0?n(a):t(a)},"number, number":function(a,o){return a>0?n(a,o):t(a,o)}})}),sy=N(oy,rH,r=>{var{typed:e,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:l,DenseMatrix:u}=r,s=qt({typed:e,DenseMatrix:u}),c=Or({typed:e}),f=nH({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(m){return new t(m.re>0?Math.floor(m.re):Math.ceil(m.re),m.im>0?Math.floor(m.im):Math.ceil(m.im))},"Complex, number":function(m,h){return new t(m.re>0?a(m.re,h):i(m.re,h),m.im>0?a(m.im,h):i(m.im,h))},"Complex, BigNumber":function(m,h){var d=h.toNumber();return new t(m.re>0?a(m.re,d):i(m.re,d),m.im>0?a(m.im,d):i(m.im,d))},BigNumber:function(m){return m.isNegative()?i(m):a(m)},"BigNumber, number | BigNumber":function(m,h){return m.isNegative()?i(m,h):a(m,h)},Fraction:function(m){return m.s<0?m.ceil():m.floor()},"Fraction, number | BigNumber":function(m,h){return m.s<0?i(m,h):a(m,h)},"Array | Matrix":e.referToSelf(p=>m=>Je(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(m,d=>p(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(n(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>o(m,0)?l(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var uy="floor",iH=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],aH=N(uy,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(uy,{number:function(a){return Pr(a,n(a),t.epsilon)?n(a):Math.floor(a)},"number, number":function(a,o){if(Pr(a,n(a,o),t.epsilon))return n(a,o);var[l,u]="".concat(a,"e").split("e"),s=Math.floor(Number("".concat(l,"e").concat(Number(u)+o)));return[l,u]="".concat(s,"e").split("e"),Number("".concat(l,"e").concat(Number(u)-o))}})}),yl=N(uy,iH,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}=r,u=Yt({typed:e,equalScalar:a}),s=qt({typed:e,DenseMatrix:l}),c=Or({typed:e}),f=aH({typed:e,config:t,round:n});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.floor()},"Complex, number":function(m,h){return m.floor(h)},"Complex, BigNumber":function(m,h){return m.floor(h.toNumber())},BigNumber:function(m){return nn(m,n(m),t.epsilon)?n(m):m.floor()},"BigNumber, BigNumber":function(m,h){return nn(m,n(m,h),t.epsilon)?n(m,h):m.toDecimalPlaces(h.toNumber(),rs.ROUND_FLOOR)},Fraction:function(m){return m.floor()},"Fraction, number":function(m,h){return m.floor(h)},"Fraction, BigNumber":function(m,h){return m.floor(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>Je(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>Je(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>u(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):s(h,m,p,!0))})});var oH="matAlgo02xDS0",sH=["typed","equalScalar"],kr=N(oH,sH,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o,l){var u=i._data,s=i._size,c=i._datatype,f=a._values,p=a._index,m=a._ptr,h=a._size,d=a._datatype;if(s.length!==h.length)throw new st(s.length,h.length);if(s[0]!==h[0]||s[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=s[0],v=s[1],w,y=t,x=0,_=o;typeof c=="string"&&c===d&&(w=c,y=e.find(t,[w,w]),x=e.convert(0,w),_=e.find(o,[w,w]));for(var b=[],E=[],D=[],A=0;A<v;A++){D[A]=E.length;for(var S=m[A],M=m[A+1],F=S;F<M;F++){var P=p[F],R=l?_(f[F],u[P][A]):_(u[P][A],f[F]);y(R,x)||(E.push(P),b.push(R))}}return D[v]=E.length,a.createSparseMatrix({values:b,index:E,ptr:D,size:[g,v],datatype:w})}});var uH="matAlgo03xDSf",lH=["typed"],sr=N(uH,lH,r=>{var{typed:e}=r;return function(n,i,a,o){var l=n._data,u=n._size,s=n._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new st(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],v,w=0,y=a;typeof s=="string"&&s===h&&(v=s,w=e.convert(0,v),y=e.find(a,[v,v]));for(var x=[],_=0;_<d;_++)x[_]=[];for(var b=[],E=[],D=0;D<g;D++){for(var A=D+1,S=p[D],M=p[D+1],F=S;F<M;F++){var P=f[F];b[P]=o?y(c[F],l[P][D]):y(l[P][D],c[F]),E[P]=A}for(var R=0;R<d;R++)E[R]===A?x[R][D]=b[R]:x[R][D]=o?y(w,l[R][D]):y(l[R][D],w)}return n.createDenseMatrix({data:x,size:[d,g],datatype:v})}});var cH="matAlgo05xSfSf",fH=["typed","equalScalar"],so=N(cH,fH,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new st(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var E=l&&p?[]:void 0,D=[],A=[],S=E?[]:void 0,M=E?[]:void 0,F=[],P=[],R,O,I,T;for(O=0;O<w;O++){A[O]=D.length;var $=O+1;for(I=s[O],T=s[O+1];I<T;I++)R=u[I],D.push(R),F[R]=$,S&&(S[R]=l[I]);for(I=h[O],T=h[O+1];I<T;I++)R=m[I],F[R]!==$&&D.push(R),P[R]=$,M&&(M[R]=p[I]);if(E)for(I=A[O];I<D.length;){R=D[I];var B=F[R],U=P[R];if(B===$||U===$){var G=B===$?S[R]:_,H=U===$?M[R]:_,L=b(G,H);x(L,_)?D.splice(I,1):(E.push(L),I++)}}}return A[w]=D.length,i.createSparseMatrix({values:E,index:D,ptr:A,size:[v,w],datatype:y})}});var pH="matAlgo13xDD",mH=["typed"],MC=N(pH,mH,r=>{var{typed:e}=r;return function(i,a,o){var l=i._data,u=i._size,s=i._datatype,c=a._data,f=a._size,p=a._datatype,m=[];if(u.length!==f.length)throw new st(u.length,f.length);for(var h=0;h<u.length;h++){if(u[h]!==f[h])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");m[h]=u[h]}var d,g=o;typeof s=="string"&&s===p&&(d=s,g=e.find(o,[d,d]));var v=m.length>0?t(g,0,m,m[0],l,c):[];return i.createDenseMatrix({data:v,size:m,datatype:d})};function t(n,i,a,o,l,u){var s=[];if(i===a.length-1)for(var c=0;c<o;c++)s[c]=n(l[c],u[c]);else for(var f=0;f<o;f++)s[f]=t(n,i+1,a,a[i+1],l[f],u[f]);return s}});var dH="broadcast",hH=["concat"],TC=N(dH,hH,r=>{var{concat:e}=r;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((h,d)=>h===a._size[d]))return[i,a];for(var l=t(i._size,o,0),u=t(a._size,o,0),s=[],c=0;c<o;c++)s[c]=Math.max(l[c],u[c]);pl(l,s),pl(u,s);var f=i.clone(),p=a.clone();f._size.length<o?f.reshape(t(f._size,o,1)):p._size.length<o&&p.reshape(t(p._size,o,1));for(var m=0;m<o;m++)f._size[m]<s[m]&&(f=n(f,s[m],m)),p._size[m]<s[m]&&(p=n(p,s[m],m));return[f,p]};function t(i,a,o){return[...Array(a-i.length).fill(o),...i]}function n(i,a,o){return e(...Array(a).fill(i),o)}});var gH="matrixAlgorithmSuite",vH=["typed","matrix","concat"],ct=N(gH,vH,r=>{var{typed:e,matrix:t,concat:n}=r,i=MC({typed:e}),a=Or({typed:e}),o=TC({concat:n});return function(u){var s=u.elop,c=u.SD||u.DS,f;s?(f={"DenseMatrix, DenseMatrix":(d,g)=>i(...o(d,g),s),"Array, Array":(d,g)=>i(...o(t(d),t(g)),s).valueOf(),"Array, DenseMatrix":(d,g)=>i(...o(t(d),g),s),"DenseMatrix, Array":(d,g)=>i(...o(d,t(g)),s)},u.SS&&(f["SparseMatrix, SparseMatrix"]=(d,g)=>u.SS(...o(d,g),s,!1)),u.DS&&(f["DenseMatrix, SparseMatrix"]=(d,g)=>u.DS(...o(d,g),s,!1),f["Array, SparseMatrix"]=(d,g)=>u.DS(...o(t(d),g),s,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(d,g)=>c(...o(g,d),s,!0),f["SparseMatrix, Array"]=(d,g)=>c(...o(t(g),d),s,!0))):(f={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,v)=>i(...o(g,v),d)),"Array, Array":e.referToSelf(d=>(g,v)=>i(...o(t(g),t(v)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,v)=>i(...o(t(g),v),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,v)=>i(...o(g,t(v)),d))},u.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.SS(...o(g,v),d,!1))),u.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.DS(...o(g,v),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(g,v)=>u.DS(...o(t(g),v),d,!1))),c&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,v)=>c(...o(v,g),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(g,v)=>c(...o(t(v),g),d,!0))));var p=u.scalar||"any",m=u.Ds||u.Ss;m&&(s?(f["DenseMatrix,"+p]=(d,g)=>a(d,g,s,!1),f[p+", DenseMatrix"]=(d,g)=>a(g,d,s,!0),f["Array,"+p]=(d,g)=>a(t(d),g,s,!1).valueOf(),f[p+", Array"]=(d,g)=>a(t(g),d,s,!0).valueOf()):(f["DenseMatrix,"+p]=e.referToSelf(d=>(g,v)=>a(g,v,d,!1)),f[p+", DenseMatrix"]=e.referToSelf(d=>(g,v)=>a(v,g,d,!0)),f["Array,"+p]=e.referToSelf(d=>(g,v)=>a(t(g),v,d,!1).valueOf()),f[p+", Array"]=e.referToSelf(d=>(g,v)=>a(t(v),g,d,!0).valueOf())));var h=u.sS!==void 0?u.sS:u.Ss;return s?(u.Ss&&(f["SparseMatrix,"+p]=(d,g)=>u.Ss(d,g,s,!1)),h&&(f[p+", SparseMatrix"]=(d,g)=>h(g,d,s,!0))):(u.Ss&&(f["SparseMatrix,"+p]=e.referToSelf(d=>(g,v)=>u.Ss(g,v,d,!1))),h&&(f[p+", SparseMatrix"]=e.referToSelf(d=>(g,v)=>h(v,g,d,!0)))),s&&s.signatures&&pp(f,s.signatures),f}});var FC="mod",yH=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],bl=N(FC,yH,r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}=r,s=yl({typed:e,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:l}),c=kr({typed:e,equalScalar:a}),f=sr({typed:e}),p=so({typed:e,equalScalar:a}),m=Yt({typed:e,equalScalar:a}),h=qt({typed:e,DenseMatrix:l}),d=ct({typed:e,matrix:i,concat:u});return e(FC,{"number, number":g,"BigNumber, BigNumber":function(w,y){return y.isZero()?w:w.sub(y.mul(s(w.div(y))))},"Fraction, Fraction":function(w,y){return y.equals(0)?w:w.sub(y.mul(s(w.div(y))))}},d({SS:p,DS:f,SD:c,Ss:m,sS:h}));function g(v,w){return w===0?v:v-w*s(v/w)}});var bH="matAlgo01xDSid",xH=["typed"],xn=N(bH,xH,r=>{var{typed:e}=r;return function(n,i,a,o){var l=n._data,u=n._size,s=n._datatype,c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype;if(u.length!==m.length)throw new st(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],v=typeof s=="string"&&s===h?s:void 0,w=v?e.find(a,[v,v]):a,y,x,_=[];for(y=0;y<d;y++)_[y]=[];var b=[],E=[];for(x=0;x<g;x++){for(var D=x+1,A=p[x],S=p[x+1],M=A;M<S;M++)y=f[M],b[y]=o?w(c[M],l[y][x]):w(l[y][x],c[M]),E[y]=D;for(y=0;y<d;y++)E[y]===D?_[y][x]=b[y]:_[y][x]=l[y][x]}return n.createDenseMatrix({data:_,size:[d,g],datatype:v})}});var wH="matAlgo04xSidSid",_H=["typed","equalScalar"],fu=N(wH,_H,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new st(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var E=l&&p?[]:void 0,D=[],A=[],S=l&&p?[]:void 0,M=l&&p?[]:void 0,F=[],P=[],R,O,I,T,$;for(O=0;O<w;O++){A[O]=D.length;var B=O+1;for(T=s[O],$=s[O+1],I=T;I<$;I++)R=u[I],D.push(R),F[R]=B,S&&(S[R]=l[I]);for(T=h[O],$=h[O+1],I=T;I<$;I++)if(R=m[I],F[R]===B){if(S){var U=b(S[R],p[I]);x(U,_)?F[R]=null:S[R]=U}}else D.push(R),P[R]=B,M&&(M[R]=p[I]);if(S&&M)for(I=A[O];I<D.length;)R=D[I],F[R]===B?(E[I]=S[R],I++):P[R]===B?(E[I]=M[R],I++):D.splice(I,1)}return A[w]=D.length,i.createSparseMatrix({values:E,index:D,ptr:A,size:[v,w],datatype:y})}});var AH="matAlgo10xSids",SH=["typed","DenseMatrix"],Vn=N(AH,SH,r=>{var{typed:e,DenseMatrix:t}=r;return function(i,a,o,l){var u=i._values,s=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!u)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var v=[],w=[],y=[],x=0;x<h;x++){for(var _=x+1,b=c[x],E=c[x+1],D=b;D<E;D++){var A=s[D];w[A]=u[D],y[A]=_}for(var S=0;S<m;S++)x===0&&(v[S]=[]),y[S]===_?v[S][x]=l?g(a,w[S]):g(w[S],a):v[S][x]=a}return new t({data:v,size:[m,h],datatype:d})}});function _a(r,e,t,n){if(!(this instanceof _a))throw new SyntaxError("Constructor must be called with the new operator");this.fn=r,this.count=e,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+r+" ("+e+" provided, "+t+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}_a.prototype=new Error;_a.prototype.constructor=Error;_a.prototype.name="ArgumentsError";_a.prototype.isArgumentsError=!0;var IC="gcd",EH=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],ly="number | BigNumber | Fraction | Matrix | Array",DH="".concat(ly,", ").concat(ly,", ...").concat(ly);function BC(r){return!r.some(e=>Array.isArray(e))}var cy=N(IC,EH,r=>{var{typed:e,matrix:t,config:n,round:i,equalScalar:a,zeros:o,BigNumber:l,DenseMatrix:u,concat:s}=r,c=bl({typed:e,config:n,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:u,concat:s}),f=xn({typed:e}),p=fu({typed:e,equalScalar:a}),m=Vn({typed:e,DenseMatrix:u}),h=ct({typed:e,matrix:t,concat:s});return e(IC,{"number, number":d,"BigNumber, BigNumber":g,"Fraction, Fraction":(v,w)=>v.gcd(w)},h({SS:p,DS:f,Ss:m}),{[DH]:e.referToSelf(v=>(w,y,x)=>{for(var _=v(w,y),b=0;b<x.length;b++)_=v(_,x[b]);return _}),Array:e.referToSelf(v=>w=>{if(w.length===1&&Array.isArray(w[0])&&BC(w[0]))return v(...w[0]);if(BC(w))return v(...w);throw new _a("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(v=>w=>v(w.toArray()))});function d(v,w){if(!ze(v)||!ze(w))throw new Error("Parameters in function gcd must be integer numbers");for(var y;w!==0;)y=c(v,w),v=w,w=y;return v<0?-v:v}function g(v,w){if(!v.isInt()||!w.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var y=new l(0);!w.isZero();){var x=c(v,w);v=w,w=x}return v.lt(y)?v.neg():v}});var NH="matAlgo06xS0S0",CH=["typed","equalScalar"],uo=N(NH,CH,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var l=i._values,u=i._size,s=i._datatype,c=a._values,f=a._size,p=a._datatype;if(u.length!==f.length)throw new st(u.length,f.length);if(u[0]!==f[0]||u[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");var m=u[0],h=u[1],d,g=t,v=0,w=o;typeof s=="string"&&s===p&&(d=s,g=e.find(t,[d,d]),v=e.convert(0,d),w=e.find(o,[d,d]));for(var y=l&&c?[]:void 0,x=[],_=[],b=y?[]:void 0,E=[],D=[],A=0;A<h;A++){_[A]=x.length;var S=A+1;if(Mg(i,A,E,b,D,S,x,w),Mg(a,A,E,b,D,S,x,w),b)for(var M=_[A];M<x.length;){var F=x[M];if(D[F]===S){var P=b[F];g(P,v)?x.splice(M,1):(y.push(P),M++)}else x.splice(M,1)}else for(var R=_[A];R<x.length;){var O=x[R];D[O]!==S?x.splice(R,1):R++}}return _[h]=x.length,i.createSparseMatrix({values:y,index:x,ptr:_,size:[m,h],datatype:d})}});var PC="lcm",MH=["typed","matrix","equalScalar","concat"],fy=N(PC,MH,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=kr({typed:e,equalScalar:n}),o=uo({typed:e,equalScalar:n}),l=Yt({typed:e,equalScalar:n}),u=ct({typed:e,matrix:t,concat:i}),s="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(s,", ").concat(s,", ...").concat(s)]=e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),v=0;v<d.length;v++)g=p(g,d[v]);return g}),e(PC,{"number, number":Vg,"BigNumber, BigNumber":f,"Fraction, Fraction":(p,m)=>p.lcm(m)},u({SS:o,DS:a,Ss:l}),c);function f(p,m){if(!p.isInt()||!m.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(p.isZero())return p;if(m.isZero())return m;for(var h=p.times(m);!m.isZero();){var d=m;m=p.mod(d),p=d}return h.div(p).abs()}});var OC="log10",TH=["typed","config","Complex"],py=N(OC,TH,r=>{var{typed:e,config:t,Complex:n}=r;return e(OC,{number:function(a){return a>=0||t.predictable?$g(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>Je(a,i))})});var kC="log2",FH=["typed","config","Complex"],my=N(kC,FH,r=>{var{typed:e,config:t,Complex:n}=r;return e(kC,{number:function(o){return o>=0||t.predictable?qg(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>Je(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var IH="multiplyScalar",BH=["typed"],dy=N(IH,BH,r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":Pg,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,n)=>n.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,n)=>t.multiply(n)})});var RC="multiply",PH=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],hy=N(RC,PH,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=r,l=Yt({typed:e,equalScalar:a}),u=Or({typed:e});function s(_,b){switch(_.length){case 1:switch(b.length){case 1:if(_[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(_[0]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+_[0]+") must match Matrix rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;case 2:switch(b.length){case 1:if(_[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+_[1]+") must match Vector length ("+b[0]+")");break;case 2:if(_[1]!==b[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+_[1]+") must match Matrix B rows ("+b[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+b.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+_.length+" dimensions)")}}function c(_,b,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(_,b)}function f(_,b){if(b.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(_,b)}function p(_,b){var E=_._data,D=_._size,A=_._datatype,S=b._data,M=b._size,F=b._datatype,P=D[0],R=M[1],O,I=n,T=i;A&&F&&A===F&&typeof A=="string"&&(O=A,I=e.find(n,[O,O]),T=e.find(i,[O,O]));for(var $=[],B=0;B<R;B++){for(var U=T(E[0],S[0][B]),G=1;G<P;G++)U=I(U,T(E[G],S[G][B]));$[B]=U}return _.createDenseMatrix({data:$,size:[R],datatype:O})}var m=e("_multiplyMatrixVector",{"DenseMatrix, any":d,"SparseMatrix, any":w}),h=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":v,"SparseMatrix, DenseMatrix":y,"SparseMatrix, SparseMatrix":x});function d(_,b){var E=_._data,D=_._size,A=_._datatype,S=b._data,M=b._datatype,F=D[0],P=D[1],R,O=n,I=i;A&&M&&A===M&&typeof A=="string"&&(R=A,O=e.find(n,[R,R]),I=e.find(i,[R,R]));for(var T=[],$=0;$<F;$++){for(var B=E[$],U=I(B[0],S[0]),G=1;G<P;G++)U=O(U,I(B[G],S[G]));T[$]=U}return _.createDenseMatrix({data:T,size:[F],datatype:R})}function g(_,b){var E=_._data,D=_._size,A=_._datatype,S=b._data,M=b._size,F=b._datatype,P=D[0],R=D[1],O=M[1],I,T=n,$=i;A&&F&&A===F&&typeof A=="string"&&(I=A,T=e.find(n,[I,I]),$=e.find(i,[I,I]));for(var B=[],U=0;U<P;U++){var G=E[U];B[U]=[];for(var H=0;H<O;H++){for(var L=$(G[0],S[0][H]),ae=1;ae<R;ae++)L=T(L,$(G[ae],S[ae][H]));B[U][H]=L}}return _.createDenseMatrix({data:B,size:[P,O],datatype:I})}function v(_,b){var E=_._data,D=_._size,A=_._datatype,S=b._values,M=b._index,F=b._ptr,P=b._size,R=b._datatype;if(!S)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var O=D[0],I=P[1],T,$=n,B=i,U=a,G=0;A&&R&&A===R&&typeof A=="string"&&(T=A,$=e.find(n,[T,T]),B=e.find(i,[T,T]),U=e.find(a,[T,T]),G=e.convert(0,T));for(var H=[],L=[],ae=[],ve=b.createSparseMatrix({values:H,index:L,ptr:ae,size:[O,I],datatype:T}),se=0;se<I;se++){ae[se]=L.length;var le=F[se],he=F[se+1];if(he>le)for(var K=0,ne=0;ne<O;ne++){for(var me=ne+1,de=void 0,Oe=le;Oe<he;Oe++){var Se=M[Oe];K!==me?(de=B(E[ne][Se],S[Oe]),K=me):de=$(de,B(E[ne][Se],S[Oe]))}K===me&&!U(de,G)&&(L.push(ne),H.push(de))}}return ae[I]=L.length,ve}function w(_,b){var E=_._values,D=_._index,A=_._ptr,S=_._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=b._data,F=b._datatype,P=_._size[0],R=b._size[0],O=[],I=[],T=[],$,B=n,U=i,G=a,H=0;S&&F&&S===F&&typeof S=="string"&&($=S,B=e.find(n,[$,$]),U=e.find(i,[$,$]),G=e.find(a,[$,$]),H=e.convert(0,$));var L=[],ae=[];T[0]=0;for(var ve=0;ve<R;ve++){var se=M[ve];if(!G(se,H))for(var le=A[ve],he=A[ve+1],K=le;K<he;K++){var ne=D[K];ae[ne]?L[ne]=B(L[ne],U(se,E[K])):(ae[ne]=!0,I.push(ne),L[ne]=U(se,E[K]))}}for(var me=I.length,de=0;de<me;de++){var Oe=I[de];O[de]=L[Oe]}return T[1]=I.length,_.createSparseMatrix({values:O,index:I,ptr:T,size:[P,1],datatype:$})}function y(_,b){var E=_._values,D=_._index,A=_._ptr,S=_._datatype;if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var M=b._data,F=b._datatype,P=_._size[0],R=b._size[0],O=b._size[1],I,T=n,$=i,B=a,U=0;S&&F&&S===F&&typeof S=="string"&&(I=S,T=e.find(n,[I,I]),$=e.find(i,[I,I]),B=e.find(a,[I,I]),U=e.convert(0,I));for(var G=[],H=[],L=[],ae=_.createSparseMatrix({values:G,index:H,ptr:L,size:[P,O],datatype:I}),ve=[],se=[],le=0;le<O;le++){L[le]=H.length;for(var he=le+1,K=0;K<R;K++){var ne=M[K][le];if(!B(ne,U))for(var me=A[K],de=A[K+1],Oe=me;Oe<de;Oe++){var Se=D[Oe];se[Se]!==he?(se[Se]=he,H.push(Se),ve[Se]=$(ne,E[Oe])):ve[Se]=T(ve[Se],$(ne,E[Oe]))}}for(var V=L[le],X=H.length,fe=V;fe<X;fe++){var W=H[fe];G[fe]=ve[W]}}return L[O]=H.length,ae}function x(_,b){var E=_._values,D=_._index,A=_._ptr,S=_._datatype,M=b._values,F=b._index,P=b._ptr,R=b._datatype,O=_._size[0],I=b._size[1],T=E&&M,$,B=n,U=i;S&&R&&S===R&&typeof S=="string"&&($=S,B=e.find(n,[$,$]),U=e.find(i,[$,$]));for(var G=T?[]:void 0,H=[],L=[],ae=_.createSparseMatrix({values:G,index:H,ptr:L,size:[O,I],datatype:$}),ve=T?[]:void 0,se=[],le,he,K,ne,me,de,Oe,Se,V=0;V<I;V++){L[V]=H.length;var X=V+1;for(me=P[V],de=P[V+1],ne=me;ne<de;ne++)if(Se=F[ne],T)for(he=A[Se],K=A[Se+1],le=he;le<K;le++)Oe=D[le],se[Oe]!==X?(se[Oe]=X,H.push(Oe),ve[Oe]=U(M[ne],E[le])):ve[Oe]=B(ve[Oe],U(M[ne],E[le]));else for(he=A[Se],K=A[Se+1],le=he;le<K;le++)Oe=D[le],se[Oe]!==X&&(se[Oe]=X,H.push(Oe));if(T)for(var fe=L[V],W=H.length,te=fe;te<W;te++){var ie=H[te];G[te]=ve[ie]}}return L[I]=H.length,ae}return e(RC,i,{"Array, Array":e.referTo("Matrix, Matrix",_=>(b,E)=>{s(nt(b),nt(E));var D=_(t(b),t(E));return Ge(D)?D.valueOf():D}),"Matrix, Matrix":function(b,E){var D=b.size(),A=E.size();return s(D,A),D.length===1?A.length===1?c(b,E,D[0]):f(b,E):A.length===1?m(b,E):h(b,E)},"Matrix, Array":e.referTo("Matrix,Matrix",_=>(b,E)=>_(b,t(E))),"Array, Matrix":e.referToSelf(_=>(b,E)=>_(t(b,E.storage()),E)),"SparseMatrix, any":function(b,E){return l(b,E,i,!1)},"DenseMatrix, any":function(b,E){return u(b,E,i,!1)},"any, SparseMatrix":function(b,E){return l(E,b,i,!0)},"any, DenseMatrix":function(b,E){return u(E,b,i,!0)},"Array, any":function(b,E){return u(t(b),E,i,!1).valueOf()},"any, Array":function(b,E){return u(t(E),b,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(_=>(b,E,D)=>{for(var A=_(b,E),S=0;S<D.length;S++)A=_(A,D[S]);return A})})});var LC="nthRoot",OH=["typed","matrix","equalScalar","BigNumber","concat"],gy=N(LC,OH,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,concat:a}=r,o=xn({typed:e}),l=kr({typed:e,equalScalar:n}),u=uo({typed:e,equalScalar:n}),s=Yt({typed:e,equalScalar:n}),c=ct({typed:e,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(LC,{number:zg,"number, number":zg,BigNumber:m=>p(m,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",m=>h=>m(t(h),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",m=>h=>m(h,2)),SparseMatrix:e.referTo("SparseMatrix,number",m=>h=>m(h,2)),"SparseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return u(h,d,m);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return o(h,d,m,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",m=>(h,d)=>m(t(h),d)),"number | BigNumber, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return s(d,h,m,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:l,Ss:s,sS:!1}));function p(m,h){var d=i.precision,g=i.clone({precision:d+2}),v=new i(0),w=new g(1),y=h.isNegative();if(y&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(m.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(m.isZero())return y?new g(1/0):0;if(!m.isFinite())return y?v:m;var x=m.abs().pow(w.div(h));return x=m.isNeg()?x.neg():x,new i((y?w.div(x):x).toPrecision(d))}});var UC="sign",kH=["typed","BigNumber","Fraction","complex"],vy=N(UC,kH,r=>{var{typed:e,BigNumber:t,complex:n,Fraction:i}=r;return e(UC,{number:Bp,Complex:function(o){return o.im===0?n(Bp(o.re)):o.sign()},BigNumber:function(o){return new t(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":e.referToSelf(a=>o=>Je(o,a,!0)),Unit:e.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return e.find(a,o.valueType())(o.value)})})});var RH="sqrt",LH=["config","typed","Complex"],yy=N(RH,LH,r=>{var{config:e,typed:t,Complex:n}=r;return t("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var VC="square",UH=["typed"],by=N(VC,UH,r=>{var{typed:e}=r;return e(VC,{number:Hg,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var $C="subtract",VH=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],xy=N($C,VH,r=>{var{typed:e,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:l}=r,u=xn({typed:e}),s=sr({typed:e}),c=so({typed:e,equalScalar:n}),f=Vn({typed:e,DenseMatrix:o}),p=qt({typed:e,DenseMatrix:o}),m=ct({typed:e,matrix:t,concat:l});return e($C,{"any, any":i},m({elop:i,SS:c,DS:u,SD:s,Ss:p,sS:f}))});var qC="xgcd",$H=["typed","config","matrix","BigNumber"],wy=N(qC,$H,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(qC,{"number, number":function(l,u){var s=Gg(l,u);return t.matrix==="Array"?s:n(s)},"BigNumber, BigNumber":a});function a(o,l){var u,s,c,f=new i(0),p=new i(1),m=f,h=p,d=p,g=f;if(!o.isInt()||!l.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!l.isZero();)s=o.div(l).floor(),c=o.mod(l),u=m,m=h.minus(s.times(m)),h=u,u=d,d=g.minus(s.times(d)),g=u,o=l,l=c;var v;return o.lt(f)?v=[o.neg(),h.neg(),g.neg()]:v=[o,o.isZero()?0:h,g],t.matrix==="Array"?v:n(v)}});var zC="invmod",qH=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],_y=N(zC,qH,r=>{var{typed:e,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:l,add:u,isInteger:s}=r;return e(zC,{"number, number":c,"BigNumber, BigNumber":c});function c(f,p){if(!s(f)||!s(p))throw new Error("Parameters in function invmod must be integer numbers");if(f=l(f,p),a(p,0))throw new Error("Divisor must be non zero");var m=i(f,p);m=m.valueOf();var[h,d]=m;return a(h,n(1))?(d=l(d,p),o(d,n(0))&&(d=u(d,p)),d):NaN}});var zH="matAlgo09xS0Sf",HH=["typed","equalScalar"],kp=N(zH,HH,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new st(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));var E=l&&p?[]:void 0,D=[],A=[],S=E?[]:void 0,M=[],F,P,R,O,I;for(P=0;P<w;P++){A[P]=D.length;var T=P+1;if(S)for(O=h[P],I=h[P+1],R=O;R<I;R++)F=m[R],M[F]=T,S[F]=p[R];for(O=s[P],I=s[P+1],R=O;R<I;R++)if(F=u[R],S){var $=M[F]===T?S[F]:_,B=b(l[R],$);x(B,_)||(D.push(F),E.push(B))}else D.push(F)}return A[w]=D.length,i.createSparseMatrix({values:E,index:D,ptr:A,size:[v,w],datatype:y})}});var HC="dotMultiply",GH=["typed","matrix","equalScalar","multiplyScalar","concat"],Ay=N(HC,GH,r=>{var{typed:e,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=r,o=kr({typed:e,equalScalar:n}),l=kp({typed:e,equalScalar:n}),u=Yt({typed:e,equalScalar:n}),s=ct({typed:e,matrix:t,concat:a});return e(HC,s({elop:i,SS:l,DS:o,Ss:u}))});function GC(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero()||e.eq(-1)||r.eq(e))return r;if(e.isZero()||r.eq(-1))return e;if(!r.isFinite()||!e.isFinite()){if(!r.isFinite()&&!e.isFinite())return r.isNegative()===e.isNegative()?r:new t(0);if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e;if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r}return Sy(r,e,function(n,i){return n&i})}function pu(r){if(r.isFinite()&&!r.isInteger())throw new Error("Integer expected in function bitNot");var e=r.constructor,t=e.precision;e.config({precision:1e9});var n=r.plus(new e(1));return n.s=-n.s||null,e.config({precision:t}),n}function WC(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);var n=new t(-1);return r.isZero()||e.eq(n)||r.eq(e)?e:e.isZero()||r.eq(n)?r:!r.isFinite()||!e.isFinite()?!r.isFinite()&&!r.isNegative()&&e.isNegative()||r.isNegative()&&!e.isNegative()&&!e.isFinite()?n:r.isNegative()&&e.isNegative()?r.isFinite()?r:e:r.isFinite()?e:r:Sy(r,e,function(i,a){return i|a})}function Sy(r,e,t){var n=r.constructor,i,a,o=+(r.s<0),l=+(e.s<0);if(o){i=Rp(pu(r));for(var u=0;u<i.length;++u)i[u]^=1}else i=Rp(r);if(l){a=Rp(pu(e));for(var s=0;s<a.length;++s)a[s]^=1}else a=Rp(e);var c,f,p;i.length<=a.length?(c=i,f=a,p=o):(c=a,f=i,p=l);var m=c.length,h=f.length,d=t(o,l)^1,g=new n(d^1),v=new n(1),w=new n(2),y=n.precision;for(n.config({precision:1e9});m>0;)t(c[--m],f[--h])===d&&(g=g.plus(v)),v=v.times(w);for(;h>0;)t(p,f[--h])===d&&(g=g.plus(v)),v=v.times(w);return n.config({precision:y}),d===0&&(g.s=-g.s),g}function Rp(r){for(var e=r.d,t=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;t.charAt(o)==="0";)o--;var l=r.e,u=t.slice(0,o+1||1),s=u.length;if(l>0)if(++l>s)for(l-=s;l--;)u+="0";else l<s&&(u=u.slice(0,l)+"."+u.slice(l));for(var c=[0],f=0;f<u.length;){for(var p=c.length;p--;)c[p]*=10;c[0]+=parseInt(u.charAt(f++));for(var m=0;m<c.length;++m)c[m]>1&&((c[m+1]===null||c[m+1]===void 0)&&(c[m+1]=0),c[m+1]+=c[m]>>1,c[m]&=1)}return c.reverse()}function jC(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero())return e;if(e.isZero())return r;if(r.eq(e))return new t(0);var n=new t(-1);return r.eq(n)?pu(e):e.eq(n)?pu(r):!r.isFinite()||!e.isFinite()?!r.isFinite()&&!e.isFinite()?n:new t(r.isNegative()===e.isNegative()?1/0:-1/0):Sy(r,e,function(i,a){return i^a})}function ZC(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:!r.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?r.times(Math.pow(2,e.toNumber())+""):r.times(new t(2).pow(e))}function JC(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:e.isFinite()?e.lt(55)?r.div(Math.pow(2,e.toNumber())+"").floor():r.div(new t(2).pow(e)).floor():r.isNegative()?new t(-1):r.isFinite()?new t(0):new t(NaN)}var YC="bitAnd",WH=["typed","matrix","equalScalar","concat"],xl=N(YC,WH,r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,a=kr({typed:e,equalScalar:n}),o=uo({typed:e,equalScalar:n}),l=Yt({typed:e,equalScalar:n}),u=ct({typed:e,matrix:t,concat:i});return e(YC,{"number, number":Zg,"BigNumber, BigNumber":GC},u({SS:o,DS:a,Ss:l}))});var XC="bitNot",jH=["typed"],Ey=N(XC,jH,r=>{var{typed:e}=r;return e(XC,{number:Jg,BigNumber:pu,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var QC="bitOr",ZH=["typed","matrix","equalScalar","DenseMatrix","concat"],wl=N(QC,ZH,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=xn({typed:e}),l=fu({typed:e,equalScalar:n}),u=Vn({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(QC,{"number, number":Yg,"BigNumber, BigNumber":WC},s({SS:l,DS:o,Ss:u}))});var JH="matAlgo07xSSf",YH=["typed","DenseMatrix"],zr=N(JH,YH,r=>{var{typed:e,DenseMatrix:t}=r;return function(a,o,l){var u=a._size,s=a._datatype,c=o._size,f=o._datatype;if(u.length!==c.length)throw new st(u.length,c.length);if(u[0]!==c[0]||u[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+c+")");var p=u[0],m=u[1],h,d=0,g=l;typeof s=="string"&&s===f&&(h=s,d=e.convert(0,h),g=e.find(l,[h,h]));var v,w,y=[];for(v=0;v<p;v++)y[v]=[];var x=[],_=[],b=[],E=[];for(w=0;w<m;w++){var D=w+1;for(n(a,w,b,x,D),n(o,w,E,_,D),v=0;v<p;v++){var A=b[v]===D?x[v]:d,S=E[v]===D?_[v]:d;y[v][w]=g(A,S)}}return new t({data:y,size:[p,m],datatype:h})};function n(i,a,o,l,u){for(var s=i._values,c=i._index,f=i._ptr,p=f[a],m=f[a+1];p<m;p++){var h=c[p];o[h]=u,l[h]=s[p]}}});var KC="bitXor",XH=["typed","matrix","DenseMatrix","concat"],Dy=N(KC,XH,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=sr({typed:e}),o=zr({typed:e,DenseMatrix:n}),l=qt({typed:e,DenseMatrix:n}),u=ct({typed:e,matrix:t,concat:i});return e(KC,{"number, number":Xg,"BigNumber, BigNumber":jC},u({SS:o,DS:a,Ss:l}))});var eM="arg",QH=["typed"],Ny=N(eM,QH,r=>{var{typed:e}=r;return e(eM,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var tM="conj",KH=["typed"],Cy=N(tM,KH,r=>{var{typed:e}=r;return e(tM,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var rM="im",eG=["typed"],My=N(rM,eG,r=>{var{typed:e}=r;return e(rM,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var nM="re",tG=["typed"],Ty=N(nM,tG,r=>{var{typed:e}=r;return e(nM,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var iM="not",rG=["typed"],Fy=N(iM,rG,r=>{var{typed:e}=r;return e(iM,{"null | undefined":()=>!0,number:nv,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},Unit:e.referToSelf(t=>n=>e.find(t,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var aM="or",nG=["typed","matrix","equalScalar","DenseMatrix","concat"],_l=N(aM,nG,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=so({typed:e,equalScalar:n}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(aM,{"number, number":iv,"Complex, Complex":function(f,p){return f.re!==0||f.im!==0||p.re!==0||p.im!==0},"BigNumber, BigNumber":function(f,p){return!f.isZero()&&!f.isNaN()||!p.isZero()&&!p.isNaN()},"Unit, Unit":e.referToSelf(c=>(f,p)=>c(f.value||0,p.value||0))},s({SS:l,DS:o,Ss:u}))});var oM="xor",iG=["typed","matrix","DenseMatrix","concat"],Iy=N(oM,iG,r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,a=sr({typed:e}),o=zr({typed:e,DenseMatrix:n}),l=qt({typed:e,DenseMatrix:n}),u=ct({typed:e,matrix:t,concat:i});return e(oM,{"number, number":av,"Complex, Complex":function(c,f){return(c.re!==0||c.im!==0)!=(f.re!==0||f.im!==0)},"BigNumber, BigNumber":function(c,f){return(!c.isZero()&&!c.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":e.referToSelf(s=>(c,f)=>s(c.value||0,f.value||0))},u({SS:o,DS:a,Ss:l}))});var sM="concat",aG=["typed","matrix","isInteger"],Al=N(sM,aG,r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(sM,{"...Array | Matrix | number | BigNumber":function(a){var o,l=a.length,u=-1,s,c=!1,f=[];for(o=0;o<l;o++){var p=a[o];if(Ge(p)&&(c=!0),it(p)||Xe(p)){if(o!==l-1)throw new Error("Dimension must be specified as last argument");if(s=u,u=p.valueOf(),!n(u))throw new TypeError("Integer number expected for dimension");if(u<0||o>0&&u>s)throw new pn(u,s+1)}else{var m=et(p).valueOf(),h=nt(m);if(f[o]=m,s=u,u=h.length-1,o>0&&u!==s)throw new st(s+1,u+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=og(d,f.shift(),u);return c?t(d):d},"...string":function(a){return a.join("")}})});var uM="column",oG=["typed","Index","matrix","range"],Sl=N(uM,oG,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(uM,{"Matrix, number":a,"Array, number":function(l,u){return a(n(et(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Jt(l,o.size()[1]);var u=i(0,o.size()[0]),s=new t(u,l),c=o.subset(s);return Ge(c)?c:n([[c]])}});var lM="count",sG=["typed","size","prod"],By=N(lM,sG,r=>{var{typed:e,size:t,prod:n}=r;return e(lM,{string:function(a){return a.length},"Matrix | Array":function(a){return n(t(a))}})});var cM="cross",uG=["typed","matrix","subtract","multiply"],Py=N(cM,uG,r=>{var{typed:e,matrix:t,subtract:n,multiply:i}=r;return e(cM,{"Matrix, Matrix":function(l,u){return t(a(l.toArray(),u.toArray()))},"Matrix, Array":function(l,u){return t(a(l.toArray(),u))},"Array, Matrix":function(l,u){return t(a(l,u.toArray()))},"Array, Array":a});function a(o,l){var u=Math.max(nt(o).length,nt(l).length);o=nu(o),l=nu(l);var s=nt(o),c=nt(l);if(s.length!==1||c.length!==1||s[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+s.join(", ")+"], B = ["+c.join(", ")+"])");var f=[n(i(o[1],l[2]),i(o[2],l[1])),n(i(o[2],l[0]),i(o[0],l[2])),n(i(o[0],l[1]),i(o[1],l[0]))];return u>1?[f]:f}});var fM="diag",lG=["typed","matrix","DenseMatrix","SparseMatrix"],Oy=N(fM,lG,r=>{var{typed:e,matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(fM,{Array:function(s){return a(s,0,nt(s),null)},"Array, number":function(s,c){return a(s,c,nt(s),null)},"Array, BigNumber":function(s,c){return a(s,c.toNumber(),nt(s),null)},"Array, string":function(s,c){return a(s,0,nt(s),c)},"Array, number, string":function(s,c,f){return a(s,c,nt(s),f)},"Array, BigNumber, string":function(s,c,f){return a(s,c.toNumber(),nt(s),f)},Matrix:function(s){return a(s,0,s.size(),s.storage())},"Matrix, number":function(s,c){return a(s,c,s.size(),s.storage())},"Matrix, BigNumber":function(s,c){return a(s,c.toNumber(),s.size(),s.storage())},"Matrix, string":function(s,c){return a(s,0,s.size(),c)},"Matrix, number, string":function(s,c,f){return a(s,c,s.size(),f)},"Matrix, BigNumber, string":function(s,c,f){return a(s,c.toNumber(),s.size(),f)}});function a(u,s,c,f){if(!ze(s))throw new TypeError("Second parameter in function diag must be an integer");var p=s>0?s:0,m=s<0?-s:0;switch(c.length){case 1:return o(u,s,f,c[0],m,p);case 2:return l(u,s,f,c,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(u,s,c,f,p,m){var h=[f+p,f+m];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var d=c==="sparse"?i.diagonal(h,u,s):n.diagonal(h,u,s);return c!==null?d:d.valueOf()}function l(u,s,c,f,p,m){if(Ge(u)){var h=u.diagonal(s);return c!==null?c!==h.storage()?t(h,c):h:h.valueOf()}for(var d=Math.min(f[0]-p,f[1]-m),g=[],v=0;v<d;v++)g[v]=u[v+p][v+m];return c!==null?t(g):g}});var El=fr(Qh(),1);function bi(r,e,t,n,i){if(El.default.isTypedFunction(r)){var a=[e,t,n],o=El.default.resolve(r,a);if(o)return f(o.implementation,a);var l=[e,t],u=El.default.resolve(r,l);if(u)return f(u.implementation,l);var s=[e],c=El.default.resolve(r,s);return c?f(c.implementation,s):f(r,a)}else return r(e,t,n);function f(p,m){try{return p.apply(p,m)}catch(g){var h;if(g instanceof TypeError&&((h=g.data)===null||h===void 0?void 0:h.category)==="wrongType"){var d=[];throw d.push("value: ".concat(Mt(e))),m.length>=2&&d.push("index: ".concat(Mt(t))),m.length>=3&&d.push("array: ".concat(Mt(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(r.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(r.name,": ").concat(g.message))}}}var cG="filter",fG=["typed"],ky=N(cG,fG,r=>{var{typed:e}=r;return e("filter",{"Array, function":pM,"Matrix, function":function(n,i){return n.create(pM(n.toArray(),i))},"Array, RegExp":iu,"Matrix, RegExp":function(n,i){return n.create(iu(n.toArray(),i))}})});function pM(r,e){return xp(r,function(t,n,i){return bi(e,t,[n],i,"filter")})}var mM="flatten",pG=["typed","matrix"],Ry=N(mM,pG,r=>{var{typed:e,matrix:t}=r;return e(mM,{Array:function(i){return ht(i)},Matrix:function(i){var a=ht(i.toArray());return t(a)}})});var dM="forEach",mG=["typed"],Ly=N(dM,mG,r=>{var{typed:e}=r;return e(dM,{"Array, function":dG,"Matrix, function":function(n,i){n.forEach(i)}})});function dG(r,e){var t=function n(i,a){if(Array.isArray(i))Ka(i,function(o,l){n(o,a.concat(l))});else return bi(e,i,a,r,"forEach")};t(r,[])}var hM="getMatrixDataType",hG=["typed"],Uy=N(hM,hG,r=>{var{typed:e}=r;return e(hM,{Array:function(n){return eo(n,Mt)},Matrix:function(n){return n.getDataType()}})});var gM="identity",gG=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Vy=N(gM,gG,r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=r;return e(gM,{"":function(){return t.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return u(c,c,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return u(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return u(c,f,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,p){return u(c,f,p)},Array:function(c){return l(c)},"Array, string":function(c,f){return l(c,f)},Matrix:function(c){return l(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return l(c.valueOf(),f)}});function l(s,c){switch(s.length){case 0:return c?n(c):[];case 1:return u(s[0],s[0],c);case 2:return u(s[0],s[1],c);default:throw new Error("Vector containing two values expected")}}function u(s,c,f){var p=Xe(s)||Xe(c)?i:null;if(Xe(s)&&(s=s.toNumber()),Xe(c)&&(c=c.toNumber()),!ze(s)||s<1)throw new Error("Parameters in function identity must be positive integers");if(!ze(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var m=p?new i(1):1,h=p?new p(0):0,d=[s,c];if(f){if(f==="sparse")return o.diagonal(d,m,0,h);if(f==="dense")return a.diagonal(d,m,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Vi([],d,h),v=s<c?s:c,w=0;w<v;w++)g[w][w]=m;return g}});var vM="kron",vG=["typed","matrix","multiplyScalar"],$y=N(vM,vG,r=>{var{typed:e,matrix:t,multiplyScalar:n}=r;return e(vM,{"Matrix, Matrix":function(o,l){return t(i(o.toArray(),l.toArray()))},"Matrix, Array":function(o,l){return t(i(o.toArray(),l))},"Array, Matrix":function(o,l){return t(i(o,l.toArray()))},"Array, Array":i});function i(a,o){if(nt(a).length===1&&(a=[a]),nt(o).length===1&&(o=[o]),nt(a).length>2||nt(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var l=[],u=[];return a.map(function(s){return o.map(function(c){return u=[],l.push(u),s.map(function(f){return c.map(function(p){return u.push(n(f,p))})})})})&&l}});var yM="map",yG=["typed"],qy=N(yM,yG,r=>{var{typed:e}=r;return e(yM,{"Array, function":bG,"Matrix, function":function(n,i){return n.map(i)}})});function bG(r,e){var t=function n(i,a){return Array.isArray(i)?i.map(function(o,l){return n(o,a.concat(l))}):bi(e,i,a,r,"map")};return t(r,[])}var bM="diff",xG=["typed","matrix","subtract","number"],Dl=N(bM,xG,r=>{var{typed:e,matrix:t,subtract:n,number:i}=r;return e(bM,{"Array | Matrix":function(c){return Ge(c)?t(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!ze(f))throw new RangeError("Dimension must be a whole number");return Ge(c)?t(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",s=>(c,f)=>s(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",s=>(c,f)=>s(c,i(f)))});function a(s,c){if(Ge(s)&&(s=s.toArray()),!Array.isArray(s))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return s.forEach(p=>{f.push(a(p,c-1))}),f}else{if(c===0)return o(s);throw RangeError("Cannot have negative dimension")}}function o(s){for(var c=[],f=s.length,p=1;p<f;p++)c.push(l(s[p-1],s[p]));return c}function l(s,c){Ge(s)&&(s=s.toArray()),Ge(c)&&(c=c.toArray());var f=Array.isArray(s),p=Array.isArray(c);if(f&&p)return u(s,c);if(!f&&!p)return n(c,s);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function u(s,c){if(s.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],p=s.length,m=0;m<p;m++)f.push(l(s[m],c[m]));return f}});var wG="ones",_G=["typed","config","matrix","BigNumber"],zy=N(wG,_G,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e("ones",{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var c=s[s.length-1];if(typeof c=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var c=s.storage();return a(s.valueOf(),c)},"Array | Matrix, string":function(s,c){return a(s.valueOf(),c)}});function a(u,s){var c=o(u),f=c?new i(1):1;if(l(u),s){var p=n(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Vi(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){Xe(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!ze(s)||s<0)throw new Error("Parameters in function ones must be positive integers")})}});function mu(){throw new Error('No "bignumber" implementation available')}function Lp(){throw new Error('No "fraction" implementation available')}function Up(){throw new Error('No "matrix" implementation available')}var xM="range",AG=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Nl=N(xM,AG,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=r;return e(xM,{string:p,"string, boolean":p,"number, number":function(g,v){return f(m(g,v,1,!1))},"number, number, number":function(g,v,w){return f(m(g,v,w,!1))},"number, number, boolean":function(g,v,w){return f(m(g,v,1,w))},"number, number, number, boolean":function(g,v,w,y){return f(m(g,v,w,y))},"BigNumber, BigNumber":function(g,v){var w=g.constructor;return f(m(g,v,new w(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,v,w){return f(m(g,v,w,!1))},"BigNumber, BigNumber, boolean":function(g,v,w){var y=g.constructor;return f(m(g,v,new y(1),w))},"BigNumber, BigNumber, BigNumber, boolean":function(g,v,w,y){return f(m(g,v,w,y))},"Unit, Unit, Unit":function(g,v,w){return f(m(g,v,w,!1))},"Unit, Unit, Unit, boolean":function(g,v,w,y){return f(m(g,v,w,y))}});function f(d){return t.matrix==="Matrix"?n?n(d):Up():d}function p(d,g){var v=h(d);if(!v)throw new SyntaxError('String "'+d+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&mu(),f(m(i(v.start),i(v.end),i(v.step)),g)):f(m(v.start,v.end,v.step,g))}function m(d,g,v,w){for(var y=[],x=c(v)?w?o:a:w?u:l,_=d;x(_,g);)y.push(_),_=s(_,v);return y}function h(d){var g=d.split(":"),v=g.map(function(y){return Number(y)}),w=v.some(function(y){return isNaN(y)});if(w)return null;switch(v.length){case 2:return{start:v[0],end:v[1],step:1};case 3:return{start:v[0],end:v[2],step:v[1]};default:return null}}});var wM="reshape",SG=["typed","isInteger","matrix"],Hy=N(wM,SG,r=>{var{typed:e,isInteger:t}=r;return e(wM,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!t(o))throw new TypeError("Invalid size for dimension: "+o)}),cl(i,a)}})});var EG="resize",DG=["config","matrix"],Gy=N(EG,DG,r=>{var{config:e,matrix:t}=r;return function(a,o,l){if(arguments.length!==2&&arguments.length!==3)throw new _a("resize",arguments.length,2,3);if(Ge(o)&&(o=o.valueOf()),Xe(o[0])&&(o=o.map(function(c){return Xe(c)?c.toNumber():c})),Ge(a))return a.resize(o,l,!0);if(typeof a=="string")return n(a,o,l);var u=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return et(a)}else{Array.isArray(a)||(a=[a]),a=et(a);var s=Vi(a,o,l);return u?t(s):s}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new st(a.length,1);var l=a[0];if(typeof l!="number"||!ze(l))throw new TypeError("Invalid size, must contain positive integers (size: "+at(a)+")");if(i.length>l)return i.substring(0,l);if(i.length<l){for(var u=i,s=0,c=l-i.length;s<c;s++)u+=o;return u}else return i}});var _M="rotate",NG=["typed","multiply","rotationMatrix"],Wy=N(_M,NG,r=>{var{typed:e,multiply:t,rotationMatrix:n}=r;return e(_M,{"Array , number | BigNumber | Complex | Unit":function(o,l){i(o,2);var u=t(n(l),o);return u.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,l){return i(o,2),t(n(l),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){i(o,3);var s=t(n(l,u),o);return s},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,l,u){return i(o,3),t(n(l,u),o)}});function i(a,o){var l=Array.isArray(a)?nt(a):a.size();if(l.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(l.length===2&&l[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(l[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var AM="rotationMatrix",CG=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],jy=N(AM,CG,r=>{var{typed:e,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:l,matrix:u,DenseMatrix:s,SparseMatrix:c,cos:f,sin:p}=r;return e(AM,{"":function(){return t.matrix==="Matrix"?u([]):[]},string:function(y){return u(y)},"number | BigNumber | Complex | Unit":function(y){return m(y,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(y,x){return m(y,x)},"number | BigNumber | Complex | Unit, Array":function(y,x){var _=u(x);return h(_),v(y,_,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(y,x){h(x);var _=x.storage()||(t.matrix==="Matrix"?"dense":void 0);return v(y,x,_)},"number | BigNumber | Complex | Unit, Array, string":function(y,x,_){var b=u(x);return h(b),v(y,b,_)},"number | BigNumber | Complex | Unit, Matrix, string":function(y,x,_){return h(x),v(y,x,_)}});function m(w,y){var x=Xe(w),_=x?new l(-1):-1,b=f(w),E=p(w),D=[[b,n(_,E)],[E,b]];return g(D,y)}function h(w){var y=w.size();if(y.length<1||y[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(w){return w.reduce((y,x)=>n(y,x))}function g(w,y){if(y){if(y==="sparse")return new c(w);if(y==="dense")return new s(w);throw new TypeError('Unknown matrix type "'.concat(y,'"'))}return w}function v(w,y,x){var _=o(y);if(_===0)throw new RangeError("Rotation around zero vector");var b=Xe(w)?l:null,E=b?new b(1):1,D=b?new b(-1):-1,A=b?new b(y.get([0])/_):y.get([0])/_,S=b?new b(y.get([1])/_):y.get([1])/_,M=b?new b(y.get([2])/_):y.get([2])/_,F=f(w),P=i(E,a(F)),R=p(w),O=i(F,d([A,A,P])),I=i(d([A,S,P]),d([D,M,R])),T=i(d([A,M,P]),d([S,R])),$=i(d([A,S,P]),d([M,R])),B=i(F,d([S,S,P])),U=i(d([S,M,P]),d([D,A,R])),G=i(d([A,M,P]),d([D,S,R])),H=i(d([S,M,P]),d([A,R])),L=i(F,d([M,M,P])),ae=[[O,I,T],[$,B,U],[G,H,L]];return g(ae,x)}});var SM="row",MG=["typed","Index","matrix","range"],Cl=N(SM,MG,r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(SM,{"Matrix, number":a,"Array, number":function(l,u){return a(n(et(l)),u).valueOf()}});function a(o,l){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Jt(l,o.size()[0]);var u=i(0,o.size()[1]),s=new t(l,u),c=o.subset(s);return Ge(c)?c:n([[c]])}});var EM="size",TG=["typed","config","?matrix"],Zy=N(EM,TG,r=>{var{typed:e,config:t,matrix:n}=r;return e(EM,{Matrix:function(a){return a.create(a.size())},Array:nt,string:function(a){return t.matrix==="Array"?[a.length]:n([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:n?n([]):Up()}})});var DM="squeeze",FG=["typed","matrix"],Jy=N(DM,FG,r=>{var{typed:e,matrix:t}=r;return e(DM,{Array:function(i){return nu(et(i))},Matrix:function(i){var a=nu(i.toArray());return Array.isArray(a)?t(a):a},any:function(i){return et(i)}})});var NM="subset",IG=["typed","matrix","zeros","add"],Ml=N(NM,IG,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r;return e(NM,{"Matrix, Index":function(l,u){return es(u)?t():(ll(l,u),l.subset(u))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(l,u){var s=o(t(l),u);return u.isScalar()?s:s.valueOf()}}),"Object, Index":PG,"string, Index":BG,"Matrix, Index, any, any":function(l,u,s,c){return es(u)?l:(ll(l,u),l.clone().subset(u,a(s,u),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s,c){var f=o(t(l),u,s,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s){return o(t(l),u,s,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(l,u,s){return o(l,u,s,void 0)}}),"string, Index, string":CM,"string, Index, string, string":CM,"Object, Index, any":OG});function a(o,l){if(typeof o=="string")throw new Error("can't boradcast a string");if(l._isScalar)return o;var u=l.size();if(u.every(s=>s>0))try{return i(o,n(u))}catch(s){return o}else return o}});function BG(r,e){if(!Ya(e))throw new TypeError("Index expected");if(es(e))return"";if(ll(Array.from(r),e),e.size().length!==1)throw new st(e.size().length,1);var t=r.length;Jt(e.min()[0],t),Jt(e.max()[0],t);var n=e.dimension(0),i="";return n.forEach(function(a){i+=r.charAt(a)}),i}function CM(r,e,t,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(es(e))return r;if(ll(Array.from(r),e),e.size().length!==1)throw new st(e.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new st(i.size()[0],t.length);var o=r.length;Jt(e.min()[0]),Jt(e.max()[0]);for(var l=[],u=0;u<o;u++)l[u]=r.charAt(u);if(i.forEach(function(f,p){l[f]=t.charAt(p[0])}),l.length>o)for(var s=o-1,c=l.length;s<c;s++)l[s]||(l[s]=n);return l.join("")}function PG(r,e){if(!es(e)){if(e.size().length!==1)throw new st(e.size(),1);var t=e.dimension(0);if(typeof t!="string")throw new TypeError("String expected as index to retrieve an object property");return br(r,t)}}function OG(r,e,t){if(es(e))return r;if(e.size().length!==1)throw new st(e.size(),1);var n=e.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");var i=et(r);return Qi(i,n,t),i}var MM="transpose",kG=["typed","matrix"],Yy=N(MM,kG,r=>{var{typed:e,matrix:t}=r;return e(MM,{Array:o=>n(t(o)).valueOf(),Matrix:n,any:et});function n(o){var l=o.size(),u;switch(l.length){case 1:u=o.clone();break;case 2:{var s=l[0],c=l[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+at(l)+")");switch(o.storage()){case"dense":u=i(o,s,c);break;case"sparse":u=a(o,s,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+at(l)+")")}return u}function i(o,l,u){for(var s=o._data,c=[],f,p=0;p<u;p++){f=c[p]=[];for(var m=0;m<l;m++)f[m]=et(s[m][p])}return o.createDenseMatrix({data:c,size:[u,l],datatype:o._datatype})}function a(o,l,u){for(var s=o._values,c=o._index,f=o._ptr,p=s?[]:void 0,m=[],h=[],d=[],g=0;g<l;g++)d[g]=0;var v,w,y;for(v=0,w=c.length;v<w;v++)d[c[v]]++;for(var x=0,_=0;_<l;_++)h.push(x),x+=d[_],d[_]=h[_];for(h.push(x),y=0;y<u;y++)for(var b=f[y],E=f[y+1],D=b;D<E;D++){var A=d[c[D]]++;m[A]=y,s&&(p[A]=et(s[D]))}return o.createSparseMatrix({values:p,index:m,ptr:h,size:[u,l],datatype:o._datatype})}});var TM="ctranspose",RG=["typed","transpose","conj"],Xy=N(TM,RG,r=>{var{typed:e,transpose:t,conj:n}=r;return e(TM,{any:function(a){return n(t(a))}})});var FM="zeros",LG=["typed","config","matrix","BigNumber"],Qy=N(FM,LG,r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(FM,{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(s){var c=s[s.length-1];if(typeof c=="string"){var f=s.pop();return a(s,f)}else return t.matrix==="Array"?a(s):a(s,"default")},Array:a,Matrix:function(s){var c=s.storage();return a(s.valueOf(),c)},"Array | Matrix, string":function(s,c){return a(s.valueOf(),c)}});function a(u,s){var c=o(u),f=c?new i(0):0;if(l(u),s){var p=n(s);return u.length>0?p.resize(u,f):p}else{var m=[];return u.length>0?Vi(m,u,f):m}}function o(u){var s=!1;return u.forEach(function(c,f,p){Xe(c)&&(s=!0,p[f]=c.toNumber())}),s}function l(u){u.forEach(function(s){if(typeof s!="number"||!ze(s)||s<0)throw new Error("Parameters in function zeros must be positive integers")})}});var IM="fft",UG=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Ky=N(IM,UG,r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:l,i:u,dotDivide:s,conj:c,pow:f,ceil:p,log2:m}=r;return e(IM,{Array:h,Matrix:function(y){return y.create(h(y.toArray()))}});function h(w){var y=nt(w);return y.length===1?v(w,y[0]):d(w.map(x=>h(x,y.slice(1))),0)}function d(w,y){var x=nt(w);if(y!==0)return new Array(x[0]).fill(0).map((b,E)=>d(w[E],y-1));if(x.length===1)return v(w);function _(b){var E=nt(b);return new Array(E[1]).fill(0).map((D,A)=>new Array(E[0]).fill(0).map((S,M)=>b[M][A]))}return _(d(_(w),1))}function g(w){for(var y=w.length,x=o(a(i(-1,i(u,l)),y)),_=[],b=1-y;b<y;b++)_.push(f(x,a(f(b,2),2)));for(var E=f(2,p(m(y+y-1))),D=[...new Array(y).fill(0).map((I,T)=>i(w[T],_[y-1+T])),...new Array(E-y).fill(0)],A=[...new Array(y+y-1).fill(0).map((I,T)=>a(1,_[T])),...new Array(E-(y+y-1)).fill(0)],S=v(D),M=v(A),F=new Array(E).fill(0).map((I,T)=>i(S[T],M[T])),P=s(c(h(c(F))),E),R=[],O=y-1;O<y+y-1;O++)R.push(i(P[O],_[O]));return R}function v(w){var y=w.length;if(y===1)return[w[0]];if(y%2===0){for(var x=[...v(w.filter((D,A)=>A%2===0),y/2),...v(w.filter((D,A)=>A%2===1),y/2)],_=0;_<y/2;_++){var b=x[_],E=i(x[_+y/2],o(i(i(l,u),a(-_,y))));x[_]=n(b,E),x[_+y/2]=n(b,i(-1,E))}return x}else return g(w)}});var BM="ifft",VG=["typed","fft","dotDivide","conj"],e0=N(BM,VG,r=>{var{typed:e,fft:t,dotDivide:n,conj:i}=r;return e(BM,{"Array | Matrix":function(o){var l=Ge(o)?o.size():nt(o);return n(i(t(i(o))),l.reduce((u,s)=>u*s,1))}})});function lo(r){"@babel/helpers - typeof";return lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lo(r)}function t0(r,e){if(lo(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(lo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function r0(r){var e=t0(r,"string");return lo(e)=="symbol"?e:String(e)}function Ht(r,e,t){return e=r0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PM(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $G(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?PM(Object(t),!0).forEach(function(n){Ht(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):PM(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var qG="solveODE",zG=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],n0=N(qG,zG,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,max:o,map:l,abs:u,isPositive:s,isNegative:c,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:d}=r;function g(D){return function(A,S,M,F){var P=!(S.length===2&&(S.every(b)||S.every(ln)));if(P)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var R=S[0],O=S[1],I=f(O,R),T=F.firstStep;if(T!==void 0&&!s(T))throw new Error('"firstStep" must be positive');var $=F.maxStep;if($!==void 0&&!s($))throw new Error('"maxStep" must be positive');var B=F.minStep;if(B&&c(B))throw new Error('"minStep" must be positive or zero');var U=[R,O,T,B,$].filter(qe=>qe!==void 0);if(!(U.every(b)||U.every(ln)))throw new Error('Inconsistent type of "t" dependant variables');for(var G=1,H=F.tol?F.tol:1e-4,L=F.minDelta?F.minDelta:.2,ae=F.maxDelta?F.maxDelta:5,ve=F.maxIter?F.maxIter:1e4,se=[R,O,...M,$,B].some(Xe),[le,he,K,ne]=se?[h(D.a),h(D.c),h(D.b),h(D.bp)]:[D.a,D.c,D.b,D.bp],me=T?I?T:d(T):a(n(O,R),G),de=[R],Oe=[M],Se=n(K,ne),V=0,X=0,fe=x(I),W=_(I);fe(de[V],O);){var te=[];me=W(de[V],O,me),te.push(A(de[V],Oe[V]));for(var ie=1;ie<he.length;++ie)te.push(A(t(de[V],i(he[ie],me)),t(Oe[V],i(me,le[ie],te))));var ge=o(u(l(i(Se,te),qe=>ln(qe)?qe.value:qe)));ge<H&&H/ge>1/4&&(de.push(t(de[V],me)),Oe.push(t(Oe[V],i(me,K,te))),V++);var ye=.84*(H/ge)**(1/5);if(p(ye,L)?ye=L:f(ye,ae)&&(ye=ae),ye=se?h(ye):ye,me=i(me,ye),$&&f(u(me),$)?me=I?$:d($):B&&p(u(me),B)&&(me=I?B:d(B)),X++,X>ve)throw new Error("Maximum number of iterations reached, try changing options")}return{t:de,y:Oe}}}function v(D,A,S,M){var F=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],P=[null,1/2,3/4,1],R=[2/9,1/3,4/9,0],O=[7/24,1/4,1/3,1/8],I={a:F,c:P,b:R,bp:O};return g(I)(D,A,S,M)}function w(D,A,S,M){var F=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],P=[null,1/5,3/10,4/5,8/9,1,1],R=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],O=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],I={a:F,c:P,b:R,bp:O};return g(I)(D,A,S,M)}function y(D,A,S,M){var F=M.method?M.method:"RK45",P={RK23:v,RK45:w};if(F.toUpperCase()in P){var R=$G({},M);return delete R.method,P[F.toUpperCase()](D,A,S,R)}else{var O=Object.keys(P).map(T=>'"'.concat(T,'"')),I="".concat(O.slice(0,-1).join(", ")," and ").concat(O.slice(-1));throw new Error('Unavailable method "'.concat(F,'". Available methods are ').concat(I))}}function x(D){return D?p:f}function _(D){var A=D?f:p;return function(S,M,F){var P=t(S,F);return A(P,M)?n(M,S):F}}function b(D){return Xe(D)||it(D)}function E(D,A,S,M){var F=y(D,A.toArray(),S.toArray(),M);return{t:m(F.t),y:m(F.y)}}return e("solveODE",{"function, Array, Array, Object":y,"function, Matrix, Matrix, Object":E,"function, Array, Array":(D,A,S)=>y(D,A,S,{}),"function, Matrix, Matrix":(D,A,S)=>E(D,A,S,{}),"function, Array, number | BigNumber | Unit":(D,A,S)=>{var M=y(D,A,[S],{});return{t:M.t,y:M.y.map(F=>F[0])}},"function, Matrix, number | BigNumber | Unit":(D,A,S)=>{var M=y(D,A.toArray(),[S],{});return{t:m(M.t),y:m(M.y.map(F=>F[0]))}},"function, Array, number | BigNumber | Unit, Object":(D,A,S,M)=>{var F=y(D,A,[S],M);return{t:F.t,y:F.y.map(P=>P[0])}},"function, Matrix, number | BigNumber | Unit, Object":(D,A,S,M)=>{var F=y(D,A.toArray(),[S],M);return{t:m(F.t),y:m(F.y.map(P=>P[0]))}}})});var HG="erf",GG=["typed"],i0=N(HG,GG,r=>{var{typed:e}=r;return e("name",{number:function(o){var l=Math.abs(o);return l>=ZG?gi(o):l<=WG?gi(o)*t(l):l<=4?gi(o)*(1-n(l)):gi(o)*(1-i(l))},"Array | Matrix":e.referToSelf(a=>o=>Je(o,a))});function t(a){var o=a*a,l=Aa[0][4]*o,u=o,s;for(s=0;s<3;s+=1)l=(l+Aa[0][s])*o,u=(u+du[0][s])*o;return a*(l+Aa[0][3])/(u+du[0][3])}function n(a){var o=Aa[1][8]*a,l=a,u;for(u=0;u<7;u+=1)o=(o+Aa[1][u])*a,l=(l+du[1][u])*a;var s=(o+Aa[1][7])/(l+du[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*s}function i(a){var o=1/(a*a),l=Aa[2][5]*o,u=o,s;for(s=0;s<4;s+=1)l=(l+Aa[2][s])*o,u=(u+du[2][s])*o;var c=o*(l+Aa[2][4])/(u+du[2][4]);c=(jG-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),WG=.46875,jG=.5641895835477563,Aa=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],du=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],ZG=Math.pow(2,53);var OM="zeta",JG=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],a0=N(OM,JG,r=>{var{typed:e,config:t,multiply:n,pow:i,divide:a,factorial:o,equal:l,smallerEq:u,isNegative:s,gamma:c,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=r;return e(OM,{number:b=>v(b,E=>E,()=>20),BigNumber:b=>v(b,E=>new d(E),()=>Math.abs(Math.log10(t.epsilon))),Complex:w});function v(b,E,D){return l(b,0)?E(-.5):l(b,1)?E(NaN):isFinite(b)?y(b,E,D,A=>A):s(b)?E(NaN):E(1)}function w(b){return b.re===0&&b.im===0?new h(-.5):b.re===1?new h(NaN,NaN):b.re===1/0&&b.im===0?new h(1):b.im===1/0||b.re===-1/0?new h(NaN,NaN):y(b,E=>E,E=>Math.round(1.3*15+.9*Math.abs(E.im)),E=>E.re)}function y(b,E,D,A){var S=D(b);if(A(b)>-(S-1)/2)return _(b,E(S),E);var M=n(i(2,b),i(E(g),p(b,1)));return M=n(M,f(n(a(E(g),2),b))),M=n(M,c(p(1,b))),n(M,y(p(1,b),E,D,A))}function x(b,E){for(var D=b,A=b;u(A,E);A=m(A,1)){var S=a(n(o(m(E,p(A,1))),i(4,A)),n(o(p(E,A)),o(n(2,A))));D=m(D,S)}return n(E,D)}function _(b,E,D){for(var A=a(1,n(x(D(0),E),p(1,i(2,p(1,b))))),S=D(0),M=D(1);u(M,E);M=m(M,1))S=m(S,a(n((-1)**(M-1),x(M,E)),i(M,b)));return n(A,S)}});var kM="mode",YG=["typed","isNaN","isNumeric"],o0=N(kM,YG,r=>{var{typed:e,isNaN:t,isNumeric:n}=r;return e(kM,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=ht(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var l={},u=[],s=0,c=0;c<a.length;c++){var f=a[c];if(n(f)&&t(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in l||(l[f]=0),l[f]++,l[f]===s?u.push(f):l[f]>s&&(s=l[f],u=[f])}return u}});function Er(r,e,t){var n;return String(r).indexOf("Unexpected type")!==-1?(n=arguments.length>2?" (type: "+Mt(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(r).indexOf("complex numbers")!==-1?(n=arguments.length>2?" (type: "+Mt(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var RM="prod",XG=["typed","config","multiplyScalar","numeric"],s0=N(RM,XG,r=>{var{typed:e,config:t,multiplyScalar:n,numeric:i}=r;return e(RM,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(l,u){throw new Error("prod(A, dim) is not yet supported")},"...":function(l){return a(l)}});function a(o){var l;if(bn(o,function(u){try{l=l===void 0?u:n(l,u)}catch(s){throw Er(s,"prod",u)}}),typeof l=="string"&&(l=i(l,t.number)),l===void 0)throw new Error("Cannot calculate prod of an empty array");return l}});var LM="format",QG=["typed"],u0=N(LM,QG,r=>{var{typed:e}=r;return e(LM,{any:at,"any, Object | function | number | BigNumber":at})});var UM="bin",KG=["typed","format"],l0=N(UM,KG,r=>{var{typed:e,format:t}=r;return e(UM,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var VM="oct",eW=["typed","format"],c0=N(VM,eW,r=>{var{typed:e,format:t}=r;return e(VM,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var $M="hex",tW=["typed","format"],f0=N($M,tW,r=>{var{typed:e,format:t}=r;return e($M,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var Vp=/\$([\w.]+)/g;var qM="print",rW=["typed"],Tl=N(qM,rW,r=>{var{typed:e}=r;return e(qM,{"string, Object | Array":zM,"string, Object | Array, number | Object":zM})});function zM(r,e,t){return r.replace(Vp,function(n,i){var a=i.split("."),o=e[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var l=a.shift();o=l?o[l]:o+"."}return o!==void 0?Ar(o)?o:at(o,t):n})}var HM="to",nW=["typed","matrix","concat"],p0=N(HM,nW,r=>{var{typed:e,matrix:t,concat:n}=r,i=ct({typed:e,matrix:t,concat:n});return e(HM,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var GM="isPrime",iW=["typed"],m0=N(GM,iW,r=>{var{typed:e}=r;return e(GM,{number:function(n){if(n*0!==0)return!1;if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},BigNumber:function(n){if(n.toNumber()*0!==0)return!1;if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(w,y,x){for(var _=1;!y.eq(0);)y.mod(2).eq(0)?(y=y.div(2),w=w.mul(w).mod(x)):(y=y.sub(1),_=w.mul(_).mod(x));return _}var l=n.constructor.clone({precision:n.toFixed(0).length*2});n=new l(n);for(var u=0,s=n.sub(1);s.mod(2).eq(0);)s=s.div(2),u+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(w=>w<n);else{var f=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));c=[];for(var p=2;p<=f;p+=1)c.push(f)}for(var m=0;m<c.length;m+=1){var h=c[m],d=o(n.sub(n).add(h),s,n);if(!d.eq(1)){for(var g=0,v=d;!v.eq(n.sub(1));g+=1,v=v.mul(v).mod(n))if(g===u-1)return!1}}return!0},"Array | Matrix":e.referToSelf(t=>n=>Je(n,t))})});var aW="numeric",oW=["number","?bignumber","?fraction"],d0=N(aW,oW,r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):mu,Fraction:n?o=>n(o):Lp};return function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",s=arguments.length>2?arguments[2]:void 0;if(s!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=Mt(l);if(!(c in i))throw new TypeError("Cannot convert "+l+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(u in a))throw new TypeError("Cannot convert "+l+' to type "'+u+'"; valid output types are '+Object.keys(a).join(", "));return u===c?l:a[u](l)}});var WM="divideScalar",sW=["typed","numeric"],h0=N(WM,sW,r=>{var{typed:e,numeric:t}=r;return e(WM,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var jM="pow",uW=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],g0=N(jM,uW,r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:a,inv:o,number:l,fraction:u,Complex:s}=r;return e(jM,{"number, number":c,"Complex, Complex":function(h,d){return h.pow(d)},"BigNumber, BigNumber":function(h,d){return d.isInteger()||h>=0||t.predictable?h.pow(d):new s(h.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(h,d){var g=h.pow(d);if(g!=null)return g;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(h.valueOf(),d.valueOf())},"Array, number":f,"Array, BigNumber":function(h,d){return f(h,d.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(h,d){return p(h,d.toNumber())},"Unit, number | BigNumber":function(h,d){return h.pow(d)}});function c(m,h){if(t.predictable&&!ze(h)&&m<0)try{var d=u(h),g=l(d);if((h===g||Math.abs((h-g)/h)<1e-14)&&d.d%2===1)return(d.n%2===0?1:-1)*Math.pow(-m,h)}catch(v){}return t.predictable&&(m<-1&&h===1/0||m>-1&&m<0&&h===-1/0)?NaN:ze(h)||m>=0||t.predictable?Wg(m,h):m*m<1&&h===1/0||m*m>1&&h===-1/0?0:new s(m,0).pow(h,0)}function f(m,h){if(!ze(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=nt(m);if(d.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!==d[1])throw new Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");if(h<0)try{return f(o(m),-h)}catch(w){throw w.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):w}for(var g=n(d[0]).valueOf(),v=m;h>=1;)(h&1)===1&&(g=i(v,g)),h>>=1,v=i(v,v);return g}function p(m,h){return a(f(m.valueOf(),h))}});var hu="Number of decimals in function round must be an integer",ZM="round",lW=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],v0=N(ZM,lW,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=r,l=Yt({typed:e,equalScalar:n}),u=qt({typed:e,DenseMatrix:o}),s=Or({typed:e});return e(ZM,{number:jg,"number, number":jg,"number, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(hu);return new a(f).toDecimalPlaces(p.toNumber())},Complex:function(f){return f.round()},"Complex, number":function(f,p){if(p%1)throw new TypeError(hu);return f.round(p)},"Complex, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(hu);var m=p.toNumber();return f.round(m)},BigNumber:function(f){return f.toDecimalPlaces(0)},"BigNumber, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(hu);return f.toDecimalPlaces(p.toNumber())},Fraction:function(f){return f.round()},"Fraction, number":function(f,p){if(p%1)throw new TypeError(hu);return f.round(p)},"Fraction, BigNumber":function(f,p){if(!p.isInteger())throw new TypeError(hu);return f.round(p.toNumber())},"Unit, number, Unit":e.referToSelf(c=>function(f,p,m){var h=f.toNumeric(m);return m.multiply(c(h,p))}),"Unit, BigNumber, Unit":e.referToSelf(c=>(f,p,m)=>c(f,p.toNumber(),m)),"Unit, Unit":e.referToSelf(c=>(f,p)=>c(f,0,p)),"Array | Matrix, number, Unit":e.referToSelf(c=>(f,p,m)=>Je(f,h=>c(h,p,m),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(c=>(f,p,m)=>c(f,p.toNumber(),m)),"Array | Matrix, Unit":e.referToSelf(c=>(f,p)=>c(f,0,p)),"Array | Matrix":e.referToSelf(c=>f=>Je(f,c,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(c=>(f,p)=>l(f,p,c,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(c=>(f,p)=>s(f,p,c,!1)),"Array, number | BigNumber":e.referToSelf(c=>(f,p)=>s(t(f),p,c,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(c=>(f,p)=>n(f,0)?i(p.size(),p.storage()):u(p,f,c,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(c=>(f,p)=>n(f,0)?i(p.size(),p.storage()):s(p,f,c,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(c=>(f,p)=>s(t(p),f,c,!0).valueOf())})});var JM="log",cW=["config","typed","divideScalar","Complex"],y0=N(JM,cW,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r;return e(JM,{number:function(o){return o>=0||t.predictable?QN(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":e.referToSelf(a=>(o,l)=>n(a(o),a(l)))})});var YM="log1p",fW=["typed","config","divideScalar","log","Complex"],b0=N(YM,fW,r=>{var{typed:e,config:t,divideScalar:n,log:i,Complex:a}=r;return e(YM,{number:function(u){return u>=-1||t.predictable?mp(u):o(new a(u,0))},Complex:o,BigNumber:function(u){var s=u.plus(1);return!s.isNegative()||t.predictable?s.ln():o(new a(u.toNumber(),0))},"Array | Matrix":e.referToSelf(l=>u=>Je(u,l)),"any, any":e.referToSelf(l=>(u,s)=>n(l(u),i(s)))});function o(l){var u=l.re+1;return new a(Math.log(Math.sqrt(u*u+l.im*l.im)),Math.atan2(l.im,u))}});var XM="nthRoots",pW=["config","typed","divideScalar","Complex"],x0=N(XM,pW,r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r,a=[function(u){return new i(u,0)},function(u){return new i(0,u)},function(u){return new i(-u,0)},function(u){return new i(0,-u)}];function o(l,u){if(u<0)throw new Error("Root must be greater than zero");if(u===0)throw new Error("Root must be non-zero");if(u%1!==0)throw new Error("Root must be an integer");if(l===0||l.abs()===0)return[new i(0,0)];var s=typeof l=="number",c;(s||l.re===0||l.im===0)&&(s?c=2*+(l<0):l.im===0?c=2*+(l.re<0):c=2*+(l.im<0)+1);for(var f=l.arg(),p=l.abs(),m=[],h=Math.pow(p,1/u),d=0;d<u;d++){var g=(c+4*d)/u;if(g===Math.round(g)){m.push(a[g%4](h));continue}m.push(new i({r:h,phi:(f+2*Math.PI*d)/u}))}return m}return e(XM,{Complex:function(u){return o(u,2)},"Complex, number":o})});var QM="dotPow",mW=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],w0=N(QM,mW,r=>{var{typed:e,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o}=r,l=sr({typed:e}),u=zr({typed:e,DenseMatrix:a}),s=Yt({typed:e,equalScalar:t}),c=qt({typed:e,DenseMatrix:a}),f=ct({typed:e,matrix:n,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes("Matrix")&&!m.includes("Array")&&(p[m]=i.signatures[m]);var h=e(p);return e(QM,f({elop:h,SS:u,DS:l,Ss:s,sS:c}))});var KM="dotDivide",dW=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],_0=N(KM,dW,r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=r,l=kr({typed:e,equalScalar:n}),u=sr({typed:e}),s=zr({typed:e,DenseMatrix:a}),c=Yt({typed:e,equalScalar:n}),f=qt({typed:e,DenseMatrix:a}),p=ct({typed:e,matrix:t,concat:o});return e(KM,p({elop:i,SS:s,DS:u,SD:l,Ss:c,sS:f}))});function ta(r){var{DenseMatrix:e}=r;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+at(o)+")");var l=o[0],u=o[1];if(l!==u)throw new RangeError("Matrix must be square (size: "+at(o)+")");var s=[];if(Ge(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var p=0;p<l;p++)s[p]=[f[p]];return new e({data:s,size:[l,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==l||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Qo(i)){if(a){s=[];for(var m=0;m<l;m++)s[m]=[f[m][0]];return new e({data:s,size:[l,1],datatype:i._datatype})}return i}if(Ri(i)){for(var h=0;h<l;h++)s[h]=[0];for(var d=i._values,g=i._index,v=i._ptr,w=v[1],y=v[0];y<w;y++){var x=g[y];s[x][0]=d[y]}return new e({data:s,size:[l,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(It(i)){var _=nt(i);if(_.length===1){if(_[0]!==l)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<l;b++)s[b]=[i[b]];return new e({data:s,size:[l,1]})}if(_.length===2){if(_[0]!==l||_[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<l;E++)s[E]=[i[E][0]];return new e({data:s,size:[l,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var eT="lsolve",hW=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],A0=N(eT,hW,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=ta({DenseMatrix:l});return e(eT,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.valueOf()}});function s(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],v=f._data,w=0;w<d;w++){var y=m[w][0]||0,x=void 0;if(o(y,0))x=0;else{var _=v[w][w];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(y,_);for(var b=w+1;b<h;b++)m[b]=[a(m[b][0]||0,i(x,v[b][w]))]}g[w]=[x]}return new l({data:g,size:[h,1]})}function c(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=[],x=0;x<d;x++){var _=m[x][0]||0;if(o(_,0))y[x]=[0];else{for(var b=0,E=[],D=[],A=w[x],S=w[x+1],M=A;M<S;M++){var F=v[M];F===x?b=g[M]:F>x&&(E.push(g[M]),D.push(F))}if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(_,b),R=0,O=D.length;R<O;R++){var I=D[R];m[I]=[a(m[I][0]||0,i(P,E[R]))]}y[x]=[P]}}return new l({data:y,size:[h,1]})}});var tT="usolve",gW=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],S0=N(tT,gW,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=ta({DenseMatrix:l});return e(tT,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.valueOf()}});function s(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],v=f._data,w=d-1;w>=0;w--){var y=m[w][0]||0,x=void 0;if(o(y,0))x=0;else{var _=v[w][w];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");x=n(y,_);for(var b=w-1;b>=0;b--)m[b]=[a(m[b][0]||0,i(x,v[b][w]))]}g[w]=[x]}return new l({data:g,size:[h,1]})}function c(f,p){p=u(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=[],x=d-1;x>=0;x--){var _=m[x][0]||0;if(o(_,0))y[x]=[0];else{for(var b=0,E=[],D=[],A=w[x],S=w[x+1],M=S-1;M>=A;M--){var F=v[M];F===x?b=g[M]:F<x&&(E.push(g[M]),D.push(F))}if(o(b,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var P=n(_,b),R=0,O=D.length;R<O;R++){var I=D[R];m[I]=[a(m[I][0],i(P,E[R]))]}y[x]=[P]}}return new l({data:y,size:[h,1]})}});var rT="lsolveAll",vW=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],E0=N(rT,vW,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=ta({DenseMatrix:l});return e(rT,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.map(g=>g.valueOf())}});function s(f,p){for(var m=[u(f,p,!0)._data.map(D=>D[0])],h=f._data,d=f._size[0],g=f._size[1],v=0;v<g;v++)for(var w=m.length,y=0;y<w;y++){var x=m[y];if(o(h[v][v],0))if(o(x[v],0)){if(y===0){var b=[...x];b[v]=1;for(var E=v+1;E<g;E++)b[E]=a(b[E],h[E][v]);m.push(b)}}else{if(y===0)return[];m.splice(y,1),y-=1,w-=1}else{x[v]=n(x[v],h[v][v]);for(var _=v+1;_<g;_++)x[_]=a(x[_],i(x[v],h[_][v]))}}return m.map(D=>new l({data:D.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(G=>G[0])],h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=0;y<d;y++)for(var x=m.length,_=0;_<x;_++){for(var b=m[_],E=[],D=[],A=w[y],S=w[y+1],M=0,F=A;F<S;F++){var P=v[F];P===y?M=g[F]:P>y&&(E.push(g[F]),D.push(P))}if(o(M,0))if(o(b[y],0)){if(_===0){var T=[...b];T[y]=1;for(var $=0,B=D.length;$<B;$++){var U=D[$];T[U]=a(T[U],E[$])}m.push(T)}}else{if(_===0)return[];m.splice(_,1),_-=1,x-=1}else{b[y]=n(b[y],M);for(var R=0,O=D.length;R<O;R++){var I=D[R];b[I]=a(b[I],i(b[y],E[R]))}}}return m.map(G=>new l({data:G.map(H=>[H]),size:[h,1]}))}});var nT="usolveAll",yW=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],D0=N(nT,yW,r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:l}=r,u=ta({DenseMatrix:l});return e(nT,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return s(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=s(h,m);return d.map(g=>g.valueOf())}});function s(f,p){for(var m=[u(f,p,!0)._data.map(D=>D[0])],h=f._data,d=f._size[0],g=f._size[1],v=g-1;v>=0;v--)for(var w=m.length,y=0;y<w;y++){var x=m[y];if(o(h[v][v],0))if(o(x[v],0)){if(y===0){var b=[...x];b[v]=1;for(var E=v-1;E>=0;E--)b[E]=a(b[E],h[E][v]);m.push(b)}}else{if(y===0)return[];m.splice(y,1),y-=1,w-=1}else{x[v]=n(x[v],h[v][v]);for(var _=v-1;_>=0;_--)x[_]=a(x[_],i(x[v],h[_][v]))}}return m.map(D=>new l({data:D.map(A=>[A]),size:[d,1]}))}function c(f,p){for(var m=[u(f,p,!0)._data.map(G=>G[0])],h=f._size[0],d=f._size[1],g=f._values,v=f._index,w=f._ptr,y=d-1;y>=0;y--)for(var x=m.length,_=0;_<x;_++){for(var b=m[_],E=[],D=[],A=w[y],S=w[y+1],M=0,F=S-1;F>=A;F--){var P=v[F];P===y?M=g[F]:P<y&&(E.push(g[F]),D.push(P))}if(o(M,0))if(o(b[y],0)){if(_===0){var T=[...b];T[y]=1;for(var $=0,B=D.length;$<B;$++){var U=D[$];T[U]=a(T[U],E[$])}m.push(T)}}else{if(_===0)return[];m.splice(_,1),_-=1,x-=1}else{b[y]=n(b[y],M);for(var R=0,O=D.length;R<O;R++){var I=D[R];b[I]=a(b[I],i(b[y],E[R]))}}}return m.map(G=>new l({data:G.map(H=>[H]),size:[h,1]}))}});var bW="matAlgo08xS0Sid",xW=["typed","equalScalar"],gu=N(bW,xW,r=>{var{typed:e,equalScalar:t}=r;return function(i,a,o){var l=i._values,u=i._index,s=i._ptr,c=i._size,f=i._datatype,p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype;if(c.length!==d.length)throw new st(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");if(!l||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var v=c[0],w=c[1],y,x=t,_=0,b=o;typeof f=="string"&&f===g&&(y=f,x=e.find(t,[y,y]),_=e.convert(0,y),b=e.find(o,[y,y]));for(var E=[],D=[],A=[],S=[],M=[],F,P,R,O,I=0;I<w;I++){A[I]=D.length;var T=I+1;for(P=s[I],R=s[I+1],F=P;F<R;F++)O=u[F],M[O]=T,S[O]=l[F],D.push(O);for(P=h[I],R=h[I+1],F=P;F<R;F++)O=m[F],M[O]===T&&(S[O]=b(S[O],p[F]));for(F=A[I];F<D.length;){O=D[F];var $=S[O];x($,_)?D.splice(F,1):(E.push($),F++)}}return A[w]=D.length,i.createSparseMatrix({values:E,index:D,ptr:A,size:[v,w],datatype:y})}});var vu=N("useMatrixForArrayScalar",["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,t(a)).valueOf())}});var iT="leftShift",wW=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],N0=N(iT,wW,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=xn({typed:e}),u=kr({typed:e,equalScalar:n}),s=gu({typed:e,equalScalar:n}),c=Vn({typed:e,DenseMatrix:a}),f=Yt({typed:e,equalScalar:n}),p=Or({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=vu({typed:e,matrix:t});return e(iT,{"number, number":Qg,"BigNumber, BigNumber":ZC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var aT="rightArithShift",_W=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],C0=N(aT,_W,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=xn({typed:e}),u=kr({typed:e,equalScalar:n}),s=gu({typed:e,equalScalar:n}),c=Vn({typed:e,DenseMatrix:a}),f=Yt({typed:e,equalScalar:n}),p=Or({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=vu({typed:e,matrix:t});return e(aT,{"number, number":Kg,"BigNumber, BigNumber":JC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var oT="rightLogShift",AW=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],M0=N(oT,AW,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=r,l=xn({typed:e}),u=kr({typed:e,equalScalar:n}),s=gu({typed:e,equalScalar:n}),c=Vn({typed:e,DenseMatrix:a}),f=Yt({typed:e,equalScalar:n}),p=Or({typed:e}),m=ct({typed:e,matrix:t,concat:o}),h=vu({typed:e,matrix:t});return e(oT,{"number, number":ev,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():f(g,v,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,v)=>n(v,0)?g.clone():p(g,v,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):c(v,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,v)=>n(g,0)?i(v.size(),v.storage()):p(v,g,d,!0))},h,m({SS:s,DS:l,SD:u}))});var sT="and",SW=["typed","matrix","equalScalar","zeros","not","concat"],Fl=N(sT,SW,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=kr({typed:e,equalScalar:n}),u=uo({typed:e,equalScalar:n}),s=Yt({typed:e,equalScalar:n}),c=Or({typed:e}),f=ct({typed:e,matrix:t,concat:o});return e(sT,{"number, number":ov,"Complex, Complex":function(m,h){return(m.re!==0||m.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(m,h){return!m.isZero()&&!h.isZero()&&!m.isNaN()&&!h.isNaN()},"Unit, Unit":e.referToSelf(p=>(m,h)=>p(m.value||0,h.value||0)),"SparseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):s(m,h,p,!1)),"DenseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):c(m,h,p,!1)),"any, SparseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):s(h,m,p,!0)),"any, DenseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):c(h,m,p,!0)),"Array, any":e.referToSelf(p=>(m,h)=>p(t(m),h).valueOf()),"any, Array":e.referToSelf(p=>(m,h)=>p(m,t(h)).valueOf())},f({SS:u,DS:l}))});var $p="compare",EW=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],T0=N($p,EW,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:l,concat:u}=r,s=sr({typed:e}),c=so({typed:e,equalScalar:n}),f=qt({typed:e,DenseMatrix:l}),p=ct({typed:e,matrix:i,concat:u}),m=yi({typed:e});return e($p,DW({typed:e,config:t}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return nn(d,g,t.epsilon)?new a(0):new a(d.cmp(g))},"Fraction, Fraction":function(d,g){return new o(d.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:c,DS:s,Ss:f}))}),DW=N($p,["typed","config"],r=>{var{typed:e,config:t}=r;return e($p,{"number, number":function(i,a){return Pr(i,a,t.epsilon)?0:i>a?1:-1}})});var os=fr(lT(),1);var cT="compareNatural",NW=["typed","compare"],F0=N(cT,NW,r=>{var{typed:e,compare:t}=r,n=t.signatures["boolean,boolean"];return e(cT,{"any, any":i});function i(u,s){var c=Mt(u),f=Mt(s),p;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return p=t(u,s),p.toString()!=="0"?p>0?1:-1:(0,os.default)(c,f);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(c)||m.includes(f))return p=a(i,u,s),p!==0?p:(0,os.default)(c,f);if(c!==f)return(0,os.default)(c,f);if(c==="Complex")return CW(u,s);if(c==="Unit")return u.equalBase(s)?i(u.value,s.value):o(i,u.formatUnits(),s.formatUnits());if(c==="boolean")return n(u,s);if(c==="string")return(0,os.default)(u,s);if(c==="Object")return l(i,u,s);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(u,s,c){return Ri(s)&&Ri(c)?o(u,s.toJSON().values,c.toJSON().values):Ri(s)?a(u,s.toArray(),c):Ri(c)?a(u,s,c.toArray()):Qo(s)?a(u,s.toJSON().data,c):Qo(c)?a(u,s,c.toJSON().data):Array.isArray(s)?Array.isArray(c)?o(u,s,c):a(u,s,[c]):a(u,[s],c)}function o(u,s,c){for(var f=0,p=Math.min(s.length,c.length);f<p;f++){var m=u(s[f],c[f]);if(m!==0)return m}return s.length>c.length?1:s.length<c.length?-1:0}function l(u,s,c){var f=Object.keys(s),p=Object.keys(c);f.sort(os.default),p.sort(os.default);var m=o(u,f,p);if(m!==0)return m;for(var h=0;h<f.length;h++){var d=u(s[f[h]],c[p[h]]);if(d!==0)return d}return 0}});function CW(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0}var fT="compareText",MW=["typed","matrix","concat"];yp.signature="any, any";var I0=N(fT,MW,r=>{var{typed:e,matrix:t,concat:n}=r,i=ct({typed:e,matrix:t,concat:n});return e(fT,yp,i({elop:yp,Ds:!0}))});var qp="equal",TW=["typed","matrix","equalScalar","DenseMatrix","concat"],B0=N(qp,TW,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=zr({typed:e,DenseMatrix:i}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:t,concat:a});return e(qp,FW({typed:e,equalScalar:n}),s({elop:n,SS:l,DS:o,Ss:u}))}),FW=N(qp,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(qp,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:t(i,a)}})});var pT="equalText",IW=["typed","compareText","isZero"],P0=N(pT,IW,r=>{var{typed:e,compareText:t,isZero:n}=r;return e(pT,{"any, any":function(a,o){return n(t(a,o))}})});var zp="smaller",BW=["typed","config","matrix","DenseMatrix","concat"],O0=N(zp,BW,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=zr({typed:e,DenseMatrix:i}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=yi({typed:e});return e(zp,PW({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<p,"BigNumber, BigNumber":function(p,m){return p.lt(m)&&!nn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)===-1,"Complex, Complex":function(p,m){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),PW=N(zp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(zp,{"number, number":function(i,a){return i<a&&!Pr(i,a,t.epsilon)}})});var Hp="smallerEq",OW=["typed","config","matrix","DenseMatrix","concat"],k0=N(Hp,OW,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=zr({typed:e,DenseMatrix:i}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=yi({typed:e});return e(Hp,kW({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||nn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),kW=N(Hp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(Hp,{"number, number":function(i,a){return i<=a||Pr(i,a,t.epsilon)}})});var Gp="larger",RW=["typed","config","matrix","DenseMatrix","concat"],R0=N(Gp,RW,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=zr({typed:e,DenseMatrix:i}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=yi({typed:e});return e(Gp,LW({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!nn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),LW=N(Gp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(Gp,{"number, number":function(i,a){return i>a&&!Pr(i,a,t.epsilon)}})});var Wp="largerEq",UW=["typed","config","matrix","DenseMatrix","concat"],L0=N(Wp,UW,r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:a}=r,o=sr({typed:e}),l=zr({typed:e,DenseMatrix:i}),u=qt({typed:e,DenseMatrix:i}),s=ct({typed:e,matrix:n,concat:a}),c=yi({typed:e});return e(Wp,VW({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||nn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,s({SS:l,DS:o,Ss:u}))}),VW=N(Wp,["typed","config"],r=>{var{typed:e,config:t}=r;return e(Wp,{"number, number":function(i,a){return i>=a||Pr(i,a,t.epsilon)}})});var mT="deepEqual",$W=["typed","equal"],U0=N(mT,$W,r=>{var{typed:e,equal:t}=r;return e(mT,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var l=0;l<o;l++)if(!n(i[l],a[l]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:t(i,a)}});var jp="unequal",qW=["typed","config","equalScalar","matrix","DenseMatrix","concat"],V0=N(jp,qW,r=>{var{typed:e,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=r,l=sr({typed:e}),u=zr({typed:e,DenseMatrix:a}),s=qt({typed:e,DenseMatrix:a}),c=ct({typed:e,matrix:i,concat:o});return e(jp,zW({typed:e,equalScalar:n}),c({elop:f,SS:u,DS:l,Ss:s}));function f(p,m){return!n(p,m)}}),zW=N(jp,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(jp,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!t(i,a)}})});var dT="partitionSelect",HW=["typed","isNumeric","isNaN","compare"],$0=N(dT,HW,r=>{var{typed:e,isNumeric:t,isNaN:n,compare:i}=r,a=i,o=(s,c)=>-i(s,c);return e(dT,{"Array | Matrix, number":function(c,f){return l(c,f,a)},"Array | Matrix, number, string":function(c,f,p){if(p==="asc")return l(c,f,a);if(p==="desc")return l(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":l});function l(s,c,f){if(!ze(c)||c<0)throw new Error("k must be a non-negative integer");if(Ge(s)){var p=s.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return u(s.valueOf(),c,f)}if(Array.isArray(s))return u(s,c,f)}function u(s,c,f){if(c>=s.length)throw new Error("k out of bounds");for(var p=0;p<s.length;p++)if(t(s[p])&&n(s[p]))return s[p];for(var m=0,h=s.length-1;m<h;){for(var d=m,g=h,v=s[Math.floor(Math.random()*(h-m+1))+m];d<g;)if(f(s[d],v)>=0){var w=s[g];s[g]=s[d],s[d]=w,--g}else++d;f(s[d],v)>0&&--d,c<=d?h=d:m=d+1}return s[c]}});var hT="sort",GW=["typed","matrix","compare","compareNatural"],q0=N(hT,GW,r=>{var{typed:e,matrix:t,compare:n,compareNatural:i}=r,a=n,o=(c,f)=>-n(c,f);return e(hT,{Array:function(f){return u(f),f.sort(a)},Matrix:function(f){return s(f),t(f.toArray().sort(a),f.storage())},"Array, function":function(f,p){return u(f),f.sort(p)},"Matrix, function":function(f,p){return s(f),t(f.toArray().sort(p),f.storage())},"Array, string":function(f,p){return u(f),f.sort(l(p))},"Matrix, string":function(f,p){return s(f),t(f.toArray().sort(l(p)),f.storage())}});function l(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(c){if(nt(c).length!==1)throw new Error("One dimensional array expected")}function s(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var gT="max",WW=["typed","config","numeric","larger"],Il=N(gT,WW,r=>{var{typed:e,config:t,numeric:n,larger:i}=r;return e(gT,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return oo(u,s.valueOf(),a)},"...":function(u){if(vi(u))throw new TypeError("Scalar values expected in function max");return o(u)}});function a(l,u){try{return i(l,u)?l:u}catch(s){throw Er(s,"max",u)}}function o(l){var u;if(bn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw Er(c,"max",s)}}),u===void 0)throw new Error("Cannot calculate max of an empty array");return typeof u=="string"&&(u=n(u,t.number)),u}});var vT="min",jW=["typed","config","numeric","smaller"],Bl=N(vT,jW,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r;return e(vT,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(u,s){return oo(u,s.valueOf(),a)},"...":function(u){if(vi(u))throw new TypeError("Scalar values expected in function min");return o(u)}});function a(l,u){try{return i(l,u)?l:u}catch(s){throw Er(s,"min",u)}}function o(l){var u;if(bn(l,function(s){try{isNaN(s)&&typeof s=="number"?u=NaN:(u===void 0||i(s,u))&&(u=s)}catch(c){throw Er(c,"min",s)}}),u===void 0)throw new Error("Cannot calculate min of an empty array");return typeof u=="string"&&(u=n(u,t.number)),u}});var ZW="ImmutableDenseMatrix",JW=["smaller","DenseMatrix"],z0=N(ZW,JW,r=>{var{smaller:e,DenseMatrix:t}=r;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!Ar(a))throw new Error("Invalid datatype: "+a);if(Ge(i)||It(i)){var o=new t(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&It(i.data)&&It(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min!="undefined"?i.min:null,this._max=typeof i.max!="undefined"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+Mt(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return Ge(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:et(this._data),size:et(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||e(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||e(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0});var YW="Index",XW=["ImmutableDenseMatrix","getMatrixDataType"],H0=N(YW,XW,r=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=r;function n(a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,l=arguments.length;o<l;o++){var u=arguments[o],s=It(u),c=Ge(u),f=null;if(tu(u))this._dimensions.push(u),this._isScalar=!1;else if(s||c){var p=void 0;t(u)==="boolean"?(s&&(p=i(yT(u).valueOf())),c&&(p=i(yT(u._data).valueOf())),f=u.valueOf().length):p=i(u.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof u=="number")this._dimensions.push(i([u]));else if(typeof u=="string")this._dimensions.push(u);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}n.prototype.type="Index",n.prototype.isIndex=!0;function i(a){for(var o=0,l=a.length;o<l;o++)if(typeof a[o]!="number"||!ze(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new e(a)}return n.prototype.clone=function(){var a=new n;return a._dimensions=et(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},n.create=function(a){var o=new n;return n.apply(o,a),o},n.prototype.size=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?1:u.size()[0]}return a},n.prototype.max=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?u:u.max()}return a},n.prototype.min=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a[o]=typeof u=="string"?u:u.min()}return a},n.prototype.forEach=function(a){for(var o=0,l=this._dimensions.length;o<l;o++)a(this._dimensions[o],o,this)},n.prototype.dimension=function(a){return this._dimensions[a]||null},n.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];a.push(typeof u=="string"?u:u.toArray())}return a},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var a=[],o=0,l=this._dimensions.length;o<l;o++){var u=this._dimensions[o];typeof u=="string"?a.push(JSON.stringify(u)):a.push(u.toString())}return"["+a.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(a){return n.create(a.dimensions)},n},{isClass:!0});function yT(r){var e=[];return r.forEach((t,n)=>{t&&e.push(n)}),e}var QW="FibonacciHeap",KW=["smaller","larger"],G0=N(QW,KW,r=>{var{smaller:e,larger:t}=r,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var p={key:c,value:f,degree:0};if(this._minimum){var m=this._minimum;p.left=m,p.right=m.right,m.right=p,p.right.left=p,e(c,m.key)&&(this._minimum=p)}else p.left=p,p.right=p,this._minimum=p;return this._size++,p},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var f=this._minimum,p=c.degree,m=c.child;p>0;){var h=m.right;m.left.right=m.right,m.right.left=m.left,m.left=f,m.right=f.right,f.right=m,m.right.left=m,m.parent=null,m=h,p--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=s(f,this._size)),this._size--,this._minimum=f,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,f,p){f.key=p;var m=f.parent;return m&&e(f.key,m.key)&&(o(c,f,m),l(c,m)),e(f.key,c.key)&&(c=f),c}function o(c,f,p){f.left.right=f.right,f.right.left=f.left,p.degree--,p.child===f&&(p.child=f.right),p.degree===0&&(p.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function l(c,f){var p=f.parent;p&&(f.mark?(o(c,f,p),l(p)):f.mark=!0)}var u=function(f,p){f.left.right=f.right,f.right.left=f.left,f.parent=p,p.child?(f.left=p.child,f.right=p.child.right,p.child.right=f,f.right.left=f):(p.child=f,f.right=f,f.left=f),p.degree++,f.mark=!1};function s(c,f){var p=Math.floor(Math.log(f)*n)+1,m=new Array(p),h=0,d=c;if(d)for(h++,d=d.right;d!==c;)h++,d=d.right;for(var g;h>0;){for(var v=d.degree,w=d.right;g=m[v],!!g;){if(t(d.key,g.key)){var y=g;g=d,d=y}u(g,d),m[v]=null,v++}m[v]=d,d=w,h--}c=null;for(var x=0;x<p;x++)g=m[x],g&&(c?(g.left.right=g.right,g.right.left=g.left,g.left=c,g.right=c.right,c.right=g,g.right.left=g,e(g.key,c.key)&&(c=g)):c=g);return c}return i},{isClass:!0});var ej="Spa",tj=["addScalar","equalScalar","FibonacciHeap"],W0=N(ej,tj,r=>{var{addScalar:e,equalScalar:t,FibonacciHeap:n}=r;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var l=this._heap.insert(a,o);this._values[a]=l}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var l=this._values[a];l?l.value=e(l.value,o):(l=this._heap.insert(a,o),this._values[a]=l)},i.prototype.forEach=function(a,o,l){var u=this._heap,s=this._values,c=[],f=u.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(t(f.value,0)||l(f.key,f.value,this)),f=u.extractMinimum(),f&&c.push(f);for(var p=0;p<c.length;p++){var m=c[p];f=u.insert(m.key,m.value),s[f.key]=f}},i.prototype.swap=function(a,o){var l=this._values[a],u=this._values[o];if(!l&&u)l=this._heap.insert(a,u.value),this._heap.remove(u),this._values[a]=l,this._values[o]=void 0;else if(l&&!u)u=this._heap.insert(o,l.value),this._heap.remove(l),this._values[o]=u,this._values[a]=void 0;else if(l&&u){var s=l.value;l.value=u.value,u.value=s}},i},{isClass:!0});var bT=ns(function(r){return new r(1).exp()},{hasher:Zp}),xT=ns(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:Zp}),Pl=ns(function(r){return r.acos(-1)},{hasher:Zp}),wT=ns(function(r){return Pl(r).times(2)},{hasher:Zp});function Zp(r){return r[0].precision}function _T(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function j0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_T(Object(t),!0).forEach(function(n){Ht(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_T(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var rj="Unit",nj=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],Z0=N(rj,nj,r=>{var{on:e,config:t,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:l,abs:u,fix:s,round:c,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:v}=r,w=h;function y(V,X){if(!(this instanceof y))throw new Error("Constructor must be called with the new operator");if(!(V==null||p(V)||Mn(V)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,X===void 0)this.units=[],this.dimensions=$.map(W=>0);else if(typeof X=="string"){var fe=y.parse(X);this.units=fe.units,this.dimensions=fe.dimensions}else if(ln(X)&&X.value===null)this.fixPrefix=X.fixPrefix,this.skipAutomaticSimplification=X.skipAutomaticSimplification,this.dimensions=X.dimensions.slice(0),this.units=X.units.map(W=>yr({},W));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(V)}Object.defineProperty(y,"name",{value:"Unit"}),y.prototype.constructor=y,y.prototype.type="Unit",y.prototype.isUnit=!0;var x,_,b;function E(){for(;b===" "||b===" ";)S()}function D(V){return V>="0"&&V<="9"||V==="."}function A(V){return V>="0"&&V<="9"}function S(){_++,b=x.charAt(_)}function M(V){_=V,b=x.charAt(_)}function F(){var V="",X=_;if(b==="+"?S():b==="-"&&(V+=b,S()),!D(b))return M(X),null;if(b==="."){if(V+=b,S(),!A(b))return M(X),null}else{for(;A(b);)V+=b,S();b==="."&&(V+=b,S())}for(;A(b);)V+=b,S();if(b==="E"||b==="e"){var fe="",W=_;if(fe+=b,S(),(b==="+"||b==="-")&&(fe+=b,S()),!A(b))return M(W),V;for(V=V+fe;A(b);)V+=b,S()}return V}function P(){for(var V="";A(b)||y.isValidAlpha(b);)V+=b,S();var X=V.charAt(0);return y.isValidAlpha(X)?V:null}function R(V){return b===V?(S(),V):null}y.parse=function(V,X){if(X=X||{},x=V,_=-1,b="",typeof x!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var fe=new y;fe.units=[];var W=1,te=!1;S(),E();var ie=F(),ge=null;if(ie){if(t.number==="BigNumber")ge=new g(ie);else if(t.number==="Fraction")try{ge=new v(ie)}catch(pe){ge=parseFloat(ie)}else ge=parseFloat(ie);E(),R("*")?(W=1,te=!0):R("/")&&(W=-1,te=!0)}for(var ye=[],qe=1;;){for(E();b==="(";)ye.push(W),qe*=W,W=1,S(),E();var De=void 0;if(b){var ft=b;if(De=P(),De===null)throw new SyntaxError('Unexpected "'+ft+'" in "'+x+'" at index '+_.toString())}else break;var wt=O(De);if(wt===null)throw new SyntaxError('Unit "'+De+'" not found.');var jt=W*qe;if(E(),R("^")){E();var nr=F();if(nr===null)throw new SyntaxError('In "'+V+'", "^" must be followed by a floating-point number');jt*=nr}fe.units.push({unit:wt.unit,prefix:wt.prefix,power:jt});for(var Y=0;Y<$.length;Y++)fe.dimensions[Y]+=(wt.unit.dimensions[Y]||0)*jt;for(E();b===")";){if(ye.length===0)throw new SyntaxError('Unmatched ")" in "'+x+'" at index '+_.toString());qe/=ye.pop(),S(),E()}if(te=!1,R("*")?(W=1,te=!0):R("/")?(W=-1,te=!0):W=1,wt.unit.base){var oe=wt.unit.base.key;se.auto[oe]={unit:wt.unit,prefix:wt.prefix}}}if(E(),b)throw new SyntaxError('Could not parse: "'+V+'"');if(te)throw new SyntaxError('Trailing characters: "'+V+'"');if(ye.length!==0)throw new SyntaxError('Unmatched "(" in "'+x+'"');if(fe.units.length===0&&!X.allowNoUnits)throw new SyntaxError('"'+V+'" contains no units');return fe.value=ge!==void 0?fe._normalize(ge):null,fe},y.prototype.clone=function(){var V=new y;V.fixPrefix=this.fixPrefix,V.skipAutomaticSimplification=this.skipAutomaticSimplification,V.value=et(this.value),V.dimensions=this.dimensions.slice(0),V.units=[];for(var X=0;X<this.units.length;X++){V.units[X]={};for(var fe in this.units[X])Ze(this.units[X],fe)&&(V.units[X][fe]=this.units[X][fe])}return V},y.prototype.valueType=function(){return Mt(this.value)},y.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},y.prototype._normalize=function(V){if(V==null||this.units.length===0)return V;for(var X=V,fe=y._getNumberConverter(Mt(V)),W=0;W<this.units.length;W++){var te=fe(this.units[W].unit.value),ie=fe(this.units[W].prefix.value),ge=fe(this.units[W].power);X=a(X,l(a(te,ie),ge))}return X},y.prototype._denormalize=function(V,X){if(V==null||this.units.length===0)return V;for(var fe=V,W=y._getNumberConverter(Mt(V)),te=0;te<this.units.length;te++){var ie=W(this.units[te].unit.value),ge=W(this.units[te].prefix.value),ye=W(this.units[te].power);fe=o(fe,l(a(ie,ge),ye))}return fe};var O=ns(V=>{if(Ze(L,V)){var X=L[V],fe=X.prefixes[""];return{unit:X,prefix:fe}}for(var W in L)if(Ze(L,W)&&vN(V,W)){var te=L[W],ie=V.length-W.length,ge=V.substring(0,ie),ye=Ze(te.prefixes,ge)?te.prefixes[ge]:void 0;if(ye!==void 0)return{unit:te,prefix:ye}}return null},{hasher:V=>V[0],limit:100});y.isValuelessUnit=function(V){return O(V)!==null},y.prototype.hasBase=function(V){if(typeof V=="string"&&(V=B[V]),!V)return!1;for(var X=0;X<$.length;X++)if(Math.abs((this.dimensions[X]||0)-(V.dimensions[X]||0))>1e-12)return!1;return!0},y.prototype.equalBase=function(V){for(var X=0;X<$.length;X++)if(Math.abs((this.dimensions[X]||0)-(V.dimensions[X]||0))>1e-12)return!1;return!0},y.prototype.equals=function(V){return this.equalBase(V)&&f(this.value,V.value)},y.prototype.multiply=function(V){for(var X=this.clone(),fe=ln(V)?V:new y(V),W=0;W<$.length;W++)X.dimensions[W]=(this.dimensions[W]||0)+(fe.dimensions[W]||0);for(var te=0;te<fe.units.length;te++){var ie=j0({},fe.units[te]);X.units.push(ie)}if(this.value!==null||fe.value!==null){var ge=this.value===null?this._normalize(1):this.value,ye=fe.value===null?fe._normalize(1):fe.value;X.value=a(ge,ye)}else X.value=null;return ln(V)&&(X.skipAutomaticSimplification=!1),I(X)},y.prototype.divideInto=function(V){return new y(V).divide(this)},y.prototype.divide=function(V){for(var X=this.clone(),fe=ln(V)?V:new y(V),W=0;W<$.length;W++)X.dimensions[W]=(this.dimensions[W]||0)-(fe.dimensions[W]||0);for(var te=0;te<fe.units.length;te++){var ie=j0(j0({},fe.units[te]),{},{power:-fe.units[te].power});X.units.push(ie)}if(this.value!==null||fe.value!==null){var ge=this.value===null?this._normalize(1):this.value,ye=fe.value===null?fe._normalize(1):fe.value;X.value=o(ge,ye)}else X.value=null;return ln(V)&&(X.skipAutomaticSimplification=!1),I(X)},y.prototype.pow=function(V){for(var X=this.clone(),fe=0;fe<$.length;fe++)X.dimensions[fe]=(this.dimensions[fe]||0)*V;for(var W=0;W<X.units.length;W++)X.units[W].power*=V;return X.value!==null?X.value=l(X.value,V):X.value=null,X.skipAutomaticSimplification=!1,I(X)};function I(V){return V.equalBase(B.NONE)&&V.value!==null&&!t.predictable?V.value:V}y.prototype.abs=function(){var V=this.clone();if(V.value!==null)if(V._isDerived()||V.units.length===0||V.units[0].unit.offset===0)V.value=u(V.value);else{var X=V._numberConverter(),fe=X(V.units[0].unit.value),W=X(V.units[0].unit.offset),te=a(fe,W);V.value=i(u(n(V.value,te)),te)}for(var ie in V.units)(V.units[ie].unit.name==="VA"||V.units[ie].unit.name==="VAR")&&(V.units[ie].unit=L.W);return V},y.prototype.to=function(V){var X=this.value===null?this._normalize(1):this.value,fe;if(typeof V=="string")fe=y.parse(V);else if(ln(V))fe=V.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(fe))throw new Error("Units do not match ('".concat(fe.toString(),"' != '").concat(this.toString(),"')"));if(fe.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||fe.units.length===0||this.units[0].unit.offset===fe.units[0].unit.offset)fe.value=et(X);else{var W=y._getNumberConverter(Mt(X)),te=this.units[0].unit.value,ie=this.units[0].unit.offset,ge=a(te,ie),ye=fe.units[0].unit.value,qe=fe.units[0].unit.offset,De=a(ye,qe);fe.value=n(X,W(i(ge,De)))}return fe.fixPrefix=!0,fe.skipAutomaticSimplification=!0,fe},y.prototype.toNumber=function(V){return w(this.toNumeric(V))},y.prototype.toNumeric=function(V){var X;return V?X=this.to(V):X=this.clone(),X._isDerived()||X.units.length===0?X._denormalize(X.value):X._denormalize(X.value,X.units[0].prefix.value)},y.prototype.toString=function(){return this.format()},y.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},y.fromJSON=function(V){var X=new y(V.value,V.unit);return X.fixPrefix=V.fixPrefix||!1,X},y.prototype.valueOf=y.prototype.toString,y.prototype.simplify=function(){var V=this.clone(),X=[],fe;for(var W in le)if(Ze(le,W)&&V.hasBase(B[W])){fe=W;break}if(fe==="NONE")V.units=[];else{var te;if(fe&&Ze(le,fe)&&(te=le[fe]),te)V.units=[{unit:te.unit,prefix:te.prefix,power:1}];else{for(var ie=!1,ge=0;ge<$.length;ge++){var ye=$[ge];Math.abs(V.dimensions[ge]||0)>1e-12&&(Ze(le,ye)?X.push({unit:le[ye].unit,prefix:le[ye].prefix,power:V.dimensions[ge]||0}):ie=!0)}X.length<V.units.length&&!ie&&(V.units=X)}}return V},y.prototype.toSI=function(){for(var V=this.clone(),X=[],fe=0;fe<$.length;fe++){var W=$[fe];if(Math.abs(V.dimensions[fe]||0)>1e-12)if(Ze(se.si,W))X.push({unit:se.si[W].unit,prefix:se.si[W].prefix,power:V.dimensions[fe]||0});else throw new Error("Cannot express custom unit "+W+" in SI units")}return V.units=X,V.fixPrefix=!0,V.skipAutomaticSimplification=!0,this.value!==null?(V.value=null,this.to(V)):V},y.prototype.formatUnits=function(){for(var V="",X="",fe=0,W=0,te=0;te<this.units.length;te++)this.units[te].power>0?(fe++,V+=" "+this.units[te].prefix.name+this.units[te].unit.name,Math.abs(this.units[te].power-1)>1e-15&&(V+="^"+this.units[te].power)):this.units[te].power<0&&W++;if(W>0)for(var ie=0;ie<this.units.length;ie++)this.units[ie].power<0&&(fe>0?(X+=" "+this.units[ie].prefix.name+this.units[ie].unit.name,Math.abs(this.units[ie].power+1)>1e-15&&(X+="^"+-this.units[ie].power)):(X+=" "+this.units[ie].prefix.name+this.units[ie].unit.name,X+="^"+this.units[ie].power));V=V.substr(1),X=X.substr(1),fe>1&&W>0&&(V="("+V+")"),W>1&&fe>0&&(X="("+X+")");var ge=V;return fe>0&&W>0&&(ge+=" / "),ge+=X,ge},y.prototype.format=function(V){var X=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),fe=!1;typeof X.value!="undefined"&&X.value!==null&&Mn(X.value)&&(fe=Math.abs(X.value.re)<1e-14);for(var W in X.units)Ze(X.units,W)&&X.units[W].unit&&(X.units[W].unit.name==="VA"&&fe?X.units[W].unit=L.VAR:X.units[W].unit.name==="VAR"&&!fe&&(X.units[W].unit=L.VA));X.units.length===1&&!X.fixPrefix&&Math.abs(X.units[0].power-Math.round(X.units[0].power))<1e-14&&(X.units[0].prefix=X._bestPrefix());var te=X._denormalize(X.value),ie=X.value!==null?m(te,V||{}):"",ge=X.formatUnits();return X.value&&Mn(X.value)&&(ie="("+ie+")"),ge.length>0&&ie.length>0&&(ie+=" "),ie+=ge,ie},y.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var V=this.value!==null?u(this.value):0,X=u(this.units[0].unit.value),fe=this.units[0].prefix;if(V===0)return fe;var W=this.units[0].power,te=Math.log(V/Math.pow(fe.value*X,W))/Math.LN10-1.2;if(te>-2.200001&&te<1.800001)return fe;te=Math.abs(te);var ie=this.units[0].unit.prefixes;for(var ge in ie)if(Ze(ie,ge)){var ye=ie[ge];if(ye.scientific){var qe=Math.abs(Math.log(V/Math.pow(ye.value*X,W))/Math.LN10-1.2);(qe<te||qe===te&&ye.name.length<fe.name.length)&&(fe=ye,te=qe)}}return fe},y.prototype.splitUnit=function(V){for(var X=this.clone(),fe=[],W=0;W<V.length&&(X=X.to(V[W]),W!==V.length-1);W++){var te=X.toNumeric(),ie=c(te),ge=void 0,ye=f(ie,te);ye?ge=ie:ge=s(X.toNumeric());var qe=new y(ge,V[W].toString());fe.push(qe),X=i(X,qe)}for(var De=0,ft=0;ft<fe.length;ft++)De=n(De,fe[ft].value);return f(De,this.value)&&(X.value=0),fe.push(X),fe};var T={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};T.SHORTLONG=yr({},T.SHORT,T.LONG),T.BINARY_SHORT=yr({},T.BINARY_SHORT_SI,T.BINARY_SHORT_IEC),T.BINARY_LONG=yr({},T.BINARY_LONG_SI,T.BINARY_LONG_IEC);var $=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],B={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var U in B)Ze(B,U)&&(B[U].key=U);var G={},H={name:"",base:G,value:1,offset:0,dimensions:$.map(V=>0)},L={meter:{name:"meter",base:B.LENGTH,prefixes:T.LONG,value:1,offset:0},inch:{name:"inch",base:B.LENGTH,prefixes:T.NONE,value:.0254,offset:0},foot:{name:"foot",base:B.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yard:{name:"yard",base:B.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mile:{name:"mile",base:B.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},link:{name:"link",base:B.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rod:{name:"rod",base:B.LENGTH,prefixes:T.NONE,value:5.0292,offset:0},chain:{name:"chain",base:B.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:B.LENGTH,prefixes:T.NONE,value:1e-10,offset:0},m:{name:"m",base:B.LENGTH,prefixes:T.SHORT,value:1,offset:0},in:{name:"in",base:B.LENGTH,prefixes:T.NONE,value:.0254,offset:0},ft:{name:"ft",base:B.LENGTH,prefixes:T.NONE,value:.3048,offset:0},yd:{name:"yd",base:B.LENGTH,prefixes:T.NONE,value:.9144,offset:0},mi:{name:"mi",base:B.LENGTH,prefixes:T.NONE,value:1609.344,offset:0},li:{name:"li",base:B.LENGTH,prefixes:T.NONE,value:.201168,offset:0},rd:{name:"rd",base:B.LENGTH,prefixes:T.NONE,value:5.02921,offset:0},ch:{name:"ch",base:B.LENGTH,prefixes:T.NONE,value:20.1168,offset:0},mil:{name:"mil",base:B.LENGTH,prefixes:T.NONE,value:254e-7,offset:0},m2:{name:"m2",base:B.SURFACE,prefixes:T.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:B.SURFACE,prefixes:T.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:B.SURFACE,prefixes:T.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:B.SURFACE,prefixes:T.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:B.SURFACE,prefixes:T.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:B.SURFACE,prefixes:T.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:B.SURFACE,prefixes:T.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:B.SURFACE,prefixes:T.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:B.SURFACE,prefixes:T.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:B.SURFACE,prefixes:T.NONE,value:1e4,offset:0},m3:{name:"m3",base:B.VOLUME,prefixes:T.CUBIC,value:1,offset:0},L:{name:"L",base:B.VOLUME,prefixes:T.SHORT,value:.001,offset:0},l:{name:"l",base:B.VOLUME,prefixes:T.SHORT,value:.001,offset:0},litre:{name:"litre",base:B.VOLUME,prefixes:T.LONG,value:.001,offset:0},cuin:{name:"cuin",base:B.VOLUME,prefixes:T.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:B.VOLUME,prefixes:T.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:B.VOLUME,prefixes:T.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:B.VOLUME,prefixes:T.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:B.VOLUME,prefixes:T.NONE,value:15e-6,offset:0},drop:{name:"drop",base:B.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:B.VOLUME,prefixes:T.NONE,value:5e-8,offset:0},minim:{name:"minim",base:B.VOLUME,prefixes:T.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:B.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:B.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:B.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:B.VOLUME,prefixes:T.NONE,value:1e-6,offset:0},cup:{name:"cup",base:B.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:B.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:B.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:B.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:B.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:B.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:B.VOLUME,prefixes:T.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:B.VOLUME,prefixes:T.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:B.VOLUME,prefixes:T.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:B.VOLUME,prefixes:T.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:B.VOLUME,prefixes:T.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:B.VOLUME,prefixes:T.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:B.VOLUME,prefixes:T.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:B.VOLUME,prefixes:T.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:B.VOLUME,prefixes:T.NONE,value:.1173478,offset:0},obl:{name:"obl",base:B.VOLUME,prefixes:T.NONE,value:.1589873,offset:0},g:{name:"g",base:B.MASS,prefixes:T.SHORT,value:.001,offset:0},gram:{name:"gram",base:B.MASS,prefixes:T.LONG,value:.001,offset:0},ton:{name:"ton",base:B.MASS,prefixes:T.SHORT,value:907.18474,offset:0},t:{name:"t",base:B.MASS,prefixes:T.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:B.MASS,prefixes:T.LONG,value:1e3,offset:0},grain:{name:"grain",base:B.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:B.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:B.MASS,prefixes:T.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:B.MASS,prefixes:T.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:B.MASS,prefixes:T.NONE,value:45.359237,offset:0},stick:{name:"stick",base:B.MASS,prefixes:T.NONE,value:.115,offset:0},stone:{name:"stone",base:B.MASS,prefixes:T.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:B.MASS,prefixes:T.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:B.MASS,prefixes:T.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:B.MASS,prefixes:T.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:B.MASS,prefixes:T.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:B.MASS,prefixes:T.NONE,value:45.359237,offset:0},s:{name:"s",base:B.TIME,prefixes:T.SHORT,value:1,offset:0},min:{name:"min",base:B.TIME,prefixes:T.NONE,value:60,offset:0},h:{name:"h",base:B.TIME,prefixes:T.NONE,value:3600,offset:0},second:{name:"second",base:B.TIME,prefixes:T.LONG,value:1,offset:0},sec:{name:"sec",base:B.TIME,prefixes:T.LONG,value:1,offset:0},minute:{name:"minute",base:B.TIME,prefixes:T.NONE,value:60,offset:0},hour:{name:"hour",base:B.TIME,prefixes:T.NONE,value:3600,offset:0},day:{name:"day",base:B.TIME,prefixes:T.NONE,value:86400,offset:0},week:{name:"week",base:B.TIME,prefixes:T.NONE,value:7*86400,offset:0},month:{name:"month",base:B.TIME,prefixes:T.NONE,value:2629800,offset:0},year:{name:"year",base:B.TIME,prefixes:T.NONE,value:31557600,offset:0},decade:{name:"decade",base:B.TIME,prefixes:T.NONE,value:315576e3,offset:0},century:{name:"century",base:B.TIME,prefixes:T.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:B.TIME,prefixes:T.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:B.FREQUENCY,prefixes:T.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:B.FREQUENCY,prefixes:T.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:B.ANGLE,prefixes:T.SHORT,value:1,offset:0},radian:{name:"radian",base:B.ANGLE,prefixes:T.LONG,value:1,offset:0},deg:{name:"deg",base:B.ANGLE,prefixes:T.SHORT,value:null,offset:0},degree:{name:"degree",base:B.ANGLE,prefixes:T.LONG,value:null,offset:0},grad:{name:"grad",base:B.ANGLE,prefixes:T.SHORT,value:null,offset:0},gradian:{name:"gradian",base:B.ANGLE,prefixes:T.LONG,value:null,offset:0},cycle:{name:"cycle",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:B.ANGLE,prefixes:T.NONE,value:null,offset:0},A:{name:"A",base:B.CURRENT,prefixes:T.SHORT,value:1,offset:0},ampere:{name:"ampere",base:B.CURRENT,prefixes:T.LONG,value:1,offset:0},K:{name:"K",base:B.TEMPERATURE,prefixes:T.SHORT,value:1,offset:0},degC:{name:"degC",base:B.TEMPERATURE,prefixes:T.SHORT,value:1,offset:273.15},degF:{name:"degF",base:B.TEMPERATURE,prefixes:T.SHORT,value:new v(5,9),offset:459.67},degR:{name:"degR",base:B.TEMPERATURE,prefixes:T.SHORT,value:new v(5,9),offset:0},kelvin:{name:"kelvin",base:B.TEMPERATURE,prefixes:T.LONG,value:1,offset:0},celsius:{name:"celsius",base:B.TEMPERATURE,prefixes:T.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:B.TEMPERATURE,prefixes:T.LONG,value:new v(5,9),offset:459.67},rankine:{name:"rankine",base:B.TEMPERATURE,prefixes:T.LONG,value:new v(5,9),offset:0},mol:{name:"mol",base:B.AMOUNT_OF_SUBSTANCE,prefixes:T.SHORT,value:1,offset:0},mole:{name:"mole",base:B.AMOUNT_OF_SUBSTANCE,prefixes:T.LONG,value:1,offset:0},cd:{name:"cd",base:B.LUMINOUS_INTENSITY,prefixes:T.SHORT,value:1,offset:0},candela:{name:"candela",base:B.LUMINOUS_INTENSITY,prefixes:T.LONG,value:1,offset:0},N:{name:"N",base:B.FORCE,prefixes:T.SHORT,value:1,offset:0},newton:{name:"newton",base:B.FORCE,prefixes:T.LONG,value:1,offset:0},dyn:{name:"dyn",base:B.FORCE,prefixes:T.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:B.FORCE,prefixes:T.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:B.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:B.FORCE,prefixes:T.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:B.FORCE,prefixes:T.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:B.FORCE,prefixes:T.NONE,value:9.80665,offset:0},J:{name:"J",base:B.ENERGY,prefixes:T.SHORT,value:1,offset:0},joule:{name:"joule",base:B.ENERGY,prefixes:T.LONG,value:1,offset:0},erg:{name:"erg",base:B.ENERGY,prefixes:T.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:B.ENERGY,prefixes:T.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:B.ENERGY,prefixes:T.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:B.ENERGY,prefixes:T.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:B.ENERGY,prefixes:T.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:B.POWER,prefixes:T.SHORT,value:1,offset:0},watt:{name:"watt",base:B.POWER,prefixes:T.LONG,value:1,offset:0},hp:{name:"hp",base:B.POWER,prefixes:T.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:B.POWER,prefixes:T.SHORT,value:d.I,offset:0},VA:{name:"VA",base:B.POWER,prefixes:T.SHORT,value:1,offset:0},Pa:{name:"Pa",base:B.PRESSURE,prefixes:T.SHORT,value:1,offset:0},psi:{name:"psi",base:B.PRESSURE,prefixes:T.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:B.PRESSURE,prefixes:T.NONE,value:101325,offset:0},bar:{name:"bar",base:B.PRESSURE,prefixes:T.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:B.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:B.PRESSURE,prefixes:T.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:B.PRESSURE,prefixes:T.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:B.PRESSURE,prefixes:T.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:B.ELECTRIC_CHARGE,prefixes:T.LONG,value:1,offset:0},C:{name:"C",base:B.ELECTRIC_CHARGE,prefixes:T.SHORT,value:1,offset:0},farad:{name:"farad",base:B.ELECTRIC_CAPACITANCE,prefixes:T.LONG,value:1,offset:0},F:{name:"F",base:B.ELECTRIC_CAPACITANCE,prefixes:T.SHORT,value:1,offset:0},volt:{name:"volt",base:B.ELECTRIC_POTENTIAL,prefixes:T.LONG,value:1,offset:0},V:{name:"V",base:B.ELECTRIC_POTENTIAL,prefixes:T.SHORT,value:1,offset:0},ohm:{name:"ohm",base:B.ELECTRIC_RESISTANCE,prefixes:T.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:B.ELECTRIC_INDUCTANCE,prefixes:T.LONG,value:1,offset:0},H:{name:"H",base:B.ELECTRIC_INDUCTANCE,prefixes:T.SHORT,value:1,offset:0},siemens:{name:"siemens",base:B.ELECTRIC_CONDUCTANCE,prefixes:T.LONG,value:1,offset:0},S:{name:"S",base:B.ELECTRIC_CONDUCTANCE,prefixes:T.SHORT,value:1,offset:0},weber:{name:"weber",base:B.MAGNETIC_FLUX,prefixes:T.LONG,value:1,offset:0},Wb:{name:"Wb",base:B.MAGNETIC_FLUX,prefixes:T.SHORT,value:1,offset:0},tesla:{name:"tesla",base:B.MAGNETIC_FLUX_DENSITY,prefixes:T.LONG,value:1,offset:0},T:{name:"T",base:B.MAGNETIC_FLUX_DENSITY,prefixes:T.SHORT,value:1,offset:0},b:{name:"b",base:B.BIT,prefixes:T.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:B.BIT,prefixes:T.BINARY_LONG,value:1,offset:0},B:{name:"B",base:B.BIT,prefixes:T.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:B.BIT,prefixes:T.BINARY_LONG,value:8,offset:0}},ae={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function ve(V){if(V.number==="BigNumber"){var X=Pl(g);L.rad.value=new g(1),L.deg.value=X.div(180),L.grad.value=X.div(200),L.cycle.value=X.times(2),L.arcsec.value=X.div(648e3),L.arcmin.value=X.div(10800)}else L.rad.value=1,L.deg.value=Math.PI/180,L.grad.value=Math.PI/200,L.cycle.value=Math.PI*2,L.arcsec.value=Math.PI/648e3,L.arcmin.value=Math.PI/10800;L.radian.value=L.rad.value,L.degree.value=L.deg.value,L.gradian.value=L.grad.value}ve(t),e&&e("config",function(V,X){V.number!==X.number&&ve(V)});var se={si:{NONE:{unit:H,prefix:T.NONE[""]},LENGTH:{unit:L.m,prefix:T.SHORT[""]},MASS:{unit:L.g,prefix:T.SHORT.k},TIME:{unit:L.s,prefix:T.SHORT[""]},CURRENT:{unit:L.A,prefix:T.SHORT[""]},TEMPERATURE:{unit:L.K,prefix:T.SHORT[""]},LUMINOUS_INTENSITY:{unit:L.cd,prefix:T.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:L.mol,prefix:T.SHORT[""]},ANGLE:{unit:L.rad,prefix:T.SHORT[""]},BIT:{unit:L.bits,prefix:T.SHORT[""]},FORCE:{unit:L.N,prefix:T.SHORT[""]},ENERGY:{unit:L.J,prefix:T.SHORT[""]},POWER:{unit:L.W,prefix:T.SHORT[""]},PRESSURE:{unit:L.Pa,prefix:T.SHORT[""]},ELECTRIC_CHARGE:{unit:L.C,prefix:T.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:L.F,prefix:T.SHORT[""]},ELECTRIC_POTENTIAL:{unit:L.V,prefix:T.SHORT[""]},ELECTRIC_RESISTANCE:{unit:L.ohm,prefix:T.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:L.H,prefix:T.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:L.S,prefix:T.SHORT[""]},MAGNETIC_FLUX:{unit:L.Wb,prefix:T.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:L.T,prefix:T.SHORT[""]},FREQUENCY:{unit:L.Hz,prefix:T.SHORT[""]}}};se.cgs=JSON.parse(JSON.stringify(se.si)),se.cgs.LENGTH={unit:L.m,prefix:T.SHORT.c},se.cgs.MASS={unit:L.g,prefix:T.SHORT[""]},se.cgs.FORCE={unit:L.dyn,prefix:T.SHORT[""]},se.cgs.ENERGY={unit:L.erg,prefix:T.NONE[""]},se.us=JSON.parse(JSON.stringify(se.si)),se.us.LENGTH={unit:L.ft,prefix:T.NONE[""]},se.us.MASS={unit:L.lbm,prefix:T.NONE[""]},se.us.TEMPERATURE={unit:L.degF,prefix:T.NONE[""]},se.us.FORCE={unit:L.lbf,prefix:T.NONE[""]},se.us.ENERGY={unit:L.BTU,prefix:T.BTU[""]},se.us.POWER={unit:L.hp,prefix:T.NONE[""]},se.us.PRESSURE={unit:L.psi,prefix:T.NONE[""]},se.auto=JSON.parse(JSON.stringify(se.si));var le=se.auto;y.setUnitSystem=function(V){if(Ze(se,V))le=se[V];else throw new Error("Unit system "+V+" does not exist. Choices are: "+Object.keys(se).join(", "))},y.getUnitSystem=function(){for(var V in se)if(Ze(se,V)&&se[V]===le)return V},y.typeConverters={BigNumber:function(X){return X!=null&&X.isFraction?new g(X.n).div(X.d).times(X.s):new g(X+"")},Fraction:function(X){return new v(X)},Complex:function(X){return X},number:function(X){return X!=null&&X.isFraction?h(X):X}},y.prototype._numberConverter=function(){var V=y.typeConverters[this.valueType()];if(V)return V;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},y._getNumberConverter=function(V){if(!y.typeConverters[V])throw new TypeError('Unsupported type "'+V+'"');return y.typeConverters[V]};for(var he in L)if(Ze(L,he)){var K=L[he];K.dimensions=K.base.dimensions}for(var ne in ae)if(Ze(ae,ne)){var me=L[ae[ne]],de={};for(var Oe in me)Ze(me,Oe)&&(de[Oe]=me[Oe]);de.name=ne,L[ne]=de}y.isValidAlpha=function(X){return/^[a-zA-Z]$/.test(X)};function Se(V){for(var X=0;X<V.length;X++){if(b=V.charAt(X),X===0&&!y.isValidAlpha(b))throw new Error('Invalid unit name (must begin with alpha character): "'+V+'"');if(X>0&&!(y.isValidAlpha(b)||A(b)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+V+'"')}}return y.createUnit=function(V,X){if(typeof V!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(X&&X.override){for(var fe in V)if(Ze(V,fe)&&y.deleteUnit(fe),V[fe].aliases)for(var W=0;W<V[fe].aliases.length;W++)y.deleteUnit(V[fe].aliases[W])}var te;for(var ie in V)Ze(V,ie)&&(te=y.createUnitSingle(ie,V[ie]));return te},y.createUnitSingle=function(V,X){if((typeof X=="undefined"||X===null)&&(X={}),typeof V!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Ze(L,V))throw new Error('Cannot create unit "'+V+'": a unit with that name already exists');Se(V);var fe=null,W=[],te=0,ie,ge,ye;if(X&&X.type==="Unit")fe=X.clone();else if(typeof X=="string")X!==""&&(ie=X);else if(typeof X=="object")ie=X.definition,ge=X.prefixes,te=X.offset,ye=X.baseName,X.aliases&&(W=X.aliases.valueOf());else throw new TypeError('Cannot create unit "'+V+'" from "'+X.toString()+'": expecting "string" or "Unit" or "Object"');if(W){for(var qe=0;qe<W.length;qe++)if(Ze(L,W[qe]))throw new Error('Cannot create alias "'+W[qe]+'": a unit with that name already exists')}if(ie&&typeof ie=="string"&&!fe)try{fe=y.parse(ie,{allowNoUnits:!0})}catch(C){throw C.message='Could not create unit "'+V+'" from "'+ie+'": '+C.message,C}else ie&&ie.type==="Unit"&&(fe=ie.clone());W=W||[],te=te||0,ge&&ge.toUpperCase?ge=T[ge.toUpperCase()]||T.NONE:ge=T.NONE;var De={};if(fe){De={name:V,value:fe.value,dimensions:fe.dimensions.slice(0),prefixes:ge,offset:te};var nr=!1;for(var Y in B)if(Ze(B,Y)){for(var oe=!0,pe=0;pe<$.length;pe++)if(Math.abs((De.dimensions[pe]||0)-(B[Y].dimensions[pe]||0))>1e-12){oe=!1;break}if(oe){nr=!0,De.base=B[Y];break}}if(!nr){ye=ye||V+"_STUFF";var Ee={dimensions:fe.dimensions.slice(0)};Ee.key=ye,B[ye]=Ee,le[ye]={unit:De,prefix:T.NONE[""]},De.base=B[ye]}}else{if(ye=ye||V+"_STUFF",$.indexOf(ye)>=0)throw new Error('Cannot create new base unit "'+V+'": a base unit with that name already exists (and cannot be overridden)');$.push(ye);for(var ft in B)Ze(B,ft)&&(B[ft].dimensions[$.length-1]=0);for(var wt={dimensions:[]},jt=0;jt<$.length;jt++)wt.dimensions[jt]=0;wt.dimensions[$.length-1]=1,wt.key=ye,B[ye]=wt,De={name:V,value:1,dimensions:B[ye].dimensions.slice(0),prefixes:ge,offset:te,base:B[ye]},le[ye]={unit:De,prefix:T.NONE[""]}}y.UNITS[V]=De;for(var Fe=0;Fe<W.length;Fe++){var Ne=W[Fe],Te={};for(var Re in De)Ze(De,Re)&&(Te[Re]=De[Re]);Te.name=Ne,y.UNITS[Ne]=Te}return delete O.cache,new y(null,V)},y.deleteUnit=function(V){delete y.UNITS[V]},y.PREFIXES=T,y.BASE_DIMENSIONS=$,y.BASE_UNITS=B,y.UNIT_SYSTEMS=se,y.UNITS=L,y},{isClass:!0});var AT="unit",ij=["typed","Unit"],J0=N(AT,ij,r=>{var{typed:e,Unit:t}=r;return e(AT,{Unit:function(i){return i.clone()},string:function(i){return t.isValuelessUnit(i)?new t(null,i):t.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new t(i,a)},"number | BigNumber | Fraction":function(i){return new t(i)},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var ST="sparse",aj=["typed","SparseMatrix"],Y0=N(ST,aj,r=>{var{typed:e,SparseMatrix:t}=r;return e(ST,{"":function(){return new t([])},string:function(i){return new t([],i)},"Array | Matrix":function(i){return new t(i)},"Array | Matrix, string":function(i,a){return new t(i,a)}})});var ET="createUnit",oj=["typed","Unit"],X0=N(ET,oj,r=>{var{typed:e,Unit:t}=r;return e(ET,{"Object, Object":function(i,a){return t.createUnit(i,a)},Object:function(i){return t.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var l={};return l[i]=a,t.createUnit(l,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,t.createUnit(o,{})},string:function(i){var a={};return a[i]={},t.createUnit(a,{})}})});var DT="acos",sj=["typed","config","Complex"],Q0=N(DT,sj,r=>{var{typed:e,config:t,Complex:n}=r;return e(DT,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var NT="acosh",uj=["typed","config","Complex"],K0=N(NT,uj,r=>{var{typed:e,config:t,Complex:n}=r;return e(NT,{number:function(a){return a>=1||t.predictable?lv(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var CT="acot",lj=["typed","BigNumber"],eb=N(CT,lj,r=>{var{typed:e,BigNumber:t}=r;return e(CT,{number:cv,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var MT="acoth",cj=["typed","config","Complex","BigNumber"],tb=N(MT,cj,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(MT,{number:function(o){return o>=1||o<=-1||t.predictable?fv(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var TT="acsc",fj=["typed","config","Complex","BigNumber"],rb=N(TT,fj,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(TT,{number:function(o){return o<=-1||o>=1||t.predictable?pv(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var FT="acsch",pj=["typed","BigNumber"],nb=N(FT,pj,r=>{var{typed:e,BigNumber:t}=r;return e(FT,{number:mv,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var IT="asec",mj=["typed","config","Complex","BigNumber"],ib=N(IT,mj,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(IT,{number:function(o){return o<=-1||o>=1||t.predictable?dv(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var BT="asech",dj=["typed","config","Complex","BigNumber"],ab=N(BT,dj,r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(BT,{number:function(o){if(o<=1&&o>=-1||t.predictable){var l=1/o;if(l>0||t.predictable)return hv(o);var u=Math.sqrt(l*l-1);return new n(Math.log(u-l),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var PT="asin",hj=["typed","config","Complex"],ob=N(PT,hj,r=>{var{typed:e,config:t,Complex:n}=r;return e(PT,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var gj="asinh",vj=["typed"],sb=N(gj,vj,r=>{var{typed:e}=r;return e("asinh",{number:gv,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var yj="atan",bj=["typed"],ub=N(yj,bj,r=>{var{typed:e}=r;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var OT="atan2",xj=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],lb=N(OT,xj,r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=r,l=kr({typed:e,equalScalar:n}),u=sr({typed:e}),s=kp({typed:e,equalScalar:n}),c=Yt({typed:e,equalScalar:n}),f=qt({typed:e,DenseMatrix:a}),p=ct({typed:e,matrix:t,concat:o});return e(OT,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,h)=>i.atan2(m,h)},p({scalar:"number | BigNumber",SS:s,DS:u,SD:l,Ss:c,sS:f}))});var kT="atanh",wj=["typed","config","Complex"],cb=N(kT,wj,r=>{var{typed:e,config:t,Complex:n}=r;return e(kT,{number:function(a){return a<=1&&a>=-1||t.predictable?vv(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var xi=N("trigUnit",["typed"],r=>{var{typed:e}=r;return{Unit:e.referToSelf(t=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,n.valueType())(n.value)})}});var RT="cos",_j=["typed"],fb=N(RT,_j,r=>{var{typed:e}=r,t=xi({typed:e});return e(RT,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},t)});var LT="cosh",Aj=["typed"],pb=N(LT,Aj,r=>{var{typed:e}=r;return e(LT,{number:gp,"Complex | BigNumber":t=>t.cosh()})});var UT="cot",Sj=["typed","BigNumber"],mb=N(UT,Sj,r=>{var{typed:e,BigNumber:t}=r,n=xi({typed:e});return e(UT,{number:yv,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},n)});var VT="coth",Ej=["typed","BigNumber"],db=N(VT,Ej,r=>{var{typed:e,BigNumber:t}=r;return e(VT,{number:bv,Complex:n=>n.coth(),BigNumber:n=>new t(1).div(n.tanh())})});var $T="csc",Dj=["typed","BigNumber"],hb=N($T,Dj,r=>{var{typed:e,BigNumber:t}=r,n=xi({typed:e});return e($T,{number:xv,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},n)});var qT="csch",Nj=["typed","BigNumber"],gb=N(qT,Nj,r=>{var{typed:e,BigNumber:t}=r;return e(qT,{number:wv,Complex:n=>n.csch(),BigNumber:n=>new t(1).div(n.sinh())})});var zT="sec",Cj=["typed","BigNumber"],vb=N(zT,Cj,r=>{var{typed:e,BigNumber:t}=r,n=xi({typed:e});return e(zT,{number:_v,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},n)});var HT="sech",Mj=["typed","BigNumber"],yb=N(HT,Mj,r=>{var{typed:e,BigNumber:t}=r;return e(HT,{number:Av,Complex:n=>n.sech(),BigNumber:n=>new t(1).div(n.cosh())})});var GT="sin",Tj=["typed"],bb=N(GT,Tj,r=>{var{typed:e}=r,t=xi({typed:e});return e(GT,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},t)});var WT="sinh",Fj=["typed"],xb=N(WT,Fj,r=>{var{typed:e}=r;return e(WT,{number:Sv,"Complex | BigNumber":t=>t.sinh()})});var jT="tan",Ij=["typed"],wb=N(jT,Ij,r=>{var{typed:e}=r,t=xi({typed:e});return e(jT,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},t)});var Bj="tanh",Pj=["typed"],_b=N(Bj,Pj,r=>{var{typed:e}=r;return e("tanh",{number:vp,"Complex | BigNumber":t=>t.tanh()})});var ZT="setCartesian",Oj=["typed","size","subset","compareNatural","Index","DenseMatrix"],Ab=N(ZT,Oj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(ZT,{"Array | Matrix, Array | Matrix":function(u,s){var c=[];if(n(t(u),new a(0))!==0&&n(t(s),new a(0))!==0){var f=ht(Array.isArray(u)?u:u.toArray()).sort(i),p=ht(Array.isArray(s)?s:s.toArray()).sort(i);c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)c.push([f[m],p[h]])}return Array.isArray(u)&&Array.isArray(s)?c:new o(c)}})});var JT="setDifference",kj=["typed","size","subset","compareNatural","Index","DenseMatrix"],Sb=N(JT,kj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(JT,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(n(t(u),new a(0))===0)c=[];else{if(n(t(s),new a(0))===0)return ht(u.toArray());var f=ya(ht(Array.isArray(u)?u:u.toArray()).sort(i)),p=ya(ht(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m,h=0;h<f.length;h++){m=!1;for(var d=0;d<p.length;d++)if(i(f[h].value,p[d].value)===0&&f[h].identifier===p[d].identifier){m=!0;break}m||c.push(f[h])}}return Array.isArray(u)&&Array.isArray(s)?au(c):new o(au(c))}})});var YT="setDistinct",Rj=["typed","size","subset","compareNatural","Index","DenseMatrix"],Eb=N(YT,Rj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(YT,{"Array | Matrix":function(u){var s;if(n(t(u),new a(0))===0)s=[];else{var c=ht(Array.isArray(u)?u:u.toArray()).sort(i);s=[],s.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&s.push(c[f])}return Array.isArray(u)?s:new o(s)}})});var XT="setIntersect",Lj=["typed","size","subset","compareNatural","Index","DenseMatrix"],Db=N(XT,Lj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=r;return e(XT,{"Array | Matrix, Array | Matrix":function(u,s){var c;if(n(t(u),new a(0))===0||n(t(s),new a(0))===0)c=[];else{var f=ya(ht(Array.isArray(u)?u:u.toArray()).sort(i)),p=ya(ht(Array.isArray(s)?s:s.toArray()).sort(i));c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)if(i(f[m].value,p[h].value)===0&&f[m].identifier===p[h].identifier){c.push(f[m]);break}}return Array.isArray(u)&&Array.isArray(s)?au(c):new o(au(c))}})});var QT="setIsSubset",Uj=["typed","size","subset","compareNatural","Index"],Nb=N(QT,Uj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(QT,{"Array | Matrix, Array | Matrix":function(l,u){if(n(t(l),new a(0))===0)return!0;if(n(t(u),new a(0))===0)return!1;for(var s=ya(ht(Array.isArray(l)?l:l.toArray()).sort(i)),c=ya(ht(Array.isArray(u)?u:u.toArray()).sort(i)),f,p=0;p<s.length;p++){f=!1;for(var m=0;m<c.length;m++)if(i(s[p].value,c[m].value)===0&&s[p].identifier===c[m].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var KT="setMultiplicity",Vj=["typed","size","subset","compareNatural","Index"],Cb=N(KT,Vj,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(KT,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(l,u){if(n(t(u),new a(0))===0)return 0;for(var s=ht(Array.isArray(u)?u:u.toArray()),c=0,f=0;f<s.length;f++)i(s[f],l)===0&&c++;return c}})});var e2="setPowerset",$j=["typed","size","subset","compareNatural","Index"],Mb=N(e2,$j,r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:a}=r;return e(e2,{"Array | Matrix":function(s){if(n(t(s),new a(0))===0)return[];for(var c=ht(Array.isArray(s)?s:s.toArray()).sort(i),f=[],p=0;p.toString(2).length<=c.length;)f.push(o(c,p.toString(2).split("").reverse())),p++;return l(f)}});function o(u,s){for(var c=[],f=0;f<s.length;f++)s[f]==="1"&&c.push(u[f]);return c}function l(u){for(var s=[],c=u.length-1;c>0;c--)for(var f=0;f<c;f++)u[f].length>u[f+1].length&&(s=u[f],u[f]=u[f+1],u[f+1]=s);return u}});var t2="setSize",qj=["typed","compareNatural"],Tb=N(t2,qj,r=>{var{typed:e,compareNatural:t}=r;return e(t2,{"Array | Matrix":function(i){return Array.isArray(i)?ht(i).length:ht(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?ht(i).length:ht(i.toArray()).length;for(var o=ht(Array.isArray(i)?i:i.toArray()).sort(t),l=1,u=1;u<o.length;u++)t(o[u],o[u-1])!==0&&l++;return l}})});var r2="setSymDifference",zj=["typed","size","concat","subset","setDifference","Index"],Fb=N(r2,zj,r=>{var{typed:e,size:t,concat:n,subset:i,setDifference:a,Index:o}=r;return e(r2,{"Array | Matrix, Array | Matrix":function(u,s){if(i(t(u),new o(0))===0)return ht(s);if(i(t(s),new o(0))===0)return ht(u);var c=ht(u),f=ht(s);return n(a(c,f),a(f,c))}})});var n2="setUnion",Hj=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],Ib=N(n2,Hj,r=>{var{typed:e,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:l}=r;return e(n2,{"Array | Matrix, Array | Matrix":function(s,c){if(i(t(s),new l(0))===0)return ht(c);if(i(t(c),new l(0))===0)return ht(s);var f=ht(s),p=ht(c);return n(o(f,p),a(f,p))}})});var i2="add",Gj=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],Bb=N(i2,Gj,r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:l}=r,u=xn({typed:e}),s=fu({typed:e,equalScalar:i}),c=Vn({typed:e,DenseMatrix:a}),f=ct({typed:e,matrix:t,concat:l});return e(i2,{"any, any":n,"any, any, ...any":e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),v=0;v<d.length;v++)g=p(g,d[v]);return g})},f({elop:n,DS:u,SS:s,Ss:c}))});var a2="hypot",Wj=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],Pb=N(a2,Wj,r=>{var{typed:e,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:l,isPositive:u}=r;return e(a2,{"... number | BigNumber":s,Array:s,Matrix:c=>s(ht(c.toArray()))});function s(c){for(var f=0,p=0,m=0;m<c.length;m++){if(Mn(c[m]))throw new TypeError("Unexpected type of argument to hypot");var h=t(c[m]);l(p,h)?(f=a(f,a(i(p,h),i(p,h))),f=n(f,1),p=h):f=n(f,u(h)?a(i(h,p),i(h,p)):h)}return a(p,o(f))}});var o2="norm",jj=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],Ob=N(o2,jj,r=>{var{typed:e,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:l,equalScalar:u,larger:s,smaller:c,matrix:f,ctranspose:p,eigs:m}=r;return e(o2,{number:Math.abs,Complex:function(D){return D.abs()},BigNumber:function(D){return D.abs()},boolean:function(D){return Math.abs(D)},Array:function(D){return b(f(D),2)},Matrix:function(D){return b(D,2)},"Array, number | BigNumber | string":function(D,A){return b(f(D),A)},"Matrix, number | BigNumber | string":function(D,A){return b(D,A)}});function h(E){var D=0;return E.forEach(function(A){var S=t(A);s(S,D)&&(D=S)},!0),D}function d(E){var D;return E.forEach(function(A){var S=t(A);(!D||c(S,D))&&(D=S)},!0),D||0}function g(E,D){if(D===Number.POSITIVE_INFINITY||D==="inf")return h(E);if(D===Number.NEGATIVE_INFINITY||D==="-inf")return d(E);if(D==="fro")return b(E,2);if(typeof D=="number"&&!isNaN(D)){if(!u(D,0)){var A=0;return E.forEach(function(S){A=n(i(t(S),D),A)},!0),i(A,1/D)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function v(E){var D=0;return E.forEach(function(A,S){D=n(D,l(A,a(A)))}),t(o(D))}function w(E){var D=[],A=0;return E.forEach(function(S,M){var F=M[1],P=n(D[F]||0,t(S));s(P,A)&&(A=P),D[F]=P},!0),A}function y(E){var D=E.size();if(D[0]!==D[1])throw new RangeError("Invalid matrix dimensions");var A=p(E),S=l(A,E),M=m(S).values.toArray(),F=M[M.length-1];return t(o(F))}function x(E){var D=[],A=0;return E.forEach(function(S,M){var F=M[0],P=n(D[F]||0,t(S));s(P,A)&&(A=P),D[F]=P},!0),A}function _(E,D){if(D===1)return w(E);if(D===Number.POSITIVE_INFINITY||D==="inf")return x(E);if(D==="fro")return v(E);if(D===2)return y(E);throw new Error("Unsupported parameter value "+D)}function b(E,D){var A=E.size();if(A.length===1)return g(E,D);if(A.length===2){if(A[0]&&A[1])return _(E,D);throw new RangeError("Invalid matrix dimensions")}}});var s2="dot",Zj=["typed","addScalar","multiplyScalar","conj","size"],kb=N(s2,Zj,r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:a}=r;return e(s2,{"Array | DenseMatrix, Array | DenseMatrix":l,"SparseMatrix, SparseMatrix":u});function o(c,f){var p=s(c),m=s(f),h,d;if(p.length===1)h=p[0];else if(p.length===2&&p[1]===1)h=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m.length===1)d=m[0];else if(m.length===2&&m[1]===1)d=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.join(", ")+")");if(h!==d)throw new RangeError("Vectors must have equal length ("+h+" != "+d+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function l(c,f){var p=o(c,f),m=Ge(c)?c._data:c,h=Ge(c)?c._datatype:void 0,d=Ge(f)?f._data:f,g=Ge(f)?f._datatype:void 0,v=s(c).length===2,w=s(f).length===2,y=t,x=n;if(h&&g&&h===g&&typeof h=="string"){var _=h;y=e.find(t,[_,_]),x=e.find(n,[_,_])}if(!v&&!w){for(var b=x(i(m[0]),d[0]),E=1;E<p;E++)b=y(b,x(i(m[E]),d[E]));return b}if(!v&&w){for(var D=x(i(m[0]),d[0][0]),A=1;A<p;A++)D=y(D,x(i(m[A]),d[A][0]));return D}if(v&&!w){for(var S=x(i(m[0][0]),d[0]),M=1;M<p;M++)S=y(S,x(i(m[M][0]),d[M]));return S}if(v&&w){for(var F=x(i(m[0][0]),d[0][0]),P=1;P<p;P++)F=y(F,x(i(m[P][0]),d[P][0]));return F}}function u(c,f){o(c,f);for(var p=c._index,m=c._values,h=f._index,d=f._values,g=0,v=t,w=n,y=0,x=0;y<p.length&&x<h.length;){var _=p[y],b=h[x];if(_<b){y++;continue}if(_>b){x++;continue}_===b&&(g=v(g,w(m[y],d[x])),y++,x++)}return g}function s(c){return Ge(c)?c.size():a(c)}});var Jj="trace",Yj=["typed","matrix","add"],Rb=N(Jj,Yj,r=>{var{typed:e,matrix:t,add:n}=r;return e("trace",{Array:function(l){return i(t(l))},SparseMatrix:a,DenseMatrix:i,any:et});function i(o){var l=o._size,u=o._data;switch(l.length){case 1:if(l[0]===1)return et(u[0]);throw new RangeError("Matrix must be square (size: "+at(l)+")");case 2:{var s=l[0],c=l[1];if(s===c){for(var f=0,p=0;p<s;p++)f=n(f,u[p][p]);return f}else throw new RangeError("Matrix must be square (size: "+at(l)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(l)+")")}}function a(o){var l=o._values,u=o._index,s=o._ptr,c=o._size,f=c[0],p=c[1];if(f===p){var m=0;if(l.length>0)for(var h=0;h<p;h++)for(var d=s[h],g=s[h+1],v=d;v<g;v++){var w=u[v];if(w===h){m=n(m,l[v]);break}if(w>h)break}return m}throw new RangeError("Matrix must be square (size: "+at(c)+")")}});var u2="index",Xj=["typed","Index"],Lb=N(u2,Xj,r=>{var{typed:e,Index:t}=r;return e(u2,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(l){return Xe(l)?l.toNumber():It(l)||Ge(l)?l.map(function(u){return Xe(u)?u.toNumber():u}):l}),o=new t;return t.apply(o,a),o}})});var Jp=new Set(["end"]);var Qj="Node",Kj=["mathWithTransform"],Ub=N(Qj,Kj,r=>{var{mathWithTransform:e}=r;function t(i){for(var a of[...Jp])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(e,{}),o={},l=null;function u(s){var c=ba(s);return t(c),a(c,o,l)}return{evaluate:u}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!Dt(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(l,u){l.forEach(function(s,c,f){u(s,c,f),o(s,u)})}o(this,a)}transform(a){function o(l,u,s){var c=a(l,u,s);return c!==l?c:l.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(l,u,s){a(l,u,s)&&o.push(l)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Li(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o!="undefined"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return n},{isClass:!0,isNode:!0});function ur(r){return r&&r.isIndexError?new pn(r.index+1,r.min+1,r.max!==void 0?r.max+1:void 0):r}function Yp(r){var{subset:e}=r;return function(n,i){try{if(Array.isArray(n))return e(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return e(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return br(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw ur(a)}}}var Xp="AccessorNode",eZ=["subset","Node"],Vb=N(Xp,eZ,r=>{var{subset:e,Node:t}=r,n=Yp({subset:e});function i(o){return!(ti(o)||cn(o)||_t(o)||Tn(o)||Qa(o)||fn(o)||ar(o))}class a extends t{constructor(l,u){if(super(),!Dt(l))throw new TypeError('Node expected for parameter "object"');if(!hi(u))throw new TypeError('IndexNode expected for parameter "index"');this.object=l,this.index=u}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Xp}get isAccessorNode(){return!0}_compile(l,u){var s=this.object._compile(l,u),c=this.index._compile(l,u);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(m,h,d){return br(s(m,h,d),f)}}else return function(m,h,d){var g=s(m,h,d),v=c(m,h,g);return n(g,v)}}forEach(l){l(this.object,"object",this),l(this.index,"index",this)}map(l){return new a(this._ifNode(l(this.object,"object",this)),this._ifNode(l(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(l){var u=this.object.toString(l);return i(this.object)&&(u="("+u+")"),u+this.index.toString(l)}_toHTML(l){var u=this.object.toHTML(l);return i(this.object)&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+this.index.toHTML(l)}_toTex(l){var u=this.object.toTex(l);return i(this.object)&&(u="\\left(' + object + '\\right)"),u+this.index.toTex(l)}toJSON(){return{mathjs:Xp,object:this.object,index:this.index}}static fromJSON(l){return new a(l.object,l.index)}}return Ht(a,"name",Xp),a},{isClass:!0,isNode:!0});var Qp="ArrayNode",tZ=["Node"],$b=N(Qp,tZ,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(Dt))throw new TypeError("Array containing Nodes expected")}get type(){return Qp}get isArrayNode(){return!0}_compile(i,a){var o=Rn(this.items,function(s){return s._compile(i,a)}),l=i.config.matrix!=="Array";if(l){var u=i.matrix;return function(c,f,p){return u(Rn(o,function(m){return m(c,f,p)}))}}else return function(c,f,p){return Rn(o,function(m){return m(c,f,p)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new t(a)}clone(){return new t(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:Qp,items:this.items}}static fromJSON(i){return new t(i.items)}_toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,l){var u=o.some(cn)&&!o.every(cn),s=l||u,c=s?"&":"\\\\",f=o.map(function(p){return p.items?a(p.items,!l):p.toTex(i)}).join(c);return u||!s||s&&!l?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return Ht(t,"name",Qp),t},{isClass:!0,isNode:!0});function l2(r){var{subset:e,matrix:t}=r;return function(i,a,o){try{if(Array.isArray(i)){var l=t(i).subset(a,o).valueOf();return l.forEach((u,s)=>{i[s]=u}),i}else{if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return e(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Qi(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(u){throw ur(u)}}}var wi=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Kp(r,e){if(!e||e!=="auto")return r;for(var t=r;fn(t);)t=t.content;return t}function Zt(r,e,t,n){var i=r;e!=="keep"&&(i=r.getContent());for(var a=i.getIdentifier(),o=null,l=0;l<wi.length;l++)if(a in wi[l]){o=l;break}if(a==="OperatorNode:multiply"&&i.implicit&&t!=="show"){var u=Kp(i.args[0],e);!(_t(u)&&n&&n.getIdentifier()==="OperatorNode:divide"&&ul(Kp(n.args[0],e)))&&!(u.getIdentifier()==="OperatorNode:divide"&&ul(Kp(u.args[0],e))&&_t(Kp(u.args[1])))&&(o+=1)}return o}function yu(r,e){var t=r;e!=="keep"&&(t=r.getContent());var n=t.getIdentifier(),i=Zt(t,e);if(i===null)return null;var a=wi[i][n];if(Ze(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function em(r,e,t){var n=t!=="keep"?r.getContent():r,i=t!=="keep"?r.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),l=Zt(n,t);if(l===null)return null;var u=wi[l][a];if(Ze(u,"associativeWith")&&u.associativeWith instanceof Array){for(var s=0;s<u.associativeWith.length;s++)if(u.associativeWith[s]===o)return!0;return!1}return null}function c2(r){var e="OperatorNode:"+r;for(var t of wi)if(e in t)return t[e].op;return null}var tm="AssignmentNode",rZ=["subset","?matrix","Node"],qb=N(tm,rZ,r=>{var{subset:e,matrix:t,Node:n}=r,i=Yp({subset:e}),a=l2({subset:e,matrix:t});function o(u,s,c){s||(s="keep");var f=Zt(u,s,c),p=Zt(u.value,s,c);return s==="all"||p!==null&&p<=f}class l extends n{constructor(s,c,f){if(super(),this.object=s,this.index=f?c:null,this.value=f||c,!ar(s)&&!ti(s))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ar(s)&&s.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!hi(this.index))throw new TypeError('IndexNode expected as "index"');if(!Dt(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return tm}get isAssignmentNode(){return!0}_compile(s,c){var f=this.object._compile(s,c),p=this.index?this.index._compile(s,c):null,m=this.value._compile(s,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(x,_,b){var E=f(x,_,b),D=m(x,_,b);return Qi(E,d,D),D}}else{if(ar(this.object))return function(x,_,b){var E=f(x,_,b),D=m(x,_,b),A=p(x,_,E);return x.set(h,a(E,A,D)),D};var g=this.object.object._compile(s,c);if(this.object.index.isObjectProperty()){var v=this.object.index.getObjectProperty();return function(x,_,b){var E=g(x,_,b),D=br(E,v),A=p(x,_,D),S=m(x,_,b);return Qi(E,v,a(D,A,S)),S}}else{var w=this.object.index._compile(s,c);return function(x,_,b){var E=g(x,_,b),D=w(x,_,E),A=i(E,D),S=p(x,_,A),M=m(x,_,b);return a(E,D,a(A,S,M)),M}}}else{if(!ar(this.object))throw new TypeError("SymbolNode expected as object");return function(x,_,b){var E=m(x,_,b);return x.set(h,E),E}}}forEach(s){s(this.object,"object",this),this.index&&s(this.index,"index",this),s(this.value,"value",this)}map(s){var c=this._ifNode(s(this.object,"object",this)),f=this.index?this._ifNode(s(this.index,"index",this)):null,p=this._ifNode(s(this.value,"value",this));return new l(c,f,p)}clone(){return new l(this.object,this.index,this.value)}_toString(s){var c=this.object.toString(s),f=this.index?this.index.toString(s):"",p=this.value.toString(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="("+p+")"),c+f+" = "+p}toJSON(){return{mathjs:tm,object:this.object,index:this.index,value:this.value}}static fromJSON(s){return new l(s.object,s.index,s.value)}_toHTML(s){var c=this.object.toHTML(s),f=this.index?this.index.toHTML(s):"",p=this.value.toHTML(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p='<span class="math-paranthesis math-round-parenthesis">(</span>'+p+'<span class="math-paranthesis math-round-parenthesis">)</span>'),c+f+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+p}_toTex(s){var c=this.object.toTex(s),f=this.index?this.index.toTex(s):"",p=this.value.toTex(s);return o(this,s&&s.parenthesis,s&&s.implicit)&&(p="\\left(".concat(p,"\\right)")),c+f+"="+p}}return Ht(l,"name",tm),l},{isClass:!0,isNode:!0});var rm="BlockNode",nZ=["ResultSet","Node"],zb=N(rm,nZ,r=>{var{ResultSet:e,Node:t}=r;class n extends t{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var l=o&&o.node,u=o&&o.visible!==void 0?o.visible:!0;if(!Dt(l))throw new TypeError('Property "node" must be a Node');if(typeof u!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:l,visible:u}})}get type(){return rm}get isBlockNode(){return!0}_compile(a,o){var l=Rn(this.blocks,function(u){return{evaluate:u.node._compile(a,o),visible:u.visible}});return function(s,c,f){var p=[];return Ka(l,function(h){var d=h.evaluate(s,c,f);h.visible&&p.push(d)}),new e(p)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],l=0;l<this.blocks.length;l++){var u=this.blocks[l],s=this._ifNode(a(u.node,"blocks["+l+"].node",this));o[l]={node:s,visible:u.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:rm,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return Ht(n,"name",rm),n},{isClass:!0,isNode:!0});var nm="ConditionalNode",iZ=["Node"],Hb=N(nm,iZ,r=>{var{Node:e}=r;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(Xe(i))return!i.isZero();if(Mn(i))return!!(i.re||i.im);if(ln(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Mt(i)+'"')}class n extends e{constructor(a,o,l){if(super(),!Dt(a))throw new TypeError("Parameter condition must be a Node");if(!Dt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!Dt(l))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=l}get type(){return nm}get isConditionalNode(){return!0}_compile(a,o){var l=this.condition._compile(a,o),u=this.trueExpr._compile(a,o),s=this.falseExpr._compile(a,o);return function(f,p,m){return t(l(f,p,m))?u(f,p,m):s(f,p,m)}}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",l=Zt(this,o,a&&a.implicit),u=this.condition.toString(a),s=Zt(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=l)&&(u="("+u+")");var c=this.trueExpr.toString(a),f=Zt(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=l)&&(c="("+c+")");var p=this.falseExpr.toString(a),m=Zt(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=l)&&(p="("+p+")"),u+" ? "+c+" : "+p}toJSON(){return{mathjs:nm,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",l=Zt(this,o,a&&a.implicit),u=this.condition.toHTML(a),s=Zt(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||s!==null&&s<=l)&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=Zt(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=l)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var p=this.falseExpr.toHTML(a),m=Zt(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=l)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+p}_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 Ht(n,"name",nm),n},{isClass:!0,isNode:!0});var d2=fr(p2(),1);var Wb={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:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Gt={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},jb={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Gt.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Gt.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Gt.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Gt.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Gt.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(Gt.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Gt.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Gt.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Gt.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Gt.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Gt.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Gt.bitAnd,"${args[1]}\\right)")},bitNot:{1:Gt.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Gt.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Gt.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Gt.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Gt.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Gt.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Gt.and,"${args[1]}\\right)")},not:{1:Gt.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Gt.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Gt.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Gt.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Gt.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Gt.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Gt.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Gt.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Gt.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Gt.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Gt.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Gt.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Gt.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Gt.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Wb.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},h2="\\mathrm{${name}}\\left(${args}\\right)",m2={deg:"^\\circ"};function im(r){return(0,d2.default)(r,{preserveFormatting:!0})}function am(r,e){return e=typeof e=="undefined"?!1:e,e?Ze(m2,r)?m2[r]:"\\mathrm{"+im(r)+"}":Ze(Wb,r)?Wb[r]:im(r)}var om="ConstantNode",uZ=["Node"],Zb=N(om,uZ,r=>{var{Node:e}=r;class t extends e{constructor(i){super(),this.value=i}get type(){return om}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new t(this.value)}_toString(i){return at(this.value,i)}_toHTML(i){var a=this._toString(i);switch(Mt(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:om,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i);switch(Mt(this.value)){case"string":return"\\mathtt{"+im(a)+"}";case"number":case"BigNumber":{if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var o=a.toLowerCase().indexOf("e");if(o!==-1)return a.substring(0,o)+"\\cdot10^{"+a.substring(o+1)+"}"}return a;case"Fraction":return this.value.toLatex();default:return a}}}return Ht(t,"name",om),t},{isClass:!0,isNode:!0});var sm="FunctionAssignmentNode",lZ=["typed","Node"],Jb=N(sm,lZ,r=>{var{typed:e,Node:t}=r;function n(a,o,l){var u=Zt(a,o,l),s=Zt(a.expr,o,l);return o==="all"||s!==null&&s<=u}class i extends t{constructor(o,l,u){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(l))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Dt(u))throw new TypeError('Node expected for parameter "expr"');if(Jp.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var s=new Set;for(var c of l){var f=typeof c=="string"?c:c.name;if(s.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));s.add(f)}this.name=o,this.params=l.map(function(p){return p&&p.name||p}),this.types=l.map(function(p){return p&&p.type||"any"}),this.expr=u}get type(){return sm}get isFunctionAssignmentNode(){return!0}_compile(o,l){var u=Object.create(l);Ka(this.params,function(h){u[h]=!0});var s=this.expr._compile(o,u),c=this.name,f=this.params,p=ag(this.types,","),m=c+"("+ag(this.params,", ")+")";return function(d,g,v){var w={};w[p]=function(){for(var x=Object.create(g),_=0;_<f.length;_++)x[f[_]]=arguments[_];return s(d,x,v)};var y=e(c,w);return y.syntax=m,d.set(c,y),y}}forEach(o){o(this.expr,"expr",this)}map(o){var l=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),l)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toString(o);return n(this,l,o&&o.implicit)&&(u="("+u+")"),this.name+"("+this.params.join(", ")+") = "+u}toJSON(){var o=this.types;return{mathjs:sm,name:this.name,params:this.params.map(function(l,u){return{name:l,type:o[u]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var l=o&&o.parenthesis?o.parenthesis:"keep",u=[],s=0;s<this.params.length;s++)u.push('<span class="math-symbol math-parameter">'+Yr(this.params[s])+"</span>");var c=this.expr.toHTML(o);return n(this,l,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Yr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+u.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+c}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=this.expr.toTex(o);return n(this,l,o&&o.implicit)&&(u="\\left(".concat(u,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(am).join(",")+"\\right)="+u}}return Ht(i,"name",sm),i},{isClass:!0,isNode:!0});var um="IndexNode",cZ=["Node","size"],Yb=N(um,cZ,r=>{var{Node:e,size:t}=r;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(Dt))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return um}get isIndexNode(){return!0}_compile(a,o){var l=Rn(this.dimensions,function(s,c){var f=s.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var p=Object.create(o);p.end=!0;var m=s._compile(a,p);return function(d,g,v){if(!Ge(v)&&!It(v)&&!Ar(v))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Mt(v));var w=t(v).valueOf(),y=Object.create(g);return y.end=w[c],m(d,y,v)}}else return s._compile(a,o)}),u=br(a,"index");return function(c,f,p){var m=Rn(l,function(h){return h(c,f,p)});return u(...m)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],l=0;l<this.dimensions.length;l++)o[l]=this._ifNode(a(this.dimensions[l],"dimensions["+l+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&_t(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:um,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],l=0;l<this.dimensions.length;l++)o[l]=this.dimensions[l].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Yr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(l){return l.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return Ht(n,"name",um),n},{isClass:!0,isNode:!0});var lm="ObjectNode",fZ=["Node"],Xb=N(lm,fZ,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return Dt(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return lm}get isObjectNode(){return!0}_compile(i,a){var o={};for(var l in this.properties)if(Ze(this.properties,l)){var u=Ko(l),s=JSON.parse(u),c=br(this.properties,l);o[s]=c._compile(i,a)}return function(p,m,h){var d={};for(var g in o)Ze(o,g)&&(d[g]=o[g](p,m,h));return d}}forEach(i){for(var a in this.properties)Ze(this.properties,a)&&i(this.properties[a],"properties["+Ko(a)+"]",this)}map(i){var a={};for(var o in this.properties)Ze(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Ko(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)Ze(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push(Ko(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:lm,properties:this.properties}}static fromJSON(i){return new t(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Yr(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)Ze(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var l="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return l}}return Ht(t,"name",lm),t},{isClass:!0,isNode:!0});function ss(r,e){return new ou(r,new ts(e),new Set(Object.keys(e)))}var cm="OperatorNode",pZ=["Node"],Qb=N(cm,pZ,r=>{var{Node:e}=r;function t(a,o){var l=a;if(o==="auto")for(;fn(l);)l=l.content;return _t(l)?!0:hr(l)?t(l.args[0],o):!1}function n(a,o,l,u,s){var c=Zt(a,o,l),f=yu(a,o);if(o==="all"||u.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return u.map(function(S){switch(S.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(u.length){case 0:p=[];break;case 1:{var m=Zt(u[0],o,l,a);if(s&&m!==null){var h,d;if(o==="keep"?(h=u[0].getIdentifier(),d=a.getIdentifier()):(h=u[0].getContent().getIdentifier(),d=a.getContent().getIdentifier()),wi[c][d].latexLeftParens===!1){p=[!1];break}if(wi[m][h].latexParens===!1){p=[!1];break}}if(m===null){p=[!1];break}if(m<=c){p=[!0];break}p=[!1]}break;case 2:{var g,v=Zt(u[0],o,l,a),w=em(a,u[0],o);v===null?g=!1:v===c&&f==="right"&&!w||v<c?g=!0:g=!1;var y,x=Zt(u[1],o,l,a),_=em(a,u[1],o);if(x===null?y=!1:x===c&&f==="left"&&!_||x<c?y=!0:y=!1,s){var b,E,D;o==="keep"?(b=a.getIdentifier(),E=a.args[0].getIdentifier(),D=a.args[1].getIdentifier()):(b=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),D=a.args[1].getContent().getIdentifier()),v!==null&&(wi[c][b].latexLeftParens===!1&&(g=!1),wi[v][E].latexParens===!1&&(g=!1)),x!==null&&(wi[c][b].latexRightParens===!1&&(y=!1),wi[x][D].latexParens===!1&&(y=!1))}p=[g,y]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=u.map(function(S){var M=Zt(S,o,l,a),F=em(a,S,o),P=yu(S,o);return M===null?!1:c===M&&f===P&&!F?!0:M<c}));break}if(u.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&l==="hide")for(var A=1;A<p.length;++A)t(u[A],o)&&!p[A-1]&&(o!=="keep"||!fn(u[A-1]))&&(p[A]=!0);return p}class i extends e{constructor(o,l,u,s,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof l!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(u)||!u.every(Dt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=s===!0,this.isPercentage=c===!0,this.op=o,this.fn=l,this.args=u||[]}get type(){return cm}get isOperatorNode(){return!0}_compile(o,l){if(typeof this.fn!="string"||!wp(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 u=br(o,this.fn),s=Rn(this.args,function(h){return h._compile(o,l)});if(typeof u=="function"&&u.rawArgs===!0){var c=this.args;return function(d,g,v){return u(c,o,ss(d,g))}}else if(s.length===1){var f=s[0];return function(d,g,v){return u(f(d,g,v))}}else if(s.length===2){var p=s[0],m=s[1];return function(d,g,v){return u(p(d,g,v),m(d,g,v))}}else return function(d,g,v){return u.apply(null,Rn(s,function(w){return w(d,g,v)}))}}forEach(o){for(var l=0;l<this.args.length;l++)o(this.args[l],"args["+l+"]",this)}map(o){for(var l=[],u=0;u<this.args.length;u++)l[u]=this._ifNode(o(this.args[u],"args["+u+"]",this));return new i(this.op,this.fn,l,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 l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=n(this,l,u,s,!1);if(s.length===1){var f=yu(this,l),p=s[0].toString(o);c[0]&&(p="("+p+")");var m=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(m?" ":"")+p:f==="left"?p+(m?" ":"")+this.op:p+this.op}else if(s.length===2){var h=s[0].toString(o),d=s[1].toString(o);return c[0]&&(h="("+h+")"),c[1]&&(d="("+d+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?h+" "+d:h+" "+this.op+" "+d}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=s.map(function(v,w){return v=v.toString(o),c[w]&&(v="("+v+")"),v});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?g.join(" "):g.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:cm,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}_toHTML(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=n(this,l,u,s,!1);if(s.length===1){var f=yu(this,l),p=s[0].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Yr(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Yr(this.op)+"</span>"}else if(s.length===2){var m=s[0].toHTML(o),h=s[1].toHTML(o);return c[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?m+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+h:m+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(this.op)+"</span>"+h}else{var d=s.map(function(g,v){return g=g.toHTML(o),c[v]&&(g='<span class="math-parenthesis math-round-parenthesis">(</span>'+g+'<span class="math-parenthesis math-round-parenthesis">)</span>'),g});return s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&u==="hide"?d.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):d.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(this.op)+"</span>"):'<span class="math-function">'+Yr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+d.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var l=o&&o.parenthesis?o.parenthesis:"keep",u=o&&o.implicit?o.implicit:"hide",s=this.args,c=n(this,l,u,s,!0),f=Gt[this.fn];if(f=typeof f=="undefined"?this.op:f,s.length===1){var p=yu(this,l),m=s[0].toTex(o);return c[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?f+m:m+f}else if(s.length===2){var h=s[0],d=h.toTex(o);c[0]&&(d="\\left(".concat(d,"\\right)"));var g=s[1],v=g.toTex(o);c[1]&&(v="\\left(".concat(v,"\\right)"));var w;switch(l==="keep"?w=h.getIdentifier():w=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+v+"}";case"OperatorNode:pow":switch(d="{"+d+"}",v="{"+v+"}",w){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&u==="hide")return d+"~"+v}return d+f+v}else if(s.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var y=s.map(function(x,_){return x=x.toTex(o),c[_]&&(x="\\left(".concat(x,"\\right)")),x});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&u==="hide"?y.join("~"):y.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+s.map(function(x){return x.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Ht(i,"name",cm),i},{isClass:!0,isNode:!0});var fm="ParenthesisNode",mZ=["Node"],Kb=N(fm,mZ,r=>{var{Node:e}=r;class t extends e{constructor(i){if(super(),!Dt(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return fm}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new t(a)}clone(){return new t(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:fm,content:this.content}}static fromJSON(i){return new t(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return Ht(t,"name",fm),t},{isClass:!0,isNode:!0});var pm="RangeNode",dZ=["Node"],ex=N(pm,dZ,r=>{var{Node:e}=r;function t(i,a,o){var l=Zt(i,a,o),u={},s=Zt(i.start,a,o);if(u.start=s!==null&&s<=l||a==="all",i.step){var c=Zt(i.step,a,o);u.step=c!==null&&c<=l||a==="all"}var f=Zt(i.end,a,o);return u.end=f!==null&&f<=l||a==="all",u}class n extends e{constructor(a,o,l){if(super(),!Dt(a))throw new TypeError("Node expected");if(!Dt(o))throw new TypeError("Node expected");if(l&&!Dt(l))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=l||null}get type(){return pm}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return ar(o)&&o.name==="end"});return a.length>0}_compile(a,o){var l=a.range,u=this.start._compile(a,o),s=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(p,m,h){return l(u(p,m,h),s(p,m,h),c(p,m,h))}}else return function(p,m,h){return l(u(p,m,h),s(p,m,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u,s=this.start.toString(a);if(l.start&&(s="("+s+")"),u=s,this.step){var c=this.step.toString(a);l.step&&(c="("+c+")"),u+=":"+c}var f=this.end.toString(a);return l.end&&(f="("+f+")"),u+=":"+f,u}toJSON(){return{mathjs:pm,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u,s=this.start.toHTML(a);if(l.start&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u=s,this.step){var c=this.step.toHTML(a);l.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return l.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),u+='<span class="math-operator math-range-operator">:</span>'+f,u}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",l=t(this,o,a&&a.implicit),u=this.start.toTex(a);if(l.start&&(u="\\left(".concat(u,"\\right)")),this.step){var s=this.step.toTex(a);l.step&&(s="\\left(".concat(s,"\\right)")),u+=":"+s}var c=this.end.toTex(a);return l.end&&(c="\\left(".concat(c,"\\right)")),u+=":"+c,u}}return Ht(n,"name",pm),n},{isClass:!0,isNode:!0});var mm="RelationalNode",hZ=["Node"],tx=N(mm,hZ,r=>{var{Node:e}=r,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return mm}get isRelationalNode(){return!0}_compile(a,o){var l=this,u=this.params.map(s=>s._compile(a,o));return function(c,f,p){for(var m,h=u[0](c,f,p),d=0;d<l.conditionals.length;d++){m=h,h=u[d+1](c,f,p);var g=br(a,l.conditionals[d]);if(!g(m,h))return!1}return!0}}forEach(a){this.params.forEach((o,l)=>a(o,"params["+l+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,l)=>this._ifNode(a(o,"params["+l+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=Zt(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=Zt(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?"("+f.toString(a)+")":f.toString(a)}),s=u[0],c=0;c<this.conditionals.length;c++)s+=" "+t[this.conditionals[c]],s+=" "+u[c+1];return s}toJSON(){return{mathjs:mm,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=Zt(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=Zt(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),s=u[0],c=0;c<this.conditionals.length;c++)s+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Yr(t[this.conditionals[c]])+"</span>"+u[c+1];return s}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",l=Zt(this,o,a&&a.implicit),u=this.params.map(function(f,p){var m=Zt(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=l?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),s=u[0],c=0;c<this.conditionals.length;c++)s+=Gt[this.conditionals[c]]+u[c+1];return s}}return Ht(n,"name",mm),n},{isClass:!0,isNode:!0});var gZ="SymbolNode",vZ=["math","?Unit","Node"],rx=N(gZ,vZ,r=>{var{math:e,Unit:t,Node:n}=r;function i(o){return t?t.isValuelessUnit(o):!1}class a extends n{constructor(l){if(super(),typeof l!="string")throw new TypeError('String expected for parameter "name"');this.name=l}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(l,u){var s=this.name;if(u[s]===!0)return function(f,p,m){return br(p,s)};if(s in l)return function(f,p,m){return f.has(s)?f.get(s):br(l,s)};var c=i(s);return function(f,p,m){return f.has(s)?f.get(s):c?new t(null,s):a.onUndefinedSymbol(s)}}forEach(l){}map(l){return this.clone()}static onUndefinedSymbol(l){throw new Error("Undefined symbol "+l)}clone(){return new a(this.name)}_toString(l){return this.name}_toHTML(l){var u=Yr(this.name);return u==="true"||u==="false"?'<span class="math-symbol math-boolean">'+u+"</span>":u==="i"?'<span class="math-symbol math-imaginary-symbol">'+u+"</span>":u==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+u+"</span>":u==="NaN"?'<span class="math-symbol math-nan-symbol">'+u+"</span>":u==="null"?'<span class="math-symbol math-null-symbol">'+u+"</span>":u==="undefined"?'<span class="math-symbol math-undefined-symbol">'+u+"</span>":'<span class="math-symbol">'+u+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(l){return new a(l.name)}_toTex(l){var u=!1;typeof e[this.name]=="undefined"&&i(this.name)&&(u=!0);var s=am(this.name,u);return s[0]==="\\"?s:" "+s}}return a},{isClass:!0,isNode:!0});var dm="FunctionNode",yZ=["math","Node","SymbolNode"],nx=N(dm,yZ,r=>{var e,{math:t,Node:n,SymbolNode:i}=r,a=u=>at(u,{truncate:78});function o(u,s,c){for(var f="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,h;(h=p.exec(u))!==null;)if(f+=u.substring(m,h.index),m=h.index,h[0]==="$$")f+="$",m++;else{m+=h[0].length;var d=s[h[1]];if(!d)throw new ReferenceError("Template: Property "+h[1]+" does not exist.");if(h[2]===void 0)switch(typeof d){case"string":f+=d;break;case"object":if(Dt(d))f+=d.toTex(c);else if(Array.isArray(d))f+=d.map(function(g,v){if(Dt(g))return g.toTex(c);throw new TypeError("Template: "+h[1]+"["+v+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes")}else if(Dt(d[h[2]]&&d[h[2]]))f+=d[h[2]].toTex(c);else throw new TypeError("Template: "+h[1]+"["+h[2]+"] is not a Node.")}return f+=u.slice(m),f}class l extends n{constructor(s,c){if(super(),typeof s=="string"&&(s=new i(s)),!Dt(s))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(Dt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=s,this.args=c||[]}get name(){return this.fn.name||""}get type(){return dm}get isFunctionNode(){return!0}_compile(s,c){var f=this.args.map(D=>D._compile(s,c));if(ar(this.fn)){var p=this.fn.name;if(c[p]){var v=this.args;return function(A,S,M){var F=br(S,p);if(typeof F!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(F)));if(F.rawArgs)return F(v,s,ss(A,S));var P=f.map(R=>R(A,S,M));return F.apply(F,P)}}else{var m=p in s?br(s,p):void 0,h=typeof m=="function"&&m.rawArgs===!0,d=D=>{var A;if(D.has(p))A=D.get(p);else if(p in s)A=br(s,p);else return l.onUndefinedFunction(p);if(typeof A=="function")return A;throw new TypeError("'".concat(p,`' is not a function; its value is:
`).concat(a(A)))};if(h){var g=this.args;return function(A,S,M){var F=d(A);return F(g,s,ss(A,S))}}else switch(f.length){case 0:return function(A,S,M){var F=d(A);return F()};case 1:return function(A,S,M){var F=d(A),P=f[0];return F(P(A,S,M))};case 2:return function(A,S,M){var F=d(A),P=f[0],R=f[1];return F(P(A,S,M),R(A,S,M))};default:return function(A,S,M){var F=d(A),P=f.map(R=>R(A,S,M));return F(...P)}}}}else if(ti(this.fn)&&hi(this.fn.index)&&this.fn.index.isObjectProperty()){var w=this.fn.object._compile(s,c),y=this.fn.index.getObjectProperty(),x=this.args;return function(A,S,M){var F=w(A,S,M),P=DN(F,y);if(P!=null&&P.rawArgs)return P(x,s,ss(A,S));var R=f.map(O=>O(A,S,M));return P.apply(F,R)}}else{var _=this.fn.toString(),b=this.fn._compile(s,c),E=this.args;return function(A,S,M){var F=b(A,S,M);if(typeof F!="function")throw new TypeError("Expression '".concat(_,"' did not evaluate to a function; value is:")+`
`.concat(a(F)));if(F.rawArgs)return F(E,s,ss(A,S));var P=f.map(R=>R(A,S,M));return F.apply(F,P)}}}forEach(s){s(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)s(this.args[c],"args["+c+"]",this)}map(s){for(var c=this._ifNode(s(this.fn,"fn",this)),f=[],p=0;p<this.args.length;p++)f[p]=this._ifNode(s(this.args[p],"args["+p+"]",this));return new l(c,f)}clone(){return new l(this.fn,this.args.slice(0))}toString(s){var c,f=this.fn.toString(s);return s&&typeof s.handler=="object"&&Ze(s.handler,f)&&(c=s.handler[f](this,s)),typeof c!="undefined"?c:super.toString(s)}_toString(s){var c=this.args.map(function(p){return p.toString(s)}),f=Xi(this.fn)?"("+this.fn.toString(s)+")":this.fn.toString(s);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:dm,fn:this.fn,args:this.args}}_toHTML(s){var c=this.args.map(function(f){return f.toHTML(s)});return'<span class="math-function">'+Yr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(s){var c;return s&&typeof s.handler=="object"&&Ze(s.handler,this.name)&&(c=s.handler[this.name](this,s)),typeof c!="undefined"?c:super.toTex(s)}_toTex(s){var c=this.args.map(function(m){return m.toTex(s)}),f;jb[this.name]&&(f=jb[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(f=t[this.name].toTex);var p;switch(typeof f){case"function":p=f(this,s);break;case"string":p=o(f,this,s);break;case"object":switch(typeof f[c.length]){case"function":p=f[c.length](this,s);break;case"string":p=o(f[c.length],this,s);break}}return typeof p!="undefined"?p:o(h2,this,s)}getIdentifier(){return this.type+":"+this.name}}return e=l,Ht(l,"name",dm),Ht(l,"onUndefinedFunction",function(u){throw new Error("Undefined function "+u)}),Ht(l,"fromJSON",function(u){return new e(u.fn,u.args)}),l},{isClass:!0,isNode:!0});var g2="parse",bZ=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],ix=N(g2,bZ,r=>{var{typed:e,numeric:t,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:l,ConditionalNode:u,ConstantNode:s,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:v,SymbolNode:w}=r,y=e(g2,{string:function(q){return G(q,{})},"Array | Matrix":function(q){return x(q,{})},"string, Object":function(q,ce){var Ce=ce.nodes!==void 0?ce.nodes:{};return G(q,Ce)},"Array | Matrix, Object":x});function x(C){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=q.nodes!==void 0?q.nodes:{};return Je(C,function(Ce){if(typeof Ce!="string")throw new TypeError("String expected");return G(Ce,ce)})}var _={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},b={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},D={true:!0,false:!1,null:null,undefined:void 0},A=["NaN","Infinity"],S={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function M(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:_.NULL,nestingLevel:0,conditionalLevel:null}}function F(C,q){return C.expression.substr(C.index,q)}function P(C){return F(C,1)}function R(C){C.index++}function O(C){return C.expression.charAt(C.index-1)}function I(C){return C.expression.charAt(C.index+1)}function T(C){for(C.tokenType=_.NULL,C.token="",C.comment="";;){if(P(C)==="#")for(;P(C)!==`
`&&P(C)!=="";)C.comment+=P(C),R(C);if(y.isWhitespace(P(C),C.nestingLevel))R(C);else break}if(P(C)===""){C.tokenType=_.DELIMITER;return}if(P(C)===`
`&&!C.nestingLevel){C.tokenType=_.DELIMITER,C.token=P(C),R(C);return}var q=P(C),ce=F(C,2),Ce=F(C,3);if(Ce.length===3&&b[Ce]){C.tokenType=_.DELIMITER,C.token=Ce,R(C),R(C),R(C);return}if(ce.length===2&&b[ce]){C.tokenType=_.DELIMITER,C.token=ce,R(C),R(C);return}if(b[q]){C.tokenType=_.DELIMITER,C.token=q,R(C);return}if(y.isDigitDot(q)){C.tokenType=_.NUMBER;var rt=F(C,2);if(rt==="0b"||rt==="0o"||rt==="0x"){for(C.token+=P(C),R(C),C.token+=P(C),R(C);y.isHexDigit(P(C));)C.token+=P(C),R(C);if(P(C)===".")for(C.token+=".",R(C);y.isHexDigit(P(C));)C.token+=P(C),R(C);else if(P(C)==="i")for(C.token+="i",R(C);y.isDigit(P(C));)C.token+=P(C),R(C);return}if(P(C)==="."){if(C.token+=P(C),R(C),!y.isDigit(P(C))){C.tokenType=_.DELIMITER;return}}else{for(;y.isDigit(P(C));)C.token+=P(C),R(C);y.isDecimalMark(P(C),I(C))&&(C.token+=P(C),R(C))}for(;y.isDigit(P(C));)C.token+=P(C),R(C);if(P(C)==="E"||P(C)==="e"){if(y.isDigit(I(C))||I(C)==="-"||I(C)==="+"){if(C.token+=P(C),R(C),(P(C)==="+"||P(C)==="-")&&(C.token+=P(C),R(C)),!y.isDigit(P(C)))throw Te(C,'Digit expected, got "'+P(C)+'"');for(;y.isDigit(P(C));)C.token+=P(C),R(C);if(y.isDecimalMark(P(C),I(C)))throw Te(C,'Digit expected, got "'+P(C)+'"')}else if(I(C)===".")throw R(C),Te(C,'Digit expected, got "'+P(C)+'"')}return}if(y.isAlpha(P(C),O(C),I(C))){for(;y.isAlpha(P(C),O(C),I(C))||y.isDigit(P(C));)C.token+=P(C),R(C);Ze(E,C.token)?C.tokenType=_.DELIMITER:C.tokenType=_.SYMBOL;return}for(C.tokenType=_.UNKNOWN;P(C)!=="";)C.token+=P(C),R(C);throw Te(C,'Syntax error in part "'+C.token+'"')}function $(C){do T(C);while(C.token===`
`)}function B(C){C.nestingLevel++}function U(C){C.nestingLevel--}y.isAlpha=function(q,ce,Ce){return y.isValidLatinOrGreek(q)||y.isValidMathSymbol(q,Ce)||y.isValidMathSymbol(ce,q)},y.isValidLatinOrGreek=function(q){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(q)},y.isValidMathSymbol=function(q,ce){return/^[\uD835]$/.test(q)&&/^[\uDC00-\uDFFF]$/.test(ce)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(ce)},y.isWhitespace=function(q,ce){return q===" "||q===" "||q===`
`&&ce>0},y.isDecimalMark=function(q,ce){return q==="."&&ce!=="/"&&ce!=="*"&&ce!=="^"},y.isDigitDot=function(q){return q>="0"&&q<="9"||q==="."},y.isDigit=function(q){return q>="0"&&q<="9"},y.isHexDigit=function(q){return q>="0"&&q<="9"||q>="a"&&q<="f"||q>="A"&&q<="F"};function G(C,q){var ce=M();yr(ce,{expression:C,extraNodes:q}),T(ce);var Ce=H(ce);if(ce.token!=="")throw ce.tokenType===_.DELIMITER?Re(ce,"Unexpected operator "+ce.token):Te(ce,'Unexpected part "'+ce.token+'"');return Ce}function H(C){var q,ce=[],Ce;for(C.token!==""&&C.token!==`
`&&C.token!==";"&&(q=L(C),C.comment&&(q.comment=C.comment));C.token===`
`||C.token===";";)ce.length===0&&q&&(Ce=C.token!==";",ce.push({node:q,visible:Ce})),T(C),C.token!==`
`&&C.token!==";"&&C.token!==""&&(q=L(C),C.comment&&(q.comment=C.comment),Ce=C.token!==";",ce.push({node:q,visible:Ce}));return ce.length>0?new l(ce):(q||(q=new s(void 0),C.comment&&(q.comment=C.comment)),q)}function L(C){var q,ce,Ce,rt,ut=ae(C);if(C.token==="="){if(ar(ut))return q=ut.name,$(C),Ce=L(C),new o(new w(q),Ce);if(ti(ut))return $(C),Ce=L(C),new o(ut.object,ut.index,Ce);if(Tn(ut)&&ar(ut.fn)&&(rt=!0,ce=[],q=ut.name,ut.args.forEach(function(gr,Gn){ar(gr)?ce[Gn]=gr.name:rt=!1}),rt))return $(C),Ce=L(C),new c(q,ce,Ce);throw Te(C,"Invalid left hand side of assignment operator =")}return ut}function ae(C){for(var q=ve(C);C.token==="?";){var ce=C.conditionalLevel;C.conditionalLevel=C.nestingLevel,$(C);var Ce=q,rt=L(C);if(C.token!==":")throw Te(C,"False part of conditional expression expected");C.conditionalLevel=null,$(C);var ut=L(C);q=new u(Ce,rt,ut),C.conditionalLevel=ce}return q}function ve(C){for(var q=se(C);C.token==="or";)$(C),q=new h("or","or",[q,se(C)]);return q}function se(C){for(var q=le(C);C.token==="xor";)$(C),q=new h("xor","xor",[q,le(C)]);return q}function le(C){for(var q=he(C);C.token==="and";)$(C),q=new h("and","and",[q,he(C)]);return q}function he(C){for(var q=K(C);C.token==="|";)$(C),q=new h("|","bitOr",[q,K(C)]);return q}function K(C){for(var q=ne(C);C.token==="^|";)$(C),q=new h("^|","bitXor",[q,ne(C)]);return q}function ne(C){for(var q=me(C);C.token==="&";)$(C),q=new h("&","bitAnd",[q,me(C)]);return q}function me(C){for(var q=[de(C)],ce=[],Ce={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ze(Ce,C.token);){var rt={name:C.token,fn:Ce[C.token]};ce.push(rt),$(C),q.push(de(C))}return q.length===1?q[0]:q.length===2?new h(ce[0].name,ce[0].fn,q):new v(ce.map(ut=>ut.fn),q)}function de(C){var q,ce,Ce,rt;q=Oe(C);for(var ut={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ze(ut,C.token);)ce=C.token,Ce=ut[ce],$(C),rt=[q,Oe(C)],q=new h(ce,Ce,rt);return q}function Oe(C){var q,ce,Ce,rt;q=Se(C);for(var ut={to:"to",in:"to"};Ze(ut,C.token);)ce=C.token,Ce=ut[ce],$(C),ce==="in"&&C.token===""?q=new h("*","multiply",[q,new w("in")],!0):(rt=[q,Se(C)],q=new h(ce,Ce,rt));return q}function Se(C){var q,ce=[];if(C.token===":"?q=new s(1):q=V(C),C.token===":"&&C.conditionalLevel!==C.nestingLevel){for(ce.push(q);C.token===":"&&ce.length<3;)$(C),C.token===")"||C.token==="]"||C.token===","||C.token===""?ce.push(new w("end")):ce.push(V(C));ce.length===3?q=new g(ce[0],ce[2],ce[1]):q=new g(ce[0],ce[1])}return q}function V(C){var q,ce,Ce,rt;q=X(C);for(var ut={"+":"add","-":"subtract"};Ze(ut,C.token);){ce=C.token,Ce=ut[ce],$(C);var gr=X(C);gr.isPercentage?rt=[q,new h("*","multiply",[q,gr])]:rt=[q,gr],q=new h(ce,Ce,rt)}return q}function X(C){var q,ce,Ce,rt;q=fe(C),ce=q;for(var ut={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Ze(ut,C.token);)Ce=C.token,rt=ut[Ce],$(C),ce=fe(C),q=new h(Ce,rt,[q,ce]);return q}function fe(C){var q,ce;for(q=W(C),ce=q;C.tokenType===_.SYMBOL||C.token==="in"&&_t(q)||C.tokenType===_.NUMBER&&!_t(ce)&&(!hr(ce)||ce.op==="!")||C.token==="(";)ce=W(C),q=new h("*","multiply",[q,ce],!0);return q}function W(C){for(var q=te(C),ce=q,Ce=[];C.token==="/"&&ul(ce);)if(Ce.push(yr({},C)),$(C),C.tokenType===_.NUMBER)if(Ce.push(yr({},C)),$(C),C.tokenType===_.SYMBOL||C.token==="(")yr(C,Ce.pop()),Ce.pop(),ce=te(C),q=new h("/","divide",[q,ce]);else{Ce.pop(),yr(C,Ce.pop());break}else{yr(C,Ce.pop());break}return q}function te(C){var q,ce,Ce,rt;q=ie(C);for(var ut={"%":"mod",mod:"mod"};Ze(ut,C.token);)ce=C.token,Ce=ut[ce],$(C),ce==="%"&&C.tokenType===_.DELIMITER&&C.token!=="("?q=new h("/","divide",[q,new s(100)],!1,!0):(rt=[q,ie(C)],q=new h(ce,Ce,rt));return q}function ie(C){var q,ce,Ce,rt={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ze(rt,C.token)?(Ce=rt[C.token],q=C.token,$(C),ce=[ie(C)],new h(q,Ce,ce)):ge(C)}function ge(C){var q,ce,Ce,rt;return q=ye(C),(C.token==="^"||C.token===".^")&&(ce=C.token,Ce=ce==="^"?"pow":"dotPow",$(C),rt=[q,ie(C)],q=new h(ce,Ce,rt)),q}function ye(C){var q,ce,Ce,rt;q=qe(C);for(var ut={"!":"factorial","'":"ctranspose"};Ze(ut,C.token);)ce=C.token,Ce=ut[ce],T(C),rt=[q],q=new h(ce,Ce,rt),q=ft(C,q);return q}function qe(C){var q=[];if(C.tokenType===_.SYMBOL&&Ze(C.extraNodes,C.token)){var ce=C.extraNodes[C.token];if(T(C),C.token==="("){if(q=[],B(C),T(C),C.token!==")")for(q.push(L(C));C.token===",";)T(C),q.push(L(C));if(C.token!==")")throw Te(C,"Parenthesis ) expected");U(C),T(C)}return new ce(q)}return De(C)}function De(C){var q,ce;return C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in E?(ce=C.token,T(C),Ze(D,ce)?q=new s(D[ce]):A.indexOf(ce)!==-1?q=new s(t(ce,"number")):q=new w(ce),q=ft(C,q),q):wt(C)}function ft(C,q,ce){for(var Ce;(C.token==="("||C.token==="["||C.token===".")&&(!ce||ce.indexOf(C.token)!==-1);)if(Ce=[],C.token==="(")if(ar(q)||ti(q)){if(B(C),T(C),C.token!==")")for(Ce.push(L(C));C.token===",";)T(C),Ce.push(L(C));if(C.token!==")")throw Te(C,"Parenthesis ) expected");U(C),T(C),q=new f(q,Ce)}else return q;else if(C.token==="["){if(B(C),T(C),C.token!=="]")for(Ce.push(L(C));C.token===",";)T(C),Ce.push(L(C));if(C.token!=="]")throw Te(C,"Parenthesis ] expected");U(C),T(C),q=new i(q,new p(Ce))}else{T(C);var rt=C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in E;if(!rt)throw Te(C,"Property name expected after dot");Ce.push(new s(C.token)),T(C);var ut=!0;q=new i(q,new p(Ce,ut))}return q}function wt(C){var q,ce;return C.token==='"'||C.token==="'"?(ce=jt(C,C.token),q=new s(ce),q=ft(C,q),q):nr(C)}function jt(C,q){for(var ce="";P(C)!==""&&P(C)!==q;)if(P(C)==="\\"){R(C);var Ce=P(C),rt=S[Ce];if(rt!==void 0)ce+=rt,C.index+=1;else if(Ce==="u"){var ut=C.expression.slice(C.index+1,C.index+5);if(/^[0-9A-Fa-f]{4}$/.test(ut))ce+=String.fromCharCode(parseInt(ut,16)),C.index+=5;else throw Te(C,"Invalid unicode character \\u".concat(ut))}else throw Te(C,"Bad escape character \\".concat(Ce))}else ce+=P(C),R(C);if(T(C),C.token!==q)throw Te(C,"End of string ".concat(q," expected"));return T(C),ce}function nr(C){var q,ce,Ce,rt;if(C.token==="["){if(B(C),T(C),C.token!=="]"){var ut=Y(C);if(C.token===";"){for(Ce=1,ce=[ut];C.token===";";)T(C),ce[Ce]=Y(C),Ce++;if(C.token!=="]")throw Te(C,"End of matrix ] expected");U(C),T(C),rt=ce[0].items.length;for(var gr=1;gr<Ce;gr++)if(ce[gr].items.length!==rt)throw Re(C,"Column dimensions mismatch ("+ce[gr].items.length+" !== "+rt+")");q=new a(ce)}else{if(C.token!=="]")throw Te(C,"End of matrix ] expected");U(C),T(C),q=ut}}else U(C),T(C),q=new a([]);return ft(C,q)}return oe(C)}function Y(C){for(var q=[L(C)],ce=1;C.token===",";)T(C),q[ce]=L(C),ce++;return new a(q)}function oe(C){if(C.token==="{"){B(C);var q,ce={};do if(T(C),C.token!=="}"){if(C.token==='"'||C.token==="'")q=jt(C,C.token);else if(C.tokenType===_.SYMBOL||C.tokenType===_.DELIMITER&&C.token in E)q=C.token,T(C);else throw Te(C,"Symbol or string expected as object key");if(C.token!==":")throw Te(C,"Colon : expected after object key");T(C),ce[q]=L(C)}while(C.token===",");if(C.token!=="}")throw Te(C,"Comma , or bracket } expected after object value");U(C),T(C);var Ce=new m(ce);return Ce=ft(C,Ce),Ce}return pe(C)}function pe(C){var q;return C.tokenType===_.NUMBER?(q=C.token,T(C),new s(t(q,n.number))):Ee(C)}function Ee(C){var q;if(C.token==="("){if(B(C),T(C),q=L(C),C.token!==")")throw Te(C,"Parenthesis ) expected");return U(C),T(C),q=new d(q),q=ft(C,q),q}return Fe(C)}function Fe(C){throw C.token===""?Te(C,"Unexpected end of expression"):Te(C,"Value expected")}function Ne(C){return C.index-C.token.length+1}function Te(C,q){var ce=Ne(C),Ce=new SyntaxError(q+" (char "+ce+")");return Ce.char=ce,Ce}function Re(C,q){var ce=Ne(C),Ce=new SyntaxError(q+" (char "+ce+")");return Ce.char=ce,Ce}return e.addConversion({from:"string",to:"Node",convert:y}),y});var v2="compile",xZ=["typed","parse"],ax=N(v2,xZ,r=>{var{typed:e,parse:t}=r;return e(v2,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return Je(i,function(a){return t(a).compile()})}})});var y2="evaluate",wZ=["typed","parse"],ox=N(y2,wZ,r=>{var{typed:e,parse:t}=r;return e(y2,{string:function(i){var a=to();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=to();return Je(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return Je(i,function(o){return t(o).compile().evaluate(a)})}})});var _Z="Parser",AZ=["evaluate"],sx=N(_Z,AZ,r=>{var{evaluate:e}=r;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:to(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(n){return e(n,this.scope)},t.prototype.get=function(n){if(this.scope.has(n))return this.scope.get(n)},t.prototype.getAll=function(){return MN(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(n,i){return this.scope.set(n,i),i},t.prototype.remove=function(n){this.scope.delete(n)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var b2="parser",SZ=["typed","Parser"],ux=N(b2,SZ,r=>{var{typed:e,Parser:t}=r;return e(b2,{"":function(){return new t}})});var x2="lup",EZ=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],lx=N(x2,EZ,r=>{var{typed:e,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:l,larger:u,equalScalar:s,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=r;return e(x2,{DenseMatrix:function(v){return h(v)},SparseMatrix:function(v){return d(v)},Array:function(v){var w=t(v),y=h(w);return{L:y.L.valueOf(),U:y.U.valueOf(),p:y.p}}});function h(g){var v=g._size[0],w=g._size[1],y=Math.min(v,w),x=et(g._data),_=[],b=[v,y],E=[],D=[y,w],A,S,M,F=[];for(A=0;A<v;A++)F[A]=A;for(S=0;S<w;S++){if(S>0)for(A=0;A<v;A++){var P=Math.min(A,S),R=0;for(M=0;M<P;M++)R=i(R,o(x[A][M],x[M][S]));x[A][S]=l(x[A][S],R)}var O=S,I=0,T=0;for(A=S;A<v;A++){var $=x[A][S],B=n($);u(B,I)&&(O=A,I=B,T=$)}if(S!==O&&(F[S]=[F[O],F[O]=F[S]][0],f._swapRows(S,O,x)),S<v)for(A=S+1;A<v;A++){var U=x[A][S];s(U,0)||(x[A][S]=a(x[A][S],T))}}for(S=0;S<w;S++)for(A=0;A<v;A++){if(S===0&&(A<w&&(E[A]=[]),_[A]=[]),A<S){A<w&&(E[A][S]=x[A][S]),S<v&&(_[A][S]=0);continue}if(A===S){A<w&&(E[A][S]=x[A][S]),S<v&&(_[A][S]=1);continue}A<w&&(E[A][S]=0),S<v&&(_[A][S]=x[A][S])}var G=new f({data:_,size:b}),H=new f({data:E,size:D}),L=[];for(A=0,y=F.length;A<y;A++)L[F[A]]=A;return{L:G,U:H,p:L,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function d(g){var v=g._size[0],w=g._size[1],y=Math.min(v,w),x=g._values,_=g._index,b=g._ptr,E=[],D=[],A=[],S=[v,y],M=[],F=[],P=[],R=[y,w],O,I,T,$=[],B=[];for(O=0;O<v;O++)$[O]=O,B[O]=O;var U=function(L,ae){var ve=B[L],se=B[ae];$[ve]=ae,$[se]=L,B[L]=se,B[ae]=ve},G=function(){var L=new m;I<v&&(A.push(E.length),E.push(1),D.push(I)),P.push(M.length);var ae=b[I],ve=b[I+1];for(T=ae;T<ve;T++)O=_[T],L.set($[O],x[T]);I>0&&L.forEach(0,I-1,function(K,ne){p._forEachRow(K,E,D,A,function(me,de){me>K&&L.accumulate(me,c(o(de,ne)))})});var se=I,le=L.get(I),he=n(le);L.forEach(I+1,v-1,function(K,ne){var me=n(ne);u(me,he)&&(se=K,he=me,le=ne)}),I!==se&&(p._swapRows(I,se,S[1],E,D,A),p._swapRows(I,se,R[1],M,F,P),L.swap(I,se),U(I,se)),L.forEach(0,v-1,function(K,ne){K<=I?(M.push(ne),F.push(K)):(ne=a(ne,le),s(ne,0)||(E.push(ne),D.push(K)))})};for(I=0;I<w;I++)G();return P.push(M.length),A.push(E.length),{L:new p({values:E,index:D,ptr:A,size:S}),U:new p({values:M,index:F,ptr:P,size:R}),p:$,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var w2="qr",DZ=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],cx=N(w2,DZ,r=>{var{typed:e,matrix:t,zeros:n,identity:i,isZero:a,equal:o,sign:l,sqrt:u,conj:s,unaryMinus:c,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=r;return yr(e(w2,{DenseMatrix:function(x){return v(x)},SparseMatrix:function(x){return w(x)},Array:function(x){var _=t(x),b=v(_);return{Q:b.Q.valueOf(),R:b.R.valueOf()}}}),{_denseQRimpl:g});function g(y){var x=y._size[0],_=y._size[1],b=i([x],"dense"),E=b._data,D=y.clone(),A=D._data,S,M,F,P=n([x],"");for(F=0;F<Math.min(_,x);++F){var R=A[F][F],O=c(o(R,0)?1:l(R)),I=s(O),T=0;for(S=F;S<x;S++)T=f(T,m(A[S][F],s(A[S][F])));var $=m(O,u(T));if(!a($)){var B=h(R,$);for(P[F]=1,S=F+1;S<x;S++)P[S]=p(A[S][F],B);var U=c(s(p(B,$))),G=void 0;for(M=F;M<_;M++){for(G=0,S=F;S<x;S++)G=f(G,m(s(P[S]),A[S][M]));for(G=m(G,U),S=F;S<x;S++)A[S][M]=m(h(A[S][M],m(P[S],G)),I)}for(S=0;S<x;S++){for(G=0,M=F;M<x;M++)G=f(G,m(E[S][M],P[M]));for(G=m(G,U),M=F;M<x;++M)E[S][M]=p(h(E[S][M],m(G,s(P[M]))),I)}}}return{Q:b,R:D,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function v(y){var x=g(y),_=x.R._data;if(y._data.length>0)for(var b=_[0][0].type==="Complex"?d(0):0,E=0;E<_.length;++E)for(var D=0;D<E&&D<(_[0]||[]).length;++D)_[E][D]=b;return x}function w(y){throw new Error("qr not implemented for sparse matrices yet")}});function _2(r,e,t,n){for(var i=r._values,a=r._index,o=r._ptr,l=r._size,u=r._datatype,s=l[0],c=l[1],f=n&&r._values?[]:null,p=[],m=[],h=0,d=0;d<c;d++){m[d]=h;for(var g=t?t[d]:d,v=o[g],w=o[g+1],y=v;y<w;y++){var x=e?e[a[y]]:a[y];p[h]=x,f&&(f[h]=i[y]),h++}}return m[c]=h,r.createSparseMatrix({values:f,index:p,ptr:m,size:[s,c],datatype:u})}function hm(r,e,t,n,i,a,o){var l=0;for(t[o]=r;l>=0;){var u=t[o+l],s=t[n+u];s===-1?(l--,a[e++]=u):(t[n+u]=t[i+s],++l,t[o+l]=s)}return e}function A2(r,e){if(!r)return null;var t=0,n,i=[],a=[],o=0,l=e,u=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)r[n]!==-1&&(a[l+n]=a[o+r[n]],a[o+r[n]]=n);for(n=0;n<e;n++)r[n]===-1&&(t=hm(n,t,a,o,l,i,u));return i}function S2(r,e){if(!r)return null;var t=r._index,n=r._ptr,i=r._size,a=i[0],o=i[1],l=[],u=[],s=0,c=o,f,p;if(e)for(f=0;f<a;f++)u[c+f]=-1;for(var m=0;m<o;m++){l[m]=-1,u[s+m]=-1;for(var h=n[m],d=n[m+1],g=h;g<d;g++){var v=t[g];for(f=e?u[c+v]:v;f!==-1&&f<m;f=p)p=u[s+f],u[s+f]=m,p===-1&&(l[f]=m);e&&(u[c+v]=m)}}return l}function E2(r,e,t){for(var n=r._values,i=r._index,a=r._ptr,o=r._size,l=o[1],u=0,s=0;s<l;s++){var c=a[s];for(a[s]=u;c<a[s+1];c++)e(i[c],s,n?n[c]:1,t)&&(i[u]=i[c],n&&(n[u]=n[c]),u++)}return a[l]=u,i.splice(u,i.length-u),n&&n.splice(u,n.length-u),u}function zi(r){return-r-2}var NZ="csAmd",CZ=["add","multiply","transpose"],D2=N(NZ,CZ,r=>{var{add:e,multiply:t,transpose:n}=r;return function(c,f){if(!f||c<=0||c>3)return null;var p=f._size,m=p[0],h=p[1],d=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var v=i(c,f,m,h,g);E2(v,u,null);for(var w=v._index,y=v._ptr,x=y[h],_=[],b=[],E=0,D=h+1,A=2*(h+1),S=3*(h+1),M=4*(h+1),F=5*(h+1),P=6*(h+1),R=7*(h+1),O=_,I=a(h,y,b,E,S,O,A,R,D,P,M,F),T=o(h,y,b,F,M,P,g,D,S,O,A),$=0,B,U,G,H,L,ae,ve,se,le,he,K,ne,me,de,Oe,Se;T<h;){for(G=-1;$<h&&(G=b[S+$])===-1;$++);b[A+G]!==-1&&(O[b[A+G]]=-1),b[S+$]=b[A+G];var V=b[M+G],X=b[D+G];T+=X;var fe=0;b[D+G]=-X;var W=y[G],te=V===0?W:x,ie=te;for(H=1;H<=V+1;H++){for(H>V?(ae=G,ve=W,se=b[E+G]-V):(ae=w[W++],ve=y[ae],se=b[E+ae]),L=1;L<=se;L++)B=w[ve++],!((le=b[D+B])<=0)&&(fe+=le,b[D+B]=-le,w[ie++]=B,b[A+B]!==-1&&(O[b[A+B]]=O[B]),O[B]!==-1?b[A+O[B]]=b[A+B]:b[S+b[F+B]]=b[A+B]);ae!==G&&(y[ae]=zi(G),b[P+ae]=0)}for(V!==0&&(x=ie),b[F+G]=fe,y[G]=te,b[E+G]=ie-te,b[M+G]=-2,I=l(I,d,b,P,h),he=te;he<ie;he++)if(B=w[he],!((K=b[M+B])<=0)){le=-b[D+B];var ge=I-le;for(W=y[B],ne=y[B]+K-1;W<=ne;W++)ae=w[W],b[P+ae]>=I?b[P+ae]-=le:b[P+ae]!==0&&(b[P+ae]=b[F+ae]+ge)}for(he=te;he<ie;he++){for(B=w[he],ne=y[B],me=ne+b[M+B]-1,de=ne,Oe=0,Se=0,W=ne;W<=me;W++)if(ae=w[W],b[P+ae]!==0){var ye=b[P+ae]-I;ye>0?(Se+=ye,w[de++]=ae,Oe+=ae):(y[ae]=zi(G),b[P+ae]=0)}b[M+B]=de-ne+1;var qe=de,De=ne+b[E+B];for(W=me+1;W<De;W++){U=w[W];var ft=b[D+U];ft<=0||(Se+=ft,w[de++]=U,Oe+=U)}Se===0?(y[B]=zi(G),le=-b[D+B],fe-=le,X+=le,T+=le,b[D+B]=0,b[M+B]=-1):(b[F+B]=Math.min(b[F+B],Se),w[de]=w[qe],w[qe]=w[ne],w[ne]=G,b[E+B]=de-ne+1,Oe=(Oe<0?-Oe:Oe)%h,b[A+B]=b[R+Oe],b[R+Oe]=B,O[B]=Oe)}for(b[F+G]=fe,d=Math.max(d,fe),I=l(I+d,d,b,P,h),he=te;he<ie;he++)if(B=w[he],!(b[D+B]>=0))for(Oe=O[B],B=b[R+Oe],b[R+Oe]=-1;B!==-1&&b[A+B]!==-1;B=b[A+B],I++){for(se=b[E+B],K=b[M+B],W=y[B]+1;W<=y[B]+se-1;W++)b[P+w[W]]=I;var wt=B;for(U=b[A+B];U!==-1;){var jt=b[E+U]===se&&b[M+U]===K;for(W=y[U]+1;jt&&W<=y[U]+se-1;W++)b[P+w[W]]!==I&&(jt=0);jt?(y[U]=zi(B),b[D+B]+=b[D+U],b[D+U]=0,b[M+U]=-1,U=b[A+U],b[A+wt]=U):(wt=U,U=b[A+U])}}for(W=te,he=te;he<ie;he++)B=w[he],!((le=-b[D+B])<=0)&&(b[D+B]=le,Se=b[F+B]+fe-le,Se=Math.min(Se,h-T-le),b[S+Se]!==-1&&(O[b[S+Se]]=B),b[A+B]=b[S+Se],O[B]=-1,b[S+Se]=B,$=Math.min($,Se),b[F+B]=Se,w[W++]=B);b[D+G]=X,(b[E+G]=W-te)===0&&(y[G]=-1,b[P+G]=0),V!==0&&(x=W)}for(B=0;B<h;B++)y[B]=zi(y[B]);for(U=0;U<=h;U++)b[S+U]=-1;for(U=h;U>=0;U--)b[D+U]>0||(b[A+U]=b[S+y[U]],b[S+y[U]]=U);for(ae=h;ae>=0;ae--)b[D+ae]<=0||y[ae]!==-1&&(b[A+ae]=b[S+y[ae]],b[S+y[ae]]=ae);for(G=0,B=0;B<=h;B++)y[B]===-1&&(G=hm(B,G,b,S,A,_,P));return _.splice(_.length-1,1),_};function i(s,c,f,p,m){var h=n(c);if(s===1&&p===f)return e(c,h);if(s===2){for(var d=h._index,g=h._ptr,v=0,w=0;w<f;w++){var y=g[w];if(g[w]=v,!(g[w+1]-y>m))for(var x=g[w+1];y<x;y++)d[v++]=d[y]}return g[f]=v,c=n(h),t(h,c)}return t(h,c)}function a(s,c,f,p,m,h,d,g,v,w,y,x){for(var _=0;_<s;_++)f[p+_]=c[_+1]-c[_];f[p+s]=0;for(var b=0;b<=s;b++)f[m+b]=-1,h[b]=-1,f[d+b]=-1,f[g+b]=-1,f[v+b]=1,f[w+b]=1,f[y+b]=0,f[x+b]=f[p+b];var E=l(0,0,f,w,s);return f[y+s]=-2,c[s]=-1,f[w+s]=0,E}function o(s,c,f,p,m,h,d,g,v,w,y){for(var x=0,_=0;_<s;_++){var b=f[p+_];if(b===0)f[m+_]=-2,x++,c[_]=-1,f[h+_]=0;else if(b>d)f[g+_]=0,f[m+_]=-1,x++,c[_]=zi(s),f[g+s]++;else{var E=f[v+b];E!==-1&&(w[E]=_),f[y+_]=f[v+b],f[v+b]=_}}return x}function l(s,c,f,p,m){if(s<2||s+c<0){for(var h=0;h<m;h++)f[p+h]!==0&&(f[p+h]=1);s=2}return s}function u(s,c){return s!==c}});function N2(r,e,t,n,i,a,o){var l,u,s=0,c;if(r<=e||t[n+e]<=t[i+r])return-1;t[i+r]=t[n+e];var f=t[a+r];if(t[a+r]=e,f===-1)s=1,c=r;else{for(s=2,c=f;c!==t[o+c];c=t[o+c]);for(l=f;l!==c;l=u)u=t[o+l],t[o+l]=c}return{jleaf:s,q:c}}var MZ="csCounts",TZ=["transpose"],C2=N(MZ,TZ,r=>{var{transpose:e}=r;return function(t,n,i,a){if(!t||!n||!i)return null;var o=t._size,l=o[0],u=o[1],s,c,f,p,m,h,d,g=4*u+(a?u+l+1:0),v=[],w=0,y=u,x=2*u,_=3*u,b=4*u,E=5*u+1;for(f=0;f<g;f++)v[f]=-1;var D=[],A=e(t),S=A._index,M=A._ptr;for(f=0;f<u;f++)for(c=i[f],D[c]=v[_+c]===-1?1:0;c!==-1&&v[_+c]===-1;c=n[c])v[_+c]=f;if(a){for(f=0;f<u;f++)v[i[f]]=f;for(s=0;s<l;s++){for(f=u,h=M[s],d=M[s+1],m=h;m<d;m++)f=Math.min(f,v[S[m]]);v[E+s]=v[b+f],v[b+f]=s}}for(s=0;s<u;s++)v[w+s]=s;for(f=0;f<u;f++){for(c=i[f],n[c]!==-1&&D[n[c]]--,p=a?v[b+f]:c;p!==-1;p=a?v[E+p]:-1)for(m=M[p];m<M[p+1];m++){s=S[m];var F=N2(s,c,v,_,y,x,w);F.jleaf>=1&&D[c]++,F.jleaf===2&&D[F.q]--}n[c]!==-1&&(v[w+c]=n[c])}for(c=0;c<u;c++)n[c]!==-1&&(D[n[c]]+=D[c]);return D}});var FZ="csSqr",IZ=["add","multiply","transpose"],M2=N(FZ,IZ,r=>{var{add:e,multiply:t,transpose:n}=r,i=D2({add:e,multiply:t,transpose:n}),a=C2({transpose:n});return function(u,s,c){var f=s._ptr,p=s._size,m=p[1],h,d={};if(d.q=i(u,s),u&&!d.q)return null;if(c){var g=u?_2(s,null,d.q,0):s;d.parent=S2(g,1);var v=A2(d.parent,m);if(d.cp=a(g,d.parent,v,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,h=0;h<m;h++)d.unz+=d.cp[h]}else d.unz=4*f[m]+m,d.lnz=d.unz;return d};function o(l,u){var s=l._ptr,c=l._index,f=l._size,p=f[0],m=f[1];u.pinv=[],u.leftmost=[];var h=u.parent,d=u.pinv,g=u.leftmost,v=[],w=0,y=p,x=p+m,_=p+2*m,b,E,D,A,S;for(E=0;E<m;E++)v[y+E]=-1,v[x+E]=-1,v[_+E]=0;for(b=0;b<p;b++)g[b]=-1;for(E=m-1;E>=0;E--)for(A=s[E],S=s[E+1],D=A;D<S;D++)g[c[D]]=E;for(b=p-1;b>=0;b--)d[b]=-1,E=g[b],E!==-1&&(v[_+E]++===0&&(v[x+E]=b),v[w+b]=v[y+E],v[y+E]=b);for(u.lnz=0,u.m2=p,E=0;E<m;E++)if(b=v[y+E],u.lnz++,b<0&&(b=u.m2++),d[b]=E,!(--_[E]<=0)){u.lnz+=v[_+E];var M=h[E];M!==-1&&(v[_+M]===0&&(v[x+M]=v[x+E]),v[w+v[x+E]]=v[y+M],v[y+M]=v[w+b],v[_+M]+=v[_+E])}for(b=0;b<p;b++)d[b]<0&&(d[b]=E++);return!0}});function Ol(r,e){return r[e]<0}function gm(r,e){r[e]=zi(r[e])}function fx(r){return r<0?zi(r):r}function T2(r,e,t,n,i){var a=e._index,o=e._ptr,l=e._size,u=l[1],s,c,f,p=0;for(n[0]=r;p>=0;){r=n[p];var m=i?i[r]:r;Ol(o,r)||(gm(o,r),n[u+p]=m<0?0:fx(o[m]));var h=1;for(c=n[u+p],f=m<0?0:fx(o[m+1]);c<f;c++)if(s=a[c],!Ol(o,s)){n[u+p]=c,n[++p]=s,h=0;break}h&&(p--,n[--t]=r)}return t}function F2(r,e,t,n,i){var a=r._ptr,o=r._size,l=e._index,u=e._ptr,s=o[1],c,f,p,m=s;for(f=u[t],p=u[t+1],c=f;c<p;c++){var h=l[c];Ol(a,h)||(m=T2(h,r,m,n,i))}for(c=m;c<s;c++)gm(a,n[c]);return m}var BZ="csSpsolve",PZ=["divideScalar","multiply","subtract"],I2=N(BZ,PZ,r=>{var{divideScalar:e,multiply:t,subtract:n}=r;return function(a,o,l,u,s,c,f){var p=a._values,m=a._index,h=a._ptr,d=a._size,g=d[1],v=o._values,w=o._index,y=o._ptr,x,_,b,E,D=F2(a,o,l,u,c);for(x=D;x<g;x++)s[u[x]]=0;for(_=y[l],b=y[l+1],x=_;x<b;x++)s[w[x]]=v[x];for(var A=D;A<g;A++){var S=u[A],M=c?c[S]:S;if(!(M<0))for(_=h[M],b=h[M+1],s[S]=e(s[S],p[f?_:b-1]),x=f?_+1:_,E=f?b:b-1;x<E;x++){var F=m[x];s[F]=n(s[F],t(p[x],s[S]))}}return D}});var OZ="csLu",kZ=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],B2=N(OZ,kZ,r=>{var{abs:e,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:l}=r,u=I2({divideScalar:t,multiply:n,subtract:i});return function(c,f,p){if(!c)return null;var m=c._size,h=m[1],d,g=100,v=100;f&&(d=f.q,g=f.lnz||g,v=f.unz||v);var w=[],y=[],x=[],_=new l({values:w,index:y,ptr:x,size:[h,h]}),b=[],E=[],D=[],A=new l({values:b,index:E,ptr:D,size:[h,h]}),S=[],M,F,P=[],R=[];for(M=0;M<h;M++)P[M]=0,S[M]=-1,x[M+1]=0;g=0,v=0;for(var O=0;O<h;O++){x[O]=g,D[O]=v;var I=d?d[O]:O,T=u(_,c,I,R,P,S,1),$=-1,B=-1;for(F=T;F<h;F++)if(M=R[F],S[M]<0){var U=e(P[M]);a(U,B)&&(B=U,$=M)}else E[v]=S[M],b[v++]=P[M];if($===-1||B<=0)return null;S[I]<0&&o(e(P[I]),n(B,p))&&($=I);var G=P[$];for(E[v]=O,b[v++]=G,S[$]=O,y[g]=$,w[g++]=1,F=T;F<h;F++)M=R[F],S[M]<0&&(y[g]=M,w[g++]=t(P[M],G)),P[M]=0}for(x[h]=g,D[h]=v,F=0;F<g;F++)y[F]=S[y[F]];return w.splice(g,w.length-g),y.splice(g,y.length-g),b.splice(v,b.length-v),E.splice(v,E.length-v),{L:_,U:A,pinv:S}}});var P2="slu",RZ=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],px=N(P2,RZ,r=>{var{typed:e,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:l,larger:u,largerEq:s,SparseMatrix:c}=r,f=M2({add:n,multiply:i,transpose:a}),p=B2({abs:t,divideScalar:o,multiply:i,subtract:l,larger:u,largerEq:s,SparseMatrix:c});return e(P2,{"SparseMatrix, number, number":function(h,d,g){if(!ze(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var v=f(d,h,!1),w=p(h,v,g);return{L:w.L,U:w.U,p:w.pinv,q:v.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function mx(r,e){var t,n=e.length,i=[];if(r)for(t=0;t<n;t++)i[r[t]]=e[t];else for(t=0;t<n;t++)i[t]=e[t];return i}var O2="lusolve",LZ=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],dx=N(O2,LZ,r=>{var{typed:e,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:l}=r,u=ta({DenseMatrix:l});return e(O2,{"Array, Array | Matrix":function(p,m){p=t(p);var h=n(p),d=c(h.L,h.U,h.p,null,m);return d.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var h=n(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var h=n(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix, number, number":function(p,m,h,d){var g=i(p,h,d);return c(g.L,g.U,g.p,g.q,m)},"Object, Array | Matrix":function(p,m){return c(p.L,p.U,p.p,p.q,m)}});function s(f){if(Ge(f))return f;if(It(f))return t(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,p,m,h,d){f=s(f),p=s(p),m&&(d=u(f,d,!0),d._data=mx(m,d._data));var g=o(f,d),v=a(p,g);return h&&(v._data=mx(h,v._data)),v}});var k2="polynomialRoot",UZ=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],hx=N(k2,UZ,r=>{var{typed:e,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:l,sqrt:u,unaryMinus:s,cbrt:c,typeOf:f,im:p,re:m}=r;return e(k2,{"number|Complex, ...number|Complex":(h,d)=>{for(var g=[h,...d];g.length>0&&t(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(d,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[s(l(g[0],g[1]))];case 3:{var[v,w,y]=g,x=o(2,y),_=o(w,w),b=o(4,y,v);if(n(_,b))return[l(s(w),x)];var E=u(a(_,b));return[l(a(E,w),x),l(a(s(E),w),x)]}case 4:{var[D,A,S,M]=g,F=s(o(3,M)),P=o(S,S),R=o(3,M,A),O=i(o(2,S,S,S),o(27,M,M,D)),I=o(9,M,S,A);if(n(P,R)&&n(O,I))return[l(S,F)];var T=a(P,R),$=a(O,I),B=i(o(18,M,S,A,D),o(S,S,A,A)),U=i(o(4,S,S,S,D),o(4,M,A,A,A),o(27,M,M,D,D));if(n(B,U))return[l(a(o(4,M,S,A),i(o(9,M,M,D),o(S,S,S))),o(M,T)),l(a(o(9,M,D),o(S,A)),o(2,T))];var G;n(P,R)?G=$:G=l(i($,u(a(o($,$),o(4,T,T,T)))),2);var H=!0,L=c(G,H).toArray().map(ae=>l(i(S,ae,l(T,ae)),F));return L.map(ae=>f(ae)==="Complex"&&n(m(ae),m(ae)+p(ae))?m(ae):ae)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var VZ="Help",$Z=["evaluate"],gx=N(VZ,$Z,r=>{var{evaluate:e}=r;function t(n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`
`),n.category&&(i+="Category: "+n.category+`
`),n.description&&(i+=`Description:
`+n.description+`
`),n.syntax&&(i+=`Syntax:
`+n.syntax.join(`
`)+`
`),n.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),l={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},u=0;u<n.examples.length;u++){var s=n.examples[u];i+=" "+s+`
`;var c=void 0;try{c=e(s,l)}catch(f){c=f}c!==void 0&&!cp(c)&&(i+=" "+at(c,{precision:14})+`
`)}i+=`
`,a&&e("config(originalConfig)",{originalConfig:o})}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`
`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},t.prototype.toJSON=function(){var n=et(this.doc);return n.mathjs="Help",n},t.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var qZ="Chain",zZ=["?on","math","typed"],vx=N(qZ,zZ,r=>{var{on:e,math:t,typed:n}=r;function i(s){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");fp(s)?this.value=s.value:this.value=s}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 at(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(s){return new i(s.value)};function a(s,c){typeof c=="function"&&(i.prototype[s]=l(c))}function o(s,c){YD(i.prototype,s,function(){var p=c();if(typeof p=="function")return l(p)})}function l(s){return function(){if(arguments.length===0)return new i(s(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(s)){var p=n.resolve(s,c);if(p.params.length===1)throw new Error("chain function "+s.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(s,c))}return new i(s.apply(s,c))}}i.createProxy=function(s,c){if(typeof s=="string")a(s,c);else{var f=function(h){Ze(s,h)&&u[h]===void 0&&o(h,()=>s[h])};for(var p in s)f(p)}};var u={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),e&&e("import",function(s,c,f){f||o(s,c)}),i},{isClass:!0});var yx={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 R2={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var L2={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 U2={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 V2={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var $2={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var q2={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 z2={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 H2={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var G2={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var W2={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 bx={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 j2={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};var Z2={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var J2={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};var Y2={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var X2={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var Q2={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var K2={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};var eF={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};var tF={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};var rF={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};var nF={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};var iF={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};var aF={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var oF={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};var sF={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};var uF={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};var lF={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};var cF={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};var fF={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};var pF={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]};var mF={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]};var dF={name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]};var hF={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]};var gF={name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]};var vF={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};var yF={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};var bF={name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]};var xF={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};var wF={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};var _F={name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]};var AF={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]};var SF={name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]};var EF={name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]};var DF={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};var NF={name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]};var CF={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]};var MF={name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]};var TF={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var FF={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};var IF={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};var BF={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var PF={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};var OF={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};var kF={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};var RF={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};var LF={name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};var UF={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};var VF={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};var $F={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};var qF={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var zF={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var HF={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};var GF={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var WF={name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax \u2263 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]};var jF={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};var ZF={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};var JF={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};var YF={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};var XF={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};var QF={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};var KF={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};var eI={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};var tI={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};var rI={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};var nI={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};var iI={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]};var aI={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};var oI={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};var sI={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]};var uI={name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]};var lI={name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]};var cI={name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]};var fI={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};var pI={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};var mI={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};var dI={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var hI={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};var gI={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var vI={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};var yI={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};var bI={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};var xI={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};var wI={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};var _I={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};var AI={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};var SI={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};var EI={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};var DI={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};var NI={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};var CI={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};var MI={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};var TI={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};var FI={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:[]};var II={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};var BI={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};var PI={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};var OI={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};var kI={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};var RI={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};var LI={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};var UI={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]};var VI={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var $I={name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]};var qI={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};var zI={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var HI={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var GI={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var WI={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var jI={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};var ZI={name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]};var JI={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};var YI={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};var XI={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]};var QI={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]};var KI={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var eB={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};var tB={name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore\u2013Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]};var rB={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};var nB={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var iB={name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]};var aB={name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]};var oB={name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]};var sB={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};var uB={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]};var lB={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};var cB={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]};var fB={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};var pB={name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]};var mB={name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]};var dB={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]};var hB={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};var gB={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};var vB={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};var yB={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};var bB={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};var xB={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};var wB={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};var _B={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var AB={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var SB={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]};var EB={name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]};var DB={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]};var NB={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};var CB={name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]};var MB={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};var TB={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};var FB={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]};var IB={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};var BB={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};var PB={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};var OB={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};var kB={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};var RB={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};var LB={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};var UB={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};var VB={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};var $B={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};var qB={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};var zB={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};var HB={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};var GB={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};var WB={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};var jB={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};var ZB={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};var JB={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};var YB={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};var XB={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};var QB={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};var KB={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};var eP={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};var tP={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};var rP={name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]};var nP={name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]};var iP={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};var aP={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var oP={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};var sP={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]};var uP={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]};var lP={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]};var cP={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]};var fP={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]};var pP={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]};var mP={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber.
In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,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 dP={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 hP={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 gP={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 vP={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 yP={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 bP={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 xP={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 wP={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 _P={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent 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 AP={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 SP={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var EP={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 DP={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var NP={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};var CP={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};var MP={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};var TP={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};var FP={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};var IP={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};var BP={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};var PP={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};var OP={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};var kP={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};var RP={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};var LP={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};var UP={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};var VP={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};var $P={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var qP={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};var zP={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};var HP={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};var GP={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var WP={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};var jP={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};var ZP={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};var JP={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var YP={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var XP={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};var QP={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};var KP={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};var eO={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var tO={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};var rO={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};var nO={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var iO={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var aO={name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]};var oO={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]};var sO={name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]};var uO={bignumber:Q2,boolean:K2,complex:eF,createUnit:tF,fraction:rF,index:nF,matrix:iF,number:aF,sparse:oF,splitUnit:sF,string:uF,unit:lF,e:yx,E:yx,false:R2,i:L2,Infinity:U2,LN2:$2,LN10:V2,LOG2E:z2,LOG10E:q2,NaN:H2,null:G2,pi:bx,PI:bx,phi:W2,SQRT1_2:j2,SQRT2:Z2,tau:J2,true:Y2,version:X2,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:mF,lsolve:hF,lsolveAll:gF,lup:vF,lusolve:yF,leafCount:dF,polynomialRoot:bF,resolve:_F,simplify:AF,simplifyConstant:SF,simplifyCore:EF,symbolicEqual:NF,rationalize:wF,slu:DF,usolve:CF,usolveAll:MF,qr:xF,abs:TF,add:FF,cbrt:IF,ceil:BF,cube:PF,divide:OF,dotDivide:kF,dotMultiply:RF,dotPow:LF,exp:UF,expm:VF,expm1:$F,fix:qF,floor:zF,gcd:HF,hypot:GF,lcm:jF,log:ZF,log2:XF,log1p:YF,log10:JF,mod:QF,multiply:KF,norm:eI,nthRoot:tI,nthRoots:rI,pow:nI,round:iI,sign:aI,sqrt:oI,sqrtm:sI,square:fI,subtract:pI,unaryMinus:mI,unaryPlus:dI,xgcd:hI,invmod:WF,bitAnd:gI,bitNot:vI,bitOr:yI,bitXor:bI,leftShift:xI,rightArithShift:wI,rightLogShift:_I,bellNumbers:AI,catalan:SI,composition:EI,stirlingS2:DI,config:cF,import:fF,typed:pF,arg:NI,conj:CI,re:TI,im:MI,evaluate:FI,help:II,distance:BI,intersect:PI,and:OI,not:kI,or:RI,xor:LI,concat:VI,count:$I,cross:qI,column:UI,ctranspose:zI,det:HI,diag:GI,diff:WI,dot:jI,getMatrixDataType:QI,identity:KI,filter:JI,flatten:YI,forEach:XI,inv:eB,pinv:tB,eigs:ZI,kron:rB,matrixFromFunction:aB,matrixFromRows:oB,matrixFromColumns:iB,map:nB,ones:sB,partitionSelect:uB,range:lB,resize:fB,reshape:cB,rotate:pB,rotationMatrix:mB,row:dB,size:hB,sort:gB,squeeze:vB,subset:yB,trace:bB,transpose:xB,zeros:wB,fft:_B,ifft:AB,sylvester:uI,schur:lI,lyap:cI,solveODE:sO,combinations:SB,combinationsWithRep:EB,factorial:DB,gamma:NB,kldivergence:MB,lgamma:CB,multinomial:TB,permutations:FB,pickRandom:IB,random:BB,randomInt:PB,compare:OB,compareNatural:kB,compareText:RB,deepEqual:LB,equal:UB,equalText:VB,larger:$B,largerEq:qB,smaller:zB,smallerEq:HB,unequal:GB,setCartesian:WB,setDifference:jB,setDistinct:ZB,setIntersect:JB,setIsSubset:YB,setMultiplicity:XB,setPowerset:QB,setSize:KB,setSymDifference:eP,setUnion:tP,zpk2tf:rP,freqz:nP,erf:iP,zeta:aP,cumsum:hP,mad:oP,max:sP,mean:uP,median:lP,min:cP,mode:fP,prod:pP,quantileSeq:mP,std:dP,sum:gP,variance:vP,corr:yP,acos:bP,acosh:xP,acot:wP,acoth:_P,acsc:AP,acsch:SP,asec:EP,asech:DP,asin:NP,asinh:CP,atan:MP,atanh:FP,atan2:TP,cos:IP,cosh:BP,cot:PP,coth:OP,csc:kP,csch:RP,sec:LP,sech:UP,sin:VP,sinh:$P,tan:qP,tanh:zP,to:HP,clone:WP,format:jP,bin:GP,oct:iO,hex:JP,isNaN:XP,isInteger:YP,isNegative:QP,isNumeric:KP,hasNumericValue:ZP,isPositive:eO,isPrime:tO,isZero:rO,print:aO,typeOf:oO,numeric:nO};var lO="help",HZ=["typed","mathWithTransform","Help"],xx=N(lO,HZ,r=>{var{typed:e,mathWithTransform:t,Help:n}=r;return e(lO,{any:function(a){var o,l=a;if(typeof a!="string"){for(o in t)if(Ze(t,o)&&a===t[o]){l=o;break}}var u=br(uO,l);if(!u){var s=typeof l=="function"?l.name:l;throw new Error('No documentation found on "'+s+'"')}return new n(u)}})});var cO="chain",GZ=["typed","Chain"],wx=N(cO,GZ,r=>{var{typed:e,Chain:t}=r;return e(cO,{"":function(){return new t},any:function(i){return new t(i)}})});var fO="det",WZ=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],_x=N(fO,WZ,r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:l}=r;return e(fO,{any:function(c){return et(c)},"Array | Matrix":function(c){var f;switch(Ge(c)?f=c.size():Array.isArray(c)?(c=t(c),f=c.size()):f=[],f.length){case 0:return et(c);case 1:if(f[0]===1)return et(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+at(f)+")");case 2:{var p=f[0],m=f[1];if(p===m)return u(c.clone().valueOf(),p,m);if(m===0)return 1;throw new RangeError("Matrix must be square (size: "+at(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(f)+")")}}});function u(s,c,f){if(c===1)return et(s[0][0]);if(c===2)return n(i(s[0][0],s[1][1]),i(s[1][0],s[0][1]));for(var p=!1,m=new Array(c).fill(0).map((E,D)=>D),h=0;h<c;h++){var d=m[h];if(o(s[d][h])){var g=void 0;for(g=h+1;g<c;g++)if(!o(s[m[g]][h])){d=m[g],m[g]=m[h],m[h]=d,p=!p;break}if(g===c)return s[d][h]}for(var v=s[d][h],w=h===0?1:s[m[h-1]][h-1],y=h+1;y<c;y++)for(var x=m[y],_=h+1;_<c;_++)s[x][_]=a(n(i(s[x][_],v),i(s[x][h],s[d][_])),w)}var b=s[m[c-1]][c-1];return p?l(b):b}});var pO="inv",jZ=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Ax=N(pO,jZ,r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:l,identity:u,abs:s}=r;return e(pO,{"Array | Matrix":function(p){var m=Ge(p)?p.size():nt(p);switch(m.length){case 1:if(m[0]===1)return Ge(p)?t([n(1,p.valueOf()[0])]):[n(1,p[0])];throw new RangeError("Matrix must be square (size: "+at(m)+")");case 2:{var h=m[0],d=m[1];if(h===d)return Ge(p)?t(c(p.valueOf(),h,d),p.storage()):c(p,h,d);throw new RangeError("Matrix must be square (size: "+at(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+at(m)+")")}},any:function(p){return n(1,p)}});function c(f,p,m){var h,d,g,v,w;if(p===1){if(v=f[0][0],v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,v)]]}else if(p===2){var y=l(f);if(y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],y),n(o(f[0][1]),y)],[n(o(f[1][0]),y),n(f[0][0],y)]]}else{var x=f.concat();for(h=0;h<p;h++)x[h]=x[h].concat();for(var _=u(p).valueOf(),b=0;b<m;b++){var E=s(x[b][b]),D=b;for(h=b+1;h<p;)s(x[h][b])>E&&(E=s(x[h][b]),D=h),h++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");h=D,h!==b&&(w=x[b],x[b]=x[h],x[h]=w,w=_[b],_[b]=_[h],_[h]=w);var A=x[b],S=_[b];for(h=0;h<p;h++){var M=x[h],F=_[h];if(h!==b){if(M[b]!==0){for(g=n(o(M[b]),A[b]),d=b;d<m;d++)M[d]=i(M[d],a(g,A[d]));for(d=0;d<m;d++)F[d]=i(F[d],a(g,S[d]))}}else{for(g=A[b],d=b;d<m;d++)M[d]=n(M[d],g);for(d=0;d<m;d++)F[d]=n(F[d],g)}}}return _}}});var mO="pinv",ZZ=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Sx=N(mO,ZZ,r=>{var{typed:e,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:l,ctranspose:u,divideScalar:s,multiply:c,add:f,Complex:p}=r;return e(mO,{"Array | Matrix":function(y){var x=Ge(y)?y.size():nt(y);switch(x.length){case 1:return v(y)?u(y):x[0]===1?n(y):o(u(y),l(y,y));case 2:{if(v(y))return u(y);var _=x[0],b=x[1];if(_===b)try{return n(y)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return Ge(y)?t(m(y.valueOf(),_,b),y.storage()):m(y,_,b)}default:throw new RangeError("Matrix must be two dimensional (size: "+at(x)+")")}},any:function(y){return a(y,0)?et(y):s(1,y)}});function m(w,y,x){var{C:_,F:b}=d(w,y,x),E=c(n(c(u(_),_)),u(_)),D=c(u(b),n(c(b,u(b))));return c(D,E)}function h(w,y,x){for(var _=et(w),b=0,E=0;E<y;E++){if(x<=b)return _;for(var D=E;g(_[D][b]);)if(D++,y===D&&(D=E,b++,x===b))return _;[_[D],_[E]]=[_[E],_[D]];for(var A=_[E][b],S=0;S<x;S++)_[E][S]=o(_[E][S],A);for(var M=0;M<y;M++)if(M!==E){A=_[M][b];for(var F=0;F<x;F++)_[M][F]=f(_[M][F],c(-1,c(A,_[E][F])))}b++}return _}function d(w,y,x){var _=h(w,y,x),b=w.map((D,A)=>D.filter((S,M)=>M<y&&!g(l(_[M],_[M])))),E=_.filter((D,A)=>!g(l(_[A],_[A])));return{C:b,F:E}}function g(w){return a(f(w,p(1,1)),f(0,p(1,1)))}function v(w){return i(f(w,p(1,1)),f(c(w,0),p(1,1)))}});function dO(r){var{addScalar:e,subtract:t,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:l,abs:u,bignumber:s,diag:c,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:v,complex:w,larger:y,smaller:x,matrixFromColumns:_,dot:b}=r;function E(H,L,ae,ve){var se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,le=D(H,L,ae,ve,se);A(H,L,ae,ve,se,le);var{values:he,C:K}=S(H,L,ae,ve,se);if(se){var ne=M(H,L,K,le,he,ae,ve);return{values:he,eigenvectors:ne}}return{values:he}}function D(H,L,ae,ve,se){var le=ve==="BigNumber",he=ve==="Complex",K=le?s(0):0,ne=le?s(1):he?w(1):1,me=le?s(1):1,de=le?s(10):2,Oe=a(de,de),Se;se&&(Se=Array(L).fill(ne));for(var V=!1;!V;){V=!0;for(var X=0;X<L;X++){for(var fe=K,W=K,te=0;te<L;te++)X!==te&&(fe=e(fe,u(H[te][X])),W=e(W,u(H[X][te])));if(!v(fe,0)&&!v(W,0)){for(var ie=me,ge=fe,ye=o(W,de),qe=a(W,de);x(ge,ye);)ge=a(ge,Oe),ie=a(ie,de);for(;y(ge,qe);)ge=o(ge,Oe),ie=o(ie,de);var De=x(o(e(ge,W),ie),a(e(fe,W),.95));if(De){V=!1;for(var ft=o(1,ie),wt=0;wt<L;wt++)X!==wt&&(H[X][wt]=a(H[X][wt],ft),H[wt][X]=a(H[wt][X],ie));se&&(Se[X]=a(Se[X],ft))}}}}return se?c(Se):null}function A(H,L,ae,ve,se,le){var he=ve==="BigNumber",K=ve==="Complex",ne=he?s(0):K?w(0):0;he&&(ae=s(ae));for(var me=0;me<L-2;me++){for(var de=0,Oe=ne,Se=me+1;Se<L;Se++){var V=H[Se][me];x(u(Oe),u(V))&&(Oe=V,de=Se)}if(!x(u(Oe),ae)){if(de!==me+1){var X=H[de];H[de]=H[me+1],H[me+1]=X;for(var fe=0;fe<L;fe++){var W=H[fe][de];H[fe][de]=H[fe][me+1],H[fe][me+1]=W}if(se){var te=le[de];le[de]=le[me+1],le[me+1]=te}}for(var ie=me+2;ie<L;ie++){var ge=o(H[ie][me],Oe);if(ge!==0){for(var ye=0;ye<L;ye++)H[ie][ye]=t(H[ie][ye],a(ge,H[me+1][ye]));for(var qe=0;qe<L;qe++)H[qe][me+1]=e(H[qe][me+1],a(ge,H[qe][ie]));if(se)for(var De=0;De<L;De++)le[ie][De]=t(le[ie][De],a(ge,le[me+1][De]))}}}}return le}function S(H,L,ae,ve,se){var le=ve==="BigNumber",he=ve==="Complex",K=le?s(1):he?w(1):1;le&&(ae=s(ae));for(var ne=et(H),me=[],de=L,Oe=[],Se=se?c(Array(L).fill(K)):void 0,V=se?c(Array(de).fill(K)):void 0,X=0;X<=100;){X+=1;for(var fe=ne[de-1][de-1],W=0;W<de;W++)ne[W][W]=t(ne[W][W],fe);var{Q:te,R:ie}=h(ne);ne=i(ie,te);for(var ge=0;ge<de;ge++)ne[ge][ge]=e(ne[ge][ge],fe);if(se&&(V=i(V,te)),de===1||x(u(ne[de-1][de-2]),ae)){X=0,me.push(ne[de-1][de-1]),se&&(Oe.unshift([[1]]),R(V,L),Se=i(Se,V),de>1&&(V=c(Array(de-1).fill(K)))),de-=1,ne.pop();for(var ye=0;ye<de;ye++)ne[ye].pop()}else if(de===2||x(u(ne[de-2][de-3]),ae)){X=0;var qe=F(ne[de-2][de-2],ne[de-2][de-1],ne[de-1][de-2],ne[de-1][de-1]);me.push(...qe),se&&(Oe.unshift(P(ne[de-2][de-2],ne[de-2][de-1],ne[de-1][de-2],ne[de-1][de-1],qe[0],qe[1],ae,ve)),R(V,L),Se=i(Se,V),de>2&&(V=c(Array(de-2).fill(K)))),de-=2,ne.pop(),ne.pop();for(var De=0;De<de;De++)ne[De].pop(),ne[De].pop()}if(de===0)break}if(me.sort((jt,nr)=>+t(u(jt),u(nr))),X>100){var ft=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+me.join(", "));throw ft.values=me,ft.vectors=[],ft}var wt=se?i(Se,O(Oe,L)):void 0;return{values:me,C:wt}}function M(H,L,ae,ve,se,le,he){var K=m(ae),ne=i(K,H,ae),me=he==="BigNumber",de=he==="Complex",Oe=me?s(0):de?w(0):0,Se=me?s(1):de?w(1):1,V=[],X=[];for(var fe of se){var W=I(V,fe,v);W===-1?(V.push(fe),X.push(1)):X[W]+=1}for(var te=[],ie=V.length,ge=Array(L).fill(Oe),ye=c(Array(L).fill(Se)),qe=function(){var wt=V[De],jt=t(ne,i(wt,ye)),nr=g(jt,ge);for(nr.shift();nr.length<X[De];){var Y=T(jt,L,nr,le,he);if(Y===null)break;nr.push(Y)}var oe=i(m(ve),ae);nr=nr.map(pe=>i(oe,pe)),te.push(...nr.map(pe=>({value:wt,vector:n(pe)})))},De=0;De<ie;De++)qe();return te}function F(H,L,ae,ve){var se=e(H,ve),le=t(a(H,ve),a(L,ae)),he=a(se,.5),K=a(l(t(a(se,se),a(4,le))),.5);return[e(he,K),t(he,K)]}function P(H,L,ae,ve,se,le,he,K){var ne=K==="BigNumber",me=K==="Complex",de=ne?s(0):me?w(0):0,Oe=ne?s(1):me?w(1):1;if(x(u(ae),he))return[[Oe,de],[de,Oe]];if(y(u(t(se,le)),he))return[[t(se,ve),t(le,ve)],[ae,ae]];var Se=t(H,se),V=t(ve,se);return x(u(L),he)&&x(u(V),he)?[[Se,Oe],[ae,de]]:[[L,de],[V,Oe]]}function R(H,L){for(var ae=0;ae<H.length;ae++)H[ae].push(...Array(L-H[ae].length).fill(0));for(var ve=H.length;ve<L;ve++)H.push(Array(L).fill(0)),H[ve][ve]=1;return H}function O(H,L){for(var ae=[],ve=0;ve<L;ve++)ae[ve]=Array(L).fill(0);var se=0;for(var le of H){for(var he=le.length,K=0;K<he;K++)for(var ne=0;ne<he;ne++)ae[se+K][se+ne]=le[K][ne];se+=he}return ae}function I(H,L,ae){for(var ve=0;ve<H.length;ve++)if(ae(H[ve],L))return ve;return-1}function T(H,L,ae,ve,se){for(var le=se==="BigNumber"?s(1e3):1e3,he,K=0;K<5;++K){he=$(L,ae,se);try{he=d(H,he)}catch(me){continue}if(y(U(he),le))break}if(K>=5)return null;for(K=0;;){var ne=d(H,he);if(x(U(B(he,[ne])),ve))break;if(++K>=10)return null;he=G(ne)}return he}function $(H,L,ae){var ve=ae==="BigNumber",se=ae==="Complex",le=Array(H).fill(0).map(he=>2*Math.random()-1);return ve&&(le=le.map(he=>s(he))),se&&(le=le.map(he=>w(he))),le=B(le,L),G(le,ae)}function B(H,L){var ae=f(H);for(var ve of L)ve=p(ve,ae),H=t(H,i(o(b(ve,H),b(ve,ve)),ve));return H}function U(H){return u(l(b(H,H)))}function G(H,L){var ae=L==="BigNumber",ve=L==="Complex",se=ae?s(1):ve?w(1):1;return i(o(se,U(H)),H)}return E}function hO(r){var{config:e,addScalar:t,subtract:n,abs:i,atan:a,cos:o,sin:l,multiplyScalar:u,inv:s,bignumber:c,multiply:f,add:p}=r;function m(A,S){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,F=arguments.length>3?arguments[3]:void 0,P=arguments.length>4?arguments[4]:void 0;if(F==="number")return h(A,M,P);if(F==="BigNumber")return d(A,M,P);throw TypeError("Unsupported data type: "+F)}function h(A,S,M){var F=A.length,P=Math.abs(S/F),R,O;if(M){O=new Array(F);for(var I=0;I<F;I++)O[I]=Array(F).fill(0),O[I][I]=1}for(var T=b(A);Math.abs(T[1])>=Math.abs(P);){var $=T[0][0],B=T[0][1];R=g(A[$][$],A[B][B],A[$][B]),A=_(A,R,$,B),M&&(O=w(O,R,$,B)),T=b(A)}for(var U=Array(F).fill(0),G=0;G<F;G++)U[G]=A[G][G];return D(et(U),O,M)}function d(A,S,M){var F=A.length,P=i(S/F),R,O;if(M){O=new Array(F);for(var I=0;I<F;I++)O[I]=Array(F).fill(0),O[I][I]=1}for(var T=E(A);i(T[1])>=i(P);){var $=T[0][0],B=T[0][1];R=v(A[$][$],A[B][B],A[$][B]),A=x(A,R,$,B),M&&(O=y(O,R,$,B)),T=E(A)}for(var U=Array(F).fill(0),G=0;G<F;G++)U[G]=A[G][G];return D(et(U),O,M)}function g(A,S,M){var F=S-A;return Math.abs(F)<=e.epsilon?Math.PI/4:.5*Math.atan(2*M/(S-A))}function v(A,S,M){var F=n(S,A);return i(F)<=e.epsilon?c(-1).acos().div(4):u(.5,a(f(2,M,s(F))))}function w(A,S,M,F){for(var P=A.length,R=Math.cos(S),O=Math.sin(S),I=Array(P).fill(0),T=Array(P).fill(0),$=0;$<P;$++)I[$]=R*A[$][M]-O*A[$][F],T[$]=O*A[$][M]+R*A[$][F];for(var B=0;B<P;B++)A[B][M]=I[B],A[B][F]=T[B];return A}function y(A,S,M,F){for(var P=A.length,R=o(S),O=l(S),I=Array(P).fill(c(0)),T=Array(P).fill(c(0)),$=0;$<P;$++)I[$]=n(u(R,A[$][M]),u(O,A[$][F])),T[$]=t(u(O,A[$][M]),u(R,A[$][F]));for(var B=0;B<P;B++)A[B][M]=I[B],A[B][F]=T[B];return A}function x(A,S,M,F){for(var P=A.length,R=c(o(S)),O=c(l(S)),I=u(R,R),T=u(O,O),$=Array(P).fill(c(0)),B=Array(P).fill(c(0)),U=f(c(2),R,O,A[M][F]),G=t(n(u(I,A[M][M]),U),u(T,A[F][F])),H=p(u(T,A[M][M]),U,u(I,A[F][F])),L=0;L<P;L++)$[L]=n(u(R,A[M][L]),u(O,A[F][L])),B[L]=t(u(O,A[M][L]),u(R,A[F][L]));A[M][M]=G,A[F][F]=H,A[M][F]=c(0),A[F][M]=c(0);for(var ae=0;ae<P;ae++)ae!==M&&ae!==F&&(A[M][ae]=$[ae],A[ae][M]=$[ae],A[F][ae]=B[ae],A[ae][F]=B[ae]);return A}function _(A,S,M,F){for(var P=A.length,R=Math.cos(S),O=Math.sin(S),I=R*R,T=O*O,$=Array(P).fill(0),B=Array(P).fill(0),U=I*A[M][M]-2*R*O*A[M][F]+T*A[F][F],G=T*A[M][M]+2*R*O*A[M][F]+I*A[F][F],H=0;H<P;H++)$[H]=R*A[M][H]-O*A[F][H],B[H]=O*A[M][H]+R*A[F][H];A[M][M]=U,A[F][F]=G,A[M][F]=0,A[F][M]=0;for(var L=0;L<P;L++)L!==M&&L!==F&&(A[M][L]=$[L],A[L][M]=$[L],A[F][L]=B[L],A[L][F]=B[L]);return A}function b(A){for(var S=A.length,M=0,F=[0,1],P=0;P<S;P++)for(var R=P+1;R<S;R++)Math.abs(M)<Math.abs(A[P][R])&&(M=Math.abs(A[P][R]),F=[P,R]);return[F,M]}function E(A){for(var S=A.length,M=0,F=[0,1],P=0;P<S;P++)for(var R=P+1;R<S;R++)i(M)<i(A[P][R])&&(M=i(A[P][R]),F=[P,R]);return[F,M]}function D(A,S,M){var F=A.length,P=Array(F),R;if(M){R=Array(F);for(var O=0;O<F;O++)R[O]=Array(F)}for(var I=0;I<F;I++){for(var T=0,$=A[0],B=0;B<A.length;B++)i(A[B])<i($)&&(T=B,$=A[T]);if(P[I]=A.splice(T,1)[0],M)for(var U=0;U<F;U++)R[I][U]=S[U][T],S[U].splice(T,1)}if(!M)return{values:P};var G=R.map((H,L)=>({value:P[L],vector:H}));return{values:P,eigenvectors:G}}return m}var JZ="eigs",YZ=["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],Ex=N(JZ,YZ,r=>{var{config:e,typed:t,matrix:n,addScalar:i,subtract:a,equal:o,abs:l,atan:u,cos:s,sin:c,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:d,add:g,larger:v,column:w,flatten:y,number:x,complex:_,sqrt:b,diag:E,size:D,reshape:A,qr:S,usolve:M,usolveAll:F,im:P,re:R,smaller:O,matrixFromColumns:I,dot:T}=r,$=hO({config:e,addScalar:i,subtract:a,column:w,flatten:y,equal:o,abs:l,atan:u,cos:s,sin:c,multiplyScalar:f,inv:m,bignumber:h,complex:_,multiply:d,add:g}),B=dO({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:y,divideScalar:p,sqrt:b,abs:l,bignumber:h,diag:E,size:D,reshape:A,qr:S,inv:m,usolve:M,usolveAll:F,equal:o,complex:_,larger:v,smaller:O,matrixFromColumns:I,dot:T});return t("eigs",{Array:function(le){return U(n(le))},"Array, number|BigNumber":function(le,he){return U(n(le),{precision:he})},"Array, Object"(se,le){return U(n(se),le)},Matrix:function(le){return U(le,{matricize:!0})},"Matrix, number|BigNumber":function(le,he){return U(le,{precision:he,matricize:!0})},"Matrix, Object":function(le,he){var K={matricize:!0};return yr(K,he),U(le,K)}});function U(se){var le,he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K="eigenvectors"in he?he.eigenvectors:!0,ne=(le=he.precision)!==null&&le!==void 0?le:e.epsilon,me=G(se,ne,K);return he.matricize&&(me.values=n(me.values),K&&(me.eigenvectors=me.eigenvectors.map(de=>{var{value:Oe,vector:Se}=de;return{value:Oe,vector:n(Se)}}))),K&&Object.defineProperty(me,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),me}function G(se,le,he){var K=se.toArray(),ne=se.size();if(ne.length!==2||ne[0]!==ne[1])throw new RangeError("Matrix must be square (size: ".concat(at(ne),")"));var me=ne[0];if(L(K,me,le)&&(ae(K,me),H(K,me,le))){var de=ve(se,K,me);return $(K,me,le,de,he)}var Oe=ve(se,K,me);return B(K,me,le,Oe,he)}function H(se,le,he){for(var K=0;K<le;K++)for(var ne=K;ne<le;ne++)if(v(h(l(a(se[K][ne],se[ne][K]))),he))return!1;return!0}function L(se,le,he){for(var K=0;K<le;K++)for(var ne=0;ne<le;ne++)if(v(h(l(P(se[K][ne]))),he))return!1;return!0}function ae(se,le){for(var he=0;he<le;he++)for(var K=0;K<le;K++)se[he][K]=R(se[he][K])}function ve(se,le,he){var K=se.datatype();if(K==="number"||K==="BigNumber"||K==="Complex")return K;for(var ne=!1,me=!1,de=!1,Oe=0;Oe<he;Oe++)for(var Se=0;Se<he;Se++){var V=le[Oe][Se];if(it(V)||va(V))ne=!0;else if(Xe(V))me=!0;else if(Mn(V))de=!0;else throw TypeError("Unsupported type in Matrix: "+Mt(V))}if(me&&de&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),de){for(var X=0;X<he;X++)for(var fe=0;fe<he;fe++)le[X][fe]=_(le[X][fe]);return"Complex"}if(me){for(var W=0;W<he;W++)for(var te=0;te<he;te++)le[W][te]=h(le[W][te]);return"BigNumber"}if(ne){for(var ie=0;ie<he;ie++)for(var ge=0;ge<he;ge++)le[ie][ge]=x(le[ie][ge]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var gO="expm",XZ=["typed","abs","add","identity","inv","multiply"],Dx=N(gO,XZ,r=>{var{typed:e,abs:t,add:n,identity:i,inv:a,multiply:o}=r;return e(gO,{Matrix:function(f){var p=f.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+at(p)+")");for(var m=p[0],h=1e-15,d=l(f),g=u(d,h),v=g.q,w=g.j,y=o(f,Math.pow(2,-w)),x=i(m),_=i(m),b=1,E=y,D=-1,A=1;A<=v;A++)A>1&&(E=o(E,y),D=-D),b=b*(v-A+1)/((2*v-A+1)*A),x=n(x,o(b,E)),_=n(_,o(b*D,E));for(var S=o(a(_),x),M=0;M<w;M++)S=o(S,S);return Ri(f)?f.createSparseMatrix(S):S}});function l(c){for(var f=c.size()[0],p=0,m=0;m<f;m++){for(var h=0,d=0;d<f;d++)h+=t(c.get([m,d]));p=Math.max(h,p)}return p}function u(c,f){for(var p=30,m=0;m<p;m++)for(var h=0;h<=m;h++){var d=m-h;if(s(c,h,d)<f)return{q:h,j:d}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function s(c,f,p){for(var m=1,h=2;h<=f;h++)m*=h;for(var d=m,g=f+1;g<=2*f;g++)d*=g;var v=d*(2*f+1);return 8*Math.pow(c/Math.pow(2,p),2*f)*m*m/(d*v)}});var vO="sqrtm",QZ=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],Nx=N(vO,QZ,r=>{var{typed:e,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:l,inv:u,size:s,max:c,identity:f}=r,p=1e3,m=1e-6;function h(d){var g,v=0,w=d,y=f(s(d));do{var x=w;if(w=i(.5,n(x,u(y))),y=i(.5,n(y,u(x))),g=c(t(l(w,x))),g>m&&++v>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>m);return w}return e(vO,{"Array | Matrix":function(g){var v=Ge(g)?g.size():nt(g);switch(v.length){case 1:if(v[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+at(v)+")");case 2:{var w=v[0],y=v[1];if(w===y)return h(g);throw new RangeError("Matrix must be square (size: "+at(v)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+at(v)+")")}}})});var yO="sylvester",KZ=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],Cx=N(yO,KZ,r=>{var{typed:e,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:l,transpose:u,index:s,subset:c,add:f,subtract:p,identity:m,lusolve:h,abs:d}=r;return e(yO,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(w,y,x){return g(i(w),y,x)},"Array, Array, Matrix":function(w,y,x){return g(i(w),i(y),x)},"Array, Matrix, Array":function(w,y,x){return g(i(w),y,i(x))},"Matrix, Array, Matrix":function(w,y,x){return g(w,i(y),x)},"Matrix, Array, Array":function(w,y,x){return g(w,i(y),i(x))},"Matrix, Matrix, Array":function(w,y,x){return g(w,y,i(x))},"Array, Array, Array":function(w,y,x){return g(i(w),i(y),i(x)).toArray()}});function g(v,w,y){for(var x=w.size()[0],_=v.size()[0],b=t(v),E=b.T,D=b.U,A=t(a(-1,w)),S=A.T,M=A.U,F=a(a(u(D),y),M),P=o(0,_),R=[],O=(de,Oe)=>l(de,Oe,1),I=(de,Oe)=>l(de,Oe,0),T=0;T<x;T++)if(T<x-1&&d(c(S,s(T+1,T)))>1e-5){for(var $=I(c(F,s(P,T)),c(F,s(P,T+1))),B=0;B<T;B++)$=f($,I(a(R[B],c(S,s(B,T))),a(R[B],c(S,s(B,T+1)))));var U=a(m(_),a(-1,c(S,s(T,T)))),G=a(m(_),a(-1,c(S,s(T+1,T)))),H=a(m(_),a(-1,c(S,s(T,T+1)))),L=a(m(_),a(-1,c(S,s(T+1,T+1)))),ae=I(O(f(E,U),G),O(H,f(E,L))),ve=h(ae,$);R[T]=ve.subset(s(o(0,_),0)),R[T+1]=ve.subset(s(o(_,2*_),0)),T++}else{for(var se=c(F,s(P,T)),le=0;le<T;le++)se=f(se,a(R[le],c(S,s(le,T))));var he=c(S,s(T,T)),K=p(E,a(he,m(_)));R[T]=h(K,se)}var ne=i(n(...R)),me=a(D,a(ne,u(M)));return me}});var bO="schur",eJ=["typed","matrix","identity","multiply","qr","norm","subtract"],Mx=N(bO,eJ,r=>{var{typed:e,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:l}=r;return e(bO,{Array:function(c){var f=u(t(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return u(c)}});function u(s){var c=s.size()[0],f=s,p=n(c),m=0,h;do{h=f;var d=a(f),g=d.Q,v=d.R;if(f=i(v,g),p=i(p,g),m++>100)break}while(o(l(f,h))>1e-4);return{U:p,T:f}}});var xO="lyap",tJ=["typed","matrix","sylvester","multiply","transpose"],Tx=N(xO,tJ,r=>{var{typed:e,matrix:t,sylvester:n,multiply:i,transpose:a}=r;return e(xO,{"Matrix, Matrix":function(l,u){return n(l,a(l),i(-1,u))},"Array, Matrix":function(l,u){return n(t(l),a(t(l)),i(-1,u))},"Matrix, Array":function(l,u){return n(l,a(t(l)),t(i(-1,u)))},"Array, Array":function(l,u){return n(t(l),a(t(l)),t(i(-1,u))).toArray()}})});var rJ="divide",nJ=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Fx=N(rJ,nJ,r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=r,l=Yt({typed:e,equalScalar:i}),u=Or({typed:e});return e("divide",pp({"Array | Matrix, Array | Matrix":function(c,f){return n(c,o(f))},"DenseMatrix, any":function(c,f){return u(c,f,a,!1)},"SparseMatrix, any":function(c,f){return l(c,f,a,!1)},"Array, any":function(c,f){return u(t(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return n(c,o(f))}},a.signatures))});var wO="distance",iJ=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],Ix=N(wO,iJ,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:l,abs:u}=r;return e(wO,{"Array, Array, Array":function(_,b,E){if(_.length===2&&b.length===2&&E.length===2){if(!c(_))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(b))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(b,E))throw new TypeError("LinePoint1 should not be same with LinePoint2");var D=n(E[1],b[1]),A=n(b[0],E[0]),S=n(i(E[0],b[1]),i(b[0],E[1]));return g(_[0],_[1],D,A,S)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(_,b,E){if(Object.keys(_).length===2&&Object.keys(b).length===2&&Object.keys(E).length===2){if(!c(_))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(b))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(b),h(E)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in _&&"pointY"in _&&"lineOnePtX"in b&&"lineOnePtY"in b&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var D=n(E.lineTwoPtY,b.lineOnePtY),A=n(b.lineOnePtX,E.lineTwoPtX),S=n(i(E.lineTwoPtX,b.lineOnePtY),i(b.lineOnePtX,E.lineTwoPtY));return g(_.pointX,_.pointY,D,A,S)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(_,b){if(_.length===2&&b.length===3){if(!c(_))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(_[0],_[1],b[0],b[1],b[2])}else if(_.length===3&&b.length===6){if(!f(_))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(b))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return v(_[0],_[1],_[2],b[0],b[1],b[2],b[3],b[4],b[5])}else if(_.length===b.length&&_.length>0){if(!p(_))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(b))throw new TypeError("All values of an array should be numbers or BigNumbers");return w(_,b)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(_,b){if(Object.keys(_).length===2&&Object.keys(b).length===3){if(!c(_))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(b))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in _&&"pointY"in _&&"xCoeffLine"in b&&"yCoeffLine"in b&&"constant"in b)return g(_.pointX,_.pointY,b.xCoeffLine,b.yCoeffLine,b.constant);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(b).length===6){if(!f(_))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(b))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in _&&"pointY"in _&&"x0"in b&&"y0"in b&&"z0"in b&&"a"in b&&"b"in b&&"c"in b)return v(_.pointX,_.pointY,_.pointZ,b.x0,b.y0,b.z0,b.a,b.b,b.c);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===2&&Object.keys(b).length===2){if(!c(_))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(b))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in _&&"pointOneY"in _&&"pointTwoX"in b&&"pointTwoY"in b)return w([_.pointOneX,_.pointOneY],[b.pointTwoX,b.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(_).length===3&&Object.keys(b).length===3){if(!f(_))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(b))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in _&&"pointOneY"in _&&"pointOneZ"in _&&"pointTwoX"in b&&"pointTwoY"in b&&"pointTwoZ"in b)return w([_.pointOneX,_.pointOneY,_.pointOneZ],[b.pointTwoX,b.pointTwoY,b.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(_){if(!d(_))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return y(_)}});function s(x){return typeof x=="number"||Xe(x)}function c(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])}function f(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])&&s(x[2])}function p(x){return Array.isArray(x)||(x=h(x)),x.every(s)}function m(x){return x.constructor!==Array&&(x=h(x)),s(x[0])&&s(x[1])&&s(x[2])&&s(x[3])&&s(x[4])&&s(x[5])}function h(x){for(var _=Object.keys(x),b=[],E=0;E<_.length;E++)b.push(x[_[E]]);return b}function d(x){if(x[0].length===2&&s(x[0][0])&&s(x[0][1])){if(x.some(_=>_.length!==2||!s(_[0])||!s(_[1])))return!1}else if(x[0].length===3&&s(x[0][0])&&s(x[0][1])&&s(x[0][2])){if(x.some(_=>_.length!==3||!s(_[0])||!s(_[1])||!s(_[2])))return!1}else return!1;return!0}function g(x,_,b,E,D){var A=u(t(t(i(b,x),i(E,_)),D)),S=l(t(i(b,b),i(E,E)));return a(A,S)}function v(x,_,b,E,D,A,S,M,F){var P=[n(i(n(D,_),F),i(n(A,b),M)),n(i(n(A,b),S),i(n(E,x),F)),n(i(n(E,x),M),i(n(D,_),S))];P=l(t(t(i(P[0],P[0]),i(P[1],P[1])),i(P[2],P[2])));var R=l(t(t(i(S,S),i(M,M)),i(F,F)));return a(P,R)}function w(x,_){for(var b=x.length,E=0,D=0,A=0;A<b;A++)D=n(x[A],_[A]),E=t(i(D,D),E);return l(E)}function y(x){for(var _=[],b=[],E=[],D=0;D<x.length-1;D++)for(var A=D+1;A<x.length;A++)x[0].length===2?(b=[x[D][0],x[D][1]],E=[x[A][0],x[A][1]]):x[0].length===3&&(b=[x[D][0],x[D][1],x[D][2]],E=[x[A][0],x[A][1],x[A][2]]),_.push(w(b,E));return _}});var aJ="intersect",oJ=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],Bx=N(aJ,oJ,r=>{var{typed:e,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:l,multiplyScalar:u,divideScalar:s,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=r;return e("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":v,"Matrix, Matrix, Matrix":function(M,F,P){var R=g(M.valueOf(),F.valueOf(),P.valueOf());return R===null?null:o(R)},"Matrix, Matrix, Matrix, Matrix":function(M,F,P,R){var O=v(M.valueOf(),F.valueOf(),P.valueOf(),R.valueOf());return O===null?null:o(O)}});function g(S,M,F){if(S=w(S),M=w(M),F=w(F),!x(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!_(F))throw new TypeError("Array with 4 numbers expected as third argument");return A(S[0],S[1],S[2],M[0],M[1],M[2],F[0],F[1],F[2],F[3])}function v(S,M,F,P){if(S=w(S),M=w(M),F=w(F),P=w(P),S.length===2){if(!y(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!y(M))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!y(F))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!y(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return b(S,M,F,P)}else if(S.length===3){if(!x(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(M))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(F))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return D(S[0],S[1],S[2],M[0],M[1],M[2],F[0],F[1],F[2],P[0],P[1],P[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function w(S){return S.length===1?S[0]:S.length>1&&Array.isArray(S[0])&&S.every(M=>Array.isArray(M)&&M.length===1)?m(S):S}function y(S){return S.length===2&&d(S[0])&&d(S[1])}function x(S){return S.length===3&&d(S[0])&&d(S[1])&&d(S[2])}function _(S){return S.length===4&&d(S[0])&&d(S[1])&&d(S[2])&&d(S[3])}function b(S,M,F,P){var R=S,O=F,I=c(R,M),T=c(O,P),$=c(u(I[0],T[1]),u(T[0],I[1]));if(h($)||f(n($),t.epsilon))return null;var B=u(T[0],R[1]),U=u(T[1],R[0]),G=u(T[0],O[1]),H=u(T[1],O[0]),L=s(a(c(c(B,U),G),H),$);return i(l(I,L),R)}function E(S,M,F,P,R,O,I,T,$,B,U,G){var H=u(c(S,M),c(F,P)),L=u(c(R,O),c(I,T)),ae=u(c($,B),c(U,G));return a(a(H,L),ae)}function D(S,M,F,P,R,O,I,T,$,B,U,G){var H=E(S,I,B,I,M,T,U,T,F,$,G,$),L=E(B,I,P,S,U,T,R,M,G,$,O,F),ae=E(S,I,P,S,M,T,R,M,F,$,O,F),ve=E(B,I,B,I,U,T,U,T,G,$,G,$),se=E(P,S,P,S,R,M,R,M,O,F,O,F),le=c(u(H,L),u(ae,ve)),he=c(u(se,ve),u(L,L));if(h(he))return null;var K=s(le,he),ne=s(a(H,u(K,L)),ve),me=a(S,u(K,c(P,S))),de=a(M,u(K,c(R,M))),Oe=a(F,u(K,c(O,F))),Se=a(I,u(ne,c(B,I))),V=a(T,u(ne,c(U,T))),X=a($,u(ne,c(G,$)));return p(me,Se)&&p(de,V)&&p(Oe,X)?[me,de,Oe]:null}function A(S,M,F,P,R,O,I,T,$,B){var U=u(S,I),G=u(P,I),H=u(M,T),L=u(R,T),ae=u(F,$),ve=u(O,$),se=c(c(c(B,U),H),ae),le=c(c(c(a(a(G,L),ve),U),H),ae),he=s(se,le),K=a(S,u(he,c(P,S))),ne=a(M,u(he,c(R,M))),me=a(F,u(he,c(O,F)));return[K,ne,me]}});var _O="sum",sJ=["typed","config","add","numeric"],kl=N(_O,sJ,r=>{var{typed:e,config:t,add:n,numeric:i}=r;return e(_O,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(u){if(vi(u))throw new TypeError("Scalar values expected in function sum");return a(u)}});function a(l){var u;return bn(l,function(s){try{u=u===void 0?s:n(u,s)}catch(c){throw Er(c,"sum",s)}}),u===void 0&&(u=i(0,t.number)),typeof u=="string"&&(u=i(u,t.number)),u}function o(l,u){try{var s=oo(l,u,n);return s}catch(c){throw Er(c,"sum")}}});var vm="cumsum",uJ=["typed","add","unaryPlus"],Rl=N(vm,uJ,r=>{var{typed:e,add:t,unaryPlus:n}=r;return e(vm,{Array:i,Matrix:function(s){return s.create(i(s.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(s,c){return s.create(o(s.valueOf(),c))},"...":function(s){if(vi(s))throw new TypeError("All values expected to be scalar in function cumsum");return i(s)}});function i(u){try{return a(u)}catch(s){throw Er(s,vm)}}function a(u){if(u.length===0)return[];for(var s=[n(u[0])],c=1;c<u.length;++c)s.push(t(s[c-1],u[c]));return s}function o(u,s){var c=nt(u);if(s<0||s>=c.length)throw new pn(s,c.length);try{return l(u,s)}catch(f){throw Er(f,vm)}}function l(u,s){var c,f,p;if(s<=0){var m=u[0][0];if(Array.isArray(m)){for(p=Fp(u),f=[],c=0;c<p.length;c++)f[c]=l(p[c],s-1);return f}else return a(u)}else{for(f=[],c=0;c<u.length;c++)f[c]=l(u[c],s-1);return f}}});var AO="mean",lJ=["typed","add","divide"],Ll=N(AO,lJ,r=>{var{typed:e,add:t,divide:n}=r;return e(AO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(l){if(vi(l))throw new TypeError("Scalar values expected in function mean");return a(l)}});function i(o,l){try{var u=oo(o,l,t),s=Array.isArray(o)?nt(o):o.size();return n(u,s[l])}catch(c){throw Er(c,"mean")}}function a(o){var l,u=0;if(bn(o,function(s){try{l=l===void 0?s:t(l,s),u++}catch(c){throw Er(c,"mean",s)}}),u===0)throw new Error("Cannot calculate the mean of an empty array");return n(l,u)}});var SO="median",cJ=["typed","add","divide","compare","partitionSelect"],Px=N(SO,cJ,r=>{var{typed:e,add:t,divide:n,compare:i,partitionSelect:a}=r;function o(s){try{s=ht(s.valueOf());var c=s.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,p=a(s,f+1),m=s[f],h=0;h<f;++h)i(s[h],m)>0&&(m=s[h]);return u(m,p)}else{var d=a(s,(c-1)/2);return l(d)}}catch(g){throw Er(g,"median")}}var l=e({"number | BigNumber | Complex | Unit":function(c){return c}}),u=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return n(t(c,f),2)}});return e(SO,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(vi(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var EO="mad",fJ=["typed","abs","map","median","subtract"],Ox=N(EO,fJ,r=>{var{typed:e,abs:t,map:n,median:i,subtract:a}=r;return e(EO,{"Array | Matrix":o,"...":function(u){return o(u)}});function o(l){if(l=ht(l.valueOf()),l.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var u=i(l);return i(n(l,function(s){return t(a(s,u))}))}catch(s){throw s instanceof TypeError&&s.message.indexOf("median")!==-1?new TypeError(s.message.replace("median","mad")):Er(s,"mad")}}});var kx="unbiased",DO="variance",pJ=["typed","add","subtract","multiply","divide","apply","isNaN"],Ul=N(DO,pJ,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l}=r;return e(DO,{"Array | Matrix":function(f){return u(f,kx)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(f,p){return s(f,p,kx)},"Array | Matrix, number | BigNumber, string":s,"...":function(f){return u(f,kx)}});function u(c,f){var p,m=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(bn(c,function(g){try{p=p===void 0?g:t(p,g),m++}catch(v){throw Er(v,"variance",g)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var h=a(p,m);if(p=void 0,bn(c,function(g){var v=n(g,h);p=p===void 0?i(v,v):t(p,i(v,v))}),l(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var d=Xe(p)?p.mul(0):0;return m===1?d:a(p,m-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function s(c,f,p){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,m=>u(m,p))}catch(m){throw Er(m,"variance")}}});var NO="quantileSeq",mJ=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Vl=N(NO,mJ,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=r,m=as({typed:e,isInteger:s});return e(NO,{"Array | Matrix, number | BigNumber":(w,y)=>d(w,y,!1),"Array | Matrix, number | BigNumber, number":(w,y,x)=>h(w,y,!1,x,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(w,y,x,_)=>h(w,y,x,_,d),"Array | Matrix, Array | Matrix":(w,y)=>g(w,y,!1),"Array | Matrix, Array | Matrix, number":(w,y,x)=>h(w,y,!1,x,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(w,y,x,_)=>h(w,y,x,_,g)});function h(w,y,x,_,b){return m(w,_,E=>b(E,y,x))}function d(w,y,x){var _,b=w.valueOf();if(c(y,0))throw new Error("N/prob must be non-negative");if(f(y,1))return it(y)?v(b,y,x):t(v(b,y,x));if(p(y,1)){if(!s(y))throw new Error("N must be a positive integer");if(p(y,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var E=n(y,1);_=[];for(var D=0;c(D,y);D++){var A=a(D+1,E);_.push(v(b,A,x))}return it(y)?_:t(_)}}function g(w,y,x){for(var _=w.valueOf(),b=y.valueOf(),E=[],D=0;D<b.length;++D)E.push(v(_,b[D],x));return E}function v(w,y,x){var _=ht(w),b=_.length;if(b===0)throw new Error("Cannot calculate quantile of an empty sequence");var E=it(y)?y*(b-1):y.times(b-1),D=it(y)?Math.floor(E):E.floor().toNumber(),A=it(y)?E%1:E.minus(D);if(s(E))return x?_[E]:l(_,it(y)?E:E.valueOf());var S,M;if(x)S=_[D],M=_[D+1];else{M=l(_,D+1),S=_[D];for(var F=0;F<D;++F)u(_[F],S)>0&&(S=_[F])}return n(o(S,i(1,A)),o(M,A))}});var CO="std",dJ=["typed","map","sqrt","variance"],$l=N(CO,dJ,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r;return e(CO,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(l){return a(l)}});function a(o,l){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var u=i.apply(null,arguments);return Cr(u)?t(u,n):n(u)}catch(s){throw s instanceof TypeError&&s.message.indexOf(" variance")!==-1?new TypeError(s.message.replace(" variance"," std")):s}}});var MO="corr",hJ=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Rx=N(MO,hJ,r=>{var{typed:e,matrix:t,sqrt:n,sum:i,add:a,subtract:o,multiply:l,pow:u,divide:s}=r;return e(MO,{"Array, Array":function(m,h){return c(m,h)},"Matrix, Matrix":function(m,h){var d=c(m.toArray(),h.toArray());return Array.isArray(d)?t(d):d}});function c(p,m){var h=[];if(Array.isArray(p[0])&&Array.isArray(m[0])){if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var d=0;d<p.length;d++){if(p[d].length!==m[d].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");h.push(f(p[d],m[d]))}return h}else{if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(p,m)}}function f(p,m){var h=p.length,d=i(p),g=i(m),v=p.reduce((b,E,D)=>a(b,l(E,m[D])),0),w=i(p.map(b=>u(b,2))),y=i(m.map(b=>u(b,2))),x=o(l(h,v),l(d,g)),_=n(l(o(l(h,w),u(d,2)),o(l(h,y),u(g,2))));return s(x,_)}});var TO="combinations",gJ=["typed"],Lx=N(TO,gJ,r=>{var{typed:e}=r;return e(TO,{"number, number":tv,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,l,u=n.minus(i),s=new a(1);if(!FO(n)||!FO(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=s,i.lt(u))for(l=s;l.lte(u);l=l.plus(s))o=o.times(i.plus(l)).dividedBy(l);else for(l=s;l.lte(i);l=l.plus(s))o=o.times(u.plus(l)).dividedBy(l);return o}})});function FO(r){return r.isInteger()&&r.gte(0)}var IO="combinationsWithRep",vJ=["typed"],Ux=N(IO,vJ,r=>{var{typed:e}=r;return e(IO,{"number, number":function(n,i){if(!ze(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ze(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<n-1){var a=ri(n,n+i-1);return a/ri(1,i)}var o=ri(i+1,n+i-1);return o/ri(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,l,u=new a(1),s=n.minus(u);if(!BO(n)||!BO(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(u))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=u,i.lt(s))for(l=u;l.lte(s);l=l.plus(u))o=o.times(i.plus(l)).dividedBy(l);else for(l=u;l.lte(i);l=l.plus(u))o=o.times(s.plus(l)).dividedBy(l);return o}})});function BO(r){return r.isInteger()&&r.gte(0)}var PO="gamma",yJ=["typed","config","multiplyScalar","pow","BigNumber","Complex"],Vx=N(PO,yJ,r=>{var{typed:e,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=r;function l(s){if(s.im===0)return hl(s.re);if(s.re<.5){var c=new o(1-s.re,-s.im),f=new o(Math.PI*s.re,Math.PI*s.im);return new o(Math.PI).div(f.sin()).div(l(c))}s=new o(s.re-1,s.im);for(var p=new o(is[0],0),m=1;m<is.length;++m){var h=new o(is[m],0);p=p.add(h.div(s.add(m)))}var d=new o(s.re+sv+.5,s.im),g=Math.sqrt(2*Math.PI),v=d.pow(s.add(.5)),w=d.neg().exp();return p.mul(g).mul(v).mul(w)}return e(PO,{number:hl,Complex:l,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):u(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function u(s){if(s<8)return new a([1,1,2,6,24,120,720,5040][s]);var c=t.precision+(Math.log(s.toNumber())|0),f=a.clone({precision:c});if(s%2===1)return s.times(u(new a(s-1)));for(var p=s,m=new f(s),h=s.toNumber();p>2;)p-=2,h+=p,m=m.times(h);return new a(m.toPrecision(a.precision))}});var OO="lgamma",bJ=["Complex","typed"],$x=N(OO,bJ,r=>{var{Complex:e,typed:t}=r,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(OO,{number:gl,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(s){var c=6.283185307179586,f=1.1447298858494002,p=.1;if(s.isNaN())return new e(NaN,NaN);if(s.im===0)return new e(gl(s.re),0);if(s.re>=n||Math.abs(s.im)>=i)return l(s);if(s.re<=p){var m=pN(c,s.im)*Math.floor(.5*s.re+.25),h=s.mul(Math.PI).sin().log(),d=o(new e(1-s.re,-s.im));return new e(f,m).sub(h).sub(d)}else return s.im>=0?u(s):u(s.conjugate()).conjugate()}function l(s){for(var c=s.sub(.5).mul(s.log()).sub(s).add(uv),f=new e(1,0).div(s),p=f.div(s),m=a[0],h=a[1],d=2*p.re,g=p.re*p.re+p.im*p.im,v=2;v<8;v++){var w=h;h=-g*m+a[v],m=d*m+w}var y=f.mul(p.mul(m).add(h));return c.add(y)}function u(s){var c=0,f=0,p=s;for(s=s.add(1);s.re<=n;){p=p.mul(s);var m=p.im<0?1:0;m!==0&&f===0&&c++,f=m,s=s.add(1)}return l(s).sub(p.log()).sub(new e(0,c*2*Math.PI*1))}});var kO="factorial",xJ=["typed","gamma"],qx=N(kO,xJ,r=>{var{typed:e,gamma:t}=r;return e(kO,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return t(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return t(i.plus(1))},"Array | Matrix":e.referToSelf(n=>i=>Je(i,n))})});var RO="kldivergence",wJ=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],zx=N(RO,wJ,r=>{var{typed:e,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:l,log:u,isNumeric:s}=r;return e(RO,{"Array, Array":function(p,m){return c(t(p),t(m))},"Matrix, Array":function(p,m){return c(p,t(m))},"Array, Matrix":function(p,m){return c(t(p),m)},"Matrix, Matrix":function(p,m){return c(p,m)}});function c(f,p){var m=p.size().length,h=f.size().length;if(m>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(m!==h)throw new Error("Length of two vectors must be equal");var d=i(f);if(d===0)throw new Error("Sum of elements in first object must be non zero");var g=i(p);if(g===0)throw new Error("Sum of elements in second object must be non zero");var v=n(f,i(f)),w=n(p,i(p)),y=i(a(v,o(l(v,w),x=>u(x))));return s(y)?y:Number.NaN}});var LO="multinomial",_J=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Hx=N(LO,_J,r=>{var{typed:e,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:l}=r;return e(LO,{"Array | Matrix":function(s){var c=0,f=1;return bn(s,function(p){if(!o(p)||!l(p))throw new TypeError("Positive integer value expected in function multinomial");c=t(c,p),f=i(f,a(p))}),n(a(c),f)}})});var UO="permutations",AJ=["typed","factorial"],Gx=N(UO,AJ,r=>{var{typed:e,factorial:t}=r;return e(UO,{"number | BigNumber":t,"number, number":function(i,a){if(!ze(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!ze(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return ri(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,l;if(!VO(i)||!VO(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var u=i.mul(0).add(1);for(o=u,l=i.minus(a).plus(1);l.lte(i);l=l.plus(1))o=o.times(l);return o}})});function VO(r){return r.isInteger()&&r.gte(0)}var Qx=fr(rk(),1),TJ=(0,Qx.default)(Date.now());function Sa(r){var e;function t(i){e=i===null?TJ:(0,Qx.default)(String(i))}t(r);function n(){return e()}return n}var nk="pickRandom",FJ=["typed","config","?on"],Kx=N(nk,FJ,r=>{var{typed:e,config:t,on:n}=r,i=Sa(t.randomSeed);return n&&n("config",function(o,l){o.randomSeed!==l.randomSeed&&(i=Sa(o.randomSeed))}),e(nk,{"Array | Matrix":function(l){return a(l,{})},"Array | Matrix, Object":function(l,u){return a(l,u)},"Array | Matrix, number":function(l,u){return a(l,{number:u})},"Array | Matrix, Array | Matrix":function(l,u){return a(l,{weights:u})},"Array | Matrix, Array | Matrix, number":function(l,u,s){return a(l,{number:s,weights:u})},"Array | Matrix, number, Array | Matrix":function(l,u,s){return a(l,{number:u,weights:s})}});function a(o,l){var{number:u,weights:s,elementWise:c=!0}=l,f=typeof u=="undefined";f&&(u=1);var p=Ge(o)?o.create:Ge(s)?s.create:null;o=o.valueOf(),s&&(s=s.valueOf()),c===!0&&(o=ht(o),s=ht(s));var m=0;if(typeof s!="undefined"){if(s.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,d=s.length;h<d;h++){if(!it(s[h])||s[h]<0)throw new Error("Weights must be an array of positive numbers");m+=s[h]}}for(var g=o.length,v=[],w;v.length<u;){if(typeof s=="undefined")w=o[Math.floor(i()*g)];else for(var y=i()*m,x=0,_=o.length;x<_;x++)if(y-=s[x],y<0){w=o[x];break}v.push(w)}return f?v[0]:p?p(v):v}});function ql(r,e){var t=[];if(r=r.slice(0),r.length>1)for(var n=0,i=r.shift();n<i;n++)t.push(ql(r,e));else for(var a=0,o=r.shift();a<o;a++)t.push(e());return t}var ik="random",IJ=["typed","config","?on"],e1=N(ik,IJ,r=>{var{typed:e,config:t,on:n}=r,i=Sa(t.randomSeed);return n&&n("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=Sa(l.randomSeed))}),e(ik,{"":()=>o(0,1),number:l=>o(0,l),"number, number":(l,u)=>o(l,u),"Array | Matrix":l=>a(l,0,1),"Array | Matrix, number":(l,u)=>a(l,0,u),"Array | Matrix, number, number":(l,u,s)=>a(l,u,s)});function a(l,u,s){var c=ql(l.valueOf(),()=>o(u,s));return Ge(l)?l.create(c):c}function o(l,u){return l+i()*(u-l)}});var ak="randomInt",BJ=["typed","config","?on"],t1=N(ak,BJ,r=>{var{typed:e,config:t,on:n}=r,i=Sa(t.randomSeed);return n&&n("config",function(l,u){l.randomSeed!==u.randomSeed&&(i=Sa(l.randomSeed))}),e(ak,{"":()=>o(0,1),number:l=>o(0,l),"number, number":(l,u)=>o(l,u),"Array | Matrix":l=>a(l,0,1),"Array | Matrix, number":(l,u)=>a(l,0,u),"Array | Matrix, number, number":(l,u,s)=>a(l,u,s)});function a(l,u,s){var c=ql(l.valueOf(),()=>o(u,s));return Ge(l)?l.create(c):c}function o(l,u){return Math.floor(l+i()*(u-l))}});var ok="stirlingS2",PJ=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],r1=N(ok,PJ,r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:l,combinations:u,isNegative:s,isInteger:c,number:f,bignumber:p,larger:m}=r,h=[],d=[];return e(ok,{"number | BigNumber, number | BigNumber":function(v,w){if(!c(v)||s(v)||!c(w)||s(w))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(w,v))throw new TypeError("k must be less than or equal to n in function stirlingS2");var y=!(it(v)&&it(w)),x=y?d:h,_=y?p:f,b=f(v),E=f(w);if(x[b]&&x[b].length>E)return x[b][E];for(var D=0;D<=b;++D)if(x[D]||(x[D]=[_(D===0?1:0)]),D!==0)for(var A=x[D],S=x[D-1],M=A.length;M<=D&&M<=E;++M)M===D?A[M]=1:A[M]=t(i(_(M),S[M]),S[M-1]);return x[b][E]}})});var sk="bellNumbers",OJ=["typed","addScalar","isNegative","isInteger","stirlingS2"],n1=N(sk,OJ,r=>{var{typed:e,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=r;return e(sk,{"number | BigNumber":function(l){if(!i(l)||n(l))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var u=0,s=0;s<=l;s++)u=t(u,a(l,s));return u}})});var uk="catalan",kJ=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],i1=N(uk,kJ,r=>{var{typed:e,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:l}=r;return e(uk,{"number | BigNumber":function(s){if(!l(s)||o(s))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(s,2),s),t(s,1))}})});var lk="composition",RJ=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],a1=N(lk,RJ,r=>{var{typed:e,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:l}=r;return e(lk,{"number | BigNumber, number | BigNumber":function(s,c){if(!o(s)||!i(s)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(l(c,s))throw new TypeError("k must be less than or equal to n in function composition");return n(t(s,-1),t(c,-1))}})});var ck="leafCount",LJ=["parse","typed"],o1=N(ck,LJ,r=>{var{parse:e,typed:t}=r;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return t(ck,{Node:function(a){return n(a)}})});function s1(r){return _t(r)||hr(r)&&r.isUnary()&&_t(r.args[0])}function zl(r){return!!(_t(r)||(Tn(r)||hr(r))&&r.args.every(zl)||fn(r)&&zl(r.content))}function fk(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function u1(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fk(Object(t),!0).forEach(function(n){Ht(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fk(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var UJ="simplifyUtil",VJ=["FunctionNode","OperatorNode","SymbolNode"],bu=N(UJ,VJ,r=>{var{FunctionNode:e,OperatorNode:t,SymbolNode:n}=r,i=!0,a=!1,o="defaultF",l={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},u={divide:{total:a},log:{total:a}},s={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(y,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l,b=o;if(typeof y=="string"?b=y:hr(y)?b=y.fn.toString():Tn(y)?b=y.name:fn(y)&&(b="paren"),Ze(_,b)){var E=_[b];if(Ze(E,x))return E[x];if(Ze(l,b))return l[b][x]}if(Ze(_,o)){var D=_[o];return Ze(D,x)?D[x]:l[o][x]}if(Ze(l,b)){var A=l[b];if(Ze(A,x))return A[x]}return l[o][x]}function f(y){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(y,"commutative",x)}function p(y){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return c(y,"associative",x)}function m(y,x){var _=u1({},y);for(var b in x)Ze(y,b)?_[b]=u1(u1({},x[b]),y[b]):_[b]=x[b];return _}function h(y,x){if(!y.args||y.args.length===0)return y;y.args=d(y,x);for(var _=0;_<y.args.length;_++)h(y.args[_],x)}function d(y,x){var _,b=[],E=function D(A){for(var S=0;S<A.args.length;S++){var M=A.args[S];hr(M)&&_===M.op?D(M):b.push(M)}};return p(y,x)?(_=y.op,E(y),b):y.args}function g(y,x){if(!(!y.args||y.args.length===0)){for(var _=w(y),b=y.args.length,E=0;E<b;E++)g(y.args[E],x);if(b>2&&p(y,x)){for(var D=y.args.pop();y.args.length>0;)D=_([y.args.pop(),D]);y.args=D.args}}}function v(y,x){if(!(!y.args||y.args.length===0)){for(var _=w(y),b=y.args.length,E=0;E<b;E++)v(y.args[E],x);if(b>2&&p(y,x)){for(var D=y.args.shift();y.args.length>0;)D=_([D,y.args.shift()]);y.args=D.args}}}function w(y){return hr(y)?function(x){try{return new t(y.op,y.fn,x,y.implicit)}catch(_){return console.error(_),[]}}:function(x){return new e(new n(y.name),x)}}return{createMakeNodeFunction:w,hasProperty:c,isCommutative:f,isAssociative:p,mergeContext:m,flatten:h,allChildren:d,unflattenr:g,unflattenl:v,defaultContext:l,realContext:u,positiveContext:s}});var $J="simplify",qJ=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],l1=N($J,qJ,r=>{var{config:e,typed:t,parse:n,add:i,subtract:a,multiply:o,divide:l,pow:u,isZero:s,equal:c,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:v,AccessorNode:w,ArrayNode:y,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:E,OperatorNode:D,ParenthesisNode:A,SymbolNode:S}=r,{hasProperty:M,isCommutative:F,isAssociative:P,mergeContext:R,flatten:O,unflattenr:I,unflattenl:T,createMakeNodeFunction:$,defaultContext:B,realContext:U,positiveContext:G}=bu({FunctionNode:_,OperatorNode:D,SymbolNode:S});t.addConversion({from:"Object",to:"Map",convert:ba});var H=t("simplify",{Node:K,"Node, Map":(W,te)=>K(W,!1,te),"Node, Map, Object":(W,te,ie)=>K(W,!1,te,ie),"Node, Array":K,"Node, Array, Map":K,"Node, Array, Map, Object":K});t.removeConversion({from:"Object",to:"Map",convert:ba}),H.defaultContext=B,H.realContext=U,H.positiveContext=G;function L(W){return W.transform(function(te,ie,ge){return fn(te)?L(te.content):te})}var ae={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};H.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function ve(W,te){var ie={};if(W.s){var ge=W.s.split("->");if(ge.length===2)ie.l=ge[0],ie.r=ge[1];else throw SyntaxError("Could not parse rule: "+W.s)}else ie.l=W.l,ie.r=W.r;ie.l=L(n(ie.l)),ie.r=L(n(ie.r));for(var ye of["imposeContext","repeat","assuming"])ye in W&&(ie[ye]=W[ye]);if(W.evaluate&&(ie.evaluate=n(W.evaluate)),P(ie.l,te)){var qe=!F(ie.l,te),De;qe&&(De=he());var ft=$(ie.l),wt=he();ie.expanded={},ie.expanded.l=ft([ie.l,wt]),O(ie.expanded.l,te),I(ie.expanded.l,te),ie.expanded.r=ft([ie.r,wt]),qe&&(ie.expandedNC1={},ie.expandedNC1.l=ft([De,ie.l]),ie.expandedNC1.r=ft([De,ie.r]),ie.expandedNC2={},ie.expandedNC2.l=ft([De,ie.expanded.l]),ie.expandedNC2.r=ft([De,ie.expanded.r]))}return ie}function se(W,te){for(var ie=[],ge=0;ge<W.length;ge++){var ye=W[ge],qe=void 0,De=typeof ye;switch(De){case"string":ye={s:ye};case"object":qe=ve(ye,te);break;case"function":qe=ye;break;default:throw TypeError("Unsupported type of rule: "+De)}ie.push(qe)}return ie}var le=0;function he(){return new S("_p"+le++)}function K(W,te){var ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:to(),ge=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},ye=ge.consoleDebug;te=se(te||H.rules,ge.context);var qe=f(W,ie);qe=L(qe);for(var De={},ft=qe.toString({parenthesis:"all"});!De[ft];){De[ft]=!0,le=0;var wt=ft;ye&&console.log("Working on: ",ft);for(var jt=0;jt<te.length;jt++){var nr="";if(typeof te[jt]=="function"?(qe=te[jt](qe,ge),ye&&(nr=te[jt].name)):(O(qe,ge.context),qe=me(qe,te[jt],ge.context),ye&&(nr="".concat(te[jt].l.toString()," -> ").concat(te[jt].r.toString()))),ye){var Y=qe.toString({parenthesis:"all"});Y!==wt&&(console.log("Applying",nr,"produced",Y),wt=Y)}T(qe,ge.context)}ft=qe.toString({parenthesis:"all"})}return qe}function ne(W,te,ie){var ge=W;if(W)for(var ye=0;ye<W.length;++ye){var qe=me(W[ye],te,ie);qe!==W[ye]&&(ge===W&&(ge=W.slice()),ge[ye]=qe)}return ge}function me(W,te,ie){if(te.assuming){for(var ge in te.assuming)for(var ye in te.assuming[ge])if(M(ge,ye,ie)!==te.assuming[ge][ye])return W}var qe=R(te.imposeContext,ie),De=W;if(De instanceof D||De instanceof _){var ft=ne(De.args,te,ie);ft!==De.args&&(De=De.clone(),De.args=ft)}else if(De instanceof A){if(De.content){var wt=me(De.content,te,ie);wt!==De.content&&(De=new A(wt))}}else if(De instanceof y){var jt=ne(De.items,te,ie);jt!==De.items&&(De=new y(jt))}else if(De instanceof w){var nr=De.object;De.object&&(nr=me(De.object,te,ie));var Y=De.index;De.index&&(Y=me(De.index,te,ie)),(nr!==De.object||Y!==De.index)&&(De=new w(nr,Y))}else if(De instanceof b){var oe=ne(De.dimensions,te,ie);oe!==De.dimensions&&(De=new b(oe))}else if(De instanceof E){var pe=!1,Ee={};for(var Fe in De.properties)Ee[Fe]=me(De.properties[Fe],te,ie),Ee[Fe]!==De.properties[Fe]&&(pe=!0);pe&&(De=new E(Ee))}var Ne=te.r,Te=X(te.l,De,qe)[0];if(!Te&&te.expanded&&(Ne=te.expanded.r,Te=X(te.expanded.l,De,qe)[0]),!Te&&te.expandedNC1&&(Ne=te.expandedNC1.r,Te=X(te.expandedNC1.l,De,qe)[0],Te||(Ne=te.expandedNC2.r,Te=X(te.expandedNC2.l,De,qe)[0])),Te){var Re=De.implicit;De=Ne.clone(),Re&&"implicit"in Ne&&(De.implicit=!0),De=De.transform(function(C){return C.isSymbolNode&&Ze(Te.placeholders,C.name)?Te.placeholders[C.name].clone():C})}return te.repeat&&De!==W&&(De=me(De,te,ie)),De}function de(W,te){var ie=[],ge,ye,qe=$(W);if(F(W,te))for(var De=0;De<W.args.length;De++)ye=W.args.slice(0),ye.splice(De,1),ge=ye.length===1?ye[0]:qe(ye),ie.push(qe([W.args[De],ge]));else for(var ft=1;ft<W.args.length;ft++){var wt=W.args[0];ft>1&&(wt=qe(W.args.slice(0,ft))),ye=W.args.slice(ft),ge=ye.length===1?ye[0]:qe(ye),ie.push(qe([wt,ge]))}return ie}function Oe(W,te){var ie={placeholders:{}};if(!W.placeholders&&!te.placeholders)return ie;if(W.placeholders){if(!te.placeholders)return W}else return te;for(var ge in W.placeholders)if(Ze(W.placeholders,ge)&&(ie.placeholders[ge]=W.placeholders[ge],Ze(te.placeholders,ge)&&!fe(W.placeholders[ge],te.placeholders[ge])))return null;for(var ye in te.placeholders)Ze(te.placeholders,ye)&&(ie.placeholders[ye]=te.placeholders[ye]);return ie}function Se(W,te){var ie=[];if(W.length===0||te.length===0)return ie;for(var ge,ye=0;ye<W.length;ye++)for(var qe=0;qe<te.length;qe++)ge=Oe(W[ye],te[qe]),ge&&ie.push(ge);return ie}function V(W){if(W.length===0)return W;for(var te=W.reduce(Se),ie=[],ge={},ye=0;ye<te.length;ye++){var qe=JSON.stringify(te[ye]);ge[qe]||(ge[qe]=!0,ie.push(te[ye]))}return ie}function X(W,te,ie,ge){var ye=[{placeholders:{}}];if(W instanceof D&&te instanceof D||W instanceof _&&te instanceof _){if(W instanceof D){if(W.op!==te.op||W.fn!==te.fn)return[]}else if(W instanceof _&&W.name!==te.name)return[];if(te.args.length===1&&W.args.length===1||!P(te,ie)&&te.args.length===W.args.length||ge){for(var qe=[],De=0;De<W.args.length;De++){var ft=X(W.args[De],te.args[De],ie);if(ft.length===0)break;qe.push(ft)}if(qe.length!==W.args.length){if(!F(te,ie)||W.args.length===1)return[];if(W.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var wt=X(W.args[0],te.args[1],ie);if(wt.length===0)return[];var jt=X(W.args[1],te.args[0],ie);if(jt.length===0)return[];qe=[wt,jt]}ye=V(qe)}else if(te.args.length>=2&&W.args.length===2){for(var nr=de(te,ie),Y=[],oe=0;oe<nr.length;oe++){var pe=X(W,nr[oe],ie,!0);Y=Y.concat(pe)}return Y}else{if(W.args.length>2)throw Error("Unexpected non-binary associative function: "+W.toString());return[]}}else if(W instanceof S){if(W.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(ae[W.name]){if(W.name!==te.name)return[]}else switch(W.name[1]>="a"&&W.name[1]<="z"?W.name.substring(0,2):W.name[0]){case"n":case"_p":ye[0].placeholders[W.name]=te;break;case"c":case"cl":if(_t(te))ye[0].placeholders[W.name]=te;else return[];break;case"v":if(!_t(te))ye[0].placeholders[W.name]=te;else return[];break;case"vl":if(ar(te))ye[0].placeholders[W.name]=te;else return[];break;case"cd":if(s1(te))ye[0].placeholders[W.name]=te;else return[];break;case"vd":if(!s1(te))ye[0].placeholders[W.name]=te;else return[];break;case"ce":if(zl(te))ye[0].placeholders[W.name]=te;else return[];break;case"ve":if(!zl(te))ye[0].placeholders[W.name]=te;else return[];break;default:throw new Error("Invalid symbol in rule: "+W.name)}}else if(W instanceof x){if(!c(W.value,te.value))return[]}else return[];return ye}function fe(W,te){if(W instanceof x&&te instanceof x){if(!c(W.value,te.value))return!1}else if(W instanceof S&&te instanceof S){if(W.name!==te.name)return!1}else if(W instanceof D&&te instanceof D||W instanceof _&&te instanceof _){if(W instanceof D){if(W.op!==te.op||W.fn!==te.fn)return!1}else if(W instanceof _&&W.name!==te.name)return!1;if(W.args.length!==te.args.length)return!1;for(var ie=0;ie<W.args.length;ie++)if(!fe(W.args[ie],te.args[ie]))return!1}else return!1;return!0}return H});var zJ="simplifyConstant",HJ=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],c1=N(zJ,HJ,r=>{var{typed:e,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:l,ArrayNode:u,ConstantNode:s,FunctionNode:c,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=r,{isCommutative:d,isAssociative:g,allChildren:v,createMakeNodeFunction:w}=bu({FunctionNode:c,OperatorNode:m,SymbolNode:h}),y=e("simplifyConstant",{Node:O=>E(R(O,{})),"Node, Object":function(I,T){return E(R(I,T))}});function x(O){return va(O)?O.valueOf():O instanceof Array?O.map(x):Ge(O)?i(x(O.valueOf())):O}function _(O,I,T){try{return n[O].apply(null,I)}catch($){return I=I.map(x),A(n[O].apply(null,I),T)}}var b=e({Fraction:M,number:function(I){return I<0?S(new s(-I)):new s(I)},BigNumber:function(I){return I<0?S(new s(-I)):new s(I)},Complex:function(I){throw new Error("Cannot convert Complex number to Node")},string:function(I){return new s(I)},Matrix:function(I){return new u(I.valueOf().map(T=>b(T)))}});function E(O){return Dt(O)?O:b(O)}function D(O,I){var T=I&&I.exactFractions!==!1;if(T&&isFinite(O)&&a){var $=a(O),B=I&&typeof I.fractionsLimit=="number"?I.fractionsLimit:1/0;if($.valueOf()===O&&$.n<B&&$.d<B)return $}return O}var A=e({"string, Object":function(I,T){if(t.number==="BigNumber")return o===void 0&&mu(),o(I);if(t.number==="Fraction")return a===void 0&&Lp(),a(I);var $=parseFloat(I);return D($,T)},"Fraction, Object":function(I,T){return I},"BigNumber, Object":function(I,T){return I},"number, Object":function(I,T){return D(I,T)},"Complex, Object":function(I,T){return I.im!==0?I:D(I.re,T)},"Matrix, Object":function(I,T){return i(D(I.valueOf()))},"Array, Object":function(I,T){return I.map(D)}});function S(O){return new m("-","unaryMinus",[O])}function M(O){var I,T=O.s*O.n;return T<0?I=new m("-","unaryMinus",[new s(-T)]):I=new s(T),O.d===1?I:new m("/","divide",[I,new s(O.d)])}function F(O,I,T){if(!hi(I))return new l(E(O),E(I));if(cn(O)||Ge(O)){for(var $=Array.from(I.dimensions);$.length>0;)if(_t($[0])&&typeof $[0].value!="string"){var B=A($.shift().value,T);cn(O)?O=O.items[B-1]:(O=O.valueOf()[B-1],O instanceof Array&&(O=i(O)))}else if($.length>1&&_t($[1])&&typeof $[1].value!="string"){var U=A($[1].value,T),G=[],H=cn(O)?O.items:O.valueOf();for(var L of H)if(cn(L))G.push(L.items[U-1]);else if(Ge(O))G.push(L[U-1]);else break;if(G.length===H.length)cn(O)?O=new u(G):O=i(G),$.splice(1,1);else break}else break;return $.length===I.dimensions.length?new l(E(O),I):$.length>0?(I=new f($),new l(E(O),I)):O}if(Qa(O)&&I.dimensions.length===1&&_t(I.dimensions[0])){var ae=I.dimensions[0].value;return ae in O.properties?O.properties[ae]:new s}return new l(E(O),I)}function P(O,I,T,$){var B=I.shift(),U=I.reduce((G,H)=>{if(!Dt(H)){var L=G.pop();if(Dt(L))return[L,H];try{return G.push(_(O,[L,H],$)),G}catch(ve){G.push(L)}}G.push(E(G.pop()));var ae=G.length===1?G[0]:T(G);return[T([ae,E(H)])]},[B]);return U.length===1?U[0]:T([U[0],b(U[1])])}function R(O,I){switch(O.type){case"SymbolNode":return O;case"ConstantNode":switch(typeof O.value){case"number":return A(O.value,I);case"string":return O.value;default:if(!isNaN(O.value))return A(O.value,I)}return O;case"FunctionNode":if(n[O.name]&&n[O.name].rawArgs)return O;{var T=["add","multiply"];if(T.indexOf(O.name)===-1){var $=O.args.map(me=>R(me,I));if(!$.some(Dt))try{return _(O.name,$,I)}catch(me){}if(O.name==="size"&&$.length===1&&cn($[0])){for(var B=[],U=$[0];cn(U);)B.push(U.items.length),U=U.items[0];return i(B)}return new c(O.name,$.map(E))}}case"OperatorNode":{var G=O.fn.toString(),H,L,ae=w(O);if(hr(O)&&O.isUnary())H=[R(O.args[0],I)],Dt(H[0])?L=ae(H):L=_(G,H,I);else if(g(O,I.context))if(H=v(O,I.context),H=H.map(me=>R(me,I)),d(G,I.context)){for(var ve=[],se=[],le=0;le<H.length;le++)Dt(H[le])?se.push(H[le]):ve.push(H[le]);ve.length>1?(L=P(G,ve,ae,I),se.unshift(L),L=P(G,se,ae,I)):L=P(G,H,ae,I)}else L=P(G,H,ae,I);else H=O.args.map(me=>R(me,I)),L=P(G,H,ae,I);return L}case"ParenthesisNode":return R(O.content,I);case"AccessorNode":return F(R(O.object,I),R(O.index,I),I);case"ArrayNode":{var he=O.items.map(me=>R(me,I));return he.some(Dt)?new u(he.map(E)):i(he)}case"IndexNode":return new f(O.dimensions.map(me=>y(me,I)));case"ObjectNode":{var K={};for(var ne in O.properties)K[ne]=y(O.properties[ne],I);return new p(K)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(O.type))}}return y});var pk="simplifyCore",GJ=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],f1=N(pk,GJ,r=>{var{typed:e,parse:t,equal:n,isZero:i,add:a,subtract:o,multiply:l,divide:u,pow:s,AccessorNode:c,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:v,SymbolNode:w}=r,y=new p(0),x=new p(1),_=new p(!0),b=new p(!1);function E(M){return hr(M)&&["and","not","or"].includes(M.op)}var{hasProperty:D,isCommutative:A}=bu({FunctionNode:m,OperatorNode:g,SymbolNode:w});function S(M){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=F?F.context:void 0;if(D(M,"trivial",P)){if(Tn(M)&&M.args.length===1)return S(M.args[0],F);var R=!1,O=0;if(M.forEach(se=>{++O,O===1&&(R=S(se,F))}),O===1)return R}var I=M;if(Tn(I)){var T=c2(I.name);if(T){if(I.args.length>2&&D(I,"associative",P))for(;I.args.length>2;){var $=I.args.pop(),B=I.args.pop();I.args.push(new g(T,I.name,[$,B]))}I=new g(T,I.name,I.args)}else return new m(S(I.fn),I.args.map(se=>S(se,F)))}if(hr(I)&&I.isUnary()){var U=S(I.args[0],F);if(I.op==="~"&&hr(U)&&U.isUnary()&&U.op==="~"||I.op==="not"&&hr(U)&&U.isUnary()&&U.op==="not"&&E(U.args[0]))return U.args[0];var G=!0;if(I.op==="-"&&hr(U)&&(U.isBinary()&&U.fn==="subtract"&&(I=new g("-","subtract",[U.args[1],U.args[0]]),G=!1),U.isUnary()&&U.op==="-"))return U.args[0];if(G)return new g(I.op,I.fn,[U])}if(hr(I)&&I.isBinary()){var H=S(I.args[0],F),L=S(I.args[1],F);if(I.op==="+"){if(_t(H)&&i(H.value))return L;if(_t(L)&&i(L.value))return H;hr(L)&&L.isUnary()&&L.op==="-"&&(L=L.args[0],I=new g("-","subtract",[H,L]))}if(I.op==="-")return hr(L)&&L.isUnary()&&L.op==="-"?S(new g("+","add",[H,L.args[0]]),F):_t(H)&&i(H.value)?S(new g("-","unaryMinus",[L])):_t(L)&&i(L.value)?H:new g(I.op,I.fn,[H,L]);if(I.op==="*"){if(_t(H)){if(i(H.value))return y;if(n(H.value,1))return L}if(_t(L)){if(i(L.value))return y;if(n(L.value,1))return H;if(A(I,P))return new g(I.op,I.fn,[L,H],I.implicit)}return new g(I.op,I.fn,[H,L],I.implicit)}if(I.op==="/")return _t(H)&&i(H.value)?y:_t(L)&&n(L.value,1)?H:new g(I.op,I.fn,[H,L]);if(I.op==="^"&&_t(L)){if(i(L.value))return x;if(n(L.value,1))return H}if(I.op==="and"){if(_t(H))if(H.value){if(E(L))return L}else return b;if(_t(L))if(L.value){if(E(H))return H}else return b}if(I.op==="or"){if(_t(H)){if(H.value)return _;if(E(L))return L}if(_t(L)){if(L.value)return _;if(E(H))return H}}return new g(I.op,I.fn,[H,L])}if(hr(I))return new g(I.op,I.fn,I.args.map(se=>S(se,F)));if(cn(I))return new f(I.items.map(se=>S(se,F)));if(ti(I))return new c(S(I.object,F),S(I.index,F));if(hi(I))return new h(I.dimensions.map(se=>S(se,F)));if(Qa(I)){var ae={};for(var ve in I.properties)ae[ve]=S(I.properties[ve],F);return new d(ae)}return I}return e(pk,{Node:S,"Node,Object":S})});var WJ="resolve",jJ=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],p1=N(WJ,jJ,r=>{var{typed:e,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=r;function l(u,s){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!s)return u;if(ar(u)){if(c.has(u.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var p=s.get(u.name);if(Dt(p)){var m=new Set(c);return m.add(u.name),l(p,s,m)}else return typeof p=="number"?t(String(p)):p!==void 0?new n(p):u}else if(hr(u)){var h=u.args.map(function(g){return l(g,s,c)});return new a(u.op,u.fn,h,u.implicit)}else{if(fn(u))return new o(l(u.content,s,c));if(Tn(u)){var d=u.args.map(function(g){return l(g,s,c)});return new i(u.name,d)}}return u.map(g=>l(g,s,c))}return e("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(u,s)=>l(u,ba(s)),"Array | Matrix":e.referToSelf(u=>s=>s.map(c=>u(c))),"Array | Matrix, null | undefined":e.referToSelf(u=>s=>s.map(c=>u(c))),"Array, Object":e.referTo("Array,Map",u=>(s,c)=>u(s,ba(c))),"Matrix, Object":e.referTo("Matrix,Map",u=>(s,c)=>u(s,ba(c))),"Array | Matrix, Map":e.referToSelf(u=>(s,c)=>s.map(f=>u(f,c)))})});var mk="symbolicEqual",ZJ=["parse","simplify","typed","OperatorNode"],m1=N(mk,ZJ,r=>{var{parse:e,simplify:t,typed:n,OperatorNode:i}=r;function a(o,l){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=new i("-","subtract",[o,l]),c=t(s,{},u);return _t(c)&&!c.value}return n(mk,{"Node, Node":a,"Node, Node, Object":a})});var dk="derivative",JJ=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],d1=N(dk,JJ,r=>{var{typed:e,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:l,ConstantNode:u,FunctionNode:s,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=r;function m(y,x){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},b={};g(b,y,x.name);var E=v(y,b);return _.simplify?i(E):E}e.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=e(dk,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});e.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(y){return d.apply(null,y.args)};var d=e("_derivTex",{"Node, SymbolNode":function(x,_){return _t(x)&&Mt(x.value)==="string"?d(n(x.value).toString(),_.toString(),1):d(x.toTex(),_.toString(),1)},"Node, ConstantNode":function(x,_){if(Mt(_.value)==="string")return d(x,n(_.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(x,_,b){return d(x.toString(),_.name,b.value)},"string, string, number":function(x,_,b){var E;return b===1?E="{d\\over d"+_+"}":E="{d^{"+b+"}\\over d"+_+"^{"+b+"}}",E+"\\left[".concat(x,"\\right]")}}),g=e("constTag",{"Object, ConstantNode, string":function(x,_){return x[_]=!0,!0},"Object, SymbolNode, string":function(x,_,b){return _.name!==b?(x[_]=!0,!0):!1},"Object, ParenthesisNode, string":function(x,_,b){return g(x,_.content,b)},"Object, FunctionAssignmentNode, string":function(x,_,b){return _.params.indexOf(b)===-1?(x[_]=!0,!0):g(x,_.expr,b)},"Object, FunctionNode | OperatorNode, string":function(x,_,b){if(_.args.length>0){for(var E=g(x,_.args[0],b),D=1;D<_.args.length;++D)E=g(x,_.args[D],b)&&E;if(E)return x[_]=!0,!0}return!1}}),v=e("_derivative",{"ConstantNode, Object":function(x){return w(0)},"SymbolNode, Object":function(x,_){return _[x]!==void 0?w(0):w(1)},"ParenthesisNode, Object":function(x,_){return new f(v(x.content,_))},"FunctionAssignmentNode, Object":function(x,_){return _[x]!==void 0?w(0):v(x.expr,_)},"FunctionNode, Object":function(x,_){if(_[x]!==void 0)return w(0);var b=x.args[0],E,D=!1,A=!1,S;switch(x.name){case"cbrt":D=!0,S=new c("*","multiply",[w(3),new c("^","pow",[b,new c("/","divide",[w(2),w(3)])])]);break;case"sqrt":case"nthRoot":if(x.args.length===1)D=!0,S=new c("*","multiply",[w(2),new s("sqrt",[b])]);else if(x.args.length===2)return E=new c("/","divide",[w(1),x.args[1]]),_[E]=_[x.args[1]],v(new c("^","pow",[b,E]),_);break;case"log10":E=w(10);case"log":if(!E&&x.args.length===1)S=b.clone(),D=!0;else if(x.args.length===1&&E||x.args.length===2&&_[x.args[1]]!==void 0)S=new c("*","multiply",[b.clone(),new s("log",[E||x.args[1]])]),D=!0;else if(x.args.length===2)return v(new c("/","divide",[new s("log",[b]),new s("log",[x.args[1]])]),_);break;case"pow":if(x.args.length===2)return _[E]=_[x.args[1]],v(new c("^","pow",[b,x.args[1]]),_);break;case"exp":S=new s("exp",[b.clone()]);break;case"sin":S=new s("cos",[b.clone()]);break;case"cos":S=new c("-","unaryMinus",[new s("sin",[b.clone()])]);break;case"tan":S=new c("^","pow",[new s("sec",[b.clone()]),w(2)]);break;case"sec":S=new c("*","multiply",[x,new s("tan",[b.clone()])]);break;case"csc":A=!0,S=new c("*","multiply",[x,new s("cot",[b.clone()])]);break;case"cot":A=!0,S=new c("^","pow",[new s("csc",[b.clone()]),w(2)]);break;case"asin":D=!0,S=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"acos":D=!0,A=!0,S=new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])]);break;case"atan":D=!0,S=new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)]);break;case"asec":D=!0,S=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acsc":D=!0,A=!0,S=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acot":D=!0,A=!0,S=new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)]);break;case"sinh":S=new s("cosh",[b.clone()]);break;case"cosh":S=new s("sinh",[b.clone()]);break;case"tanh":S=new c("^","pow",[new s("sech",[b.clone()]),w(2)]);break;case"sech":A=!0,S=new c("*","multiply",[x,new s("tanh",[b.clone()])]);break;case"csch":A=!0,S=new c("*","multiply",[x,new s("coth",[b.clone()])]);break;case"coth":A=!0,S=new c("^","pow",[new s("csch",[b.clone()]),w(2)]);break;case"asinh":D=!0,S=new s("sqrt",[new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"acosh":D=!0,S=new s("sqrt",[new c("-","subtract",[new c("^","pow",[b.clone(),w(2)]),w(1)])]);break;case"atanh":D=!0,S=new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])]);break;case"asech":D=!0,A=!0,S=new c("*","multiply",[b.clone(),new s("sqrt",[new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])])])]);break;case"acsch":D=!0,A=!0,S=new c("*","multiply",[new s("abs",[b.clone()]),new s("sqrt",[new c("+","add",[new c("^","pow",[b.clone(),w(2)]),w(1)])])]);break;case"acoth":D=!0,A=!0,S=new c("-","subtract",[w(1),new c("^","pow",[b.clone(),w(2)])]);break;case"abs":S=new c("/","divide",[new s(new p("abs"),[b.clone()]),b.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+x.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var M,F;D?(M="/",F="divide"):(M="*",F="multiply");var P=v(b,_);return A&&(P=new c("-","unaryMinus",[P])),new c(M,F,[P,S])},"OperatorNode, Object":function(x,_){if(_[x]!==void 0)return w(0);if(x.op==="+")return new c(x.op,x.fn,x.args.map(function(O){return v(O,_)}));if(x.op==="-"){if(x.isUnary())return new c(x.op,x.fn,[v(x.args[0],_)]);if(x.isBinary())return new c(x.op,x.fn,[v(x.args[0],_),v(x.args[1],_)])}if(x.op==="*"){var b=x.args.filter(function(O){return _[O]!==void 0});if(b.length>0){var E=x.args.filter(function(O){return _[O]===void 0}),D=E.length===1?E[0]:new c("*","multiply",E),A=b.concat(v(D,_));return new c("*","multiply",A)}return new c("+","add",x.args.map(function(O){return new c("*","multiply",x.args.map(function(I){return I===O?v(I,_):I.clone()}))}))}if(x.op==="/"&&x.isBinary()){var S=x.args[0],M=x.args[1];return _[M]!==void 0?new c("/","divide",[v(S,_),M]):_[S]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[S]),new c("/","divide",[v(M,_),new c("^","pow",[M.clone(),w(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[v(S,_),M.clone()]),new c("*","multiply",[S.clone(),v(M,_)])]),new c("^","pow",[M.clone(),w(2)])])}if(x.op==="^"&&x.isBinary()){var F=x.args[0],P=x.args[1];if(_[F]!==void 0)return _t(F)&&(o(F.value)||a(F.value,1))?w(0):new c("*","multiply",[x,new c("*","multiply",[new s("log",[F.clone()]),v(P.clone(),_)])]);if(_[P]!==void 0){if(_t(P)){if(o(P.value))return w(0);if(a(P.value,1))return v(F,_)}var R=new c("^","pow",[F.clone(),new c("-","subtract",[P,w(1)])]);return new c("*","multiply",[P.clone(),new c("*","multiply",[v(F,_),R])])}return new c("*","multiply",[new c("^","pow",[F.clone(),P.clone()]),new c("+","add",[new c("*","multiply",[v(F,_),new c("/","divide",[P.clone(),F.clone()])]),new c("*","multiply",[v(P,_),new s("log",[F.clone()])])])])}throw new Error('Cannot process operator "'+x.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function w(y,x){return new u(l(y,x||t.number))}return h});var hk="rationalize",YJ=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],h1=N(hk,YJ,r=>{var{config:e,typed:t,equal:n,isZero:i,add:a,subtract:o,multiply:l,divide:u,pow:s,parse:c,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:v,AccessorNode:w,ArrayNode:y,ConstantNode:x,FunctionNode:_,IndexNode:b,ObjectNode:E,OperatorNode:D,SymbolNode:A,ParenthesisNode:S}=r;function M(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,B=P(),U=F(I,T,!0,B.firstRules),G=U.variables.length,H={exactFractions:!1},L={exactFractions:!0};if(I=U.expression,G>=1){I=R(I);var ae,ve,se=!0,le=!1;I=m(I,B.firstRules,{},H);for(var he;ve=se?B.distrDivRules:B.sucDivRules,I=m(I,ve,{},L),se=!se,he=I.toString(),he!==ae;)le=!0,ae=he;le&&(I=m(I,B.firstRulesAgain,{},H)),I=m(I,B.finalRules,{},H)}var K=[],ne={};return I.type==="OperatorNode"&&I.isBinary()&&I.op==="/"?(G===1&&(I.args[0]=O(I.args[0],K),I.args[1]=O(I.args[1])),$&&(ne.numerator=I.args[0],ne.denominator=I.args[1])):(G===1&&(I=O(I,K)),$&&(ne.numerator=I,ne.denominator=null)),$?(ne.coefficients=K,ne.variables=U.variables,ne.expression=I,ne):I}return t(hk,{Node:M,"Node, boolean":(I,T)=>M(I,{},T),"Node, Object":M,"Node, Object, boolean":M});function F(I,T,$,B){var U=[],G=m(I,B,T,{exactFractions:!1});$=!!$;var H="+-*"+($?"/":"");ae(G);var L={};return L.expression=G,L.variables=U,L;function ae(ve){var se=ve.type;if(se==="FunctionNode")throw new Error("There is an unsolved function call");if(se==="OperatorNode")if(ve.op==="^"){if(ve.args[1].type!=="ConstantNode"||!ze(parseFloat(ve.args[1].value)))throw new Error("There is a non-integer exponent");ae(ve.args[0])}else{if(H.indexOf(ve.op)===-1)throw new Error("Operator "+ve.op+" invalid in polynomial expression");for(var le=0;le<ve.args.length;le++)ae(ve.args[le])}else if(se==="SymbolNode"){var he=ve.name,K=U.indexOf(he);K===-1&&U.push(he)}else if(se==="ParenthesisNode")ae(ve.content);else if(se!=="ConstantNode")throw new Error("type "+se+" is not allowed in polynomial expression")}}function P(){var I=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],T=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],$=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],B=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],U={};return U.firstRules=I.concat(T,B),U.distrDivRules=$,U.sucDivRules=B,U.firstRulesAgain=I.concat(T),U.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],U}function R(I,T,$){var B=I.type,U=arguments.length>1;if(B==="OperatorNode"&&I.isBinary()){var G=!1,H;if(I.op==="^"&&(I.args[0].type==="ParenthesisNode"||I.args[0].type==="OperatorNode")&&I.args[1].type==="ConstantNode"&&(H=parseFloat(I.args[1].value),G=H>=2&&ze(H)),G){if(H>2){var L=I.args[0],ae=new D("^","pow",[I.args[0].cloneDeep(),new x(H-1)]);I=new D("*","multiply",[L,ae])}else I=new D("*","multiply",[I.args[0],I.args[0].cloneDeep()]);U&&($==="content"?T.content=I:T.args[$]=I)}}if(B==="ParenthesisNode")R(I.content,I,"content");else if(B!=="ConstantNode"&&B!=="SymbolNode")for(var ve=0;ve<I.args.length;ve++)R(I.args[ve],I,ve);if(!U)return I}function O(I,T){T===void 0&&(T=[]),T[0]=0;var $={};$.cte=1,$.oper="+",$.fire="";var B=0,U="";he(I,null,$),B=T.length-1;for(var G=!0,H,L=B;L>=0;L--)if(T[L]!==0){var ae=new x(G?T[L]:Math.abs(T[L])),ve=T[L]<0?"-":"+";if(L>0){var se=new A(U);if(L>1){var le=new x(L);se=new D("^","pow",[se,le])}T[L]===-1&&G?ae=new D("-","unaryMinus",[se]):Math.abs(T[L])===1?ae=se:ae=new D("*","multiply",[ae,se])}G?H=ae:ve==="+"?H=new D("+","add",[H,ae]):H=new D("-","subtract",[H,ae]),G=!1}if(G)return new x(0);return H;function he(K,ne,me){var de=K.type;if(de==="FunctionNode")throw new Error("There is an unsolved function call");if(de==="OperatorNode"){if("+-*^".indexOf(K.op)===-1)throw new Error("Operator "+K.op+" invalid");if(ne!==null){if((K.fn==="unaryMinus"||K.fn==="pow")&&ne.fn!=="add"&&ne.fn!=="subtract"&&ne.fn!=="multiply")throw new Error("Invalid "+K.op+" placing");if((K.fn==="subtract"||K.fn==="add"||K.fn==="multiply")&&ne.fn!=="add"&&ne.fn!=="subtract")throw new Error("Invalid "+K.op+" placing");if((K.fn==="subtract"||K.fn==="add"||K.fn==="unaryMinus")&&me.noFil!==0)throw new Error("Invalid "+K.op+" placing")}(K.op==="^"||K.op==="*")&&(me.fire=K.op);for(var Oe=0;Oe<K.args.length;Oe++)K.fn==="unaryMinus"&&(me.oper="-"),(K.op==="+"||K.fn==="subtract")&&(me.fire="",me.cte=1,me.oper=Oe===0?"+":K.op),me.noFil=Oe,he(K.args[Oe],K,me)}else if(de==="SymbolNode"){if(K.name!==U&&U!=="")throw new Error("There is more than one variable");if(U=K.name,ne===null){T[1]=1;return}if(ne.op==="^"&&me.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ne.op==="*"&&me.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(me.fire===""||me.fire==="*")&&(B<1&&(T[1]=0),T[1]+=me.cte*(me.oper==="+"?1:-1),B=Math.max(1,B))}else if(de==="ConstantNode"){var Se=parseFloat(K.value);if(ne===null){T[0]=Se;return}if(ne.op==="^"){if(me.noFil!==1)throw new Error("Constant cannot be powered");if(!ze(Se)||Se<=0)throw new Error("Non-integer exponent is not allowed");for(var V=B+1;V<Se;V++)T[V]=0;Se>B&&(T[Se]=0),T[Se]+=me.cte*(me.oper==="+"?1:-1),B=Math.max(Se,B);return}me.cte=Se,me.fire===""&&(T[0]+=me.cte*(me.oper==="+"?1:-1))}else throw new Error("Type "+de+" is not allowed")}}});var gk="zpk2tf",XJ=["typed","add","multiply","Complex","number"],g1=N(gk,XJ,r=>{var{typed:e,add:t,multiply:n,Complex:i,number:a}=r;return e(gk,{"Array,Array,number":function(s,c,f){return o(s,c,f)},"Array,Array":function(s,c){return o(s,c,1)},"Matrix,Matrix,number":function(s,c,f){return o(s.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(s,c){return o(s.valueOf(),c.valueOf(),1)}});function o(u,s,c){u.some(w=>w.type==="BigNumber")&&(u=u.map(w=>a(w))),s.some(w=>w.type==="BigNumber")&&(s=s.map(w=>a(w)));for(var f=[i(1,0)],p=[i(1,0)],m=0;m<u.length;m++){var h=u[m];typeof h=="number"&&(h=i(h,0)),f=l(f,[i(1,0),i(-h.re,-h.im)])}for(var d=0;d<s.length;d++){var g=s[d];typeof g=="number"&&(g=i(g,0)),p=l(p,[i(1,0),i(-g.re,-g.im)])}for(var v=0;v<f.length;v++)f[v]=n(f[v],c);return[f,p]}function l(u,s){for(var c=[],f=0;f<u.length+s.length-1;f++){c[f]=i(0,0);for(var p=0;p<u.length;p++)f-p>=0&&f-p<s.length&&(c[f]=t(c[f],n(u[p],s[f-p])))}return c}});var vk="freqz",QJ=["typed","add","multiply","Complex","divide","matrix"],v1=N(vk,QJ,r=>{var{typed:e,add:t,multiply:n,Complex:i,divide:a,matrix:o}=r;return e(vk,{"Array, Array":function(c,f){var p=u(512);return l(c,f,p)},"Array, Array, Array":function(c,f,p){return l(c,f,p)},"Array, Array, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=u(p);return l(c,f,m)},"Matrix, Matrix":function(c,f){var p=u(512),{w:m,h}=l(c.valueOf(),f.valueOf(),p);return{w:o(m),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,p){var{h:m}=l(c.valueOf(),f.valueOf(),p.valueOf());return{h:o(m),w:o(p)}},"Matrix, Matrix, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=u(p),{h}=l(c.valueOf(),f.valueOf(),m);return{h:o(h),w:o(m)}}});function l(s,c,f){for(var p=[],m=[],h=0;h<f.length;h++){for(var d=i(0,0),g=i(0,0),v=0;v<s.length;v++)d=t(d,n(s[v],i(Math.cos(-v*f[h]),Math.sin(-v*f[h]))));for(var w=0;w<c.length;w++)g=t(g,n(c[w],i(Math.cos(-w*f[h]),Math.sin(-w*f[h]))));p.push(d),m.push(g)}for(var y=[],x=0;x<p.length;x++)y.push(a(p[x],m[x]));return{h:y,w:f}}function u(s){for(var c=[],f=0;f<s;f++)c.push(f/s*Math.PI);return c}});var KJ="reviver",eY=["classes"],y1=N(KJ,eY,r=>{var{classes:e}=r;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var tY="replacer",rY=[],b1=N(tY,rY,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var yk="12.3.2";var x1=N("true",[],()=>!0),w1=N("false",[],()=>!1),_1=N("null",[],()=>null),A1=ni("Infinity",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1/0):1/0}),S1=ni("NaN",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(NaN):NaN}),E1=ni("pi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?Pl(t):KN}),D1=ni("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?wT(t):eC}),N1=ni("e",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?bT(t):tC}),C1=ni("phi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?xT(t):rC}),M1=ni("LN2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),T1=ni("LN10",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),F1=ni("LOG2E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),I1=ni("LOG10E",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),B1=ni("SQRT1_2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),P1=ni("SQRT2",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),O1=ni("i",["Complex"],r=>{var{Complex:e}=r;return e.I});var k1=N("version",[],()=>yk);function ni(r,e,t){return N(r,e,t,{recreateOnConfigChange:!0})}var R1=Ct("speedOfLight","299792458","m s^-1"),L1=Ct("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),U1=Ct("planckConstant","6.62607015e-34","J s"),V1=Ct("reducedPlanckConstant","1.0545718176461565e-34","J s"),$1=Ct("magneticConstant","1.25663706212e-6","N A^-2"),q1=Ct("electricConstant","8.8541878128e-12","F m^-1"),z1=Ct("vacuumImpedance","376.730313667","ohm"),H1=Ct("coulomb","8.987551792261171e9","N m^2 C^-2"),G1=Ct("elementaryCharge","1.602176634e-19","C"),W1=Ct("bohrMagneton","9.2740100783e-24","J T^-1"),j1=Ct("conductanceQuantum","7.748091729863649e-5","S"),Z1=Ct("inverseConductanceQuantum","12906.403729652257","ohm"),J1=Ct("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Y1=Ct("nuclearMagneton","5.0507837461e-27","J T^-1"),X1=Ct("klitzing","25812.807459304513","ohm");var Q1=Ct("bohrRadius","5.29177210903e-11","m"),K1=Ct("classicalElectronRadius","2.8179403262e-15","m"),ew=Ct("electronMass","9.1093837015e-31","kg"),tw=Ct("fermiCoupling","1.1663787e-5","GeV^-2"),rw=bm("fineStructure",.0072973525693),nw=Ct("hartreeEnergy","4.3597447222071e-18","J"),iw=Ct("protonMass","1.67262192369e-27","kg"),aw=Ct("deuteronMass","3.3435830926e-27","kg"),ow=Ct("neutronMass","1.6749271613e-27","kg"),sw=Ct("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),uw=Ct("rydberg","10973731.568160","m^-1"),lw=Ct("thomsonCrossSection","6.6524587321e-29","m^2"),cw=bm("weakMixingAngle",.2229),fw=bm("efimovFactor",22.7),pw=Ct("atomicMass","1.66053906660e-27","kg"),mw=Ct("avogadro","6.02214076e23","mol^-1"),dw=Ct("boltzmann","1.380649e-23","J K^-1"),hw=Ct("faraday","96485.33212331001","C mol^-1"),gw=Ct("firstRadiation","3.7417718521927573e-16","W m^2"),vw=Ct("loschmidt","2.686780111798444e25","m^-3"),yw=Ct("gasConstant","8.31446261815324","J K^-1 mol^-1"),bw=Ct("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),xw=Ct("molarVolume","0.022413969545014137","m^3 mol^-1"),ww=bm("sackurTetrode",-1.16487052358),_w=Ct("secondRadiation","0.014387768775039337","m K"),Aw=Ct("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Sw=Ct("wienDisplacement","2.897771955e-3","m K"),Ew=Ct("molarMass","0.99999999965e-3","kg mol^-1"),Dw=Ct("molarMassC12","11.9999999958e-3","kg mol^-1"),Nw=Ct("gravity","9.80665","m s^-2"),Cw=Ct("planckLength","1.616255e-35","m"),Mw=Ct("planckMass","2.176435e-8","kg"),Tw=Ct("planckTime","5.391245e-44","s"),Fw=Ct("planckCharge","1.87554603778e-18","C"),Iw=Ct("planckTemperature","1.416785e+32","K");function Ct(r,e,t){var n=["config","Unit","BigNumber"];return N(r,n,i=>{var{config:a,Unit:o,BigNumber:l}=i,u=a.number==="BigNumber"?new l(e):parseFloat(e),s=new o(u,t);return s.fixPrefix=!0,s})}function bm(r,e){var t=["config","BigNumber"];return N(r,t,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}var nY="apply",iY=["typed","isInteger"],Bw=N(nY,iY,r=>{var{typed:e,isInteger:t}=r,n=as({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];it(o)?a[1]=o-1:Xe(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(l){throw ur(l)}}})},{isTransformFunction:!0});var aY="column",oY=["typed","Index","matrix","range"],Pw=N(aY,oY,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=Sl({typed:e,Index:t,matrix:n,range:i});return e("column",{"...any":function(l){var u=l.length-1,s=l[u];it(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw ur(c)}}})},{isTransformFunction:!0});function xu(r,e,t){var n=r.filter(function(u){return ar(u)&&!(u.name in e)&&!t.has(u.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+r+'"');var i=n.name,a=new Map,o=new ou(t,a,new Set([i])),l=r.compile();return function(s){return a.set(i,s),l.evaluate(o)}}var sY="filter",uY=["typed"],Ow=N(sY,uY,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(ar(i[1])||Xi(i[1])?u=i[1].compile().evaluate(o):u=xu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("filter",{"Array, function":bk,"Matrix, function":function(a,o){return a.create(bk(a.toArray(),o))},"Array, RegExp":iu,"Matrix, RegExp":function(a,o){return a.create(iu(a.toArray(),o))}});return t},{isTransformFunction:!0});function bk(r,e){return xp(r,function(t,n,i){return bi(e,t,[n+1],i,"filter")})}var lY="forEach",cY=["typed"],kw=N(lY,cY,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(ar(i[1])||Xi(i[1])?u=i[1].compile().evaluate(o):u=xu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("forEach",{"Array | Matrix, function":function(a,o){var l=function u(s,c){if(Array.isArray(s))Ka(s,function(f,p){u(f,c.concat(p+1))});else return bi(o,s,c,a,"forEach")};l(a.valueOf(),[])}});return t},{isTransformFunction:!0});var fY="index",pY=["Index","getMatrixDataType"],Rw=N(fY,pY,r=>{var{Index:e,getMatrixDataType:t}=r;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var l=arguments[a];if(tu(l))l.start--,l.end-=l.step>0?0:2;else if(l&&l.isSet===!0)l=l.map(function(s){return s-1});else if(It(l)||Ge(l))t(l)!=="boolean"&&(l=l.map(function(s){return s-1}));else if(it(l))l--;else if(Xe(l))l=l.toNumber()-1;else if(typeof l!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=l}var u=new e;return e.apply(u,i),u}},{isTransformFunction:!0});var mY="map",dY=["typed"],Lw=N(mY,dY,r=>{var{typed:e}=r;function t(i,a,o){var l,u;return i[0]&&(l=i[0].compile().evaluate(o)),i[1]&&(ar(i[1])||Xi(i[1])?u=i[1].compile().evaluate(o):u=xu(i[1],a,o)),n(l,u)}t.rawArgs=!0;var n=e("map",{"Array, function":function(a,o){return xk(a,o,a)},"Matrix, function":function(a,o){return a.create(xk(a.valueOf(),o,a))}});return t},{isTransformFunction:!0});function xk(r,e,t){function n(i,a){return Array.isArray(i)?Rn(i,function(o,l){return n(o,a.concat(l+1))}):bi(e,i,a,t,"map")}return n(r,[])}function wn(r){if(r.length===2&&Cr(r[0])){r=r.slice();var e=r[1];it(e)?r[1]=e-1:Xe(e)&&(r[1]=e.minus(1))}return r}var hY="max",gY=["typed","config","numeric","larger"],Uw=N(hY,gY,r=>{var{typed:e,config:t,numeric:n,larger:i}=r,a=Il({typed:e,config:t,numeric:n,larger:i});return e("max",{"...any":function(l){l=wn(l);try{return a.apply(null,l)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var vY="mean",yY=["typed","add","divide"],Vw=N(vY,yY,r=>{var{typed:e,add:t,divide:n}=r,i=Ll({typed:e,add:t,divide:n});return e("mean",{"...any":function(o){o=wn(o);try{return i.apply(null,o)}catch(l){throw ur(l)}}})},{isTransformFunction:!0});var bY="min",xY=["typed","config","numeric","smaller"],$w=N(bY,xY,r=>{var{typed:e,config:t,numeric:n,smaller:i}=r,a=Bl({typed:e,config:t,numeric:n,smaller:i});return e("min",{"...any":function(l){l=wn(l);try{return a.apply(null,l)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var wY="range",_Y=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],qw=N(wY,_Y,r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c}=r,f=Nl({typed:e,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:l,largerEq:u,add:s,isPositive:c});return e("range",{"...any":function(m){var h=m.length-1,d=m[h];return typeof d!="boolean"&&m.push(!0),f.apply(null,m)}})},{isTransformFunction:!0});var AY="row",SY=["typed","Index","matrix","range"],zw=N(AY,SY,r=>{var{typed:e,Index:t,matrix:n,range:i}=r,a=Cl({typed:e,Index:t,matrix:n,range:i});return e("row",{"...any":function(l){var u=l.length-1,s=l[u];it(s)&&(l[u]=s-1);try{return a.apply(null,l)}catch(c){throw ur(c)}}})},{isTransformFunction:!0});var EY="subset",DY=["typed","matrix","zeros","add"],Hw=N(EY,DY,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=Ml({typed:e,matrix:t,zeros:n,add:i});return e("subset",{"...any":function(l){try{return a.apply(null,l)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var NY="concat",CY=["typed","matrix","isInteger"],Gw=N(NY,CY,r=>{var{typed:e,matrix:t,isInteger:n}=r,i=Al({typed:e,matrix:t,isInteger:n});return e("concat",{"...any":function(o){var l=o.length-1,u=o[l];it(u)?o[l]=u-1:Xe(u)&&(o[l]=u.minus(1));try{return i.apply(null,o)}catch(s){throw ur(s)}}})},{isTransformFunction:!0});var wk="diff",MY=["typed","matrix","subtract","number","bignumber"],Ww=N(wk,MY,r=>{var{typed:e,matrix:t,subtract:n,number:i,bignumber:a}=r,o=Dl({typed:e,matrix:t,subtract:n,number:i,bignumber:a});return e(wk,{"...any":function(u){u=wn(u);try{return o.apply(null,u)}catch(s){throw ur(s)}}})},{isTransformFunction:!0});var TY="std",FY=["typed","map","sqrt","variance"],jw=N(TY,FY,r=>{var{typed:e,map:t,sqrt:n,variance:i}=r,a=$l({typed:e,map:t,sqrt:n,variance:i});return e("std",{"...any":function(l){l=wn(l);try{return a.apply(null,l)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var _k="sum",IY=["typed","config","add","numeric"],Zw=N(_k,IY,r=>{var{typed:e,config:t,add:n,numeric:i}=r,a=kl({typed:e,config:t,add:n,numeric:i});return e(_k,{"...any":function(l){l=wn(l);try{return a.apply(null,l)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var BY="quantileSeq",PY=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Jw=N(BY,PY,r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p}=r,m=Vl({typed:e,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:l,compare:u,isInteger:s,smaller:c,smallerEq:f,larger:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(d,g,v)=>m(d,g,h(v)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(d,g,v,w)=>m(d,g,v,h(w)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(d,g,v)=>m(d,g,h(v)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(d,g,v,w)=>m(d,g,v,h(w))});function h(d){return wn([[],d])[1]}},{isTransformFunction:!0});var Ak="cumsum",OY=["typed","add","unaryPlus"],Yw=N(Ak,OY,r=>{var{typed:e,add:t,unaryPlus:n}=r,i=Rl({typed:e,add:t,unaryPlus:n});return e(Ak,{"...any":function(o){if(o.length===2&&Cr(o[0])){var l=o[1];it(l)?o[1]=l-1:Xe(l)&&(o[1]=l.minus(1))}try{return i.apply(null,o)}catch(u){throw ur(u)}}})},{isTransformFunction:!0});var Sk="variance",kY=["typed","add","subtract","multiply","divide","apply","isNaN"],Xw=N(Sk,kY,r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l}=r,u=Ul({typed:e,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:l});return e(Sk,{"...any":function(c){c=wn(c);try{return u.apply(null,c)}catch(f){throw ur(f)}}})},{isTransformFunction:!0});var Ek="print",RY=["typed","matrix","zeros","add"],Qw=N(Ek,RY,r=>{var{typed:e,matrix:t,zeros:n,add:i}=r,a=Tl({typed:e,matrix:t,zeros:n,add:i});return e(Ek,{"string, Object | Array":function(u,s){return a(o(u),s)},"string, Object | Array, number | Object":function(u,s,c){return a(o(u),s,c)}});function o(l){return l.replace(Vp,u=>{var s=u.slice(1).split("."),c=s.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var LY="and",UY=["typed","matrix","zeros","add","equalScalar","not","concat"],Kw=N(LY,UY,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=Fl({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(s,c,f){var p=s[0].compile().evaluate(f);if(!Cr(p)&&!l(p,!0))return!1;var m=s[1].compile().evaluate(f);return l(p,m)}return u.rawArgs=!0,u},{isTransformFunction:!0});var VY="or",$Y=["typed","matrix","equalScalar","DenseMatrix","concat"],e_=N(VY,$Y,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=_l({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function l(u,s,c){var f=u[0].compile().evaluate(c);if(!Cr(f)&&o(f,!1))return!0;var p=u[1].compile().evaluate(c);return o(f,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var qY="bitAnd",zY=["typed","matrix","zeros","add","equalScalar","not","concat"],t_=N(qY,zY,r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=r,l=xl({typed:e,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(s,c,f){var p=s[0].compile().evaluate(f);if(!Cr(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=s[1].compile().evaluate(f);return l(p,m)}return u.rawArgs=!0,u},{isTransformFunction:!0});var HY="bitOr",GY=["typed","matrix","equalScalar","DenseMatrix","concat"],r_=N(HY,GY,r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=r,o=wl({typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function l(u,s,c){var f=u[0].compile().evaluate(c);if(!Cr(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var p=u[1].compile().evaluate(c);return o(f,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Ue=xg({config:_e}),lr=_g({}),n_=N1({BigNumber:Ue,config:_e}),Dk=w1({}),Nk=rw({BigNumber:Ue,config:_e}),co=Sg({}),i_=O1({Complex:lr}),Ck=A1({BigNumber:Ue,config:_e}),Mk=T1({BigNumber:Ue,config:_e}),Tk=I1({BigNumber:Ue,config:_e}),Hl=Dg({}),Fk=S1({BigNumber:Ue,config:_e}),Ik=_1({}),Bk=C1({BigNumber:Ue,config:_e}),Pk=Eg({}),a_=mg({}),Ok=B1({BigNumber:Ue,config:_e}),kk=ww({BigNumber:Ue,config:_e}),o_=D1({BigNumber:Ue,config:_e}),Rk=x1({}),Lk=k1({}),Tt=Ng({Matrix:Hl}),Uk=fw({BigNumber:Ue,config:_e}),Vk=M1({BigNumber:Ue,config:_e}),xm=E1({BigNumber:Ue,config:_e}),$k=b1({}),qk=P1({BigNumber:Ue,config:_e}),Q=pg({BigNumber:Ue,Complex:lr,DenseMatrix:Tt,Fraction:co}),wm=Yv({BigNumber:Ue,config:_e,typed:Q}),zk=cw({BigNumber:Ue,config:_e}),_n=Xv({typed:Q}),Hk=Q0({Complex:lr,config:_e,typed:Q}),Gk=eb({BigNumber:Ue,typed:Q}),Wk=rb({BigNumber:Ue,Complex:lr,config:_e,typed:Q}),Hr=Qv({typed:Q}),jk=Ny({typed:Q}),Zk=ab({BigNumber:Ue,Complex:lr,config:_e,typed:Q}),Jk=sb({typed:Q}),s_=ub({typed:Q}),Yk=cb({Complex:lr,config:_e,typed:Q}),$n=$v({BigNumber:Ue,typed:Q}),Xk=Ey({typed:Q}),Qk=Vv({typed:Q}),Kk=Cg({typed:Q}),Gl=Lx({typed:Q}),Wl=qv({Complex:lr,typed:Q}),fo=Cy({typed:Q}),_m=fb({typed:Q}),e3=mb({BigNumber:Ue,typed:Q}),t3=hb({BigNumber:Ue,typed:Q}),r3=ny({typed:Q}),kt=kv({config:_e,typed:Q}),n3=i0({typed:Q}),u_=iy({typed:Q}),i3=ay({Complex:lr,typed:Q}),a3=ky({typed:Q}),o3=Ly({typed:Q}),wu=u0({typed:Q}),Am=Uy({typed:Q}),s3=f0({format:wu,typed:Q}),Sm=My({typed:Q}),Fn=Tg({typed:Q}),Ea=Mv({typed:Q}),po=Iv({typed:Q}),_i=Bv({typed:Q}),u3=F1({BigNumber:Ue,config:_e}),l3=$x({Complex:lr,typed:Q}),c3=py({Complex:lr,config:_e,typed:Q}),l_=my({Complex:lr,config:_e,typed:Q}),mo=qy({typed:Q}),Mr=dy({typed:Q}),jl=Fy({typed:Q}),ra=Lv({typed:Q}),f3=c0({format:wu,typed:Q}),p3=Kx({config:_e,typed:Q}),m3=Tl({typed:Q}),d3=e1({config:_e,typed:Q}),Em=Ty({typed:Q}),h3=vb({BigNumber:Ue,typed:Q}),c_=vy({BigNumber:Ue,Fraction:co,complex:Wl,typed:Q}),Zl=bb({typed:Q}),na=Rv({Matrix:Hl,equalScalar:kt,typed:Q}),g3=Zv({typed:Q}),v3=by({typed:Q}),y3=Uv({typed:Q}),ii=Kv({typed:Q}),b3=wb({typed:Q}),f_=Ov({typed:Q}),x3=K0({Complex:lr,config:_e,typed:Q}),w3=nb({BigNumber:Ue,typed:Q}),Dm=as({isInteger:Fn,typed:Q}),_3=ib({BigNumber:Ue,Complex:lr,config:_e,typed:Q}),A3=l0({format:wu,typed:Q}),S3=Ux({typed:Q}),E3=pb({typed:Q}),D3=gb({BigNumber:Ue,typed:Q}),_u=Pv({typed:Q}),N3=m0({typed:Q}),C3=t1({config:_e,typed:Q}),M3=yb({BigNumber:Ue,typed:Q}),T3=xb({typed:Q}),F3=Y0({SparseMatrix:na,typed:Q}),Ai=yy({Complex:lr,config:_e,typed:Q}),I3=_b({typed:Q}),Hi=Jv({typed:Q}),B3=tb({BigNumber:Ue,Complex:lr,config:_e,typed:Q}),P3=db({BigNumber:Ue,typed:Q}),ls=zv({Fraction:co,typed:Q}),ho=Tv({typed:Q}),ke=Hv({DenseMatrix:Tt,Matrix:Hl,SparseMatrix:na,typed:Q}),O3=Gv({isZero:_i,matrix:ke,typed:Q}),k3=o0({isNaN:_u,isNumeric:ho,typed:Q}),Si=d0({bignumber:$n,fraction:ls,number:ra}),p_=s0({config:_e,multiplyScalar:Mr,numeric:Si,typed:Q}),m_=Hy({isInteger:Fn,matrix:ke,typed:Q}),an=Zy({matrix:ke,config:_e,typed:Q}),R3=Jy({matrix:ke,typed:Q}),Au=Yy({matrix:ke,typed:Q}),d_=wy({BigNumber:Ue,config:_e,matrix:ke,typed:Q}),on=Qy({BigNumber:Ue,config:_e,matrix:ke,typed:Q}),L3=ob({Complex:lr,config:_e,typed:Q}),h_=ey({BigNumber:Ue,Complex:lr,Fraction:co,config:_e,isNegative:Ea,matrix:ke,typed:Q,unaryMinus:Hi}),Wt=Al({isInteger:Fn,matrix:ke,typed:Q}),U3=By({prod:p_,size:an,typed:Q}),Nm=Xy({conj:fo,transpose:Au,typed:Q}),g_=Oy({DenseMatrix:Tt,SparseMatrix:na,matrix:ke,typed:Q}),wr=h0({numeric:Si,typed:Q}),Su=_0({DenseMatrix:Tt,concat:Wt,divideScalar:wr,equalScalar:kt,matrix:ke,typed:Q}),ai=B0({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),Eu=Ry({matrix:ke,typed:Q}),V3=Fv({isNumeric:ho,typed:Q}),Da=Vy({BigNumber:Ue,DenseMatrix:Tt,SparseMatrix:na,config:_e,matrix:ke,typed:Q}),$3=$y({matrix:ke,multiplyScalar:Mr,typed:Q}),Jl=L0({DenseMatrix:Tt,concat:Wt,config:_e,matrix:ke,typed:Q}),q3=N0({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q,zeros:on}),v_=A0({DenseMatrix:Tt,divideScalar:wr,equalScalar:kt,matrix:ke,multiplyScalar:Mr,subtractScalar:ii,typed:Q}),Cm=jv({flatten:Eu,matrix:ke,size:an,typed:Q}),z3=gy({BigNumber:Ue,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),H3=zy({BigNumber:Ue,config:_e,matrix:ke,typed:Q}),Mm=cx({addScalar:Hr,complex:Wl,conj:fo,divideScalar:wr,equal:ai,identity:Da,isZero:_i,matrix:ke,multiplyScalar:Mr,sign:c_,sqrt:Ai,subtractScalar:ii,typed:Q,unaryMinus:Hi,zeros:on}),G3=Gy({config:_e,matrix:ke}),W3=C0({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q,zeros:on}),cs=v0({BigNumber:Ue,DenseMatrix:Tt,equalScalar:kt,matrix:ke,typed:Q,zeros:on}),An=O0({DenseMatrix:Tt,concat:Wt,config:_e,matrix:ke,typed:Q}),Tr=xy({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,subtractScalar:ii,typed:Q,unaryMinus:Hi}),j3=p0({concat:Wt,matrix:ke,typed:Q}),Z3=V0({DenseMatrix:Tt,concat:Wt,config:_e,equalScalar:kt,matrix:ke,typed:Q}),Tm=S0({DenseMatrix:Tt,divideScalar:wr,equalScalar:kt,matrix:ke,multiplyScalar:Mr,subtractScalar:ii,typed:Q}),J3=Iy({DenseMatrix:Tt,concat:Wt,matrix:ke,typed:Q}),Ut=Bb({DenseMatrix:Tt,SparseMatrix:na,addScalar:Hr,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),Y3=lb({BigNumber:Ue,DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),X3=xl({concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),Q3=wl({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),K3=Dy({DenseMatrix:Tt,concat:Wt,matrix:ke,typed:Q}),eR=i1({addScalar:Hr,combinations:Gl,divideScalar:wr,isInteger:Fn,isNegative:Ea,multiplyScalar:Mr,typed:Q}),go=T0({BigNumber:Ue,DenseMatrix:Tt,Fraction:co,concat:Wt,config:_e,equalScalar:kt,matrix:ke,typed:Q}),y_=I0({concat:Wt,matrix:ke,typed:Q}),tR=Rl({add:Ut,typed:Q,unaryPlus:wm}),Fm=U0({equal:ai,typed:Q}),rR=Dl({matrix:ke,number:ra,subtract:Tr,typed:Q}),nR=Ix({abs:_n,addScalar:Hr,deepEqual:Fm,divideScalar:wr,multiplyScalar:Mr,sqrt:Ai,subtractScalar:ii,typed:Q}),Yl=kb({addScalar:Hr,conj:fo,multiplyScalar:Mr,size:an,typed:Q}),iR=P0({compareText:y_,isZero:_i,typed:Q}),b_=yl({DenseMatrix:Tt,config:_e,equalScalar:kt,matrix:ke,round:cs,typed:Q,zeros:on}),aR=cy({BigNumber:Ue,DenseMatrix:Tt,concat:Wt,config:_e,equalScalar:kt,matrix:ke,round:cs,typed:Q,zeros:on}),oR=Pb({abs:_n,addScalar:Hr,divideScalar:wr,isPositive:po,multiplyScalar:Mr,smaller:An,sqrt:Ai,typed:Q}),x_=z0({DenseMatrix:Tt,smaller:An}),dn=H0({ImmutableDenseMatrix:x_,getMatrixDataType:Am}),Sn=R0({DenseMatrix:Tt,concat:Wt,config:_e,matrix:ke,typed:Q}),Im=y0({Complex:lr,config:_e,divideScalar:wr,typed:Q}),sR=E0({DenseMatrix:Tt,divideScalar:wr,equalScalar:kt,matrix:ke,multiplyScalar:Mr,subtractScalar:ii,typed:Q}),uR=Wv({flatten:Eu,matrix:ke,size:an,typed:Q}),lR=Bl({config:_e,numeric:Si,smaller:An,typed:Q}),w_=bl({DenseMatrix:Tt,concat:Wt,config:_e,equalScalar:kt,matrix:ke,round:cs,typed:Q,zeros:on}),Xt=hy({addScalar:Hr,dot:Yl,equalScalar:kt,matrix:ke,multiplyScalar:Mr,typed:Q}),cR=x0({Complex:lr,config:_e,divideScalar:wr,typed:Q}),fR=_l({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),Xl=$0({compare:go,isNaN:_u,isNumeric:ho,typed:Q}),pR=M0({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q,zeros:on}),__=px({SparseMatrix:na,abs:_n,add:Ut,divideScalar:wr,larger:Sn,largerEq:Jl,multiply:Xt,subtract:Tr,transpose:Au,typed:Q}),qn=Ml({add:Ut,matrix:ke,typed:Q,zeros:on}),Bm=kl({add:Ut,config:_e,numeric:Si,typed:Q}),mR=Rb({add:Ut,matrix:ke,typed:Q}),A_=D0({DenseMatrix:Tt,divideScalar:wr,equalScalar:kt,matrix:ke,multiplyScalar:Mr,subtractScalar:ii,typed:Q}),dR=g1({Complex:lr,add:Ut,multiply:Xt,number:ra,typed:Q}),Pm=ry({DenseMatrix:Tt,config:_e,equalScalar:kt,matrix:ke,round:cs,typed:Q,zeros:on}),Gi=F0({compare:go,typed:Q}),hR=a1({addScalar:Hr,combinations:Gl,isInteger:Fn,isNegative:Ea,isPositive:po,larger:Sn,typed:Q}),gR=Py({matrix:ke,multiply:Xt,subtract:Tr,typed:Q}),S_=_x({divideScalar:wr,isZero:_i,matrix:ke,multiply:Xt,subtractScalar:ii,typed:Q,unaryMinus:Hi}),vR=Ay({concat:Wt,equalScalar:kt,matrix:ke,multiplyScalar:Mr,typed:Q}),E_=G0({larger:Sn,smaller:An}),D_=sy({Complex:lr,DenseMatrix:Tt,ceil:Pm,equalScalar:kt,floor:b_,matrix:ke,typed:Q,zeros:on}),N_=Lb({Index:dn,typed:Q}),yR=Bx({abs:_n,add:Ut,addScalar:Hr,config:_e,divideScalar:wr,equalScalar:kt,flatten:Eu,isNumeric:ho,isZero:_i,matrix:ke,multiply:Xt,multiplyScalar:Mr,smaller:An,subtract:Tr,typed:Q}),bR=_y({BigNumber:Ue,add:Ut,config:_e,equal:ai,isInteger:Fn,mod:w_,smaller:An,typed:Q,xgcd:d_}),xR=fy({concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),wR=b0({Complex:lr,config:_e,divideScalar:wr,log:Im,typed:Q}),Om=Il({config:_e,larger:Sn,numeric:Si,typed:Q}),_R=Ab({DenseMatrix:Tt,Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),AR=Eb({DenseMatrix:Tt,Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),SR=Nb({Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),ER=Mb({Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),fs=k0({DenseMatrix:Tt,concat:Wt,config:_e,matrix:ke,typed:Q}),DR=q0({compare:go,compareNatural:Gi,matrix:ke,typed:Q}),NR=Fl({concat:Wt,equalScalar:kt,matrix:ke,not:jl,typed:Q,zeros:on}),ps=Nl({bignumber:$n,matrix:ke,add:Ut,config:_e,isPositive:po,larger:Sn,largerEq:Jl,smaller:An,smallerEq:fs,typed:Q}),CR=Cl({Index:dn,matrix:ke,range:ps,typed:Q}),C_=Sb({DenseMatrix:Tt,Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),MR=Cb({Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),M_=Fb({Index:dn,concat:Wt,setDifference:C_,size:an,subset:qn,typed:Q}),T_=W0({FibonacciHeap:E_,addScalar:Hr,equalScalar:kt}),F_=Sl({Index:dn,matrix:ke,range:ps,typed:Q}),vo=Ax({abs:_n,addScalar:Hr,det:S_,divideScalar:wr,identity:Da,matrix:ke,multiply:Xt,typed:Q,unaryMinus:Hi}),I_=lx({DenseMatrix:Tt,Spa:T_,SparseMatrix:na,abs:_n,addScalar:Hr,divideScalar:wr,equalScalar:kt,larger:Sn,matrix:ke,multiplyScalar:Mr,subtractScalar:ii,typed:Q,unaryMinus:Hi}),TR=Sx({Complex:lr,add:Ut,ctranspose:Nm,deepEqual:Fm,divideScalar:wr,dot:Yl,dotDivide:Su,equal:ai,inv:vo,matrix:ke,multiply:Xt,typed:Q}),oi=g0({Complex:lr,config:_e,fraction:ls,identity:Da,inv:vo,matrix:ke,multiply:Xt,number:ra,typed:Q}),B_=Db({DenseMatrix:Tt,Index:dn,compareNatural:Gi,size:an,subset:qn,typed:Q}),FR=Ib({Index:dn,concat:Wt,setIntersect:B_,setSymDifference:M_,size:an,subset:qn,typed:Q}),IR=Nx({abs:_n,add:Ut,identity:Da,inv:vo,map:mo,max:Om,multiply:Xt,size:an,sqrt:Ai,subtract:Tr,typed:Q}),yt=Z0({BigNumber:Ue,Complex:lr,Fraction:co,abs:_n,addScalar:Hr,config:_e,divideScalar:wr,equal:ai,fix:D_,format:wu,isNumeric:ho,multiplyScalar:Mr,number:ra,pow:oi,round:cs,subtractScalar:ii}),BR=z1({BigNumber:Ue,Unit:yt,config:_e}),PR=Sw({BigNumber:Ue,Unit:yt,config:_e}),OR=pw({BigNumber:Ue,Unit:yt,config:_e}),kR=W1({BigNumber:Ue,Unit:yt,config:_e}),RR=dw({BigNumber:Ue,Unit:yt,config:_e}),LR=j1({BigNumber:Ue,Unit:yt,config:_e}),UR=H1({BigNumber:Ue,Unit:yt,config:_e}),VR=aw({BigNumber:Ue,Unit:yt,config:_e}),$R=w0({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,pow:oi,typed:Q}),qR=q1({BigNumber:Ue,Unit:yt,config:_e}),zR=G1({BigNumber:Ue,Unit:yt,config:_e}),HR=Dx({abs:_n,add:Ut,identity:Da,inv:vo,multiply:Xt,typed:Q}),GR=hw({BigNumber:Ue,Unit:yt,config:_e}),P_=Ky({addScalar:Hr,ceil:Pm,conj:fo,divideScalar:wr,dotDivide:Su,exp:u_,i:i_,log2:l_,matrix:ke,multiplyScalar:Mr,pow:oi,tau:o_,typed:Q}),km=Vx({BigNumber:Ue,Complex:lr,config:_e,multiplyScalar:Mr,pow:oi,typed:Q}),WR=L1({BigNumber:Ue,Unit:yt,config:_e}),jR=nw({BigNumber:Ue,Unit:yt,config:_e}),ZR=e0({conj:fo,dotDivide:Su,fft:P_,typed:Q}),JR=X1({BigNumber:Ue,Unit:yt,config:_e}),YR=vw({BigNumber:Ue,Unit:yt,config:_e}),XR=$1({BigNumber:Ue,Unit:yt,config:_e}),QR=Ew({BigNumber:Ue,Unit:yt,config:_e}),KR=bw({BigNumber:Ue,Unit:yt,config:_e}),eL=ow({BigNumber:Ue,Unit:yt,config:_e}),tL=Y1({BigNumber:Ue,Unit:yt,config:_e}),rL=Fw({BigNumber:Ue,Unit:yt,config:_e}),nL=Cw({BigNumber:Ue,Unit:yt,config:_e}),iL=Iw({BigNumber:Ue,Unit:yt,config:_e}),aL=iw({BigNumber:Ue,Unit:yt,config:_e}),oL=sw({BigNumber:Ue,Unit:yt,config:_e}),sL=V1({BigNumber:Ue,Unit:yt,config:_e}),uL=uw({BigNumber:Ue,Unit:yt,config:_e}),lL=_w({BigNumber:Ue,Unit:yt,config:_e}),cL=R1({BigNumber:Ue,Unit:yt,config:_e}),fL=Aw({BigNumber:Ue,Unit:yt,config:_e}),pL=lw({BigNumber:Ue,Unit:yt,config:_e}),mL=mw({BigNumber:Ue,Unit:yt,config:_e}),dL=Q1({BigNumber:Ue,Unit:yt,config:_e}),hL=X0({Unit:yt,typed:Q}),Qr=Fx({divideScalar:wr,equalScalar:kt,inv:vo,matrix:ke,multiply:Xt,typed:Q}),gL=ew({BigNumber:Ue,Unit:yt,config:_e}),Du=qx({gamma:km,typed:Q}),vL=gw({BigNumber:Ue,Unit:yt,config:_e}),yL=Nw({BigNumber:Ue,Unit:yt,config:_e}),bL=Z1({BigNumber:Ue,Unit:yt,config:_e}),O_=dx({DenseMatrix:Tt,lsolve:v_,lup:I_,matrix:ke,slu:__,typed:Q,usolve:Tm}),xL=J1({BigNumber:Ue,Unit:yt,config:_e}),wL=Dw({BigNumber:Ue,Unit:yt,config:_e}),_L=Hx({add:Ut,divide:Qr,factorial:Du,isInteger:Fn,isPositive:po,multiply:Xt,typed:Q}),AL=Gx({factorial:Du,typed:Q}),SL=Mw({BigNumber:Ue,Unit:yt,config:_e}),EL=hx({add:Ut,cbrt:h_,divide:Qr,equalScalar:kt,im:Sm,isZero:_i,multiply:Xt,re:Em,sqrt:Ai,subtract:Tr,typeOf:f_,typed:Q,unaryMinus:Hi}),DL=Tb({compareNatural:Gi,typed:Q}),NL=n0({abs:_n,add:Ut,bignumber:$n,divide:Qr,isNegative:Ea,isPositive:po,larger:Sn,map:mo,matrix:ke,max:Om,multiply:Xt,smaller:An,subtract:Tr,typed:Q,unaryMinus:Hi}),k_=r1({bignumber:$n,addScalar:Hr,combinations:Gl,divideScalar:wr,factorial:Du,isInteger:Fn,isNegative:Ea,larger:Sn,multiplyScalar:Mr,number:ra,pow:oi,subtractScalar:ii,typed:Q}),CL=J0({Unit:yt,typed:Q}),ML=n1({addScalar:Hr,isInteger:Fn,isNegative:Ea,stirlingS2:k_,typed:Q}),R_=Ex({abs:_n,add:Ut,addScalar:Hr,atan:s_,bignumber:$n,column:F_,complex:Wl,config:_e,cos:_m,diag:g_,divideScalar:wr,dot:Yl,equal:ai,flatten:Eu,im:Sm,inv:vo,larger:Sn,matrix:ke,matrixFromColumns:Cm,multiply:Xt,multiplyScalar:Mr,number:ra,qr:Mm,re:Em,reshape:m_,sin:Zl,size:an,smaller:An,sqrt:Ai,subtract:Tr,typed:Q,usolve:Tm,usolveAll:A_}),TL=tw({BigNumber:Ue,Unit:yt,config:_e}),FL=yw({BigNumber:Ue,Unit:yt,config:_e}),IL=zx({divide:Qr,dotDivide:Su,isNumeric:ho,log:Im,map:mo,matrix:ke,multiply:Xt,sum:Bm,typed:Q}),L_=Ll({add:Ut,divide:Qr,typed:Q}),BL=xw({BigNumber:Ue,Unit:yt,config:_e}),PL=U1({BigNumber:Ue,Unit:yt,config:_e}),OL=Vl({bignumber:$n,add:Ut,compare:go,divide:Qr,isInteger:Fn,larger:Sn,multiply:Xt,partitionSelect:Xl,smaller:An,smallerEq:fs,subtract:Tr,typed:Q}),Rm=Ul({add:Ut,apply:Dm,divide:Qr,isNaN:_u,multiply:Xt,subtract:Tr,typed:Q}),kL=K1({BigNumber:Ue,Unit:yt,config:_e}),U_=Px({add:Ut,compare:go,divide:Qr,partitionSelect:Xl,typed:Q}),RL=Rx({add:Ut,divide:Qr,matrix:ke,mean:L_,multiply:Xt,pow:oi,sqrt:Ai,subtract:Tr,sum:Bm,typed:Q}),LL=v1({Complex:lr,add:Ut,divide:Qr,matrix:ke,multiply:Xt,typed:Q}),UL=Ox({abs:_n,map:mo,median:U_,subtract:Tr,typed:Q}),VL=$l({map:mo,sqrt:Ai,typed:Q,variance:Rm}),$L=a0({BigNumber:Ue,Complex:lr,add:Ut,config:_e,divide:Qr,equal:ai,factorial:Du,gamma:km,isNegative:Ea,multiply:Xt,pi:xm,pow:oi,sin:Zl,smallerEq:fs,subtract:Tr,typed:Q}),Lm=Ob({abs:_n,add:Ut,conj:fo,ctranspose:Nm,eigs:R_,equalScalar:kt,larger:Sn,matrix:ke,multiply:Xt,pow:oi,smaller:An,sqrt:Ai,typed:Q}),V_=jy({BigNumber:Ue,DenseMatrix:Tt,SparseMatrix:na,addScalar:Hr,config:_e,cos:_m,matrix:ke,multiplyScalar:Mr,norm:Lm,sin:Zl,typed:Q,unaryMinus:Hi}),qL=Tw({BigNumber:Ue,Unit:yt,config:_e}),$_=Mx({identity:Da,matrix:ke,multiply:Xt,norm:Lm,qr:Mm,subtract:Tr,typed:Q}),zL=Wy({multiply:Xt,rotationMatrix:V_,typed:Q}),q_=Cx({abs:_n,add:Ut,concat:Wt,identity:Da,index:N_,lusolve:O_,matrix:ke,matrixFromColumns:Cm,multiply:Xt,range:ps,schur:$_,subset:qn,subtract:Tr,transpose:Au,typed:Q}),HL=Tx({matrix:ke,multiply:Xt,sylvester:q_,transpose:Au,typed:Q});var Nu={},Cu={},GL={},En=Ub({mathWithTransform:Cu}),Mu=Xb({Node:En}),Na=Qb({Node:En}),ms=Kb({Node:En}),WL=tx({Node:En}),Tu=$b({Node:En}),jL=zb({Node:En,ResultSet:a_}),ZL=Hb({Node:En}),yo=Zb({Node:En}),JL=ex({Node:En}),WY=y1({classes:GL}),z_=vx({math:Nu,typed:Q}),YL=Jb({Node:En,typed:Q}),jY=wx({Chain:z_,typed:Q}),Fu=Yb({Node:En,size:an}),Iu=Vb({Node:En,subset:qn}),XL=qb({matrix:ke,Node:En,subset:qn}),bo=rx({Unit:yt,Node:En,math:Nu}),xo=nx({Node:En,SymbolNode:bo,math:Nu}),ia=ix({AccessorNode:Iu,ArrayNode:Tu,AssignmentNode:XL,BlockNode:jL,ConditionalNode:ZL,ConstantNode:yo,FunctionAssignmentNode:YL,FunctionNode:xo,IndexNode:Fu,ObjectNode:Mu,OperatorNode:Na,ParenthesisNode:ms,RangeNode:JL,RelationalNode:WL,SymbolNode:bo,config:_e,numeric:Si,typed:Q}),QL=p1({ConstantNode:yo,FunctionNode:xo,OperatorNode:Na,ParenthesisNode:ms,parse:ia,typed:Q}),H_=c1({bignumber:$n,fraction:ls,AccessorNode:Iu,ArrayNode:Tu,ConstantNode:yo,FunctionNode:xo,IndexNode:Fu,ObjectNode:Mu,OperatorNode:Na,SymbolNode:bo,config:_e,mathWithTransform:Cu,matrix:ke,typed:Q}),G_=ax({parse:ia,typed:Q}),W_=f1({AccessorNode:Iu,ArrayNode:Tu,ConstantNode:yo,FunctionNode:xo,IndexNode:Fu,ObjectNode:Mu,OperatorNode:Na,ParenthesisNode:ms,SymbolNode:bo,add:Ut,divide:Qr,equal:ai,isZero:_i,multiply:Xt,parse:ia,pow:oi,subtract:Tr,typed:Q}),j_=ox({parse:ia,typed:Q}),KL=gx({evaluate:j_}),e4=sx({evaluate:j_}),Um=l1({bignumber:$n,fraction:ls,AccessorNode:Iu,ArrayNode:Tu,ConstantNode:yo,FunctionNode:xo,IndexNode:Fu,ObjectNode:Mu,OperatorNode:Na,ParenthesisNode:ms,SymbolNode:bo,add:Ut,config:_e,divide:Qr,equal:ai,isZero:_i,mathWithTransform:Cu,matrix:ke,multiply:Xt,parse:ia,pow:oi,resolve:QL,simplifyConstant:H_,simplifyCore:W_,subtract:Tr,typed:Q}),ZY=m1({OperatorNode:Na,parse:ia,simplify:Um,typed:Q}),JY=o1({parse:ia,typed:Q}),YY=ux({Parser:e4,typed:Q}),XY=h1({bignumber:$n,fraction:ls,AccessorNode:Iu,ArrayNode:Tu,ConstantNode:yo,FunctionNode:xo,IndexNode:Fu,ObjectNode:Mu,OperatorNode:Na,ParenthesisNode:ms,SymbolNode:bo,add:Ut,config:_e,divide:Qr,equal:ai,isZero:_i,mathWithTransform:Cu,matrix:ke,multiply:Xt,parse:ia,pow:oi,simplify:Um,simplifyConstant:H_,simplifyCore:W_,subtract:Tr,typed:Q}),QY=d1({ConstantNode:yo,FunctionNode:xo,OperatorNode:Na,ParenthesisNode:ms,SymbolNode:bo,config:_e,equal:ai,isZero:_i,numeric:Si,parse:ia,simplify:Um,typed:Q}),KY=xx({Help:KL,mathWithTransform:Cu,typed:Q});yr(Nu,{e:n_,false:Dk,fineStructure:Nk,i:i_,Infinity:Ck,LN10:Mk,LOG10E:Tk,NaN:Fk,null:Ik,phi:Bk,SQRT1_2:Ok,sackurTetrode:kk,tau:o_,true:Rk,E:n_,version:Lk,efimovFactor:Uk,LN2:Vk,pi:xm,replacer:$k,reviver:WY,SQRT2:qk,typed:Q,unaryPlus:wm,PI:xm,weakMixingAngle:zk,abs:_n,acos:Hk,acot:Gk,acsc:Wk,addScalar:Hr,arg:jk,asech:Zk,asinh:Jk,atan:s_,atanh:Yk,bignumber:$n,bitNot:Xk,boolean:Qk,clone:Kk,combinations:Gl,complex:Wl,conj:fo,cos:_m,cot:e3,csc:t3,cube:r3,equalScalar:kt,erf:n3,exp:u_,expm1:i3,filter:a3,forEach:o3,format:wu,getMatrixDataType:Am,hex:s3,im:Sm,isInteger:Fn,isNegative:Ea,isPositive:po,isZero:_i,LOG2E:u3,lgamma:l3,log10:c3,log2:l_,map:mo,multiplyScalar:Mr,not:jl,number:ra,oct:f3,pickRandom:p3,print:m3,random:d3,re:Em,sec:h3,sign:c_,sin:Zl,splitUnit:g3,square:v3,string:y3,subtractScalar:ii,tan:b3,typeOf:f_,acosh:x3,acsch:w3,apply:Dm,asec:_3,bin:A3,chain:jY,combinationsWithRep:S3,cosh:E3,csch:D3,isNaN:_u,isPrime:N3,randomInt:C3,sech:M3,sinh:T3,sparse:F3,sqrt:Ai,tanh:I3,unaryMinus:Hi,acoth:B3,coth:P3,fraction:ls,isNumeric:ho,matrix:ke,matrixFromFunction:O3,mode:k3,numeric:Si,prod:p_,reshape:m_,size:an,squeeze:R3,transpose:Au,xgcd:d_,zeros:on,asin:L3,cbrt:h_,concat:Wt,count:U3,ctranspose:Nm,diag:g_,divideScalar:wr,dotDivide:Su,equal:ai,flatten:Eu,hasNumericValue:V3,identity:Da,kron:$3,largerEq:Jl,leftShift:q3,lsolve:v_,matrixFromColumns:Cm,nthRoot:z3,ones:H3,qr:Mm,resize:G3,rightArithShift:W3,round:cs,smaller:An,subtract:Tr,to:j3,unequal:Z3,usolve:Tm,xor:J3,add:Ut,atan2:Y3,bitAnd:X3,bitOr:Q3,bitXor:K3,catalan:eR,compare:go,compareText:y_,cumsum:tR,deepEqual:Fm,diff:rR,distance:nR,dot:Yl,equalText:iR,floor:b_,gcd:aR,hypot:oR,larger:Sn,log:Im,lsolveAll:sR,matrixFromRows:uR,min:lR,mod:w_,multiply:Xt,nthRoots:cR,or:fR,partitionSelect:Xl,rightLogShift:pR,slu:__,subset:qn,sum:Bm,trace:mR,usolveAll:A_,zpk2tf:dR,ceil:Pm,compareNatural:Gi,composition:hR,cross:gR,det:S_,dotMultiply:vR,fix:D_,index:N_,intersect:yR,invmod:bR,lcm:xR,log1p:wR,max:Om,setCartesian:_R,setDistinct:AR,setIsSubset:SR,setPowerset:ER,smallerEq:fs,sort:DR,and:NR,range:ps,row:CR,setDifference:C_,setMultiplicity:MR,setSymDifference:M_,column:F_,inv:vo,lup:I_,pinv:TR,pow:oi,setIntersect:B_,setUnion:FR,sqrtm:IR,vacuumImpedance:BR,wienDisplacement:PR,atomicMass:OR,bohrMagneton:kR,boltzmann:RR,conductanceQuantum:LR,coulomb:UR,deuteronMass:VR,dotPow:$R,electricConstant:qR,elementaryCharge:zR,expm:HR,faraday:GR,fft:P_,gamma:km,gravitationConstant:WR,hartreeEnergy:jR,ifft:ZR,klitzing:JR,loschmidt:YR,magneticConstant:XR,molarMass:QR,molarPlanckConstant:KR,neutronMass:eL,nuclearMagneton:tL,planckCharge:rL,planckLength:nL,planckTemperature:iL,protonMass:aL,quantumOfCirculation:oL,reducedPlanckConstant:sL,rydberg:uL,secondRadiation:lL,speedOfLight:cL,stefanBoltzmann:fL,thomsonCrossSection:pL,avogadro:mL,bohrRadius:dL,createUnit:hL,divide:Qr,electronMass:gL,factorial:Du,firstRadiation:vL,gravity:yL,inverseConductanceQuantum:bL,lusolve:O_,magneticFluxQuantum:xL,molarMassC12:wL,multinomial:_L,parse:ia,permutations:AL,planckMass:SL,polynomialRoot:EL,resolve:QL,setSize:DL,simplifyConstant:H_,solveODE:NL,stirlingS2:k_,unit:CL,bellNumbers:ML,compile:G_,eigs:R_,fermiCoupling:TL,gasConstant:FL,kldivergence:IL,mean:L_,molarVolume:BL,planckConstant:PL,quantileSeq:OL,simplifyCore:W_,variance:Rm,classicalElectronRadius:kL,evaluate:j_,median:U_,simplify:Um,symbolicEqual:ZY,corr:RL,freqz:LL,leafCount:JY,mad:UL,parser:YY,rationalize:XY,std:VL,zeta:$L,derivative:QY,norm:Lm,rotationMatrix:V_,help:KY,planckTime:qL,schur:$_,rotate:zL,sylvester:q_,lyap:HL,config:_e});yr(Cu,Nu,{filter:Ow({typed:Q}),forEach:kw({typed:Q}),map:Lw({typed:Q}),apply:Bw({isInteger:Fn,typed:Q}),or:e_({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),and:Kw({add:Ut,concat:Wt,equalScalar:kt,matrix:ke,not:jl,typed:Q,zeros:on}),concat:Gw({isInteger:Fn,matrix:ke,typed:Q}),max:Uw({config:_e,larger:Sn,numeric:Si,typed:Q}),print:Qw({add:Ut,matrix:ke,typed:Q,zeros:on}),bitAnd:t_({add:Ut,concat:Wt,equalScalar:kt,matrix:ke,not:jl,typed:Q,zeros:on}),diff:Ww({bignumber:$n,matrix:ke,number:ra,subtract:Tr,typed:Q}),min:$w({config:_e,numeric:Si,smaller:An,typed:Q}),subset:Hw({add:Ut,matrix:ke,typed:Q,zeros:on}),bitOr:r_({DenseMatrix:Tt,concat:Wt,equalScalar:kt,matrix:ke,typed:Q}),cumsum:Yw({add:Ut,typed:Q,unaryPlus:wm}),index:Rw({Index:dn,getMatrixDataType:Am}),sum:Zw({add:Ut,config:_e,numeric:Si,typed:Q}),range:qw({bignumber:$n,matrix:ke,add:Ut,config:_e,isPositive:po,larger:Sn,largerEq:Jl,smaller:An,smallerEq:fs,typed:Q}),row:zw({Index:dn,matrix:ke,range:ps,typed:Q}),column:Pw({Index:dn,matrix:ke,range:ps,typed:Q}),mean:Vw({add:Ut,divide:Qr,typed:Q}),quantileSeq:Jw({add:Ut,bignumber:$n,compare:go,divide:Qr,isInteger:Fn,larger:Sn,multiply:Xt,partitionSelect:Xl,smaller:An,smallerEq:fs,subtract:Tr,typed:Q}),variance:Xw({add:Ut,apply:Dm,divide:Qr,isNaN:_u,multiply:Xt,subtract:Tr,typed:Q}),std:jw({map:mo,sqrt:Ai,typed:Q,variance:Rm})});yr(GL,{BigNumber:Ue,Complex:lr,Fraction:co,Matrix:Hl,Node:En,ObjectNode:Mu,OperatorNode:Na,ParenthesisNode:ms,Range:Pk,RelationalNode:WL,ResultSet:a_,ArrayNode:Tu,BlockNode:jL,ConditionalNode:ZL,ConstantNode:yo,DenseMatrix:Tt,RangeNode:JL,Chain:z_,FunctionAssignmentNode:YL,SparseMatrix:na,IndexNode:Fu,ImmutableDenseMatrix:x_,Index:dn,AccessorNode:Iu,AssignmentNode:XL,FibonacciHeap:E_,Spa:T_,Unit:yt,SymbolNode:bo,FunctionNode:xo,Help:KL,Parser:e4});z_.createProxy(Nu);var Vm=class extends Ja{constructor(e){super(e),this.hidden=!1,this.hasError=!1}buildVariables(){var t;let e=0;this.expressionStr="",this.variables=[];for(let n of(t=this.base.getDeclaration().templateDeclaration)!=null?t:[])if(typeof n!="string"){let i={bindTargetDeclaration:n,inputSignal:new _r(void 0),uuid:mr(),contextName:`MB_VAR_${e}`};this.variables.push(i),this.expressionStr+=i.contextName,e+=1}else this.expressionStr+=n;this.expression=G_(this.expressionStr)}buildMathJSContext(){var t,n;let e={};for(let i of(t=this.variables)!=null?t:[])!i.contextName||!i.inputSignal||(e[i.contextName]=(n=i.inputSignal.get())!=null?n:"");return e}computeValue(){var t;if(this.hasError=!1,!this.expression)return this.handleComputeError(new fa({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{return Qn((t=this.expression.evaluate(e))==null?void 0:t.toString())}catch(n){return n instanceof Error?this.handleComputeError(new fa({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:n,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of: unexpected thrown value"))}}onInitialRender(e){}onRerender(e,t){this.hasError?e.addClass("mb-error"):e.removeClass("mb-error"),e.innerText=t}handleComputeError(e){return this.hasError=!0,console.warn(e),e.message}};var $m=class extends Ja{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){var t;this.textParts=[];let e=0;this.variables=[];for(let n of(t=this.base.getDeclaration().templateDeclaration)!=null?t:[])if(typeof n!="string"){let i={bindTargetDeclaration:n,inputSignal:new _r(void 0),uuid:mr(),contextName:`MB_VAR_${e}`};this.variables.push(i),this.textParts.push(e),e+=1}else this.textParts.push(n)}computeValue(){if(!this.textParts)throw new fa({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="number"?of(this.variables[e].inputSignal.get(),this.base.plugin.settings.viewFieldDisplayNullAsEmpty):e).join("")}onInitialRender(e){var t,n;this.renderMarkdown=(n=(t=this.base.getArgument("renderMarkdown"))==null?void 0:t.value)!=null?n:!1,this.renderMarkdown&&e.addClass("mb-view-markdown")}async onRerender(e,t){var n;this.renderMarkdown?((n=this.markdownUnloadCallback)==null||n.call(this),this.markdownUnloadCallback=await this.base.plugin.internal.renderMarkdown(t,e,this.base.getFilePath())):e.innerText=t}onUnmount(){var e;super.onUnmount(),(e=this.markdownUnloadCallback)==null||e.call(this)}};function eX(r){let e,t;return e=new $f({props:{elements:r[0],$$slots:{default:[nX,({element:n})=>({1:n}),({element:n})=>n?2:0]},$$scope:{ctx:r}}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.elements=n[0]),i&6&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function tX(r){let e,t;return e=new Za({props:{mdLink:r[0][0]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&1&&(a.mdLink=n[0][0]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function rX(r){let e;return{c(){e=Z("span")},m(t,n){J(t,e,n)},p:Me,i:Me,o:Me,d(t){t&&j(e)}}}function nX(r){let e,t;return e=new Za({props:{mdLink:r[1]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&2&&(a.mdLink=n[1]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function iX(r){let e,t,n,i,a=[rX,tX,eX],o=[];function l(u,s){return u[0].length===0?0:u[0].length===1?1:2}return e=l(r,-1),t=o[e]=a[e](r),{c(){t.c(),n=pr()},m(u,s){o[e].m(u,s),J(u,n,s),i=!0},p(u,[s]){let c=e;e=l(u,s),e===c?o[e].p(u,s):(pt(),re(o[c],1,1,()=>{o[c]=null}),mt(),t=o[e],t?t.p(u,s):(t=o[e]=a[e](u),t.c()),ee(t,1),t.m(n.parentNode,n))},i(u){i||(ee(t),i=!0)},o(u){re(t),i=!1},d(u){u&&j(n),o[e].d(u)}}}function aX(r,e,t){let{mdLinkList:n}=e;return r.$$set=i=>{"mdLinkList"in i&&t(0,n=i.mdLinkList)},[n]}var Z_=class extends Le{constructor(e){super(),$e(this,e,aX,iX,Ve,{mdLinkList:0})}},J_=Z_;var qm=class extends Ja{constructor(e){super(e)}buildVariables(){let e=this.base.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new qu({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new qu({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});this.variables=[{bindTargetDeclaration:t,inputSignal:new _r(void 0),uuid:mr(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new fa({errorLevel:"CRITICAL",effect:"failed to evaluate link view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?un.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>un.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new J_({target:e,props:{mdLinkList:[]}})}async onRerender(e,t){let n=un.parseLinkList(t);this.component=new J_({target:e,props:{mdLinkList:n}})}onUnmount(){var e;super.onUnmount(),(e=this.component)==null||e.$destroy()}};var zm=class{constructor(e){this.plugin=e}createViewField(e){let t=e.declaration.viewFieldType;if(t==="math")return new Vm(e);if(t==="text")return new $m(e);if(t==="link")return new qm(e)}};var wo=class extends fi{constructor(e,t,n,i,a){super(e,t,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.fullDeclaration,this.errorCollection=new Rt(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new zt({errorLevel:"CRITICAL",effect:"can not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getBindTarget(){return this.declaration.bindTarget}shouldAddCardContainer(){let e=this.declaration.inputFieldType==="select"||this.declaration.inputFieldType==="multiSelect"||this.declaration.inputFieldType==="list",t=this.hasArgument("showcase")||this.hasArgument("title");return this.renderChildType==="block"&&(e||t)}createContainer(e){if(this.shouldAddCardContainer()){let t=Bt.createElement(e,"div");Bt.addClass(t,"mb-card");let n=this.getArgument("title");return n&&Bt.createElement(t,"h3",{text:n.value}),t}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let n=Bt.createElement(e,"code",{class:"mb-none"}),i=Bt.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=bt.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.plugin.api.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new zt({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){var a;if(console.debug("meta-bind | InputFieldBase >> mount",this.declaration),Bt.empty(e),Bt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=this.createContainer(e);this.createErrorIndicator(t);let n=Bt.createElement(t,"div",{class:"mb-input-wrapper"});(a=this.inputField)==null||a.mount(n);let i=this.getArguments("class");for(let o of i)Bt.addClasses(n,o.value);Bt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?Bt.addClass(e,"mb-input-block"):Bt.addClass(e,"mb-input-inline"),this.addShowcase(t)}onUnmount(e){var t;console.debug("meta-bind | InputFieldBase >> destroy",this.declaration),(t=this.inputField)==null||t.destroy(),ci(e,"input field")}};var Bu=class extends fi{constructor(e,t,n,i,a){super(e,t,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.fullDeclaration,this.errorCollection=new Rt(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new zt({errorLevel:"ERROR",effect:"an not retrieve arguments",cause:"viewFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getDeclaration(){return this.declaration}createViewField(){if(!this.errorCollection.hasErrors())try{this.viewField=this.plugin.api.viewFieldFactory.createViewField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new zt({errorLevel:"CRITICAL",effect:"can't render view field",cause:"view field is undefined"}))}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){var n;if(console.debug("meta-bind | ViewFieldBase >> mount",this.declaration),Bt.empty(e),Bt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=document.createElement("div");t.addClass("mb-view-wrapper");try{(n=this.viewField)==null||n.mount(t)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(t),Bt.addClass(t,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?Bt.addClass(e,"mb-view-block"):Bt.addClass(e,"mb-view-inline")}onUnmount(e){var t;console.debug("meta-bind | ViewFieldBase >> unmount",this.declaration),(t=this.viewField)==null||t.unmount(),ci(e,"view field")}};var Hm=class extends fi{constructor(e,t,n,i,a){super(e,t,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.fullDeclaration,this.errorCollection=new Rt(this.getUuid()),this.errorCollection.merge(a.errorCollection),this.variables=[],this.buildVariables()}buildVariables(){var e;if(this.errorCollection.isEmpty())try{for(let t of(e=this.declaration.bindTargetMappings)!=null?e:[])this.variables.push({bindTargetDeclaration:t.bindTarget,inputSignal:new _r(void 0),uuid:mr(),contextName:t.name})}catch(t){this.errorCollection.add(t)}}buildContext(){var t,n;let e={};for(let i of(t=this.variables)!=null?t:[])!i.contextName||!i.inputSignal||(e[i.contextName]=(n=i.inputSignal.get())!=null?n:"");return e}async evaluate(){var e;return(e=this.jsRenderer)==null?void 0:e.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){let e=new _r(void 0);this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.getUuid(),e,this.declaration.writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.evaluate(),()=>this.unmount())}unregisterSelfFromMetadataManager(){var e;(e=this.metadataSubscription)==null||e.unsubscribe()}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){if(console.debug("meta-bind | JsViewField >> mount",this.declaration),Bt.addClass(e,"mb-view"),Bt.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new zu({errorLevel:"ERROR",effect:"can not create js view field",cause:"The JS Engine plugin is not installed and enabled."})),!this.plugin.settings.enableJs)throw new zu({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS expressions are disabled in the plugin settings."});if(this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let t=createDiv();t.addClass("mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(t,this.getFilePath(),this.declaration.code),this.registerSelfToMetadataManager(),e.appendChild(t)}onUnmount(e){console.debug("meta-bind | JsViewField >> unmount",this.declaration),this.unregisterSelfFromMetadataManager(),ci(e,"js view field")}};var Ql=fr(On());var t4=fr(Yn()),oX=Ql.P.sequenceMap((r,e)=>e,Ql.P.string("BUTTON"),Ql.P.manyNotOf("[],^").separateBy(Ql.P.string(",").trim(t4.P_UTILS.optionalWhitespace())).wrapString("[","]")),Gm=class{static parseString(e){return qr(oX,e)}};var Wm=class{constructor(e,t,n){this.cleanupCallbacks=[];this.plugin=e,this.content=t,this.filePath=n,this.cleanupCallbacks=[]}renderInitialButton(e,t){return new kc({target:e,props:{variant:"default",label:"Button ID not Found",tooltip:`No button with id '${t}' found`,error:!0,onClick:async()=>{}}})}mount(e){Bt.empty(e),Bt.addClass(e,"mb-button-group");let t=Gm.parseString(this.content);for(let n of t){let i=Bt.createElement(e,"span",{class:"mb-button mb-button-inline"}),a=this.renderInitialButton(i,n),o,l=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,n,u=>{a==null||a.$destroy(),o=new Os(this.plugin,u,this.filePath,!0,!1),o.mount(i)});this.cleanupCallbacks.push(()=>{a==null||a.$destroy(),o==null||o.unmount(),l()})}}unmount(){for(let e of this.cleanupCallbacks)e()}};var jm=class extends fi{constructor(e,t,n,i){super(e,t,n),this.declarationString=i,this.errorCollection=new Rt(this.getUuid())}onMount(e){console.debug("meta-bind | InlineButtonBase >> mount",this.declarationString),Bt.removeAllClasses(e),this.buttonField=new Wm(this.plugin,this.declarationString,this.getFilePath());try{this.buttonField.mount(e)}catch(t){this.errorCollection.add(t),this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}}onUnmount(e){var t;console.debug("meta-bind | InlineButtonBase >> destroy",this.declarationString),(t=this.buttonField)==null||t.unmount(),ci(e,"inline button")}};var sl=(a=>(a.INPUT_FIELD="INPUT_FIELD",a.VIEW_FIELD="VIEW_FIELD",a.JS_VIEW_FIELD="JS_VIEW_FIELD",a.INLINE_BUTTON="INLINE_BUTTON",a.BUTTON="BUTTON",a))(sl||{});function Y_(r){return r==="INPUT_FIELD"||r==="VIEW_FIELD"||r==="INLINE_BUTTON"}var Zm=class{constructor(e,t){var n,i,a,o,l,u,s,c;this.plugin=e,this.inputField=new Pf(e),this.inputFieldParser=(n=t==null?void 0:t.inputFieldParser)!=null?n:new Df(e),this.viewFieldParser=(i=t==null?void 0:t.viewFieldParser)!=null?i:new If(e),this.bindTargetParser=(a=t==null?void 0:t.bindTargetParser)!=null?a:new Bf(e),this.inputFieldFactory=(o=t==null?void 0:t.inputFieldFactory)!=null?o:new np(e),this.viewFieldFactory=(l=t==null?void 0:t.viewFieldFactory)!=null?l:new zm(e),this.buttonActionRunner=(u=t==null?void 0:t.buttonActionRunner)!=null?u:new Ys(e),this.buttonManager=(s=t==null?void 0:t.buttonManager)!=null?s:new ap(e),this.syntaxHighlighting=(c=t==null?void 0:t.syntaxHighlighting)!=null?c:new lp(e)}createField(e,t,n,i,a){let o=mr();if(e==="INPUT_FIELD"){let l=this.inputFieldParser.parseString(i,t,a);return new wo(this.plugin,o,t,n,l)}else if(e==="VIEW_FIELD"){let l=this.viewFieldParser.parseString(i,t,a);return new Bu(this.plugin,o,t,n,l)}else if(e==="JS_VIEW_FIELD"){let l=this.viewFieldParser.parseJsString(i,t);return new Hm(this.plugin,o,t,n,l)}else{if(e==="INLINE_BUTTON")return new jm(this.plugin,o,t,i);if(e==="BUTTON")return new ks(this.plugin,o,t,i,!1)}throw new Error(`Unknown field type: ${e}`)}getInlineFieldDeclarationPrefix(e){if(e==="INPUT_FIELD")return"INPUT";if(e==="VIEW_FIELD")return"VIEW";if(e==="INLINE_BUTTON")return"BUTTON";throw new zt({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,t){let n=this.getInlineFieldDeclarationPrefix(e)+"[";return t.startsWith(n)&&t.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(e.endsWith("]"))for(let t of Object.values(sl)){if(!Y_(t))continue;let n=this.getInlineFieldDeclarationPrefix(t)+"[";if(e.startsWith(n))return t}}};var r4=require("obsidian");var aa=class extends r4.MarkdownRenderChild{constructor(e,t,n){super(n),this.plugin=e,this.filePath=t,this.uuid=mr()}onload(){this.plugin.mdrcManager.registerMDRC(this),super.onload()}onunload(){this.plugin.mdrcManager.unregisterMDRC(this),super.onunload()}};var Jm=class extends aa{onload(){console.debug("meta-bind | ExcludedMDRC >> load",this),this.containerEl.empty(),this.containerEl.createEl("span",{text:"[META_BIND] This folder has been excluded in the settings",cls:"mb-error"}),super.onload()}onunload(){console.debug("meta-bind | ExcludedMDRC >> unload",this),super.onunload()}};var Pu=class{constructor(e){this.scope=e}};var n4=require("obsidian");function sX(r){let e,t;return{c(){e=Z("td"),t=Z("div")},m(n,i){J(n,e,i),z(e,t),r[3](t)},p:Me,i:Me,o:Me,d(n){n&&j(e),r[3](null)}}}function uX(r,e,t){let{table:n}=e,{cell:i}=e,a,o;sn(()=>{o=new n4.Component,o.load(),n.createCell(i,a,o)}),To(()=>{o.unload()});function l(u){Ir[u?"unshift":"push"](()=>{a=u,t(0,a)})}return r.$$set=u=>{"table"in u&&t(1,n=u.table),"cell"in u&&t(2,i=u.cell)},[a,n,i,l]}var X_=class extends Le{constructor(e){super(),$e(this,e,uX,sX,Ve,{table:1,cell:2})}},i4=X_;function a4(r,e,t){let n=r.slice();return n[7]=e[t],n}function o4(r,e,t){let n=r.slice();return n[10]=e[t],n[11]=e,n[12]=t,n}function s4(r,e,t){let n=r.slice();return n[13]=e[t],n}function u4(r){let e,t=r[13]+"",n;return{c(){e=Z("th"),n=Ie(t)},m(i,a){J(i,e,a),z(e,n)},p(i,a){a&2&&t!==(t=i[13]+"")&&Ke(n,t)},d(i){i&&j(e)}}}function lX(r){let e,t,n;return{c(){e=Z("td"),t=Ie("invalid data"),k(e,"class","meta-bind-error"),k(e,"colspan",n=r[1].length)},m(i,a){J(i,e,a),z(e,t)},p(i,a){a&2&&n!==(n=i[1].length)&&k(e,"colspan",n)},i:Me,o:Me,d(i){i&&j(e)}}}function cX(r){let e,t,n=We(r[7].cells),i=[];for(let o=0;o<n.length;o+=1)i[o]=l4(o4(r,n,o));let a=o=>re(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=pr()},m(o,l){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(o,l);J(o,e,l),t=!0},p(o,l){if(l&5){n=We(o[7].cells);let u;for(u=0;u<n.length;u+=1){let s=o4(o,n,u);i[u]?(i[u].p(s,l),ee(i[u],1)):(i[u]=l4(s),i[u].c(),ee(i[u],1),i[u].m(e.parentNode,e))}for(pt(),u=n.length;u<i.length;u+=1)a(u);mt()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)ee(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)re(i[l]);t=!1},d(o){o&&j(e),At(i,o)}}}function l4(r){let e,t,n;function i(o){r[4](o,r[10],r[11],r[12])}let a={table:r[0]};return r[10]!==void 0&&(a.cell=r[10]),e=new i4({props:a}),Ir.push(()=>Pa(e,"cell",i)),{c(){we(e.$$.fragment)},m(o,l){be(e,o,l),n=!0},p(o,l){r=o;let u={};l&1&&(u.table=r[0]),!t&&l&4&&(t=!0,u.cell=r[10],Ba(()=>t=!1)),e.$set(u)},i(o){n||(ee(e.$$.fragment,o),n=!0)},o(o){re(e.$$.fragment,o),n=!1},d(o){xe(e,o)}}}function fX(r){let e,t;return e=new Qt({props:{iconName:"x"}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p:Me,i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function c4(r,e){let t,n,i,a,o,l,u,s,c=[cX,lX],f=[];function p(h,d){return h[7].isValid?0:1}n=p(e,-1),i=f[n]=c[n](e);function m(){return e[5](e[7])}return l=new Et({props:{$$slots:{default:[fX]},$$scope:{ctx:e}}}),l.$on("click",m),{key:r,first:null,c(){t=Z("tr"),i.c(),a=ue(),o=Z("td"),we(l.$$.fragment),u=ue(),k(o,"class","mb-html-table-button-cell"),this.first=t},m(h,d){J(h,t,d),f[n].m(t,null),z(t,a),z(t,o),be(l,o,null),z(t,u),s=!0},p(h,d){e=h;let g=n;n=p(e,d),n===g?f[n].p(e,d):(pt(),re(f[g],1,1,()=>{f[g]=null}),mt(),i=f[n],i?i.p(e,d):(i=f[n]=c[n](e),i.c()),ee(i,1),i.m(t,a));let v={};d&65536&&(v.$$scope={dirty:d,ctx:e}),l.$set(v)},i(h){s||(ee(i),ee(l.$$.fragment,h),s=!0)},o(h){re(i),re(l.$$.fragment,h),s=!1},d(h){h&&j(t),f[n].d(),xe(l)}}}function pX(r){let e;return{c(){e=Ie("Add Column")},m(t,n){J(t,e,n)},d(t){t&&j(e)}}}function mX(r){let e,t,n,i,a,o,l,u,s=[],c=new Map,f,p,m,h=We(r[1]),d=[];for(let w=0;w<h.length;w+=1)d[w]=u4(s4(r,h,w));let g=We(r[2]),v=w=>w[7].index;for(let w=0;w<g.length;w+=1){let y=a4(r,g,w),x=v(y);c.set(x,s[w]=c4(x,y))}return p=new Et({props:{$$slots:{default:[pX]},$$scope:{ctx:r}}}),p.$on("click",r[6]),{c(){e=Z("div"),t=Z("table"),n=Z("thead"),i=Z("tr");for(let w=0;w<d.length;w+=1)d[w].c();a=ue(),o=Z("th"),l=ue(),u=Z("tbody");for(let w=0;w<s.length;w+=1)s[w].c();f=ue(),we(p.$$.fragment),k(o,"class","mb-html-table-button-cell"),k(t,"class","mb-html-table"),k(e,"class","mb-table-wrapper")},m(w,y){J(w,e,y),z(e,t),z(t,n),z(n,i);for(let x=0;x<d.length;x+=1)d[x]&&d[x].m(i,null);z(i,a),z(i,o),z(t,l),z(t,u);for(let x=0;x<s.length;x+=1)s[x]&&s[x].m(u,null);J(w,f,y),be(p,w,y),m=!0},p(w,[y]){if(y&2){h=We(w[1]);let _;for(_=0;_<h.length;_+=1){let b=s4(w,h,_);d[_]?d[_].p(b,y):(d[_]=u4(b),d[_].c(),d[_].m(i,a))}for(;_<d.length;_+=1)d[_].d(1);d.length=h.length}y&7&&(g=We(w[2]),pt(),s=xs(s,y,v,1,w,g,c,u,xc,c4,null,a4),mt());let x={};y&65536&&(x.$$scope={dirty:y,ctx:w}),p.$set(x)},i(w){if(!m){for(let y=0;y<g.length;y+=1)ee(s[y]);ee(p.$$.fragment,w),m=!0}},o(w){for(let y=0;y<s.length;y+=1)re(s[y]);re(p.$$.fragment,w),m=!1},d(w){w&&(j(e),j(f)),At(d,w);for(let y=0;y<s.length;y+=1)s[y].d();xe(p,w)}}}function dX(r,e,t){let{table:n}=e,{tableHead:i=[]}=e,a=[];function o(c){t(2,a=c)}function l(c,f,p,m){p[m]=c,t(2,a)}let u=c=>n.removeColumn(c.index),s=()=>n.addColumn();return r.$$set=c=>{"table"in c&&t(0,n=c.table),"tableHead"in c&&t(1,i=c.tableHead)},[n,i,a,o,l,u,s]}var Q_=class extends Le{constructor(e){super(),$e(this,e,dX,mX,Ve,{table:0,tableHead:1,updateTable:3})}get updateTable(){return this.$$.ctx[3]}},f4=Q_;function Ym(r){return new ja(r.map(e=>bE.tryParse(e).success?new Yo("array",e):new Yo("object",e)))}var Xm=class extends aa{constructor(e,t,n,i,a,o){super(e,t,n),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new _r(void 0),this.outputSignal=new _r(void 0),this.value=void 0}registerSelfToMetadataManager(){this.metadataManagerOutputSignalListener=this.outputSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.metadataSubscription=this.plugin.metadataManager.subscribe(this.uuid,this.inputSignal,this.bindTarget,()=>this.unload())}unregisterSelfFromMetadataManager(){var e;this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),(e=this.metadataSubscription)==null||e.unsubscribe()}updateMetadataManager(e){var t;(t=this.metadataSubscription)==null||t.update(e)}updateDisplayValue(e){var n;e=e!=null?e:[];let t=[];for(let i=0;i<e.length;i++)if(typeof e[i]=="object"){let a=new Pu({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(Ym([i.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),o=this.columns.map(l=>"inputFieldType"in l?this.plugin.api.inputFieldParser.validateDeclaration(l,this.filePath,a):this.plugin.api.viewFieldParser.validateDeclaration(l,this.filePath,a));t.push({cells:o,index:i,value:e[i],isValid:!0})}else t.push({cells:[],index:i,value:e[i],isValid:!1});(n=this.tableComponent)==null||n.updateTable(t)}createCell(e,t,n){let i=mr();if("inputFieldType"in e){let a=new wo(this.plugin,i,this.filePath,"inline",e);a.mount(t),n.register(()=>a.unmount())}else{let a=new Bu(this.plugin,i,this.filePath,"inline",e);a.mount(t),n.register(()=>a.unmount())}}removeColumn(e){var t;this.value=(t=this.value)!=null?t:[],this.value.splice(e,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){var e;this.value=(e=this.value)!=null?e:[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onload(){this.plugin.mdrcManager.registerMDRC(this),this.tableComponent=new f4({target:this.containerEl,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:e=>{this.value=e,this.updateDisplayValue(e)}}),this.registerSelfToMetadataManager()}onunload(){var e;this.plugin.mdrcManager.unregisterMDRC(this),this.unregisterSelfFromMetadataManager(),(e=this.tableComponent)==null||e.$destroy()}};var Kl=(i=>(i.FRONTMATTER="frontmatter",i.MEMORY="memory",i.GLOBAL_MEMORY="globalMemory",i.SCOPE="scope",i))(Kl||{});var eA=require("obsidian");var oa=$t()(Pe.string()),Qm=$t()(Pe.nativeEnum(Bi)),Ao=$t()(Pe.instanceof(HTMLElement)),CGe=$t()(Pe.instanceof(eA.Component)),tA=$t()(Pe.instanceof(Pu)),p4=$t()(Pe.object({index:Pe.number(),line:Pe.number(),column:Pe.number()})),hX=$t()(Pe.object({from:p4,to:p4})),_o=$t()(Pe.object({value:Pe.string(),position:hX.optional()})),m4=$t()(Pe.object({name:_o,value:_o.array()})),gX=$t()(Pe.object({type:Pe.nativeEnum(Xo),prop:_o})),K_=$t()(Pe.object({storageType:_o.optional(),storagePath:_o.optional(),storageProp:gX.array(),listenToChildren:Pe.boolean()})),d4=$t()(Pe.object({fullDeclaration:Pe.string(),inputFieldType:_o.optional(),templateName:_o.optional(),bindTarget:K_.optional(),arguments:m4.array(),errorCollection:Pe.instanceof(Rt)})),vX=$t()(Pe.object({fullDeclaration:Pe.string(),templateDeclaration:Pe.array(Pe.union([Pe.string(),K_])),viewFieldType:_o.optional(),arguments:m4.array(),writeToBindTarget:K_.optional(),errorCollection:Pe.instanceof(Rt)})),yX=$t()(Pe.object({storageType:Pe.nativeEnum(Kl),storagePath:Pe.string(),storageProp:Pe.instanceof(ja),listenToChildren:Pe.boolean()})),bX=$t()(Pe.instanceof(_r)),xX=$t()(Pe.function().args().returns(Pe.void())),So=$t()(Pe.object({addChild:Pe.function().args(Pe.instanceof(eA.Component)).returns(Pe.void())})),h4=$t()(Pe.tuple([d4,Qm,oa,Ao,So,tA.optional()])),g4=$t()(Pe.tuple([Pe.string(),Qm,oa,Ao,So,tA.optional()])),v4=$t()(Pe.tuple([Pe.string(),Qm,oa,Ao,So,tA.optional()])),y4=$t()(Pe.tuple([Pe.string(),Qm,oa,Ao,So])),b4=$t()(Pe.tuple([Ao,oa,So])),x4=$t()(Pe.tuple([bX,oa,Pe.array(Pe.string()),Pe.boolean(),xX.optional()])),w4=$t()(Pe.tuple([Ao,oa,So,yX,Pe.array(Pe.string()),Pe.array(Pe.union([d4,vX]))])),_4=$t()(Pe.tuple([Pe.string(),oa])),A4=$t()(Pe.tuple([Pe.string(),oa,Ao,So])),S4=$t()(Pe.tuple([Pe.string(),oa,Ao,So]));var ec=class extends aa{constructor(e,t,n){super(e,t.getFilePath(),n),this.base=t}onload(){this.base.mount(this.containerEl),super.onload()}onunload(){this.base.unmount(),super.onunload()}};var E4=require("@codemirror/view");var Km=class extends E4.WidgetType{constructor(e,t,n,i,a){super(),this.type=e,this.content=t,this.filePath=n,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement("span");return t.addClass("cm-inline-code"),this.renderChild=this.plugin.api.createMDRC(this.type,this.content,"inline",this.filePath,t,this.parentComponent,void 0),t}destroy(e){var t;(t=this.renderChild)==null||t.unload(),super.destroy(e)}};var td=require("obsidian"),ed=class extends Ys{constructor(e){super(e),this.plugin=e}async runTemplaterCreateNoteAction(e){var a,o;let t=this.plugin.app.plugins.getPlugin("templater-obsidian");if(!t)throw new Error("Templater plugin not found");let n=t.templater,i=this.plugin.app.vault.getAbstractFileByPath(e.templateFile);if(!i||!(i instanceof td.TFile))throw new Error(`Template file not found: ${e.templateFile}`);if(e.folderPath===void 0)await n.create_new_note_from_template(i,void 0,e.fileName,(a=e.openNote)!=null?a:!0);else{let l=this.plugin.app.vault.getAbstractFileByPath(e.folderPath);if(!l||!(l instanceof td.TFolder))throw new Error(`Folder not found: ${e.folderPath}`);await n.create_new_note_from_template(i,l,e.fileName,(o=e.openNote)!=null?o:!0)}}};var rd=class extends Zm{constructor(e){super(e,{buttonActionRunner:new ed(e)})}createMDRC(e,t,n,i,a,o,l){if(this.plugin.isFilePathExcluded(i))return this.createExcludedField(a,i,o);let u=this.createField(e,i,n,t,l),s=new ec(this.plugin,u,a);return o.addChild(s),s}createInputField(e,t,n,i,a,o){if(ki(h4,[e,t,n,i,a,o]),this.plugin.isFilePathExcluded(n))return this.createExcludedField(i,n,a);let l=this.inputFieldParser.validateDeclaration(e,n,o),u=new wo(this.plugin,mr(),n,t,l),s=new ec(this.plugin,u,i);return a.addChild(s),s}createInputFieldFromString(e,t,n,i,a,o){return ki(g4,[e,t,n,i,a,o]),this.createMDRC("INPUT_FIELD",e,t,n,i,a,o)}createViewFieldFromString(e,t,n,i,a,o){return ki(v4,[e,t,n,i,a,o]),this.createMDRC("VIEW_FIELD",e,t,n,i,a,o)}createJsViewFieldFromString(e,t,n,i,a){return ki(y4,[e,t,n,i,a]),this.createMDRC("JS_VIEW_FIELD",e,t,n,i,a,void 0)}createButtonFromString(e,t,n,i){return ki(A4,[e,t,n,i]),this.createMDRC("BUTTON",e,"block",t,n,i,void 0)}createInlineButtonFromString(e,t,n,i){return ki(S4,[e,t,n,i]),this.createMDRC("INLINE_BUTTON",e,"inline",t,n,i,void 0)}createExcludedField(e,t,n){ki(b4,[e,t,n]);let i=new Jm(this.plugin,t,e);return n.addChild(i),i}createSignal(e){return new _r(e)}listenToMetadata(e,t,n,i=!1,a){ki(x4,[e,t,n,i,a]);let o=mr(),l=this.plugin.metadataManager.subscribe(o,e,{storageType:"frontmatter",storagePath:t,storageProp:Ym(n),listenToChildren:i},a!=null?a:()=>{});return()=>{l.unsubscribe()}}createTable(e,t,n,i,a,o){ki(w4,[e,t,n,i,a,o]);let l=new Xm(this.plugin,t,e,i,a,o);return n.addChild(l),l}createBindTarget(e,t){return ki(_4,[e,t]),this.bindTargetParser.parseAndValidateBindTarget(e,t)}constructMDRCWidget(e,t,n,i,a){if(Y_(e))return new Km(e,t,n,i,a);throw new zt({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}};var D4=require("obsidian");var rA=Co[1];function N4(r){rA=r}function nA(r){return xA[r]}function C4(r,e){let t=(0,D4.moment)(new Date(e,r)).daysInMonth(),n=new Array(42).fill(0),i=wX(new Date(e,r,1));for(let a=0;a<t;a++)n[a+i]=a+1;return n=n[n.length-7]?n:n.slice(0,-7),n=n[n.length-7]?n:n.slice(0,-7),n}function wX(r){return Rd(r.getDay()-rA.index,7)}function M4(){return Co.map(e=>({index:Rd(e.index-rA.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function T4(){let r=0;return()=>++r}var hs=require("@codemirror/view"),pA=require("@codemirror/language"),od=require("obsidian");var F4=require("obsidian");var Ca=class{static checkSelectionOverlap(e,t,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,t,n,i){return e<=i&&n<=t}static getContent(e,t,n){return e.sliceDoc(t,n)}static getCurrentFile(e){return e.state.field(F4.editorInfoField).file}static existsDecorationBetween(e,t,n){let i=!1;return e.between(t,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,n,i){let a=!1;return e.between(n,i,(o,l,u)=>{u.spec.mb_widgetType===t&&(a=!0)}),a}};var Dr=class extends Error{},tc=class extends Error{};var Ou=function(r){return this instanceof Ou?(this.v=r,this):new Ou(r)},_X=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Ou?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}},Wi;(function(r){r[r.SHORTEST=0]="SHORTEST",r[r.LONGEST=1]="LONGEST",r[r.STRICT_EQUAL=2]="STRICT_EQUAL"})(Wi||(Wi={}));function*iA(r,e,...t){if(t.length===0)return;let n=[];for(let i of t)n.push(I4(i));e:for(;;){let i=P4.map(n,u=>u.next()),a=[],o=!0,l=!1;for(let u of i){let s;u.done?(o=!1,s=e):(l=!0,s=u.value),a.push(s)}if(!o&&l)switch(r){case Wi.SHORTEST:break e;case Wi.STRICT_EQUAL:throw new tc("Iterators must have equal lengths")}if(!l)break;yield a}}function aA(r,e,...t){return _X(this,arguments,function*(){if(t.length===0)return yield Ou(void 0);let i=[];for(let a of t)i.push(B4(a));e:for(;;){let a=[];for(let s of i){let c=yield Ou(s.next());a.push(c)}let o=[],l=!0,u=!1;for(let s of a){let c;s.done?(l=!1,c=e):(u=!0,c=s.value),o.push(c)}if(!l&&u)switch(r){case Wi.SHORTEST:break e;case Wi.STRICT_EQUAL:throw new tc("Iterators must have equal lengths")}if(!u)break;yield yield Ou(o)}})}var O4=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},Ma=function(r){return this instanceof Ma?(this.v=r,this):new Ma(r)},k4=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Ma?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*R4(...r){for(let e of iA(Wi.SHORTEST,void 0,...r))yield e}function L4(...r){return k4(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=O4(aA(Wi.SHORTEST,void 0,...r)),u;u=yield Ma(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Ma(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Ma(i.call(l)))}finally{if(n)throw n.error}}})}function*U4(...r){for(let e of iA(Wi.STRICT_EQUAL,void 0,...r))yield e}function V4(...r){return k4(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=O4(aA(Wi.STRICT_EQUAL,void 0,...r)),u;u=yield Ma(l.next()),t=u.done,!t;){a=u.value,o=!1;try{yield yield Ma(a)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield Ma(i.call(l)))}finally{if(n)throw n.error}}})}var $4=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},AX=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function SX(r,e,t){let n=t;for(let i of tr(r))n=e(n,i);return n}function EX(r,e,t){var n,i,a,o;return $4(this,void 0,void 0,function*(){let l=t;try{for(var u=!0,s=AX(rr(r)),c;c=yield s.next(),n=c.done,!n;){o=c.value,u=!1;try{l=yield e(l,o)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l})}function oA(r){switch(!0){case r instanceof Array:return r.length;case sa(r):return r.length;case r instanceof Set:return r.size;case r instanceof Map:return r.size}return SX(r,e=>e+1,0)}function q4(r){return $4(this,void 0,void 0,function*(){switch(!0){case r instanceof Array:case sa(r):case r instanceof Set:case r instanceof Map:return oA(r)}return yield EX(r,e=>e+1,0)})}var ji=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},Ta=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function z4(r,e){for(let t of tr(r))if(!e(t))return!1;return!0}function H4(r,e){var t,n,i,a;return ji(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(rr(r)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(!(yield e(a)))return!1}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!0})}function G4(r){let e=new Set;for(let t of tr(r)){if(e.has(t))return!1;e.add(t)}return!0}function W4(r){var e,t,n,i;return ji(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,l=Ta(rr(r)),u;u=yield l.next(),e=u.done,!e;){i=u.value,o=!1;try{let s=i;if(a.has(s))return!1;a.add(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(n=l.return)&&(yield n.call(l))}finally{if(t)throw t.error}}return!0})}function j4(r,e){for(let t of tr(r))if(e(t))return!0;return!1}function Z4(r,e){var t,n,i,a;return ji(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(rr(r)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(yield e(a))return!0}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!1})}function J4(r,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let n=0;for(let i of tr(r))if(t(i)&&(n++,n>e))return!1;return n===e}function Y4(r,e,t){var n,i,a,o;return ji(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=f=>!!f);let l=0;try{for(var u=!0,s=Ta(rr(r)),c;c=yield s.next(),n=c.done,!n;){o=c.value,u=!1;try{if((yield t(o))&&(l++,l>e))return!1}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i.error}}return l===e})}function X4(r){for(let e of tr(r))return!1;return!0}function Q4(r){var e,t,n,i;return ji(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(rr(r)),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let u=i;return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function zn(r){return r==null?!1:typeof r[Symbol.iterator]=="function"}function Fa(r){return r==null?!1:typeof r[Symbol.asyncIterator]=="function"}function Ei(r){return r==null?!1:r.next!==void 0&&typeof r.next=="function"}function K4(r){for(let[e,t]of ds(tr(r)))if(e<t)return!1;return!0}function e5(r){var e,t,n,i;return ji(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(nc(rr(r))),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let[u,s]=i;if(u<s)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function t5(r){for(let[e,t]of ds(tr(r)))if(e>t)return!1;return!0}function r5(r){var e,t,n,i;return ji(this,void 0,void 0,function*(){try{for(var a=!0,o=Ta(nc(rr(r))),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let[u,s]=i;if(u>s)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return!0})}function sa(r){return typeof r=="string"||r instanceof String}function n5(r,e){for(let t of tr(r))if(e(t))return!1;return!0}function i5(r,e){var t,n,i,a;return ji(this,void 0,void 0,function*(){try{for(var o=!0,l=Ta(rr(r)),u;u=yield l.next(),t=u.done,!t;){a=u.value,o=!1;try{if(yield e(a))return!1}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return!0})}function a5(...r){try{for(let e of U4(...r))for(let[t,n]of ds(e))if(t!==n)return!1}catch(e){return!1}return!0}function o5(...r){var e,t,n,i;return ji(this,void 0,void 0,function*(){try{try{for(var a=!0,o=Ta(V4(...r)),l;l=yield o.next(),e=l.done,!e;){i=l.value,a=!1;try{let u=i;for(let[s,c]of ds(u))if(s!==c)return!1}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}}catch(u){return!1}return!0})}function s5(...r){if(r.length<=1)return!0;let e=r.map(t=>oA(t));return new Set(e).size===1}function u5(...r){return ji(this,void 0,void 0,function*(){if(r.length<=1)return!0;let e=yield nd(r,t=>ji(this,void 0,void 0,function*(){return yield q4(t)}));return new Set(yield rc(e)).size===1})}var DX=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function l(c){try{s(n.next(c))}catch(f){o(f)}}function u(c){try{s(n.throw(c))}catch(f){o(f)}}function s(c){c.done?a(c.value):i(c.value).then(l,u)}s((n=n.apply(r,e||[])).next())})},ua=function(r){return this instanceof ua?(this.v=r,this):new ua(r)},sA=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof ua?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}},l5=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}};function tr(r){if(zn(r))return r;if(Ei(r))return{[Symbol.iterator](){return r}};if(typeof r=="object"&&r!==null)return function*(){for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(yield[e,r[e]])}();throw new Dr("Given collection is not iterable or iterator.")}function rr(r){if(Fa(r))return r;if(Ei(r))return{[Symbol.asyncIterator](){return sA(this,arguments,function*(){for(;;){let t=yield ua(r.next());if(t.done)return yield ua(void 0);yield yield ua(t.value)}})}};if(typeof r=="object"&&r!==null&&(r=tr(r)),zn(r))return{[Symbol.asyncIterator](){return sA(this,arguments,function*(){for(let t of r)yield yield ua(t)})}};throw new Dr("Given collection is not async iterable or iterator.")}function I4(r){if(Ei(r))return r;if(zn(r))return function*(){for(let e of r)yield e}();throw new Dr("Given collection is not iterable or iterator.")}function B4(r){if((Ei(r)||zn(r))&&(r=rr(r)),Fa(r))return function(){return sA(this,arguments,function*(){var e,t,n,i;try{for(var a=!0,o=l5(r),l;l=yield ua(o.next()),e=l.done,!e;){i=l.value,a=!1;try{yield yield ua(i)}finally{a=!0}}}catch(u){t={error:u}}finally{try{!a&&!e&&(n=o.return)&&(yield ua(n.call(o)))}finally{if(t)throw t.error}}})}();throw new Dr("Given collection is not iterable or iterator.")}function uA(r){let e=[];for(let t of tr(r))e.push(t);return e}function rc(r){var e,t,n,i;return DX(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,l=l5(rr(r)),u;u=yield l.next(),e=u.done,!e;){i=u.value,o=!1;try{let s=i;a.push(s)}finally{o=!0}}}catch(s){t={error:s}}finally{try{!o&&!e&&(n=l.return)&&(yield n.call(l))}finally{if(t)throw t.error}}return a})}var Eo=function(r){return this instanceof Eo?(this.v=r,this):new Eo(r)},NX=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},CX=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof Eo?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*lA(r,e){let t=new Set;if(r instanceof Map){e===void 0&&(e=n=>n[1]);for(let n of r){let i=e(n);t.has(i)||(yield n,t.add(i))}}else{e===void 0&&(e=n=>n);for(let n of tr(r)){let i=e(n);t.has(i)||(yield n,t.add(i))}}}function c5(r,e){return CX(this,arguments,function*(){var n,i,a,o;let l=new Set;if(r instanceof Map)for(let f of lA(r,e))yield yield Eo(yield Eo(f));else{e===void 0&&(e=f=>f);try{for(var u=!0,s=NX(rr(r)),c;c=yield Eo(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o,p=e(f);l.has(p)||(yield yield Eo(f),l.add(p))}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield Eo(a.call(s)))}finally{if(i)throw i.error}}}})}var Ur=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof __values=="function"?__values(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(l,u){o=r[a](o),i(l,u,o.done,o.value)})}}function i(a,o,l,u){Promise.resolve(u).then(function(s){a({value:s,done:l})},o)}},je=function(r){return this instanceof je?(this.v=r,this):new je(r)},Kr=function(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){n[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||l(p,m)})})}function l(p,m){try{u(n[p](m))}catch(h){f(a[0][3],h)}}function u(p){p.value instanceof je?Promise.resolve(p.value.v).then(s,c):f(a[0][2],p)}function s(p){l("next",p)}function c(p){l("throw",p)}function f(p,m){p(m),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*f5(r,e){for(let t of tr(r))yield e(t)}function nd(r,e){return Kr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Ur(rr(r)),s;s=yield je(u.next()),n=s.done,!n;){o=s.value,l=!1;try{yield yield je(yield je(e(o)))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield je(a.call(u)))}finally{if(i)throw i.error}}})}function*p5(r,e){for(let[t,n]of R4(r,e))n&&(yield t)}function m5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Ur(L4(r,e)),s;s=yield je(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let[c,f]=o;f&&(yield yield je(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield je(a.call(u)))}finally{if(i)throw i.error}}})}function*d5(r,e){let t=!0;for(let n of tr(r)){if(t){if(!e(n)){t=!1,yield n;continue}continue}yield n}}function h5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;let l=!0;try{for(var u=!0,s=Ur(rr(r)),c;c=yield je(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o;if(l){if(!(yield je(e(f)))){l=!1,yield yield je(f);continue}continue}yield yield je(f)}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield je(a.call(s)))}finally{if(i)throw i.error}}})}function*g5(r,e){for(let t of tr(r))if(e(t))yield t;else break}function v5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Ur(rr(r)),s;s=yield je(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let c=o;if(yield je(e(c)))yield yield je(c);else break}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield je(a.call(u)))}finally{if(i)throw i.error}}})}function*y5(r,e){if(e<0)throw new Dr(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield r}function b5(r,e){return Kr(this,arguments,function*(){if(e<0)throw new Dr(`Number of repetitions cannot be negative: ${e}`);let n=yield je(r);for(let i=e;i>0;--i)yield yield je(n)})}function*x5(r,e){for(let t of tr(r)){let n=e(t,e);if(zn(n))for(let i of tr(n))yield i;else yield n}}function w5(r,e){return Kr(this,arguments,function*(){var n,i,a,o,l,u,s,c;try{for(var f=!0,p=Ur(rr(r)),m;m=yield je(p.next()),n=m.done,!n;){o=m.value,f=!1;try{let w=yield je(e(o,e));if(zn(w)||Fa(w))try{for(var h=!0,d=(u=void 0,Ur(rr(w))),g;g=yield je(d.next()),l=g.done,!l;){c=g.value,h=!1;try{yield yield je(c)}finally{h=!0}}}catch(y){u={error:y}}finally{try{!h&&!l&&(s=d.return)&&(yield je(s.call(d)))}finally{if(u)throw u.error}}else yield yield je(w)}finally{f=!0}}}catch(v){i={error:v}}finally{try{!f&&!n&&(a=p.return)&&(yield je(a.call(p)))}finally{if(i)throw i.error}}})}function*cA(r,e=1/0){if(e<1){for(let t of tr(r))r instanceof Map&&(t=t[1]),yield t;return}for(let t of tr(r))if(r instanceof Map&&(t=t[1]),(zn(t)||Ei(t))&&!sa(t))for(let n of cA(t,e-1))yield n;else yield t}function fA(r,e=1/0){return Kr(this,arguments,function*(){var n,i,a,o,l,u,s,c,f,p,m,h;if(e<1){try{for(var d=!0,g=Ur(rr(r)),v;v=yield je(g.next()),n=v.done,!n;){o=v.value,d=!1;try{let D=o;r instanceof Map&&(D=D[1]),yield yield je(D)}finally{d=!0}}}catch(D){i={error:D}}finally{try{!d&&!n&&(a=g.return)&&(yield je(a.call(g)))}finally{if(i)throw i.error}}return yield je(void 0)}try{for(var w=!0,y=Ur(rr(r)),x;x=yield je(y.next()),l=x.done,!l;){c=x.value,w=!1;try{let D=c;if(r instanceof Map&&(D=D[1]),(Fa(D)||zn(D)||Ei(D))&&!sa(D))try{for(var _=!0,b=(p=void 0,Ur(fA(D,e-1))),E;E=yield je(b.next()),f=E.done,!f;){h=E.value,_=!1;try{yield yield je(h)}finally{_=!0}}}catch(A){p={error:A}}finally{try{!_&&!f&&(m=b.return)&&(yield je(m.call(b)))}finally{if(p)throw p.error}}else yield yield je(D)}finally{w=!0}}}catch(D){u={error:D}}finally{try{!w&&!l&&(s=y.return)&&(yield je(s.call(y)))}finally{if(u)throw u.error}}})}function*_5(r,e){for(let t of tr(r))e(t)&&(yield t)}function A5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Ur(rr(r)),s;s=yield je(u.next()),n=s.done,!n;){o=s.value,l=!1;try{let c=o;(yield je(e(c)))&&(yield yield je(c))}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield je(a.call(u)))}finally{if(i)throw i.error}}})}function*id(r,e,t,n=!0){if(e<1)throw new Dr(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new Dr("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of tr(r))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&n&&(yield i)}function ad(r,e,t,n=!0){return Kr(this,arguments,function*(){var a,o,l,u;if(e<1)throw new Dr(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new Dr("Overlap size must be less than chunk size");let s=[],c=!1;try{for(var f=!0,p=Ur(rr(r)),m;m=yield je(p.next()),a=m.done,!a;){u=m.value,f=!1;try{let h=u;c=!1,s.push(h),s.length===e&&(yield yield je(s),s=s.slice(e-t),c=!0)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(l=p.return)&&(yield je(l.call(p)))}finally{if(o)throw o.error}}!c&&s.length>0&&n&&(yield yield je(s))})}function*S5(r,e){for(let t of id(r,e,0))yield t}function E5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;try{for(var l=!0,u=Ur(ad(r,e,0)),s;s=yield je(u.next()),n=s.done,!n;){o=s.value,l=!1;try{yield yield je(o)}finally{l=!0}}}catch(c){i={error:c}}finally{try{!l&&!n&&(a=u.return)&&(yield je(a.call(u)))}finally{if(i)throw i.error}}})}function*ds(r){let e=id(r,2,1,!1);for(let t of e)yield t}function nc(r){return Kr(this,arguments,function*(){var t,n,i,a;let o=ad(r,2,1,!1);try{for(var l=!0,u=Ur(o),s;s=yield je(u.next()),t=s.done,!t;){a=s.value,l=!1;try{yield yield je(a)}finally{l=!0}}}catch(c){n={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield je(i.call(u)))}finally{if(n)throw n.error}}})}function*D5(r,e){if(e<0)throw new Dr(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let n of tr(r)){if(t>=e)return;yield n,++t}}function N5(r,e){return Kr(this,arguments,function*(){var n,i,a,o;if(e<0)throw new Dr(`Limit must be \u2265 0. Got ${e}`);let l=0;try{for(var u=!0,s=Ur(rr(r)),c;c=yield je(s.next()),n=c.done,!n;){o=c.value,u=!1;try{let f=o;if(l>=e)return yield je(void 0);yield yield je(f),++l}finally{u=!0}}}catch(f){i={error:f}}finally{try{!u&&!n&&(a=s.return)&&(yield je(a.call(s)))}finally{if(i)throw i.error}}})}function*C5(r){let e=0;for(let t of tr(r))yield[e++,t]}function M5(r){return Kr(this,arguments,function*(){var t,n,i,a;let o=0;try{for(var l=!0,u=Ur(rr(r)),s;s=yield je(u.next()),t=s.done,!t;){a=s.value,l=!1;try{let c=a;yield yield je([o++,c])}finally{l=!0}}}catch(c){n={error:c}}finally{try{!l&&!t&&(i=u.return)&&(yield je(i.call(u)))}finally{if(n)throw n.error}}})}function*T5(r,e=0,t,n=1){if(e<0)throw new Dr("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new Dr("Parameter 'count' cannot be negative");if(n<=0)throw new Dr("Parameter 'step' must be positive");let i=0,a=0;for(let o of tr(r))if(!(i++<e||(i-e-1)%n!==0)){if(a++===t&&t!==void 0)break;yield o}}function F5(r,e=0,t,n=1){return Kr(this,arguments,function*(){var a,o,l,u;if(e<0)throw new Dr("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new Dr("Parameter 'count' cannot be negative");if(n<=0)throw new Dr("Parameter 'step' must be positive");let s=0,c=0;try{for(var f=!0,p=Ur(rr(r)),m;m=yield je(p.next()),a=m.done,!a;){u=m.value,f=!1;try{let h=u;if(s++<e||(s-e-1)%n!==0)continue;if(c++===t&&t!==void 0)break;yield yield je(h)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(l=p.return)&&(yield je(l.call(p)))}finally{if(o)throw o.error}}})}function*I5(r){for(let[e]of tr(r))yield e}function B5(r){return Kr(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=Ur(rr(r)),u;u=yield je(l.next()),t=u.done,!t;){a=u.value,o=!1;try{let[s]=a;yield yield je(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield je(i.call(l)))}finally{if(n)throw n.error}}})}function*P5(r,e,t=0){if(e<0||t<0)throw new Dr;let n=-t;for(let i of tr(r))(n<0||n>=e)&&(yield i),++n}function O5(r,e,t=0){return Kr(this,arguments,function*(){var i,a,o,l;if(e<0||t<0)throw new Dr;let u=-t;try{for(var s=!0,c=Ur(rr(r)),f;f=yield je(c.next()),i=f.done,!i;){l=f.value,s=!1;try{let p=l;(u<0||u>=e)&&(yield yield je(p)),++u}finally{s=!0}}}catch(p){a={error:p}}finally{try{!s&&!i&&(o=c.return)&&(yield je(o.call(c)))}finally{if(a)throw a.error}}})}function*k5(r){for(let[,e]of tr(r))yield e}function R5(r){return Kr(this,arguments,function*(){var t,n,i,a;try{for(var o=!0,l=Ur(rr(r)),u;u=yield je(l.next()),t=u.done,!t;){a=u.value,o=!1;try{let[,s]=a;yield yield je(s)}finally{o=!0}}}catch(s){n={error:s}}finally{try{!o&&!t&&(i=l.return)&&(yield je(i.call(l)))}finally{if(n)throw n.error}}})}function*L5(r,e,t){let n=new Map,i=a=>{n.has(a)||(t!==void 0?n.set(a,{}):n.set(a,[]))};for(let a of tr(r)){let o=e(a),l=t!==void 0?t(a):void 0,u=(zn(o)||Ei(o))&&!sa(o)?o:[o];for(let s of lA(u))i(s),l===void 0?n.get(s).push(a):n.get(s)[l]=a}for(let a of n)yield a}function U5(r,e,t){return Kr(this,arguments,function*(){var i,a,o,l,u,s,c,f;let p=new Map,m=x=>{p.has(x)||(t!==void 0?p.set(x,{}):p.set(x,[]))};try{for(var h=!0,d=Ur(rr(r)),g;g=yield je(d.next()),i=g.done,!i;){l=g.value,h=!1;try{let x=l,_=yield je(e(x)),b=t!==void 0?yield je(t(x)):void 0,E=(Fa(_)||zn(_)||Ei(_))&&!sa(_)?_:[_];try{for(var v=!0,w=(s=void 0,Ur(c5(E))),y;y=yield je(w.next()),u=y.done,!u;){f=y.value,v=!1;try{let D=f;m(D),b===void 0?p.get(D).push(x):p.get(D)[b]=x}finally{v=!0}}}catch(D){s={error:D}}finally{try{!v&&!u&&(c=w.return)&&(yield je(c.call(w)))}finally{if(s)throw s.error}}}finally{h=!0}}}catch(x){a={error:x}}finally{try{!h&&!i&&(o=d.return)&&(yield je(o.call(d)))}finally{if(a)throw a.error}}for(let x of p)yield yield je(x)})}function*V5(r,e){let t=uA(r);e!==void 0?t.sort(e):t.sort();for(let n of t)yield n}function $5(r,e){return Kr(this,arguments,function*(){let n=yield je(rc(r));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield je(i)})}var P4={chunkwise:S5,chunkwiseOverlap:id,compress:p5,dropWhile:d5,enumerate:C5,filter:_5,flatMap:x5,flatten:cA,groupBy:L5,keys:I5,limit:D5,map:f5,pairwise:ds,repeat:y5,skip:P5,slice:T5,sort:V5,takeWhile:g5,values:k5,chunkwiseAsync:E5,chunkwiseOverlapAsync:ad,compressAsync:m5,dropWhileAsync:h5,enumerateAsync:M5,filterAsync:A5,flatMapAsync:w5,flattenAsync:fA,groupByAsync:U5,keysAsync:B5,limitAsync:N5,mapAsync:nd,pairwiseAsync:nc,repeatAsync:b5,skipAsync:O5,sliceAsync:F5,sortAsync:$5,takeWhileAsync:v5,valuesAsync:R5};var q5={allMatch:z4,allUnique:G4,anyMatch:j4,exactlyN:J4,isEmpty:X4,isAsyncIterable:Fa,isIterable:zn,isIterator:Ei,isReversed:K4,isSorted:t5,isString:sa,noneMatch:n5,same:a5,sameCount:s5,allMatchAsync:H4,allUniqueAsync:W4,anyMatchAsync:Z4,exactlyNAsync:Y4,isEmptyAsync:Q4,isReversedAsync:e5,isSortedAsync:r5,noneMatchAsync:i5,sameAsync:o5,sameCountAsync:u5};function z5(r){return hs.ViewPlugin.fromClass(class{constructor(e){var t;this.component=new od.Component,this.component.load(),this.decorations=(t=this.renderWidgets(e))!=null?t:hs.Decoration.none}isLivePreview(e){return e.field(od.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,n,i)=>{var o,l;return q5.anyMatch(e.visibleRanges,u=>Ca.checkRangeOverlap(t,n,u.from,u.to))?!0:((l=(o=i.spec).mb_unload)==null||l.call(o),!1)}});for(let{from:t,to:n}of e.visibleRanges)(0,pA.syntaxTree)(e.state).iterate({from:t,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,t){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,filterTo:i,filter:(o,l,u)=>{var s,c;return t&&u.spec.mb_widgetType===t?!0:((c=(s=u.spec).mb_unload)==null||c.call(s),!1)}})})}addDecoration(e,t,n,i,a){let o=e.from-1,l=e.to+1;if(Ca.existsDecorationOfTypeBetween(this.decorations,n,o,l))return;let u=Ca.getCurrentFile(t);if(!u)return;let s=this.renderWidget(e,a,n,i,u),c=Array.isArray(s)?s:[s];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,t){var i;let n=new Set((i=t.type.name)==null?void 0:i.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let a=e.state.selection,o=Ca.checkSelectionOverlap(a,t.from-1,t.to+1),l=this.readNode(e,t.from,t.to),u=this.isLivePreview(e.state);return{shouldRender:!o&&u,shouldHighlight:(o||!u)&&r.settings.enableSyntaxHighlighting,content:l.content,widgetType:l.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,n){let i=Ca.getContent(e.state,t,n);return{content:i,widgetType:r.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let t=Ca.getCurrentFile(e);if(!t)return;let n=[];for(let i of e.visibleRanges)(0,pA.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,l=this.getRenderInfo(e,o);if(!l.widgetType||!l.content)return;let u;l.shouldRender&&(u=this.renderWidget(o,l.widgetType,"field",l.content,t)),l.shouldHighlight&&(u=this.renderWidget(o,l.widgetType,"highlight",l.content,t)),u&&(Array.isArray(u)?n.push(...u):n.push(u))}});return hs.Decoration.set(n,!0)}renderWidget(e,t,n,i,a){if(n==="field"){let o=r.api.constructMDRCWidget(t,i,a.path,this.component,r);return hs.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{var l;(l=o.renderChild)==null||l.unload()}}).range(e.from-1,e.to+1)}else return r.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(l=>hs.Decoration.mark({class:`mb-highlight-${l.tokenClass}`}).range(e.from+l.range.from.index,e.from+l.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var sd=class{constructor(){this.activeMDRCs=new Map}unloadFile(e){for(let t of this.activeMDRCs.values())t.filePath===e&&(console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${t.uuid}`),t.unload())}unload(){for(let e of this.activeMDRCs.values())console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),e.unload()}registerMDRC(e){console.debug(`meta-bind | MDRCManager >> registered MDRC ${e.uuid}`),this.activeMDRCs.set(e.uuid,e)}unregisterMDRC(e){console.debug(`meta-bind | MDRCManager >> unregistered MDRC ${e.uuid}`),this.activeMDRCs.delete(e.uuid)}};var H5=require("obsidian");var mA=8,ic=class extends aa{constructor(e,t,n,i,a){super(e,t,n),this.content=i,this.depth=a,this.uuid=mr()}async parseContent(){let e=this.content.split(`
`).map(o=>o.trim()).filter(o=>o.length>0);if(e.length===0)return"";if(e.length>1)throw new ws({errorLevel:"ERROR",effect:"can not create embed",cause:"embed may only contain one link"});let t=e[0],n=un.parseLink(t);if(!n.internal)throw new ws({errorLevel:"ERROR",effect:"can not create embed",cause:"embed link is not an internal link"});let i=this.plugin.app.metadataCache.getFirstLinkpathDest(n.target,this.filePath);if(i===null)throw new ws({errorLevel:"ERROR",effect:"can not create embed",cause:"link target not found"});return(await this.plugin.app.vault.cachedRead(i)).replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`)}async onload(){if(console.debug("meta-bind | EmbedMDRC >> unload",this),this.depth>=mA)this.containerEl.empty(),this.containerEl.addClass("mb-error"),this.containerEl.innerText="Max embed depth reached";else{let e=await this.parseContent();await H5.MarkdownRenderer.render(this.plugin.app,e,this.containerEl,this.filePath,this)}super.onload()}onunload(){console.debug("meta-bind | EmbedMDRC >> unload",this),ci(this.containerEl,"embed"),super.onunload()}};var si=require("obsidian");var ac=require("obsidian"),ud=class extends ac.Modal{constructor(e,t,n,i,a,o,l){super(e),this.value=t,this.title=n,this.subTitle=i,this.description=a,this.onSubmit=o,this.onCancel=l}onOpen(){this.contentEl.empty(),this.contentEl.createEl("h2",{text:this.title});let e=new ac.Setting(this.contentEl);e.setName(this.subTitle),e.setDesc(this.description),e.addText(n=>{n.setValue(this.value),n.setPlaceholder(this.subTitle),n.onChange(i=>{this.value=i})});let t=new ac.Setting(this.contentEl);t.addButton(n=>{n.setButtonText("Apply"),n.setCta(),n.onClick(()=>{this.onSubmit(this.value),this.close()})}),t.addButton(n=>{n.setButtonText("Cancel"),n.onClick(()=>{this.onCancel(),this.close()})})}onClose(){super.onClose()}};var W5=require("obsidian");var G5=require("obsidian"),ld=class extends G5.FuzzySuggestModal{constructor(e,t,n){super(e),this.options=t,this.onSelect=n}getItemText(e){return e.displayValue}getItems(){return this.options}onChooseItem(e,t){this.onSelect(e)}};var Do=class{constructor(e,t){this.value=e,this.displayValue=t}valueAsString(){var e,t;return(t=(e=this.value)==null?void 0:e.toString())!=null?t:"null"}};function MX(r,e,t,n,i){let a=[];for(let o of t)a.push(new Do(o.value,o.name));if(n.length>0){let o;try{o=eD(r)}catch(u){return new W5.Notice("meta-bind | Dataview needs to be installed and enabled to use suggest option queries. Check the console for more information."),console.warn("meta-bind | failed to get dataview api",u),a}let l=Pe.object({name:Pe.string().min(1),path:Pe.string().min(1)});for(let u of n)o.pages(u.value,e).forEach(c=>{try{let f=c.file;if(!l.safeParse(f).success)return;let p=SE(f.path,f.name,i);a.push(new Do(p,`file: ${f.name}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function TX(r,e){let t=r.base.getArguments("option"),n=r.base.getArguments("optionQuery"),i=r.base.getArgument("useLinks");return MX(e,r.base.getFilePath(),t,n,i===void 0?"true":i.value)}function j5(r,e,t){new ld(t.app,TX(r,t),e).open()}var Hn=require("obsidian");var K5=require("obsidian");function FX(r){en(r,"svelte-1m4qg39",".image-card-image.svelte-1m4qg39{width:100%;height:fit-content;max-height:500px;object-fit:contain}.image-card-text.svelte-1m4qg39{display:block;margin:var(--size-4-2);margin-bottom:var(--size-4-4)}")}function IX(r){let e,t,n,i,a,o,l,u;return{c(){e=Z("div"),t=Z("img"),i=ue(),a=Z("span"),o=Ie(r[0]),k(t,"class","image-card-image svelte-1m4qg39"),vs(t.src,n=Zs(r[0]))||k(t,"src",n),k(t,"alt",r[0]),k(a,"class","image-card-text svelte-1m4qg39"),k(e,"class","image-card svelte-1m4qg39"),k(e,"role","button"),k(e,"tabindex","0")},m(s,c){J(s,e,c),z(e,t),z(e,i),z(e,a),z(a,o),l||(u=[Ae(e,"click",r[3]),Ae(e,"keydown",r[4])],l=!0)},p(s,[c]){c&1&&!vs(t.src,n=Zs(s[0]))&&k(t,"src",n),c&1&&k(t,"alt",s[0]),c&1&&Ke(o,s[0])},i:Me,o:Me,d(s){s&&j(e),l=!1,ot(u)}}}function BX(r,e,t){let{image:n}=e,{onSelect:i}=e;function a(u,s){u.key===" "&&i(s)}let o=()=>i(n),l=u=>a(u,n);return r.$$set=u=>{"image"in u&&t(0,n=u.image),"onSelect"in u&&t(1,i=u.onSelect)},[n,i,a,o,l]}var dA=class extends Le{constructor(e){super(),$e(this,e,BX,IX,Ve,{image:0,onSelect:1},FX)}},Z5=dA;var X5=require("obsidian");function J5(r,e,t){let n=r.slice();return n[6]=e[t],n}function Y5(r){let e,t;return e=new Z5({props:{image:r[6].value,onSelect:r[0]}}),{c(){we(e.$$.fragment)},m(n,i){be(e,n,i),t=!0},p(n,i){let a={};i&4&&(a.image=n[6].value),i&1&&(a.onSelect=n[0]),e.$set(a)},i(n){t||(ee(e.$$.fragment,n),t=!0)},o(n){re(e.$$.fragment,n),t=!1},d(n){xe(e,n)}}}function PX(r){let e,t,n,i,a,o,l,u=We(r[2]),s=[];for(let f=0;f<u.length;f+=1)s[f]=Y5(J5(r,u,f));let c=f=>re(s[f],1,1,()=>{s[f]=null});return{c(){e=Z("div"),t=Z("input"),n=ue(),i=Z("div");for(let f=0;f<s.length;f+=1)s[f].c();k(t,"type","text"),k(t,"placeholder","Search Images..."),k(e,"class","mb-image-search-container"),k(i,"class","mb-image-card-grid")},m(f,p){J(f,e,p),z(e,t),Ye(t,r[1]),J(f,n,p),J(f,i,p);for(let m=0;m<s.length;m+=1)s[m]&&s[m].m(i,null);a=!0,o||(l=Ae(t,"input",r[4]),o=!0)},p(f,[p]){if(p&2&&t.value!==f[1]&&Ye(t,f[1]),p&5){u=We(f[2]);let m;for(m=0;m<u.length;m+=1){let h=J5(f,u,m);s[m]?(s[m].p(h,p),ee(s[m],1)):(s[m]=Y5(h),s[m].c(),ee(s[m],1),s[m].m(i,null))}for(pt(),m=u.length;m<s.length;m+=1)c(m);mt()}},i(f){if(!a){for(let p=0;p<u.length;p+=1)ee(s[p]);a=!0}},o(f){s=s.filter(Boolean);for(let p=0;p<s.length;p+=1)re(s[p]);a=!1},d(f){f&&(j(e),j(n),j(i)),At(s,f),o=!1,l()}}}function OX(r,e,t){let{options:n}=e,{onSelect:i}=e,a="",o;function l(s){var c;if(!s){t(2,o=n);return}let f=(0,X5.prepareFuzzySearch)(s),p=[];for(let m of n)((c=f(m.value))===null||c===void 0?void 0:c.score)!==void 0&&p.push(m);t(2,o=p)}function u(){a=this.value,t(1,a)}return r.$$set=s=>{"options"in s&&t(3,n=s.options),"onSelect"in s&&t(0,i=s.onSelect)},r.$$.update=()=>{r.$$.dirty&2&&l(a)},[i,a,o,n,u]}var hA=class extends Le{constructor(e){super(),$e(this,e,OX,PX,Ve,{options:3,onSelect:0})}},Q5=hA;var cd=class extends K5.Modal{constructor(e,t,n){super(e),this.options=t,this.onSelect=n}onOpen(){this.modalEl.style.width="100%",new Q5({target:this.contentEl,props:{options:this.options,onSelect:e=>{this.onSelect(e),this.close()}}})}};function e8(r){let e=[];for(let t of r.children)t instanceof Hn.TFile&&t8(t.extension)&&e.push(new Do(t.path,t.name)),t instanceof Hn.TFolder&&e.push(...e8(t));return e}function kX(r,e,t){let n=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:"expected suggest option query for image suggester to start and end with double quotation marks"});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof Hn.TFolder)){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}n.push(...e8(o))}for(let i of r){let a=nl(i.value);if(!a){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!(o instanceof Hn.TFile)){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}if(!t8(o.extension)){let l=new ir({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Hn.Notice(`meta-bind | ${l.message}`),console.warn(l);continue}n.push(new Do(o.path,o.name))}return n}function t8(r){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(r)}function RX(r,e){let t=r.base.getArguments("option"),n=r.base.getArguments("optionQuery");return kX(t,n,e)}function r8(r,e,t){new cd(t.app,RX(r,t),e).open()}var u8=require("obsidian");var a8=require("obsidian");function LX(r){en(r,"svelte-12l82wb",".calendar.svelte-12l82wb{margin-top:10px}.calendar-header.svelte-12l82wb{display:flex;justify-content:space-around;flex-wrap:wrap;gap:var(--size-4-1);background:var(--background-secondary);border-radius:var(--mb-border-radius);margin-bottom:var(--size-4-1)}.calendar-content.svelte-12l82wb{display:grid;flex-wrap:wrap;grid-template-columns:repeat(7, 1fr);gap:var(--size-4-1)}.cell.svelte-12l82wb{min-width:40px;padding:var(--size-4-2);display:flex;justify-content:center;align-items:center;border-radius:var(--mb-border-radius)}.content-cell.svelte-12l82wb{cursor:pointer}.cell-text.svelte-12l82wb{margin:auto;text-align:center}.selected.svelte-12l82wb{background:var(--interactive-accent);color:var(--text-on-accent)}.highlight.svelte-12l82wb:hover{background:var(--interactive-hover)}.selected.highlight.svelte-12l82wb:hover{background:var(--interactive-accent-hover)}")}function n8(r,e,t){let n=r.slice();return n[10]=e[t],n}function UX(r,e,t){let n=r.slice();return n[13]=e[t],n}function VX(r){let e,t,n;return{c(){e=Z("div"),t=Z("span"),t.textContent=`${r[13]}`,n=ue(),k(t,"class","cell-text svelte-12l82wb"),k(e,"class","cell header-cell svelte-12l82wb")},m(i,a){J(i,e,a),z(e,t),z(e,n)},p:Me,d(i){i&&j(e)}}}function i8(r,e){let t,n,i=(e[10]||"")+"",a,o,l,u;function s(){return e[6](e[10])}function c(...f){return e[7](e[10],...f)}return{key:r,first:null,c(){var f,p,m;t=Z("div"),n=Z("span"),a=Ie(i),o=ue(),k(n,"class","cell-text svelte-12l82wb"),k(t,"class","cell svelte-12l82wb"),k(t,"role","button"),k(t,"tabindex","0"),St(t,"highlight",e[10]),St(t,"content-cell",e[10]),St(t,"selected",((f=e[0])==null?void 0:f.year())===e[2]&&((p=e[0])==null?void 0:p.month())===e[1]&&((m=e[0])==null?void 0:m.date())===e[10]),this.first=t},m(f,p){J(f,t,p),z(t,n),z(n,a),z(t,o),l||(u=[Ae(t,"click",s),Ae(t,"keydown",c)],l=!0)},p(f,p){var m,h,d;e=f,p&8&&i!==(i=(e[10]||"")+"")&&Ke(a,i),p&8&&St(t,"highlight",e[10]),p&8&&St(t,"content-cell",e[10]),p&15&&St(t,"selected",((m=e[0])==null?void 0:m.year())===e[2]&&((h=e[0])==null?void 0:h.month())===e[1]&&((d=e[0])==null?void 0:d.date())===e[10])},d(f){f&&j(t),l=!1,ot(u)}}}function $X(r){let e,t,n,i,a=[],o=new Map,l=We(M4()),u=[];for(let f=0;f<l.length;f+=1)u[f]=VX(UX(r,l,f));let s=We(r[3]),c=f=>T4();for(let f=0;f<s.length;f+=1){let p=n8(r,s,f),m=c(p);o.set(m,a[f]=i8(m,p))}return{c(){e=Z("div"),t=Z("div");for(let f=0;f<u.length;f+=1)u[f].c();n=ue(),i=Z("div");for(let f=0;f<a.length;f+=1)a[f].c();k(t,"class","calendar-header svelte-12l82wb"),k(i,"class","calendar-content svelte-12l82wb"),k(e,"class","calendar svelte-12l82wb")},m(f,p){J(f,e,p),z(e,t);for(let m=0;m<u.length;m+=1)u[m]&&u[m].m(t,null);z(e,n),z(e,i);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(i,null)},p(f,[p]){p&63&&(s=We(f[3]),a=xs(a,p,c,1,f,s,o,i,IA,i8,null,n8))},i:Me,o:Me,d(f){f&&j(e),At(u,f);for(let p=0;p<a.length;p+=1)a[p].d()}}}function qX(r,e,t){let n=Fo(),{selectedDate:i}=e,{month:a}=e,{year:o}=e,l;function u(m){n("dateChange",(0,a8.moment)(new Date(o,a,m)))}function s(m){m&&u(m)}function c(m,h){m.key===" "&&s(h)}let f=m=>s(m),p=(m,h)=>c(h,m);return r.$$set=m=>{"selectedDate"in m&&t(0,i=m.selectedDate),"month"in m&&t(1,a=m.month),"year"in m&&t(2,o=m.year)},r.$$.update=()=>{r.$$.dirty&6&&t(3,l=C4(a,o))},[i,a,o,l,s,c,f,p]}var gA=class extends Le{constructor(e){super(),$e(this,e,qX,$X,Ve,{selectedDate:0,month:1,year:2},LX)}},o8=gA;var vA=require("obsidian");function zX(r){en(r,"svelte-berpp6",".date-picker.svelte-berpp6{display:block;padding:var(--size-4-4)}.date-picker-header.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:space-around}.date-picker-header-text.svelte-berpp6{flex:1;text-align:center;display:flex;gap:var(--size-4-2);align-items:center;justify-content:center;width:min-content}.date-picker-header-text-year.svelte-berpp6{width:60px;padding:var(--size-4-2)}.date-picker-header-text-month.svelte-berpp6{height:min-content}.month-switch-button.svelte-berpp6{margin:0}.date-picker-footer.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:center}.none-button.svelte-berpp6{margin:0}")}function HX(r){let e,t,n,i,a,o,l=nA(r[1])+"",u,s,c,f,p,m,h,d,g,v,w,y,x,_;return d=new o8({props:{month:r[1],year:r[2],selectedDate:r[0]}}),d.$on("dateChange",r[6]),{c(){e=Z("div"),t=Z("div"),n=Z("button"),n.textContent="Prev",i=ue(),a=Z("div"),o=Z("span"),u=Ie(l),s=ue(),c=Z("input"),p=ue(),m=Z("button"),m.textContent="Next",h=ue(),we(d.$$.fragment),g=ue(),v=Z("div"),w=Z("button"),w.textContent="Set no Date",k(n,"class","month-switch-button svelte-berpp6"),k(o,"class","date-picker-header-text-month svelte-berpp6"),k(c,"class","date-picker-header-text-year svelte-berpp6"),k(c,"type","number"),c.value=f=r[2].toString(),k(a,"class","date-picker-header-text svelte-berpp6"),k(m,"class","month-switch-button svelte-berpp6"),k(t,"class","date-picker-header svelte-berpp6"),k(w,"class","none-button svelte-berpp6"),k(v,"class","date-picker-footer svelte-berpp6"),k(e,"class","date-picker svelte-berpp6")},m(b,E){J(b,e,E),z(e,t),z(t,n),z(t,i),z(t,a),z(a,o),z(o,u),z(a,s),z(a,c),z(t,p),z(t,m),z(e,h),be(d,e,null),z(e,g),z(e,v),z(v,w),y=!0,x||(_=[Ae(n,"click",r[4]),Ae(c,"input",r[5]),Ae(m,"click",r[3]),Ae(w,"click",r[7])],x=!0)},p(b,[E]){(!y||E&2)&&l!==(l=nA(b[1])+"")&&Ke(u,l),(!y||E&4&&f!==(f=b[2].toString())&&c.value!==f)&&(c.value=f);let D={};E&2&&(D.month=b[1]),E&4&&(D.year=b[2]),E&1&&(D.selectedDate=b[0]),d.$set(D)},i(b){y||(ee(d.$$.fragment,b),y=!0)},o(b){re(d.$$.fragment,b),y=!1},d(b){b&&j(e),xe(d),x=!1,ot(_)}}}function GX(r,e,t){let{selectedDate:n=(0,vA.moment)()}=e,{dateChangeCallback:i}=e,a,o;function l(){if(a===11){t(1,a=0),t(2,o+=1);return}t(1,a=a+1)}function u(){if(a===0){t(1,a=11),t(2,o-=1);return}t(1,a-=1)}function s(p){let m=p.target.value,h=Number.parseInt(m);Number.isNaN(h)||t(2,o=h)}function c(p){t(0,n=p.detail),i(p.detail)}function f(){t(0,n=null),i(null)}return r.$$set=p=>{"selectedDate"in p&&t(0,n=p.selectedDate),"dateChangeCallback"in p&&t(8,i=p.dateChangeCallback)},r.$$.update=()=>{if(r.$$.dirty&1)if(n)t(1,a=n.month()),t(2,o=n.year());else{let p=(0,vA.moment)();t(1,a=p.month()),t(2,o=p.year())}},[n,a,o,l,u,s,c,f,i]}var yA=class extends Le{constructor(e){super(),$e(this,e,GX,HX,Ve,{selectedDate:0,dateChangeCallback:8},zX)}},s8=yA;var fd=class extends u8.Modal{constructor(e,t){super(e),this.datePicker=t}onOpen(){this.datePickerInput=new s8({target:this.contentEl,props:{selectedDate:this.datePicker.getInternalValue(),dateChangeCallback:e=>{this.datePicker.setInternalValue(e),this.close()}}})}onClose(){var e;(e=this.datePickerInput)==null||e.$destroy()}};var oc=require("obsidian");var pd=class{constructor(e,t,n,i){this.plugin=e,this.containerEl=t,this.code=i;let a=e.app.vault.getAbstractFileByPath(n);if(!(a instanceof oc.TFile))throw new Error(`File not found: ${n}`);this.file=a,this.jsEngine=Js(this.plugin),this.renderComponent=new oc.Component}async evaluateCode(e){return this.jsEngine.internal.execute({code:this.code,context:{file:this.file,line:0,metadata:this.plugin.app.metadataCache.getFileCache(this.file)},container:this.containerEl,component:this.renderComponent,contextOverrides:e})}async evaluate(e){try{Bt.empty(this.containerEl),Bt.removeClass(this.containerEl,"mb-error"),this.renderComponent.unload(),this.renderComponent=new oc.Component,this.renderComponent.load();let t=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);return await n.render(t.result),n.convertToSimpleObject(t.result)}catch(t){t instanceof Error&&(this.containerEl.innerText=t.message,Bt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var md=class{constructor(e){this.plugin=e,this.app=e.app}openDatePickerModal(e){new fd(this.app,e).open()}openImageSuggesterModal(e,t){r8(e,t,this.plugin)}openSuggesterModal(e,t){j5(e,t,this.plugin)}openTextPromptModal(e,t,n,i,a,o){new ud(this.app,e,t,n,i,a,o).open()}async renderMarkdown(e,t,n){let i=new si.Component;return await si.MarkdownRenderer.render(this.app,e,t,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return Js(this.plugin),!0}catch(e){return!1}}async jsEngineRunFile(e,t,n){let i=Js(this.plugin),a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof si.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new si.Component;return await i.internal.executeFile(e,{component:l,container:n,context:{metadata:o,file:a,line:0}}),()=>l.unload()}async jsEngineRunCode(e,t,n){let i=Js(this.plugin),a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof si.TFile))throw new Error(`calling file not found: ${t}`);let o=this.app.metadataCache.getFileCache(a),l=new si.Component;return await i.internal.execute({code:e,component:l,container:n,context:{metadata:o,file:a,line:0}}),()=>l.unload()}createJsRenderer(e,t,n){return new pd(this.plugin,e,t,n)}openFile(e,t,n){this.app.workspace.openLinkText(e,t,n)}getFilePathByName(e){var t;return(t=this.app.metadataCache.getFirstLinkpathDest(e,""))==null?void 0:t.path}showNotice(e){new si.Notice(e)}createErrorIndicator(e,t){new Wu({target:e,props:{app:this.plugin.app,props:t}})}parseYaml(e){return(0,si.parseYaml)(e)}};var WX=["true","false","on","off","yes","no"],jX=new RegExp("\\b(("+WX.join(")|(")+"))$","i"),sc={name:"yaml",token:function(r,e){var t=r.peek(),n=e.escaped;if(e.escaped=!1,t=="#"&&(r.pos==0||/\s/.test(r.string.charAt(r.pos-1))))return r.skipToEnd(),"comment";if(r.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&r.indentation()>e.keyCol)return r.skipToEnd(),"string";if(e.literal&&(e.literal=!1),r.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,r.match("---")||r.match("..."))return"def";if(r.match(/^\s*-\s+/))return"meta"}if(r.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&t==",")return r.next(),"meta";if(e.inlinePairs>0&&!n&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,r.next(),"meta";if(e.pairStart){if(r.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(r.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&r.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&r.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(r.match(jX))return"keyword"}return!e.pair&&r.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=r.indentation(),"atom"):e.pair&&r.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",r.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function l8(r){if(!r.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>{var i,a;return(a=(i=sc).startState)==null?void 0:a.call(i,4)},blankLine:i=>{var a,o;return(o=(a=sc).blankLine)==null?void 0:o.call(a,i,4)},copyState:i=>{var a,o;return(o=(a=sc).startState)==null?void 0:o.call(a,4)},token:(i,a)=>{var o,l;return`line-HyperMD-codeblock ${(l=(o=sc).token)==null?void 0:l.call(o,i,a)}`}}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",t=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let u=[i.string],s=1,c=i.lookAhead(s);for(;c!==void 0&&!e.test(c)&&(u.push(c),s+=1,c=i.lookAhead(s),!(s>100)););a.str=u.filter(p=>p.trim()!=="").join(`
`);let f=r.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new ga(a.str,[]):(a.mdrcType=f,a.highlights=r.api.syntaxHighlighting.highlight(a.str,a.mdrcType,!0))}let l=a.highlights.getHighlights().filter(u=>u.range.from.line===a.line).find(u=>u.range.from.column===i.pos+1);return l===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<l.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${l.tokenClass}`)}}))}var uc=fr(On()),lc=fr(Yn()),ZX=uc.P.sequenceMap((r,e,t,n)=>{let i=parseInt(r),a=parseInt(e),o=parseInt(t);return new Di(i,a,o,n)},lc.P_UTILS.digits().skip(uc.P.string(".")),lc.P_UTILS.digits().skip(uc.P.string(".")),lc.P_UTILS.digits(),uc.P.string("-").then(lc.P_UTILS.remaining()).optional()),Di=class r{constructor(e,t,n,i){this.major=e,this.minor=t,this.patch=n,this.prerelease=i}static fromString(e){return qr(ZX,e)}static lessThan(e,t){return e.major<t.major?!0:e.major>t.major?!1:e.minor<t.minor?!0:e.minor>t.minor?!1:e.patch<t.patch?!0:e.patch>t.patch||e.prerelease===void 0?!1:t.prerelease===void 0?!0:e.prerelease<t.prerelease}static greaterThan(e,t){return r.lessThan(t,e)}static equals(e,t){return e.major===t.major&&e.minor===t.minor&&e.patch===t.patch&&e.prerelease===t.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var dd=class{constructor(e,t){this.plugin=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(n=>n.pluginId===e);if(t===void 0)throw new Po({errorLevel:"CRITICAL",effect:"Dependency Violation Detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return t}getPlugin(e){return this.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new Po({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,t){if(Di.lessThan(t,e.minVersion))throw new Po({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${t}. Please update the plugin.`});if(e.maxVersion!==void 0&&(Di.greaterThan(t,e.maxVersion)||Di.equals(t,e.maxVersion)))throw new Po({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${t}. Please downgrade the plugin.`})}checkDependency(e){let t=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Di.fromString(n.manifest.version);return this.checkDependencyVersion(t,i),n}checkDependencyOnStartup(e){let t=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let n=Di.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(t,n)}checkDependenciesOnStartup(){let e=new Rt("Dependency Validation");for(let t of this.dependencies)if(t.checkOnStartup)try{this.checkDependencyOnStartup(t.pluginId)}catch(n){e.add(n)}return e.hasErrors()?(new Ss(this.plugin.app,{errorCollection:e,text:"The following errors were detected during dependency validation. The plugin won't load until these errors have been resolved. Please install the required plugins and restart Obsidian."}).open(),!0):!1}};var c8=require("obsidian");function f8(r,e,t){let n=hS(t),i=gS(t);r.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(l=>{l.setTitle("Input Field");let u=l.setSubmenu();for(let[s,c]of n)u.addItem(f=>{f.setTitle(s),f.onClick(()=>hd(e,c))})}),o.addItem(l=>{l.setTitle("View Field");let u=l.setSubmenu();for(let[s,c]of i)u.addItem(f=>{f.setTitle(s),f.onClick(()=>hd(e,c))})}),o.addItem(l=>{l.setTitle("Inline Button"),l.onClick(()=>{hd(e,"`BUTTON[example-id]`")})}),o.addItem(l=>{l.setTitle("Button"),l.onClick(()=>{new qa({plugin:t,onOkay:u=>{hd(e,`\`\`\`meta-bind-button
${(0,c8.stringifyYaml)(u)}
\`\`\``)},submitText:"Insert"}).open()})})})}function hd(r,e){r.replaceSelection(e)}var No=class{static get(e,t){return t.get(e).child}static tryGet(e,t){var n;return(n=t.tryGet(e))==null?void 0:n.child}static fullGet(e,t){return t.get(e)}static set(e,t,n){t.set(e,n)}static setAndCreate(e,t,n){t.setAndCreate(e,n)}};var ku=class{constructor(e,t){this.id=e,this.manager=t,this.cache=new Map}validateStoragePath(e,t,n,i){return i.validateStoragePathAsFilePath(e,n)}resolveBindTargetScope(e,t,n){return e}subscribe(e){if(e.bindTarget===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let t=this.cache.get(e.bindTarget.storagePath);return t===void 0&&(t=this.getDefaultCacheItem(e.bindTarget.storagePath),this.cache.set(e.bindTarget.storagePath,t)),t.subscriptions.push(e),t}unsubscribe(e){if(e.bindTarget===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"subscription bind target undefined"});let t=this.cache.get(e.bindTarget.storagePath);if(t===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return t.subscriptions=t.subscriptions.filter(n=>n.uuid!==e.uuid),t}getCacheItemForStoragePath(e){return this.cache.get(e)}onCycle(e){}iterateCacheItems(){return this.cache.values()}shouldDelete(e){return!0}delete(e){this.cache.delete(e.storagePath)}update(e,t){if(t.bindTarget===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not update metadata",cause:"subscription bind target undefined"});let n=this.cache.get(t.bindTarget.storagePath);if(n===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not update metadata",cause:"cache item does not exist"});return No.setAndCreate(n.data,t.bindTarget.storageProp,e),n}updateEntireCache(e,t){t.data=e}readCache(e){if(e.storageType!==this.id)throw new zt({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let t=this.getCacheItemForStoragePath(e.storagePath);if(t===void 0)throw new zt({errorLevel:"ERROR",effect:"can not read cache",cause:`Cache item for path "${e.storagePath}" does not exist or is not loaded`});return this.readCacheItem(t,e.storageProp)}readCacheItem(e,t){return No.tryGet(e.data,t)}readEntireCacheItem(e){return e.data}};var gd=class extends ku{getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}async syncExternal(e){}},vd=class{constructor(e,t){this.id=e,this.manager=t,this.cache={data:{},...this.manager.getDefaultCacheItem()}}validateStoragePath(e,t,n,i){if(t)throw new $r("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",n,e.position);return""}resolveBindTargetScope(e,t,n){return e}delete(e){}getCacheItemForStoragePath(e){return this.cache}iterateCacheItems(){return[this.cache][Symbol.iterator]()}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,t){return No.tryGet(e.data,t)}shouldDelete(e){return!1}subscribe(e){return this.cache.subscriptions.push(e),this.cache}syncExternal(e){}unsubscribe(e){return this.cache.subscriptions=this.cache.subscriptions.filter(t=>t.uuid!==e.uuid),this.cache}update(e,t){if(t.bindTarget===void 0)throw new zt({errorLevel:"CRITICAL",effect:"can not update metadata",cause:"subscription bind target undefined"});return No.setAndCreate(this.cache.data,t.bindTarget.storageProp,e),this.cache}updateEntireCache(e,t){t.data=e}readEntireCacheItem(e){return e.data}},yd=class{constructor(e,t){this.id=e,this.manager=t}validateStoragePath(e,t,n,i){if(t)throw new $r("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}resolveBindTargetScope(e,t,n){return n.resolveScope(e,t)}delete(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,t){}shouldDelete(e){return!0}subscribe(e){throw new zt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new zt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}update(e,t){throw new zt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}updateEntireCache(e,t){}readEntireCacheItem(e){throw new zt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};var p8=require("obsidian");var bd=class extends ku{constructor(e,t,n){super(t,n),this.plugin=e,this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(i,a,o)=>{var l;this.manager.onExternalUpdate(this,i.path,(l=structuredClone(o.frontmatter))!=null?l:{})}))}getDefaultCacheItem(e){var i,a;let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof p8.TFile))throw new zt({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let n=(i=this.plugin.app.metadataCache.getFileCache(t))==null?void 0:i.frontmatter;return console.log("meta-bind | Obs Source >> loaded frontmatter",structuredClone(n),e),{data:(a=structuredClone(n))!=null?a:{},storagePath:e,file:t,...this.manager.getDefaultCacheItem()}}async syncExternal(e){await this.plugin.app.fileManager.processFrontMatter(e.file,t=>{Object.assign(t,e.data)})}};var th=(n=>(n.DEV="dev",n.CANARY="canary",n.RELEASE="release",n))(th||{}),xd=class extends Ru.Plugin{async onload(){console.log("meta-bind | Main >> load"),this.build=this.determineBuild(),await this.loadSettings(),this.addSettingTab(new Zc(this.app,this)),this.dependencyManager=new dd(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Di(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Di(0,1,0)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new rd(this),this.internal=new md(this),this.mdrcManager=new sd,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(z5(this)),this.addCommands(),l8(this),this.registerView(Oo,e=>new Mc(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,t)=>{f8(e,t,this)})),await(0,Ru.loadPrism)())}onunload(){console.log("meta-bind | Main >> unload"),this.mdrcManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}setUpMetadataManager(){this.metadataManager=new lf,this.metadataManager.registerSource(new bd(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new gd("memory",this.metadataManager)),this.metadataManager.registerSource(new vd("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new yd("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,t)=>{this.mdrcManager.unloadFile(t),this.metadataManager.onStoragePathRenamed(t,e.path)})),this.registerEvent(this.app.vault.on("delete",e=>{this.mdrcManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.settings.syncInterval))}addPostProcessors(){this.registerMarkdownPostProcessor((e,t)=>{let n=e.querySelectorAll("code"),i=t.sourcePath;for(let a=0;a<n.length;a++){let o=n.item(a);if(o.hasClass("mb-none"))continue;let l=o.innerText,u=this.api.isInlineFieldDeclarationAndGetType(l);u!==void 0&&this.api.createMDRC(u,l,"inline",i,o,t,void 0)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,t,n)=>{let i=t,a=e.trim(),o=n.sourcePath,l=this.api.isInlineFieldDeclarationAndGetType(a);l!==void 0&&this.api.createMDRC(l,a,"block",o,i,n,void 0)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,t,n)=>{let i=t,a=e.trim(),o=n.sourcePath;this.api.createMDRC("JS_VIEW_FIELD",a,"block",o,i,n,void 0)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,t,n)=>{let i=new ic(this,n.sourcePath,t,e,0);n.addChild(i)});for(let e=1;e<=mA;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(t,n,i)=>{let a=new ic(this,i.sourcePath,n,t,e);i.addChild(a)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,t,n)=>{console.log(n.getSectionInfo(t)),this.api.createButtonFromString(e,n.sourcePath,t,n)})}addCommands(){this.addCommand({id:"open-docs",name:"Open Meta Bind Docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.addCommand({id:"open-faq",name:"Open Meta Bind FAQ",callback:()=>{this.activateView(Oo)}}),this.addCommand({id:"open-help",name:"Open Meta Bind Help",callback:()=>{this.activateView(Oo)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{new qa({plugin:this,onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,Ru.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"}).open()}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.register(()=>e.remove())}if(this.build==="canary"){let e=this.addStatusBarItem();e.setText(`Meta Bind Canary Build (${this.manifest.version})`),e.addClass("mb-error"),this.register(()=>e.remove())}}loadTemplates(){let e=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);e.hasErrors()&&console.warn("meta-bind | failed to parse input field templates",e);let t=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);t.hasErrors()&&console.warn("meta-bind | failed to parse button templates",t)}isFilePathExcluded(e){for(let t of this.settings.excludedFolders)if(e.startsWith(t))return!0;return!1}async loadSettings(){console.log("meta-bind | Main >> settings load");let e=await this.loadData();this.settings=Object.assign({},Ci,e),await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),Zr.dateFormat=this.settings.preferredDateFormat,N4(this.settings.firstWeekday),await this.saveData(this.settings)}async activateView(e){let{workspace:t}=this.app,n,i=t.getLeavesOfType(e);i.length>0?n=i[0]:(n=t.getLeaf("tab"),await n.setViewState({type:e,active:!0})),t.revealLeaf(n)}};
/*! Bundled license information:
complex.js/complex.js:
(**
* @license Complex.js v2.1.1 12/05/2020
*
* Copyright (c) 2020, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**)
fraction.js/fraction.js:
(**
* @license Fraction.js v4.3.0 20/08/2023
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
*
* Copyright (c) 2023, Robert Eisele (robert@raw.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**)
decimal.js/decimal.mjs:
(*!
* decimal.js v10.4.3
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*)
*/