Oscar Plaisant 66c143b7b3 update
2024-05-14 10:51:40 +02:00

171 lines
1.1 MiB

/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Fri, 19 Apr 2024 14:14:37 GMT
Version: 1.1.0
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
-------------------------------------------
Copyright (C) 2024 Moritz Jung
-------------------------------------------
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
"use strict";var J7=Object.create;var Vf=Object.defineProperty;var X7=Object.getOwnPropertyDescriptor;var Q7=Object.getOwnPropertyNames;var K7=Object.getPrototypeOf,ez=Object.prototype.hasOwnProperty;var xn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),tz=(n,e)=>{for(var t in e)Vf(n,t,{get:e[t],enumerable:!0})},gE=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Q7(e))!ez.call(n,i)&&i!==t&&Vf(n,i,{get:()=>e[i],enumerable:!(r=X7(e,i))||r.enumerable});return n};var wr=(n,e,t)=>(t=n!=null?J7(K7(n)):{},gE(e||!n||!n.__esModule?Vf(t,"default",{value:n,enumerable:!0}):t,n)),rz=n=>gE(Vf({},"__esModule",{value:!0}),n);var pc=xn((Tg,Uu)=>{(function(n,e){typeof Tg=="object"&&typeof Uu<"u"?Uu.exports=e():typeof define=="function"&&define.amd?define(e):n.moment=e()})(Tg,function(){"use strict";var n;function e(){return n.apply(null,arguments)}function t(g){n=g}function r(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function i(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function a(g,M){return Object.prototype.hasOwnProperty.call(g,M)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var M;for(M in g)if(a(g,M))return!1;return!0}function u(g){return g===void 0}function s(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function l(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function c(g,M){var I=[],R,G=g.length;for(R=0;R<G;++R)I.push(M(g[R],R));return I}function f(g,M){for(var I in M)a(M,I)&&(g[I]=M[I]);return a(M,"toString")&&(g.toString=M.toString),a(M,"valueOf")&&(g.valueOf=M.valueOf),g}function p(g,M,I,R){return YM(g,M,I,R,!0).utc()}function m(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function h(g){return g._pf==null&&(g._pf=m()),g._pf}var d;Array.prototype.some?d=Array.prototype.some:d=function(g){var M=Object(this),I=M.length>>>0,R;for(R=0;R<I;R++)if(R in M&&g.call(this,M[R],R,M))return!0;return!1};function v(g){var M=null,I=!1,R=g._d&&!isNaN(g._d.getTime());if(R&&(M=h(g),I=d.call(M.parsedDateParts,function(G){return G!=null}),R=M.overflow<0&&!M.empty&&!M.invalidEra&&!M.invalidMonth&&!M.invalidWeekday&&!M.weekdayMismatch&&!M.nullInput&&!M.invalidFormat&&!M.userInvalidated&&(!M.meridiem||M.meridiem&&I),g._strict&&(R=R&&M.charsLeftOver===0&&M.unusedTokens.length===0&&M.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=R;else return R;return g._isValid}function y(g){var M=p(NaN);return g!=null?f(h(M),g):h(M).userInvalidated=!0,M}var S=e.momentProperties=[],b=!1;function w(g,M){var I,R,G,ce=S.length;if(u(M._isAMomentObject)||(g._isAMomentObject=M._isAMomentObject),u(M._i)||(g._i=M._i),u(M._f)||(g._f=M._f),u(M._l)||(g._l=M._l),u(M._strict)||(g._strict=M._strict),u(M._tzm)||(g._tzm=M._tzm),u(M._isUTC)||(g._isUTC=M._isUTC),u(M._offset)||(g._offset=M._offset),u(M._pf)||(g._pf=h(M)),u(M._locale)||(g._locale=M._locale),ce>0)for(I=0;I<ce;I++)R=S[I],G=M[R],u(G)||(g[R]=G);return g}function A(g){w(this,g),this._d=new Date(g._d!=null?g._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),b===!1&&(b=!0,e.updateOffset(this),b=!1)}function x(g){return g instanceof A||g!=null&&g._isAMomentObject!=null}function D(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function E(g,M){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),I){var R=[],G,ce,Oe,gt=arguments.length;for(ce=0;ce<gt;ce++){if(G="",typeof arguments[ce]=="object"){G+=`
[`+ce+"] ";for(Oe in arguments[0])a(arguments[0],Oe)&&(G+=Oe+": "+arguments[0][Oe]+", ");G=G.slice(0,-2)}else G=arguments[ce];R.push(G)}D(g+`
Arguments: `+Array.prototype.slice.call(R).join("")+`
`+new Error().stack),I=!1}return M.apply(this,arguments)},M)}var _={};function N(g,M){e.deprecationHandler!=null&&e.deprecationHandler(g,M),_[g]||(D(M),_[g]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function P(g){return typeof Function<"u"&&g instanceof Function||Object.prototype.toString.call(g)==="[object Function]"}function B(g){var M,I;for(I in g)a(g,I)&&(M=g[I],P(M)?this[I]=M:this["_"+I]=M);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function V(g,M){var I=f({},g),R;for(R in M)a(M,R)&&(i(g[R])&&i(M[R])?(I[R]={},f(I[R],g[R]),f(I[R],M[R])):M[R]!=null?I[R]=M[R]:delete I[R]);for(R in g)a(g,R)&&!a(M,R)&&i(g[R])&&(I[R]=f({},I[R]));return I}function z(g){g!=null&&this.set(g)}var L;Object.keys?L=Object.keys:L=function(g){var M,I=[];for(M in g)a(g,M)&&I.push(M);return I};var k={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function C(g,M,I){var R=this._calendar[g]||this._calendar.sameElse;return P(R)?R.call(M,I):R}function W(g,M,I){var R=""+Math.abs(g),G=M-R.length,ce=g>=0;return(ce?I?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+R}var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,H=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Z={},Q={};function U(g,M,I,R){var G=R;typeof R=="string"&&(G=function(){return this[R]()}),g&&(Q[g]=G),M&&(Q[M[0]]=function(){return W(G.apply(this,arguments),M[1],M[2])}),I&&(Q[I]=function(){return this.localeData().ordinal(G.apply(this,arguments),g)})}function de(g){return g.match(/\[[\s\S]/)?g.replace(/^\[|\]$/g,""):g.replace(/\\/g,"")}function De(g){var M=g.match(O),I,R;for(I=0,R=M.length;I<R;I++)Q[M[I]]?M[I]=Q[M[I]]:M[I]=de(M[I]);return function(G){var ce="",Oe;for(Oe=0;Oe<R;Oe++)ce+=P(M[Oe])?M[Oe].call(G,g):M[Oe];return ce}}function me(g,M){return g.isValid()?(M=_e(M,g.localeData()),Z[M]=Z[M]||De(M),Z[M](g)):g.localeData().invalidDate()}function _e(g,M){var I=5;function R(G){return M.longDateFormat(G)||G}for(H.lastIndex=0;I>=0&&H.test(g);)g=g.replace(H,R),H.lastIndex=0,I-=1;return g}var Ne={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Se(g){var M=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return M||!I?M:(this._longDateFormat[g]=I.match(O).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[g])}var Me="Invalid date";function Ee(){return this._invalidDate}var Ce="%d",Ge=/\d{1,2}/;function We(g){return this._ordinal.replace("%d",g)}var te={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function oe(g,M,I,R){var G=this._relativeTime[I];return P(G)?G(g,M,I,R):G.replace(/%d/i,g)}function ge(g,M){var I=this._relativeTime[g>0?"future":"past"];return P(I)?I(M):I.replace(/%s/i,M)}var ie={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function re(g){return typeof g=="string"?ie[g]||ie[g.toLowerCase()]:void 0}function le(g){var M={},I,R;for(R in g)a(g,R)&&(I=re(R),I&&(M[I]=g[R]));return M}var Te={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Ie(g){var M=[],I;for(I in g)a(g,I)&&M.push({unit:I,priority:Te[I]});return M.sort(function(R,G){return R.priority-G.priority}),M}var Ze=/\d/,we=/\d\d/,ht=/\d{3}/,Nt=/\d{4}/,Ht=/[+-]?\d{6}/,Et=/\d\d?/,ae=/\d\d\d\d?/,he=/\d\d\d\d\d\d?/,ve=/\d{1,3}/,qe=/\d{1,4}/,$e=/[+-]?\d{1,6}/,Re=/\d+/,ze=/[+-]?\d+/,Xe=/Z|[+-]\d\d:?\d\d/gi,F=/Z|[+-]\d\d(?::?\d\d)?/gi,X=/[+-]?\d+(\.\d{1,3})?/,Ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Le=/^[1-9]\d?/,ft=/^([1-9]\d|\d)/,St;St={};function Ye(g,M,I){St[g]=P(M)?M:function(R,G){return R&&I?I:M}}function kn(g,M){return a(St,g)?St[g](M._strict,M._locale):new RegExp(li(g))}function li(g){return Wr(g.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(M,I,R,G,ce){return I||R||G||ce}))}function Wr(g){return g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Dn(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function ur(g){var M=+g,I=0;return M!==0&&isFinite(M)&&(I=Dn(M)),I}var Uo={};function Sr(g,M){var I,R=M,G;for(typeof g=="string"&&(g=[g]),s(M)&&(R=function(ce,Oe){Oe[M]=ur(ce)}),G=g.length,I=0;I<G;I++)Uo[g[I]]=R}function bi(g,M){Sr(g,function(I,R,G,ce){G._w=G._w||{},M(I,G._w,G,ce)})}function Ki(g,M,I){M!=null&&a(Uo,g)&&Uo[g](M,I._a,I,g)}function ki(g){return g%4===0&&g%100!==0||g%400===0}var mn=0,Nn=1,xi=2,Kr=3,Bn=4,dn=5,wi=6,Kl=7,Nu=8;U("Y",0,0,function(){var g=this.year();return g<=9999?W(g,4):"+"+g}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),Ye("Y",ze),Ye("YY",Et,we),Ye("YYYY",qe,Nt),Ye("YYYYY",$e,Ht),Ye("YYYYYY",$e,Ht),Sr(["YYYYY","YYYYYY"],mn),Sr("YYYY",function(g,M){M[mn]=g.length===2?e.parseTwoDigitYear(g):ur(g)}),Sr("YY",function(g,M){M[mn]=e.parseTwoDigitYear(g)}),Sr("Y",function(g,M){M[mn]=parseInt(g,10)});function so(g){return ki(g)?366:365}e.parseTwoDigitYear=function(g){return ur(g)+(ur(g)>68?1900:2e3)};var uo=qa("FullYear",!0);function Tu(){return ki(this.year())}function qa(g,M){return function(I){return I!=null?(Cu(this,g,I),e.updateOffset(this,M),this):ya(this,g)}}function ya(g,M){if(!g.isValid())return NaN;var I=g._d,R=g._isUTC;switch(M){case"Milliseconds":return R?I.getUTCMilliseconds():I.getMilliseconds();case"Seconds":return R?I.getUTCSeconds():I.getSeconds();case"Minutes":return R?I.getUTCMinutes():I.getMinutes();case"Hours":return R?I.getUTCHours():I.getHours();case"Date":return R?I.getUTCDate():I.getDate();case"Day":return R?I.getUTCDay():I.getDay();case"Month":return R?I.getUTCMonth():I.getMonth();case"FullYear":return R?I.getUTCFullYear():I.getFullYear();default:return NaN}}function Cu(g,M,I){var R,G,ce,Oe,gt;if(!(!g.isValid()||isNaN(I))){switch(R=g._d,G=g._isUTC,M){case"Milliseconds":return void(G?R.setUTCMilliseconds(I):R.setMilliseconds(I));case"Seconds":return void(G?R.setUTCSeconds(I):R.setSeconds(I));case"Minutes":return void(G?R.setUTCMinutes(I):R.setMinutes(I));case"Hours":return void(G?R.setUTCHours(I):R.setHours(I));case"Date":return void(G?R.setUTCDate(I):R.setDate(I));case"FullYear":break;default:return}ce=I,Oe=g.month(),gt=g.date(),gt=gt===29&&Oe===1&&!ki(ce)?28:gt,G?R.setUTCFullYear(ce,Oe,gt):R.setFullYear(ce,Oe,gt)}}function Fu(g){return g=re(g),P(this[g])?this[g]():this}function ec(g,M){if(typeof g=="object"){g=le(g);var I=Ie(g),R,G=I.length;for(R=0;R<G;R++)this[I[R].unit](g[I[R].unit])}else if(g=re(g),P(this[g]))return this[g](M);return this}function tc(g,M){return(g%M+M)%M}var Yr;Array.prototype.indexOf?Yr=Array.prototype.indexOf:Yr=function(g){var M;for(M=0;M<this.length;++M)if(this[M]===g)return M;return-1};function $(g,M){if(isNaN(g)||isNaN(M))return NaN;var I=tc(M,12);return g+=(M-I)/12,I===1?ki(g)?29:28:31-I%7%2}U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(g){return this.localeData().monthsShort(this,g)}),U("MMMM",0,0,function(g){return this.localeData().months(this,g)}),Ye("M",Et,Le),Ye("MM",Et,we),Ye("MMM",function(g,M){return M.monthsShortRegex(g)}),Ye("MMMM",function(g,M){return M.monthsRegex(g)}),Sr(["M","MM"],function(g,M){M[Nn]=ur(g)-1}),Sr(["MMM","MMMM"],function(g,M,I,R){var G=I._locale.monthsParse(g,R,I._strict);G!=null?M[Nn]=G:h(I).invalidMonth=g});var ue="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ve="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),at=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,et=Ae,Vt=Ae;function Ar(g,M){return g?r(this._months)?this._months[g.month()]:this._months[(this._months.isFormat||at).test(M)?"format":"standalone"][g.month()]:r(this._months)?this._months:this._months.standalone}function yn(g,M){return g?r(this._monthsShort)?this._monthsShort[g.month()]:this._monthsShort[at.test(M)?"format":"standalone"][g.month()]:r(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function bn(g,M,I){var R,G,ce,Oe=g.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],R=0;R<12;++R)ce=p([2e3,R]),this._shortMonthsParse[R]=this.monthsShort(ce,"").toLocaleLowerCase(),this._longMonthsParse[R]=this.months(ce,"").toLocaleLowerCase();return I?M==="MMM"?(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:null):(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:null):M==="MMM"?(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:null)):(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:null))}function lo(g,M,I){var R,G,ce;if(this._monthsParseExact)return bn.call(this,g,M,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),R=0;R<12;R++){if(G=p([2e3,R]),I&&!this._longMonthsParse[R]&&(this._longMonthsParse[R]=new RegExp("^"+this.months(G,"").replace(".","")+"$","i"),this._shortMonthsParse[R]=new RegExp("^"+this.monthsShort(G,"").replace(".","")+"$","i")),!I&&!this._monthsParse[R]&&(ce="^"+this.months(G,"")+"|^"+this.monthsShort(G,""),this._monthsParse[R]=new RegExp(ce.replace(".",""),"i")),I&&M==="MMMM"&&this._longMonthsParse[R].test(g))return R;if(I&&M==="MMM"&&this._shortMonthsParse[R].test(g))return R;if(!I&&this._monthsParse[R].test(g))return R}}function BM(g,M){if(!g.isValid())return g;if(typeof M=="string"){if(/^\d+$/.test(M))M=ur(M);else if(M=g.localeData().monthsParse(M),!s(M))return g}var I=M,R=g.date();return R=R<29?R:Math.min(R,$(g.year(),I)),g._isUTC?g._d.setUTCMonth(I,R):g._d.setMonth(I,R),g}function OM(g){return g!=null?(BM(this,g),e.updateOffset(this,!0),this):ya(this,"Month")}function P6(){return $(this.year(),this.month())}function k6(g){return this._monthsParseExact?(a(this,"_monthsRegex")||RM.call(this),g?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=et),this._monthsShortStrictRegex&&g?this._monthsShortStrictRegex:this._monthsShortRegex)}function B6(g){return this._monthsParseExact?(a(this,"_monthsRegex")||RM.call(this),g?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Vt),this._monthsStrictRegex&&g?this._monthsStrictRegex:this._monthsRegex)}function RM(){function g(Wt,hr){return hr.length-Wt.length}var M=[],I=[],R=[],G,ce,Oe,gt;for(G=0;G<12;G++)ce=p([2e3,G]),Oe=Wr(this.monthsShort(ce,"")),gt=Wr(this.months(ce,"")),M.push(Oe),I.push(gt),R.push(gt),R.push(Oe);M.sort(g),I.sort(g),R.sort(g),this._monthsRegex=new RegExp("^("+R.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+M.join("|")+")","i")}function O6(g,M,I,R,G,ce,Oe){var gt;return g<100&&g>=0?(gt=new Date(g+400,M,I,R,G,ce,Oe),isFinite(gt.getFullYear())&&gt.setFullYear(g)):gt=new Date(g,M,I,R,G,ce,Oe),gt}function rc(g){var M,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,M=new Date(Date.UTC.apply(null,I)),isFinite(M.getUTCFullYear())&&M.setUTCFullYear(g)):M=new Date(Date.UTC.apply(null,arguments)),M}function Nf(g,M,I){var R=7+M-I,G=(7+rc(g,0,R).getUTCDay()-M)%7;return-G+R-1}function LM(g,M,I,R,G){var ce=(7+I-R)%7,Oe=Nf(g,R,G),gt=1+7*(M-1)+ce+Oe,Wt,hr;return gt<=0?(Wt=g-1,hr=so(Wt)+gt):gt>so(g)?(Wt=g+1,hr=gt-so(g)):(Wt=g,hr=gt),{year:Wt,dayOfYear:hr}}function nc(g,M,I){var R=Nf(g.year(),M,I),G=Math.floor((g.dayOfYear()-R-1)/7)+1,ce,Oe;return G<1?(Oe=g.year()-1,ce=G+co(Oe,M,I)):G>co(g.year(),M,I)?(ce=G-co(g.year(),M,I),Oe=g.year()+1):(Oe=g.year(),ce=G),{week:ce,year:Oe}}function co(g,M,I){var R=Nf(g,M,I),G=Nf(g+1,M,I);return(so(g)-R+G)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),Ye("w",Et,Le),Ye("ww",Et,we),Ye("W",Et,Le),Ye("WW",Et,we),bi(["w","ww","W","WW"],function(g,M,I,R){M[R.substr(0,1)]=ur(g)});function R6(g){return nc(g,this._week.dow,this._week.doy).week}var L6={dow:0,doy:6};function V6(){return this._week.dow}function U6(){return this._week.doy}function q6(g){var M=this.localeData().week(this);return g==null?M:this.add((g-M)*7,"d")}function z6(g){var M=nc(this,1,4).week;return g==null?M:this.add((g-M)*7,"d")}U("d",0,"do","day"),U("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),U("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),U("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),Ye("d",Et),Ye("e",Et),Ye("E",Et),Ye("dd",function(g,M){return M.weekdaysMinRegex(g)}),Ye("ddd",function(g,M){return M.weekdaysShortRegex(g)}),Ye("dddd",function(g,M){return M.weekdaysRegex(g)}),bi(["dd","ddd","dddd"],function(g,M,I,R){var G=I._locale.weekdaysParse(g,R,I._strict);G!=null?M.d=G:h(I).invalidWeekday=g}),bi(["d","e","E"],function(g,M,I,R){M[R]=ur(g)});function $6(g,M){return typeof g!="string"?g:isNaN(g)?(g=M.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function H6(g,M){return typeof g=="string"?M.weekdaysParse(g)%7||7:isNaN(g)?null:g}function ug(g,M){return g.slice(M,7).concat(g.slice(0,M))}var G6="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),VM="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),W6="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Y6=Ae,j6=Ae,Z6=Ae;function J6(g,M){var I=r(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(M)?"format":"standalone"];return g===!0?ug(I,this._week.dow):g?I[g.day()]:I}function X6(g){return g===!0?ug(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function Q6(g){return g===!0?ug(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function K6(g,M,I){var R,G,ce,Oe=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],R=0;R<7;++R)ce=p([2e3,1]).day(R),this._minWeekdaysParse[R]=this.weekdaysMin(ce,"").toLocaleLowerCase(),this._shortWeekdaysParse[R]=this.weekdaysShort(ce,"").toLocaleLowerCase(),this._weekdaysParse[R]=this.weekdays(ce,"").toLocaleLowerCase();return I?M==="dddd"?(G=Yr.call(this._weekdaysParse,Oe),G!==-1?G:null):M==="ddd"?(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1?G:null):(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null):M==="dddd"?(G=Yr.call(this._weekdaysParse,Oe),G!==-1||(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null)):M==="ddd"?(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1||(G=Yr.call(this._weekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null)):(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1||(G=Yr.call(this._weekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1?G:null))}function eq(g,M,I){var R,G,ce;if(this._weekdaysParseExact)return K6.call(this,g,M,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),R=0;R<7;R++){if(G=p([2e3,1]).day(R),I&&!this._fullWeekdaysParse[R]&&(this._fullWeekdaysParse[R]=new RegExp("^"+this.weekdays(G,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[R]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[R]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[R]||(ce="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[R]=new RegExp(ce.replace(".",""),"i")),I&&M==="dddd"&&this._fullWeekdaysParse[R].test(g))return R;if(I&&M==="ddd"&&this._shortWeekdaysParse[R].test(g))return R;if(I&&M==="dd"&&this._minWeekdaysParse[R].test(g))return R;if(!I&&this._weekdaysParse[R].test(g))return R}}function tq(g){if(!this.isValid())return g!=null?this:NaN;var M=ya(this,"Day");return g!=null?(g=$6(g,this.localeData()),this.add(g-M,"d")):M}function rq(g){if(!this.isValid())return g!=null?this:NaN;var M=(this.day()+7-this.localeData()._week.dow)%7;return g==null?M:this.add(g-M,"d")}function nq(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var M=H6(g,this.localeData());return this.day(this.day()%7?M:M-7)}else return this.day()||7}function iq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||lg.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Y6),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function aq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||lg.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=j6),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function oq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||lg.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Z6),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function lg(){function g(ci,go){return go.length-ci.length}var M=[],I=[],R=[],G=[],ce,Oe,gt,Wt,hr;for(ce=0;ce<7;ce++)Oe=p([2e3,1]).day(ce),gt=Wr(this.weekdaysMin(Oe,"")),Wt=Wr(this.weekdaysShort(Oe,"")),hr=Wr(this.weekdays(Oe,"")),M.push(gt),I.push(Wt),R.push(hr),G.push(gt),G.push(Wt),G.push(hr);M.sort(g),I.sort(g),R.sort(g),G.sort(g),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+M.join("|")+")","i")}function cg(){return this.hours()%12||12}function sq(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,cg),U("k",["kk",2],0,sq),U("hmm",0,0,function(){return""+cg.apply(this)+W(this.minutes(),2)}),U("hmmss",0,0,function(){return""+cg.apply(this)+W(this.minutes(),2)+W(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+W(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+W(this.minutes(),2)+W(this.seconds(),2)});function UM(g,M){U(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),M)})}UM("a",!0),UM("A",!1);function qM(g,M){return M._meridiemParse}Ye("a",qM),Ye("A",qM),Ye("H",Et,ft),Ye("h",Et,Le),Ye("k",Et,Le),Ye("HH",Et,we),Ye("hh",Et,we),Ye("kk",Et,we),Ye("hmm",ae),Ye("hmmss",he),Ye("Hmm",ae),Ye("Hmmss",he),Sr(["H","HH"],Kr),Sr(["k","kk"],function(g,M,I){var R=ur(g);M[Kr]=R===24?0:R}),Sr(["a","A"],function(g,M,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),Sr(["h","hh"],function(g,M,I){M[Kr]=ur(g),h(I).bigHour=!0}),Sr("hmm",function(g,M,I){var R=g.length-2;M[Kr]=ur(g.substr(0,R)),M[Bn]=ur(g.substr(R)),h(I).bigHour=!0}),Sr("hmmss",function(g,M,I){var R=g.length-4,G=g.length-2;M[Kr]=ur(g.substr(0,R)),M[Bn]=ur(g.substr(R,2)),M[dn]=ur(g.substr(G)),h(I).bigHour=!0}),Sr("Hmm",function(g,M,I){var R=g.length-2;M[Kr]=ur(g.substr(0,R)),M[Bn]=ur(g.substr(R))}),Sr("Hmmss",function(g,M,I){var R=g.length-4,G=g.length-2;M[Kr]=ur(g.substr(0,R)),M[Bn]=ur(g.substr(R,2)),M[dn]=ur(g.substr(G))});function uq(g){return(g+"").toLowerCase().charAt(0)==="p"}var lq=/[ap]\.?m?\.?/i,cq=qa("Hours",!0);function fq(g,M,I){return g>11?I?"pm":"PM":I?"am":"AM"}var zM={calendar:k,longDateFormat:Ne,invalidDate:Me,ordinal:Ce,dayOfMonthOrdinalParse:Ge,relativeTime:te,months:ue,monthsShort:Ve,week:L6,weekdays:G6,weekdaysMin:W6,weekdaysShort:VM,meridiemParse:lq},en={},ic={},ac;function pq(g,M){var I,R=Math.min(g.length,M.length);for(I=0;I<R;I+=1)if(g[I]!==M[I])return I;return R}function $M(g){return g&&g.toLowerCase().replace("_","-")}function mq(g){for(var M=0,I,R,G,ce;M<g.length;){for(ce=$M(g[M]).split("-"),I=ce.length,R=$M(g[M+1]),R=R?R.split("-"):null;I>0;){if(G=Tf(ce.slice(0,I).join("-")),G)return G;if(R&&R.length>=I&&pq(ce,R)>=I-1)break;I--}M++}return ac}function dq(g){return!!(g&&g.match("^[^/\\\\]*$"))}function Tf(g){var M=null,I;if(en[g]===void 0&&typeof Uu<"u"&&Uu&&Uu.exports&&dq(g))try{M=ac._abbr,I=require,I("./locale/"+g),qo(M)}catch{en[g]=null}return en[g]}function qo(g,M){var I;return g&&(u(M)?I=fo(g):I=fg(g,M),I?ac=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),ac._abbr}function fg(g,M){if(M!==null){var I,R=zM;if(M.abbr=g,en[g]!=null)N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),R=en[g]._config;else if(M.parentLocale!=null)if(en[M.parentLocale]!=null)R=en[M.parentLocale]._config;else if(I=Tf(M.parentLocale),I!=null)R=I._config;else return ic[M.parentLocale]||(ic[M.parentLocale]=[]),ic[M.parentLocale].push({name:g,config:M}),null;return en[g]=new z(V(R,M)),ic[g]&&ic[g].forEach(function(G){fg(G.name,G.config)}),qo(g),en[g]}else return delete en[g],null}function hq(g,M){if(M!=null){var I,R,G=zM;en[g]!=null&&en[g].parentLocale!=null?en[g].set(V(en[g]._config,M)):(R=Tf(g),R!=null&&(G=R._config),M=V(G,M),R==null&&(M.abbr=g),I=new z(M),I.parentLocale=en[g],en[g]=I),qo(g)}else en[g]!=null&&(en[g].parentLocale!=null?(en[g]=en[g].parentLocale,g===qo()&&qo(g)):en[g]!=null&&delete en[g]);return en[g]}function fo(g){var M;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return ac;if(!r(g)){if(M=Tf(g),M)return M;g=[g]}return mq(g)}function gq(){return L(en)}function pg(g){var M,I=g._a;return I&&h(g).overflow===-2&&(M=I[Nn]<0||I[Nn]>11?Nn:I[xi]<1||I[xi]>$(I[mn],I[Nn])?xi:I[Kr]<0||I[Kr]>24||I[Kr]===24&&(I[Bn]!==0||I[dn]!==0||I[wi]!==0)?Kr:I[Bn]<0||I[Bn]>59?Bn:I[dn]<0||I[dn]>59?dn:I[wi]<0||I[wi]>999?wi:-1,h(g)._overflowDayOfYear&&(M<mn||M>xi)&&(M=xi),h(g)._overflowWeeks&&M===-1&&(M=Kl),h(g)._overflowWeekday&&M===-1&&(M=Nu),h(g).overflow=M),g}var vq=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yq=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,bq=/Z|[+-]\d\d(?::?\d\d)?/,Cf=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],mg=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],xq=/^\/?Date\((-?\d+)/i,wq=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,_q={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function HM(g){var M,I,R=g._i,G=vq.exec(R)||yq.exec(R),ce,Oe,gt,Wt,hr=Cf.length,ci=mg.length;if(G){for(h(g).iso=!0,M=0,I=hr;M<I;M++)if(Cf[M][1].exec(G[1])){Oe=Cf[M][0],ce=Cf[M][2]!==!1;break}if(Oe==null){g._isValid=!1;return}if(G[3]){for(M=0,I=ci;M<I;M++)if(mg[M][1].exec(G[3])){gt=(G[2]||" ")+mg[M][0];break}if(gt==null){g._isValid=!1;return}}if(!ce&&gt!=null){g._isValid=!1;return}if(G[4])if(bq.exec(G[4]))Wt="Z";else{g._isValid=!1;return}g._f=Oe+(gt||"")+(Wt||""),hg(g)}else g._isValid=!1}function Sq(g,M,I,R,G,ce){var Oe=[Aq(g),Ve.indexOf(M),parseInt(I,10),parseInt(R,10),parseInt(G,10)];return ce&&Oe.push(parseInt(ce,10)),Oe}function Aq(g){var M=parseInt(g,10);return M<=49?2e3+M:M<=999?1900+M:M}function Mq(g){return g.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Eq(g,M,I){if(g){var R=VM.indexOf(g),G=new Date(M[0],M[1],M[2]).getDay();if(R!==G)return h(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function Dq(g,M,I){if(g)return _q[g];if(M)return 0;var R=parseInt(I,10),G=R%100,ce=(R-G)/100;return ce*60+G}function GM(g){var M=wq.exec(Mq(g._i)),I;if(M){if(I=Sq(M[4],M[3],M[2],M[5],M[6],M[7]),!Eq(M[1],I,g))return;g._a=I,g._tzm=Dq(M[8],M[9],M[10]),g._d=rc.apply(null,g._a),g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),h(g).rfc2822=!0}else g._isValid=!1}function Nq(g){var M=xq.exec(g._i);if(M!==null){g._d=new Date(+M[1]);return}if(HM(g),g._isValid===!1)delete g._isValid;else return;if(GM(g),g._isValid===!1)delete g._isValid;else return;g._strict?g._isValid=!1:e.createFromInputFallback(g)}e.createFromInputFallback=E("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(g){g._d=new Date(g._i+(g._useUTC?" UTC":""))});function Iu(g,M,I){return g??M??I}function Tq(g){var M=new Date(e.now());return g._useUTC?[M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()]:[M.getFullYear(),M.getMonth(),M.getDate()]}function dg(g){var M,I,R=[],G,ce,Oe;if(!g._d){for(G=Tq(g),g._w&&g._a[xi]==null&&g._a[Nn]==null&&Cq(g),g._dayOfYear!=null&&(Oe=Iu(g._a[mn],G[mn]),(g._dayOfYear>so(Oe)||g._dayOfYear===0)&&(h(g)._overflowDayOfYear=!0),I=rc(Oe,0,g._dayOfYear),g._a[Nn]=I.getUTCMonth(),g._a[xi]=I.getUTCDate()),M=0;M<3&&g._a[M]==null;++M)g._a[M]=R[M]=G[M];for(;M<7;M++)g._a[M]=R[M]=g._a[M]==null?M===2?1:0:g._a[M];g._a[Kr]===24&&g._a[Bn]===0&&g._a[dn]===0&&g._a[wi]===0&&(g._nextDay=!0,g._a[Kr]=0),g._d=(g._useUTC?rc:O6).apply(null,R),ce=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[Kr]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==ce&&(h(g).weekdayMismatch=!0)}}function Cq(g){var M,I,R,G,ce,Oe,gt,Wt,hr;M=g._w,M.GG!=null||M.W!=null||M.E!=null?(ce=1,Oe=4,I=Iu(M.GG,g._a[mn],nc(jr(),1,4).year),R=Iu(M.W,1),G=Iu(M.E,1),(G<1||G>7)&&(Wt=!0)):(ce=g._locale._week.dow,Oe=g._locale._week.doy,hr=nc(jr(),ce,Oe),I=Iu(M.gg,g._a[mn],hr.year),R=Iu(M.w,hr.week),M.d!=null?(G=M.d,(G<0||G>6)&&(Wt=!0)):M.e!=null?(G=M.e+ce,(M.e<0||M.e>6)&&(Wt=!0)):G=ce),R<1||R>co(I,ce,Oe)?h(g)._overflowWeeks=!0:Wt!=null?h(g)._overflowWeekday=!0:(gt=LM(I,R,G,ce,Oe),g._a[mn]=gt.year,g._dayOfYear=gt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function hg(g){if(g._f===e.ISO_8601){HM(g);return}if(g._f===e.RFC_2822){GM(g);return}g._a=[],h(g).empty=!0;var M=""+g._i,I,R,G,ce,Oe,gt=M.length,Wt=0,hr,ci;for(G=_e(g._f,g._locale).match(O)||[],ci=G.length,I=0;I<ci;I++)ce=G[I],R=(M.match(kn(ce,g))||[])[0],R&&(Oe=M.substr(0,M.indexOf(R)),Oe.length>0&&h(g).unusedInput.push(Oe),M=M.slice(M.indexOf(R)+R.length),Wt+=R.length),Q[ce]?(R?h(g).empty=!1:h(g).unusedTokens.push(ce),Ki(ce,R,g)):g._strict&&!R&&h(g).unusedTokens.push(ce);h(g).charsLeftOver=gt-Wt,M.length>0&&h(g).unusedInput.push(M),g._a[Kr]<=12&&h(g).bigHour===!0&&g._a[Kr]>0&&(h(g).bigHour=void 0),h(g).parsedDateParts=g._a.slice(0),h(g).meridiem=g._meridiem,g._a[Kr]=Fq(g._locale,g._a[Kr],g._meridiem),hr=h(g).era,hr!==null&&(g._a[mn]=g._locale.erasConvertYear(hr,g._a[mn])),dg(g),pg(g)}function Fq(g,M,I){var R;return I==null?M:g.meridiemHour!=null?g.meridiemHour(M,I):(g.isPM!=null&&(R=g.isPM(I),R&&M<12&&(M+=12),!R&&M===12&&(M=0)),M)}function Iq(g){var M,I,R,G,ce,Oe,gt=!1,Wt=g._f.length;if(Wt===0){h(g).invalidFormat=!0,g._d=new Date(NaN);return}for(G=0;G<Wt;G++)ce=0,Oe=!1,M=w({},g),g._useUTC!=null&&(M._useUTC=g._useUTC),M._f=g._f[G],hg(M),v(M)&&(Oe=!0),ce+=h(M).charsLeftOver,ce+=h(M).unusedTokens.length*10,h(M).score=ce,gt?ce<R&&(R=ce,I=M):(R==null||ce<R||Oe)&&(R=ce,I=M,Oe&&(gt=!0));f(g,I||M)}function Pq(g){if(!g._d){var M=le(g._i),I=M.day===void 0?M.date:M.day;g._a=c([M.year,M.month,I,M.hour,M.minute,M.second,M.millisecond],function(R){return R&&parseInt(R,10)}),dg(g)}}function kq(g){var M=new A(pg(WM(g)));return M._nextDay&&(M.add(1,"d"),M._nextDay=void 0),M}function WM(g){var M=g._i,I=g._f;return g._locale=g._locale||fo(g._l),M===null||I===void 0&&M===""?y({nullInput:!0}):(typeof M=="string"&&(g._i=M=g._locale.preparse(M)),x(M)?new A(pg(M)):(l(M)?g._d=M:r(I)?Iq(g):I?hg(g):Bq(g),v(g)||(g._d=null),g))}function Bq(g){var M=g._i;u(M)?g._d=new Date(e.now()):l(M)?g._d=new Date(M.valueOf()):typeof M=="string"?Nq(g):r(M)?(g._a=c(M.slice(0),function(I){return parseInt(I,10)}),dg(g)):i(M)?Pq(g):s(M)?g._d=new Date(M):e.createFromInputFallback(g)}function YM(g,M,I,R,G){var ce={};return(M===!0||M===!1)&&(R=M,M=void 0),(I===!0||I===!1)&&(R=I,I=void 0),(i(g)&&o(g)||r(g)&&g.length===0)&&(g=void 0),ce._isAMomentObject=!0,ce._useUTC=ce._isUTC=G,ce._l=I,ce._i=g,ce._f=M,ce._strict=R,kq(ce)}function jr(g,M,I,R){return YM(g,M,I,R,!1)}var Oq=E("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=jr.apply(null,arguments);return this.isValid()&&g.isValid()?g<this?this:g:y()}),Rq=E("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=jr.apply(null,arguments);return this.isValid()&&g.isValid()?g>this?this:g:y()});function jM(g,M){var I,R;if(M.length===1&&r(M[0])&&(M=M[0]),!M.length)return jr();for(I=M[0],R=1;R<M.length;++R)(!M[R].isValid()||M[R][g](I))&&(I=M[R]);return I}function Lq(){var g=[].slice.call(arguments,0);return jM("isBefore",g)}function Vq(){var g=[].slice.call(arguments,0);return jM("isAfter",g)}var Uq=function(){return Date.now?Date.now():+new Date},oc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function qq(g){var M,I=!1,R,G=oc.length;for(M in g)if(a(g,M)&&!(Yr.call(oc,M)!==-1&&(g[M]==null||!isNaN(g[M]))))return!1;for(R=0;R<G;++R)if(g[oc[R]]){if(I)return!1;parseFloat(g[oc[R]])!==ur(g[oc[R]])&&(I=!0)}return!0}function zq(){return this._isValid}function $q(){return ba(NaN)}function Ff(g){var M=le(g),I=M.year||0,R=M.quarter||0,G=M.month||0,ce=M.week||M.isoWeek||0,Oe=M.day||0,gt=M.hour||0,Wt=M.minute||0,hr=M.second||0,ci=M.millisecond||0;this._isValid=qq(M),this._milliseconds=+ci+hr*1e3+Wt*6e4+gt*1e3*60*60,this._days=+Oe+ce*7,this._months=+G+R*3+I*12,this._data={},this._locale=fo(),this._bubble()}function If(g){return g instanceof Ff}function gg(g){return g<0?Math.round(-1*g)*-1:Math.round(g)}function Hq(g,M,I){var R=Math.min(g.length,M.length),G=Math.abs(g.length-M.length),ce=0,Oe;for(Oe=0;Oe<R;Oe++)(I&&g[Oe]!==M[Oe]||!I&&ur(g[Oe])!==ur(M[Oe]))&&ce++;return ce+G}function ZM(g,M){U(g,0,0,function(){var I=this.utcOffset(),R="+";return I<0&&(I=-I,R="-"),R+W(~~(I/60),2)+M+W(~~I%60,2)})}ZM("Z",":"),ZM("ZZ",""),Ye("Z",F),Ye("ZZ",F),Sr(["Z","ZZ"],function(g,M,I){I._useUTC=!0,I._tzm=vg(F,g)});var Gq=/([\+\-]|\d\d)/gi;function vg(g,M){var I=(M||"").match(g),R,G,ce;return I===null?null:(R=I[I.length-1]||[],G=(R+"").match(Gq)||["-",0,0],ce=+(G[1]*60)+ur(G[2]),ce===0?0:G[0]==="+"?ce:-ce)}function yg(g,M){var I,R;return M._isUTC?(I=M.clone(),R=(x(g)||l(g)?g.valueOf():jr(g).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+R),e.updateOffset(I,!1),I):jr(g).local()}function bg(g){return-Math.round(g._d.getTimezoneOffset())}e.updateOffset=function(){};function Wq(g,M,I){var R=this._offset||0,G;if(!this.isValid())return g!=null?this:NaN;if(g!=null){if(typeof g=="string"){if(g=vg(F,g),g===null)return this}else Math.abs(g)<16&&!I&&(g=g*60);return!this._isUTC&&M&&(G=bg(this)),this._offset=g,this._isUTC=!0,G!=null&&this.add(G,"m"),R!==g&&(!M||this._changeInProgress?KM(this,ba(g-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:bg(this)}function Yq(g,M){return g!=null?(typeof g!="string"&&(g=-g),this.utcOffset(g,M),this):-this.utcOffset()}function jq(g){return this.utcOffset(0,g)}function Zq(g){return this._isUTC&&(this.utcOffset(0,g),this._isUTC=!1,g&&this.subtract(bg(this),"m")),this}function Jq(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var g=vg(Xe,this._i);g!=null?this.utcOffset(g):this.utcOffset(0,!0)}return this}function Xq(g){return this.isValid()?(g=g?jr(g).utcOffset():0,(this.utcOffset()-g)%60===0):!1}function Qq(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kq(){if(!u(this._isDSTShifted))return this._isDSTShifted;var g={},M;return w(g,this),g=WM(g),g._a?(M=g._isUTC?p(g._a):jr(g._a),this._isDSTShifted=this.isValid()&&Hq(g._a,M.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function e9(){return this.isValid()?!this._isUTC:!1}function t9(){return this.isValid()?this._isUTC:!1}function JM(){return this.isValid()?this._isUTC&&this._offset===0:!1}var r9=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,n9=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ba(g,M){var I=g,R=null,G,ce,Oe;return If(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:s(g)||!isNaN(+g)?(I={},M?I[M]=+g:I.milliseconds=+g):(R=r9.exec(g))?(G=R[1]==="-"?-1:1,I={y:0,d:ur(R[xi])*G,h:ur(R[Kr])*G,m:ur(R[Bn])*G,s:ur(R[dn])*G,ms:ur(gg(R[wi]*1e3))*G}):(R=n9.exec(g))?(G=R[1]==="-"?-1:1,I={y:Os(R[2],G),M:Os(R[3],G),w:Os(R[4],G),d:Os(R[5],G),h:Os(R[6],G),m:Os(R[7],G),s:Os(R[8],G)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Oe=i9(jr(I.from),jr(I.to)),I={},I.ms=Oe.milliseconds,I.M=Oe.months),ce=new Ff(I),If(g)&&a(g,"_locale")&&(ce._locale=g._locale),If(g)&&a(g,"_isValid")&&(ce._isValid=g._isValid),ce}ba.fn=Ff.prototype,ba.invalid=$q;function Os(g,M){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*M}function XM(g,M){var I={};return I.months=M.month()-g.month()+(M.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(M)&&--I.months,I.milliseconds=+M-+g.clone().add(I.months,"M"),I}function i9(g,M){var I;return g.isValid()&&M.isValid()?(M=yg(M,g),g.isBefore(M)?I=XM(g,M):(I=XM(M,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function QM(g,M){return function(I,R){var G,ce;return R!==null&&!isNaN(+R)&&(N(M,"moment()."+M+"(period, number) is deprecated. Please use moment()."+M+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),ce=I,I=R,R=ce),G=ba(I,R),KM(this,G,g),this}}function KM(g,M,I,R){var G=M._milliseconds,ce=gg(M._days),Oe=gg(M._months);g.isValid()&&(R=R??!0,Oe&&BM(g,ya(g,"Month")+Oe*I),ce&&Cu(g,"Date",ya(g,"Date")+ce*I),G&&g._d.setTime(g._d.valueOf()+G*I),R&&e.updateOffset(g,ce||Oe))}var a9=QM(1,"add"),o9=QM(-1,"subtract");function eE(g){return typeof g=="string"||g instanceof String}function s9(g){return x(g)||l(g)||eE(g)||s(g)||l9(g)||u9(g)||g===null||g===void 0}function u9(g){var M=i(g)&&!o(g),I=!1,R=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,ce,Oe=R.length;for(G=0;G<Oe;G+=1)ce=R[G],I=I||a(g,ce);return M&&I}function l9(g){var M=r(g),I=!1;return M&&(I=g.filter(function(R){return!s(R)&&eE(g)}).length===0),M&&I}function c9(g){var M=i(g)&&!o(g),I=!1,R=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],G,ce;for(G=0;G<R.length;G+=1)ce=R[G],I=I||a(g,ce);return M&&I}function f9(g,M){var I=g.diff(M,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function p9(g,M){arguments.length===1&&(arguments[0]?s9(arguments[0])?(g=arguments[0],M=void 0):c9(arguments[0])&&(M=arguments[0],g=void 0):(g=void 0,M=void 0));var I=g||jr(),R=yg(I,this).startOf("day"),G=e.calendarFormat(this,R)||"sameElse",ce=M&&(P(M[G])?M[G].call(this,I):M[G]);return this.format(ce||this.localeData().calendar(G,this,jr(I)))}function m9(){return new A(this)}function d9(g,M){var I=x(g)?g:jr(g);return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(M).valueOf()):!1}function h9(g,M){var I=x(g)?g:jr(g);return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(M).valueOf()<I.valueOf()):!1}function g9(g,M,I,R){var G=x(g)?g:jr(g),ce=x(M)?M:jr(M);return this.isValid()&&G.isValid()&&ce.isValid()?(R=R||"()",(R[0]==="("?this.isAfter(G,I):!this.isBefore(G,I))&&(R[1]===")"?this.isBefore(ce,I):!this.isAfter(ce,I))):!1}function v9(g,M){var I=x(g)?g:jr(g),R;return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()===I.valueOf():(R=I.valueOf(),this.clone().startOf(M).valueOf()<=R&&R<=this.clone().endOf(M).valueOf())):!1}function y9(g,M){return this.isSame(g,M)||this.isAfter(g,M)}function b9(g,M){return this.isSame(g,M)||this.isBefore(g,M)}function x9(g,M,I){var R,G,ce;if(!this.isValid())return NaN;if(R=yg(g,this),!R.isValid())return NaN;switch(G=(R.utcOffset()-this.utcOffset())*6e4,M=re(M),M){case"year":ce=Pf(this,R)/12;break;case"month":ce=Pf(this,R);break;case"quarter":ce=Pf(this,R)/3;break;case"second":ce=(this-R)/1e3;break;case"minute":ce=(this-R)/6e4;break;case"hour":ce=(this-R)/36e5;break;case"day":ce=(this-R-G)/864e5;break;case"week":ce=(this-R-G)/6048e5;break;default:ce=this-R}return I?ce:Dn(ce)}function Pf(g,M){if(g.date()<M.date())return-Pf(M,g);var I=(M.year()-g.year())*12+(M.month()-g.month()),R=g.clone().add(I,"months"),G,ce;return M-R<0?(G=g.clone().add(I-1,"months"),ce=(M-R)/(R-G)):(G=g.clone().add(I+1,"months"),ce=(M-R)/(G-R)),-(I+ce)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function w9(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function _9(g){if(!this.isValid())return null;var M=g!==!0,I=M?this.clone().utc():this;return I.year()<0||I.year()>9999?me(I,M?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):P(Date.prototype.toISOString)?M?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",me(I,"Z")):me(I,M?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function S9(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",M="",I,R,G,ce;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",M="Z"),I="["+g+'("]',R=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",ce=M+'[")]',this.format(I+R+G+ce)}function A9(g){g||(g=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var M=me(this,g);return this.localeData().postformat(M)}function M9(g,M){return this.isValid()&&(x(g)&&g.isValid()||jr(g).isValid())?ba({to:this,from:g}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function E9(g){return this.from(jr(),g)}function D9(g,M){return this.isValid()&&(x(g)&&g.isValid()||jr(g).isValid())?ba({from:this,to:g}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function N9(g){return this.to(jr(),g)}function tE(g){var M;return g===void 0?this._locale._abbr:(M=fo(g),M!=null&&(this._locale=M),this)}var rE=E("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(g){return g===void 0?this.localeData():this.locale(g)});function nE(){return this._locale}var kf=1e3,Pu=60*kf,Bf=60*Pu,iE=(365*400+97)*24*Bf;function ku(g,M){return(g%M+M)%M}function aE(g,M,I){return g<100&&g>=0?new Date(g+400,M,I)-iE:new Date(g,M,I).valueOf()}function oE(g,M,I){return g<100&&g>=0?Date.UTC(g+400,M,I)-iE:Date.UTC(g,M,I)}function T9(g){var M,I;if(g=re(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?oE:aE,g){case"year":M=I(this.year(),0,1);break;case"quarter":M=I(this.year(),this.month()-this.month()%3,1);break;case"month":M=I(this.year(),this.month(),1);break;case"week":M=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":M=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":M=I(this.year(),this.month(),this.date());break;case"hour":M=this._d.valueOf(),M-=ku(M+(this._isUTC?0:this.utcOffset()*Pu),Bf);break;case"minute":M=this._d.valueOf(),M-=ku(M,Pu);break;case"second":M=this._d.valueOf(),M-=ku(M,kf);break}return this._d.setTime(M),e.updateOffset(this,!0),this}function C9(g){var M,I;if(g=re(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?oE:aE,g){case"year":M=I(this.year()+1,0,1)-1;break;case"quarter":M=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":M=I(this.year(),this.month()+1,1)-1;break;case"week":M=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":M=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":M=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":M=this._d.valueOf(),M+=Bf-ku(M+(this._isUTC?0:this.utcOffset()*Pu),Bf)-1;break;case"minute":M=this._d.valueOf(),M+=Pu-ku(M,Pu)-1;break;case"second":M=this._d.valueOf(),M+=kf-ku(M,kf)-1;break}return this._d.setTime(M),e.updateOffset(this,!0),this}function F9(){return this._d.valueOf()-(this._offset||0)*6e4}function I9(){return Math.floor(this.valueOf()/1e3)}function P9(){return new Date(this.valueOf())}function k9(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function B9(){var g=this;return{years:g.year(),months:g.month(),date:g.date(),hours:g.hours(),minutes:g.minutes(),seconds:g.seconds(),milliseconds:g.milliseconds()}}function O9(){return this.isValid()?this.toISOString():null}function R9(){return v(this)}function L9(){return f({},h(this))}function V9(){return h(this).overflow}function U9(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),Ye("N",xg),Ye("NN",xg),Ye("NNN",xg),Ye("NNNN",X9),Ye("NNNNN",Q9),Sr(["N","NN","NNN","NNNN","NNNNN"],function(g,M,I,R){var G=I._locale.erasParse(g,R,I._strict);G?h(I).era=G:h(I).invalidEra=g}),Ye("y",Re),Ye("yy",Re),Ye("yyy",Re),Ye("yyyy",Re),Ye("yo",K9),Sr(["y","yy","yyy","yyyy"],mn),Sr(["yo"],function(g,M,I,R){var G;I._locale._eraYearOrdinalRegex&&(G=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?M[mn]=I._locale.eraYearOrdinalParse(g,G):M[mn]=parseInt(g,10)});function q9(g,M){var I,R,G,ce=this._eras||fo("en")._eras;for(I=0,R=ce.length;I<R;++I){switch(typeof ce[I].since){case"string":G=e(ce[I].since).startOf("day"),ce[I].since=G.valueOf();break}switch(typeof ce[I].until){case"undefined":ce[I].until=1/0;break;case"string":G=e(ce[I].until).startOf("day").valueOf(),ce[I].until=G.valueOf();break}}return ce}function z9(g,M,I){var R,G,ce=this.eras(),Oe,gt,Wt;for(g=g.toUpperCase(),R=0,G=ce.length;R<G;++R)if(Oe=ce[R].name.toUpperCase(),gt=ce[R].abbr.toUpperCase(),Wt=ce[R].narrow.toUpperCase(),I)switch(M){case"N":case"NN":case"NNN":if(gt===g)return ce[R];break;case"NNNN":if(Oe===g)return ce[R];break;case"NNNNN":if(Wt===g)return ce[R];break}else if([Oe,gt,Wt].indexOf(g)>=0)return ce[R]}function $9(g,M){var I=g.since<=g.until?1:-1;return M===void 0?e(g.since).year():e(g.since).year()+(M-g.offset)*I}function H9(){var g,M,I,R=this.localeData().eras();for(g=0,M=R.length;g<M;++g)if(I=this.clone().startOf("day").valueOf(),R[g].since<=I&&I<=R[g].until||R[g].until<=I&&I<=R[g].since)return R[g].name;return""}function G9(){var g,M,I,R=this.localeData().eras();for(g=0,M=R.length;g<M;++g)if(I=this.clone().startOf("day").valueOf(),R[g].since<=I&&I<=R[g].until||R[g].until<=I&&I<=R[g].since)return R[g].narrow;return""}function W9(){var g,M,I,R=this.localeData().eras();for(g=0,M=R.length;g<M;++g)if(I=this.clone().startOf("day").valueOf(),R[g].since<=I&&I<=R[g].until||R[g].until<=I&&I<=R[g].since)return R[g].abbr;return""}function Y9(){var g,M,I,R,G=this.localeData().eras();for(g=0,M=G.length;g<M;++g)if(I=G[g].since<=G[g].until?1:-1,R=this.clone().startOf("day").valueOf(),G[g].since<=R&&R<=G[g].until||G[g].until<=R&&R<=G[g].since)return(this.year()-e(G[g].since).year())*I+G[g].offset;return this.year()}function j9(g){return a(this,"_erasNameRegex")||wg.call(this),g?this._erasNameRegex:this._erasRegex}function Z9(g){return a(this,"_erasAbbrRegex")||wg.call(this),g?this._erasAbbrRegex:this._erasRegex}function J9(g){return a(this,"_erasNarrowRegex")||wg.call(this),g?this._erasNarrowRegex:this._erasRegex}function xg(g,M){return M.erasAbbrRegex(g)}function X9(g,M){return M.erasNameRegex(g)}function Q9(g,M){return M.erasNarrowRegex(g)}function K9(g,M){return M._eraYearOrdinalRegex||Re}function wg(){var g=[],M=[],I=[],R=[],G,ce,Oe,gt,Wt,hr=this.eras();for(G=0,ce=hr.length;G<ce;++G)Oe=Wr(hr[G].name),gt=Wr(hr[G].abbr),Wt=Wr(hr[G].narrow),M.push(Oe),g.push(gt),I.push(Wt),R.push(Oe),R.push(gt),R.push(Wt);this._erasRegex=new RegExp("^("+R.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+M.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+g.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+I.join("|")+")","i")}U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Of(g,M){U(0,[g,g.length],0,M)}Of("gggg","weekYear"),Of("ggggg","weekYear"),Of("GGGG","isoWeekYear"),Of("GGGGG","isoWeekYear"),Ye("G",ze),Ye("g",ze),Ye("GG",Et,we),Ye("gg",Et,we),Ye("GGGG",qe,Nt),Ye("gggg",qe,Nt),Ye("GGGGG",$e,Ht),Ye("ggggg",$e,Ht),bi(["gggg","ggggg","GGGG","GGGGG"],function(g,M,I,R){M[R.substr(0,2)]=ur(g)}),bi(["gg","GG"],function(g,M,I,R){M[R]=e.parseTwoDigitYear(g)});function e7(g){return sE.call(this,g,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function t7(g){return sE.call(this,g,this.isoWeek(),this.isoWeekday(),1,4)}function r7(){return co(this.year(),1,4)}function n7(){return co(this.isoWeekYear(),1,4)}function i7(){var g=this.localeData()._week;return co(this.year(),g.dow,g.doy)}function a7(){var g=this.localeData()._week;return co(this.weekYear(),g.dow,g.doy)}function sE(g,M,I,R,G){var ce;return g==null?nc(this,R,G).year:(ce=co(g,R,G),M>ce&&(M=ce),o7.call(this,g,M,I,R,G))}function o7(g,M,I,R,G){var ce=LM(g,M,I,R,G),Oe=rc(ce.year,0,ce.dayOfYear);return this.year(Oe.getUTCFullYear()),this.month(Oe.getUTCMonth()),this.date(Oe.getUTCDate()),this}U("Q",0,"Qo","quarter"),Ye("Q",Ze),Sr("Q",function(g,M){M[Nn]=(ur(g)-1)*3});function s7(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),Ye("D",Et,Le),Ye("DD",Et,we),Ye("Do",function(g,M){return g?M._dayOfMonthOrdinalParse||M._ordinalParse:M._dayOfMonthOrdinalParseLenient}),Sr(["D","DD"],xi),Sr("Do",function(g,M){M[xi]=ur(g.match(Et)[0])});var uE=qa("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),Ye("DDD",ve),Ye("DDDD",ht),Sr(["DDD","DDDD"],function(g,M,I){I._dayOfYear=ur(g)});function u7(g){var M=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?M:this.add(g-M,"d")}U("m",["mm",2],0,"minute"),Ye("m",Et,ft),Ye("mm",Et,we),Sr(["m","mm"],Bn);var l7=qa("Minutes",!1);U("s",["ss",2],0,"second"),Ye("s",Et,ft),Ye("ss",Et,we),Sr(["s","ss"],dn);var c7=qa("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return this.millisecond()*10}),U(0,["SSSSS",5],0,function(){return this.millisecond()*100}),U(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),U(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),U(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),U(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ye("S",ve,Ze),Ye("SS",ve,we),Ye("SSS",ve,ht);var zo,lE;for(zo="SSSS";zo.length<=9;zo+="S")Ye(zo,Re);function f7(g,M){M[wi]=ur(("0."+g)*1e3)}for(zo="S";zo.length<=9;zo+="S")Sr(zo,f7);lE=qa("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function p7(){return this._isUTC?"UTC":""}function m7(){return this._isUTC?"Coordinated Universal Time":""}var rt=A.prototype;rt.add=a9,rt.calendar=p9,rt.clone=m9,rt.diff=x9,rt.endOf=C9,rt.format=A9,rt.from=M9,rt.fromNow=E9,rt.to=D9,rt.toNow=N9,rt.get=Fu,rt.invalidAt=V9,rt.isAfter=d9,rt.isBefore=h9,rt.isBetween=g9,rt.isSame=v9,rt.isSameOrAfter=y9,rt.isSameOrBefore=b9,rt.isValid=R9,rt.lang=rE,rt.locale=tE,rt.localeData=nE,rt.max=Rq,rt.min=Oq,rt.parsingFlags=L9,rt.set=ec,rt.startOf=T9,rt.subtract=o9,rt.toArray=k9,rt.toObject=B9,rt.toDate=P9,rt.toISOString=_9,rt.inspect=S9,typeof Symbol<"u"&&Symbol.for!=null&&(rt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),rt.toJSON=O9,rt.toString=w9,rt.unix=I9,rt.valueOf=F9,rt.creationData=U9,rt.eraName=H9,rt.eraNarrow=G9,rt.eraAbbr=W9,rt.eraYear=Y9,rt.year=uo,rt.isLeapYear=Tu,rt.weekYear=e7,rt.isoWeekYear=t7,rt.quarter=rt.quarters=s7,rt.month=OM,rt.daysInMonth=P6,rt.week=rt.weeks=q6,rt.isoWeek=rt.isoWeeks=z6,rt.weeksInYear=i7,rt.weeksInWeekYear=a7,rt.isoWeeksInYear=r7,rt.isoWeeksInISOWeekYear=n7,rt.date=uE,rt.day=rt.days=tq,rt.weekday=rq,rt.isoWeekday=nq,rt.dayOfYear=u7,rt.hour=rt.hours=cq,rt.minute=rt.minutes=l7,rt.second=rt.seconds=c7,rt.millisecond=rt.milliseconds=lE,rt.utcOffset=Wq,rt.utc=jq,rt.local=Zq,rt.parseZone=Jq,rt.hasAlignedHourOffset=Xq,rt.isDST=Qq,rt.isLocal=e9,rt.isUtcOffset=t9,rt.isUtc=JM,rt.isUTC=JM,rt.zoneAbbr=p7,rt.zoneName=m7,rt.dates=E("dates accessor is deprecated. Use date instead.",uE),rt.months=E("months accessor is deprecated. Use month instead",OM),rt.years=E("years accessor is deprecated. Use year instead",uo),rt.zone=E("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Yq),rt.isDSTShifted=E("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kq);function d7(g){return jr(g*1e3)}function h7(){return jr.apply(null,arguments).parseZone()}function cE(g){return g}var Mr=z.prototype;Mr.calendar=C,Mr.longDateFormat=Se,Mr.invalidDate=Ee,Mr.ordinal=We,Mr.preparse=cE,Mr.postformat=cE,Mr.relativeTime=oe,Mr.pastFuture=ge,Mr.set=B,Mr.eras=q9,Mr.erasParse=z9,Mr.erasConvertYear=$9,Mr.erasAbbrRegex=Z9,Mr.erasNameRegex=j9,Mr.erasNarrowRegex=J9,Mr.months=Ar,Mr.monthsShort=yn,Mr.monthsParse=lo,Mr.monthsRegex=B6,Mr.monthsShortRegex=k6,Mr.week=R6,Mr.firstDayOfYear=U6,Mr.firstDayOfWeek=V6,Mr.weekdays=J6,Mr.weekdaysMin=Q6,Mr.weekdaysShort=X6,Mr.weekdaysParse=eq,Mr.weekdaysRegex=iq,Mr.weekdaysShortRegex=aq,Mr.weekdaysMinRegex=oq,Mr.isPM=uq,Mr.meridiem=fq;function Rf(g,M,I,R){var G=fo(),ce=p().set(R,M);return G[I](ce,g)}function fE(g,M,I){if(s(g)&&(M=g,g=void 0),g=g||"",M!=null)return Rf(g,M,I,"month");var R,G=[];for(R=0;R<12;R++)G[R]=Rf(g,R,I,"month");return G}function _g(g,M,I,R){typeof g=="boolean"?(s(M)&&(I=M,M=void 0),M=M||""):(M=g,I=M,g=!1,s(M)&&(I=M,M=void 0),M=M||"");var G=fo(),ce=g?G._week.dow:0,Oe,gt=[];if(I!=null)return Rf(M,(I+ce)%7,R,"day");for(Oe=0;Oe<7;Oe++)gt[Oe]=Rf(M,(Oe+ce)%7,R,"day");return gt}function g7(g,M){return fE(g,M,"months")}function v7(g,M){return fE(g,M,"monthsShort")}function y7(g,M,I){return _g(g,M,I,"weekdays")}function b7(g,M,I){return _g(g,M,I,"weekdaysShort")}function x7(g,M,I){return _g(g,M,I,"weekdaysMin")}qo("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(g){var M=g%10,I=ur(g%100/10)===1?"th":M===1?"st":M===2?"nd":M===3?"rd":"th";return g+I}}),e.lang=E("moment.lang is deprecated. Use moment.locale instead.",qo),e.langData=E("moment.langData is deprecated. Use moment.localeData instead.",fo);var po=Math.abs;function w7(){var g=this._data;return this._milliseconds=po(this._milliseconds),this._days=po(this._days),this._months=po(this._months),g.milliseconds=po(g.milliseconds),g.seconds=po(g.seconds),g.minutes=po(g.minutes),g.hours=po(g.hours),g.months=po(g.months),g.years=po(g.years),this}function pE(g,M,I,R){var G=ba(M,I);return g._milliseconds+=R*G._milliseconds,g._days+=R*G._days,g._months+=R*G._months,g._bubble()}function _7(g,M){return pE(this,g,M,1)}function S7(g,M){return pE(this,g,M,-1)}function mE(g){return g<0?Math.floor(g):Math.ceil(g)}function A7(){var g=this._milliseconds,M=this._days,I=this._months,R=this._data,G,ce,Oe,gt,Wt;return g>=0&&M>=0&&I>=0||g<=0&&M<=0&&I<=0||(g+=mE(Sg(I)+M)*864e5,M=0,I=0),R.milliseconds=g%1e3,G=Dn(g/1e3),R.seconds=G%60,ce=Dn(G/60),R.minutes=ce%60,Oe=Dn(ce/60),R.hours=Oe%24,M+=Dn(Oe/24),Wt=Dn(dE(M)),I+=Wt,M-=mE(Sg(Wt)),gt=Dn(I/12),I%=12,R.days=M,R.months=I,R.years=gt,this}function dE(g){return g*4800/146097}function Sg(g){return g*146097/4800}function M7(g){if(!this.isValid())return NaN;var M,I,R=this._milliseconds;if(g=re(g),g==="month"||g==="quarter"||g==="year")switch(M=this._days+R/864e5,I=this._months+dE(M),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(M=this._days+Math.round(Sg(this._months)),g){case"week":return M/7+R/6048e5;case"day":return M+R/864e5;case"hour":return M*24+R/36e5;case"minute":return M*1440+R/6e4;case"second":return M*86400+R/1e3;case"millisecond":return Math.floor(M*864e5)+R;default:throw new Error("Unknown unit "+g)}}function mo(g){return function(){return this.as(g)}}var hE=mo("ms"),E7=mo("s"),D7=mo("m"),N7=mo("h"),T7=mo("d"),C7=mo("w"),F7=mo("M"),I7=mo("Q"),P7=mo("y"),k7=hE;function B7(){return ba(this)}function O7(g){return g=re(g),this.isValid()?this[g+"s"]():NaN}function Rs(g){return function(){return this.isValid()?this._data[g]:NaN}}var R7=Rs("milliseconds"),L7=Rs("seconds"),V7=Rs("minutes"),U7=Rs("hours"),q7=Rs("days"),z7=Rs("months"),$7=Rs("years");function H7(){return Dn(this.days()/7)}var ho=Math.round,Bu={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function G7(g,M,I,R,G){return G.relativeTime(M||1,!!I,g,R)}function W7(g,M,I,R){var G=ba(g).abs(),ce=ho(G.as("s")),Oe=ho(G.as("m")),gt=ho(G.as("h")),Wt=ho(G.as("d")),hr=ho(G.as("M")),ci=ho(G.as("w")),go=ho(G.as("y")),$o=ce<=I.ss&&["s",ce]||ce<I.s&&["ss",ce]||Oe<=1&&["m"]||Oe<I.m&&["mm",Oe]||gt<=1&&["h"]||gt<I.h&&["hh",gt]||Wt<=1&&["d"]||Wt<I.d&&["dd",Wt];return I.w!=null&&($o=$o||ci<=1&&["w"]||ci<I.w&&["ww",ci]),$o=$o||hr<=1&&["M"]||hr<I.M&&["MM",hr]||go<=1&&["y"]||["yy",go],$o[2]=M,$o[3]=+g>0,$o[4]=R,G7.apply(null,$o)}function Y7(g){return g===void 0?ho:typeof g=="function"?(ho=g,!0):!1}function j7(g,M){return Bu[g]===void 0?!1:M===void 0?Bu[g]:(Bu[g]=M,g==="s"&&(Bu.ss=M-1),!0)}function Z7(g,M){if(!this.isValid())return this.localeData().invalidDate();var I=!1,R=Bu,G,ce;return typeof g=="object"&&(M=g,g=!1),typeof g=="boolean"&&(I=g),typeof M=="object"&&(R=Object.assign({},Bu,M),M.s!=null&&M.ss==null&&(R.ss=M.s-1)),G=this.localeData(),ce=W7(this,!I,R,G),I&&(ce=G.pastFuture(+this,ce)),G.postformat(ce)}var Ag=Math.abs;function Ou(g){return(g>0)-(g<0)||+g}function Lf(){if(!this.isValid())return this.localeData().invalidDate();var g=Ag(this._milliseconds)/1e3,M=Ag(this._days),I=Ag(this._months),R,G,ce,Oe,gt=this.asSeconds(),Wt,hr,ci,go;return gt?(R=Dn(g/60),G=Dn(R/60),g%=60,R%=60,ce=Dn(I/12),I%=12,Oe=g?g.toFixed(3).replace(/\.?0+$/,""):"",Wt=gt<0?"-":"",hr=Ou(this._months)!==Ou(gt)?"-":"",ci=Ou(this._days)!==Ou(gt)?"-":"",go=Ou(this._milliseconds)!==Ou(gt)?"-":"",Wt+"P"+(ce?hr+ce+"Y":"")+(I?hr+I+"M":"")+(M?ci+M+"D":"")+(G||R||g?"T":"")+(G?go+G+"H":"")+(R?go+R+"M":"")+(g?go+Oe+"S":"")):"P0D"}var vr=Ff.prototype;vr.isValid=zq,vr.abs=w7,vr.add=_7,vr.subtract=S7,vr.as=M7,vr.asMilliseconds=hE,vr.asSeconds=E7,vr.asMinutes=D7,vr.asHours=N7,vr.asDays=T7,vr.asWeeks=C7,vr.asMonths=F7,vr.asQuarters=I7,vr.asYears=P7,vr.valueOf=k7,vr._bubble=A7,vr.clone=B7,vr.get=O7,vr.milliseconds=R7,vr.seconds=L7,vr.minutes=V7,vr.hours=U7,vr.days=q7,vr.weeks=H7,vr.months=z7,vr.years=$7,vr.humanize=Z7,vr.toISOString=Lf,vr.toString=Lf,vr.toJSON=Lf,vr.locale=tE,vr.localeData=nE,vr.toIsoString=E("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Lf),vr.lang=rE,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Ye("x",ze),Ye("X",X),Sr("X",function(g,M,I){I._d=new Date(parseFloat(g)*1e3)}),Sr("x",function(g,M,I){I._d=new Date(ur(g))});return e.version="2.30.1",t(jr),e.fn=rt,e.min=Lq,e.max=Vq,e.now=Uq,e.utc=p,e.unix=d7,e.months=g7,e.isDate=l,e.locale=qo,e.invalid=y,e.duration=ba,e.isMoment=x,e.weekdays=y7,e.parseZone=h7,e.localeData=fo,e.isDuration=If,e.monthsShort=v7,e.weekdaysMin=x7,e.defineLocale=fg,e.updateLocale=hq,e.locales=gq,e.weekdaysShort=b7,e.normalizeUnits=re,e.relativeTimeRounding=Y7,e.relativeTimeThreshold=j7,e.calendarFormat=f9,e.prototype=rt,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var tp=xn(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.P_HELPERS=_i.ParserHelpers=_i.validateRegexFlags=_i.validateRange=_i.getIndex=_i.arrayUnion=void 0;var kg=rp();function oz(n,e){if(n===void 0&&e===void 0)return;if(n===void 0)return e;if(e===void 0)return n;let t=[...n];for(let r of e)t.includes(r)||t.push(r);return t}_i.arrayUnion=oz;function sz(n){return n===void 0?-1:n.index}_i.getIndex=sz;function uz(n,e){if(e<n)throw new Error(`Invalid Range: max might not be smaller than min. Received [${n}, ${e}].`);if(n<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${n}, ${e}].`);if(n===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${n}, ${e}].`);if(!Number.isInteger(n)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${n}, ${e}].`)}_i.validateRange=uz;function lz(n){for(let e of n)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'.`)}_i.validateRegexFlags=lz;var ep=class{followedBy(e){return new kg.Parser(function(r){return e.p(r.copy())})}notFollowedBy(e){return new kg.Parser(function(r){let i=r.copy(),a=e.p(i),o=r.sliceTo(i.position.index);return a.success?r.fail("not '"+o+"'"):r.succeed(void 0)})}test(e){return new kg.Parser(function(r){let i=r.input[r.position.index];return!r.atEOF()&&e(i)?r.succeedOffset(1,i):r.fail(`a character matching ${e}`)})}};_i.ParserHelpers=ep;_i.P_HELPERS=new ep});var PE=xn(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.ParserContext=void 0;var Bg=tp(),Og=class n{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new n(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 r=(0,Bg.getIndex)(e.furthest),i=(0,Bg.getIndex)(t.furthest);if(i>r)return t;let a=i===r?(0,Bg.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};np.ParserContext=Og});var Si=xn(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.P=void 0;var Bi=rp(),ip=tp(),Rg=class n{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Bi.Parser(function(r){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o].p(r);if(i=r.merge(i,s),!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 Bi.Parser(function(i){let a,o=new Array(t.length);for(let u=0;u<t.length;u++){let l=t[u].p(i);if(a=i.merge(a,l),!a.success)return a;o[u]=a.value}return a.value=e(...o),a})}static createLanguage(e){let t={},r={},i={};for(let a in e)i[a]=n.reference(()=>e[a](t,i)),Object.defineProperty(r,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](r,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Bi.Parser(function(r){let i;for(let a of e){let o=a,u=r.copy(),s=o.p(u);if(i=r.merge(i,s),i.success)return r.moveToPosition(u.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(n.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 Bi.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,ip.validateRegexFlags)(e.flags);let r=e.source;return t!==void 0?new Bi.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let s=t??0;if(s>=0&&s<=u.length){let c=u[0],f=u[s];return a.succeedOffset(c.length,f)}let l="expected valid match group (0 to "+u.length+") in "+r;return a.fail(l)}else return a.fail(r)}):new Bi.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let s=u[0];return a.succeedOffset(s.length,s)}else return a.fail(r)})}static succeed(e){return new Bi.Parser(function(r){return r.succeed(e)})}static fail(e){return new Bi.Parser(function(r){return r.fail(e)})}static oneOf(e){return ip.P_HELPERS.test(function(r){return e.includes(r)}).describe(`one character of '${e}'`)}static noneOf(e){return ip.P_HELPERS.test(function(r){return!e.includes(r)}).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 Bi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static manyNotOf(e){return new Bi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&!e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static custom(e){return new Bi.Parser(e)}static range(e,t){let r=e.charCodeAt(0),i=t.charCodeAt(0);return ip.P_HELPERS.test(function(o){let u=o.charCodeAt(0);return r<=u&&u<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new Bi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e(r.input[i]);)i++;return r.succeedAt(i,r.input.slice(r.position.index,i))})}static reference(e){return new Bi.Parser(function(r){return e().p(r)})}};ap.P=Rg});var BE=xn(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.ParsingError=qu.createParsingErrorMessage=void 0;function kE(n,e,t){let r=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${r} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=n.split(`
`)[e.furthest.line-1],u=`${e.furthest.line} | `;i+=`
${u}${o}`,i+=`
${" ".repeat(e.furthest.column-1+u.length)}^ (${r})`}return i}qu.createParsingErrorMessage=kE;var Lg=class extends Error{constructor(e,t){super(kE(e,t,!0))}};qu.ParsingError=Lg});var rp=xn(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.Parser=void 0;var cz=PE(),ta=Si(),Vg=tp(),zu=Oi(),fz=BE(),Ug=class n{constructor(e){this.p=e}tryParse(e){return this.p(new cz.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new fz.ParsingError(e,t)}or(e){return ta.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(ta.P.string(e))}wrap(e,t){let r=this;return new n(function(a){let o=e.p(a);if(!o.success)return o;let u=a.merge(o,r.p(a));if(!u.success)return u;let s=a.merge(u,t.p(a));return s.success?a.merge(s,a.succeed(u.value)):s})}wrapString(e,t){return this.wrap(ta.P.string(e),ta.P.string(t))}then(e){let t=this;return new n(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 n(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 ta.P.sequence(this,e)}many(){let e=this;return new n(function(r){let i,a=r.position.index,o=[];for(;;){let u=r.copy(),s=e.p(u);if(i=r.merge(i,s),i.success){if(u.position.index===a)throw new Error("infinite loop in many() parser detected");r.moveToPosition(u.position),o.push(i.value)}else return r.merge(i,r.succeed(o))}})}repeat(e,t){(0,Vg.validateRange)(e,t);let r=this;return new n(function(a){let o,u,s=[],l=0;for(;l<e;l++)if(o=r.p(a),u=a.merge(u,o),o.success)s.push(o.value);else return u;for(;l<t;l++){let c=a.copy();if(o=r.p(c),u=a.merge(u,o),o.success)a.moveToPosition(c.position),s.push(o.value);else break}return a.merge(u,a.succeed(s))})}atMost(e){return this.repeat(0,e)}atLeast(e){return ta.P.sequenceMap((t,r)=>t.concat(r),this.repeat(e,e),this.many())}separateBy(e){return ta.P.separateBy(this,e)}separateByNotEmpty(e){return ta.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new n(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return ta.P.sequenceMap(function(t,r,i){return{value:r,range:{from:t,to:i}}},zu.P_UTILS.position(),this,zu.P_UTILS.position())}namedMarker(e){return ta.P.sequenceMap(function(r,i,a){return{value:i,name:e,range:{from:r,to:a}}},zu.P_UTILS.position(),this,zu.P_UTILS.position())}node(e){return ta.P.sequenceMap(function(r,i,a){return e(i,{from:r,to:a})},zu.P_UTILS.position(),this,zu.P_UTILS.position())}followedBy(e){return this.skip(Vg.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(Vg.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new n(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 n(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(ta.P.succeed(e))}chain(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let u=e(a.value).p(i);return i.merge(a,u)})}thenEof(){let e=this;return new n(function(r){let i=e.p(r);return i.success?r.atEOF()?i:r.merge(i,r.fail("eof")):i})}memorize(){let e=this,t="",r=new Map,i=new Map;return new n(function(o){let u=o.position.index;if(o.input!==t)t=o.input,r.clear(),i.clear();else{let l=r.get(u),c=i.get(u);if(l!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},l)}let s=e.p(o);return r.set(u,Object.assign({},s)),i.set(u,o.getPosition()),s})}};op.Parser=Ug});var Oi=xn(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.P_UTILS=void 0;var sp=rp(),Rr=Si(),qg=class n{static position(){return new sp.Parser(e=>e.succeed(e.getPosition()))}static any(){return new sp.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new sp.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new sp.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return Rr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return Rr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return Rr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return Rr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return Rr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return Rr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return Rr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return Rr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return Rr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return Rr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return Rr.P.string("\r")}static lf(){return Rr.P.string(`
`)}static crlf(){return Rr.P.string(`\r
`)}static newline(){return Rr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,r){return Rr.P.sequenceMap((i,a)=>i.reduce((o,u)=>r(u,o),a),e.many(),t)}static postfix(e,t,r){return Rr.P.sequenceMap((i,a)=>a.reduce((o,u)=>r(u,o),i),t,e.many())}static binaryRight(e,t,r){return Rr.P.sequenceMap((i,a)=>i.reverse().reduce((o,u)=>{let[s,l]=u;return r(s,l,o)},a),Rr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,r){return Rr.P.sequenceMap((i,a)=>a.reduce((o,u)=>{let[s,l]=u;return r(o,s,l)},i),t,Rr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,r){return Rr.P.sequenceMap((i,a,o)=>i.reverse().reduce((u,s)=>{let[l,c,f]=s;return r({from:l,to:o},c,f,u)},a),Rr.P.sequence(n.position(),t,e.trim(this.optionalWhitespace())).many(),t,n.position())}static binaryLeftRange(e,t,r){return Rr.P.sequenceMap((i,a,o)=>o.reduce((u,s)=>{let[l,c,f]=s;return r({from:i,to:f},u,l,c)},a),n.position(),t,Rr.P.sequence(e.trim(this.optionalWhitespace()),t,n.position()).many())}static func(e,t,r){let i=typeof e=="string"?Rr.P.string(e):e;return Rr.P.sequenceMap((a,o,u,s,l,c)=>r(a,s),i,Rr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),Rr.P.string(")"))}};up.P_UTILS=qg});var Bv=xn((Pv,kv)=>{(function(n,e){typeof Pv=="object"&&typeof kv<"u"?kv.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n["'typed'"]=e())})(Pv,function(){"use strict";function n(){return!0}function e(){return!1}function t(){}let r="Argument is not a typed-function.";function i(){function o(ae){return typeof ae=="object"&&ae!==null&&ae.constructor===Object}let u=[{name:"number",test:function(ae){return typeof ae=="number"}},{name:"string",test:function(ae){return typeof ae=="string"}},{name:"boolean",test:function(ae){return typeof ae=="boolean"}},{name:"Function",test:function(ae){return typeof ae=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(ae){return ae instanceof Date}},{name:"RegExp",test:function(ae){return ae instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(ae){return ae===null}},{name:"undefined",test:function(ae){return ae===void 0}}],s={name:"any",test:n,isAny:!0},l,c,f=0,p={createCount:0};function m(ae){let he=l.get(ae);if(he)return he;let ve='Unknown type "'+ae+'"',qe=ae.toLowerCase(),$e;for($e of c)if($e.toLowerCase()===qe){ve+='. Did you mean "'+$e+'" ?';break}throw new TypeError(ve)}function h(ae){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",ve=he?m(he).index:c.length,qe=[];for(let Re=0;Re<ae.length;++Re){if(!ae[Re]||typeof ae[Re].name!="string"||typeof ae[Re].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let ze=ae[Re].name;if(l.has(ze))throw new TypeError('Duplicate type name "'+ze+'"');qe.push(ze),l.set(ze,{name:ze,test:ae[Re].test,isAny:ae[Re].isAny,index:ve+Re,conversionsTo:[]})}let $e=c.slice(ve);c=c.slice(0,ve).concat(qe).concat($e);for(let Re=ve+qe.length;Re<c.length;++Re)l.get(c[Re]).index=Re}function d(){l=new Map,c=[],f=0,h([s],!1)}d(),h(u);function v(){let ae;for(ae of c)l.get(ae).conversionsTo=[];f=0}function y(ae){let he=c.filter(ve=>{let qe=l.get(ve);return!qe.isAny&&qe.test(ae)});return he.length?he:["any"]}function S(ae){return ae&&typeof ae=="function"&&"_typedFunctionData"in ae}function b(ae,he,ve){if(!S(ae))throw new TypeError(r);let qe=ve&&ve.exact,$e=Array.isArray(he)?he.join(","):he,Re=N($e),ze=x(Re);if(!qe||ze in ae.signatures){let Ae=ae._typedFunctionData.signatureMap.get(ze);if(Ae)return Ae}let Xe=Re.length,F;if(qe){F=[];let Ae;for(Ae in ae.signatures)F.push(ae._typedFunctionData.signatureMap.get(Ae))}else F=ae._typedFunctionData.signatures;for(let Ae=0;Ae<Xe;++Ae){let Le=Re[Ae],ft=[],St;for(St of F){let Ye=z(St.params,Ae);if(!(!Ye||Le.restParam&&!Ye.restParam)){if(!Ye.hasAny){let kn=_(Ye);if(Le.types.some(li=>!kn.has(li.name)))continue}ft.push(St)}}if(F=ft,F.length===0)break}let X;for(X of F)if(X.params.length<=Xe)return X;throw new TypeError("Signature not found (signature: "+(ae.name||"unnamed")+"("+x(Re,", ")+"))")}function w(ae,he,ve){return b(ae,he,ve).implementation}function A(ae,he){let ve=m(he);if(ve.test(ae))return ae;let qe=ve.conversionsTo;if(qe.length===0)throw new Error("There are no conversions to "+he+" defined.");for(let $e=0;$e<qe.length;$e++)if(m(qe[$e].from).test(ae))return qe[$e].convert(ae);throw new Error("Cannot convert "+ae+" to "+he)}function x(ae){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return ae.map(ve=>ve.name).join(he)}function D(ae){let he=ae.indexOf("...")===0,qe=(he?ae.length>3?ae.slice(3):"any":ae).split("|").map(Xe=>m(Xe.trim())),$e=!1,Re=he?"...":"";return{types:qe.map(function(Xe){return $e=Xe.isAny||$e,Re+=Xe.name+"|",{name:Xe.name,typeIndex:Xe.index,test:Xe.test,isAny:Xe.isAny,conversion:null,conversionIndex:-1}}),name:Re.slice(0,-1),hasAny:$e,hasConversion:!1,restParam:he}}function E(ae){let he=ae.types.map(ze=>ze.name),ve=U(he),qe=ae.hasAny,$e=ae.name,Re=ve.map(function(ze){let Xe=m(ze.from);return qe=Xe.isAny||qe,$e+="|"+ze.from,{name:ze.from,typeIndex:Xe.index,test:Xe.test,isAny:Xe.isAny,conversion:ze,conversionIndex:ze.index}});return{types:ae.types.concat(Re),name:$e,hasAny:qe,hasConversion:Re.length>0,restParam:ae.restParam}}function _(ae){return ae.typeSet||(ae.typeSet=new Set,ae.types.forEach(he=>ae.typeSet.add(he.name))),ae.typeSet}function N(ae){let he=[];if(typeof ae!="string")throw new TypeError("Signatures must be strings");let ve=ae.trim();if(ve==="")return he;let qe=ve.split(",");for(let $e=0;$e<qe.length;++$e){let Re=D(qe[$e].trim());if(Re.restParam&&$e!==qe.length-1)throw new SyntaxError('Unexpected rest parameter "'+qe[$e]+'": only allowed for the last parameter');if(Re.types.length===0)return null;he.push(Re)}return he}function P(ae){let he=te(ae);return he?he.restParam:!1}function B(ae){if(!ae||ae.types.length===0)return n;if(ae.types.length===1)return m(ae.types[0].name).test;if(ae.types.length===2){let he=m(ae.types[0].name).test,ve=m(ae.types[1].name).test;return function($e){return he($e)||ve($e)}}else{let he=ae.types.map(function(ve){return m(ve.name).test});return function(qe){for(let $e=0;$e<he.length;$e++)if(he[$e](qe))return!0;return!1}}}function V(ae){let he,ve,qe;if(P(ae)){he=We(ae).map(B);let $e=he.length,Re=B(te(ae)),ze=function(Xe){for(let F=$e;F<Xe.length;F++)if(!Re(Xe[F]))return!1;return!0};return function(F){for(let X=0;X<he.length;X++)if(!he[X](F[X]))return!1;return ze(F)&&F.length>=$e+1}}else return ae.length===0?function(Re){return Re.length===0}:ae.length===1?(ve=B(ae[0]),function(Re){return ve(Re[0])&&Re.length===1}):ae.length===2?(ve=B(ae[0]),qe=B(ae[1]),function(Re){return ve(Re[0])&&qe(Re[1])&&Re.length===2}):(he=ae.map(B),function(Re){for(let ze=0;ze<he.length;ze++)if(!he[ze](Re[ze]))return!1;return Re.length===he.length})}function z(ae,he){return he<ae.length?ae[he]:P(ae)?te(ae):null}function L(ae,he){let ve=z(ae,he);return ve?_(ve):new Set}function k(ae){return ae.conversion===null||ae.conversion===void 0}function C(ae,he){let ve=new Set;return ae.forEach(qe=>{let $e=L(qe.params,he),Re;for(Re of $e)ve.add(Re)}),ve.has("any")?["any"]:Array.from(ve)}function W(ae,he,ve){let qe,$e,Re=ae||"unnamed",ze=ve,Xe;for(Xe=0;Xe<he.length;Xe++){let Le=[];if(ze.forEach(ft=>{let St=z(ft.params,Xe),Ye=B(St);(Xe<ft.params.length||P(ft.params))&&Ye(he[Xe])&&Le.push(ft)}),Le.length===0){if($e=C(ze,Xe),$e.length>0){let ft=y(he[Xe]);return qe=new TypeError("Unexpected type of argument in function "+Re+" (expected: "+$e.join(" or ")+", actual: "+ft.join(" | ")+", index: "+Xe+")"),qe.data={category:"wrongType",fn:Re,index:Xe,actual:ft,expected:$e},qe}}else ze=Le}let F=ze.map(function(Le){return P(Le.params)?1/0:Le.params.length});if(he.length<Math.min.apply(null,F))return $e=C(ze,Xe),qe=new TypeError("Too few arguments in function "+Re+" (expected: "+$e.join(" or ")+", index: "+he.length+")"),qe.data={category:"tooFewArgs",fn:Re,index:he.length,expected:$e},qe;let X=Math.max.apply(null,F);if(he.length>X)return qe=new TypeError("Too many arguments in function "+Re+" (expected: "+X+", actual: "+he.length+")"),qe.data={category:"tooManyArgs",fn:Re,index:he.length,expectedLength:X},qe;let Ae=[];for(let Le=0;Le<he.length;++Le)Ae.push(y(he[Le]).join("|"));return qe=new TypeError('Arguments of type "'+Ae.join(", ")+'" do not match any of the defined signatures of function '+Re+"."),qe.data={category:"mismatch",actual:Ae},qe}function O(ae){let he=c.length+1;for(let ve=0;ve<ae.types.length;ve++)k(ae.types[ve])&&(he=Math.min(he,ae.types[ve].typeIndex));return he}function H(ae){let he=f+1;for(let ve=0;ve<ae.types.length;ve++)k(ae.types[ve])||(he=Math.min(he,ae.types[ve].conversionIndex));return he}function Z(ae,he){if(ae.hasAny){if(!he.hasAny)return 1}else if(he.hasAny)return-1;if(ae.restParam){if(!he.restParam)return 1}else if(he.restParam)return-1;if(ae.hasConversion){if(!he.hasConversion)return 1}else if(he.hasConversion)return-1;let ve=O(ae)-O(he);if(ve<0)return-1;if(ve>0)return 1;let qe=H(ae)-H(he);return qe<0?-1:qe>0?1:0}function Q(ae,he){let ve=ae.params,qe=he.params,$e=te(ve),Re=te(qe),ze=P(ve),Xe=P(qe);if(ze&&$e.hasAny){if(!Xe||!Re.hasAny)return 1}else if(Xe&&Re.hasAny)return-1;let F=0,X=0,Ae;for(Ae of ve)Ae.hasAny&&++F,Ae.hasConversion&&++X;let Le=0,ft=0;for(Ae of qe)Ae.hasAny&&++Le,Ae.hasConversion&&++ft;if(F!==Le)return F-Le;if(ze&&$e.hasConversion){if(!Xe||!Re.hasConversion)return 1}else if(Xe&&Re.hasConversion)return-1;if(X!==ft)return X-ft;if(ze){if(!Xe)return 1}else if(Xe)return-1;let St=(ve.length-qe.length)*(ze?-1:1);if(St!==0)return St;let Ye=[],kn=0;for(let Wr=0;Wr<ve.length;++Wr){let Dn=Z(ve[Wr],qe[Wr]);Ye.push(Dn),kn+=Dn}if(kn!==0)return kn;let li;for(li of Ye)if(li!==0)return li;return 0}function U(ae){if(ae.length===0)return[];let he=ae.map(m);ae.length>1&&he.sort(($e,Re)=>$e.index-Re.index);let ve=he[0].conversionsTo;if(ae.length===1)return ve;ve=ve.concat([]);let qe=new Set(ae);for(let $e=1;$e<he.length;++$e){let Re;for(Re of he[$e].conversionsTo)qe.has(Re.from)||(ve.push(Re),qe.add(Re.from))}return ve}function de(ae,he){let ve=he;if(ae.some($e=>$e.hasConversion)){let $e=P(ae),Re=ae.map(De);ve=function(){let Xe=[],F=$e?arguments.length-1:arguments.length;for(let X=0;X<F;X++)Xe[X]=Re[X](arguments[X]);return $e&&(Xe[F]=arguments[F].map(Re[F])),he.apply(this,Xe)}}let qe=ve;if(P(ae)){let $e=ae.length-1;qe=function(){return ve.apply(this,oe(arguments,0,$e).concat([oe(arguments,$e)]))}}return qe}function De(ae){let he,ve,qe,$e,Re=[],ze=[];switch(ae.types.forEach(function(Xe){Xe.conversion&&(Re.push(m(Xe.conversion.from).test),ze.push(Xe.conversion.convert))}),ze.length){case 0:return function(F){return F};case 1:return he=Re[0],qe=ze[0],function(F){return he(F)?qe(F):F};case 2:return he=Re[0],ve=Re[1],qe=ze[0],$e=ze[1],function(F){return he(F)?qe(F):ve(F)?$e(F):F};default:return function(F){for(let X=0;X<ze.length;X++)if(Re[X](F))return ze[X](F);return F}}}function me(ae){function he(ve,qe,$e){if(qe<ve.length){let Re=ve[qe],ze=[];if(Re.restParam){let Xe=Re.types.filter(k);Xe.length<Re.types.length&&ze.push({types:Xe,name:"..."+Xe.map(F=>F.name).join("|"),hasAny:Xe.some(F=>F.isAny),hasConversion:!1,restParam:!0}),ze.push(Re)}else ze=Re.types.map(function(Xe){return{types:[Xe],name:Xe.name,hasAny:Xe.isAny,hasConversion:Xe.conversion,restParam:!1}});return ie(ze,function(Xe){return he(ve,qe+1,$e.concat([Xe]))})}else return[$e]}return he(ae,0,[])}function _e(ae,he){let ve=Math.max(ae.length,he.length);for(let Xe=0;Xe<ve;Xe++){let F=L(ae,Xe),X=L(he,Xe),Ae=!1,Le;for(Le of X)if(F.has(Le)){Ae=!0;break}if(!Ae)return!1}let qe=ae.length,$e=he.length,Re=P(ae),ze=P(he);return Re?ze?qe===$e:$e>=qe:ze?qe>=$e:qe===$e}function Ne(ae){return ae.map(he=>Ze(he)?Te(he.referToSelf.callback):Ie(he)?le(he.referTo.references,he.referTo.callback):he)}function Se(ae,he,ve){let qe=[],$e;for($e of ae){let Re=ve[$e];if(typeof Re!="number")throw new TypeError('No definition for referenced signature "'+$e+'"');if(Re=he[Re],typeof Re!="function")return!1;qe.push(Re)}return qe}function Me(ae,he,ve){let qe=Ne(ae),$e=new Array(qe.length).fill(!1),Re=!0;for(;Re;){Re=!1;let ze=!0;for(let Xe=0;Xe<qe.length;++Xe){if($e[Xe])continue;let F=qe[Xe];if(Ze(F))qe[Xe]=F.referToSelf.callback(ve),qe[Xe].referToSelf=F.referToSelf,$e[Xe]=!0,ze=!1;else if(Ie(F)){let X=Se(F.referTo.references,qe,he);X?(qe[Xe]=F.referTo.callback.apply(this,X),qe[Xe].referTo=F.referTo,$e[Xe]=!0,ze=!1):Re=!0}}if(ze&&Re)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return qe}function Ee(ae){let he=/\bthis(\(|\.signatures\b)/;Object.keys(ae).forEach(ve=>{let qe=ae[ve];if(he.test(qe.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 Ce(ae,he){if(p.createCount++,Object.keys(he).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&Ee(he);let ve=[],qe=[],$e={},Re=[],ze;for(ze in he){if(!Object.prototype.hasOwnProperty.call(he,ze))continue;let et=N(ze);if(!et)continue;ve.forEach(function(bn){if(_e(bn,et))throw new TypeError('Conflicting signatures "'+x(bn)+'" and "'+x(et)+'".')}),ve.push(et);let Vt=qe.length;qe.push(he[ze]);let Ar=et.map(E),yn;for(yn of me(Ar)){let bn=x(yn);Re.push({params:yn,name:bn,fn:Vt}),yn.every(lo=>!lo.hasConversion)&&($e[bn]=Vt)}}Re.sort(Q);let Xe=Me(qe,$e,at),F;for(F in $e)Object.prototype.hasOwnProperty.call($e,F)&&($e[F]=Xe[$e[F]]);let X=[],Ae=new Map;for(F of Re)Ae.has(F.name)||(F.fn=Xe[F.fn],X.push(F),Ae.set(F.name,F));let Le=X[0]&&X[0].params.length<=2&&!P(X[0].params),ft=X[1]&&X[1].params.length<=2&&!P(X[1].params),St=X[2]&&X[2].params.length<=2&&!P(X[2].params),Ye=X[3]&&X[3].params.length<=2&&!P(X[3].params),kn=X[4]&&X[4].params.length<=2&&!P(X[4].params),li=X[5]&&X[5].params.length<=2&&!P(X[5].params),Wr=Le&&ft&&St&&Ye&&kn&&li;for(let et=0;et<X.length;++et)X[et].test=V(X[et].params);let Dn=Le?B(X[0].params[0]):e,ur=ft?B(X[1].params[0]):e,Uo=St?B(X[2].params[0]):e,Sr=Ye?B(X[3].params[0]):e,bi=kn?B(X[4].params[0]):e,Ki=li?B(X[5].params[0]):e,ki=Le?B(X[0].params[1]):e,mn=ft?B(X[1].params[1]):e,Nn=St?B(X[2].params[1]):e,xi=Ye?B(X[3].params[1]):e,Kr=kn?B(X[4].params[1]):e,Bn=li?B(X[5].params[1]):e;for(let et=0;et<X.length;++et)X[et].implementation=de(X[et].params,X[et].fn);let dn=Le?X[0].implementation:t,wi=ft?X[1].implementation:t,Kl=St?X[2].implementation:t,Nu=Ye?X[3].implementation:t,so=kn?X[4].implementation:t,uo=li?X[5].implementation:t,Tu=Le?X[0].params.length:-1,qa=ft?X[1].params.length:-1,ya=St?X[2].params.length:-1,Cu=Ye?X[3].params.length:-1,Fu=kn?X[4].params.length:-1,ec=li?X[5].params.length:-1,tc=Wr?6:0,Yr=X.length,$=X.map(et=>et.test),ue=X.map(et=>et.implementation),Ve=function(){for(let Vt=tc;Vt<Yr;Vt++)if($[Vt](arguments))return ue[Vt].apply(this,arguments);return p.onMismatch(ae,arguments,X)};function at(et,Vt){return arguments.length===Tu&&Dn(et)&&ki(Vt)?dn.apply(this,arguments):arguments.length===qa&&ur(et)&&mn(Vt)?wi.apply(this,arguments):arguments.length===ya&&Uo(et)&&Nn(Vt)?Kl.apply(this,arguments):arguments.length===Cu&&Sr(et)&&xi(Vt)?Nu.apply(this,arguments):arguments.length===Fu&&bi(et)&&Kr(Vt)?so.apply(this,arguments):arguments.length===ec&&Ki(et)&&Bn(Vt)?uo.apply(this,arguments):Ve.apply(this,arguments)}try{Object.defineProperty(at,"name",{value:ae})}catch{}return at.signatures=$e,at._typedFunctionData={signatures:X,signatureMap:Ae},at}function Ge(ae,he,ve){throw W(ae,he,ve)}function We(ae){return oe(ae,0,ae.length-1)}function te(ae){return ae[ae.length-1]}function oe(ae,he,ve){return Array.prototype.slice.call(ae,he,ve)}function ge(ae,he){for(let ve=0;ve<ae.length;ve++)if(he(ae[ve]))return ae[ve]}function ie(ae,he){return Array.prototype.concat.apply([],ae.map(he))}function re(){let ae=We(arguments).map(ve=>x(N(ve))),he=te(arguments);if(typeof he!="function")throw new TypeError("Callback function expected as last argument");return le(ae,he)}function le(ae,he){return{referTo:{references:ae,callback:he}}}function Te(ae){if(typeof ae!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:ae}}}function Ie(ae){return ae&&typeof ae.referTo=="object"&&Array.isArray(ae.referTo.references)&&typeof ae.referTo.callback=="function"}function Ze(ae){return ae&&typeof ae.referToSelf=="object"&&typeof ae.referToSelf.callback=="function"}function we(ae,he){if(!ae)return he;if(he&&he!==ae){let ve=new Error("Function names do not match (expected: "+ae+", actual: "+he+")");throw ve.data={actual:he,expected:ae},ve}return ae}function ht(ae){let he;for(let ve in ae)Object.prototype.hasOwnProperty.call(ae,ve)&&(S(ae[ve])||typeof ae[ve].signature=="string")&&(he=we(he,ae[ve].name));return he}function Nt(ae,he){let ve;for(ve in he)if(Object.prototype.hasOwnProperty.call(he,ve)){if(ve in ae&&he[ve]!==ae[ve]){let qe=new Error('Signature "'+ve+'" is defined twice');throw qe.data={signature:ve,sourceFunction:he[ve],destFunction:ae[ve]},qe}ae[ve]=he[ve]}}let Ht=p;p=function(ae){let he=typeof ae=="string",ve=he?1:0,qe=he?ae:"",$e={};for(let Re=ve;Re<arguments.length;++Re){let ze=arguments[Re],Xe={},F;if(typeof ze=="function"?(F=ze.name,typeof ze.signature=="string"?Xe[ze.signature]=ze:S(ze)&&(Xe=ze.signatures)):o(ze)&&(Xe=ze,he||(F=ht(ze))),Object.keys(Xe).length===0){let X=new TypeError("Argument to 'typed' at index "+Re+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw X.data={index:Re,argument:ze},X}he||(qe=we(qe,F)),Nt($e,Xe)}return Ce(qe||"",$e)},p.create=i,p.createCount=Ht.createCount,p.onMismatch=Ge,p.throwMismatchError=Ge,p.createError=W,p.clear=d,p.clearConversions=v,p.addTypes=h,p._findType=m,p.referTo=re,p.referToSelf=Te,p.convert=A,p.findSignature=b,p.find=w,p.isTypedFunction=S,p.warnAgainstDeprecatedThis=!0,p.addType=function(ae,he){let ve="any";he!==!1&&l.has("Object")&&(ve="Object"),p.addTypes([ae],ve)};function Et(ae){if(!ae||typeof ae.from!="string"||typeof ae.to!="string"||typeof ae.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(ae.to===ae.from)throw new SyntaxError('Illegal to define conversion from "'+ae.from+'" to itself.')}return p.addConversion=function(ae){Et(ae);let he=m(ae.to);if(he.conversionsTo.every(function(ve){return ve.from!==ae.from}))he.conversionsTo.push({from:ae.from,convert:ae.convert,index:f++});else throw new Error('There is already a conversion from "'+ae.from+'" to "'+he.name+'"')},p.addConversions=function(ae){ae.forEach(p.addConversion)},p.removeConversion=function(ae){Et(ae);let he=m(ae.to),ve=ge(he.conversionsTo,$e=>$e.from===ae.from);if(!ve)throw new Error("Attempt to remove nonexistent conversion from "+ae.from+" to "+ae.to);if(ve.convert!==ae.convert)throw new Error("Conversion to remove does not match existing conversion");let qe=he.conversionsTo.indexOf(ve);he.conversionsTo.splice(qe,1)},p.resolve=function(ae,he){if(!S(ae))throw new TypeError(r);let ve=ae._typedFunctionData.signatures;for(let qe=0;qe<ve.length;++qe)if(ve[qe].test(he))return ve[qe];return null},p}var a=i();return a})});var wT=xn((iy,xT)=>{(function(n){"use strict";var e=Math.cosh||function(l){return Math.abs(l)<1e-9?1-l:(Math.exp(l)+Math.exp(-l))*.5},t=Math.sinh||function(l){return Math.abs(l)<1e-9?l:(Math.exp(l)-Math.exp(-l))*.5},r=function(l){var c=Math.PI/4;if(-c>l||l>c)return Math.cos(l)-1;var f=l*l;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(l,c){var f=Math.abs(l),p=Math.abs(c);return f<3e3&&p<3e3?Math.sqrt(f*f+p*p):(f<p?(f=p,p=l/c):p=c/l,f*Math.sqrt(1+p*p))},a=function(){throw SyntaxError("Invalid Param")};function o(l,c){var f=Math.abs(l),p=Math.abs(c);return l===0?Math.log(p):c===0?Math.log(f):f<3e3&&p<3e3?Math.log(l*l+c*c)*.5:(l=l/2,c=c/2,.5*Math.log(l*l+c*c)+Math.LN2)}var u=function(l,c){var f={re:0,im:0};if(l==null)f.re=f.im=0;else if(c!==void 0)f.re=l,f.im=c;else switch(typeof l){case"object":if("im"in l&&"re"in l)f.re=l.re,f.im=l.im;else if("abs"in l&&"arg"in l){if(!Number.isFinite(l.abs)&&Number.isFinite(l.arg))return s.INFINITY;f.re=l.abs*Math.cos(l.arg),f.im=l.abs*Math.sin(l.arg)}else if("r"in l&&"phi"in l){if(!Number.isFinite(l.r)&&Number.isFinite(l.phi))return s.INFINITY;f.re=l.r*Math.cos(l.phi),f.im=l.r*Math.sin(l.phi)}else l.length===2?(f.re=l[0],f.im=l[1]):a();break;case"string":f.im=f.re=0;var p=l.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 v=p[d];v===" "||v===" "||v===`
`||(v==="+"?m++:v==="-"?h++:v==="i"||v==="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(v))&&a(),p[d+1]==="i"||p[d+1]==="I"?(f.im+=parseFloat((h%2?"-":"")+v),d++):f.re+=parseFloat((h%2?"-":"")+v),m=h=0))}m+h>0&&a();break;case"number":f.im=0,f.re=l;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function s(l,c){if(!(this instanceof s))return new s(l,c);var f=u(l,c);this.re=f.re,this.im=f.im}s.prototype={re:0,im:0,sign:function(){var l=this.abs();return new s(this.re/l,this.im/l)},add:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:new s(this.re+f.re,this.im+f.im)},sub:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:new s(this.re-f.re,this.im-f.im)},mul:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:f.im===0&&this.im===0?new s(this.re*f.re,0):new s(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(l,c){var f=new s(l,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return s.NAN;if(this.isInfinite()||f.isZero())return s.INFINITY;if(this.isZero()||f.isInfinite())return s.ZERO;l=this.re,c=this.im;var p=f.re,m=f.im,h,d;return m===0?new s(l/p,c/p):Math.abs(p)<Math.abs(m)?(d=p/m,h=p*d+m,new s((l*d+c)/h,(c*d-l)/h)):(d=m/p,h=m*d+p,new s((l+c*d)/h,(c-l*d)/h))},pow:function(l,c){var f=new s(l,c);if(l=this.re,c=this.im,f.isZero())return s.ONE;if(f.im===0){if(c===0&&l>0)return new s(Math.pow(l,f.re),0);if(l===0)switch((f.re%4+4)%4){case 0:return new s(Math.pow(c,f.re),0);case 1:return new s(0,Math.pow(c,f.re));case 2:return new s(-Math.pow(c,f.re),0);case 3:return new s(0,-Math.pow(c,f.re))}}if(l===0&&c===0&&f.re>0&&f.im>=0)return s.ZERO;var p=Math.atan2(c,l),m=o(l,c);return l=Math.exp(f.re*m-f.im*p),c=f.im*m+f.re*p,new s(l*Math.cos(c),l*Math.sin(c))},sqrt:function(){var l=this.re,c=this.im,f=this.abs(),p,m;if(l>=0){if(c===0)return new s(Math.sqrt(l),0);p=.5*Math.sqrt(2*(f+l))}else p=Math.abs(c)/Math.sqrt(2*(f-l));return l<=0?m=.5*Math.sqrt(2*(f-l)):m=Math.abs(c)/Math.sqrt(2*(f+l)),new s(p,c<0?-m:m)},exp:function(){var l=Math.exp(this.re);return this.im,new s(l*Math.cos(this.im),l*Math.sin(this.im))},expm1:function(){var l=this.re,c=this.im;return new s(Math.expm1(l)*Math.cos(c)+r(c),Math.exp(l)*Math.sin(c))},log:function(){var l=this.re,c=this.im;return c===0&&l>0,new s(o(l,c),Math.atan2(c,l))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var l=this.re,c=this.im;return new s(Math.sin(l)*e(c),Math.cos(l)*t(c))},cos:function(){var l=this.re,c=this.im;return new s(Math.cos(l)*e(c),-Math.sin(l)*t(c))},tan:function(){var l=2*this.re,c=2*this.im,f=Math.cos(l)+e(c);return new s(Math.sin(l)/f,t(c)/f)},cot:function(){var l=2*this.re,c=2*this.im,f=Math.cos(l)-e(c);return new s(-Math.sin(l)/f,t(c)/f)},sec:function(){var l=this.re,c=this.im,f=.5*e(2*c)+.5*Math.cos(2*l);return new s(Math.cos(l)*e(c)/f,Math.sin(l)*t(c)/f)},csc:function(){var l=this.re,c=this.im,f=.5*e(2*c)-.5*Math.cos(2*l);return new s(Math.sin(l)*e(c)/f,-Math.cos(l)*t(c)/f)},asin:function(){var l=this.re,c=this.im,f=new s(c*c-l*l+1,-2*l*c).sqrt(),p=new s(f.re-c,f.im+l).log();return new s(p.im,-p.re)},acos:function(){var l=this.re,c=this.im,f=new s(c*c-l*l+1,-2*l*c).sqrt(),p=new s(f.re-c,f.im+l).log();return new s(Math.PI/2-p.im,p.re)},atan:function(){var l=this.re,c=this.im;if(l===0){if(c===1)return new s(0,1/0);if(c===-1)return new s(0,-1/0)}var f=l*l+(1-c)*(1-c),p=new s((1-c*c-l*l)/f,-2*l/f).log();return new s(-.5*p.im,.5*p.re)},acot:function(){var l=this.re,c=this.im;if(c===0)return new s(Math.atan2(1,l),0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).atan():new s(l!==0?l/0:0,c!==0?-c/0:0).atan()},asec:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(0,1/0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).acos():new s(l!==0?l/0:0,c!==0?-c/0:0).acos()},acsc:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(Math.PI/2,1/0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).asin():new s(l!==0?l/0:0,c!==0?-c/0:0).asin()},sinh:function(){var l=this.re,c=this.im;return new s(t(l)*Math.cos(c),e(l)*Math.sin(c))},cosh:function(){var l=this.re,c=this.im;return new s(e(l)*Math.cos(c),t(l)*Math.sin(c))},tanh:function(){var l=2*this.re,c=2*this.im,f=e(l)+Math.cos(c);return new s(t(l)/f,Math.sin(c)/f)},coth:function(){var l=2*this.re,c=2*this.im,f=e(l)-Math.cos(c);return new s(t(l)/f,-Math.sin(c)/f)},csch:function(){var l=this.re,c=this.im,f=Math.cos(2*c)-e(2*l);return new s(-2*t(l)*Math.cos(c)/f,2*e(l)*Math.sin(c)/f)},sech:function(){var l=this.re,c=this.im,f=Math.cos(2*c)+e(2*l);return new s(2*e(l)*Math.cos(c)/f,-2*t(l)*Math.sin(c)/f)},asinh:function(){var l=this.im;this.im=-this.re,this.re=l;var c=this.asin();return this.re=-this.im,this.im=l,l=c.re,c.re=-c.im,c.im=l,c},acosh:function(){var l=this.acos();if(l.im<=0){var c=l.re;l.re=-l.im,l.im=c}else{var c=l.im;l.im=-l.re,l.re=c}return l},atanh:function(){var l=this.re,c=this.im,f=l>1&&c===0,p=1-l,m=1+l,h=p*p+c*c,d=h!==0?new s((m*p-c*c)/h,(c*p+m*c)/h):new s(l!==-1?l/0:0,c!==0?c/0:0),v=d.re;return d.re=o(d.re,d.im)/2,d.im=Math.atan2(d.im,v)/2,f&&(d.im=-d.im),d},acoth:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(0,Math.PI/2);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).atanh():new s(l!==0?l/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var l=this.re,c=this.im;if(c===0)return new s(l!==0?Math.log(l+Math.sqrt(l*l+1)):1/0,0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).asinh():new s(l!==0?l/0:0,c!==0?-c/0:0).asinh()},asech:function(){var l=this.re,c=this.im;if(this.isZero())return s.INFINITY;var f=l*l+c*c;return f!==0?new s(l/f,-c/f).acosh():new s(l!==0?l/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return s.INFINITY;if(this.isInfinite())return s.ZERO;var l=this.re,c=this.im,f=l*l+c*c;return new s(l/f,-c/f)},conjugate:function(){return new s(this.re,-this.im)},neg:function(){return new s(-this.re,-this.im)},ceil:function(l){return l=Math.pow(10,l||0),new s(Math.ceil(this.re*l)/l,Math.ceil(this.im*l)/l)},floor:function(l){return l=Math.pow(10,l||0),new s(Math.floor(this.re*l)/l,Math.floor(this.im*l)/l)},round:function(l){return l=Math.pow(10,l||0),new s(Math.round(this.re*l)/l,Math.round(this.im*l)/l)},equals:function(l,c){var f=new s(l,c);return Math.abs(f.re-this.re)<=s.EPSILON&&Math.abs(f.im-this.im)<=s.EPSILON},clone:function(){return new s(this.re,this.im)},toString:function(){var l=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(l)<s.EPSILON&&(l=0),Math.abs(c)<s.EPSILON&&(c=0),c===0?f+l:(l!==0?(f+=l,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())}},s.ZERO=new s(0,0),s.ONE=new s(1,0),s.I=new s(0,1),s.PI=new s(Math.PI,0),s.E=new s(Math.E,0),s.INFINITY=new s(1/0,1/0),s.NAN=new s(NaN,NaN),s.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return s}):typeof iy=="object"?(Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Complex=s,xT.exports=s):n.Complex=s})(iy)});var ST=xn((oy,_T)=>{(function(n){"use strict";var e=2e3,t={s:1,n:0,d:1};function r(d,v){if(isNaN(d=parseInt(d,10)))throw m();return d*v}function i(d,v){if(v===0)throw p();var y=Object.create(f.prototype);y.s=d<0?-1:1,d=d<0?-d:d;var S=c(d,v);return y.n=d/S,y.d=v/S,y}function a(d){for(var v={},y=d,S=2,b=4;b<=y;){for(;y%S===0;)y/=S,v[S]=(v[S]||0)+1;b+=1+2*S++}return y!==d?y>1&&(v[y]=(v[y]||0)+1):v[d]=(v[d]||0)+1,v}var o=function(d,v){var y=0,S=1,b=1,w=0,A=0,x=0,D=1,E=1,_=0,N=1,P=1,B=1,V=1e7,z;if(d!=null)if(v!==void 0){if(y=d,S=v,b=y*S,y%1!==0||S%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)y=d.n,S=d.d,"s"in d&&(y*=d.s);else if(0 in d)y=d[0],1 in d&&(S=d[1]);else throw m();b=y*S;break}case"number":{if(d<0&&(b=d,d=-d),d%1===0)y=d;else if(d>0){for(d>=1&&(E=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=E);N<=V&&B<=V;)if(z=(_+P)/(N+B),d===z){N+B<=V?(y=_+P,S=N+B):B>N?(y=P,S=B):(y=_,S=N);break}else d>z?(_+=P,N+=B):(P+=_,B+=N),N>V?(y=P,S=B):(y=_,S=N);y*=E}else(isNaN(d)||isNaN(v))&&(S=y=NaN);break}case"string":{if(N=d.match(/\d+|./g),N===null)throw m();if(N[_]==="-"?(b=-1,_++):N[_]==="+"&&_++,N.length===_+1?A=r(N[_++],b):N[_+1]==="."||N[_]==="."?(N[_]!=="."&&(w=r(N[_++],b)),_++,(_+1===N.length||N[_+1]==="("&&N[_+3]===")"||N[_+1]==="'"&&N[_+3]==="'")&&(A=r(N[_],b),D=Math.pow(10,N[_].length),_++),(N[_]==="("&&N[_+2]===")"||N[_]==="'"&&N[_+2]==="'")&&(x=r(N[_+1],b),E=Math.pow(10,N[_+1].length)-1,_+=3)):N[_+1]==="/"||N[_+1]===":"?(A=r(N[_],b),D=r(N[_+2],1),_+=3):N[_+3]==="/"&&N[_+1]===" "&&(w=r(N[_],b),A=r(N[_+2],b),D=r(N[_+4],1),_+=5),N.length<=_){S=D*E,b=y=x+S*w+E*A;break}}default:throw m()}if(S===0)throw p();t.s=b<0?-1:1,t.n=Math.abs(y),t.d=Math.abs(S)};function u(d,v,y){for(var S=1;v>0;d=d*d%y,v>>=1)v&1&&(S=S*d%y);return S}function s(d,v){for(;v%2===0;v/=2);for(;v%5===0;v/=5);if(v===1)return 0;for(var y=10%v,S=1;y!==1;S++)if(y=y*10%v,S>e)return 0;return S}function l(d,v,y){for(var S=1,b=u(10,y,v),w=0;w<300;w++){if(S===b)return w;S=S*10%v,b=b*10%v}return 0}function c(d,v){if(!d)return v;if(!v)return d;for(;;){if(d%=v,!d)return v;if(v%=d,!v)return d}}function f(d,v){if(o(d,v),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,v){return o(d,v),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(d,v){return o(d,v),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(d,v){return o(d,v),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(d,v){return o(d,v),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,v){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,v),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,v){return o(d,v),i(c(t.n,this.n)*c(t.d,this.d),t.d*this.d)},lcm:function(d,v){return o(d,v),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,v){if(o(d,v),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 y=a(this.n),S=a(this.d),b=1,w=1;for(var A in y)if(A!=="1"){if(A==="0"){b=0;break}if(y[A]*=t.n,y[A]%t.d===0)y[A]/=t.d;else return null;b*=Math.pow(A,y[A])}for(var A in S)if(A!=="1"){if(S[A]*=t.n,S[A]%t.d===0)S[A]/=t.d;else return null;w*=Math.pow(A,S[A])}return t.s<0?i(w,b):i(b,w)},equals:function(d,v){return o(d,v),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(d,v){o(d,v);var y=this.s*this.n*t.d-t.s*t.n*this.d;return(0<y)-(y<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var v=this.abs(),y=v.toContinued(),S=1;S<y.length;S++){for(var b=i(y[S-1],1),w=S-2;w>=0;w--)b=b.inverse().add(y[w]);if(Math.abs(b.sub(v).valueOf())<d)return b.mul(this.s)}return this},divisible:function(d,v){return o(d,v),!(!(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 v,y="",S=this.n,b=this.d;return this.s<0&&(y+="-"),b===1?y+=S:(d&&(v=Math.floor(S/b))>0&&(y+=v,y+=" ",S%=b),y+=S,y+="/",y+=b),y},toLatex:function(d){var v,y="",S=this.n,b=this.d;return this.s<0&&(y+="-"),b===1?y+=S:(d&&(v=Math.floor(S/b))>0&&(y+=v,S%=b),y+="\\frac{",y+=S,y+="}{",y+=b,y+="}"),y},toContinued:function(){var d,v=this.n,y=this.d,S=[];if(isNaN(v)||isNaN(y))return S;do S.push(Math.floor(v/y)),d=v%y,v=y,y=d;while(v!==1);return S},toString:function(d){var v=this.n,y=this.d;if(isNaN(v)||isNaN(y))return"NaN";d=d||15;var S=s(v,y),b=l(v,y,S),w=this.s<0?"-":"";if(w+=v/y|0,v%=y,v*=10,v&&(w+="."),S){for(var A=b;A--;)w+=v/y|0,v%=y,v*=10;w+="(";for(var A=S;A--;)w+=v/y|0,v%=y,v*=10;w+=")"}else for(var A=d;v&&A--;)w+=v/y|0,v%=y,v*=10;return w}},typeof oy=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,_T.exports=f):n.Fraction=f})(oy)});var L2=xn((DMe,R2)=>{R2.exports=function n(e,t){"use strict";var r=/(^([+\-]?(?: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,u=/^0/,s=function(b){return n.insensitive&&(""+b).toLowerCase()||""+b},l=s(e).replace(i,"")||"",c=s(t).replace(i,"")||"",f=l.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=c.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(l.match(o),16)||f.length!==1&&l.match(a)&&Date.parse(l),h=parseInt(c.match(o),16)||m&&c.match(a)&&Date.parse(c)||null,d,v;if(h){if(m<h)return-1;if(m>h)return 1}for(var y=0,S=Math.max(f.length,p.length);y<S;y++){if(d=!(f[y]||"").match(u)&&parseFloat(f[y])||f[y]||0,v=!(p[y]||"").match(u)&&parseFloat(p[y])||p[y]||0,isNaN(d)!==isNaN(v))return isNaN(d)?1:-1;if(typeof d!=typeof v&&(d+="",v+=""),d<v)return-1;if(d>v)return 1}return 0}});var qF=xn((HCe,UF)=>{"use strict";var D1=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},bX={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},xX={"\u2013":"\\--","\u2014":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},wX=function(e,t){return D1({},e,t)};UF.exports=function(n){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,r=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?wX:i,o=String(n),u="",s=a(D1({},bX),r?D1({},xX):{}),l=Object.keys(s),c=function(){var p=!1;l.forEach(function(m,h){p||o.length>=m.length&&o.slice(0,m.length)===m&&(u+=s[l[h]],o=o.slice(m.length,o.length),p=!0)}),p||(u+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return u}});var vR=xn((gR,Nw)=>{(function(n,e,t){function r(u){var s=this,l=o();s.next=function(){var c=2091639*s.s0+s.c*23283064365386963e-26;return s.s0=s.s1,s.s1=s.s2,s.s2=c-(s.c=c|0)},s.c=1,s.s0=l(" "),s.s1=l(" "),s.s2=l(" "),s.s0-=l(u),s.s0<0&&(s.s0+=1),s.s1-=l(u),s.s1<0&&(s.s1+=1),s.s2-=l(u),s.s2<0&&(s.s2+=1),l=null}function i(u,s){return s.c=u.c,s.s0=u.s0,s.s1=u.s1,s.s2=u.s2,s}function a(u,s){var l=new r(u),c=s&&s.state,f=l.next;return f.int32=function(){return l.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,l),f.state=function(){return i(l,{})}),f}function o(){var u=4022871197,s=function(l){l=String(l);for(var c=0;c<l.length;c++){u+=l.charCodeAt(c);var f=.02519603282416938*u;u=f>>>0,f-=u,f*=u,u=f>>>0,f-=u,u+=f*4294967296}return(u>>>0)*23283064365386963e-26};return s}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.alea=a})(gR,typeof Nw=="object"&&Nw,typeof define=="function"&&define)});var bR=xn((yR,Tw)=>{(function(n,e,t){function r(o){var u=this,s="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var c=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^c^c>>>8},o===(o|0)?u.x=o:s+=o;for(var l=0;l<s.length+64;l++)u.x^=s.charCodeAt(l)|0,u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor128=a})(yR,typeof Tw=="object"&&Tw,typeof define=="function"&&define)});var wR=xn((xR,Cw)=>{(function(n,e,t){function r(o){var u=this,s="";u.next=function(){var c=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(c^c<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,o===(o|0)?u.x=o:s+=o;for(var l=0;l<s.length+64;l++)u.x^=s.charCodeAt(l)|0,l==s.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u.v=o.v,u.d=o.d,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorwow=a})(xR,typeof Cw=="object"&&Cw,typeof define=="function"&&define)});var SR=xn((_R,Fw)=>{(function(n,e,t){function r(o){var u=this;u.next=function(){var l=u.x,c=u.i,f,p,m;return f=l[c],f^=f>>>7,p=f^f<<24,f=l[c+1&7],p^=f^f>>>10,f=l[c+3&7],p^=f^f>>>3,f=l[c+4&7],p^=f^f<<7,f=l[c+7&7],f=f^f<<13,p^=f^f<<9,l[c]=p,u.i=c+1&7,p};function s(l,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],l.x=m,l.i=0,f=256;f>0;--f)l.next()}s(u,o)}function i(o,u){return u.x=o.x.slice(),u.i=o.i,u}function a(o,u){o==null&&(o=+new Date);var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(l.x&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorshift7=a})(_R,typeof Fw=="object"&&Fw,typeof define=="function"&&define)});var MR=xn((AR,Iw)=>{(function(n,e,t){function r(o){var u=this;u.next=function(){var l=u.w,c=u.X,f=u.i,p,m;return u.w=l=l+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,u.i=f,m+(l^l>>>16)|0};function s(l,c){var f,p,m,h,d,v=[],y=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,y=Math.max(y,c.length)),m=0,h=-32;h<y;++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=v[h&127]^=p+d,m=f==0?m+1:0);for(m>=128&&(v[(c&&c.length||0)&127]=-1),m=127,h=4*128;h>0;--h)p=v[m+34&127],f=v[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,v[m]=p^f;l.w=d,l.X=v,l.i=m}s(u,o)}function i(o,u){return u.i=o.i,u.w=o.w,u.X=o.X.slice(),u}function a(o,u){o==null&&(o=+new Date);var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(l.X&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor4096=a})(AR,typeof Iw=="object"&&Iw,typeof define=="function"&&define)});var DR=xn((ER,Pw)=>{(function(n,e,t){function r(o){var u=this,s="";u.next=function(){var c=u.b,f=u.c,p=u.d,m=u.a;return c=c<<25^c>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-c|0,u.b=c=c<<20^c>>>12^f,u.c=f=f-p|0,u.d=p<<16^f>>>16^m,u.a=m-c|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,o===Math.floor(o)?(u.a=o/4294967296|0,u.b=o|0):s+=o;for(var l=0;l<s.length+20;l++)u.b^=s.charCodeAt(l)|0,u.next()}function i(o,u){return u.a=o.a,u.b=o.b,u.c=o.c,u.d=o.d,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.tychei=a})(ER,typeof Pw=="object"&&Pw,typeof define=="function"&&define)});var TR=xn((NR,gd)=>{(function(n,e,t){var r=256,i=6,a=52,o="random",u=t.pow(r,i),s=t.pow(2,a),l=s*2,c=r-1,f;function p(b,w,A){var x=[];w=w==!0?{entropy:!0}:w||{};var D=v(d(w.entropy?[b,S(e)]:b??y(),3),x),E=new m(x),_=function(){for(var N=E.g(i),P=u,B=0;N<s;)N=(N+B)*r,P*=r,B=E.g(1);for(;N>=l;)N/=2,P/=2,B>>>=1;return(N+B)/P};return _.int32=function(){return E.g(4)|0},_.quick=function(){return E.g(4)/4294967296},_.double=_,v(S(E.S),e),(w.pass||A||function(N,P,B,V){return V&&(V.S&&h(V,E),N.state=function(){return h(E,{})}),B?(t[o]=N,P):N})(_,D,"global"in w?w.global:this==t,w.state)}function m(b){var w,A=b.length,x=this,D=0,E=x.i=x.j=0,_=x.S=[];for(A||(b=[A++]);D<r;)_[D]=D++;for(D=0;D<r;D++)_[D]=_[E=c&E+b[D%A]+(w=_[D])],_[E]=w;(x.g=function(N){for(var P,B=0,V=x.i,z=x.j,L=x.S;N--;)P=L[V=c&V+1],B=B*r+L[c&(L[V]=L[z=c&z+P])+(L[z]=P)];return x.i=V,x.j=z,B})(r)}function h(b,w){return w.i=b.i,w.j=b.j,w.S=b.S.slice(),w}function d(b,w){var A=[],x=typeof b,D;if(w&&x=="object")for(D in b)try{A.push(d(b[D],w-1))}catch{}return A.length?A:x=="string"?b:b+"\0"}function v(b,w){for(var A=b+"",x,D=0;D<A.length;)w[c&D]=c&(x^=w[c&D]*19)+A.charCodeAt(D++);return S(w)}function y(){try{var b;return f&&(b=f.randomBytes)?b=b(r):(b=new Uint8Array(r),(n.crypto||n.msCrypto).getRandomValues(b)),S(b)}catch{var w=n.navigator,A=w&&w.plugins;return[+new Date,n,A,n.screen,S(e)]}}function S(b){return String.fromCharCode.apply(0,b)}if(v(t.random(),e),typeof gd=="object"&&gd.exports){gd.exports=p;try{f=require("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return p}):t["seed"+o]=p})(typeof self<"u"?self:NR,[],Math)});var FR=xn((lUe,CR)=>{var LQ=vR(),VQ=bR(),UQ=wR(),qQ=SR(),zQ=MR(),$Q=DR(),au=TR();au.alea=LQ;au.xor128=VQ;au.xorwow=UQ;au.xorshift7=qQ;au.xor4096=zQ;au.tychei=$Q;CR.exports=au});var Jie={};tz(Jie,{MetaBindBuild:()=>kM,default:()=>sg});module.exports=rz(Jie);var Ql=require("obsidian");var vE=["January","February","March","April","May","June","July","August","September","October","November","December"],Ls=[{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"}],xa={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:Ls[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"],inputTemplates:void 0};var Ho=(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.IMAGE_LIST_SUGGESTER="imageListSuggester",x.DATE_TIME="dateTime",x.INVALID="invalid",x))(Ho||{}),Zr=(S=>(S.CLASS="class",S.ADD_LABELS="addLabels",S.MIN_VALUE="minValue",S.MAX_VALUE="maxValue",S.STEP_SIZE="stepSize",S.OPTION="option",S.TITLE="title",S.OPTION_QUERY="optionQuery",S.SHOWCASE="showcase",S.ON_VALUE="onValue",S.OFF_VALUE="offValue",S.DEFAULT_VALUE="defaultValue",S.PLACEHOLDER="placeholder",S.USE_LINKS="useLinks",S.LIMIT="limit",S.MULTI_LINE="multiLine",S.ALLOW_OTHER="allowOther",S.INVALID="invalid",S))(Zr||{}),Uf={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},imageListSuggester:{type:"imageListSuggester",allowInBlock:!0,allowInline:!1},dateTime:{type:"dateTime",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}};var yr={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","imageListSuggester"],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","imageListSuggester"],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},multiLine:{type:"multiLine",allowedFieldTypes:["list"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},allowOther:{type:"allowOther",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},sc=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(sc||{}),Vs=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(Vs||{}),Ru={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},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},qf=8;var wn=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)}},Ut=class extends wn{getErrorType(){return"MB_INTERNAL"}},wa=class extends wn{getErrorType(){return"MB_PARSING"}},Go=class extends wn{getErrorType(){return"MB_VALIDATION"}},zf=class extends wn{getErrorType(){return"MB_BIND_TARGET"}};var Cr=class extends wn{getErrorType(){return"MB_ARGUMENT"}},uc=class extends wn{getErrorType(){return"MB_JS"}},_a=class extends wn{getErrorType(){return"MB_EXPRESSION"}};var lc=class extends wn{getErrorType(){return"MB_EXAMPLE"}},Us=class extends wn{getErrorType(){return"MB_EMBED"}},vo=class extends wn{getErrorType(){return"MB_BUTTON"}},qs=class extends wn{getErrorType(){return"MB_DEPENDENCY"}};var ea=class{static get(e,t){return t.get(e).child}static tryGet(e,t){return t.tryGet(e)?.child}static fullGet(e,t){return t.get(e)}static set(e,t,r){t.set(e,r)}static setAndCreate(e,t,r){t.setAndCreate(e,r)}};var Lu=class{constructor(e,t){this.id=e,this.manager=t,this.cache=new Map}validateStoragePath(e,t,r,i){return i.validateStoragePathAsFilePath(e,r)}resolveBindTargetScope(e,t,r){return e}createCacheItem(e){let t=this.cache.get(e);if(t!==void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not create cache item",cause:"cache item already exists"});return t=this.getDefaultCacheItem(e),this.cache.set(e,t),t}getOrCreateCacheItem(e){let t=this.getCacheItemForStoragePath(e);return t===void 0&&(t=this.getDefaultCacheItem(e),this.cache.set(e,t)),t}subscribe(e){if(e.bindTarget===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let t=this.getOrCreateCacheItem(e.bindTarget.storagePath);return t.subscriptions.push(e),t}unsubscribe(e){if(e.bindTarget===void 0)throw new Ut({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 Ut({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return t.subscriptions=t.subscriptions.filter(r=>r.uuid!==e.uuid),t}getCacheItemForStoragePath(e){return this.cache.get(e)}onCycle(e){}iterateCacheItems(){return this.cache.values()}shouldDelete(e){return!0}deleteCache(e){this.cache.delete(e.storagePath)}writeCache(e,t){let r=this.getOrCreateCacheItem(t.storagePath);return ea.setAndCreate(r.data,t.storageProp,e),r}writeEntireCache(e,t){t.data=e}readCache(e){if(e.storageType!==this.id)throw new Ut({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let t=this.getCacheItemForStoragePath(e.storagePath);return t===void 0?ea.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(t,e.storageProp)}readCacheItem(e,t){return ea.tryGet(e.data,t)}readEntireCacheItem(e){return e.data}};function Tn(n,e){let t=n.tryParse(e);if(t.success)return t.value;throw new cc("ERROR","parsiNOM parser",e,t)}var cc=class extends wn{constructor(e,t,r,i){super({errorLevel:e,effect:"failed to parse",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=r,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],r=`${this.parseFailure.furthest.line} | `;this.positionContext=`${r}${t}`,this.positionContext+=`
${this.getUnderline(r.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let t=" ".repeat(this.parseFailure.furthest.column+e-1),r=`^ (${this.cause})`;return t+r}},_n=class extends wn{constructor(e,t,r,i,a,o){super({errorLevel:e,effect:"failed to validate parser result",cause:r,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],r=`${this.position.from.line} | `;this.positionContext=`${r}${t}`,this.positionContext+=`
${this.getUnderline(r.length,t.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,t){if(this.position===void 0)return"";let r=" ".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 r+a}};var $f=class extends Lu{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}async syncExternal(e){}},Hf=class{constructor(e,t){this.id=e,this.manager=t,this.cache={data:{},...this.manager.getDefaultCacheItem()}}createCacheItem(e){return this.cache}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,t,r,i){if(t)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",r,e.position);return""}resolveBindTargetScope(e,t,r){return e}deleteCache(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 ea.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}writeCache(e,t){return ea.setAndCreate(this.cache.data,t.storageProp,e),this.cache}writeEntireCache(e,t){t.data=e}readEntireCacheItem(e){return e.data}},Gf=class{constructor(e,t){this.id=e,this.manager=t}createCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}getOrCreateCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,t,r,i){if(t)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",r,e.position);return""}resolveBindTargetScope(e,t,r){return r.resolveScope(e,t)}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,t){}shouldDelete(e){return!0}subscribe(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,t){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,t){}readEntireCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};function fc(n,e,t){return Math.min(Math.max(n,e),t)}function Wf(n,e,t){return n!==void 0?Math.min(Math.max(n,e),t):void 0}function Mg(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}function Eg(n,e){return(n%e+e)%e}function yE(n){return!!n}function Dg(n){let e=Reflect.ownKeys(n);for(let t of e){let r=n[t];(r&&typeof r=="object"||typeof r=="function")&&Dg(r)}return Object.freeze(n)}function bE(n){return structuredClone(n)}function Ir(){return window.crypto.randomUUID()}function Vu(n){try{return new URL(n),!0}catch{return!1}}function Yf(n){window.open(n,"_blank")}function xE(n,e,t=", ",r="and"){return n.length===0?"":(n=n.map(e),n.length===1?n[0]:n.length===2?`${n[0]} ${r} ${n[1]}`:`${n.slice(0,-1).join(t)} ${r} ${n.slice(-1)}`)}function Wn(n,e){n.innerHTML="",n.className="";let t=document.createElement("span");t.className="mb-warning mb-unloaded",t.innerText=`[MB_UNLOADED] ${e}`,n.appendChild(t)}var mt=class{static createElement(e,t,r){let i=document.createElement(t);return r?.text&&(i.innerText=r.text),r?.class&&(i.className=r.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){for(;e.lastChild;)e.removeChild(e.lastChild)}};var jf=class{constructor(e,t,r,i,a,o,u){this.uuid=e,this.callbackSignal=t,this.metadataManager=r,this.bindTarget=i,this.dependencies=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=u,this.deleted=!1}init(){for(let e of this.dependencies){let t=this.uuid+"/"+Ir();this.dependencySubscriptions.push(this.metadataManager.subscribe(t,e.callbackSignal,e.bindTarget,()=>this.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){try{let e=this.dependencySubscriptions.map(r=>r.callbackSignal.get()),t=await this.computeFunction(e);this.callbackSignal.set(t),this.bindTarget!==void 0&&this.metadataManager.write(t,this.bindTarget,this.uuid)}catch(e){let t=e instanceof Error?e:String(e);console.warn(new Ut({errorLevel:"ERROR",effect:"Failed to compute value of computed subscription",cause:t}))}}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 Zf=class{constructor(e,t,r,i,a){this.uuid=e,this.callbackSignal=t,this.metadataManager=r,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}update(e){this.metadataManager.write(e,this.bindTarget,this.uuid)}notify(e){try{this.callbackSignal.set(e)}catch(t){let r=t instanceof Error?t:String(t);console.warn(new Ut({errorLevel:"ERROR",effect:"Failed to notify subscription of updated value in the cache",cause:r}))}}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var wE=5,nz=5*60;function Ng(n,e){return n===void 0||e===void 0||n.storageType!==e.storageType||n.storagePath!==e.storagePath?!1:_E(n.storageProp,e.storageProp,e.listenToChildren)}function _E(n,e,t){let r=n.path,i=e.path;for(let a=0;a<Math.min(r.length,i.length);a++)if(r[a].type!==i[a].type||r[a].prop!==i[a].prop)return!1;return r.length>i.length?t:!0}function iz(n){return n===void 0?"undefined":`${n.storagePath}#${n.storageProp.toString()}`}var Jf=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 Ut({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,r,i){let a=new Zf(e,t,this,r,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,r,i,a,o){let u=new jf(e,t,this,r,i,a,o);return this.checkForLoops(u),u.init(),this.subscribeSubscription(u),u}unsubscribe(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let r=t.unsubscribe(e);r.subscriptions.length===0&&(r.inactive=!0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let r=t.subscribe(e);r.inactive=!1,r.cyclesSinceInactive=0,e.notify(t.readCacheItem(r,e.bindTarget.storageProp))}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.at(0),r=e.at(-1);if(!(r===void 0||t===void 0)){if(Ng(t.bindTarget,r.bindTarget))throw new zf({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${iz(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(r))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 r=[];for(let i of t.subscriptions)Ng(i.bindTarget,e)&&r.push(i);return t.subscriptions.filter(i=>Ng(i.bindTarget,e))}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let t=[];for(let r of e.iterateCacheItems()){if(e.onCycle(r),r.pendingInternalChange){try{e.syncExternal(r)}catch(i){console.warn("failed to update frontmatter",i)}r.pendingInternalChange=!1}r.cyclesSinceInternalChange+=1,r.inactive&&(r.cyclesSinceInactive+=1),r.cyclesSinceInactive>nz&&e.shouldDelete(r)&&t.push(r)}for(let r of t)e.deleteCache(r)}}write(e,t,r){let i=this.getSource(t.storageType);if(i===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${t.storageType}" does not exist`});let a=i.writeCache(e,t);a.pendingInternalChange=!0,a.cyclesSinceInternalChange=0,this.notifyListeners(t,r)}read(e){let t=this.getSource(e.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return t.readCache(e)}isCacheExternalWriteLocked(e){return e.cyclesSinceInternalChange<wE}notifyListeners(e,t){let r=this.getSource(e.storageType);if(r===void 0)throw new Ut({errorLevel:"ERROR",effect:"can notify listeners metadata",cause:`Source "${e.storageType}" does not exist`});let i=r.getCacheItemForStoragePath(e.storagePath);if(i!==void 0){for(let a of i.subscriptions)if(!(t!==void 0&&t===a.uuid||a.bindTarget===void 0)&&_E(e.storageProp,a.bindTarget.storageProp,a.bindTarget.listenToChildren)){let o=r.readCache(a.bindTarget);a.notify(o)}}}notifyAllListeners(e,t){for(let r of t.subscriptions){if(r.bindTarget===void 0)continue;let i=e.readCache(r.bindTarget);r.notify(i)}}deleteCachesForStoragePath(e){for(let t of this.sources.values()){let r=t.getCacheItemForStoragePath(e);r!==void 0&&(r.subscriptions.forEach(i=>i.delete()),t.deleteCache(r))}}getDefaultCacheItem(){return{subscriptions:[],cyclesSinceInternalChange:wE+1,pendingInternalChange:!1,cyclesSinceInactive:0,inactive:!0}}onExternalUpdate(e,t,r){let i=e.getCacheItemForStoragePath(t);if(i===void 0||this.isCacheExternalWriteLocked(i))return;let a=e.readEntireCacheItem(i);e.writeEntireCache(r,i);for(let o of i.subscriptions){if(o.bindTarget===void 0)continue;let u=o.bindTarget.storageProp,s=ea.tryGet(r,u),l=ea.tryGet(a,u);s!==l&&o.notify(s)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,t){this.deleteCachesForStoragePath(e)}};var Cg=wr(pc()),Yn=class n{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,Cg.default)(e,n.dateFormat)}static getDefaultDate(){return(0,Cg.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var SE=wr(pc());var Fg=Ls[1];function AE(n){Fg=n}function Ig(n){return vE[n]}function ME(n,e){let t=(0,SE.default)(new Date(e,n)).daysInMonth(),r=new Array(42).fill(0),i=az(new Date(e,n,1));for(let a=0;a<t;a++)r[a+i]=a+1;return r=r[r.length-7]?r:r.slice(0,-7),r=r[r.length-7]?r:r.slice(0,-7),r}function az(n){return Eg(n.getDay()-Fg.index,7)}function EE(){return Ls.map(e=>({index:Eg(e.index-Fg.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function DE(){let n=0;return()=>++n}var FE=require("obsidian");var NE={date:"date",datePicker:"datePicker",dateTime:"dateTime",editor:"editor",imageSuggester:'imageSuggester(optionQuery(""))',imageListSuggester:'imageListSuggester(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:""},Xf={image:[{title:"Image",declaration:"VIEW[{globalMemory^MB_VF_image_example}][image]",display:"VIEW[{imageExampleProperty}][image]",inputField:'INPUT[imageSuggester(optionQuery("")):globalMemory^MB_VF_image_example]'}],link:[{title:"Link",declaration:"VIEW[{globalMemory^MB_VF_link_example}][link]",display:"VIEW[{linkExampleProperty}][link]",inputField:'INPUT[suggester(optionQuery("")):globalMemory^MB_VF_link_example]'}],math:[{title:"Math",declaration:"VIEW[{globalMemory^MB_VF_math_example} + 2][math]",display:"VIEW[{mathExampleProperty} + 2][math]",inputField:"INPUT[number:globalMemory^MB_VF_math_example]"}],text:[{title:"Text",declaration:"VIEW[some text {globalMemory^MB_VF_text_example}][text]",display:"VIEW[some text {textExampleProperty}][text]",inputField:"INPUT[text:globalMemory^MB_VF_text_example]"},{title:"Markdown",declaration:"VIEW[**some markdown** {globalMemory^MB_VF_text_markdown_example}][text(renderMarkdown)]",display:"VIEW[**some markdown** {markdownExampleProperty}][text(renderMarkdown)]",inputField:"INPUT[text:globalMemory^MB_VF_text_markdown_example]"}],invalid:[]};function Pg(n){let e=[];for(let[t,r]of Object.entries(NE)){if(r==="")continue;let i=n.api.inputFieldParser.fromString(`INPUT[${r}]`),a=n.api.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[t]}]});i=n.api.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${r}]`;let o=n.api.inputFieldParser.validate(i,"",void 0);e.push([t,o])}return e}function TE(n){let e=[];for(let[t,r]of Object.entries(NE)){if(r==="")continue;let i=t,a="";Uf[i].allowInline?a=`\`INPUT[${r}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${r}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((t,r)=>t[0].localeCompare(r[0])),e}function CE(n){let e=[];for(let t of Object.values(Xf))for(let r of t)e.push([r.title,`\`${r.display}\``]);return e.sort((t,r)=>t[0].localeCompare(r[0])),e}function IE(n,e,t){let r=TE(t),i=CE(t);n.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(u=>{u.setTitle("Input Field");let s=u.setSubmenu();for(let[l,c]of r)s.addItem(f=>{f.setTitle(l),f.onClick(()=>Qf(e,c))})}),o.addItem(u=>{u.setTitle("View Field");let s=u.setSubmenu();for(let[l,c]of i)s.addItem(f=>{f.setTitle(l),f.onClick(()=>Qf(e,c))})}),o.addItem(u=>{u.setTitle("Inline Button"),u.onClick(()=>{Qf(e,"`BUTTON[example-id]`")})}),o.addItem(u=>{u.setTitle("Button"),u.onClick(()=>{t.internal.openButtonBuilderModal({onOkay:s=>{Qf(e,`\`\`\`meta-bind-button
${(0,FE.stringifyYaml)(s)}
\`\`\``)},submitText:"Insert"})})})})}function Qf(n,e){n.replaceSelection(e)}var Kf=class{constructor(){this.activeMountables=new Map}unloadFile(e){for(let t of this.activeMountables.values())t.getFilePath()===e&&(console.debug(`meta-bind | MountableManager >> unregistered Mountable ${t.getUuid()}`),t.unmount())}unload(){for(let e of this.activeMountables.values())console.debug(`meta-bind | MountableManager >> unregistered Mountable ${e.getUuid()}`),e.unmount()}registerMountable(e){console.debug(`meta-bind | MountableManager >> registered Mountable ${e.getUuid()}`),this.activeMountables.set(e.getUuid(),e)}unregisterMountable(e){console.debug(`meta-bind | MountableManager >> unregistered Mountable ${e.getUuid()}`),this.activeMountables.delete(e.getUuid())}};var N5=require("obsidian");var jE=wr(Oi());var on=wr(Oi()),Wg=wr(Si());var UE=wr(Oi()),pi=wr(Si());var mc=wr(Oi()),Ri=wr(Si()),jn=Ri.P.sequence(Ri.P.or(mc.P_UTILS.unicodeLetter(),Ri.P.oneOf("_$")),Ri.P.or(mc.P_UTILS.unicodeAlphanumeric(),Ri.P.oneOf("-_$")).many()).map(n=>n[0]+n[1].join("")).describe("identifier"),OE=Ri.P.sequenceMap((n,e)=>n+e.map(t=>t[0]+t[1]).join(""),jn,Ri.P.sequence(mc.P_UTILS.optionalWhitespace(),jn).many()).describe("identifier with spaces"),pz=Ri.P.string("\\").then(mc.P_UTILS.any()).map(n=>n==="'"?"'":n==="\\"?"\\":"\\"+n);function RE(n){return Ri.P.or(pz,Ri.P.noneOf(n+"\\")).many().map(e=>e.join("")).trim(Ri.P.string(n))}var lp=RE("'"),LE=RE('"'),$u=Ri.P.manyNotOf("{}[]#^|:?").box("file path");function fi(n,e){return{value:n,position:e}}function Li(n){if(n!==void 0)return typeof n=="string"?{value:n}:n}var $s=(t=>(t.OBJECT="object",t.ARRAY="array",t))($s||{}),cp=class{constructor(e,t,r){this.parent=e,this.access=t,this.child=r}};function mz(n,e){return n[e]}function VE(n,e,t){n[e]=t}var zs=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 cp(e,this,mz(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 cp(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");VE(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");VE(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 qE=jn.node((n,e)=>({type:"object",prop:fi(n,e)})),zg=pi.P.or(UE.P_UTILS.digits().wrap(pi.P.string("["),pi.P.string("]")).node((n,e)=>({type:"array",prop:fi(n,e)})),LE.wrap(pi.P.string("["),pi.P.string("]")).node((n,e)=>({type:"object",prop:fi(n,e)}))),dz=pi.P.or(pi.P.sequenceMap(n=>({storagePath:void 0,listenToChildren:!1,storageProp:n}),zg.atLeast(1)),pi.P.sequenceMap((n,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[n,...e]}),qE,zg.many())),hz=pi.P.sequenceMap((n,e)=>[n,...e],qE,zg.many()),$g=pi.P.sequenceMap((n,e)=>(n.storageProp=n.storageProp.concat(e.flat()),n),dz,pi.P.string(".").then(hz).many()),za=pi.P.sequenceMap((n,e,t)=>(t.storageType=n,t.storagePath=e,t),jn.describe("storage type").node(fi).skip(pi.P.string("^").describe('storage type separator "^"')).optional(),$u.describe("storage path").node(fi).skip(pi.P.string("#").describe('storage/file path separator "#"')).optional(),$g.describe("property path")).box("bind target");var Ai=wr(Oi()),Sn=wr(Si());var $a=wr(Si()),fp=wr(Oi());var Hg=$a.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),gz=$a.P.or(lp,Hg).node(fi),vz=$a.P.separateBy(gz,$a.P.string(",").describe('argument value separator ","').trim(fp.P_UTILS.optionalWhitespace())),yz=$a.P.sequenceMap((n,e)=>({name:n,value:e}),jn.node(fi),vz.trim(fp.P_UTILS.optionalWhitespace()).wrap($a.P.string("(").describe('argument value paren "("'),$a.P.string(")").describe('argument value paren ")"')).optional([])),dc=$a.P.separateBy(yz,$a.P.string(",").describe('argument separator ","').trim(fp.P_UTILS.optionalWhitespace()));var bz=Sn.P.string("\\").then(Ai.P_UTILS.any()).map(n=>n==="["?"[":n==="]"?"]":n==="{"?"{":n==="}"?"}":n==="\\"?"\\":"\\"+n),pp=Sn.P.sequenceMap((n,e)=>n+e.flat().join(""),Sn.P.manyNotOf("{}[]\\"),Sn.P.sequence(bz,Sn.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),xz=Sn.P.sequenceMap((n,e)=>[n,...e.flat()],pp,Sn.P.sequence(za.wrapString("{","}"),pp).many()),wz=Sn.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{viewFieldType:n,writeToBindTarget:r,arguments:e,templateDeclaration:void 0}},jn.node(fi).trim(Ai.P_UTILS.optionalWhitespace()).optional().describe("input field type"),dc.trim(Ai.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(Ai.P_UTILS.optionalWhitespace()).optional([]),Sn.P.sequence(Sn.P.string(":").trim(Ai.P_UTILS.optionalWhitespace()),za).trim(Ai.P_UTILS.optionalWhitespace()).optional()),zE=Sn.P.sequenceMap((n,e,t,r)=>r===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(r.templateDeclaration=e,r),Sn.P.string("VIEW"),xz.wrapString("[","]"),Ai.P_UTILS.optionalWhitespace(),wz.wrapString("[","]").optional(),Ai.P_UTILS.eof()),_z=Sn.P.sequenceMap((n,e,t,r)=>(e!==void 0&&(n.listenToChildren=!0),{bindTarget:n,name:r}),za.wrapString("{","}"),Sn.P.string(" and children").optional(),Sn.P.string(" as "),jn),$E=Sn.P.sequenceMap((n,e,t,r)=>({bindTargetMappings:n,writeToBindTarget:e,hidden:t!==void 0,code:r}),_z.separateBy(Ai.P_UTILS.whitespace()).skip(Ai.P_UTILS.whitespace()),Sn.P.string("save to ").then(za.wrapString("{","}")).skip(Ai.P_UTILS.whitespace()).optional(),Sn.P.string("hidden").skip(Ai.P_UTILS.whitespace()).optional(),Sn.P.string("---").then(Ai.P_UTILS.remaining()));var Gg=wr(Si());var Hu=class{constructor(e,t){this.range=e,this.tokenClass=t}};var Bt=class n{static sequence(...e){return Gg.P.sequenceMap((...t)=>t.flat(2).filter(r=>r!==void 0),...e)}static separateBy(e,t){return n.sequence(e,n.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((r,i)=>[new Hu(i,t)])}static highlightStr(e,t){return n.highlight(Gg.P.string(e),t)}};var Yg=Bt.highlight(jn,"ident"),mp=Bt.highlight(jn,"keyword"),jg=Bt.highlightStr(",","control"),dp=Bt.highlightStr("(","control"),hp=Bt.highlightStr(")","control"),Gu=Bt.highlightStr("[","control"),Wu=Bt.highlightStr("]","control"),Az=Bt.highlight(lp,"string"),Mz=Bt.highlight(Hg,"ident"),Ez=Wg.P.or(Mz,Az),Dz=Bt.separateBy(Ez,jg.trim(on.P_UTILS.optionalWhitespace())),Nz=Bt.sequence(mp,Bt.sequence(dp,Dz.trim(on.P_UTILS.optionalWhitespace()),hp).optional()),Zg=Bt.separateBy(Nz,jg.trim(on.P_UTILS.optionalWhitespace())),Yu=Bt.sequence(Bt.sequence(Yg,Bt.highlightStr("^","control")).optional(),Bt.sequence(Bt.highlight($u,"ident"),Bt.highlightStr("#","control")).optional(),Bt.highlight($g,"ident")),Tz=Bt.sequence(mp.trim(on.P_UTILS.optionalWhitespace()),Bt.sequence(dp,Zg.trim(on.P_UTILS.optionalWhitespace()),hp).trim(on.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(on.P_UTILS.optionalWhitespace()),Yu).trim(on.P_UTILS.optionalWhitespace()).optional()),Cz=Bt.sequence(mp.trim(on.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(dp,Zg.trim(on.P_UTILS.optionalWhitespace()),hp).trim(on.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(on.P_UTILS.optionalWhitespace()),Yu).trim(on.P_UTILS.optionalWhitespace()).optional()),GE=Wg.P.or(Bt.sequence(Bt.highlightStr("INPUT","control"),Gu,Yg.trim(on.P_UTILS.optionalWhitespace()),Wu.skip(on.P_UTILS.optionalWhitespace()),Gu,Cz,Wu),Bt.sequence(Bt.highlightStr("INPUT","control"),Gu,Tz,Wu)),HE=Bt.highlight(pp,"ident"),Fz=Bt.sequence(Bt.highlightStr("{","string"),Yu,Bt.highlightStr("}","string")),Iz=Bt.sequence(HE,Bt.sequence(Fz,HE).many()),Pz=Bt.sequence(mp.trim(on.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(dp,Zg.trim(on.P_UTILS.optionalWhitespace()).optional(),hp).trim(on.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(on.P_UTILS.optionalWhitespace()),Yu).trim(on.P_UTILS.optionalWhitespace()).optional()),WE=Bt.sequence(Bt.highlightStr("VIEW","control"),Gu,Iz,Wu,Bt.sequence(Gu.skip(on.P_UTILS.optionalWhitespace()),Pz,Wu).optional()),YE=Bt.sequence(Bt.highlightStr("BUTTON","control"),Gu,Bt.separateBy(Yg,jg.trim(on.P_UTILS.optionalWhitespace())),Wu);var yo=class{constructor(e,t,r){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=r}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 Hu({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};var mi=(t=>(t.INLINE="inline",t.BLOCK="block",t))(mi||{}),ju=(s=>(s.INPUT="INPUT",s.VIEW="VIEW",s.JS_VIEW="JS_VIEW",s.TABLE="TABLE",s.BUTTON_GROUP="BUTTON_GROUP",s.BUTTON="BUTTON",s.EMBED="EMBED",s.EXCLUDED="EXCLUDED",s))(ju||{}),Wo=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function gp(n){return n==="INPUT"||n==="VIEW"||n==="BUTTON_GROUP"}var vp=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,GE)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,WE)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,YE)}highlight(e,t,r){if(t==="INPUT")return this.highlightInputFieldDeclaration(e,r);if(t==="VIEW")return this.highlightViewFieldDeclaration(e,r);if(t==="BUTTON_GROUP")return this.highlightInlineButtonDeclaration(e,r);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,Yu)}highlightWithParser(e,t,r){try{return t?new yo(e,Tn(r.trim(jE.P_UTILS.optionalWhitespace()).thenEof(),e)):new yo(e,Tn(r.thenEof(),e))}catch(i){return i instanceof cc?new yo(e,[],i):(console.error(i),new yo(e,[]))}}};var hn=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(hn||{}),bo=(m=>(m.COMMAND="command",m.JS="js",m.OPEN="open",m.INPUT="input",m.SLEEP="sleep",m.TEMPLATER_CREATE_NOTE="templaterCreateNote",m.UPDATE_METADATA="updateMetadata",m.CREATE_NOTE="createNote",m.REPLACE_IN_NOTE="replaceInNote",m.REGEXP_REPLACE_IN_NOTE="regexpReplaceInNote",m.REPLACE_SELF="replaceSelf",m.INSERT_INTO_NOTE="insertIntoNote",m.INLINE_JS="inlineJS",m))(bo||{});var ZE=wr(Oi()),di=wr(Si());var kz=di.P.sequence($u,di.P.string("#").then(di.P.manyNotOf("[]#|^:")).optional(),di.P.string("|").then(di.P.manyNotOf("[]")).optional()),Jg=di.P.or(di.P.sequenceMap((n,e)=>({isEmbed:n!==void 0,target:e[0],block:e[1],alias:e[2],internal:!0}),di.P.string("!").optional(),kz.wrapString("[[","]]")),di.P.sequenceMap((n,e,t)=>{let r=!Vu(t);return{isEmbed:n!==void 0,target:t,block:void 0,alias:e,internal:r}},di.P.string("!").optional(),di.P.manyNotOf("[]").wrapString("[","]"),di.P.manyNotOf("()").wrapString("(",")"))),Bz=di.P.separateBy(Jg,di.P.string(",").trim(ZE.P_UTILS.optionalWhitespace())),sn=class n{static parseLink(e){return Tn(Jg.thenEof(),e)}static parseLinkList(e){return Tn(Bz.thenEof(),e)}static isLink(e){return Jg.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 Vu(e)?n.urlToLink(new URL(e)):n.parseLink(e)}static convertToLinkString(e){return n.isLink(e)?e:Vu(e)?`[${new URL(e).hostname}](${e})`:n.isLink(`[[${e}]]`)?`[[${e}]]`:""}};var hc=wr(Oi()),Yo=wr(Si());var XE=Yo.P.sequenceMap((n,e)=>n===void 0?e:-e,Yo.P.string("-").optional(),Yo.P.or(Yo.P.sequenceMap((n,e,t)=>Number(n+e+t),hc.P_UTILS.digits(),Yo.P.string("."),hc.P_UTILS.digits()),hc.P_UTILS.digits().map(n=>Number(n)))).thenEof(),QE=Yo.P.sequenceMap((n,e)=>n===void 0?e:-e,Yo.P.string("-").optional(),hc.P_UTILS.digits().map(n=>Number(n))).thenEof();function Vi(n){if(n.toLowerCase()==="null")return null;if(n==="true")return!0;if(n==="false")return!1;{let e=XE.tryParse(n);return e.success?e.value:n}}function Sa(n){return n===void 0||n===null?"":typeof n=="string"?n:typeof n=="boolean"?n?"true":"false":n.toString()}function jo(n){return n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"}function ra(n){if(n!=null){if(jo(n))return[n];if(typeof n=="object"&&Array.isArray(n))return n.filter(e=>jo(e))}}function Zu(n){if(typeof n=="number")return n;if(typeof n=="string"){let e=XE.tryParse(n);if(e.success)return e.value}}function Ha(n){return jo(n)?Sa(n):void 0}function Zo(n){return jo(n)?n:void 0}function yp(n,e){return Array.isArray(n)?n.map(t=>Xg(t,e)).filter(t=>t!=="").join(", "):Xg(n,e)}function Xg(n,e){return n==null?e?"":"null":typeof n=="function"?"<function>":typeof n=="object"||Array.isArray(n)?JSON.stringify(n):n.toString()}function KE(n,e){return Array.isArray(n)?n.map(t=>JE(t,e)).filter(t=>t!==""):JE(n,e)}function JE(n,e){return typeof n=="string"?sn.isLink(n)?sn.parseLink(n):Vu(n)?sn.urlToLink(new URL(n)):n:Xg(n,e)}var bp=class{constructor(e){this.plugin=e}resolveFilePath(e,t){let r=sn.isLink(e)?sn.parseLink(e).target:e,i=this.plugin.internal.getFilePathByName(r,t);if(i===void 0)throw new wa({errorLevel:"ERROR",cause:"file not found",effect:`could not resolve path or link "${e}" relative to "${t}"`});return i}createDefaultButtonConfig(){return{label:"This is a button",icon:"",hidden:!1,class:"",tooltip:"",id:"",style:"default",actions:[]}}async runButtonAction(e,t,r,i){try{if(e.action)await this.plugin.api.buttonActionRunner.runAction(e,e.action,t,r,i);else if(e.actions)for(let a of e.actions)await this.plugin.api.buttonActionRunner.runAction(e,a,t,r,i);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(a){console.warn("meta-bind | ButtonMDRC >> error while running action",a),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:"",args:{}};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:""};if(e==="createNote")return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0};if(e==="replaceInNote")return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text"};if(e==="replaceSelf")return{type:"replaceSelf",replacement:"Replacement text"};if(e==="regexpReplaceInNote")return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text"};if(e==="insertIntoNote")return{type:"insertIntoNote",line:0,value:"Some text"};if(e==="inlineJS")return{type:"inlineJS",code:'console.log("Hello world")'};throw new Error(`Unknown button action type: ${e}`)}async runAction(e,t,r,i,a){if(t.type==="command"){await this.runCommandAction(t);return}else if(t.type==="js"){await this.runJSAction(e,t,r);return}else if(t.type==="open"){await this.runOpenAction(t,r);return}else if(t.type==="input"){await this.runInputAction(t);return}else if(t.type==="sleep"){await this.runSleepAction(t);return}else if(t.type==="templaterCreateNote"){await this.runTemplaterCreateNoteAction(t);return}else if(t.type==="updateMetadata"){await this.runUpdateMetadataAction(t,r);return}else if(t.type==="createNote"){await this.runCreateNoteAction(t);return}else if(t.type==="replaceInNote"){await this.runReplaceInNoteAction(t,r);return}else if(t.type==="replaceSelf"){await this.runReplaceSelfAction(t,r,i,a);return}else if(t.type==="regexpReplaceInNote"){await this.runRegexpReplaceInNotAction(t,r);return}else if(t.type==="insertIntoNote"){await this.runInsertIntoNoteAction(t,r);return}else if(t.type==="inlineJS"){await this.runInlineJsAction(e,t,r);return}throw new Error("Unknown button action type")}async runCommandAction(e){this.plugin.internal.executeCommandById(e.command)}async runJSAction(e,t,r){let i={buttonConfig:structuredClone(e),args:structuredClone(t.args)};(await this.plugin.internal.jsEngineRunFile(t.file,r,i))()}async runOpenAction(e,t){let r=sn.parseLinkOrUrl(e.link);r.internal?this.plugin.internal.openFile(r.target,t,e.newTab??!1):Yf(r.target)}async runInputAction(e){let t=document.activeElement;t&&t instanceof HTMLInputElement&&(t.setRangeText(e.str,t.selectionStart,t.selectionEnd,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})))}async runSleepAction(e){await new Promise(t=>setTimeout(t,e.ms))}async runTemplaterCreateNoteAction(e){await this.plugin.internal.createNoteWithTemplater(e.templateFile,e.folderPath,e.fileName,e.openNote)}async runUpdateMetadataAction(e,t){let r=this.plugin.api.bindTargetParser.fromStringAndValidate(e.bindTarget,t);if(e.evaluate){let i=new Function("x",`return ${e.value};`);this.plugin.api.updateMetadata(r,i)}else this.plugin.api.setMetadata(r,Vi(e.value))}async runCreateNoteAction(e){await this.plugin.internal.createFile(e.folderPath??"",e.fileName,"md",e.openNote??!1)}async runReplaceInNoteAction(e,t){if(e.fromLine>e.toLine)throw new Error("From line cannot be greater than to line");let i=(await this.plugin.internal.readFilePath(t)).split(`
`);if(e.fromLine<0||e.toLine>i.length+1)throw new Error("Line numbers out of bounds");let a=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;i=[...i.slice(0,e.fromLine-1),a,...i.slice(e.toLine)],await this.plugin.internal.writeFilePath(t,i.join(`
`))}async runReplaceSelfAction(e,t,r,i){if(r)throw new Error("Replace self action not supported for inline buttons");let a=i?.getPosition();if(a===void 0)throw new Error("Position of the button in the note is unknown");if(a.lineStart>a.lineEnd)throw new Error("Position of the button in the note is invalid");let u=(await this.plugin.internal.readFilePath(t)).split(`
`);if(a.lineStart<0||a.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");let s=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;u=[...u.slice(0,a.lineStart),s,...u.slice(a.lineEnd+1)],await this.plugin.internal.writeFilePath(t,u.join(`
`))}async runRegexpReplaceInNotAction(e,t){if(e.regexp==="")throw new Error("Regexp cannot be empty");let r=await this.plugin.internal.readFilePath(t);r=r.replace(new RegExp(e.regexp,"g"),e.replacement),await this.plugin.internal.writeFilePath(t,r)}async runInsertIntoNoteAction(e,t){let i=(await this.plugin.internal.readFilePath(t)).split(`
`);if(e.line<1||e.line>i.length+1)throw new Error("Line number out of bounds");let a=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.value),t):e.value;i=[...i.slice(0,e.line-1),a,...i.slice(e.line-1)],await this.plugin.internal.writeFilePath(t,i.join(`
`))}async runInlineJsAction(e,t,r){let i={buttonConfig:structuredClone(e)};(await this.plugin.internal.jsEngineRunCode(t.code,r,i))()}};var Zn=class{constructor(){this.mounted=!1,this.targetEl=void 0,this.onUnmountCbs=[]}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);for(let e of this.onUnmountCbs)e();this.targetEl=void 0}registerUnmountCb(e){this.onUnmountCbs.push(e)}};var An=class extends Zn{constructor(e,t,r){super(),this.plugin=e,this.filePath=r,this.uuid=t}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.plugin.mountableManager.registerMountable(this)}onUnmount(e){this.plugin.mountableManager.unregisterMountable(this)}};function Ke(){}function Oz(n,e){for(let t in e)n[t]=e[t];return n}function Qg(n){return n()}function _p(){return Object.create(null)}function Ft(n){n.forEach(Qg)}function Hs(n){return typeof n=="function"}function ke(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}var wp;function na(n,e){return n===e?!0:(wp||(wp=document.createElement("a")),wp.href=e,n===wp.href)}function eD(n){return Object.keys(n).length===0}function Aa(n,e,t,r){if(n){let i=tD(n,e,t,r);return n[0](i)}}function tD(n,e,t,r){return n[1]&&r?Oz(t.ctx.slice(),n[1](r(e))):t.ctx}function Ma(n,e,t,r){if(n[2]&&r){let i=n[2](r(t));if(e.dirty===void 0)return i;if(typeof i=="object"){let a=[],o=Math.max(e.dirty.length,i.length);for(let u=0;u<o;u+=1)a[u]=e.dirty[u]|i[u];return a}return e.dirty|i}return e.dirty}function Ea(n,e,t,r,i,a){if(i){let o=tD(e,t,r,a);n.p(o,i)}}function Da(n){if(n.ctx.length>32){let e=[],t=n.ctx.length/32;for(let r=0;r<t;r++)e[r]=-1;return e}return-1}var gc=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;var Sp=class n{_listeners="WeakMap"in gc?new WeakMap:void 0;_observer=void 0;options;constructor(e){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(){return this._observer??(this._observer=new ResizeObserver(e=>{for(let t of e)n.entries.set(t.target,t),this._listeners.get(t.target)?.(t)}))}};Sp.entries="WeakMap"in gc?new WeakMap:void 0;var rD=!1;function nD(){rD=!0}function iD(){rD=!1}function K(n,e){n.appendChild(e)}function ia(n,e,t){let r=aD(n);if(!r.getElementById(e)){let i=ee("style");i.id=e,i.textContent=t,Vz(r,i)}}function aD(n){if(!n)return document;let e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function Vz(n,e){return K(n.head||n,e),e.sheet}function J(n,e,t){n.insertBefore(e,t||null)}function Y(n){n.parentNode&&n.parentNode.removeChild(n)}function Qt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function ee(n){return document.createElement(n)}function Ui(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function He(n){return document.createTextNode(n)}function fe(){return He(" ")}function Er(){return He("")}function Fe(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function q(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Jn(n){return n===""?null:+n}function oD(n){return Array.from(n.childNodes)}function yt(n,e){e=""+e,n.data!==e&&(n.data=e)}function je(n,e){n.value=e??""}function xo(n,e,t,r){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,r?"important":"")}function Jo(n,e,t){for(let r=0;r<n.options.length;r+=1){let i=n.options[r];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(n.selectedIndex=-1)}function vc(n){let e=n.querySelector(":checked");return e&&e.__value}function Yt(n,e,t){n.classList.toggle(e,!!t)}function Ap(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function sD(n){let e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Xo;function wo(n){Xo=n}function Mp(){if(!Xo)throw new Error("Function called outside component initialization");return Xo}function qi(n){Mp().$$.on_mount.push(n)}function Gs(n){Mp().$$.on_destroy.push(n)}function Ws(){let n=Mp();return(e,t,{cancelable:r=!1}={})=>{let i=n.$$.callbacks[e];if(i){let a=Ap(e,t,{cancelable:r});return i.slice().forEach(o=>{o.call(n,a)}),!a.defaultPrevented}return!0}}function uD(n,e){let t=n.$$.callbacks[e.type];t&&t.slice().forEach(r=>r.call(this,e))}var Ys=[];var Pr=[],Xu=[],ev=[],Gz=Promise.resolve(),tv=!1;function lD(){tv||(tv=!0,Gz.then(Ep))}function Ga(n){Xu.push(n)}function Xn(n){ev.push(n)}var Kg=new Set,Ju=0;function Ep(){if(Ju!==0)return;let n=Xo;do{try{for(;Ju<Ys.length;){let e=Ys[Ju];Ju++,wo(e),Wz(e.$$)}}catch(e){throw Ys.length=0,Ju=0,e}for(wo(null),Ys.length=0,Ju=0;Pr.length;)Pr.pop()();for(let e=0;e<Xu.length;e+=1){let t=Xu[e];Kg.has(t)||(Kg.add(t),t())}Xu.length=0}while(Ys.length);for(;ev.length;)ev.pop()();tv=!1,Kg.clear(),wo(n)}function Wz(n){if(n.fragment!==null){n.update(),Ft(n.before_update);let e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Ga)}}function cD(n){let e=[],t=[];Xu.forEach(r=>n.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),Xu=e}var Dp=new Set,js;function bt(){js={r:0,c:[],p:js}}function xt(){js.r||Ft(js.c),js=js.p}function j(n,e){n&&n.i&&(Dp.delete(n),n.i(e))}function ne(n,e,t,r){if(n&&n.o){if(Dp.has(n))return;Dp.add(n),js.c.push(()=>{Dp.delete(n),r&&(t&&n.d(1),r())}),n.o(e)}else r&&r()}function ct(n){return n?.length!==void 0?n:Array.from(n)}function fD(n,e){n.d(1),e.delete(n.key)}function Np(n,e){ne(n,1,1,()=>{e.delete(n.key)})}function Qu(n,e,t,r,i,a,o,u,s,l,c,f){let p=n.length,m=a.length,h=p,d={};for(;h--;)d[n[h].key]=h;let v=[],y=new Map,S=new Map,b=[];for(h=m;h--;){let D=f(i,a,h),E=t(D),_=o.get(E);_?r&&b.push(()=>_.p(D,e)):(_=l(E,D),_.c()),y.set(E,v[h]=_),E in d&&S.set(E,Math.abs(h-d[E]))}let w=new Set,A=new Set;function x(D){j(D,1),D.m(u,c),o.set(D.key,D),c=D.first,m--}for(;p&&m;){let D=v[m-1],E=n[p-1],_=D.key,N=E.key;D===E?(c=D.first,p--,m--):y.has(N)?!o.has(_)||w.has(_)?x(D):A.has(N)?p--:S.get(_)>S.get(N)?(A.add(_),x(D)):(w.add(N),p--):(s(E,o),p--)}for(;p--;){let D=n[p];y.has(D.key)||s(D,o)}for(;m;)x(v[m-1]);return Ft(b),v}var Yz=["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"],jz=new Set([...Yz]);function Qn(n,e,t){let r=n.$$.props[e];r!==void 0&&(n.$$.bound[r]=t,t(n.$$.ctx[r]))}function xe(n){n&&n.c()}function ye(n,e,t){let{fragment:r,after_update:i}=n.$$;r&&r.m(e,t),Ga(()=>{let a=n.$$.on_mount.map(Qg).filter(Hs);n.$$.on_destroy?n.$$.on_destroy.push(...a):Ft(a),n.$$.on_mount=[]}),i.forEach(Ga)}function be(n,e){let t=n.$$;t.fragment!==null&&(cD(t.after_update),Ft(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Jz(n,e){n.$$.dirty[0]===-1&&(Ys.push(n),lD(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Be(n,e,t,r,i,a,o=null,u=[-1]){let s=Xo;wo(n);let l=n.$$={fragment:null,ctx:[],props:a,update:Ke,not_equal:i,bound:_p(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(s?s.$$.context:[])),callbacks:_p(),dirty:u,skip_bound:!1,root:e.target||s.$$.root};o&&o(l.root);let c=!1;if(l.ctx=t?t(n,e.props||{},(f,p,...m)=>{let h=m.length?m[0]:p;return l.ctx&&i(l.ctx[f],l.ctx[f]=h)&&(!l.skip_bound&&l.bound[f]&&l.bound[f](h),c&&Jz(n,f)),p}):[],l.update(),c=!0,Ft(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){nD();let f=oD(e.target);l.fragment&&l.fragment.l(f),f.forEach(Y)}else l.fragment&&l.fragment.c();e.intro&&j(n.$$.fragment),ye(n,e.target,e.anchor),iD(),Ep()}wo(s)}var Xz;typeof HTMLElement=="function"&&(Xz=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(n,e,t){super(),this.$$ctor=n,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(n,e,t){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(e),this.$$c){let r=this.$$c.$on(n,e);this.$$l_u.set(e,r)}super.addEventListener(n,e,t)}removeEventListener(n,e,t){if(super.removeEventListener(n,e,t),this.$$c){let r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return()=>{let a;return{c:function(){a=ee("slot"),i!=="default"&&q(a,"name",i)},m:function(s,l){J(s,a,l)},d:function(s){s&&Y(a)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},t=sD(this);for(let i of this.$$s)i in t&&(e[i]=[n(i)]);for(let i of this.attributes){let a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=rv(a,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){let a=rv(i,this.$$d[i],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,a)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let i in this.$$l)for(let a of this.$$l[i]){let o=this.$$c.$on(i,a);this.$$l_u.set(a,o)}this.$$l={}}}attributeChangedCallback(n,e,t){this.$$r||(n=this.$$g_p(n),this.$$d[n]=rv(n,t,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(n){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===n||!this.$$p_d[e].attribute&&e.toLowerCase()===n)||n}});function rv(n,e,t,r){let i=t[n]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;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 Pe=class{$$=void 0;$$set=void 0;$destroy(){be(this,1),this.$destroy=Ke}$on(e,t){if(!Hs(t))return Ke;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!eD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var pD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(pD);function mD(n){let e;return{c(){e=ee("div"),q(e,"class","mb-icon-wrapper")},m(t,r){J(t,e,r),n[3](e)},p:Ke,d(t){t&&Y(e),n[3](null)}}}function Qz(n){let e,t=n[0].length>0&&mD(n);return{c(){t&&t.c(),e=Er()},m(r,i){t&&t.m(r,i),J(r,e,i)},p(r,[i]){r[0].length>0?t?t.p(r,i):(t=mD(r),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Ke,o:Ke,d(r){r&&Y(e),t&&t.d(r)}}}function Kz(n,e,t){let{iconName:r=""}=e,{plugin:i}=e,a;qi(()=>{i.internal.setIcon(a,r)});function o(u){Pr[u?"unshift":"push"](()=>{a=u,t(1,a)})}return n.$$set=u=>{"iconName"in u&&t(0,r=u.iconName),"plugin"in u&&t(2,i=u.plugin)},[r,a,i,o]}var nv=class extends Pe{constructor(e){super(),Be(this,e,Kz,Qz,ke,{iconName:0,plugin:2})}},qr=nv;function e$(n){ia(n,"svelte-i3s6h2","button.svelte-i3s6h2{gap:var(--size-4-2)}.mod-plain.svelte-i3s6h2{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-i3s6h2:hover{color:var(--text-normal)}.disabled.svelte-i3s6h2{opacity:0.6}")}function dD(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:n[5]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),i&32&&(a.iconName=r[5]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function t$(n){let e,t,r,i,a,o,u=n[5]&&dD(n);return{c(){e=ee("button"),u&&u.c(),t=fe(),r=He(n[4]),q(e,"class","mb-button-inner svelte-i3s6h2"),q(e,"aria-label",n[3]),e.disabled=n[0],Yt(e,"mod-cta",n[2]==="primary"),Yt(e,"mod-warning",n[2]==="destructive"),Yt(e,"mod-plain",n[2]==="plain"),Yt(e,"disabled",n[0]),Yt(e,"mb-error",n[6])},m(s,l){J(s,e,l),u&&u.m(e,null),K(e,t),K(e,r),i=!0,a||(o=Fe(e,"click",n[9]),a=!0)},p(s,[l]){s[5]?u?(u.p(s,l),l&32&&j(u,1)):(u=dD(s),u.c(),j(u,1),u.m(e,t)):u&&(bt(),ne(u,1,1,()=>{u=null}),xt()),(!i||l&16)&&yt(r,s[4]),(!i||l&8)&&q(e,"aria-label",s[3]),(!i||l&1)&&(e.disabled=s[0]),(!i||l&4)&&Yt(e,"mod-cta",s[2]==="primary"),(!i||l&4)&&Yt(e,"mod-warning",s[2]==="destructive"),(!i||l&4)&&Yt(e,"mod-plain",s[2]==="plain"),(!i||l&1)&&Yt(e,"disabled",s[0]),(!i||l&64)&&Yt(e,"mb-error",s[6])},i(s){i||(j(u),i=!0)},o(s){ne(u),i=!1},d(s){s&&Y(e),u&&u.d(),a=!1,o()}}}function r$(n,e,t){let{plugin:r}=e,{variant:i="default"}=e,{disabled:a=!1}=e,{tooltip:o=""}=e,{label:u=""}=e,{icon:s=""}=e,{error:l=!1}=e,{onClick:c=async()=>{}}=e;async function f(){if(!a){t(0,a=!0);try{await c()}catch(m){console.warn("failed to run button component on click",m)}finally{t(0,a=!1)}}}let p=()=>f();return n.$$set=m=>{"plugin"in m&&t(1,r=m.plugin),"variant"in m&&t(2,i=m.variant),"disabled"in m&&t(0,a=m.disabled),"tooltip"in m&&t(3,o=m.tooltip),"label"in m&&t(4,u=m.label),"icon"in m&&t(5,s=m.icon),"error"in m&&t(6,l=m.error),"onClick"in m&&t(8,c=m.onClick)},[a,r,i,o,u,s,l,f,c,p]}var iv=class extends Pe{constructor(e){super(),Be(this,e,r$,t$,ke,{plugin:1,variant:2,disabled:0,tooltip:3,label:4,icon:5,error:6,onClick:8},e$)}},Tp=iv;var Qo=class extends Zn{constructor(e,t,r,i,a,o){super(),this.plugin=e,this.config=t,this.filePath=r,this.inline=i==="inline",this.position=a,this.isPreview=o}onMount(e){mt.empty(e),mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.inline?"mb-button-inline":"mb-button-block"]),!(!this.inline&&!this.isPreview&&(this.config.id&&this.plugin.api.buttonManager.addButton(this.filePath,this.config),this.config.hidden))&&(this.config.class&&mt.addClasses(e,this.config.class.split(" ").filter(t=>t!=="")),this.buttonComponent=new Tp({target:e,props:{plugin:this.plugin,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:yE(this.config.tooltip)?this.config.tooltip:this.config.label,onClick:async()=>{await this.plugin.api.buttonActionRunner.runButtonAction(this.config,this.filePath,this.inline,this.position)}}}))}onUnmount(){this.buttonComponent?.$destroy(),!this.inline&&!this.isPreview&&this.config?.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var Gt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof wn?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 Cp=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new Gt(this.getUuid())}onMount(e){if(console.debug("meta-bind | ButtonMountable >> mount",this.declaration.declarationString),super.onMount(e),mt.removeAllClasses(e),!this.declaration.config||!this.declaration.errorCollection.isEmpty()){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.declaration.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.declaration.declarationString});return}this.buttonField=new Qo(this.plugin,this.declaration.config,this.getFilePath(),"block",this.position,this.isPreview),this.buttonField.mount(e)}onUnmount(e){console.debug("meta-bind | ButtonMountable >> destroy",this.declaration.declarationString),super.onUnmount(e),this.buttonField?.unmount(),Wn(e,"button")}};var Fp=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 Ip=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let t=new Set,r=new Gt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?r.add(new vo({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)?r.add(new vo({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 r.hasErrors()&&this.buttonTemplates.clear(),r}registerButtonLoadListener(e,t,r){let i=this.getButton(e,t);i&&r(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),u=Ir();return o.set(u,r),()=>this.removeButtonLoadListener(e,t,u)}notifyButtonLoadListeners(e,t){let r=this.getButton(e,t);if(!r)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,u]of a)u(r)}removeButtonLoadListener(e,t,r){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(r),a.size===0&&i.delete(t),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){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),this.buttons.get(e).set(t.id,new Fp(t)),this.notifyButtonLoadListeners(e,t.id)}getButton(e,t){if(this.buttonTemplates.has(t))return this.buttonTemplates.get(t);let r=this.buttons.get(e);if(r)return r.get(t)?.getValue()}removeButton(e,t){let r=this.buttons.get(e);r&&(r.get(t)?.decrement(),r.get(t)?.isEmpty()&&r.delete(t),r.size===0&&this.buttons.delete(e))}};var Pp=class extends Zn{constructor(e,t,r,i,a){super(),this.plugin=e,this.referencedIds=t,this.filePath=r,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,t){return mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),new Tp({target:e,props:{plugin:this.plugin,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${t}' found`,error:!0,onClick:async()=>{}}})}onMount(e){mt.empty(e),mt.addClasses(e,["mb-button-group",this.renderChildType==="inline"?"mb-button-group-inline":"mb-button-group-block"]);for(let t of this.referencedIds){let r=mt.createElement(e,"span"),i=this.renderInitialButton(r,t),a,o=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,t,u=>{i?.$destroy(),a=new Qo(this.plugin,u,this.filePath,this.renderChildType,this.notePosition,!1),a.mount(r)});this.registerUnmountCb(()=>{i?.$destroy(),a?.unmount(),o()})}}onUnmount(e){mt.empty(e)}};var kp=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.declaration=i,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(console.debug("meta-bind | ButtonGroupMountable >> mount",this.declaration),super.onMount(e),mt.removeAllClasses(e),!this.declaration.errorCollection.isEmpty()){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.declaration.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.declaration.declarationString});return}this.buttonField=new Pp(this.plugin,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}onUnmount(e){console.debug("meta-bind | ButtonGroupMountable >> destroy",this.declaration),super.onUnmount(e),this.buttonField?.unmount(),Wn(e,"inline button")}};var qt=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){Yf(e)}};var Ku=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Gt(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 Ut({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=mt.createElement(e,"div");mt.addClass(t,"mb-card");let r=this.getArgument("title");return r&&mt.createElement(t,"h3",{text:r.value}),t}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let r=mt.createElement(e,"code",{class:"mb-none"}),i=mt.createElement(r,"a",{text:this.declarationString,class:"mb-no-link"});i.href=qt.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 Ut({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){if(console.debug("meta-bind | InputFieldMountable >> mount",this.declaration),super.onMount(e),mt.empty(e),mt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=this.createContainer(e);this.createErrorIndicator(t);let r=mt.createElement(t,"div",{class:"mb-input-wrapper"});this.inputField?.mount(r);let i=this.getArguments("class");for(let a of i)mt.addClasses(r,a.value);mt.addClass(r,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-input-block"):mt.addClass(e,"mb-input-inline"),this.addShowcase(t)}onUnmount(e){console.debug("meta-bind | InputFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.inputField?.destroy(),Wn(e,"input field")}};var el=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=Ir(),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)try{t.callback(e)}catch(r){let i=r instanceof Error?r:String(r);console.error(new Ut({errorLevel:"ERROR",effect:"error while calling listener callback",cause:i}))}}},Lr=class extends el{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},Bp=class extends el{constructor(e,t){super(),this.dependency=e,this.value=t(e.get()),this.dependencyListener=e.registerListener({callback:r=>this.set(t(r))})}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};var Op=class extends el{constructor(e,t){super(),this.plugin=e,this.mounted=!1,this.svelteComponent=t}setValue(e){this.svelteComponentInstance?.setValue(e)}mount(e,t,r={}){let i=Object.assign({plugin:this.plugin,value:t,onValueChange:a=>{this.notifyListeners(a)}},r);this.svelteComponentInstance=new this.svelteComponent({target:e,props:i}),this.mounted=!0}unmount(){this.unregisterAllListeners(),this.svelteComponentInstance?.$destroy(),this.mounted=!1}isMounted(){return this.mounted}};var rr=class extends Zn{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Lr(void 0),this.inputFieldComponent=new Op(this.plugin,this.getSvelteComponent()),this.computedSignal=new Bp(this.inputSignal,t=>{let r=this.filterValue(t);return r!==void 0?r:this.getDefaultValue()})}destroy(){this.inputFieldComponent.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let r=this.rawReverseMapValue(this.getDefaultValue());return r!==void 0?r: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){this.metadataSubscription?.update(e)}getDefaultValue(){let e=this.mountable.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.inputSignal.set(this.inputSignal.get()),this.computedSignal.registerListener({callback:r=>this.inputFieldComponent.setValue(this.reverseMapValue(r))});let t=this.mountable.getBindTarget();t&&(this.inputFieldComponent.registerListener({callback:r=>{this.notifySubscription(this.mapValue(r))}}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,t,()=>this.mountable.unmount())),this.inputFieldComponent.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.computedSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.inputFieldComponent.unmount()}};function n$(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","date")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function i$(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var av=class extends Pe{constructor(e){super(),Be(this,e,i$,n$,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},hD=av;var Rp=class extends rr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return Yn.stringify(Yn.getDefaultDate())}getSvelteComponent(){return hD}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function a$(n){let e,t,r=(n[0]?n[0].format(n[2]):"none")+"",i,a,o,u,s,l;return o=new qr({props:{plugin:n[1],iconName:"calendar"}}),{c(){e=ee("div"),t=ee("span"),i=He(r),a=fe(),xe(o.$$.fragment),q(t,"class","date-picker-text"),q(e,"class","date-picker-input"),q(e,"role","button"),q(e,"tabindex","0")},m(c,f){J(c,e,f),K(e,t),K(t,i),K(e,a),ye(o,e,null),u=!0,s||(l=[Fe(e,"click",n[3]),Fe(e,"keydown",n[4])],s=!0)},p(c,[f]){(!u||f&5)&&r!==(r=(c[0]?c[0].format(c[2]):"none")+"")&&yt(i,r);let p={};f&2&&(p.plugin=c[1]),o.$set(p)},i(c){u||(j(o.$$.fragment,c),u=!0)},o(c){ne(o.$$.fragment,c),u=!1},d(c){c&&Y(e),be(o),s=!1,Ft(l)}}}function o$(n,e,t){let{plugin:r}=e,{value:i}=e,{dateFormat:a}=e,{showDatePicker:o}=e,{onValueChange:u}=e;function s(f){t(0,i=f)}function l(f){o()}function c(f){f.key===" "&&o()}return n.$$set=f=>{"plugin"in f&&t(1,r=f.plugin),"value"in f&&t(0,i=f.value),"dateFormat"in f&&t(2,a=f.dateFormat),"showDatePicker"in f&&t(5,o=f.showDatePicker),"onValueChange"in f&&t(6,u=f.onValueChange)},[i,r,a,l,c,o,u,s]}var ov=class extends Pe{constructor(e){super(),Be(this,e,o$,a$,ke,{plugin:1,value:0,dateFormat:2,showDatePicker:5,onValueChange:6,setValue:7})}get setValue(){return this.$$.ctx[7]}},gD=ov;var Lp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!="string")return;let t=Yn.parse(e);if(t.isValid())return Yn.stringify(t)}getFallbackDefaultValue(){return Yn.getDefaultDate()}getSvelteComponent(){return gD}rawMapValue(e){return e===null?null:Yn.stringify(e)}rawReverseMapValue(e){if(e===null)return null;let t=Yn.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.mountable.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.mountable.plugin.internal.openDatePickerModal(this)}}}};function s$(n){ia(n,"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 u$(n){let e,t,r,i,a,o;return{c(){e=ee("div"),t=ee("textarea"),r=fe(),i=ee("div"),q(t,"class","svelte-1tfnqy0"),q(i,"class","svelte-1tfnqy0"),q(e,"class","editor-input card svelte-1tfnqy0"),q(e,"role","button"),q(e,"tabindex","0")},m(u,s){J(u,e,s),K(e,t),n[10](t),je(t,n[0]),K(e,r),K(e,i),n[14](i),a||(o=[Fe(t,"input",n[11]),Fe(t,"focusout",n[12]),Fe(t,"input",n[13]),Fe(e,"click",n[15]),Fe(e,"keypress",n[16])],a=!0)},p(u,[s]){s&1&&je(t,u[0])},i:Ke,o:Ke,d(u){u&&Y(e),n[10](null),n[14](null),a=!1,Ft(o)}}}function l$(n,e,t){let{plugin:r}=e,{value:i}=e,{onValueChange:a}=e,{render:o}=e,u,s;qi(()=>{t(2,u.style.display="block",u),t(3,s.style.display="none",s),o(u,i)});function l(w){t(0,i=w),o(u,w)}function c(){t(2,u.style.display="block",u),t(3,s.style.display="none",s),o(u,i)}function f(){t(2,u.style.display="none",u),t(3,s.style.display="block",s),s.focus()}function p(w){w.key===" "&&f()}function m(w){Pr[w?"unshift":"push"](()=>{s=w,t(3,s)})}function h(){i=this.value,t(0,i)}let d=()=>c(),v=()=>a(i);function y(w){Pr[w?"unshift":"push"](()=>{u=w,t(2,u)})}let S=()=>f(),b=w=>p(w);return n.$$set=w=>{"plugin"in w&&t(7,r=w.plugin),"value"in w&&t(0,i=w.value),"onValueChange"in w&&t(1,a=w.onValueChange),"render"in w&&t(8,o=w.render)},[i,a,u,s,c,f,p,r,o,l,m,h,d,v,y,S,b]}var sv=class extends Pe{constructor(e){super(),Be(this,e,l$,u$,ke,{plugin:7,value:0,onValueChange:1,render:8,setValue:9},s$)}get setValue(){return this.$$.ctx[9]}},vD=sv;var Vp=class extends rr{filterValue(e){return jo(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return vD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t)}}async renderInElement(e,t){this.mdUnloadCallback?.(),e.innerHTML="",this.mdUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};function c$(n){ia(n,"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 f$(n){let e,t,r,i,a=n[4].default,o=Aa(a,n,n[3],null);return{c(){e=ee("button"),o&&o.c(),q(e,"aria-label",n[2]),e.disabled=n[1],q(e,"class","svelte-12xcpmj"),Yt(e,"mod-cta",n[0]==="primary"),Yt(e,"mod-warning",n[0]==="destructive"),Yt(e,"mod-plain",n[0]==="plain"),Yt(e,"disabled",n[1])},m(u,s){J(u,e,s),o&&o.m(e,null),t=!0,r||(i=Fe(e,"click",n[5]),r=!0)},p(u,[s]){o&&o.p&&(!t||s&8)&&Ea(o,a,u,u[3],t?Ma(a,u[3],s,null):Da(u[3]),null),(!t||s&4)&&q(e,"aria-label",u[2]),(!t||s&2)&&(e.disabled=u[1]),(!t||s&1)&&Yt(e,"mod-cta",u[0]==="primary"),(!t||s&1)&&Yt(e,"mod-warning",u[0]==="destructive"),(!t||s&1)&&Yt(e,"mod-plain",u[0]==="plain"),(!t||s&2)&&Yt(e,"disabled",u[1])},i(u){t||(j(o,u),t=!0)},o(u){ne(o,u),t=!1},d(u){u&&Y(e),o&&o.d(u),r=!1,i()}}}function p$(n,e,t){let{$$slots:r={},$$scope:i}=e,{variant:a="default"}=e,{disabled:o=!1}=e,{tooltip:u=""}=e;function s(l){uD.call(this,n,l)}return n.$$set=l=>{"variant"in l&&t(0,a=l.variant),"disabled"in l&&t(1,o=l.disabled),"tooltip"in l&&t(2,u=l.tooltip),"$$scope"in l&&t(3,i=l.$$scope)},[a,o,u,i,r,s]}var uv=class extends Pe{constructor(e){super(),Be(this,e,p$,f$,ke,{variant:0,disabled:1,tooltip:2},c$)}},It=uv;function yD(n){let e,t;return{c(){e=ee("img"),q(e,"class","mb-image-card-image"),na(e.src,t=n[1].internal.imagePathToUri(n[0]))||q(e,"src",t),q(e,"alt",n[0])},m(r,i){J(r,e,i)},p(r,i){i&3&&!na(e.src,t=r[1].internal.imagePathToUri(r[0]))&&q(e,"src",t),i&1&&q(e,"alt",r[0])},d(r){r&&Y(e)}}}function m$(n){let e,t;return e=new qr({props:{iconName:"pencil",plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function d$(n){let e,t,r,i,a=(n[0]||"no image selected")+"",o,u,s,l,c=n[0]&&yD(n);return s=new It({props:{variant:"plain",$$slots:{default:[m$]},$$scope:{ctx:n}}}),s.$on("click",n[2]),{c(){e=ee("div"),c&&c.c(),t=fe(),r=ee("div"),i=ee("span"),o=He(a),u=fe(),xe(s.$$.fragment),q(r,"class","mb-image-card-footer"),q(e,"class","mb-image-card")},m(f,p){J(f,e,p),c&&c.m(e,null),K(e,t),K(e,r),K(r,i),K(i,o),K(r,u),ye(s,r,null),l=!0},p(f,[p]){f[0]?c?c.p(f,p):(c=yD(f),c.c(),c.m(e,t)):c&&(c.d(1),c=null),(!l||p&1)&&a!==(a=(f[0]||"no image selected")+"")&&yt(o,a);let m={};p&66&&(m.$$scope={dirty:p,ctx:f}),s.$set(m)},i(f){l||(j(s.$$.fragment,f),l=!0)},o(f){ne(s.$$.fragment,f),l=!1},d(f){f&&Y(e),c&&c.d(),be(s)}}}function h$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{onValueChange:o}=e;function u(l){t(0,i=l)}function s(l){a()}return n.$$set=l=>{"plugin"in l&&t(1,r=l.plugin),"value"in l&&t(0,i=l.value),"showSuggester"in l&&t(3,a=l.showSuggester),"onValueChange"in l&&t(4,o=l.onValueChange)},[i,r,s,a,o,u]}var lv=class extends Pe{constructor(e){super(),Be(this,e,h$,d$,ke,{plugin:1,value:0,showSuggester:3,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},bD=lv;var Up=class extends rr{filterValue(e){return jo(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return bD}rawMapValue(e){return e}rawReverseMapValue(e){return Sa(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};function g$(n){let e,t;return{c(){e=ee("a"),t=He(n[2]),q(e,"data-href",n[2]),q(e,"href",n[2]),q(e,"class",n[1]),q(e,"target","_blank"),q(e,"rel","noopener")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&4&&yt(t,r[2]),i&4&&q(e,"data-href",r[2]),i&4&&q(e,"href",r[2]),i&2&&q(e,"class",r[1])},d(r){r&&Y(e)}}}function v$(n){let e,t=n[0].alias+"",r;return{c(){e=ee("a"),r=He(t),q(e,"data-href",n[2]),q(e,"href",n[2]),q(e,"class",n[1]),q(e,"target","_blank"),q(e,"rel","noopener"),q(e,"aria-label",n[2])},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].alias+"")&&yt(r,t),a&4&&q(e,"data-href",i[2]),a&4&&q(e,"href",i[2]),a&2&&q(e,"class",i[1]),a&4&&q(e,"aria-label",i[2])},d(i){i&&Y(e)}}}function y$(n){let e;function t(a,o){return a[0].alias?v$:g$}let r=t(n,-1),i=r(n);return{c(){i.c(),e=Er()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Ke,o:Ke,d(a){a&&Y(e),i.d(a)}}}function b$(n,e,t){let r,i,{mdLink:a}=e;return n.$$set=o=>{"mdLink"in o&&t(0,a=o.mdLink)},n.$$.update=()=>{n.$$.dirty&1&&t(2,r=a.block?`${a.target}#${a.block}`:a.target),n.$$.dirty&1&&t(1,i=a.internal?"internal-link":"external-link")},[a,i,r]}var cv=class extends Pe{constructor(e){super(),Be(this,e,b$,y$,ke,{mdLink:0})}},Ko=cv;var x$=n=>({element:n&1}),xD=n=>({element:n[0][n[0].length-1]});function wD(n,e,t){let r=n.slice();return r[3]=e[t],r}var w$=n=>({element:n&1}),_D=n=>({element:n[3]});function SD(n){let e,t,r,i,a,o=n[2].default,u=Aa(o,n,n[1],_D);return{c(){u&&u.c(),e=fe(),t=ee("span"),t.textContent=",",r=fe(),i=ee("span")},m(s,l){u&&u.m(s,l),J(s,e,l),J(s,t,l),J(s,r,l),J(s,i,l),a=!0},p(s,l){u&&u.p&&(!a||l&3)&&Ea(u,o,s,s[1],a?Ma(o,s[1],l,w$):Da(s[1]),_D)},i(s){a||(j(u,s),a=!0)},o(s){ne(u,s),a=!1},d(s){s&&(Y(e),Y(t),Y(r),Y(i)),u&&u.d(s)}}}function _$(n){let e,t,r=ct(n[0].slice(0,n[0].length-1)),i=[];for(let s=0;s<r.length;s+=1)i[s]=SD(wD(n,r,s));let a=s=>ne(i[s],1,1,()=>{i[s]=null}),o=n[2].default,u=Aa(o,n,n[1],xD);return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=fe(),u&&u.c()},m(s,l){for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(s,l);J(s,e,l),u&&u.m(s,l),t=!0},p(s,[l]){if(l&3){r=ct(s[0].slice(0,s[0].length-1));let c;for(c=0;c<r.length;c+=1){let f=wD(s,r,c);i[c]?(i[c].p(f,l),j(i[c],1)):(i[c]=SD(f),i[c].c(),j(i[c],1),i[c].m(e.parentNode,e))}for(bt(),c=r.length;c<i.length;c+=1)a(c);xt()}u&&u.p&&(!t||l&3)&&Ea(u,o,s,s[1],t?Ma(o,s[1],l,x$):Da(s[1]),xD)},i(s){if(!t){for(let l=0;l<r.length;l+=1)j(i[l]);j(u,s),t=!0}},o(s){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)ne(i[l]);ne(u,s),t=!1},d(s){s&&Y(e),Qt(i,s),u&&u.d(s)}}}function S$(n,e,t){let{$$slots:r={},$$scope:i}=e,{elements:a=[]}=e;return n.$$set=o=>{"elements"in o&&t(0,a=o.elements),"$$scope"in o&&t(1,i=o.$$scope)},[a,i,r]}var fv=class extends Pe{constructor(e){super(),Be(this,e,S$,_$,ke,{elements:0})}},qp=fv;function A$(n){let e,t,r;return t=new Ko({props:{mdLink:n[0]}}),{c(){e=ee("span"),xe(t.$$.fragment)},m(i,a){J(i,e,a),ye(t,e,null),r=!0},p(i,a){let o={};a&1&&(o.mdLink=i[0]),t.$set(o)},i(i){r||(j(t.$$.fragment,i),r=!0)},o(i){ne(t.$$.fragment,i),r=!1},d(i){i&&Y(e),be(t)}}}function M$(n){let e,t,r;return t=new qp({props:{elements:n[0],$$slots:{default:[T$,({element:i})=>({2:i}),({element:i})=>i?4:0]},$$scope:{ctx:n}}}),{c(){e=ee("span"),xe(t.$$.fragment)},m(i,a){J(i,e,a),ye(t,e,null),r=!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){r||(j(t.$$.fragment,i),r=!0)},o(i){ne(t.$$.fragment,i),r=!1},d(i){i&&Y(e),be(t)}}}function E$(n){let e,t;return{c(){e=ee("span"),t=He(n[0]),xo(e,"white-space","pre")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&1&&yt(t,r[0])},i:Ke,o:Ke,d(r){r&&Y(e)}}}function D$(n){let e,t;return e=new Ko({props:{mdLink:n[2]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&4&&(a.mdLink=r[2]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function N$(n){let e,t=n[2]+"",r;return{c(){e=ee("span"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&4&&t!==(t=i[2]+"")&&yt(r,t)},i:Ke,o:Ke,d(i){i&&Y(e)}}}function T$(n){let e,t,r,i,a=[N$,D$],o=[];function u(s,l){return typeof s[2]=="string"?0:1}return e=u(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=Er()},m(s,l){o[e].m(s,l),J(s,r,l),i=!0},p(s,l){let c=e;e=u(s,l),e===c?o[e].p(s,l):(bt(),ne(o[c],1,1,()=>{o[c]=null}),xt(),t=o[e],t?t.p(s,l):(t=o[e]=a[e](s),t.c()),j(t,1),t.m(r.parentNode,r))},i(s){i||(j(t),i=!0)},o(s){ne(t),i=!1},d(s){s&&Y(r),o[e].d(s)}}}function C$(n){let e,t,r,i,a,o=[E$,M$,A$],u=[];function s(l,c){return c&1&&(e=null),typeof l[0]=="string"?0:(e==null&&(e=!!Array.isArray(l[0])),e?1:2)}return t=s(n,-1),r=u[t]=o[t](n),{c(){r.c(),i=Er()},m(l,c){u[t].m(l,c),J(l,i,c),a=!0},p(l,[c]){let f=t;t=s(l,c),t===f?u[t].p(l,c):(bt(),ne(u[f],1,1,()=>{u[f]=null}),xt(),r=u[t],r?r.p(l,c):(r=u[t]=o[t](l),r.c()),j(r,1),r.m(i.parentNode,i))},i(l){a||(j(r),a=!0)},o(l){ne(r),a=!1},d(l){l&&Y(i),u[t].d(l)}}}function F$(n,e,t){let{value:r=void 0}=e,i;return n.$$set=a=>{"value"in a&&t(1,r=a.value)},n.$$.update=()=>{n.$$.dirty&2&&t(0,i=KE(r,!1))},[i,r]}var pv=class extends Pe{constructor(e){super(),Be(this,e,F$,C$,ke,{value:1})}},aa=pv;function AD(n,e,t){let r=n.slice();return r[11]=e[t],r[13]=t,r}function MD(n){let e,t,r,i,a;t=new aa({props:{value:n[11]}});function o(...u){return n[8](n[13],...u)}return{c(){e=ee("div"),xe(t.$$.fragment),q(e,"class","mb-inline-list-item"),q(e,"role","listitem")},m(u,s){J(u,e,s),ye(t,e,null),r=!0,i||(a=Fe(e,"contextmenu",o),i=!0)},p(u,s){n=u;let l={};s&1&&(l.value=n[11]),t.$set(l)},i(u){r||(j(t.$$.fragment,u),r=!0)},o(u){ne(t.$$.fragment,u),r=!1},d(u){u&&Y(e),be(t),i=!1,a()}}}function I$(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=MD(AD(n,c,m));let p=m=>ne(f[m],1,1,()=>{f[m]=null});return o=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){e=ee("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),r=ee("div"),i=ee("span"),i.textContent="\u200B",a=fe(),xe(o.$$.fragment),q(r,"class","mb-inline-list-add"),q(r,"role","button"),q(r,"tabindex","0"),q(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);K(e,t),K(e,r),K(r,i),K(r,a),ye(o,r,null),u=!0,s||(l=[Fe(r,"click",n[9]),Fe(r,"keydown",n[3])],s=!0)},p(m,[h]){if(h&17){c=ct(m[0]);let v;for(v=0;v<c.length;v+=1){let y=AD(m,c,v);f[v]?(f[v].p(y,h),j(f[v],1)):(f[v]=MD(y),f[v].c(),j(f[v],1),f[v].m(e,t))}for(bt(),v=c.length;v<f.length;v+=1)p(v);xt()}let d={};h&2&&(d.plugin=m[1]),o.$set(d)},i(m){if(!u){for(let h=0;h<c.length;h+=1)j(f[h]);j(o.$$.fragment,m),u=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)ne(f[h]);ne(o.$$.fragment,m),u=!1},d(m){m&&Y(e),Qt(f,m),be(o),s=!1,Ft(l)}}}function P$(n,e,t){let{plugin:r}=e,{value:i}=e,{showInput:a}=e,{onValueChange:o}=e;function u(h){t(0,i=h)}function s(h){i.push(h),t(0,i)}function l(h){i.splice(h,1),o(i),t(0,i)}function c(h){h.key===" "&&a()}function f(h,d){let v=[];d>0&&v.push({name:"Move left",icon:"arrow-left",onclick:()=>{let y=i[d-1];t(0,i[d-1]=i[d],i),t(0,i[d]=y,i),o(i)}}),d<i.length-1&&v.push({name:"Move right",icon:"arrow-right",onclick:()=>{let y=i[d+1];t(0,i[d+1]=i[d],i),t(0,i[d]=y,i),o(i)}}),v.push({name:"Edit",icon:"pencil",onclick:()=>{r.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:Sa(i[d]),multiline:!1,onSubmit:y=>{t(0,i[d]=y,i),o(i)},onCancel:()=>{}})}}),v.push({name:"Remove",icon:"x",warning:!0,onclick:()=>l(d)}),r.internal.createContextMenu(v).showWithEvent(h)}let p=(h,d)=>f(d,h),m=()=>a();return n.$$set=h=>{"plugin"in h&&t(1,r=h.plugin),"value"in h&&t(0,i=h.value),"showInput"in h&&t(2,a=h.showInput),"onValueChange"in h&&t(5,o=h.onValueChange)},[i,r,a,c,f,o,u,s,p,m]}var mv=class extends Pe{constructor(e){super(),Be(this,e,P$,I$,ke,{plugin:1,value:0,showInput:2,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},ED=mv;var zp=class extends rr{filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return ED}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function DD(n,e,t){let r=n.slice();return r[13]=e[t],r[15]=t,r}function ND(n){let e,t,r,i,a;t=new aa({props:{value:n[13]}});function o(...u){return n[11](n[15],...u)}return{c(){e=ee("div"),xe(t.$$.fragment),q(e,"class","mb-inline-list-item"),q(e,"role","listitem")},m(u,s){J(u,e,s),ye(t,e,null),r=!0,i||(a=Fe(e,"contextmenu",o),i=!0)},p(u,s){n=u;let l={};s&1&&(l.value=n[13]),t.$set(l)},i(u){r||(j(t.$$.fragment,u),r=!0)},o(u){ne(t.$$.fragment,u),r=!1},d(u){u&&Y(e),be(t),i=!1,a()}}}function k$(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=ND(DD(n,c,m));let p=m=>ne(f[m],1,1,()=>{f[m]=null});return o=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){e=ee("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),r=ee("div"),i=ee("span"),i.textContent="\u200B",a=fe(),xe(o.$$.fragment),q(r,"class","mb-inline-list-add"),q(r,"role","button"),q(r,"tabindex","0"),q(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);K(e,t),K(e,r),K(r,i),K(r,a),ye(o,r,null),u=!0,s||(l=[Fe(r,"click",n[2]),Fe(r,"keydown",n[3])],s=!0)},p(m,[h]){if(h&17){c=ct(m[0]);let v;for(v=0;v<c.length;v+=1){let y=DD(m,c,v);f[v]?(f[v].p(y,h),j(f[v],1)):(f[v]=ND(y),f[v].c(),j(f[v],1),f[v].m(e,t))}for(bt(),v=c.length;v<f.length;v+=1)p(v);xt()}let d={};h&2&&(d.plugin=m[1]),o.$set(d)},i(m){if(!u){for(let h=0;h<c.length;h+=1)j(f[h]);j(o.$$.fragment,m),u=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)ne(f[h]);ne(o.$$.fragment,m),u=!1},d(m){m&&Y(e),Qt(f,m),be(o),s=!1,Ft(l)}}}function B$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowsOther:u}=e,{onValueChange:s}=e;function l(v){t(0,i=v)}function c(v){i.push(v),t(0,i)}function f(v){i.splice(v,1),s(i),t(0,i)}function p(v){if(!u){a();return}r.internal.createContextMenu([{name:"From Options",onclick:()=>a()},{name:"From Text",onclick:()=>o()}]).showWithEvent(v)}function m(v){v.key===" "&&a()}function h(v,y){let S=[];y>0&&S.push({name:"Move left",icon:"arrow-left",onclick:()=>{let b=i[y-1];t(0,i[y-1]=i[y],i),t(0,i[y]=b,i),s(i)}}),y<i.length-1&&S.push({name:"Move right",icon:"arrow-right",onclick:()=>{let b=i[y+1];t(0,i[y+1]=i[y],i),t(0,i[y]=b,i),s(i)}}),S.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(y)}),r.internal.createContextMenu(S).showWithEvent(v)}let d=(v,y)=>h(y,v);return n.$$set=v=>{"plugin"in v&&t(1,r=v.plugin),"value"in v&&t(0,i=v.value),"showSuggester"in v&&t(5,a=v.showSuggester),"showTextPrompt"in v&&t(6,o=v.showTextPrompt),"allowsOther"in v&&t(7,u=v.allowsOther),"onValueChange"in v&&t(8,s=v.onValueChange)},[i,r,p,m,h,a,o,u,s,l,c,d]}var dv=class extends Pe{constructor(e){super(),Be(this,e,B$,k$,ke,{plugin:1,value:0,showSuggester:5,showTextPrompt:6,allowsOther:7,onValueChange:8,setValue:9,addValue:10})}get setValue(){return this.$$.ctx[9]}get addValue(){return this.$$.ctx[10]}},TD=dv;var $p=class extends rr{filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return TD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowsOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function CD(n,e,t){let r=n.slice();return r[8]=e[t],r}function FD(n){let e,t=n[8].name+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[8].value,je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&2&&t!==(t=a[8].name+"")&&yt(r,t),o&2&&i!==(i=a[8].value)&&(e.__value=i,je(e,e.__value))},d(a){a&&Y(e)}}}function O$(n){let e,t,r,i=ct(n[1]),a=[];for(let o=0;o<i.length;o+=1)a[o]=FD(CD(n,i,o));return{c(){e=ee("select");for(let o=0;o<a.length;o+=1)a[o].c();q(e,"class","dropdown"),n[0]===void 0&&Ga(()=>n[6].call(e))},m(o,u){J(o,e,u);for(let s=0;s<a.length;s+=1)a[s]&&a[s].m(e,null);Jo(e,n[0],!0),t||(r=[Fe(e,"change",n[6]),Fe(e,"change",n[7])],t=!0)},p(o,[u]){if(u&2){i=ct(o[1]);let s;for(s=0;s<i.length;s+=1){let l=CD(o,i,s);a[s]?a[s].p(l,u):(a[s]=FD(l),a[s].c(),a[s].m(e,null))}for(;s<a.length;s+=1)a[s].d(1);a.length=i.length}u&3&&Jo(e,o[0])},i:Ke,o:Ke,d(o){o&&Y(e),Qt(a,o),t=!1,Ft(r)}}}function R$(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(f){t(0,i=f)}function s(){o(i)}function l(){i=vc(this),t(0,i),t(1,a)}let c=()=>s();return n.$$set=f=>{"plugin"in f&&t(3,r=f.plugin),"value"in f&&t(0,i=f.value),"options"in f&&t(1,a=f.options),"onValueChange"in f&&t(4,o=f.onValueChange)},[i,a,s,r,o,u,l,c]}var hv=class extends Pe{constructor(e){super(),Be(this,e,R$,O$,ke,{plugin:3,value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},ID=hv;var Hp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Zo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return ID}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function PD(n,e,t){let r=n.slice();return r[16]=e[t],r[18]=t,r}function kD(n){let e;return{c(){e=ee("span"),e.textContent="Empty",q(e,"class","mb-list-empty")},m(t,r){J(t,e,r)},p:Ke,d(t){t&&Y(e)}}}function BD(n){let e,t,r,i,a,o;t=new aa({props:{value:n[16]}});function u(...s){return n[10](n[18],...s)}return{c(){e=ee("div"),xe(t.$$.fragment),r=fe(),q(e,"class","mb-list-item"),q(e,"role","listitem")},m(s,l){J(s,e,l),ye(t,e,null),K(e,r),i=!0,a||(o=Fe(e,"contextmenu",u),a=!0)},p(s,l){n=s;let c={};l&1&&(c.value=n[16]),t.$set(c)},i(s){i||(j(t.$$.fragment,s),i=!0)},o(s){ne(t.$$.fragment,s),i=!1},d(s){s&&Y(e),be(t),a=!1,o()}}}function L$(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"tabindex","0"),q(e,"placeholder",n[3]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[5]),t||(r=[Fe(e,"input",n[12]),Fe(e,"keyup",n[13])],t=!0)},p(i,a){a&8&&q(e,"placeholder",i[3]),a&4&&q(e,"maxlength",i[2]),a&32&&e.value!==i[5]&&je(e,i[5])},d(i){i&&Y(e),t=!1,Ft(r)}}}function V$(n){let e,t,r;return{c(){e=ee("textarea"),q(e,"tabindex","0"),q(e,"placeholder",n[3]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[5]),t||(r=Fe(e,"input",n[11]),t=!0)},p(i,a){a&8&&q(e,"placeholder",i[3]),a&4&&q(e,"maxlength",i[2]),a&32&&je(e,i[5])},d(i){i&&Y(e),t=!1,r()}}}function OD(n){let e,t=RD(n[0].length,n[2])+"",r,i;return{c(){e=ee("span"),r=He(t),q(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&5&&t!==(t=RD(a[0].length,a[2])+"")&&yt(r,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&q(e,"class",i)},d(a){a&&Y(e)}}}function U$(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function q$(n){let e,t,r,i,a,o,u,s=ct(n[0]),l=[];for(let v=0;v<s.length;v+=1)l[v]=BD(PD(n,s,v));let c=v=>ne(l[v],1,1,()=>{l[v]=null}),f=null;s.length||(f=kD(n));function p(v,y){return v[4]?V$:L$}let m=p(n,-1),h=m(n),d=n[2]!==void 0&&OD(n);return o=new It({props:{disabled:!n[5],$$slots:{default:[U$]},$$scope:{ctx:n}}}),o.$on("click",n[14]),{c(){e=ee("div");for(let v=0;v<l.length;v+=1)l[v].c();f&&f.c(),t=fe(),r=ee("div"),h.c(),i=fe(),d&&d.c(),a=fe(),xe(o.$$.fragment),q(e,"class","mb-list-items"),q(r,"class","mb-list-input")},m(v,y){J(v,e,y);for(let S=0;S<l.length;S+=1)l[S]&&l[S].m(e,null);f&&f.m(e,null),J(v,t,y),J(v,r,y),h.m(r,null),K(r,i),d&&d.m(r,null),K(r,a),ye(o,r,null),u=!0},p(v,[y]){if(y&129){s=ct(v[0]);let b;for(b=0;b<s.length;b+=1){let w=PD(v,s,b);l[b]?(l[b].p(w,y),j(l[b],1)):(l[b]=BD(w),l[b].c(),j(l[b],1),l[b].m(e,null))}for(bt(),b=s.length;b<l.length;b+=1)c(b);xt(),!s.length&&f?f.p(v,y):s.length?f&&(f.d(1),f=null):(f=kD(v),f.c(),f.m(e,null))}m===(m=p(v,y))&&h?h.p(v,y):(h.d(1),h=m(v),h&&(h.c(),h.m(r,i))),v[2]!==void 0?d?d.p(v,y):(d=OD(v),d.c(),d.m(r,a)):d&&(d.d(1),d=null);let S={};y&32&&(S.disabled=!v[5]),y&524290&&(S.$$scope={dirty:y,ctx:v}),o.$set(S)},i(v){if(!u){for(let y=0;y<s.length;y+=1)j(l[y]);j(o.$$.fragment,v),u=!0}},o(v){l=l.filter(Boolean);for(let y=0;y<l.length;y+=1)ne(l[y]);ne(o.$$.fragment,v),u=!1},d(v){v&&(Y(e),Y(t),Y(r)),Qt(l,v),f&&f.d(),h.d(),d&&d.d(),be(o)}}}function RD(n,e){let t=e.toString();return`${n.toString().padStart(t.length,"0")}/${t}`}function z$(n,e,t){let{plugin:r}=e,{value:i}=e,{limit:a}=e,{placeholder:o}=e,{multiLine:u}=e,{onValueChange:s}=e,l="";function c(b){t(0,i=b)}function f(){i.push(l),s(i),t(5,l=""),t(0,i)}function p(b){i.splice(b,1),s(i),t(0,i)}function m(b,w){let A=[];w>0&&A.push({name:"Move up",icon:"arrow-up",onclick:()=>{let x=i[w-1];t(0,i[w-1]=i[w],i),t(0,i[w]=x,i),s(i)}}),w<i.length-1&&A.push({name:"Move down",icon:"arrow-down",onclick:()=>{let x=i[w+1];t(0,i[w+1]=i[w],i),t(0,i[w]=x,i),s(i)}}),A.push({name:"Edit",icon:"pencil",onclick:()=>{r.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:Sa(i[w]),multiline:u,onSubmit:x=>{t(0,i[w]=x,i),s(i)},onCancel:()=>{}})}}),A.push({name:"Remove",icon:"x",warning:!0,onclick:()=>p(w)}),r.internal.createContextMenu(A).showWithEvent(b)}let h=(b,w)=>m(w,b);function d(){l=this.value,t(5,l)}function v(){l=this.value,t(5,l)}let y=b=>{b.key==="Enter"&&l.length>0&&f()},S=()=>f();return n.$$set=b=>{"plugin"in b&&t(1,r=b.plugin),"value"in b&&t(0,i=b.value),"limit"in b&&t(2,a=b.limit),"placeholder"in b&&t(3,o=b.placeholder),"multiLine"in b&&t(4,u=b.multiLine),"onValueChange"in b&&t(8,s=b.onValueChange)},[i,r,a,o,u,l,f,m,s,c,h,d,v,y,S]}var gv=class extends Pe{constructor(e){super(),Be(this,e,z$,q$,ke,{plugin:1,value:0,limit:2,placeholder:3,multiLine:4,onValueChange:8,setValue:9})}get setValue(){return this.$$.ctx[9]}},LD=gv;var Gp=class extends rr{filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return LD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"New Entry...",limit:this.mountable.getArgument("limit")?.value,multiLine:this.mountable.getArgument("multiLine")?.value===!0}}};function VD(n,e,t){let r=n.slice();return r[14]=e[t],r[16]=t,r}function UD(n){let e;return{c(){e=ee("span"),e.textContent="Empty",q(e,"class","mb-list-empty")},m(t,r){J(t,e,r)},p:Ke,d(t){t&&Y(e)}}}function qD(n){let e,t,r,i,a,o;t=new aa({props:{value:n[14]}});function u(...s){return n[9](n[16],...s)}return{c(){e=ee("div"),xe(t.$$.fragment),r=fe(),q(e,"class","mb-list-item"),q(e,"role","listitem")},m(s,l){J(s,e,l),ye(t,e,null),K(e,r),i=!0,a||(o=Fe(e,"contextmenu",u),a=!0)},p(s,l){n=s;let c={};l&1&&(c.value=n[14]),t.$set(c)},i(s){i||(j(t.$$.fragment,s),i=!0)},o(s){ne(t.$$.fragment,s),i=!1},d(s){s&&Y(e),be(t),a=!1,o()}}}function $$(n){let e;return{c(){e=He("Add new item")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function zD(n){let e,t;return e=new It({props:{variant:"default",$$slots:{default:[H$]},$$scope:{ctx:n}}}),e.$on("click",n[11]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function H$(n){let e;return{c(){e=He("Add other item")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function G$(n){let e,t,r,i,a,o,u=ct(n[0]),s=[];for(let p=0;p<u.length;p+=1)s[p]=qD(VD(n,u,p));let l=p=>ne(s[p],1,1,()=>{s[p]=null}),c=null;u.length||(c=UD(n)),i=new It({props:{variant:"default",$$slots:{default:[$$]},$$scope:{ctx:n}}}),i.$on("click",n[10]);let f=n[3]&&zD(n);return{c(){e=ee("div");for(let p=0;p<s.length;p+=1)s[p].c();c&&c.c(),t=fe(),r=ee("div"),xe(i.$$.fragment),a=fe(),f&&f.c(),q(e,"class","mb-list-items"),q(r,"class","mb-list-input")},m(p,m){J(p,e,m);for(let h=0;h<s.length;h+=1)s[h]&&s[h].m(e,null);c&&c.m(e,null),J(p,t,m),J(p,r,m),ye(i,r,null),K(r,a),f&&f.m(r,null),o=!0},p(p,[m]){if(m&17){u=ct(p[0]);let d;for(d=0;d<u.length;d+=1){let v=VD(p,u,d);s[d]?(s[d].p(v,m),j(s[d],1)):(s[d]=qD(v),s[d].c(),j(s[d],1),s[d].m(e,null))}for(bt(),d=u.length;d<s.length;d+=1)l(d);xt(),!u.length&&c?c.p(p,m):u.length?c&&(c.d(1),c=null):(c=UD(p),c.c(),c.m(e,null))}let h={};m&131072&&(h.$$scope={dirty:m,ctx:p}),i.$set(h),p[3]?f?(f.p(p,m),m&8&&j(f,1)):(f=zD(p),f.c(),j(f,1),f.m(r,null)):f&&(bt(),ne(f,1,1,()=>{f=null}),xt())},i(p){if(!o){for(let m=0;m<u.length;m+=1)j(s[m]);j(i.$$.fragment,p),j(f),o=!0}},o(p){s=s.filter(Boolean);for(let m=0;m<s.length;m+=1)ne(s[m]);ne(i.$$.fragment,p),ne(f),o=!1},d(p){p&&(Y(e),Y(t),Y(r)),Qt(s,p),c&&c.d(),be(i),f&&f.d()}}}function W$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowOther:u}=e,{onValueChange:s}=e;function l(y){t(0,i=y)}function c(y){i.push(y),t(0,i)}function f(y){i.splice(y,1),s(i),t(0,i)}function p(y){y.key===" "&&a()}function m(y,S){let b=[];S>0&&b.push({name:"Move up",icon:"arrow-up",onclick:()=>{let w=i[S-1];t(0,i[S-1]=i[S],i),t(0,i[S]=w,i),s(i)}}),S<i.length-1&&b.push({name:"Move down",icon:"arrow-down",onclick:()=>{let w=i[S+1];t(0,i[S+1]=i[S],i),t(0,i[S]=w,i),s(i)}}),b.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(S)}),r.internal.createContextMenu(b).showWithEvent(y)}let h=(y,S)=>m(S,y),d=()=>a(),v=()=>o();return n.$$set=y=>{"plugin"in y&&t(5,r=y.plugin),"value"in y&&t(0,i=y.value),"showSuggester"in y&&t(1,a=y.showSuggester),"showTextPrompt"in y&&t(2,o=y.showTextPrompt),"allowOther"in y&&t(3,u=y.allowOther),"onValueChange"in y&&t(6,s=y.onValueChange)},[i,a,o,u,m,r,s,l,c,h,d,v]}var vv=class extends Pe{constructor(e){super(),Be(this,e,W$,G$,ke,{plugin:5,value:0,showSuggester:1,showTextPrompt:2,allowOther:3,onValueChange:6,setValue:7,addValue:8})}get setValue(){return this.$$.ctx[7]}get addValue(){return this.$$.ctx[8]}},$D=vv;var Wp=class extends rr{filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return $D}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function HD(n,e,t){let r=n.slice();return r[10]=e[t],r}function GD(n){let e,t,r,i,a,o,u,s,l;function c(){return n[7](n[10])}a=new aa({props:{value:n[10].name}});function f(...m){return n[8](n[10],...m)}function p(...m){return n[9](n[10],...m)}return{c(){e=ee("div"),t=ee("input"),i=fe(),xe(a.$$.fragment),o=fe(),q(t,"type","checkbox"),t.checked=r=n[0].includes(n[10].value),q(e,"class","mb-select-input-element mb-mod-multi"),q(e,"role","button"),q(e,"tabindex","0"),Yt(e,"is-selected",n[0].includes(n[10].value))},m(m,h){J(m,e,h),K(e,t),K(e,i),ye(a,e,null),K(e,o),u=!0,s||(l=[Fe(t,"input",c),Fe(e,"click",f),Fe(e,"keypress",p)],s=!0)},p(m,h){n=m,(!u||h&3&&r!==(r=n[0].includes(n[10].value)))&&(t.checked=r);let d={};h&2&&(d.value=n[10].name),a.$set(d),(!u||h&3)&&Yt(e,"is-selected",n[0].includes(n[10].value))},i(m){u||(j(a.$$.fragment,m),u=!0)},o(m){ne(a.$$.fragment,m),u=!1},d(m){m&&Y(e),be(a),s=!1,Ft(l)}}}function Y$(n){let e,t,r=ct(n[1]),i=[];for(let o=0;o<r.length;o+=1)i[o]=GD(HD(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,[u]){if(u&15){r=ct(o[1]);let s;for(s=0;s<r.length;s+=1){let l=HD(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=GD(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function j$(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(m){t(0,i=m)}function s(m){i.includes(m)?t(0,i=i.filter(h=>h!==m)):(i.push(m),t(0,i)),o(i)}function l(m,h){m.key===" "&&s(h)}let c=m=>s(m.value),f=(m,h)=>{h.target instanceof HTMLInputElement||s(m.value)},p=(m,h)=>l(h,m.value);return n.$$set=m=>{"plugin"in m&&t(4,r=m.plugin),"value"in m&&t(0,i=m.value),"options"in m&&t(1,a=m.options),"onValueChange"in m&&t(5,o=m.onValueChange)},[i,a,s,l,r,o,u,c,f,p]}var yv=class extends Pe{constructor(e){super(),Be(this,e,j$,Y$,ke,{plugin:4,value:0,options:1,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},WD=yv;var Yp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return WD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function Z$(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"tabindex","0"),q(e,"placeholder",n[1])},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[5]),Fe(e,"input",n[6])],t=!0)},p(i,[a]){a&2&&q(e,"placeholder",i[1]),a&1&&Jn(e.value)!==i[0]&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function J$(n,e,t){let{plugin:r}=e,{value:i}=e,{placeholder:a}=e,{onValueChange:o}=e;function u(c){t(0,i=c)}function s(){i=Jn(this.value),t(0,i)}let l=()=>o(i);return n.$$set=c=>{"plugin"in c&&t(3,r=c.plugin),"value"in c&&t(0,i=c.value),"placeholder"in c&&t(1,a=c.placeholder),"onValueChange"in c&&t(2,o=c.onValueChange)},[i,a,o,r,u,s,l]}var bv=class extends Pe{constructor(e){super(),Be(this,e,J$,Z$,ke,{plugin:3,value:0,placeholder:1,onValueChange:2,setValue:4})}get setValue(){return this.$$.ctx[4]}},YD=bv;var jp=class extends rr{filterValue(e){return Zu(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return YD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")??"Number"}}};var{window:yc}=gc;function X$(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h;return{c(){e=ee("div"),t=ee("div"),i=fe(),a=ee("span"),o=He(n[0]),u=fe(),s=ee("span"),l=He(n[1]),c=fe(),f=ee("span"),p=He(n[2]),q(t,"class","mb-progress-bar-progress"),q(t,"style",r=`width: ${n[5](n[0])}%`),q(t,"role","slider"),q(t,"aria-valuemin",n[1]),q(t,"aria-valuemax",n[2]),q(t,"aria-valuenow",n[0]),q(t,"tabindex","0"),q(a,"class","mb-progress-bar-value"),q(s,"class","mb-progress-bar-label-left"),q(f,"class","mb-progress-bar-label-right"),q(e,"class","mb-progress-bar-input"),q(e,"tabindex","0"),q(e,"role","button")},m(d,v){J(d,e,v),K(e,t),K(e,i),K(e,a),K(a,o),K(e,u),K(e,s),K(s,l),K(e,c),K(e,f),K(f,p),n[15](e),m||(h=[Fe(yc,"touchmove",n[8],{passive:!1}),Fe(yc,"touchcancel",n[6]),Fe(yc,"touchend",n[6]),Fe(yc,"mousemove",n[8]),Fe(yc,"mouseup",n[6]),Fe(t,"dragstart",n[14]),Fe(e,"keydown",n[9]),Fe(e,"mousedown",n[7]),Fe(e,"touchstart",n[7])],m=!0)},p(d,[v]){v&1&&r!==(r=`width: ${d[5](d[0])}%`)&&q(t,"style",r),v&2&&q(t,"aria-valuemin",d[1]),v&4&&q(t,"aria-valuemax",d[2]),v&1&&q(t,"aria-valuenow",d[0]),v&1&&yt(o,d[0]),v&2&&yt(l,d[1]),v&4&&yt(p,d[2])},i:Ke,o:Ke,d(d){d&&Y(e),n[15](null),m=!1,Ft(h)}}}function Q$(n,e){return Number.parseFloat((Math.round(n/e)*e).toFixed(10))}function K$(n,e,t){let{plugin:r}=e,{onValueChange:i}=e,{value:a}=e,{minValue:o}=e,{maxValue:u}=e,{stepSize:s}=e,l=!1,c,f=0,p;function m(E){t(0,a=E)}function h(E){t(0,a=E),i(E)}function d(E){return E=fc(E,o,u),Mg(E,o,u,0,100)}function v(){t(3,l=!0)}function y(){t(3,l=!1)}function S(E){v(),b(E)}function b(E){if(!l)return;E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault();let _=E instanceof TouchEvent?E.touches[0].clientX:E.clientX;w(_)}function w(E){let _=c.getBoundingClientRect();E=fc(E,_.left,_.right);let N=Mg(E,_.left,_.right,o,u);N=Q$(N,s),h(N)}function A(E){f<50&&(f+=1);let _=Math.ceil(f/5);if(E.key==="ArrowUp"||E.key==="ArrowRight"){let N=fc(a+_,o,u);h(N)}if(E.key==="ArrowDown"||E.key==="ArrowLeft"){let N=fc(a-_,o,u);h(N)}window.clearTimeout(p),p=window.setTimeout(()=>f=1,100)}let x=()=>t(3,l=!0);function D(E){Pr[E?"unshift":"push"](()=>{c=E,t(4,c)})}return n.$$set=E=>{"plugin"in E&&t(10,r=E.plugin),"onValueChange"in E&&t(11,i=E.onValueChange),"value"in E&&t(0,a=E.value),"minValue"in E&&t(1,o=E.minValue),"maxValue"in E&&t(2,u=E.maxValue),"stepSize"in E&&t(12,s=E.stepSize)},[a,o,u,l,c,d,y,S,b,A,r,i,s,m,x,D]}var xv=class extends Pe{constructor(e){super(),Be(this,e,K$,X$,ke,{plugin:10,onValueChange:11,value:0,minValue:1,maxValue:2,stepSize:12,setValue:13})}get setValue(){return this.$$.ctx[13]}},jD=xv;var Zp=class extends rr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new Cr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Wf(Zu(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return jD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};function ZD(n,e,t){let r=n.slice();return r[10]=e[t],r}function JD(n){let e,t,r,i,a,o,u,s,l;function c(){return n[7](n[10])}a=new aa({props:{value:n[10].name}});function f(...m){return n[8](n[10],...m)}function p(...m){return n[9](n[10],...m)}return{c(){e=ee("div"),t=ee("input"),i=fe(),xe(a.$$.fragment),o=fe(),q(t,"type","checkbox"),t.checked=r=n[10].value===n[0],q(e,"class","mb-select-input-element"),q(e,"role","button"),q(e,"tabindex","0"),Yt(e,"is-selected",n[10].value===n[0])},m(m,h){J(m,e,h),K(e,t),K(e,i),ye(a,e,null),K(e,o),u=!0,s||(l=[Fe(t,"input",c),Fe(e,"click",f),Fe(e,"keypress",p)],s=!0)},p(m,h){n=m,(!u||h&3&&r!==(r=n[10].value===n[0]))&&(t.checked=r);let d={};h&2&&(d.value=n[10].name),a.$set(d),(!u||h&3)&&Yt(e,"is-selected",n[10].value===n[0])},i(m){u||(j(a.$$.fragment,m),u=!0)},o(m){ne(a.$$.fragment,m),u=!1},d(m){m&&Y(e),be(a),s=!1,Ft(l)}}}function eH(n){let e,t,r=ct(n[1]),i=[];for(let o=0;o<r.length;o+=1)i[o]=JD(ZD(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,[u]){if(u&15){r=ct(o[1]);let s;for(s=0;s<r.length;s+=1){let l=ZD(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=JD(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function tH(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(m){t(0,i=m)}function s(m){i===m?t(0,i=null):t(0,i=m),o(i)}function l(m,h){m.key===" "&&s(h)}let c=m=>s(m.value),f=(m,h)=>{h.target instanceof HTMLInputElement||s(m.value)},p=(m,h)=>l(h,m.value);return n.$$set=m=>{"plugin"in m&&t(4,r=m.plugin),"value"in m&&t(0,i=m.value),"options"in m&&t(1,a=m.options),"onValueChange"in m&&t(5,o=m.onValueChange)},[i,a,s,l,r,o,u,c,f,p]}var wv=class extends Pe{constructor(e){super(),Be(this,e,tH,eH,ke,{plugin:4,value:0,options:1,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},XD=wv;var Jp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Zo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return XD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function QD(n){let e,t;return{c(){e=ee("span"),t=He(n[1]),q(e,"class","mb-slider-input-label")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&2&&yt(t,r[1])},d(r){r&&Y(e)}}}function KD(n){let e,t;return{c(){e=ee("span"),t=He(n[2]),q(e,"class","mb-slider-input-label")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&4&&yt(t,r[2])},d(r){r&&Y(e)}}}function rH(n){let e,t,r,i,a,o,u=n[4]&&QD(n),s=n[4]&&KD(n);return{c(){u&&u.c(),e=fe(),t=ee("input"),r=fe(),s&&s.c(),i=Er(),q(t,"class","mb-slider-input slider"),q(t,"type","range"),q(t,"tabindex","0"),q(t,"min",n[1]),q(t,"max",n[2]),q(t,"step",n[3])},m(l,c){u&&u.m(l,c),J(l,e,c),J(l,t,c),je(t,n[0]),J(l,r,c),s&&s.m(l,c),J(l,i,c),a||(o=[Fe(t,"change",n[7]),Fe(t,"input",n[7]),Fe(t,"input",n[8])],a=!0)},p(l,[c]){l[4]?u?u.p(l,c):(u=QD(l),u.c(),u.m(e.parentNode,e)):u&&(u.d(1),u=null),c&2&&q(t,"min",l[1]),c&4&&q(t,"max",l[2]),c&8&&q(t,"step",l[3]),c&1&&je(t,l[0]),l[4]?s?s.p(l,c):(s=KD(l),s.c(),s.m(i.parentNode,i)):s&&(s.d(1),s=null)},i:Ke,o:Ke,d(l){l&&(Y(e),Y(t),Y(r),Y(i)),u&&u.d(l),s&&s.d(l),a=!1,Ft(o)}}}function nH(n,e,t){let{value:r}=e,{minValue:i}=e,{maxValue:a}=e,{stepSize:o}=e,{addLabels:u}=e,{onValueChange:s}=e;function l(p){t(0,r=p)}function c(){r=Jn(this.value),t(0,r)}let f=()=>s(r);return n.$$set=p=>{"value"in p&&t(0,r=p.value),"minValue"in p&&t(1,i=p.minValue),"maxValue"in p&&t(2,a=p.maxValue),"stepSize"in p&&t(3,o=p.stepSize),"addLabels"in p&&t(4,u=p.addLabels),"onValueChange"in p&&t(5,s=p.onValueChange)},[r,i,a,o,u,s,l,c,f]}var _v=class extends Pe{constructor(e){super(),Be(this,e,nH,rH,ke,{value:0,minValue:1,maxValue:2,stepSize:3,addLabels:4,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},eN=_v;var Xp=class extends rr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new Cr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Wf(Zu(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return eN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:this.mountable.getArgument("addLabels")?.value===!0}}};function iH(n){let e,t;return{c(){e=ee("span"),t=He(n[5])},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&32&&yt(t,r[5])},i:Ke,o:Ke,d(r){r&&Y(e)}}}function aH(n){let e,t,r;function i(o){n[10](o)}let a={};return n[4]!==void 0&&(a.mdLink=n[4]),e=new Ko({props:a}),Pr.push(()=>Qn(e,"mdLink",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u&16&&(t=!0,s.mdLink=o[4],Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function oH(n){let e,t;return e=new qr({props:{plugin:n[0],iconName:"list"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function tN(n){let e,t;return e=new It({props:{variant:"plain",$$slots:{default:[sH]},$$scope:{ctx:n}}}),e.$on("click",function(){Hs(n[2])&&n[2].apply(this,arguments)}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){n=r;let a={};i&2049&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function sH(n){let e,t;return e=new qr({props:{plugin:n[0],iconName:"pencil"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function uH(n){let e,t,r,i,a,o,u,s,l=[aH,iH],c=[];function f(m,h){return m[6]?0:1}r=f(n,-1),i=c[r]=l[r](n),o=new It({props:{variant:"plain",$$slots:{default:[oH]},$$scope:{ctx:n}}}),o.$on("click",function(){Hs(n[1])&&n[1].apply(this,arguments)});let p=n[3]&&tN(n);return{c(){e=ee("div"),t=ee("div"),i.c(),a=fe(),xe(o.$$.fragment),u=fe(),p&&p.c(),q(t,"class","mb-suggest-text"),q(e,"class","mb-suggest-input")},m(m,h){J(m,e,h),K(e,t),c[r].m(t,null),K(e,a),ye(o,e,null),K(e,u),p&&p.m(e,null),s=!0},p(m,[h]){n=m;let d=r;r=f(n,h),r===d?c[r].p(n,h):(bt(),ne(c[d],1,1,()=>{c[d]=null}),xt(),i=c[r],i?i.p(n,h):(i=c[r]=l[r](n),i.c()),j(i,1),i.m(t,null));let v={};h&2049&&(v.$$scope={dirty:h,ctx:n}),o.$set(v),n[3]?p?(p.p(n,h),h&8&&j(p,1)):(p=tN(n),p.c(),j(p,1),p.m(e,null)):p&&(bt(),ne(p,1,1,()=>{p=null}),xt())},i(m){s||(j(i),j(o.$$.fragment,m),j(p),s=!0)},o(m){ne(i),ne(o.$$.fragment,m),ne(p),s=!1},d(m){m&&Y(e),c[r].d(),be(o),p&&p.d()}}}function lH(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowOther:u}=e,{onValueChange:s}=e,l,c,f=!1;qi(()=>{p(i)});function p(h){let d=h?.toString()??"null";if(t(6,f=sn.isLink(d)),f)try{t(4,l=sn.parseLink(d))}catch(v){console.warn(v)}else t(5,c=d)}function m(h){l=h,t(4,l)}return n.$$set=h=>{"plugin"in h&&t(0,r=h.plugin),"value"in h&&t(7,i=h.value),"showSuggester"in h&&t(1,a=h.showSuggester),"showTextPrompt"in h&&t(2,o=h.showTextPrompt),"allowOther"in h&&t(3,u=h.allowOther),"onValueChange"in h&&t(8,s=h.onValueChange)},[r,a,o,u,l,c,f,i,s,p,m]}var Sv=class extends Pe{constructor(e){super(),Be(this,e,lH,uH,ke,{plugin:0,value:7,showSuggester:1,showTextPrompt:2,allowOther:3,onValueChange:8,setValue:9})}get setValue(){return this.$$.ctx[9]}},rN=Sv;var Qp=class extends rr{filterValue(e){return Zo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return rN}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind Suggester",subTitle:"Set the suggester value.",value:"",multiline:!1,onSubmit:e=>{this.setInternalValue(e)},onCancel:()=>{}})}};function nN(n){let e,t=iN(n[0].length,n[2])+"",r,i;return{c(){e=ee("span"),r=He(t),q(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&5&&t!==(t=iN(a[0].length,a[2])+"")&&yt(r,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&q(e,"class",i)},d(a){a&&Y(e)}}}function cH(n){let e,t,r,i,a,o=n[2]!==void 0&&nN(n);return{c(){e=ee("input"),t=fe(),o&&o.c(),r=Er(),q(e,"type","text"),q(e,"tabindex","0"),q(e,"placeholder",n[1]),q(e,"maxlength",n[2])},m(u,s){J(u,e,s),je(e,n[0]),J(u,t,s),o&&o.m(u,s),J(u,r,s),i||(a=[Fe(e,"input",n[6]),Fe(e,"input",n[7])],i=!0)},p(u,[s]){s&2&&q(e,"placeholder",u[1]),s&4&&q(e,"maxlength",u[2]),s&1&&e.value!==u[0]&&je(e,u[0]),u[2]!==void 0?o?o.p(u,s):(o=nN(u),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null)},i:Ke,o:Ke,d(u){u&&(Y(e),Y(t),Y(r)),o&&o.d(u),i=!1,Ft(a)}}}function iN(n,e){let t=e.toString();return`${n.toString().padStart(t.length,"0")}/${t}`}function fH(n,e,t){let{plugin:r}=e,{value:i}=e,{placeholder:a}=e,{limit:o}=e,{onValueChange:u}=e;function s(f){t(0,i=f)}function l(){i=this.value,t(0,i)}let c=()=>u(i);return n.$$set=f=>{"plugin"in f&&t(4,r=f.plugin),"value"in f&&t(0,i=f.value),"placeholder"in f&&t(1,a=f.placeholder),"limit"in f&&t(2,o=f.limit),"onValueChange"in f&&t(3,u=f.onValueChange)},[i,a,o,u,r,s,l,c]}var Av=class extends Pe{constructor(e){super(),Be(this,e,fH,cH,ke,{plugin:4,value:0,placeholder:1,limit:2,onValueChange:3,setValue:5})}get setValue(){return this.$$.ctx[5]}},aN=Av;var Kp=class extends rr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return aN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};function pH(n){let e,t,r;return{c(){e=ee("textarea"),q(e,"class","mb-input-textarea"),q(e,"tabindex","0"),q(e,"placeholder",n[1]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[5]),Fe(e,"input",n[6])],t=!0)},p(i,[a]){a&2&&q(e,"placeholder",i[1]),a&4&&q(e,"maxlength",i[2]),a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function mH(n,e,t){let{value:r}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function u(c){t(0,r=c)}function s(){r=this.value,t(0,r)}let l=()=>o(r);return n.$$set=c=>{"value"in c&&t(0,r=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)},[r,i,a,o,u,s,l]}var Mv=class extends Pe{constructor(e){super(),Be(this,e,mH,pH,ke,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},oN=Mv;var em=class extends rr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return oN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};function dH(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","time")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function hH(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var Ev=class extends Pe{constructor(e){super(),Be(this,e,hH,dH,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},sN=Ev;var tm=class extends rr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return sN}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function gH(n){let e,t,r,i;return{c(){e=ee("div"),t=ee("input"),q(t,"type","checkbox"),q(t,"tabindex","-1"),t.checked=n[0],q(e,"class","checkbox-container"),q(e,"role","switch"),q(e,"tabindex","0"),q(e,"aria-checked",n[0]),Yt(e,"is-enabled",n[0])},m(a,o){J(a,e,o),K(e,t),r||(i=[Fe(e,"click",n[5]),Fe(e,"keypress",n[6])],r=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&q(e,"aria-checked",a[0]),o&1&&Yt(e,"is-enabled",a[0])},i:Ke,o:Ke,d(a){a&&Y(e),r=!1,Ft(i)}}}function vH(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(c){t(0,r=c)}function o(){t(0,r=!r),i(r)}function u(c){c.key===" "&&o()}let s=()=>o(),l=c=>u(c);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"onValueChange"in c&&t(3,i=c.onValueChange)},[r,o,u,i,a,s,l]}var Dv=class extends Pe{constructor(e){super(),Be(this,e,vH,gH,ke,{value:0,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},uN=Dv;var rm=class extends rr{constructor(e){super(e),this.onValue=this.mountable.getArgument("onValue")?.value??!0,this.offValue=this.mountable.getArgument("offValue")?.value??!1}filterValue(e){return e===this.onValue||e===this.offValue?Zo(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return uN}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};function lN(n,e,t){let r=n.slice();return r[11]=e[t],r[13]=t,r}function cN(n){let e,t,r,i,a,o,u,s=n[11]+"",l,c,f,p;function m(...h){return n[7](n[13],...h)}return{c(){e=ee("div"),t=ee("img"),a=fe(),o=ee("div"),u=ee("span"),l=He(s),c=fe(),q(t,"class","mb-image-card-image"),na(t.src,r=n[1].internal.imagePathToUri(n[11]))||q(t,"src",r),q(t,"alt",i=n[11]),q(o,"class","mb-image-card-footer"),q(e,"class","mb-image-card"),q(e,"role","listitem")},m(h,d){J(h,e,d),K(e,t),K(e,a),K(e,o),K(o,u),K(u,l),K(e,c),f||(p=Fe(e,"contextmenu",m),f=!0)},p(h,d){n=h,d&3&&!na(t.src,r=n[1].internal.imagePathToUri(n[11]))&&q(t,"src",r),d&1&&i!==(i=n[11])&&q(t,"alt",i),d&1&&s!==(s=n[11]+"")&&yt(l,s)},d(h){h&&Y(e),f=!1,p()}}}function yH(n){let e;return{c(){e=He("Add new image")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function bH(n){let e,t,r,i,a,o=ct(n[0]),u=[];for(let s=0;s<o.length;s+=1)u[s]=cN(lN(n,o,s));return i=new It({props:{variant:"default",$$slots:{default:[yH]},$$scope:{ctx:n}}}),i.$on("click",n[8]),{c(){e=ee("div");for(let s=0;s<u.length;s+=1)u[s].c();t=fe(),r=ee("div"),xe(i.$$.fragment),q(e,"class","mb-image-card-grid"),q(r,"class","mb-list-input")},m(s,l){J(s,e,l);for(let c=0;c<u.length;c+=1)u[c]&&u[c].m(e,null);J(s,t,l),J(s,r,l),ye(i,r,null),a=!0},p(s,[l]){if(l&11){o=ct(s[0]);let f;for(f=0;f<o.length;f+=1){let p=lN(s,o,f);u[f]?u[f].p(p,l):(u[f]=cN(p),u[f].c(),u[f].m(e,null))}for(;f<u.length;f+=1)u[f].d(1);u.length=o.length}let c={};l&16384&&(c.$$scope={dirty:l,ctx:s}),i.$set(c)},i(s){a||(j(i.$$.fragment,s),a=!0)},o(s){ne(i.$$.fragment,s),a=!1},d(s){s&&(Y(e),Y(t),Y(r)),Qt(u,s),be(i)}}}function xH(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{onValueChange:o}=e;function u(h){t(0,i=h)}function s(h){i.push(h),t(0,i)}function l(h){i.splice(h,1),o(i),t(0,i)}function c(h){h.key===" "&&a()}function f(h,d){let v=[];d>0&&v.push({name:"Move left",icon:"arrow-left",onclick:()=>{let y=i[d-1];t(0,i[d-1]=i[d],i),t(0,i[d]=y,i),o(i)}}),d<i.length-1&&v.push({name:"Move right",icon:"arrow-right",onclick:()=>{let y=i[d+1];t(0,i[d+1]=i[d],i),t(0,i[d]=y,i),o(i)}}),v.push({name:"Copy image path",icon:"copy",onclick:()=>{let y=i[d];navigator.clipboard.writeText(y).then(()=>{r.internal.showNotice("Image path copied to clipboard")})}}),v.push({name:"Remove",icon:"x",warning:!0,onclick:()=>l(d)}),r.internal.createContextMenu(v).showWithEvent(h)}let p=(h,d)=>f(d,h),m=()=>a();return n.$$set=h=>{"plugin"in h&&t(1,r=h.plugin),"value"in h&&t(0,i=h.value),"showSuggester"in h&&t(2,a=h.showSuggester),"onValueChange"in h&&t(4,o=h.onValueChange)},[i,r,a,f,o,u,s,p,m]}var Nv=class extends Pe{constructor(e){super(),Be(this,e,xH,bH,ke,{plugin:1,value:0,showSuggester:2,onValueChange:4,setValue:5,addValue:6})}get setValue(){return this.$$.ctx[5]}get addValue(){return this.$$.ctx[6]}},fN=Nv;var nm=class extends rr{filterValue(e){return ra(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return fN}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(t=>Sa(t)).filter(t=>t!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)})}};function wH(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","datetime-local")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function _H(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var Tv=class extends Pe{constructor(e){super(),Be(this,e,_H,wH,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},pN=Tv;var im=class extends rr{filterValue(e){return Ha(e)}getFallbackDefaultValue(){return Yn.stringify(Yn.getDefaultDate())}getSvelteComponent(){return pN}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var am=class{constructor(e){this.plugin=e}createInputField(e){let t=e.declaration.inputFieldType,r=e.renderChildType;if(t!=="invalid"&&this.checkRenderChildTypeAllowed(t,r),t==="toggle")return new rm(e);if(t==="slider")return new Xp(e);if(t==="text")return new Kp(e);if(t==="textArea")return new em(e);if(t==="select")return new Jp(e);if(t==="multiSelect")return new Yp(e);if(t==="datePicker")return new Lp(e);if(t==="number")return new jp(e);if(t==="suggester")return new Qp(e);if(t==="editor")return new Vp(e);if(t==="progressBar")return new Zp(e);if(t==="inlineSelect")return new Hp(e);if(t==="imageSuggester")return new Up(e);if(t==="list")return new Gp(e);if(t==="listSuggester")return new Wp(e);if(t==="date")return new Rp(e);if(t==="time")return new tm(e);if(t==="inlineListSuggester")return new $p(e);if(t==="inlineList")return new zp(e);if(t==="imageListSuggester")return new nm(e);if(t==="dateTime")return new im(e);}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let r=Uf[e];if(t==="block"&&!r.allowInBlock)throw new wa({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[qt.linkToInputField(e)]});if(t==="inline"&&!r.allowInline)throw new wa({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[qt.linkToInputField(e)]})}};var om=class extends An{constructor(e,t,r,i){super(e,t,r),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.variables=[],this.buildVariables()}buildVariables(){if(this.errorCollection.isEmpty())try{for(let e of this.declaration.bindTargetMappings??[])this.variables.push({bindTargetDeclaration:e.bindTarget,inputSignal:new Lr(void 0),uuid:Ir(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){let e=new Lr(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(){this.metadataSubscription?.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 | JsViewFieldMountable >> mount",this.declaration),super.onMount(e),mt.addClass(e,"mb-view"),mt.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new uc({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 uc({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=document.createElement("div");mt.addClass(t,"mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(t,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(t)}onUnmount(e){console.debug("meta-bind | JsViewFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.unregisterSelfFromMetadataManager(),Wn(e,"js view field")}};var sm=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Gt(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 Ut({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 Ut({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){if(console.debug("meta-bind | ViewFieldMountable >> mount",this.declaration),super.onMount(e),mt.empty(e),mt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=document.createElement("div");mt.addClass(t,"mb-view-wrapper");try{this.viewField?.mount(t)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(t);let r=this.getArguments("class");for(let i of r)mt.addClasses(t,i.value);mt.addClass(t,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-view-block"):mt.addClass(e,"mb-view-inline")}onUnmount(e){console.debug("meta-bind | ViewFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.viewField?.unmount(),Wn(e,"view field")}};var Wa=class extends Zn{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Lr(void 0),this.variables=[],this.hidden=!1}async initialRender(e){mt.addClass(e,"mb-view-text"),this.hidden=this.mountable.getArgument("hidden")?.value??!1,this.hidden&&mt.addClass(e,"mb-view-hidden"),await this.onInitialRender(e),await this.rerender(e,"")}async rerender(e,t){if(!this.hidden){let r=yp(t,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";mt.empty(e),await this.onRerender(e,r)}}onMount(e){this.buildVariables(),this.inputSignal.registerListener({callback:t=>void this.rerender(e,t)}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribeComputed(this.mountable.getUuid(),this.inputSignal,this.mountable.getDeclaration().writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.computeValue(),()=>this.mountable.unmount()),this.initialRender(e)}onUnmount(){this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe()}};function SH(n){let e,t;return e=new qp({props:{elements:n[0],$$slots:{default:[EH,({element:r})=>({1:r}),({element:r})=>r?2:0]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.elements=r[0]),i&6&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function AH(n){let e,t;return e=new Ko({props:{mdLink:n[0][0]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.mdLink=r[0][0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function MH(n){let e;return{c(){e=ee("span")},m(t,r){J(t,e,r)},p:Ke,i:Ke,o:Ke,d(t){t&&Y(e)}}}function EH(n){let e,t;return e=new Ko({props:{mdLink:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.mdLink=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function DH(n){let e,t,r,i,a=[MH,AH,SH],o=[];function u(s,l){return s[0].length===0?0:s[0].length===1?1:2}return e=u(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=Er()},m(s,l){o[e].m(s,l),J(s,r,l),i=!0},p(s,[l]){let c=e;e=u(s,l),e===c?o[e].p(s,l):(bt(),ne(o[c],1,1,()=>{o[c]=null}),xt(),t=o[e],t?t.p(s,l):(t=o[e]=a[e](s),t.c()),j(t,1),t.m(r.parentNode,r))},i(s){i||(j(t),i=!0)},o(s){ne(t),i=!1},d(s){s&&Y(r),o[e].d(s)}}}function NH(n,e,t){let{mdLinkList:r}=e;return n.$$set=i=>{"mdLinkList"in i&&t(0,r=i.mdLinkList)},[r]}var Cv=class extends Pe{constructor(e){super(),Be(this,e,NH,DH,ke,{mdLinkList:0})}},Fv=Cv;var um=class extends Wa{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(r=>typeof r=="string"?r:!0);if(e.length!==1)throw new Go({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 Go({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new _a({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"?sn.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>sn.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new Fv({target:e,props:{mdLinkList:[]}})}async onRerender(e,t){let r=sn.parseLinkList(t);this.component=new Fv({target:e,props:{mdLinkList:r}})}onUnmount(){super.onUnmount(),this.component?.$destroy()}};function zr(){return zr=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zr.apply(this,arguments)}var Iv={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function At(n){return typeof n=="number"}function pt(n){return!n||typeof n!="object"||typeof n.constructor!="function"?!1:n.isBigNumber===!0&&typeof n.constructor.prototype=="object"&&n.constructor.prototype.isBigNumber===!0||typeof n.constructor.isDecimal=="function"&&n.constructor.isDecimal(n)===!0}function hi(n){return n&&typeof n=="object"&&Object.getPrototypeOf(n).isComplex===!0||!1}function _o(n){return n&&typeof n=="object"&&Object.getPrototypeOf(n).isFraction===!0||!1}function Un(n){return n&&n.constructor.prototype.isUnit===!0||!1}function tn(n){return typeof n=="string"}var nr=Array.isArray;function ot(n){return n&&n.constructor.prototype.isMatrix===!0||!1}function un(n){return Array.isArray(n)||ot(n)}function Zs(n){return n&&n.isDenseMatrix&&n.constructor.prototype.isMatrix===!0||!1}function Na(n){return n&&n.isSparseMatrix&&n.constructor.prototype.isMatrix===!0||!1}function tl(n){return n&&n.constructor.prototype.isRange===!0||!1}function es(n){return n&&n.constructor.prototype.isIndex===!0||!1}function mN(n){return typeof n=="boolean"}function dN(n){return n&&n.constructor.prototype.isResultSet===!0||!1}function lm(n){return n&&n.constructor.prototype.isHelp===!0||!1}function hN(n){return typeof n=="function"}function gN(n){return n instanceof Date}function vN(n){return n instanceof RegExp}function ts(n){return!!(n&&typeof n=="object"&&n.constructor===Object&&!hi(n)&&!_o(n))}function yN(n){return n===null}function bN(n){return n===void 0}function zi(n){return n&&n.isAccessorNode===!0&&n.constructor.prototype.isNode===!0||!1}function qn(n){return n&&n.isArrayNode===!0&&n.constructor.prototype.isNode===!0||!1}function xN(n){return n&&n.isAssignmentNode===!0&&n.constructor.prototype.isNode===!0||!1}function wN(n){return n&&n.isBlockNode===!0&&n.constructor.prototype.isNode===!0||!1}function _N(n){return n&&n.isConditionalNode===!0&&n.constructor.prototype.isNode===!0||!1}function zt(n){return n&&n.isConstantNode===!0&&n.constructor.prototype.isNode===!0||!1}function bc(n){return zt(n)||Vr(n)&&n.args.length===1&&zt(n.args[0])&&"-+~".includes(n.op)}function Ya(n){return n&&n.isFunctionAssignmentNode===!0&&n.constructor.prototype.isNode===!0||!1}function gi(n){return n&&n.isFunctionNode===!0&&n.constructor.prototype.isNode===!0||!1}function oa(n){return n&&n.isIndexNode===!0&&n.constructor.prototype.isNode===!0||!1}function jt(n){return n&&n.isNode===!0&&n.constructor.prototype.isNode===!0||!1}function rs(n){return n&&n.isObjectNode===!0&&n.constructor.prototype.isNode===!0||!1}function Vr(n){return n&&n.isOperatorNode===!0&&n.constructor.prototype.isNode===!0||!1}function zn(n){return n&&n.isParenthesisNode===!0&&n.constructor.prototype.isNode===!0||!1}function SN(n){return n&&n.isRangeNode===!0&&n.constructor.prototype.isNode===!0||!1}function AN(n){return n&&n.isRelationalNode===!0&&n.constructor.prototype.isNode===!0||!1}function Fr(n){return n&&n.isSymbolNode===!0&&n.constructor.prototype.isNode===!0||!1}function cm(n){return n&&n.constructor.prototype.isChain===!0||!1}function Kt(n){var e=typeof n;return e==="object"?n===null?"null":pt(n)?"BigNumber":n.constructor&&n.constructor.name?n.constructor.name:"Object":e}function vt(n){var e=typeof n;if(e==="number"||e==="string"||e==="boolean"||n===null||n===void 0)return n;if(typeof n.clone=="function")return n.clone();if(Array.isArray(n))return n.map(function(t){return vt(t)});if(n instanceof Date)return new Date(n.valueOf());if(pt(n))return n;if(ts(n))return TH(n,vt);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(n,")"))}function TH(n,e){var t={};for(var r in n)ut(n,r)&&(t[r]=e(n[r]));return t}function fm(n,e){for(var t in e)ut(e,t)&&(n[t]=e[t]);return n}function Ta(n,e){var t,r,i;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(r=0,i=n.length;r<i;r++)if(!Ta(n[r],e[r]))return!1;return!0}else{if(typeof n=="function")return n===e;if(n instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in n)if(!(t in e)||!Ta(n[t],e[t]))return!1;for(t in e)if(!(t in n))return!1;return!0}else return n===e}}function MN(n,e,t){var r=!0,i;Object.defineProperty(n,e,{get:function(){return r&&(i=t(),r=!1),i},set:function(o){i=o,r=!1},configurable:!0,enumerable:!0})}function ut(n,e){return n&&Object.hasOwnProperty.call(n,e)}function EN(n,e){for(var t={},r=0;r<e.length;r++){var i=e[r],a=n[i];a!==void 0&&(t[i]=a)}return t}var DN=["Matrix","Array"],NN=["number","BigNumber","Fraction"];var Ue=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(Iv)};zr(Ue,Iv,{MATRIX_OPTIONS:DN,NUMBER_OPTIONS:NN});var jv=wr(Bv(),1);function nt(n){return typeof n=="boolean"?!0:isFinite(n)?n===Math.round(n):!1}var sa=Math.sign||function(n){return n>0?1:n<0?-1:0},FN=Math.log2||function(e){return Math.log(e)/Math.LN2},IN=Math.log10||function(e){return Math.log(e)/Math.LN10},pm=Math.log1p||function(n){return Math.log(n+1)},PN=Math.cbrt||function(e){if(e===0)return e;var t=e<0,r;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},kN=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Ov(n,e,t){var r={2:"0b",8:"0o",16:"0x"},i=r[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!nt(t))throw new Error("size must be an integer");if(n>2**(t-1)-1||n<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!nt(n))throw new Error("Value must be an integer");n<0&&(n=n+2**t),a="i".concat(t)}var o="";return n<0&&(n=-n,o="-"),"".concat(o).concat(i).concat(n.toString(e)).concat(a)}function Ca(n,e){if(typeof e=="function")return e(n);if(n===1/0)return"Infinity";if(n===-1/0)return"-Infinity";if(isNaN(n))return"NaN";var{notation:t,precision:r,wordSize:i}=Rv(e);switch(t){case"fixed":return Lv(n,r);case"exponential":return BN(n,r);case"engineering":return CH(n,r);case"bin":return Ov(n,2,i);case"oct":return Ov(n,8,i);case"hex":return Ov(n,16,i);case"auto":return FH(n,r,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 Rv(n){var e="auto",t,r;if(n!==void 0)if(At(n))t=n;else if(pt(n))t=n.toNumber();else if(ts(n))n.precision!==void 0&&(t=TN(n.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),n.wordSize!==void 0&&(r=TN(n.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),n.notation&&(e=n.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:r}}function nl(n){var e=String(n).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+n);var t=e[1],r=e[2],i=parseFloat(e[4]||"0"),a=r.indexOf(".");i+=a!==-1?a-1:r.length-1;var o=r.replace(".","").replace(/^0*/,function(u){return i-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return o.length===0&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function CH(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=nl(n),r=mm(t,e),i=r.exponent,a=r.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(At(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var u=Math.abs(i-o)-(a.length-1),s=0;s<u;s++)a.push(0);for(var l=Math.abs(i-o),c=1;l>0;)c++,l--;var f=a.slice(c).join(""),p=At(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,c).join("")+p+"e"+(i>=0?"+":"")+o.toString();return r.sign+m}function Lv(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=nl(n),r=typeof e=="number"?mm(t,t.exponent+1+e):t,i=r.coefficients,a=r.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(rl(o-i.length))),a<0&&(i=rl(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),r.sign+i.join("")}function BN(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=nl(n),r=e?mm(t,e):t,i=r.coefficients,a=r.exponent;i.length<e&&(i=i.concat(rl(e-i.length)));var o=i.shift();return r.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function FH(n,e,t){if(isNaN(n)||!isFinite(n))return String(n);var r=CN(t?.lowerExp,-3),i=CN(t?.upperExp,5),a=nl(n),o=e?mm(a,e):a;if(o.exponent<r||o.exponent>=i)return BN(n,e);var u=o.coefficients,s=o.exponent;u.length<e&&(u=u.concat(rl(e-u.length))),u=u.concat(rl(s-u.length+1+(u.length<e?e-u.length:0))),u=rl(-s).concat(u);var l=s>0?s:0;return l<u.length-1&&u.splice(l+1,0,"."),o.sign+u.join("")}function mm(n,e){for(var t={sign:n.sign,coefficients:n.coefficients,exponent:n.exponent},r=t.coefficients;e<=0;)r.unshift(0),t.exponent++,e++;if(r.length>e){var i=r.splice(e,r.length-e);if(i[0]>=5){var a=e-1;for(r[a]++;r[a]===10;)r.pop(),a===0&&(r.unshift(0),t.exponent++,a++),a--,r[a]++}}return t}function rl(n){for(var e=[],t=0;t<n;t++)e.push(0);return e}function ON(n){return n.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var IH=Number.EPSILON||2220446049250313e-31;function Jr(n,e,t){if(t==null)return n===e;if(n===e)return!0;if(isNaN(n)||isNaN(e))return!1;if(isFinite(n)&&isFinite(e)){var r=Math.abs(n-e);return r<=IH?!0:r<=Math.max(Math.abs(n),Math.abs(e))*t}return!1}var RN=Math.acosh||function(n){return Math.log(Math.sqrt(n*n-1)+n)},LN=Math.asinh||function(n){return Math.log(Math.sqrt(n*n+1)+n)},VN=Math.atanh||function(n){return Math.log((1+n)/(1-n))/2},dm=Math.cosh||function(n){return(Math.exp(n)+Math.exp(-n))/2},UN=Math.sinh||function(n){return(Math.exp(n)-Math.exp(-n))/2},hm=Math.tanh||function(n){var e=Math.exp(2*n);return(e-1)/(e+1)};function qN(n,e){var t=n>0?!0:n<0?!1:1/n===1/0,r=e>0?!0:e<0?!1:1/e===1/0;return t^r?-n:n}function TN(n,e){if(At(n))return n;if(pt(n))return n.toNumber();e()}function CN(n,e){return At(n)?n:pt(n)?n.toNumber():e}function Vv(n,e,t){var r=n.constructor,i=new r(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!nt(t))throw new Error("size must be an integer");if(n.greaterThan(i.pow(t-1).sub(1))||n.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(!n.isInteger())throw new Error("Value must be an integer");n.lessThan(0)&&(n=n.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(n.toBinary()).concat(a);case 8:return"".concat(n.toOctal()).concat(a);case 16:return"".concat(n.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function HN(n,e){if(typeof e=="function")return e(n);if(!n.isFinite())return n.isNaN()?"NaN":n.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:r,wordSize:i}=Rv(e);switch(t){case"fixed":return kH(n,r);case"exponential":return zN(n,r);case"engineering":return PH(n,r);case"bin":return Vv(n,2,i);case"oct":return Vv(n,8,i);case"hex":return Vv(n,16,i);case"auto":{var a=$N(e?.lowerExp,-3),o=$N(e?.upperExp,5);if(n.isZero())return"0";var u,s=n.toSignificantDigits(r),l=s.e;return l>=a&&l<o?u=s.toFixed():u=zN(n,r),u.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 PH(n,e){var t=n.e,r=t%3===0?t:t<0?t-3-t%3:t-t%3,i=n.mul(Math.pow(10,-r)),a=i.toPrecision(e);if(a.indexOf("e")!==-1){var o=n.constructor;a=new o(a).toFixed()}return a+"e"+(t>=0?"+":"")+r.toString()}function zN(n,e){return e!==void 0?n.toExponential(e-1):n.toExponential()}function kH(n,e){return n.toFixed(e)}function $N(n,e){return At(n)?n:pt(n)?n.toNumber():e}function WN(n,e){var t=n.length-e.length,r=n.length;return n.substring(t,r)===e}function Mt(n,e){var t=BH(n,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function BH(n,e){if(typeof n=="number")return Ca(n,e);if(pt(n))return HN(n,e);if(OH(n))return!e||e.fraction!=="decimal"?n.s*n.n+"/"+n.d:n.toString();if(Array.isArray(n))return YN(n,e);if(tn(n))return Js(n);if(typeof n=="function")return n.syntax?String(n.syntax):"function";if(n&&typeof n=="object"){if(typeof n.format=="function")return n.format(e);if(n&&n.toString(e)!=={}.toString())return n.toString(e);var t=Object.keys(n).map(r=>Js(r)+": "+Mt(n[r],e));return"{"+t.join(", ")+"}"}return String(n)}function Js(n){for(var e=String(n),t="",r=0;r<e.length;){var i=e.charAt(r);t+=i in GN?GN[i]:i,r++}return'"'+t+'"'}var GN={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function Cn(n){var e=String(n);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function YN(n,e){if(Array.isArray(n)){for(var t="[",r=n.length,i=0;i<r;i++)i!==0&&(t+=", "),t+=YN(n[i],e);return t+="]",t}else return Mt(n,e)}function OH(n){return n&&typeof n=="object"&&typeof n.s=="number"&&typeof n.n=="number"&&typeof n.d=="number"||!1}function gm(n,e){if(!tn(n))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Kt(n)+", index: 0)");if(!tn(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Kt(e)+", index: 1)");return n===e?0:n>e?1:-1}function Dt(n,e,t){if(!(this instanceof Dt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=n,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(n)?"["+n.join(", ")+"]":n)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Dt.prototype=new RangeError;Dt.prototype.constructor=RangeError;Dt.prototype.name="DimensionError";Dt.prototype.isDimensionError=!0;function $n(n,e,t){if(!(this instanceof $n))throw new SyntaxError("Constructor must be called with the new operator");this.index=n,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}$n.prototype=new RangeError;$n.prototype.constructor=RangeError;$n.prototype.name="IndexError";$n.prototype.isIndexError=!0;function _t(n){for(var e=[];Array.isArray(n);)e.push(n.length),n=n[0];return e}function jN(n,e,t){var r,i=n.length;if(i!==e[t])throw new Dt(i,e[t]);if(t<e.length-1){var a=t+1;for(r=0;r<i;r++){var o=n[r];if(!Array.isArray(o))throw new Dt(e.length-1,e.length,"<");jN(n[r],e,a)}}else for(r=0;r<i;r++)if(Array.isArray(n[r]))throw new Dt(e.length+1,e.length,">")}function qv(n,e){var t=e.length===0;if(t){if(Array.isArray(n))throw new Dt(n.length,0)}else jN(n,e,0)}function xc(n,e){var t=n.isMatrix?n._size:_t(n),r=e._sourceSize;r.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new Dt(i,t[a])})}function br(n,e){if(n!==void 0){if(!At(n)||!nt(n))throw new TypeError("Index must be an integer (value: "+n+")");if(n<0||typeof e=="number"&&n>=e)throw new $n(n,e)}}function Xs(n){for(var e=0;e<n._dimensions.length;++e){var t=n._dimensions[e];if(t._data&&nr(t._data)){if(t._size[0]===0)return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(tn(t)&&t.length===0)return!0}return!1}function Fa(n,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(!At(i)||!nt(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(e)+")")}),(At(n)||pt(n))&&(n=[n]);var r=t!==void 0?t:0;return Uv(n,e,0,r),n}function Uv(n,e,t,r){var i,a,o=n.length,u=e[t],s=Math.min(o,u);if(n.length=u,t<e.length-1){var l=t+1;for(i=0;i<s;i++)a=n[i],Array.isArray(a)||(a=[a],n[i]=a),Uv(a,e,l,r);for(i=s;i<u;i++)a=[],n[i]=a,Uv(a,e,l,r)}else{for(i=0;i<s;i++)for(;Array.isArray(n[i]);)n[i]=n[i][0];for(i=s;i<u;i++)n[i]=r}}function wc(n,e){var t=kt(n),r=t.length;if(!Array.isArray(n)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Dt(0,r,"!=");e=_c(e,r);var i=ZN(e);if(r!==i)throw new Dt(i,r,"!=");try{return RH(t,e)}catch(a){throw a instanceof Dt?new Dt(i,r,"!="):a}}function _c(n,e){var t=ZN(n),r=n.slice(),i=-1,a=n.indexOf(i),o=n.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var u=a>=0,s=e%t===0;if(u)if(s)r[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function ZN(n){return n.reduce((e,t)=>e*t,1)}function RH(n,e){for(var t=n,r,i=e.length-1;i>0;i--){var a=e[i];r=[];for(var o=t.length/a,u=0;u<o;u++)r.push(t.slice(u*a,(u+1)*a));t=r}return t}function il(n,e){for(var t=e||_t(n);Array.isArray(n)&&n.length===1;)n=n[0],t.shift();for(var r=t.length;t[r-1]===1;)r--;return r<t.length&&(n=JN(n,r,0),t.length=r),n}function JN(n,e,t){var r,i;if(t<e){var a=t+1;for(r=0,i=n.length;r<i;r++)n[r]=JN(n[r],e,a)}else for(;Array.isArray(n);)n=n[0];return n}function vm(n,e,t,r){var i=r||_t(n);if(t)for(var a=0;a<t;a++)n=[n],i.unshift(1);for(n=XN(n,e,0);i.length<e;)i.push(1);return n}function XN(n,e,t){var r,i;if(Array.isArray(n)){var a=t+1;for(r=0,i=n.length;r<i;r++)n[r]=XN(n[r],e,a)}else for(var o=t;o<e;o++)n=[n];return n}function kt(n){if(!Array.isArray(n))return n;var e=[];return n.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}function Mi(n,e){return Array.prototype.map.call(n,e)}function ns(n,e){Array.prototype.forEach.call(n,e)}function ym(n,e){if(_t(n).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(n,e)}function al(n,e){if(_t(n).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(n,t=>e.test(t))}function zv(n,e){return Array.prototype.join.call(n,e)}function So(n){if(!Array.isArray(n))throw new TypeError("Array input expected");if(n.length===0)return n;var e=[],t=0;e[0]={value:n[0],identifier:0};for(var r=1;r<n.length;r++)n[r]===n[r-1]?t++:t=0,e.push({value:n[r],identifier:t});return e}function ol(n){if(!Array.isArray(n))throw new TypeError("Array input expected");if(n.length===0)return n;for(var e=[],t=0;t<n.length;t++)e.push(n[t].value);return e}function is(n,e){for(var t,r=0,i=0;i<n.length;i++){var a=n[i],o=Array.isArray(a);if(i===0&&o&&(r=a.length),o&&a.length!==r)return;var u=o?is(a,e):e(a);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function QN(n,e,t,r){if(r<t){if(n.length!==e.length)throw new Dt(n.length,e.length);for(var i=[],a=0;a<n.length;a++)i[a]=QN(n[a],e[a],t,r+1);return i}else return n.concat(e)}function $v(){var n=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(n.length===1)return n[0];if(n.length>1)return n.slice(1).reduce(function(t,r){return QN(t,r,e,0)},n[0]);throw new Error("Wrong number of arguments in function concat")}function LH(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];for(var r=e.map(p=>p.length),i=Math.max(...r),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var u=e[o],s=r[o],l=0;l<s;l++){var c=i-s+l;u[l]>a[c]&&(a[c]=u[l])}for(var f=0;f<e.length;f++)Sc(e[f],a);return a}function Sc(n,e){for(var t=e.length,r=n.length,i=0;i<r;i++){var a=t-r+i;if(n[i]<e[a]&&n[i]>1||n[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(n,") not possible to broadcast dimension ").concat(r," with size ").concat(n[i]," to size ").concat(e[a]))}}function Hv(n,e){var t=_t(n);if(Ta(t,e))return n;Sc(t,e);var r=LH(t,e),i=r.length,a=[...Array(i-t.length).fill(1),...t],o=UH(n);t.length<i&&(o=wc(o,a),t=_t(o));for(var u=0;u<i;u++)t[u]<r[u]&&(o=VH(o,r[u],u),t=_t(o));return o}function VH(n,e,t){return $v(...Array(e).fill(n),t)}function UH(n){return zr([],n)}function T(n,e,t,r){function i(a){var o=EN(a,e.map($H));return qH(n,e,a),t(o)}return i.isFactory=!0,i.fn=n,i.dependencies=e.slice().sort(),r&&(i.meta=r),i}function qH(n,e,t){var r=e.filter(a=>!zH(a)).every(a=>t[a]!==void 0);if(!r){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(n,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function zH(n){return n&&n[0]==="?"}function $H(n){return n&&n[0]==="?"?n.slice(1):n}function $r(n,e){if(rT(n)&&eT(n,e))return n[e];throw typeof n[e]=="function"&&bm(n,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function ja(n,e,t){if(rT(n)&&eT(n,e))return n[e]=t,t;throw new Error('No access to property "'+e+'"')}function KN(n,e){return e in n}function eT(n,e){return!n||typeof n!="object"?!1:ut(HH,e)?!0:!(e in Object.prototype||e in Function.prototype)}function tT(n,e){if(!bm(n,e))throw new Error('No access to method "'+e+'"');return n[e]}function bm(n,e){return n==null||typeof n[e]!="function"||ut(n,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(n)?!1:ut(GH,e)?!0:!(e in Object.prototype||e in Function.prototype)}function rT(n){return typeof n=="object"&&n&&n.constructor===Object}var HH={length:!0,name:!0},GH={toString:!0,valueOf:!0,toLocaleString:!0};var Qs=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return $r(this.wrappedObject,e)}set(e,t){return ja(this.wrappedObject,e,t),this}has(e){return KN(this.wrappedObject,e)}entries(){return nT(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}},sl=class{constructor(e,t,r){this.a=e,this.b=t,this.bKeys=r,this[Symbol.iterator]=this.entries}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 nT(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 nT(n,e){return{next:()=>{var t=n.next();return t.done?t:{value:e(t.value),done:!1}}}}function as(){return new Map}function Ao(n){if(!n)return as();if(Gv(n))return n;if(ts(n))return new Qs(n);throw new Error("createMap can create maps from objects or Maps")}function iT(n){if(n instanceof Qs)return n.wrappedObject;var e={};for(var t of n.keys()){var r=n.get(t);ja(e,t,r)}return e}function Gv(n){return n?n instanceof Map||n instanceof Qs||typeof n.set=="function"&&typeof n.get=="function"&&typeof n.keys=="function"&&typeof n.has=="function":!1}var aT=function(){return aT=jv.default.create,jv.default},WH=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Zv=T("typed",WH,function(e){var{BigNumber:t,Complex:r,DenseMatrix:i,Fraction:a}=e,o=aT();return o.clear(),o.addTypes([{name:"number",test:At},{name:"Complex",test:hi},{name:"BigNumber",test:pt},{name:"Fraction",test:_o},{name:"Unit",test:Un},{name:"identifier",test:u=>tn&&/^(?:[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(u)},{name:"string",test:tn},{name:"Chain",test:cm},{name:"Array",test:nr},{name:"Matrix",test:ot},{name:"DenseMatrix",test:Zs},{name:"SparseMatrix",test:Na},{name:"Range",test:tl},{name:"Index",test:es},{name:"boolean",test:mN},{name:"ResultSet",test:dN},{name:"Help",test:lm},{name:"function",test:hN},{name:"Date",test:gN},{name:"RegExp",test:vN},{name:"null",test:yN},{name:"undefined",test:bN},{name:"AccessorNode",test:zi},{name:"ArrayNode",test:qn},{name:"AssignmentNode",test:xN},{name:"BlockNode",test:wN},{name:"ConditionalNode",test:_N},{name:"ConstantNode",test:zt},{name:"FunctionNode",test:gi},{name:"FunctionAssignmentNode",test:Ya},{name:"IndexNode",test:oa},{name:"Node",test:jt},{name:"ObjectNode",test:rs},{name:"OperatorNode",test:Vr},{name:"ParenthesisNode",test:zn},{name:"RangeNode",test:SN},{name:"RelationalNode",test:AN},{name:"SymbolNode",test:Fr},{name:"Map",test:Gv},{name:"Object",test:ts}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(s){if(t||Wv(s),ON(s)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+s+"). Use function bignumber(x) to convert to BigNumber.");return new t(s)}},{from:"number",to:"Complex",convert:function(s){return r||xm(s),new r(s,0)}},{from:"BigNumber",to:"Complex",convert:function(s){return r||xm(s),new r(s.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(s){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(s){return r||xm(s),new r(s.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(s){a||Yv(s);var l=new a(s);if(l.valueOf()!==s)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+s+"). Use function fraction(x) to convert to Fraction.");return l}},{from:"string",to:"number",convert:function(s){var l=Number(s);if(isNaN(l))throw new Error('Cannot convert "'+s+'" to a number');return l}},{from:"string",to:"BigNumber",convert:function(s){t||Wv(s);try{return new t(s)}catch{throw new Error('Cannot convert "'+s+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(s){a||Yv(s);try{return new a(s)}catch{throw new Error('Cannot convert "'+s+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(s){r||xm(s);try{return new r(s)}catch{throw new Error('Cannot convert "'+s+'" to Complex')}}},{from:"boolean",to:"number",convert:function(s){return+s}},{from:"boolean",to:"BigNumber",convert:function(s){return t||Wv(s),new t(+s)}},{from:"boolean",to:"Fraction",convert:function(s){return a||Yv(s),new a(+s)}},{from:"boolean",to:"string",convert:function(s){return String(s)}},{from:"Array",to:"Matrix",convert:function(s){return i||YH(),new i(s)}},{from:"Matrix",to:"Array",convert:function(s){return s.valueOf()}}]),o.onMismatch=(u,s,l)=>{var c=o.createError(u,s,l);if(["wrongType","mismatch"].includes(c.data.category)&&s.length===1&&un(s[0])&&l.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(u,s,l)=>{var c=o.createError(u,s,l);if(["wrongType","mismatch"].includes(c.data.category)&&s.length===1&&un(s[0])&&l.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=c.data,f}throw c},o});function Wv(n){throw new Error("Cannot convert value ".concat(n," into a BigNumber: no class 'BigNumber' provided"))}function xm(n){throw new Error("Cannot convert value ".concat(n," into a Complex number: no class 'Complex' provided"))}function YH(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Yv(n){throw new Error("Cannot convert value ".concat(n," into a Fraction, no class 'Fraction' provided."))}var jH="ResultSet",ZH=[],Jv=T(jH,ZH,()=>{function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return n.prototype.type="ResultSet",n.prototype.isResultSet=!0,n.prototype.valueOf=function(){return this.entries},n.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},n.fromJSON=function(e){return new n(e.entries)},n},{isClass:!0});var ul=9e15,ls=1e9,Xv="0123456789abcdef",_m="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Sm="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qv={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ul,maxE:ul,crypto:!1},lT,Mo,Zt=!0,Mm="[DecimalError] ",us=Mm+"Invalid argument: ",cT=Mm+"Precision limit exceeded",fT=Mm+"crypto unavailable",pT="[object Decimal]",Kn=Math.floor,Fn=Math.pow,JH=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,XH=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,QH=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mT=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Pa=1e7,Ot=7,KH=9007199254740991,eG=_m.length-1,Kv=Sm.length-1,Je={toStringTag:pT};Je.absoluteValue=Je.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Tt(n)};Je.ceil=function(){return Tt(new this.constructor(this),this.e+1,2)};Je.clampedTo=Je.clamp=function(n,e){var t,r=this,i=r.constructor;if(n=new i(n),e=new i(e),!n.s||!e.s)return new i(NaN);if(n.gt(e))throw Error(us+e);return t=r.cmp(n),t<0?n:r.cmp(e)>0?e:new i(r)};Je.comparedTo=Je.cmp=function(n){var e,t,r,i,a=this,o=a.d,u=(n=new a.constructor(n)).d,s=a.s,l=n.s;if(!o||!u)return!s||!l?NaN:s!==l?s:o===u?0:!o^s<0?1:-1;if(!o[0]||!u[0])return o[0]?s:u[0]?-l:0;if(s!==l)return s;if(a.e!==n.e)return a.e>n.e^s<0?1:-1;for(r=o.length,i=u.length,e=0,t=r<i?r:i;e<t;++e)if(o[e]!==u[e])return o[e]>u[e]^s<0?1:-1;return r===i?0:r>i^s<0?1:-1};Je.cosine=Je.cos=function(){var n,e,t=this,r=t.constructor;return t.d?t.d[0]?(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+Ot,r.rounding=1,t=tG(r,yT(r,t)),r.precision=n,r.rounding=e,Tt(Mo==2||Mo==3?t.neg():t,n,e,!0)):new r(1):new r(NaN)};Je.cubeRoot=Je.cbrt=function(){var n,e,t,r,i,a,o,u,s,l,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Zt=!1,a=c.s*Fn(c.s*c,1/3),!a||Math.abs(a)==1/0?(t=Hn(c.d),n=c.e,(a=(n-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=Fn(t,1/3),n=Kn((n+1)/3)-(n%3==(n<0?-1:2)),a==1/0?t="5e"+n:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+n),r=new f(t),r.s=c.s):r=new f(a.toString()),o=(n=f.precision)+3;;)if(u=r,s=u.times(u).times(u),l=s.plus(c),r=Hr(l.plus(c).times(u),l.plus(s),o+2,1),Hn(u.d).slice(0,o)===(t=Hn(r.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(Tt(u,n+1,0),u.times(u).times(u).eq(c))){r=u;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Tt(r,n+1,1),e=!r.times(r).times(r).eq(c));break}return Zt=!0,Tt(r,n,f.rounding,e)};Je.decimalPlaces=Je.dp=function(){var n,e=this.d,t=NaN;if(e){if(n=e.length-1,t=(n-Kn(this.e/Ot))*Ot,n=e[n],n)for(;n%10==0;n/=10)t--;t<0&&(t=0)}return t};Je.dividedBy=Je.div=function(n){return Hr(this,new this.constructor(n))};Je.dividedToIntegerBy=Je.divToInt=function(n){var e=this,t=e.constructor;return Tt(Hr(e,new t(n),0,1,1),t.precision,t.rounding)};Je.equals=Je.eq=function(n){return this.cmp(n)===0};Je.floor=function(){return Tt(new this.constructor(this),this.e+1,3)};Je.greaterThan=Je.gt=function(n){return this.cmp(n)>0};Je.greaterThanOrEqualTo=Je.gte=function(n){var e=this.cmp(n);return e==1||e===0};Je.hyperbolicCosine=Je.cosh=function(){var n,e,t,r,i,a=this,o=a.constructor,u=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return u;t=o.precision,r=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(n=Math.ceil(i/3),e=(1/Dm(4,n)).toString()):(n=16,e="2.3283064365386962890625e-10"),a=ll(o,1,a.times(e),new o(1),!0);for(var s,l=n,c=new o(8);l--;)s=a.times(a),a=u.minus(s.times(c.minus(s.times(c))));return Tt(a,o.precision=t,o.rounding=r,!0)};Je.hyperbolicSine=Je.sinh=function(){var n,e,t,r,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,r=i.d.length,r<3)i=ll(a,2,i,i,!0);else{n=1.4*Math.sqrt(r),n=n>16?16:n|0,i=i.times(1/Dm(5,n)),i=ll(a,2,i,i,!0);for(var o,u=new a(5),s=new a(16),l=new a(20);n--;)o=i.times(i),i=i.times(u.plus(o.times(s.times(o).plus(l))))}return a.precision=e,a.rounding=t,Tt(i,e,t,!0)};Je.hyperbolicTangent=Je.tanh=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+7,r.rounding=1,Hr(t.sinh(),t.cosh(),r.precision=n,r.rounding=e)):new r(t.s)};Je.inverseCosine=Je.acos=function(){var n,e=this,t=e.constructor,r=e.abs().cmp(1),i=t.precision,a=t.rounding;return r!==-1?r===0?e.isNeg()?Ia(t,i,a):new t(0):new t(NaN):e.isZero()?Ia(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),n=Ia(t,i+4,a).times(.5),t.precision=i,t.rounding=a,n.minus(e))};Je.inverseHyperbolicCosine=Je.acosh=function(){var n,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(n=r.precision,e=r.rounding,r.precision=n+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,Zt=!1,t=t.times(t).minus(1).sqrt().plus(t),Zt=!0,r.precision=n,r.rounding=e,t.ln()):new r(t)};Je.inverseHyperbolicSine=Je.asinh=function(){var n,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,Zt=!1,t=t.times(t).plus(1).sqrt().plus(t),Zt=!0,r.precision=n,r.rounding=e,t.ln())};Je.inverseHyperbolicTangent=Je.atanh=function(){var n,e,t,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(n=a.precision,e=a.rounding,r=i.sd(),Math.max(r,n)<2*-i.e-1?Tt(new a(i),n,e,!0):(a.precision=t=r-i.e,i=Hr(i.plus(1),new a(1).minus(i),t+n,1),a.precision=n+4,a.rounding=1,i=i.ln(),a.precision=n,a.rounding=e,i.times(.5))):new a(NaN)};Je.inverseSine=Je.asin=function(){var n,e,t,r,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,r=a.rounding,e!==-1?e===0?(n=Ia(a,t+4,r).times(.5),n.s=i.s,n):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=r,i.times(2)))};Je.inverseTangent=Je.atan=function(){var n,e,t,r,i,a,o,u,s,l=this,c=l.constructor,f=c.precision,p=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);if(l.abs().eq(1)&&f+4<=Kv)return o=Ia(c,f+4,p).times(.25),o.s=l.s,o}else{if(!l.s)return new c(NaN);if(f+4<=Kv)return o=Ia(c,f+4,p).times(.5),o.s=l.s,o}for(c.precision=u=f+10,c.rounding=1,t=Math.min(28,u/Ot+2|0),n=t;n;--n)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(Zt=!1,e=Math.ceil(u/Ot),r=1,s=l.times(l),o=new c(l),i=l;n!==-1;)if(i=i.times(s),a=o.minus(i.div(r+=2)),i=i.times(s),o=a.plus(i.div(r+=2)),o.d[e]!==void 0)for(n=e;o.d[n]===a.d[n]&&n--;);return t&&(o=o.times(2<<t-1)),Zt=!0,Tt(o,c.precision=f,c.rounding=p,!0)};Je.isFinite=function(){return!!this.d};Je.isInteger=Je.isInt=function(){return!!this.d&&Kn(this.e/Ot)>this.d.length-2};Je.isNaN=function(){return!this.s};Je.isNegative=Je.isNeg=function(){return this.s<0};Je.isPositive=Je.isPos=function(){return this.s>0};Je.isZero=function(){return!!this.d&&this.d[0]===0};Je.lessThan=Je.lt=function(n){return this.cmp(n)<0};Je.lessThanOrEqualTo=Je.lte=function(n){return this.cmp(n)<1};Je.logarithm=Je.log=function(n){var e,t,r,i,a,o,u,s,l=this,c=l.constructor,f=c.precision,p=c.rounding,m=5;if(n==null)n=new c(10),e=!0;else{if(n=new c(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new c(NaN);e=n.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new c(t&&!t[0]?-1/0:l.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(Zt=!1,u=f+m,o=ss(l,u),r=e?Am(c,u+10):ss(n,u),s=Hr(o,r,u,1),Ac(s.d,i=f,p))do if(u+=10,o=ss(l,u),r=e?Am(c,u+10):ss(n,u),s=Hr(o,r,u,1),!a){+Hn(s.d).slice(i+1,i+15)+1==1e14&&(s=Tt(s,f+1,0));break}while(Ac(s.d,i+=10,p));return Zt=!0,Tt(s,f,p)};Je.minus=Je.sub=function(n){var e,t,r,i,a,o,u,s,l,c,f,p,m=this,h=m.constructor;if(n=new h(n),!m.d||!n.d)return!m.s||!n.s?n=new h(NaN):m.d?n.s=-n.s:n=new h(n.d||m.s!==n.s?m:NaN),n;if(m.s!=n.s)return n.s=-n.s,m.plus(n);if(l=m.d,p=n.d,u=h.precision,s=h.rounding,!l[0]||!p[0]){if(p[0])n.s=-n.s;else if(l[0])n=new h(m);else return new h(s===3?-0:0);return Zt?Tt(n,u,s):n}if(t=Kn(n.e/Ot),c=Kn(m.e/Ot),l=l.slice(),a=c-t,a){for(f=a<0,f?(e=l,a=-a,o=p.length):(e=p,t=c,o=l.length),r=Math.max(Math.ceil(u/Ot),o)+2,a>r&&(a=r,e.length=1),e.reverse(),r=a;r--;)e.push(0);e.reverse()}else{for(r=l.length,o=p.length,f=r<o,f&&(o=r),r=0;r<o;r++)if(l[r]!=p[r]){f=l[r]<p[r];break}a=0}for(f&&(e=l,l=p,p=e,n.s=-n.s),o=l.length,r=p.length-o;r>0;--r)l[o++]=0;for(r=p.length;r>a;){if(l[--r]<p[r]){for(i=r;i&&l[--i]===0;)l[i]=Pa-1;--l[i],l[r]+=Pa}l[r]-=p[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(n.d=l,n.e=Em(l,t),Zt?Tt(n,u,s):n):new h(s===3?-0:0)};Je.modulo=Je.mod=function(n){var e,t=this,r=t.constructor;return n=new r(n),!t.d||!n.s||n.d&&!n.d[0]?new r(NaN):!n.d||t.d&&!t.d[0]?Tt(new r(t),r.precision,r.rounding):(Zt=!1,r.modulo==9?(e=Hr(t,n.abs(),0,3,1),e.s*=n.s):e=Hr(t,n,0,r.modulo,1),e=e.times(n),Zt=!0,t.minus(e))};Je.naturalExponential=Je.exp=function(){return ey(this)};Je.naturalLogarithm=Je.ln=function(){return ss(this)};Je.negated=Je.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Tt(n)};Je.plus=Je.add=function(n){var e,t,r,i,a,o,u,s,l,c,f=this,p=f.constructor;if(n=new p(n),!f.d||!n.d)return!f.s||!n.s?n=new p(NaN):f.d||(n=new p(n.d||f.s===n.s?f:NaN)),n;if(f.s!=n.s)return n.s=-n.s,f.minus(n);if(l=f.d,c=n.d,u=p.precision,s=p.rounding,!l[0]||!c[0])return c[0]||(n=new p(f)),Zt?Tt(n,u,s):n;if(a=Kn(f.e/Ot),r=Kn(n.e/Ot),l=l.slice(),i=a-r,i){for(i<0?(t=l,i=-i,o=c.length):(t=c,r=a,o=l.length),a=Math.ceil(u/Ot),o=a>o?a+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=l.length,i=c.length,o-i<0&&(i=o,t=c,c=l,l=t),e=0;i;)e=(l[--i]=l[i]+c[i]+e)/Pa|0,l[i]%=Pa;for(e&&(l.unshift(e),++r),o=l.length;l[--o]==0;)l.pop();return n.d=l,n.e=Em(l,r),Zt?Tt(n,u,s):n};Je.precision=Je.sd=function(n){var e,t=this;if(n!==void 0&&n!==!!n&&n!==1&&n!==0)throw Error(us+n);return t.d?(e=dT(t.d),n&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Je.round=function(){var n=this,e=n.constructor;return Tt(new e(n),n.e+1,e.rounding)};Je.sine=Je.sin=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+Ot,r.rounding=1,t=nG(r,yT(r,t)),r.precision=n,r.rounding=e,Tt(Mo>2?t.neg():t,n,e,!0)):new r(NaN)};Je.squareRoot=Je.sqrt=function(){var n,e,t,r,i,a,o=this,u=o.d,s=o.e,l=o.s,c=o.constructor;if(l!==1||!u||!u[0])return new c(!l||l<0&&(!u||u[0])?NaN:u?o:1/0);for(Zt=!1,l=Math.sqrt(+o),l==0||l==1/0?(e=Hn(u),(e.length+s)%2==0&&(e+="0"),l=Math.sqrt(e),s=Kn((s+1)/2)-(s<0||s%2),l==1/0?e="5e"+s:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+s),r=new c(e)):r=new c(l.toString()),t=(s=c.precision)+3;;)if(a=r,r=a.plus(Hr(o,a,t+2,1)).times(.5),Hn(a.d).slice(0,t)===(e=Hn(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(Tt(a,s+1,0),a.times(a).eq(o))){r=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Tt(r,s+1,1),n=!r.times(r).eq(o));break}return Zt=!0,Tt(r,s,c.rounding,n)};Je.tangent=Je.tan=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+10,r.rounding=1,t=t.sin(),t.s=1,t=Hr(t,new r(1).minus(t.times(t)).sqrt(),n+10,0),r.precision=n,r.rounding=e,Tt(Mo==2||Mo==4?t.neg():t,n,e,!0)):new r(NaN)};Je.times=Je.mul=function(n){var e,t,r,i,a,o,u,s,l,c=this,f=c.constructor,p=c.d,m=(n=new f(n)).d;if(n.s*=c.s,!p||!p[0]||!m||!m[0])return new f(!n.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?n.s/0:n.s*0);for(t=Kn(c.e/Ot)+Kn(n.e/Ot),s=p.length,l=m.length,s<l&&(a=p,p=m,m=a,o=s,s=l,l=o),a=[],o=s+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(e=0,i=s+r;i>r;)u=a[i]+m[r]*p[i-r-1]+e,a[i--]=u%Pa|0,e=u/Pa|0;a[i]=(a[i]+e)%Pa|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),n.d=a,n.e=Em(a,t),Zt?Tt(n,f.precision,f.rounding):n};Je.toBinary=function(n,e){return ry(this,2,n,e)};Je.toDecimalPlaces=Je.toDP=function(n,e){var t=this,r=t.constructor;return t=new r(t),n===void 0?t:(Ei(n,0,ls),e===void 0?e=r.rounding:Ei(e,0,8),Tt(t,n+t.e+1,e))};Je.toExponential=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Za(r,!0):(Ei(n,0,ls),e===void 0?e=i.rounding:Ei(e,0,8),r=Tt(new i(r),n+1,e),t=Za(r,!0,n+1)),r.isNeg()&&!r.isZero()?"-"+t:t};Je.toFixed=function(n,e){var t,r,i=this,a=i.constructor;return n===void 0?t=Za(i):(Ei(n,0,ls),e===void 0?e=a.rounding:Ei(e,0,8),r=Tt(new a(i),n+i.e+1,e),t=Za(r,!1,n+r.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Je.toFraction=function(n){var e,t,r,i,a,o,u,s,l,c,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(l=t=new d(1),r=s=new d(0),e=new d(r),a=e.e=dT(h)-m.e-1,o=a%Ot,e.d[0]=Fn(10,o<0?Ot+o:o),n==null)n=a>0?e:l;else{if(u=new d(n),!u.isInt()||u.lt(l))throw Error(us+u);n=u.gt(e)?a>0?e:l:u}for(Zt=!1,u=new d(Hn(h)),c=d.precision,d.precision=a=h.length*Ot*2;f=Hr(u,e,0,1,1),i=t.plus(f.times(r)),i.cmp(n)!=1;)t=r,r=i,i=l,l=s.plus(f.times(i)),s=i,i=e,e=u.minus(f.times(i)),u=i;return i=Hr(n.minus(t),r,0,1,1),s=s.plus(i.times(l)),t=t.plus(i.times(r)),s.s=l.s=m.s,p=Hr(l,r,a,1).minus(m).abs().cmp(Hr(s,t,a,1).minus(m).abs())<1?[l,r]:[s,t],d.precision=c,Zt=!0,p};Je.toHexadecimal=Je.toHex=function(n,e){return ry(this,16,n,e)};Je.toNearest=function(n,e){var t=this,r=t.constructor;if(t=new r(t),n==null){if(!t.d)return t;n=new r(1),e=r.rounding}else{if(n=new r(n),e===void 0?e=r.rounding:Ei(e,0,8),!t.d)return n.s?t:n;if(!n.d)return n.s&&(n.s=t.s),n}return n.d[0]?(Zt=!1,t=Hr(t,n,0,e,1).times(n),Zt=!0,Tt(t)):(n.s=t.s,t=n),t};Je.toNumber=function(){return+this};Je.toOctal=function(n,e){return ry(this,8,n,e)};Je.toPower=Je.pow=function(n){var e,t,r,i,a,o,u=this,s=u.constructor,l=+(n=new s(n));if(!u.d||!n.d||!u.d[0]||!n.d[0])return new s(Fn(+u,l));if(u=new s(u),u.eq(1))return u;if(r=s.precision,a=s.rounding,n.eq(1))return Tt(u,r,a);if(e=Kn(n.e/Ot),e>=n.d.length-1&&(t=l<0?-l:l)<=KH)return i=hT(s,u,t,r),n.s<0?new s(1).div(i):Tt(i,r,a);if(o=u.s,o<0){if(e<n.d.length-1)return new s(NaN);if(n.d[e]&1||(o=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=o,u}return t=Fn(+u,l),e=t==0||!isFinite(t)?Kn(l*(Math.log("0."+Hn(u.d))/Math.LN10+u.e+1)):new s(t+"").e,e>s.maxE+1||e<s.minE-1?new s(e>0?o/0:0):(Zt=!1,s.rounding=u.s=1,t=Math.min(12,(e+"").length),i=ey(n.times(ss(u,r+t)),r),i.d&&(i=Tt(i,r+5,1),Ac(i.d,r,a)&&(e=r+10,i=Tt(ey(n.times(ss(u,e+t)),e),e+5,1),+Hn(i.d).slice(r+1,r+15)+1==1e14&&(i=Tt(i,r+1,0)))),i.s=o,Zt=!0,s.rounding=a,Tt(i,r,a))};Je.toPrecision=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Za(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(Ei(n,1,ls),e===void 0?e=i.rounding:Ei(e,0,8),r=Tt(new i(r),n,e),t=Za(r,n<=r.e||r.e<=i.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+t:t};Je.toSignificantDigits=Je.toSD=function(n,e){var t=this,r=t.constructor;return n===void 0?(n=r.precision,e=r.rounding):(Ei(n,1,ls),e===void 0?e=r.rounding:Ei(e,0,8)),Tt(new r(t),n,e)};Je.toString=function(){var n=this,e=n.constructor,t=Za(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+t:t};Je.truncated=Je.trunc=function(){return Tt(new this.constructor(this),this.e+1,1)};Je.valueOf=Je.toJSON=function(){var n=this,e=n.constructor,t=Za(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+t:t};function Hn(n){var e,t,r,i=n.length-1,a="",o=n[0];if(i>0){for(a+=o,e=1;e<i;e++)r=n[e]+"",t=Ot-r.length,t&&(a+=os(t)),a+=r;o=n[e],r=o+"",t=Ot-r.length,t&&(a+=os(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Ei(n,e,t){if(n!==~~n||n<e||n>t)throw Error(us+n)}function Ac(n,e,t,r){var i,a,o,u;for(a=n[0];a>=10;a/=10)--e;return--e<0?(e+=Ot,i=0):(i=Math.ceil((e+1)/Ot),e%=Ot),a=Fn(10,Ot-e),u=n[i]%a|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),o=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):o=(t<4&&u+1==a||t>3&&u+1==a/2)&&(n[i+1]/a/100|0)==Fn(10,e-2)-1||(u==a/2||u==0)&&(n[i+1]/a/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),o=(r||t<4)&&u==9999||!r&&t>3&&u==4999):o=((r||t<4)&&u+1==a||!r&&t>3&&u+1==a/2)&&(n[i+1]/a/1e3|0)==Fn(10,e-3)-1,o}function wm(n,e,t){for(var r,i=[0],a,o=0,u=n.length;o<u;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=Xv.indexOf(n.charAt(o++)),r=0;r<i.length;r++)i[r]>t-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/t|0,i[r]%=t)}return i.reverse()}function tG(n,e){var t,r,i;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),i=(1/Dm(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),n.precision+=t,e=ll(n,1,e.times(i),new n(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=t,e}var Hr=function(){function n(r,i,a){var o,u=0,s=r.length;for(r=r.slice();s--;)o=r[s]*i+u,r[s]=o%a|0,u=o/a|0;return u&&r.unshift(u),r}function e(r,i,a,o){var u,s;if(a!=o)s=a>o?1:-1;else for(u=s=0;u<a;u++)if(r[u]!=i[u]){s=r[u]>i[u]?1:-1;break}return s}function t(r,i,a,o){for(var u=0;a--;)r[a]-=u,u=r[a]<i[a]?1:0,r[a]=u*o+r[a]-i[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,a,o,u,s){var l,c,f,p,m,h,d,v,y,S,b,w,A,x,D,E,_,N,P,B,V=r.constructor,z=r.s==i.s?1:-1,L=r.d,k=i.d;if(!L||!L[0]||!k||!k[0])return new V(!r.s||!i.s||(L?k&&L[0]==k[0]:!k)?NaN:L&&L[0]==0||!k?z*0:z/0);for(s?(m=1,c=r.e-i.e):(s=Pa,m=Ot,c=Kn(r.e/m)-Kn(i.e/m)),P=k.length,_=L.length,y=new V(z),S=y.d=[],f=0;k[f]==(L[f]||0);f++);if(k[f]>(L[f]||0)&&c--,a==null?(x=a=V.precision,o=V.rounding):u?x=a+(r.e-i.e)+1:x=a,x<0)S.push(1),h=!0;else{if(x=x/m+2|0,f=0,P==1){for(p=0,k=k[0],x++;(f<_||p)&&x--;f++)D=p*s+(L[f]||0),S[f]=D/k|0,p=D%k|0;h=p||f<_}else{for(p=s/(k[0]+1)|0,p>1&&(k=n(k,p,s),L=n(L,p,s),P=k.length,_=L.length),E=P,b=L.slice(0,P),w=b.length;w<P;)b[w++]=0;B=k.slice(),B.unshift(0),N=k[0],k[1]>=s/2&&++N;do p=0,l=e(k,b,P,w),l<0?(A=b[0],P!=w&&(A=A*s+(b[1]||0)),p=A/N|0,p>1?(p>=s&&(p=s-1),d=n(k,p,s),v=d.length,w=b.length,l=e(d,b,v,w),l==1&&(p--,t(d,P<v?B:k,v,s))):(p==0&&(l=p=1),d=k.slice()),v=d.length,v<w&&d.unshift(0),t(b,d,w,s),l==-1&&(w=b.length,l=e(k,b,P,w),l<1&&(p++,t(b,P<w?B:k,w,s))),w=b.length):l===0&&(p++,b=[0]),S[f++]=p,l&&b[0]?b[w++]=L[E]||0:(b=[L[E]],w=1);while((E++<_||b[0]!==void 0)&&x--);h=b[0]!==void 0}S[0]||S.shift()}if(m==1)y.e=c,lT=h;else{for(f=1,p=S[0];p>=10;p/=10)f++;y.e=f+c*m-1,Tt(y,u?a+y.e+1:a,o,h)}return y}}();function Tt(n,e,t,r){var i,a,o,u,s,l,c,f,p,m=n.constructor;e:if(e!=null){if(f=n.d,!f)return n;for(i=1,u=f[0];u>=10;u/=10)i++;if(a=e-i,a<0)a+=Ot,o=e,c=f[p=0],s=c/Fn(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Ot),u=f.length,p>=u)if(r){for(;u++<=p;)f.push(0);c=s=0,i=1,a%=Ot,o=a-Ot+1}else break e;else{for(c=u=f[p],i=1;u>=10;u/=10)i++;a%=Ot,o=a-Ot+i,s=o<0?0:c/Fn(10,i-o-1)%10|0}if(r=r||e<0||f[p+1]!==void 0||(o<0?c:c%Fn(10,i-o-1)),l=t<4?(s||r)&&(t==0||t==(n.s<0?3:2)):s>5||s==5&&(t==4||r||t==6&&(a>0?o>0?c/Fn(10,i-o):0:f[p-1])%10&1||t==(n.s<0?8:7)),e<1||!f[0])return f.length=0,l?(e-=n.e+1,f[0]=Fn(10,(Ot-e%Ot)%Ot),n.e=-e||0):f[0]=n.e=0,n;if(a==0?(f.length=p,u=1,p--):(f.length=p+1,u=Fn(10,Ot-a),f[p]=o>0?(c/Fn(10,i-o)%Fn(10,o)|0)*u:0),l)for(;;)if(p==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=u,u=1;o>=10;o/=10)u++;a!=u&&(n.e++,f[0]==Pa&&(f[0]=1));break}else{if(f[p]+=u,f[p]!=Pa)break;f[p--]=0,u=1}for(a=f.length;f[--a]===0;)f.pop()}return Zt&&(n.e>m.maxE?(n.d=null,n.e=NaN):n.e<m.minE&&(n.e=0,n.d=[0])),n}function Za(n,e,t){if(!n.isFinite())return vT(n);var r,i=n.e,a=Hn(n.d),o=a.length;return e?(t&&(r=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+os(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(n.e<0?"e":"e+")+n.e):i<0?(a="0."+os(-i-1)+a,t&&(r=t-o)>0&&(a+=os(r))):i>=o?(a+=os(i+1-o),t&&(r=t-i-1)>0&&(a=a+"."+os(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),t&&(r=t-o)>0&&(i+1===o&&(a+="."),a+=os(r))),a}function Em(n,e){var t=n[0];for(e*=Ot;t>=10;t/=10)e++;return e}function Am(n,e,t){if(e>eG)throw Zt=!0,t&&(n.precision=t),Error(cT);return Tt(new n(_m),e,1,!0)}function Ia(n,e,t){if(e>Kv)throw Error(cT);return Tt(new n(Sm),e,t,!0)}function dT(n){var e=n.length-1,t=e*Ot+1;if(e=n[e],e){for(;e%10==0;e/=10)t--;for(e=n[0];e>=10;e/=10)t++}return t}function os(n){for(var e="";n--;)e+="0";return e}function hT(n,e,t,r){var i,a=new n(1),o=Math.ceil(r/Ot+4);for(Zt=!1;;){if(t%2&&(a=a.times(e),sT(a.d,o)&&(i=!0)),t=Kn(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),sT(e.d,o)}return Zt=!0,a}function oT(n){return n.d[n.d.length-1]&1}function gT(n,e,t){for(var r,i=new n(e[0]),a=0;++a<e.length;)if(r=new n(e[a]),r.s)i[t](r)&&(i=r);else{i=r;break}return i}function ey(n,e){var t,r,i,a,o,u,s,l=0,c=0,f=0,p=n.constructor,m=p.rounding,h=p.precision;if(!n.d||!n.d[0]||n.e>17)return new p(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(e==null?(Zt=!1,s=h):s=e,u=new p(.03125);n.e>-2;)n=n.times(u),f+=5;for(r=Math.log(Fn(2,f))/Math.LN10*2+5|0,s+=r,t=a=o=new p(1),p.precision=s;;){if(a=Tt(a.times(n),s,1),t=t.times(++c),u=o.plus(Hr(a,t,s,1)),Hn(u.d).slice(0,s)===Hn(o.d).slice(0,s)){for(i=f;i--;)o=Tt(o.times(o),s,1);if(e==null)if(l<3&&Ac(o.d,s-r,m,l))p.precision=s+=10,t=a=u=new p(1),c=0,l++;else return Tt(o,p.precision=h,m,Zt=!0);else return p.precision=h,o}o=u}}function ss(n,e){var t,r,i,a,o,u,s,l,c,f,p,m=1,h=10,d=n,v=d.d,y=d.constructor,S=y.rounding,b=y.precision;if(d.s<0||!v||!v[0]||!d.e&&v[0]==1&&v.length==1)return new y(v&&!v[0]?-1/0:d.s!=1?NaN:v?0:d);if(e==null?(Zt=!1,c=b):c=e,y.precision=c+=h,t=Hn(v),r=t.charAt(0),Math.abs(a=d.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)d=d.times(n),t=Hn(d.d),r=t.charAt(0),m++;a=d.e,r>1?(d=new y("0."+t),a++):d=new y(r+"."+t.slice(1))}else return l=Am(y,c+2,b).times(a+""),d=ss(new y(r+"."+t.slice(1)),c-h).plus(l),y.precision=b,e==null?Tt(d,b,S,Zt=!0):d;for(f=d,s=o=d=Hr(d.minus(1),d.plus(1),c,1),p=Tt(d.times(d),c,1),i=3;;){if(o=Tt(o.times(p),c,1),l=s.plus(Hr(o,new y(i),c,1)),Hn(l.d).slice(0,c)===Hn(s.d).slice(0,c))if(s=s.times(2),a!==0&&(s=s.plus(Am(y,c+2,b).times(a+""))),s=Hr(s,new y(m),c,1),e==null)if(Ac(s.d,c-h,S,u))y.precision=c+=h,l=o=d=Hr(f.minus(1),f.plus(1),c,1),p=Tt(d.times(d),c,1),i=u=1;else return Tt(s,y.precision=b,S,Zt=!0);else return y.precision=b,s;s=l,i+=2}}function vT(n){return String(n.s*n.s/0)}function ty(n,e){var t,r,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,n.e=t=t-r-1,n.d=[],r=(t+1)%Ot,t<0&&(r+=Ot),r<i){for(r&&n.d.push(+e.slice(0,r)),i-=Ot;r<i;)n.d.push(+e.slice(r,r+=Ot));e=e.slice(r),r=Ot-e.length}else r-=i;for(;r--;)e+="0";n.d.push(+e),Zt&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function rG(n,e){var t,r,i,a,o,u,s,l,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),mT.test(e))return ty(n,e)}else if(e==="Infinity"||e==="NaN")return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(XH.test(e))t=16,e=e.toLowerCase();else if(JH.test(e))t=2;else if(QH.test(e))t=8;else throw Error(us+e);for(a=e.search(/p/i),a>0?(s=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,r=n.constructor,o&&(e=e.replace(".",""),u=e.length,a=u-a,i=hT(r,new r(t),a,a*2)),l=wm(e,t,Pa),c=l.length-1,a=c;l[a]===0;--a)l.pop();return a<0?new r(n.s*0):(n.e=Em(l,c),n.d=l,Zt=!1,o&&(n=Hr(n,i,u*4)),s&&(n=n.times(Math.abs(s)<54?Fn(2,s):Mc.pow(2,s))),Zt=!0,n)}function nG(n,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:ll(n,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/Dm(5,t)),e=ll(n,2,e,e);for(var i,a=new n(5),o=new n(16),u=new n(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(u))));return e}function ll(n,e,t,r,i){var a,o,u,s,l=1,c=n.precision,f=Math.ceil(c/Ot);for(Zt=!1,s=t.times(t),u=new n(r);;){if(o=Hr(u.times(s),new n(e++*e++),c,1),u=i?r.plus(o):r.minus(o),r=Hr(o.times(s),new n(e++*e++),c,1),o=u.plus(r),o.d[f]!==void 0){for(a=f;o.d[a]===u.d[a]&&a--;);if(a==-1)break}a=u,u=r,r=o,o=a,l++}return Zt=!0,o.d.length=f+1,o}function Dm(n,e){for(var t=n;--e;)t*=n;return t}function yT(n,e){var t,r=e.s<0,i=Ia(n,n.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Mo=r?4:1,e;if(t=e.divToInt(i),t.isZero())Mo=r?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return Mo=oT(t)?r?2:3:r?4:1,e;Mo=oT(t)?r?1:4:r?3:2}return e.minus(i).abs()}function ry(n,e,t,r){var i,a,o,u,s,l,c,f,p,m=n.constructor,h=t!==void 0;if(h?(Ei(t,1,ls),r===void 0?r=m.rounding:Ei(r,0,8)):(t=m.precision,r=m.rounding),!n.isFinite())c=vT(n);else{for(c=Za(n),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=wm(Za(p),10,i),p.e=p.d.length),f=wm(c,10,i),a=s=f.length;f[--s]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(n=new m(n),n.d=f,n.e=a,n=Hr(n,p,t,r,0,i),f=n.d,a=n.e,l=lT),o=f[t],u=i/2,l=l||f[t+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(n.s<0?3:2)):o>u||o===u&&(r===4||l||r===6&&f[t-1]&1||r===(n.s<0?8:7)),f.length=t,l)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(s=f.length;!f[s-1];--s);for(o=0,c="";o<s;o++)c+=Xv.charAt(f[o]);if(h){if(s>1)if(e==16||e==8){for(o=e==16?4:3,--s;s%o;s++)c+="0";for(f=wm(c,i,e),s=f.length;!f[s-1];--s);for(o=1,c="1.";o<s;o++)c+=Xv.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>s)for(a-=s;a--;)c+="0";else a<s&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return n.s<0?"-"+c:c}function sT(n,e){if(n.length>e)return n.length=e,!0}function iG(n){return new this(n).abs()}function aG(n){return new this(n).acos()}function oG(n){return new this(n).acosh()}function sG(n,e){return new this(n).plus(e)}function uG(n){return new this(n).asin()}function lG(n){return new this(n).asinh()}function cG(n){return new this(n).atan()}function fG(n){return new this(n).atanh()}function pG(n,e){n=new this(n),e=new this(e);var t,r=this.precision,i=this.rounding,a=r+4;return!n.s||!e.s?t=new this(NaN):!n.d&&!e.d?(t=Ia(this,a,1).times(e.s>0?.25:.75),t.s=n.s):!e.d||n.isZero()?(t=e.s<0?Ia(this,r,i):new this(0),t.s=n.s):!n.d||e.isZero()?(t=Ia(this,a,1).times(.5),t.s=n.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(Hr(n,e,a,1)),e=Ia(this,a,1),this.precision=r,this.rounding=i,t=n.s<0?t.minus(e):t.plus(e)):t=this.atan(Hr(n,e,a,1)),t}function mG(n){return new this(n).cbrt()}function dG(n){return Tt(n=new this(n),n.e+1,2)}function hG(n,e,t){return new this(n).clamp(e,t)}function gG(n){if(!n||typeof n!="object")throw Error(Mm+"Object expected");var e,t,r,i=n.defaults===!0,a=["precision",1,ls,"rounding",0,8,"toExpNeg",-ul,0,"toExpPos",0,ul,"maxE",0,ul,"minE",-ul,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(t=a[e],i&&(this[t]=Qv[t]),(r=n[t])!==void 0)if(Kn(r)===r&&r>=a[e+1]&&r<=a[e+2])this[t]=r;else throw Error(us+t+": "+r);if(t="crypto",i&&(this[t]=Qv[t]),(r=n[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(fT);else this[t]=!1;else throw Error(us+t+": "+r);return this}function vG(n){return new this(n).cos()}function yG(n){return new this(n).cosh()}function bT(n){var e,t,r;function i(a){var o,u,s,l=this;if(!(l instanceof i))return new i(a);if(l.constructor=i,uT(a)){l.s=a.s,Zt?!a.d||a.e>i.maxE?(l.e=NaN,l.d=null):a.e<i.minE?(l.e=0,l.d=[0]):(l.e=a.e,l.d=a.d.slice()):(l.e=a.e,l.d=a.d?a.d.slice():a.d);return}if(s=typeof a,s==="number"){if(a===0){l.s=1/a<0?-1:1,l.e=0,l.d=[0];return}if(a<0?(a=-a,l.s=-1):l.s=1,a===~~a&&a<1e7){for(o=0,u=a;u>=10;u/=10)o++;Zt?o>i.maxE?(l.e=NaN,l.d=null):o<i.minE?(l.e=0,l.d=[0]):(l.e=o,l.d=[a]):(l.e=o,l.d=[a]);return}else if(a*0!==0){a||(l.s=NaN),l.e=NaN,l.d=null;return}return ty(l,a.toString())}else if(s!=="string")throw Error(us+a);return(u=a.charCodeAt(0))===45?(a=a.slice(1),l.s=-1):(u===43&&(a=a.slice(1)),l.s=1),mT.test(a)?ty(l,a):rG(l,a)}if(i.prototype=Je,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=gG,i.clone=bT,i.isDecimal=uT,i.abs=iG,i.acos=aG,i.acosh=oG,i.add=sG,i.asin=uG,i.asinh=lG,i.atan=cG,i.atanh=fG,i.atan2=pG,i.cbrt=mG,i.ceil=dG,i.clamp=hG,i.cos=vG,i.cosh=yG,i.div=bG,i.exp=xG,i.floor=wG,i.hypot=_G,i.ln=SG,i.log=AG,i.log10=EG,i.log2=MG,i.max=DG,i.min=NG,i.mod=TG,i.mul=CG,i.pow=FG,i.random=IG,i.round=PG,i.sign=kG,i.sin=BG,i.sinh=OG,i.sqrt=RG,i.sub=LG,i.sum=VG,i.tan=UG,i.tanh=qG,i.trunc=zG,n===void 0&&(n={}),n&&n.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)n.hasOwnProperty(t=r[e++])||(n[t]=this[t]);return i.config(n),i}function bG(n,e){return new this(n).div(e)}function xG(n){return new this(n).exp()}function wG(n){return Tt(n=new this(n),n.e+1,3)}function _G(){var n,e,t=new this(0);for(Zt=!1,n=0;n<arguments.length;)if(e=new this(arguments[n++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Zt=!0,new this(1/0);t=e}return Zt=!0,t.sqrt()}function uT(n){return n instanceof Mc||n&&n.toStringTag===pT||!1}function SG(n){return new this(n).ln()}function AG(n,e){return new this(n).log(e)}function MG(n){return new this(n).log(2)}function EG(n){return new this(n).log(10)}function DG(){return gT(this,arguments,"lt")}function NG(){return gT(this,arguments,"gt")}function TG(n,e){return new this(n).mod(e)}function CG(n,e){return new this(n).mul(e)}function FG(n,e){return new this(n).pow(e)}function IG(n){var e,t,r,i,a=0,o=new this(1),u=[];if(n===void 0?n=this.precision:Ei(n,1,ls),r=Math.ceil(n/Ot),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));a<r;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);a<r;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(u.push(i%1e7),a+=4);a=r/4}else throw Error(fT);else for(;a<r;)u[a++]=Math.random()*1e7|0;for(r=u[--a],n%=Ot,r&&n&&(i=Fn(10,Ot-n),u[a]=(r/i|0)*i);u[a]===0;a--)u.pop();if(a<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Ot)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<Ot&&(t-=Ot-r)}return o.e=t,o.d=u,o}function PG(n){return Tt(n=new this(n),n.e+1,this.rounding)}function kG(n){return n=new this(n),n.d?n.d[0]?n.s:0*n.s:n.s||NaN}function BG(n){return new this(n).sin()}function OG(n){return new this(n).sinh()}function RG(n){return new this(n).sqrt()}function LG(n,e){return new this(n).sub(e)}function VG(){var n=0,e=arguments,t=new this(e[n]);for(Zt=!1;t.s&&++n<e.length;)t=t.plus(e[n]);return Zt=!0,Tt(t,this.precision,this.rounding)}function UG(n){return new this(n).tan()}function qG(n){return new this(n).tanh()}function zG(n){return Tt(n=new this(n),n.e+1,1)}Je[Symbol.for("nodejs.util.inspect.custom")]=Je.toString;Je[Symbol.toStringTag]="Decimal";var Mc=Je.constructor=bT(Qv);_m=new Mc(_m);Sm=new Mc(Sm);var Ks=Mc;var $G="BigNumber",HG=["?on","config"],ny=T($G,HG,n=>{var{on:e,config:t}=n,r=Ks.clone({precision:t.precision,modulo:Ks.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(i){return new r(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&r.config({precision:i.precision})}),r},{isClass:!0});var On=wr(wT(),1);var GG="Complex",WG=[],ay=T(GG,WG,()=>(Object.defineProperty(On.default,"name",{value:"Complex"}),On.default.prototype.constructor=On.default,On.default.prototype.type="Complex",On.default.prototype.isComplex=!0,On.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},On.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},On.default.prototype.format=function(n){var e="",t=this.im,r=this.re,i=Ca(this.re,n),a=Ca(this.im,n),o=At(n)?n:n?n.precision:null;if(o!==null){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return t===0?e=i:r===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},On.default.fromPolar=function(n){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,On.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],r=arguments[1];if(At(t)){if(Un(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),At(r))return new On.default({r:t,phi:r});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")}},On.default.prototype.valueOf=On.default.prototype.toString,On.default.fromJSON=function(n){return new On.default(n)},On.default.compare=function(n,e){return n.re>e.re?1:n.re<e.re?-1:n.im>e.im?1:n.im<e.im?-1:0},On.default),{isClass:!0});var Ja=wr(ST(),1);var YG="Fraction",jG=[],sy=T(YG,jG,()=>(Object.defineProperty(Ja.default,"name",{value:"Fraction"}),Ja.default.prototype.constructor=Ja.default,Ja.default.prototype.type="Fraction",Ja.default.prototype.isFraction=!0,Ja.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Ja.default.fromJSON=function(n){return new Ja.default(n)},Ja.default),{isClass:!0});var ZG="Range",JG=[],uy=T(ZG,JG,()=>{function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=r!=null;if(i){if(pt(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(pt(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(pt(r))r=r.toNumber();else if(typeof r!="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(r):1}return n.prototype.type="Range",n.prototype.isRange=!0,n.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),r=t.map(function(a){return parseFloat(a)}),i=r.some(function(a){return isNaN(a)});if(i)return null;switch(r.length){case 2:return new n(r[0],r[1]);case 3:return new n(r[0],r[2],r[1]);default:return null}},n.prototype.clone=function(){return new n(this.start,this.end,this.step)},n.prototype.size=function(){var e=0,t=this.start,r=this.step,i=this.end,a=i-t;return sa(r)===sa(a)?e=Math.ceil(a/r):a===0&&(e=0),isNaN(e)&&(e=0),[e]},n.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},n.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},n.prototype.forEach=function(e){var t=this.start,r=this.step,i=this.end,a=0;if(r>0)for(;t<i;)e(t,[a],this),t+=r,a++;else if(r<0)for(;t>i;)e(t,[a],this),t+=r,a++},n.prototype.map=function(e){var t=[];return this.forEach(function(r,i,a){t[i[0]]=e(r,i,a)}),t},n.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},n.prototype.valueOf=function(){return this.toArray()},n.prototype.format=function(e){var t=Ca(this.start,e);return this.step!==1&&(t+=":"+Ca(this.step,e)),t+=":"+Ca(this.end,e),t},n.prototype.toString=function(){return this.format()},n.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},n.fromJSON=function(e){return new n(e.start,e.end,e.step)},n},{isClass:!0});var XG="Matrix",QG=[],ly=T(XG,QG,()=>{function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator")}return n.prototype.type="Matrix",n.prototype.isMatrix=!0,n.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},n.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},n.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},n.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},n.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},n.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},n.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},n.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},n.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},n.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},n.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},n.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},n.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},n.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},n.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},n.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},n.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},n},{isClass:!0});function AT(n){var e=0,t=1,r=Object.create(null),i=Object.create(null),a=0,o=function(s){var l=i[s];if(l&&(delete r[l],delete i[s],--e,t===l)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(r,++t););}};return n=Math.abs(n),{hit:function(s){var l=i[s],c=++a;if(r[c]=s,i[s]=c,!l)return++e,e<=n?void 0:(s=r[t],o(s),s);if(delete r[l],t===l)for(;!Object.prototype.hasOwnProperty.call(r,++t););},delete:o,clear:function(){e=a=0,t=1,r=Object.create(null),i=Object.create(null)}}}function eu(n){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function r(){typeof r.cache!="object"&&(r.cache={values:new Map,lru:AT(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(r.cache.values.has(o))return r.cache.lru.hit(o),r.cache.values.get(o);var u=n.apply(n,i);return r.cache.values.set(o,u),r.cache.values.delete(r.cache.lru.hit(o)),u}}function Nm(n){return Object.keys(n.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var KG="DenseMatrix",eW=["Matrix"],cy=T(KG,eW,n=>{var{Matrix:e}=n;function t(c,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!tn(f))throw new Error("Invalid datatype: "+f);if(ot(c))c.type==="DenseMatrix"?(this._data=vt(c._data),this._size=vt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&nr(c.data)&&nr(c.size))this._data=c.data,this._size=c.size,qv(this._data,this._size),this._datatype=f||c.datatype;else if(nr(c))this._data=l(c),this._size=_t(this._data),qv(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+Kt(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 is(this._data,Kt)},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 r(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(!nr(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new Dt(c.length,this._size.length);for(var f=0;f<c.length;f++)br(c[f],this._size[f]);for(var p=this._data,m=0,h=c.length;m<h;m++){var d=c[m];br(d,p.length),p=p[d]}return p},t.prototype.set=function(c,f,p){if(!nr(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Dt(c.length,this._size.length,"<");var m,h,d,v=c.map(function(S){return S+1});s(this,v,p);var y=this._data;for(m=0,h=c.length-1;m<h;m++)d=c[m],br(d,y.length),y=y[d];return d=c[c.length-1],br(d,y.length),y[d]=f,this};function r(c,f){if(!es(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 Dt(m.length,c._size.length);for(var h=f.min(),d=f.max(),v=0,y=c._size.length;v<y;v++)br(h[v],c._size[v]),br(d[v],c._size[v]);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(v){return br(v,c.length),c[v]}).valueOf():d.map(function(v){br(v,c.length);var y=c[v];return i(y,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(),v;if(ot(p)?(v=p.size(),p=p.valueOf()):v=_t(p),d){if(v.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),p,m)}else{if(!Ta(v,h))try{v.length===0?p=Hv([p],h):p=Hv(p,h),v=_t(p)}catch{}if(h.length<c._size.length)throw new Dt(h.length,c._size.length,"<");if(v.length<h.length){for(var y=0,S=0;h[y]===1&&v[y]===1;)y++;for(;h[y]===1;)S++,y++;p=vm(p,h.length,S,v)}if(!Ta(h,v))throw new Dt(h,v,">");var b=f.max().map(function(x){return x+1});s(c,b,m);var w=h.length,A=0;o(c._data,f,p,w,A)}return c}function o(c,f,p,m,h){var d=h===m-1,v=f.dimension(h);d?v.forEach(function(y,S){br(y),c[y]=p[S[0]]}):v.forEach(function(y,S){br(y),o(c[y],f,p[S[0]],m,h+1)})}t.prototype.resize=function(c,f,p){if(!un(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 u(h,m,f)};function u(c,f,p){if(f.length===0){for(var m=c._data;nr(m);)m=m[0];return m}return c._size=f.slice(0),c._data=Fa(c._data,c._size,p),c}t.prototype.reshape=function(c,f){var p=f?this.clone():this;p._data=wc(p._data,c);var m=p._size.reduce((h,d)=>h*d);return p._size=_c(c,m),p};function s(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,v=f.length;d<v;d++)f[d]>m[d]&&(m[d]=f[d],h=!0);h&&u(c,m,p)}t.prototype.clone=function(){var c=new t({data:vt(this._data),size:vt(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=Nm(c),m=function v(y,S){return nr(y)?y.map(function(b,w){return v(b,S.concat(w))}):p===1?c(y):p===2?c(y,S):c(y,S,f)},h=m(this._data,[]),d=this._datatype!==void 0?is(h,Kt):void 0;return new t(h,d)},t.prototype.forEach=function(c){var f=this,p=function m(h,d){nr(h)?h.forEach(function(v,y){m(v,d.concat(y))}):c(h,d,f)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var c=function*f(p,m){if(nr(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(y){var S=m.map(b=>[b[y]]);f.push(new t(S,c._datatype))},d=0;d<p[1];d++)h(d);return f},t.prototype.toArray=function(){return vt(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(c){return Mt(this._data,c)},t.prototype.toString=function(){return Mt(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(pt(c)&&(c=c.toNumber()),!At(c)||!nt(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),v=[],y=0;y<d;y++)v[y]=this._data[y+p][y+f];return new t({data:v,size:[d],datatype:this._datatype})},t.diagonal=function(c,f,p,m){if(!nr(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(D){if(pt(D)&&(D=D.toNumber()),!At(D)||!nt(D)||D<1)throw new Error("Size values must be positive integers");return D}),p){if(pt(p)&&(p=p.toNumber()),!At(p)||!nt(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,v=c[0],y=c[1],S=Math.min(v-d,y-h),b;if(nr(f)){if(f.length!==S)throw new Error("Invalid value array length");b=function(E){return f[E]}}else if(ot(f)){var w=f.size();if(w.length!==1||w[0]!==S)throw new Error("Invalid matrix length");b=function(E){return f.get([E])}}else b=function(){return f};m||(m=pt(b(0))?b(0).mul(0):0);var A=[];if(c.length>0){A=Fa(A,c,m);for(var x=0;x<S;x++)A[x+d][x+h]=b(x)}return new t({data:A,size:[v,y]})},t.fromJSON=function(c){return new t(c)},t.prototype.swapRows=function(c,f){if(!At(c)||!nt(c)||!At(f)||!nt(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 br(c,this._size[0]),br(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 l(c){return ot(c)?l(c.valueOf()):nr(c)?c.map(l):c}return t},{isClass:!0});var MT="clone",tW=["typed"],fy=T(MT,tW,n=>{var{typed:e}=n;return e(MT,{any:vt})});function Tm(n){var e=n.length,t=n[0].length,r,i,a=[];for(i=0;i<t;i++){var o=[];for(r=0;r<e;r++)o.push(n[r][i]);a.push(o)}return a}function ua(n){for(var e=0;e<n.length;e++)if(un(n[e]))return!0;return!1}function ei(n,e){ot(n)&&(n=n.valueOf());for(var t=0,r=n.length;t<r;t++){var i=n[t];Array.isArray(i)?ei(i,e):e(i)}}function lt(n,e,t){return n&&typeof n.map=="function"?n.map(function(r){return lt(r,e,t)}):e(n)}function cs(n,e,t){var r=Array.isArray(n)?_t(n):n.size();if(e<0||e>=r.length)throw new $n(e,r.length);return ot(n)?n.create(Cm(n.valueOf(),e,t)):Cm(n,e,t)}function Cm(n,e,t){var r,i,a,o;if(e<=0)if(Array.isArray(n[0])){for(o=Tm(n),i=[],r=0;r<o.length;r++)i[r]=Cm(o[r],e-1,t);return i}else{for(a=n[0],r=1;r<n.length;r++)a=t(a,n[r]);return a}else{for(i=[],r=0;r<n.length;r++)i[r]=Cm(n[r],e-1,t);return i}}function py(n,e,t,r,i,a,o,u,s,l,c){var f=n._values,p=n._index,m=n._ptr,h,d,v,y;if(r)for(d=m[e],v=m[e+1],h=d;h<v;h++)y=p[h],t[y]!==a?(t[y]=a,o.push(y),l?(r[y]=s?u(f[h],c):u(c,f[h]),i[y]=a):r[y]=f[h]):(r[y]=s?u(f[h],r[y]):u(r[y],f[h]),i[y]=a);else for(d=m[e],v=m[e+1],h=d;h<v;h++)y=p[h],t[y]!==a?(t[y]=a,o.push(y)):i[y]=a}var ET="isInteger",rW=["typed"],my=T(ET,rW,n=>{var{typed:e}=n;return e(ET,{number:nt,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var Di="number",Eo="number, number";function dy(n){return Math.abs(n)}dy.signature=Di;function hy(n,e){return n+e}hy.signature=Eo;function gy(n,e){return n-e}gy.signature=Eo;function vy(n,e){return n*e}vy.signature=Eo;function nW(n,e){return n/e}nW.signature=Eo;function yy(n){return-n}yy.signature=Di;function by(n){return n}by.signature=Di;function cl(n){return PN(n)}cl.signature=Di;function xy(n){return n*n*n}xy.signature=Di;function wy(n){return Math.exp(n)}wy.signature=Di;function _y(n){return kN(n)}_y.signature=Di;function iW(n,e){if(!nt(n)||!nt(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=n%e,n=e,e=t;return n<0?-n:n}iW.signature=Eo;function Sy(n,e){if(!nt(n)||!nt(e))throw new Error("Parameters in function lcm must be integer numbers");if(n===0||e===0)return 0;for(var t,r=n*e;e!==0;)t=e,e=n%t,n=t;return Math.abs(r/n)}Sy.signature=Eo;function DT(n,e){return e?Math.log(n)/Math.log(e):Math.log(n)}function Ay(n){return IN(n)}Ay.signature=Di;function My(n){return FN(n)}My.signature=Di;function aW(n){return pm(n)}aW.signature=Di;function oW(n,e){return e===0?n:n-e*Math.floor(n/e)}oW.signature=Eo;function Ey(n){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(n<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(n===0)return t?1/0:0;if(!isFinite(n))return t?0:n;var r=Math.pow(Math.abs(n),1/e);return r=n<0?-r:r,t?1/r:r}function Fm(n){return sa(n)}Fm.signature=Di;function sW(n){return Math.sqrt(n)}sW.signature=Di;function Dy(n){return n*n}Dy.signature=Di;function Ny(n,e){var t,r,i,a=0,o=1,u=1,s=0;if(!nt(n)||!nt(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)r=Math.floor(n/e),i=n-r*e,t=a,a=o-r*a,o=t,t=u,u=s-r*u,s=t,n=e,e=i;var l;return n<0?l=[-n,-o,-s]:l=[n,n?o:0,s],l}Ny.signature=Eo;function Ty(n,e){return n*n<1&&e===1/0||n*n>1&&e===-1/0?0:Math.pow(n,e)}Ty.signature=Eo;function fl(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!nt(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(Lv(n,e))}function uW(n){return Math.abs(n)}uW.signature=Di;var lW="number",pl="number, number";function Cy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitAnd");return n&e}Cy.signature=pl;function Fy(n){if(!nt(n))throw new Error("Integer expected in function bitNot");return~n}Fy.signature=lW;function Iy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitOr");return n|e}Iy.signature=pl;function Py(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitXor");return n^e}Py.signature=pl;function ky(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function leftShift");return n<<e}ky.signature=pl;function By(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function rightArithShift");return n>>e}By.signature=pl;function Oy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function rightLogShift");return n>>>e}Oy.signature=pl;function $i(n,e){if(e<n)return 1;if(e===n)return e;var t=e+n>>1;return $i(n,t)*$i(t+1,e)}function Ry(n,e){if(!nt(n)||n<0)throw new TypeError("Positive integer value expected in function combinations");if(!nt(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>n)throw new TypeError("k must be less than or equal to n");for(var t=n-e,r=1,i=e<t?t+1:e+1,a=2,o=e<t?e:t,u=i;u<=n;++u)for(r*=u;a<=o&&r%a===0;)r/=a,++a;return a<=o&&(r/=$i(a,o)),r}Ry.signature="number, number";var NT=Math.PI,TT=2*Math.PI,CT=Math.E,FT=1.618033988749895;var cW="number",Ly="number, number";function Vy(n){return!n}Vy.signature=cW;function Uy(n,e){return!!(n||e)}Uy.signature=Ly;function qy(n,e){return!!n!=!!e}qy.signature=Ly;function zy(n,e){return!!(n&&e)}zy.signature=Ly;function Ec(n){var e;if(nt(n))return n<=0?isFinite(n)?1/0:NaN:n>171?1/0:$i(1,n-1);if(n<.5)return Math.PI/(Math.sin(Math.PI*n)*Ec(1-n));if(n>=171.35)return 1/0;if(n>85){var t=n*n,r=t*n,i=r*n,a=i*n;return Math.sqrt(2*Math.PI/n)*Math.pow(n/Math.E,n)*(1+1/(12*n)+1/(288*t)-139/(51840*r)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*n))}--n,e=tu[0];for(var o=1;o<tu.length;++o)e+=tu[o]/(n+o);var u=n+$y+.5;return Math.sqrt(2*Math.PI)*Math.pow(u,n+.5)*Math.exp(-u)*e}Ec.signature="number";var $y=4.7421875,tu=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Hy=.9189385332046728,fW=5,pW=7,IT=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Dc(n){if(n<0)return NaN;if(n===0)return 1/0;if(!isFinite(n))return n;if(n<.5)return Math.log(Math.PI/Math.sin(Math.PI*n))-Dc(1-n);n=n-1;for(var e=n+fW+.5,t=IT[0],r=pW-1;r>=1;r--)t+=IT[r]/(n+r);return Hy+(n+.5)*Math.log(e)-e+Math.log(t)}Dc.signature="number";var rn="number",mW="number, number";function dW(n){return Math.acos(n)}dW.signature=rn;function Gy(n){return RN(n)}Gy.signature=rn;function Wy(n){return Math.atan(1/n)}Wy.signature=rn;function Yy(n){return isFinite(n)?(Math.log((n+1)/n)+Math.log(n/(n-1)))/2:0}Yy.signature=rn;function jy(n){return Math.asin(1/n)}jy.signature=rn;function Zy(n){var e=1/n;return Math.log(e+Math.sqrt(e*e+1))}Zy.signature=rn;function Jy(n){return Math.acos(1/n)}Jy.signature=rn;function Xy(n){var e=1/n,t=Math.sqrt(e*e-1);return Math.log(t+e)}Xy.signature=rn;function hW(n){return Math.asin(n)}hW.signature=rn;function Qy(n){return LN(n)}Qy.signature=rn;function gW(n){return Math.atan(n)}gW.signature=rn;function vW(n,e){return Math.atan2(n,e)}vW.signature=mW;function Ky(n){return VN(n)}Ky.signature=rn;function yW(n){return Math.cos(n)}yW.signature=rn;function bW(n){return dm(n)}bW.signature=rn;function e0(n){return 1/Math.tan(n)}e0.signature=rn;function t0(n){var e=Math.exp(2*n);return(e+1)/(e-1)}t0.signature=rn;function r0(n){return 1/Math.sin(n)}r0.signature=rn;function n0(n){return n===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(n)-Math.exp(-n)))*sa(n)}n0.signature=rn;function i0(n){return 1/Math.cos(n)}i0.signature=rn;function a0(n){return 2/(Math.exp(n)+Math.exp(-n))}a0.signature=rn;function xW(n){return Math.sin(n)}xW.signature=rn;function o0(n){return UN(n)}o0.signature=rn;function wW(n){return Math.tan(n)}wW.signature=rn;function _W(n){return hm(n)}_W.signature=rn;var Nc="number";function SW(n){return nt(n)}SW.signature=Nc;function s0(n){return n<0}s0.signature=Nc;function u0(n){return n>0}u0.signature=Nc;function l0(n){return n===0}l0.signature=Nc;function c0(n){return Number.isNaN(n)}c0.signature=Nc;var PT="isNegative",AW=["typed"],f0=T(PT,AW,n=>{var{typed:e}=n;return e(PT,{number:s0,BigNumber:function(r){return r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s<0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var kT="isNumeric",MW=["typed"],p0=T(kT,MW,n=>{var{typed:e}=n;return e(kT,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var BT="hasNumericValue",EW=["typed","isNumeric"],m0=T(BT,EW,n=>{var{typed:e,isNumeric:t}=n;return e(BT,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var OT="isPositive",DW=["typed"],d0=T(OT,DW,n=>{var{typed:e}=n;return e(OT,{number:u0,BigNumber:function(r){return!r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s>0&&r.n>0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var RT="isZero",NW=["typed"],h0=T(RT,NW,n=>{var{typed:e}=n;return e(RT,{number:l0,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var LT="isNaN",TW=["typed"],g0=T(LT,TW,n=>{var{typed:e}=n;return e(LT,{number:c0,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return lt(r,Number.isNaN)}})});var VT="typeOf",CW=["typed"],v0=T(VT,CW,n=>{var{typed:e}=n;return e(VT,{any:Kt})});function gn(n,e,t){if(t==null)return n.eq(e);if(n.eq(e))return!0;if(n.isNaN()||e.isNaN())return!1;if(n.isFinite()&&e.isFinite()){var r=n.minus(e).abs();if(r.isZero())return!0;var i=n.constructor.max(n.abs(),e.abs());return r.lte(i.times(t))}return!1}function UT(n,e,t){return Jr(n.re,e.re,t)&&Jr(n.im,e.im,t)}var la=T("compareUnits",["typed"],n=>{var{typed:e}=n;return{"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(!r.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),i.valueType()])(r.value,i.value)})}});var Im="equalScalar",FW=["typed","config"],y0=T(Im,FW,n=>{var{typed:e,config:t}=n,r=la({typed:e});return e(Im,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Jr(a,o,t.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||gn(a,o,t.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return UT(a,o,t.epsilon)}},r)}),Kge=T(Im,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Im,{"number, number":function(i,a){return Jr(i,a,t.epsilon)}})});var IW="SparseMatrix",PW=["typed","equalScalar","Matrix"],b0=T(IW,PW,n=>{var{typed:e,equalScalar:t,Matrix:r}=n;function i(d,v){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(v&&!tn(v))throw new Error("Invalid datatype: "+v);if(ot(d))a(this,d,v);else if(d&&nr(d.index)&&nr(d.ptr)&&nr(d.size))this._values=d.values,this._index=d.index,this._ptr=d.ptr,this._size=d.size,this._datatype=v||d.datatype;else if(nr(d))o(this,d,v);else{if(d)throw new TypeError("Unsupported type of data ("+Kt(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=v}}function a(d,v,y){v.type==="SparseMatrix"?(d._values=v._values?vt(v._values):void 0,d._index=vt(v._index),d._ptr=vt(v._ptr),d._size=vt(v._size),d._datatype=y||v._datatype):o(d,v.valueOf(),y||v._datatype)}function o(d,v,y){d._values=[],d._index=[],d._ptr=[],d._datatype=y;var S=v.length,b=0,w=t,A=0;if(tn(y)&&(w=e.find(t,[y,y])||t,A=e.convert(0,y)),S>0){var x=0;do{d._ptr.push(d._index.length);for(var D=0;D<S;D++){var E=v[D];if(nr(E)){if(x===0&&b<E.length&&(b=E.length),x<E.length){var _=E[x];w(_,A)||(d._values.push(_),d._index.push(D))}}else x===0&&b<1&&(b=1),w(E,A)||(d._values.push(E),d._index.push(D))}x++}while(x<b)}d._ptr.push(d._index.length),d._size=[S,b]}i.prototype=new r,i.prototype.createSparseMatrix=function(d,v){return new i(d,v)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return is(this._values,Kt)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(d,v){return new i(d,v)},i.prototype.density=function(){var d=this._size[0],v=this._size[1];return d!==0&&v!==0?this._index.length/(d*v):0},i.prototype.subset=function(d,v,y){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return u(this,d);case 2:case 3:return s(this,d,v,y);default:throw new SyntaxError("Wrong number of arguments")}};function u(d,v){if(!es(v))throw new TypeError("Invalid index");var y=v.isScalar();if(y)return d.get(v.min());var S=v.size();if(S.length!==d._size.length)throw new Dt(S.length,d._size.length);var b,w,A,x,D=v.min(),E=v.max();for(b=0,w=d._size.length;b<w;b++)br(D[b],d._size[b]),br(E[b],d._size[b]);var _=d._values,N=d._index,P=d._ptr,B=v.dimension(0),V=v.dimension(1),z=[],L=[];B.forEach(function(O,H){L[O]=H[0],z[O]=!0});var k=_?[]:void 0,C=[],W=[];return V.forEach(function(O){for(W.push(C.length),A=P[O],x=P[O+1];A<x;A++)b=N[A],z[b]===!0&&(C.push(L[b]),k&&k.push(_[A]))}),W.push(C.length),new i({values:k,index:C,ptr:W,size:S,datatype:d._datatype})}function s(d,v,y,S){if(!v||v.isIndex!==!0)throw new TypeError("Invalid index");var b=v.size(),w=v.isScalar(),A;if(ot(y)?(A=y.size(),y=y.toArray()):A=_t(y),w){if(A.length!==0)throw new TypeError("Scalar expected");d.set(v.min(),y,S)}else{if(b.length!==1&&b.length!==2)throw new Dt(b.length,d._size.length,"<");if(A.length<b.length){for(var x=0,D=0;b[x]===1&&A[x]===1;)x++;for(;b[x]===1;)D++,x++;y=vm(y,b.length,D,A)}if(!Ta(b,A))throw new Dt(b,A,">");if(b.length===1){var E=v.dimension(0);E.forEach(function(P,B){br(P),d.set([P,0],y[B[0]],S)})}else{var _=v.dimension(0),N=v.dimension(1);_.forEach(function(P,B){br(P),N.forEach(function(V,z){br(V),d.set([P,V],y[B[0]][z[0]],S)})})}}return d}i.prototype.get=function(d){if(!nr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Dt(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var v=d[0],y=d[1];br(v,this._size[0]),br(y,this._size[1]);var S=l(v,this._ptr[y],this._ptr[y+1],this._index);return S<this._ptr[y+1]&&this._index[S]===v?this._values[S]:0},i.prototype.set=function(d,v,y){if(!nr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Dt(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var S=d[0],b=d[1],w=this._size[0],A=this._size[1],x=t,D=0;tn(this._datatype)&&(x=e.find(t,[this._datatype,this._datatype])||t,D=e.convert(0,this._datatype)),(S>w-1||b>A-1)&&(p(this,Math.max(S+1,w),Math.max(b+1,A),y),w=this._size[0],A=this._size[1]),br(S,w),br(b,A);var E=l(S,this._ptr[b],this._ptr[b+1],this._index);return E<this._ptr[b+1]&&this._index[E]===S?x(v,D)?c(E,b,this._values,this._index,this._ptr):this._values[E]=v:x(v,D)||f(E,S,b,v,this._values,this._index,this._ptr),this};function l(d,v,y,S){if(y-v===0)return y;for(var b=v;b<y;b++)if(S[b]===d)return b;return v}function c(d,v,y,S,b){y.splice(d,1),S.splice(d,1);for(var w=v+1;w<b.length;w++)b[w]--}function f(d,v,y,S,b,w,A){b.splice(d,0,S),w.splice(d,0,v);for(var x=y+1;x<A.length;x++)A[x]++}i.prototype.resize=function(d,v,y){if(!un(d))throw new TypeError("Array or Matrix expected");var S=d.valueOf().map(w=>Array.isArray(w)&&w.length===1?w[0]:w);if(S.length!==2)throw new Error("Only two dimensions matrix are supported");S.forEach(function(w){if(!At(w)||!nt(w)||w<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(S)+")")});var b=y?this.clone():this;return p(b,S[0],S[1],v)};function p(d,v,y,S){var b=S||0,w=t,A=0;tn(d._datatype)&&(w=e.find(t,[d._datatype,d._datatype])||t,A=e.convert(0,d._datatype),b=e.convert(b,d._datatype));var x=!w(b,A),D=d._size[0],E=d._size[1],_,N,P;if(y>E){for(N=E;N<y;N++)if(d._ptr[N]=d._values.length,x)for(_=0;_<D;_++)d._values.push(b),d._index.push(_);d._ptr[y]=d._values.length}else y<E&&(d._ptr.splice(y+1,E-y),d._values.splice(d._ptr[y],d._values.length),d._index.splice(d._ptr[y],d._index.length));if(E=y,v>D){if(x){var B=0;for(N=0;N<E;N++){d._ptr[N]=d._ptr[N]+B,P=d._ptr[N+1]+B;var V=0;for(_=D;_<v;_++,V++)d._values.splice(P+V,0,b),d._index.splice(P+V,0,_),B++}d._ptr[E]=d._values.length}}else if(v<D){var z=0;for(N=0;N<E;N++){d._ptr[N]=d._ptr[N]-z;var L=d._ptr[N],k=d._ptr[N+1]-z;for(P=L;P<k;P++)_=d._index[P],_>v-1&&(d._values.splice(P,1),d._index.splice(P,1),z++)}d._ptr[N]=d._values.length}return d._size[0]=v,d._size[1]=y,d}i.prototype.reshape=function(d,v){if(!nr(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(O){if(!At(O)||!nt(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Mt(d)+")")});var y=this._size[0]*this._size[1];d=_c(d,y);var S=d[0]*d[1];if(y!==S)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=v?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return b;for(var w=[],A=0;A<b._ptr.length;A++)for(var x=0;x<b._ptr[A+1]-b._ptr[A];x++)w.push(A);for(var D=b._values.slice(),E=b._index.slice(),_=0;_<b._index.length;_++){var N=E[_],P=w[_],B=N*b._size[1]+P;w[_]=B%d[1],E[_]=Math.floor(B/d[1])}b._values.length=0,b._index.length=0,b._ptr.length=d[1]+1,b._size=d.slice();for(var V=0;V<b._ptr.length;V++)b._ptr[V]=0;for(var z=0;z<D.length;z++){var L=E[z],k=w[z],C=D[z],W=l(L,b._ptr[k],b._ptr[k+1],b._index);f(W,L,k,C,b._values,b._index,b._ptr)}return b},i.prototype.clone=function(){var d=new i({values:this._values?vt(this._values):void 0,index:vt(this._index),ptr:vt(this._ptr),size:vt(this._size),datatype:this._datatype});return d},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(d,v){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var y=this,S=this._size[0],b=this._size[1],w=Nm(d),A=function(D,E,_){return w===1?d(D):w===2?d(D,[E,_]):d(D,[E,_],y)};return m(this,0,S-1,0,b-1,A,v)};function m(d,v,y,S,b,w,A){var x=[],D=[],E=[],_=t,N=0;tn(d._datatype)&&(_=e.find(t,[d._datatype,d._datatype])||t,N=e.convert(0,d._datatype));for(var P=function(U,de,De){U=w(U,de,De),_(U,N)||(x.push(U),D.push(de))},B=S;B<=b;B++){E.push(x.length);var V=d._ptr[B],z=d._ptr[B+1];if(A)for(var L=V;L<z;L++){var k=d._index[L];k>=v&&k<=y&&P(d._values[L],k-v,B-S)}else{for(var C={},W=V;W<z;W++){var O=d._index[W];C[O]=d._values[W]}for(var H=v;H<=y;H++){var Z=H in C?C[H]:0;P(Z,H-v,B-S)}}}return E.push(x.length),new i({values:x,index:D,ptr:E,size:[y-v+1,b-S+1]})}i.prototype.forEach=function(d,v){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var y=this,S=this._size[0],b=this._size[1],w=0;w<b;w++){var A=this._ptr[w],x=this._ptr[w+1];if(v)for(var D=A;D<x;D++){var E=this._index[D];d(this._values[D],[E,w],y)}else{for(var _={},N=A;N<x;N++){var P=this._index[N];_[P]=this._values[N]}for(var B=0;B<S;B++){var V=B in _?_[B]:0;d(V,[B,w],y)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var d=this._size[1],v=0;v<d;v++)for(var y=this._ptr[v],S=this._ptr[v+1],b=y;b<S;b++){var w=this._index[b];yield{value:this._values[b],index:[w,v]}}},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,v,y,S,b){var w=S[0],A=S[1],x=[],D,E;for(D=0;D<w;D++)for(x[D]=[],E=0;E<A;E++)x[D][E]=0;for(E=0;E<A;E++)for(var _=y[E],N=y[E+1],P=_;P<N;P++)D=v[P],x[D][E]=d?b?vt(d[P]):d[P]:1;return x}return i.prototype.format=function(d){for(var v=this._size[0],y=this._size[1],S=this.density(),b="Sparse Matrix ["+Mt(v,d)+" x "+Mt(y,d)+"] density: "+Mt(S,d)+`
`,w=0;w<y;w++)for(var A=this._ptr[w],x=this._ptr[w+1],D=A;D<x;D++){var E=this._index[D];b+=`
(`+Mt(E,d)+", "+Mt(w,d)+") ==> "+(this._values?Mt(this._values[D],d):"X")}return b},i.prototype.toString=function(){return Mt(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(pt(d)&&(d=d.toNumber()),!At(d)||!nt(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var v=d>0?d:0,y=d<0?-d:0,S=this._size[0],b=this._size[1],w=Math.min(S-y,b-v),A=[],x=[],D=[];D[0]=0;for(var E=v;E<b&&A.length<w;E++)for(var _=this._ptr[E],N=this._ptr[E+1],P=_;P<N;P++){var B=this._index[P];if(B===E-v+y){A.push(this._values[P]),x[A.length-1]=B-y;break}}return D.push(A.length),new i({values:A,index:x,ptr:D,size:[w,1]})},i.fromJSON=function(d){return new i(d)},i.diagonal=function(d,v,y,S,b){if(!nr(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(O){if(pt(O)&&(O=O.toNumber()),!At(O)||!nt(O)||O<1)throw new Error("Size values must be positive integers");return O}),y){if(pt(y)&&(y=y.toNumber()),!At(y)||!nt(y))throw new TypeError("The parameter k must be an integer number")}else y=0;var w=t,A=0;tn(b)&&(w=e.find(t,[b,b])||t,A=e.convert(0,b));var x=y>0?y:0,D=y<0?-y:0,E=d[0],_=d[1],N=Math.min(E-D,_-x),P;if(nr(v)){if(v.length!==N)throw new Error("Invalid value array length");P=function(H){return v[H]}}else if(ot(v)){var B=v.size();if(B.length!==1||B[0]!==N)throw new Error("Invalid matrix length");P=function(H){return v.get([H])}}else P=function(){return v};for(var V=[],z=[],L=[],k=0;k<_;k++){L.push(V.length);var C=k-x;if(C>=0&&C<N){var W=P(C);w(W,A)||(z.push(C+D),V.push(W))}}return L.push(V.length),new i({values:V,index:z,ptr:L,size:[E,_]})},i.prototype.swapRows=function(d,v){if(!At(d)||!nt(d)||!At(v)||!nt(v))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return br(d,this._size[0]),br(v,this._size[0]),i._swapRows(d,v,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(d,v,y,S,b){for(var w=S[d],A=S[d+1],x=w;x<A;x++)b(y[x],v[x])},i._swapRows=function(d,v,y,S,b,w){for(var A=0;A<y;A++){var x=w[A],D=w[A+1],E=l(d,x,D,b),_=l(v,x,D,b);if(E<D&&_<D&&b[E]===d&&b[_]===v){if(S){var N=S[E];S[E]=S[_],S[_]=N}continue}if(E<D&&b[E]===d&&(_>=D||b[_]!==v)){var P=S?S[E]:void 0;b.splice(_,0,v),S&&S.splice(_,0,P),b.splice(_<=E?E+1:E,1),S&&S.splice(_<=E?E+1:E,1);continue}if(_<D&&b[_]===v&&(E>=D||b[E]!==d)){var B=S?S[_]:void 0;b.splice(E,0,d),S&&S.splice(E,0,B),b.splice(E<=_?_+1:_,1),S&&S.splice(E<=_?_+1:_,1)}}},i},{isClass:!0});var kW="number",BW=["typed"];function OW(n){var e=n.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],i=e[3];return{input:n,radix:t,integerPart:r,fractionalPart:i}}else return null}function RW(n){for(var e=parseInt(n.integerPart,n.radix),t=0,r=0;r<n.fractionalPart.length;r++){var i=parseInt(n.fractionalPart[r],n.radix);t+=i/Math.pow(n.radix,r+1)}var a=e+t;if(isNaN(a))throw new SyntaxError('String "'+n.input+'" is not a valid number');return a}var x0=T(kW,BW,n=>{var{typed:e}=n,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=OW(i);if(a)return RW(a);var o=0,u=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(o=Number(u[2]),i=u[1]);var s=Number(i);if(isNaN(s))throw new SyntaxError('String "'+i+'" is not a valid number');if(u){if(s>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));s>=2**(o-1)&&(s=s-2**o)}return s},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t});var qT="string",LW=["typed"],w0=T(qT,LW,n=>{var{typed:e}=n;return e(qT,{"":function(){return""},number:Ca,null:function(r){return"null"},boolean:function(r){return r+""},string:function(r){return r},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t)),any:function(r){return String(r)}})});var zT="boolean",VW=["typed"],_0=T(zT,VW,n=>{var{typed:e}=n;return e(zT,{"":function(){return!1},boolean:function(r){return r},number:function(r){return!!r},null:function(r){return!1},BigNumber:function(r){return!r.isZero()},string:function(r){var i=r.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(r);if(r!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+r+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var UW="bignumber",qW=["typed","BigNumber"],S0=T(UW,qW,n=>{var{typed:e,BigNumber:t}=n;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],u=t(a[1]),s=new t(2).pow(Number(o));if(u.gt(s.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var l=new t(2).pow(Number(o)-1);return u.gte(l)?u.sub(s):u}return new t(i)},BigNumber:function(i){return i},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(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(r=>i=>lt(i,r))})});var zW="complex",$W=["typed","Complex"],A0=T(zW,$W,n=>{var{typed:e,Complex:t}=n;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(r=>i=>lt(i,r))})});var HW="fraction",GW=["typed","Fraction"],M0=T(HW,GW,n=>{var{typed:e,Fraction:t}=n;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(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var $T="matrix",WW=["typed","Matrix","DenseMatrix","SparseMatrix"],E0=T($T,WW,n=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e($T,{"":function(){return a([])},string:function(u){return a([],u)},"string, string":function(u,s){return a([],u,s)},Array:function(u){return a(u)},Matrix:function(u){return a(u,u.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,u,s){if(u==="dense"||u==="default"||u===void 0)return new r(o,s);if(u==="sparse")return new i(o,s);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}});var HT="matrixFromFunction",YW=["typed","matrix","isZero"],D0=T(HT,YW,n=>{var{typed:e,matrix:t,isZero:r}=n;return e(HT,{"Array | Matrix, function, string, string":function(o,u,s,l){return i(o,u,s,l)},"Array | Matrix, function, string":function(o,u,s){return i(o,u,s)},"Matrix, function":function(o,u){return i(o,u,"dense")},"Array, function":function(o,u){return i(o,u,"dense").toArray()},"Array | Matrix, string, function":function(o,u,s){return i(o,s,u)},"Array | Matrix, string, string, function":function(o,u,s,l){return i(o,l,u,s)}});function i(a,o,u,s){var l;return s!==void 0?l=t(u,s):l=t(u),l.resize(a),l.forEach(function(c,f){var p=o(f);r(p)||l.set(f,p)}),l}});var GT="matrixFromRows",jW=["typed","matrix","flatten","size"],N0=T(GT,jW,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(GT,{"...Array":function(s){return a(s)},"...Matrix":function(s){return t(a(s.map(l=>l.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var s=o(u[0]),l=[];for(var c of u){var f=o(c);if(f!==s)throw new TypeError("The vectors had different length: "+(s|0)+" \u2260 "+(f|0));l.push(r(c))}return l}function o(u){var s=i(u);if(s.length===1)return s[0];if(s.length===2){if(s[0]===1)return s[1];if(s[1]===1)return s[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 WT="matrixFromColumns",ZW=["typed","matrix","flatten","size"],T0=T(WT,ZW,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(WT,{"...Array":function(s){return a(s)},"...Matrix":function(s){return t(a(s.map(l=>l.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var s=o(u[0]),l=[],c=0;c<s;c++)l[c]=[];for(var f of u){var p=o(f);if(p!==s)throw new TypeError("The vectors had different length: "+(s|0)+" \u2260 "+(p|0));for(var m=r(f),h=0;h<s;h++)l[h].push(m[h])}return l}function o(u){var s=i(u);if(s.length===1)return s[0];if(s.length===2){if(s[0]===1)return s[1];if(s[1]===1)return s[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 YT="splitUnit",JW=["typed"],C0=T(YT,JW,n=>{var{typed:e}=n;return e(YT,{"Unit, Array":function(r,i){return r.splitUnit(i)}})});var jT="unaryMinus",XW=["typed"],F0=T(jT,XW,n=>{var{typed:e}=n;return e(jT,{number:yy,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var i=r.clone();return i.value=e.find(t,i.valueType())(r.value),i}),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t,!0))})});var ZT="unaryPlus",QW=["typed","config","BigNumber"],I0=T(ZT,QW,n=>{var{typed:e,config:t,BigNumber:r}=n;return e(ZT,{number:by,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=>lt(a,i,!0)),"boolean | string":function(a){return t.number==="BigNumber"?new r(+a):+a}})});var JT="abs",KW=["typed"],P0=T(JT,KW,n=>{var{typed:e}=n;return e(JT,{number:dy,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t,!0))})});var XT="apply",eY=["typed","isInteger"],ru=T(XT,eY,n=>{var{typed:e,isInteger:t}=n;return e(XT,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!t(a))throw new TypeError("Integer number expected for dimension");var u=Array.isArray(i)?_t(i):i.size();if(a<0||a>=u.length)throw new $n(a,u.length);return ot(i)?i.create(Pm(i.valueOf(),a,o)):Pm(i,a,o)}})});function Pm(n,e,t){var r,i,a;if(e<=0)if(Array.isArray(n[0])){for(a=tY(n),i=[],r=0;r<a.length;r++)i[r]=Pm(a[r],e-1,t);return i}else return t(n);else{for(i=[],r=0;r<n.length;r++)i[r]=Pm(n[r],e-1,t);return i}}function tY(n){var e=n.length,t=n[0].length,r,i,a=[];for(i=0;i<t;i++){var o=[];for(r=0;r<e;r++)o.push(n[r][i]);a.push(o)}return a}var QT="addScalar",rY=["typed"],k0=T(QT,rY,n=>{var{typed:e}=n;return e(QT,{"number, number":hy,"Complex, Complex":function(r,i){return r.add(i)},"BigNumber, BigNumber":function(r,i){return r.plus(i)},"Fraction, Fraction":function(r,i){return r.add(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.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(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var KT="subtractScalar",nY=["typed"],B0=T(KT,nY,n=>{var{typed:e}=n;return e(KT,{"number, number":gy,"Complex, Complex":function(r,i){return r.sub(i)},"BigNumber, BigNumber":function(r,i){return r.minus(i)},"Fraction, Fraction":function(r,i){return r.sub(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.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(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var eC="cbrt",iY=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],O0=T(eC,iY,n=>{var{config:e,typed:t,isNegative:r,unaryMinus:i,matrix:a,Complex:o,BigNumber:u,Fraction:s}=n;return t(eC,{number:cl,Complex:l,"Complex, boolean":l,BigNumber:function(p){return p.cbrt()},Unit:c});function l(f,p){var m=f.arg()/3,h=f.abs(),d=new o(cl(h),0).mul(new o(0,m).exp());if(p){var v=[d,new o(cl(h),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(cl(h),0).mul(new o(0,m-Math.PI*2/3).exp())];return e.matrix==="Array"?v:a(v)}else return d}function c(f){if(f.value&&hi(f.value)){var p=f.clone();return p.value=1,p=p.pow(1/3),p.value=l(f.value),p}else{var m=r(f.value);m&&(f.value=i(f.value));var h;pt(f.value)?h=new u(1).div(3):_o(f.value)?h=new s(1,3):h=1/3;var d=f.pow(h);return m&&(d.value=i(d.value)),d}}});var aY="matAlgo11xS0s",oY=["typed","equalScalar"],xr=T(aY,oY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,v=t,y=0,S=o;typeof p=="string"&&(d=p,v=e.find(t,[d,d]),y=e.convert(0,d),a=e.convert(a,d),S=e.find(o,[d,d]));for(var b=[],w=[],A=[],x=0;x<h;x++){A[x]=w.length;for(var D=c[x],E=c[x+1],_=D;_<E;_++){var N=l[_],P=u?S(a,s[_]):S(s[_],a);v(P,y)||(w.push(N),b.push(P))}}return A[h]=w.length,i.createSparseMatrix({values:b,index:w,ptr:A,size:[m,h],datatype:d})}});var sY="matAlgo12xSfs",uY=["typed","DenseMatrix"],cr=T(sY,uY,n=>{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,v=o;typeof p=="string"&&(d=p,a=e.convert(a,d),v=e.find(o,[d,d]));for(var y=[],S=[],b=[],w=0;w<h;w++){for(var A=w+1,x=c[w],D=c[w+1],E=x;E<D;E++){var _=l[E];S[_]=s[E],b[_]=A}for(var N=0;N<m;N++)w===0&&(y[N]=[]),b[N]===A?y[N][w]=u?v(a,S[N]):v(S[N],a):y[N][w]=u?v(a,0):v(0,a)}return new t({data:y,size:[m,h],datatype:d})}});var lY="matAlgo14xDs",cY=["typed"],fn=T(lY,cY,n=>{var{typed:e}=n;return function(i,a,o,u){var s=i._data,l=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=l.length>0?t(p,0,l,l[0],s,a,u):[];return i.createDenseMatrix({data:m,size:vt(l),datatype:f})};function t(r,i,a,o,u,s,l){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=l?r(s,u[f]):r(u[f],s);else for(var p=0;p<o;p++)c[p]=t(r,i+1,a,a[i+1],u[p],s,l);return c}});var R0="ceil",fY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],pY=T(R0,["typed","config","round"],n=>{var{typed:e,config:t,round:r}=n;return e(R0,{number:function(a){return Jr(a,r(a),t.epsilon)?r(a):Math.ceil(a)},"number, number":function(a,o){if(Jr(a,r(a,o),t.epsilon))return r(a,o);var[u,s]="".concat(a,"e").split("e"),l=Math.ceil(Number("".concat(u,"e").concat(Number(s)+o)));return[u,s]="".concat(l,"e").split("e"),Number("".concat(u,"e").concat(Number(s)-o))}})}),L0=T(R0,fY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:a}),l=cr({typed:e,DenseMatrix:u}),c=fn({typed:e}),f=pY({typed:e,config:t,round:r});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 gn(m,r(m),t.epsilon)?r(m):m.ceil()},"BigNumber, BigNumber":function(m,h){return gn(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),Ks.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=>lt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(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):l(h,m,p,!0))})});var tC="cube",mY=["typed"],V0=T(tC,mY,n=>{var{typed:e}=n;return e(tC,{number:xy,Complex:function(r){return r.mul(r).mul(r)},BigNumber:function(r){return r.times(r).times(r)},Fraction:function(r){return r.pow(3)},Unit:function(r){return r.pow(3)}})});var rC="exp",dY=["typed"],U0=T(rC,dY,n=>{var{typed:e}=n;return e(rC,{number:wy,Complex:function(r){return r.exp()},BigNumber:function(r){return r.exp()}})});var nC="expm1",hY=["typed","Complex"],q0=T(nC,hY,n=>{var{typed:e,Complex:t}=n;return e(nC,{number:_y,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 z0="fix",gY=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],vY=T(z0,["typed","ceil","floor"],n=>{var{typed:e,ceil:t,floor:r}=n;return e(z0,{number:function(a){return a>0?r(a):t(a)},"number, number":function(a,o){return a>0?r(a,o):t(a,o)}})}),$0=T(z0,gY,n=>{var{typed:e,Complex:t,matrix:r,ceil:i,floor:a,equalScalar:o,zeros:u,DenseMatrix:s}=n,l=cr({typed:e,DenseMatrix:s}),c=fn({typed:e}),f=vY({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=>lt(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(r(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>o(m,0)?u(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):l(h,m,p,!0))})});var H0="floor",yY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],bY=T(H0,["typed","config","round"],n=>{var{typed:e,config:t,round:r}=n;return e(H0,{number:function(a){return Jr(a,r(a),t.epsilon)?r(a):Math.floor(a)},"number, number":function(a,o){if(Jr(a,r(a,o),t.epsilon))return r(a,o);var[u,s]="".concat(a,"e").split("e"),l=Math.floor(Number("".concat(u,"e").concat(Number(s)+o)));return[u,s]="".concat(l,"e").split("e"),Number("".concat(u,"e").concat(Number(s)-o))}})}),Tc=T(H0,yY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:a}),l=cr({typed:e,DenseMatrix:u}),c=fn({typed:e}),f=bY({typed:e,config:t,round:r});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 gn(m,r(m),t.epsilon)?r(m):m.floor()},"BigNumber, BigNumber":function(m,h){return gn(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),Ks.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=>lt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(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):l(h,m,p,!0))})});var xY="matAlgo02xDS0",wY=["typed","equalScalar"],pn=T(xY,wY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,u){var s=i._data,l=i._size,c=i._datatype||i.getDataType(),f=a._values,p=a._index,m=a._ptr,h=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Dt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=l[0],y=l[1],S,b=t,w=0,A=o;typeof c=="string"&&c===d&&c!=="mixed"&&(S=c,b=e.find(t,[S,S]),w=e.convert(0,S),A=e.find(o,[S,S]));for(var x=[],D=[],E=[],_=0;_<y;_++){E[_]=D.length;for(var N=m[_],P=m[_+1],B=N;B<P;B++){var V=p[B],z=u?A(f[B],s[V][_]):A(s[V][_],f[B]);b(z,w)||(D.push(V),x.push(z))}}return E[y]=D.length,a.createSparseMatrix({values:x,index:D,ptr:E,size:[v,y],datatype:c===i._datatype&&d===a._datatype?S:void 0})}});var _Y="matAlgo03xDSf",SY=["typed"],kr=T(_Y,SY,n=>{var{typed:e}=n;return function(r,i,a,o){var u=r._data,s=r._size,l=r._datatype||r.getDataType(),c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==m.length)throw new Dt(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=s[0],v=s[1],y,S=0,b=a;typeof l=="string"&&l===h&&l!=="mixed"&&(y=l,S=e.convert(0,y),b=e.find(a,[y,y]));for(var w=[],A=0;A<d;A++)w[A]=[];for(var x=[],D=[],E=0;E<v;E++){for(var _=E+1,N=p[E],P=p[E+1],B=N;B<P;B++){var V=f[B];x[V]=o?b(c[B],u[V][E]):b(u[V][E],c[B]),D[V]=_}for(var z=0;z<d;z++)D[z]===_?w[z][E]=x[z]:w[z][E]=o?b(S,u[z][E]):b(u[z][E],S)}return r.createDenseMatrix({data:w,size:[d,v],datatype:l===r._datatype&&h===i._datatype?y:void 0})}});var AY="matAlgo05xSfSf",MY=["typed","equalScalar"],fs=T(AY,MY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,v=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(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 y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===v&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=D?[]:void 0,P=D?[]:void 0,B=[],V=[],z,L,k,C;for(L=0;L<S;L++){_[L]=E.length;var W=L+1;for(k=l[L],C=l[L+1];k<C;k++)z=s[k],E.push(z),B[z]=W,N&&(N[z]=u[k]);for(k=h[L],C=h[L+1];k<C;k++)z=m[k],B[z]!==W&&E.push(z),V[z]=W,P&&(P[z]=p[k]);if(D)for(k=_[L];k<E.length;){z=E[k];var O=B[z],H=V[z];if(O===W||H===W){var Z=O===W?N[z]:A,Q=H===W?P[z]:A,U=x(Z,Q);w(U,A)?E.splice(k,1):(D.push(U),k++)}}}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&v===a._datatype?b:void 0})}});var EY="matAlgo13xDD",DY=["typed"],iC=T(EY,DY,n=>{var{typed:e}=n;return function(i,a,o){var u=i._data,s=i._size,l=i._datatype,c=a._data,f=a._size,p=a._datatype,m=[];if(s.length!==f.length)throw new Dt(s.length,f.length);for(var h=0;h<s.length;h++){if(s[h]!==f[h])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+f+")");m[h]=s[h]}var d,v=o;typeof l=="string"&&l===p&&(d=l,v=e.find(o,[d,d]));var y=m.length>0?t(v,0,m,m[0],u,c):[];return i.createDenseMatrix({data:y,size:m,datatype:d})};function t(r,i,a,o,u,s){var l=[];if(i===a.length-1)for(var c=0;c<o;c++)l[c]=r(u[c],s[c]);else for(var f=0;f<o;f++)l[f]=t(r,i+1,a,a[i+1],u[f],s[f]);return l}});var NY="broadcast",TY=["concat"],aC=T(NY,TY,n=>{var{concat:e}=n;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 u=t(i._size,o,0),s=t(a._size,o,0),l=[],c=0;c<o;c++)l[c]=Math.max(u[c],s[c]);Sc(u,l),Sc(s,l);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]<l[m]&&(f=r(f,l[m],m)),p._size[m]<l[m]&&(p=r(p,l[m],m));return[f,p]};function t(i,a,o){return[...Array(a-i.length).fill(o),...i]}function r(i,a,o){return e(...Array(a).fill(i),o)}});var CY="matrixAlgorithmSuite",FY=["typed","matrix","concat"],Ct=T(CY,FY,n=>{var{typed:e,matrix:t,concat:r}=n,i=iC({typed:e}),a=fn({typed:e}),o=aC({concat:r});return function(s){var l=s.elop,c=s.SD||s.DS,f;l?(f={"DenseMatrix, DenseMatrix":(d,v)=>i(...o(d,v),l),"Array, Array":(d,v)=>i(...o(t(d),t(v)),l).valueOf(),"Array, DenseMatrix":(d,v)=>i(...o(t(d),v),l),"DenseMatrix, Array":(d,v)=>i(...o(d,t(v)),l)},s.SS&&(f["SparseMatrix, SparseMatrix"]=(d,v)=>s.SS(...o(d,v),l,!1)),s.DS&&(f["DenseMatrix, SparseMatrix"]=(d,v)=>s.DS(...o(d,v),l,!1),f["Array, SparseMatrix"]=(d,v)=>s.DS(...o(t(d),v),l,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(d,v)=>c(...o(v,d),l,!0),f["SparseMatrix, Array"]=(d,v)=>c(...o(t(v),d),l,!0))):(f={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(v,y)=>i(...o(v,y),d)),"Array, Array":e.referToSelf(d=>(v,y)=>i(...o(t(v),t(y)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(v,y)=>i(...o(t(v),y),d)),"DenseMatrix, Array":e.referToSelf(d=>(v,y)=>i(...o(v,t(y)),d))},s.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(v,y)=>s.SS(...o(v,y),d,!1))),s.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(v,y)=>s.DS(...o(v,y),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(v,y)=>s.DS(...o(t(v),y),d,!1))),c&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(v,y)=>c(...o(y,v),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(v,y)=>c(...o(t(y),v),d,!0))));var p=s.scalar||"any",m=s.Ds||s.Ss;m&&(l?(f["DenseMatrix,"+p]=(d,v)=>a(d,v,l,!1),f[p+", DenseMatrix"]=(d,v)=>a(v,d,l,!0),f["Array,"+p]=(d,v)=>a(t(d),v,l,!1).valueOf(),f[p+", Array"]=(d,v)=>a(t(v),d,l,!0).valueOf()):(f["DenseMatrix,"+p]=e.referToSelf(d=>(v,y)=>a(v,y,d,!1)),f[p+", DenseMatrix"]=e.referToSelf(d=>(v,y)=>a(y,v,d,!0)),f["Array,"+p]=e.referToSelf(d=>(v,y)=>a(t(v),y,d,!1).valueOf()),f[p+", Array"]=e.referToSelf(d=>(v,y)=>a(t(y),v,d,!0).valueOf())));var h=s.sS!==void 0?s.sS:s.Ss;return l?(s.Ss&&(f["SparseMatrix,"+p]=(d,v)=>s.Ss(d,v,l,!1)),h&&(f[p+", SparseMatrix"]=(d,v)=>h(v,d,l,!0))):(s.Ss&&(f["SparseMatrix,"+p]=e.referToSelf(d=>(v,y)=>s.Ss(v,y,d,!1))),h&&(f[p+", SparseMatrix"]=e.referToSelf(d=>(v,y)=>h(y,v,d,!0)))),l&&l.signatures&&fm(f,l.signatures),f}});var oC="mod",IY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Cc=T(oC,IY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u,concat:s}=n,l=Tc({typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}),c=pn({typed:e,equalScalar:a}),f=kr({typed:e}),p=fs({typed:e,equalScalar:a}),m=xr({typed:e,equalScalar:a}),h=cr({typed:e,DenseMatrix:u}),d=Ct({typed:e,matrix:i,concat:s});return e(oC,{"number, number":v,"BigNumber, BigNumber":function(S,b){return b.isZero()?S:S.sub(b.mul(l(S.div(b))))},"Fraction, Fraction":function(S,b){return b.equals(0)?S:S.sub(b.mul(l(S.div(b))))}},d({SS:p,DS:f,SD:c,Ss:m,sS:h}));function v(y,S){return S===0?y:y-S*l(y/S)}});var PY="matAlgo01xDSid",kY=["typed"],ti=T(PY,kY,n=>{var{typed:e}=n;return function(r,i,a,o){var u=r._data,s=r._size,l=r._datatype||r.getDataType(),c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==m.length)throw new Dt(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=s[0],v=s[1],y=typeof l=="string"&&l!=="mixed"&&l===h?l:void 0,S=y?e.find(a,[y,y]):a,b,w,A=[];for(b=0;b<d;b++)A[b]=[];var x=[],D=[];for(w=0;w<v;w++){for(var E=w+1,_=p[w],N=p[w+1],P=_;P<N;P++)b=f[P],x[b]=o?S(c[P],u[b][w]):S(u[b][w],c[P]),D[b]=E;for(b=0;b<d;b++)D[b]===E?A[b][w]=x[b]:A[b][w]=u[b][w]}return r.createDenseMatrix({data:A,size:[d,v],datatype:l===r._datatype&&h===i._datatype?y:void 0})}});var BY="matAlgo04xSidSid",OY=["typed","equalScalar"],ml=T(BY,OY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,v=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(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 y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===v&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=u&&p?[]:void 0,P=u&&p?[]:void 0,B=[],V=[],z,L,k,C,W;for(L=0;L<S;L++){_[L]=E.length;var O=L+1;for(C=l[L],W=l[L+1],k=C;k<W;k++)z=s[k],E.push(z),B[z]=O,N&&(N[z]=u[k]);for(C=h[L],W=h[L+1],k=C;k<W;k++)if(z=m[k],B[z]===O){if(N){var H=x(N[z],p[k]);w(H,A)?B[z]=null:N[z]=H}}else E.push(z),V[z]=O,P&&(P[z]=p[k]);if(N&&P)for(k=_[L];k<E.length;)z=E[k],B[z]===O?(D[k]=N[z],k++):V[z]===O?(D[k]=P[z],k++):E.splice(k,1)}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&v===a._datatype?b:void 0})}});var RY="matAlgo10xSids",LY=["typed","DenseMatrix"],Ni=T(RY,LY,n=>{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,v=o;typeof p=="string"&&(d=p,a=e.convert(a,d),v=e.find(o,[d,d]));for(var y=[],S=[],b=[],w=0;w<h;w++){for(var A=w+1,x=c[w],D=c[w+1],E=x;E<D;E++){var _=l[E];S[_]=s[E],b[_]=A}for(var N=0;N<m;N++)w===0&&(y[N]=[]),b[N]===A?y[N][w]=u?v(a,S[N]):v(S[N],a):y[N][w]=a}return new t({data:y,size:[m,h],datatype:d})}});function Do(n,e,t,r){if(!(this instanceof Do))throw new SyntaxError("Constructor must be called with the new operator");this.fn=n,this.count=e,this.min=t,this.max=r,this.message="Wrong number of arguments in function "+n+" ("+e+" provided, "+t+(r!=null?"-"+r:"")+" expected)",this.stack=new Error().stack}Do.prototype=new Error;Do.prototype.constructor=Error;Do.prototype.name="ArgumentsError";Do.prototype.isArgumentsError=!0;var sC="gcd",VY=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],G0="number | BigNumber | Fraction | Matrix | Array",UY="".concat(G0,", ").concat(G0,", ...").concat(G0);function uC(n){return!n.some(e=>Array.isArray(e))}var W0=T(sC,VY,n=>{var{typed:e,matrix:t,config:r,round:i,equalScalar:a,zeros:o,BigNumber:u,DenseMatrix:s,concat:l}=n,c=Cc({typed:e,config:r,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}),f=ti({typed:e}),p=ml({typed:e,equalScalar:a}),m=Ni({typed:e,DenseMatrix:s}),h=Ct({typed:e,matrix:t,concat:l});return e(sC,{"number, number":d,"BigNumber, BigNumber":v,"Fraction, Fraction":(y,S)=>y.gcd(S)},h({SS:p,DS:f,Ss:m}),{[UY]:e.referToSelf(y=>(S,b,w)=>{for(var A=y(S,b),x=0;x<w.length;x++)A=y(A,w[x]);return A}),Array:e.referToSelf(y=>S=>{if(S.length===1&&Array.isArray(S[0])&&uC(S[0]))return y(...S[0]);if(uC(S))return y(...S);throw new Do("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(y=>S=>y(S.toArray()))});function d(y,S){if(!nt(y)||!nt(S))throw new Error("Parameters in function gcd must be integer numbers");for(var b;S!==0;)b=c(y,S),y=S,S=b;return y<0?-y:y}function v(y,S){if(!y.isInt()||!S.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var b=new u(0);!S.isZero();){var w=c(y,S);y=S,S=w}return y.lt(b)?y.neg():y}});var qY="matAlgo06xS0S0",zY=["typed","equalScalar"],ps=T(qY,zY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._size,l=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,p=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(s.length!==f.length)throw new Dt(s.length,f.length);if(s[0]!==f[0]||s[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+f+")");var m=s[0],h=s[1],d,v=t,y=0,S=o;typeof l=="string"&&l===p&&l!=="mixed"&&(d=l,v=e.find(t,[d,d]),y=e.convert(0,d),S=e.find(o,[d,d]));for(var b=u&&c?[]:void 0,w=[],A=[],x=b?[]:void 0,D=[],E=[],_=0;_<h;_++){A[_]=w.length;var N=_+1;if(py(i,_,D,x,E,N,w,S),py(a,_,D,x,E,N,w,S),x)for(var P=A[_];P<w.length;){var B=w[P];if(E[B]===N){var V=x[B];v(V,y)?w.splice(P,1):(b.push(V),P++)}else w.splice(P,1)}else for(var z=A[_];z<w.length;){var L=w[z];E[L]!==N?w.splice(z,1):z++}}return A[h]=w.length,i.createSparseMatrix({values:b,index:w,ptr:A,size:[m,h],datatype:l===i._datatype&&p===a._datatype?d:void 0})}});var lC="lcm",$Y=["typed","matrix","equalScalar","concat"],Y0=T(lC,$Y,n=>{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=pn({typed:e,equalScalar:r}),o=ps({typed:e,equalScalar:r}),u=xr({typed:e,equalScalar:r}),s=Ct({typed:e,matrix:t,concat:i}),l="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(l,", ").concat(l,", ...").concat(l)]=e.referToSelf(p=>(m,h,d)=>{for(var v=p(m,h),y=0;y<d.length;y++)v=p(v,d[y]);return v}),e(lC,{"number, number":Sy,"BigNumber, BigNumber":f,"Fraction, Fraction":(p,m)=>p.lcm(m)},s({SS:o,DS:a,Ss:u}),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 cC="log10",HY=["typed","config","Complex"],j0=T(cC,HY,n=>{var{typed:e,config:t,Complex:r}=n;return e(cC,{number:function(a){return a>=0||t.predictable?Ay(a):new r(a,0).log().div(Math.LN10)},Complex:function(a){return new r(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new r(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>lt(a,i))})});var fC="log2",GY=["typed","config","Complex"],Z0=T(fC,GY,n=>{var{typed:e,config:t,Complex:r}=n;return e(fC,{number:function(o){return o>=0||t.predictable?My(o):i(new r(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new r(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>lt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new r(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var WY="multiplyScalar",YY=["typed"],J0=T(WY,YY,n=>{var{typed:e}=n;return e("multiplyScalar",{"number, number":vy,"Complex, Complex":function(r,i){return r.mul(i)},"BigNumber, BigNumber":function(r,i){return r.times(i)},"Fraction, Fraction":function(r,i){return r.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})});var pC="multiply",jY=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],X0=T(pC,jY,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,equalScalar:a,dot:o}=n,u=xr({typed:e,equalScalar:a}),s=fn({typed:e});function l(A,x){switch(A.length){case 1:switch(x.length){case 1:if(A[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(A[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+A[0]+") must match Matrix rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;case 2:switch(x.length){case 1:if(A[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+A[1]+") must match Vector length ("+x[0]+")");break;case 2:if(A[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+A[1]+") must match Matrix B rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+A.length+" dimensions)")}}function c(A,x,D){if(D===0)throw new Error("Cannot multiply two empty vectors");return o(A,x)}function f(A,x){if(x.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(A,x)}function p(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._size,B=x._datatype||x.getDataType(),V=E[0],z=P[1],L,k=r,C=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&(L=_,k=e.find(r,[L,L]),C=e.find(i,[L,L]));for(var W=[],O=0;O<z;O++){for(var H=C(D[0],N[0][O]),Z=1;Z<V;Z++)H=k(H,C(D[Z],N[Z][O]));W[O]=H}return A.createDenseMatrix({data:W,size:[z],datatype:_===A._datatype&&B===x._datatype?L:void 0})}var m=e("_multiplyMatrixVector",{"DenseMatrix, any":d,"SparseMatrix, any":S}),h=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":v,"DenseMatrix, SparseMatrix":y,"SparseMatrix, DenseMatrix":b,"SparseMatrix, SparseMatrix":w});function d(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._datatype||x.getDataType(),B=E[0],V=E[1],z,L=r,k=i;_&&P&&_===P&&typeof _=="string"&&_!=="mixed"&&(z=_,L=e.find(r,[z,z]),k=e.find(i,[z,z]));for(var C=[],W=0;W<B;W++){for(var O=D[W],H=k(O[0],N[0]),Z=1;Z<V;Z++)H=L(H,k(O[Z],N[Z]));C[W]=H}return A.createDenseMatrix({data:C,size:[B],datatype:_===A._datatype&&P===x._datatype?z:void 0})}function v(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._size,B=x._datatype||x.getDataType(),V=E[0],z=E[1],L=P[1],k,C=r,W=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&_!=="mixed"&&(k=_,C=e.find(r,[k,k]),W=e.find(i,[k,k]));for(var O=[],H=0;H<V;H++){var Z=D[H];O[H]=[];for(var Q=0;Q<L;Q++){for(var U=W(Z[0],N[0][Q]),de=1;de<z;de++)U=C(U,W(Z[de],N[de][Q]));O[H][Q]=U}}return A.createDenseMatrix({data:O,size:[V,L],datatype:_===A._datatype&&B===x._datatype?k:void 0})}function y(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._values,P=x._index,B=x._ptr,V=x._size,z=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var L=E[0],k=V[1],C,W=r,O=i,H=a,Z=0;_&&z&&_===z&&typeof _=="string"&&_!=="mixed"&&(C=_,W=e.find(r,[C,C]),O=e.find(i,[C,C]),H=e.find(a,[C,C]),Z=e.convert(0,C));for(var Q=[],U=[],de=[],De=x.createSparseMatrix({values:Q,index:U,ptr:de,size:[L,k],datatype:_===A._datatype&&z===x._datatype?C:void 0}),me=0;me<k;me++){de[me]=U.length;var _e=B[me],Ne=B[me+1];if(Ne>_e)for(var Se=0,Me=0;Me<L;Me++){for(var Ee=Me+1,Ce=void 0,Ge=_e;Ge<Ne;Ge++){var We=P[Ge];Se!==Ee?(Ce=O(D[Me][We],N[Ge]),Se=Ee):Ce=W(Ce,O(D[Me][We],N[Ge]))}Se===Ee&&!H(Ce,Z)&&(U.push(Me),Q.push(Ce))}}return de[k]=U.length,De}function S(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType();if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=x._data,B=x._datatype||x.getDataType(),V=A._size[0],z=x._size[0],L=[],k=[],C=[],W,O=r,H=i,Z=a,Q=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(r,[W,W]),H=e.find(i,[W,W]),Z=e.find(a,[W,W]),Q=e.convert(0,W));var U=[],de=[];C[0]=0;for(var De=0;De<z;De++){var me=P[De];if(!Z(me,Q))for(var _e=_[De],Ne=_[De+1],Se=_e;Se<Ne;Se++){var Me=E[Se];de[Me]?U[Me]=O(U[Me],H(me,D[Se])):(de[Me]=!0,k.push(Me),U[Me]=H(me,D[Se]))}}for(var Ee=k.length,Ce=0;Ce<Ee;Ce++){var Ge=k[Ce];L[Ce]=U[Ge]}return C[1]=k.length,A.createSparseMatrix({values:L,index:k,ptr:C,size:[V,1],datatype:N===A._datatype&&B===x._datatype?W:void 0})}function b(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType();if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=x._data,B=x._datatype||x.getDataType(),V=A._size[0],z=x._size[0],L=x._size[1],k,C=r,W=i,O=a,H=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(k=N,C=e.find(r,[k,k]),W=e.find(i,[k,k]),O=e.find(a,[k,k]),H=e.convert(0,k));for(var Z=[],Q=[],U=[],de=A.createSparseMatrix({values:Z,index:Q,ptr:U,size:[V,L],datatype:N===A._datatype&&B===x._datatype?k:void 0}),De=[],me=[],_e=0;_e<L;_e++){U[_e]=Q.length;for(var Ne=_e+1,Se=0;Se<z;Se++){var Me=P[Se][_e];if(!O(Me,H))for(var Ee=_[Se],Ce=_[Se+1],Ge=Ee;Ge<Ce;Ge++){var We=E[Ge];me[We]!==Ne?(me[We]=Ne,Q.push(We),De[We]=W(Me,D[Ge])):De[We]=C(De[We],W(Me,D[Ge]))}}for(var te=U[_e],oe=Q.length,ge=te;ge<oe;ge++){var ie=Q[ge];Z[ge]=De[ie]}}return U[L]=Q.length,de}function w(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType(),P=x._values,B=x._index,V=x._ptr,z=x._datatype||x._data===void 0?x._datatype:x.getDataType(),L=A._size[0],k=x._size[1],C=D&&P,W,O=r,H=i;N&&z&&N===z&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(r,[W,W]),H=e.find(i,[W,W]));for(var Z=C?[]:void 0,Q=[],U=[],de=A.createSparseMatrix({values:Z,index:Q,ptr:U,size:[L,k],datatype:N===A._datatype&&z===x._datatype?W:void 0}),De=C?[]:void 0,me=[],_e,Ne,Se,Me,Ee,Ce,Ge,We,te=0;te<k;te++){U[te]=Q.length;var oe=te+1;for(Ee=V[te],Ce=V[te+1],Me=Ee;Me<Ce;Me++)if(We=B[Me],C)for(Ne=_[We],Se=_[We+1],_e=Ne;_e<Se;_e++)Ge=E[_e],me[Ge]!==oe?(me[Ge]=oe,Q.push(Ge),De[Ge]=H(P[Me],D[_e])):De[Ge]=O(De[Ge],H(P[Me],D[_e]));else for(Ne=_[We],Se=_[We+1],_e=Ne;_e<Se;_e++)Ge=E[_e],me[Ge]!==oe&&(me[Ge]=oe,Q.push(Ge));if(C)for(var ge=U[te],ie=Q.length,re=ge;re<ie;re++){var le=Q[re];Z[re]=De[le]}}return U[k]=Q.length,de}return e(pC,i,{"Array, Array":e.referTo("Matrix, Matrix",A=>(x,D)=>{l(_t(x),_t(D));var E=A(t(x),t(D));return ot(E)?E.valueOf():E}),"Matrix, Matrix":function(x,D){var E=x.size(),_=D.size();return l(E,_),E.length===1?_.length===1?c(x,D,E[0]):f(x,D):_.length===1?m(x,D):h(x,D)},"Matrix, Array":e.referTo("Matrix,Matrix",A=>(x,D)=>A(x,t(D))),"Array, Matrix":e.referToSelf(A=>(x,D)=>A(t(x,D.storage()),D)),"SparseMatrix, any":function(x,D){return u(x,D,i,!1)},"DenseMatrix, any":function(x,D){return s(x,D,i,!1)},"any, SparseMatrix":function(x,D){return u(D,x,i,!0)},"any, DenseMatrix":function(x,D){return s(D,x,i,!0)},"Array, any":function(x,D){return s(t(x),D,i,!1).valueOf()},"any, Array":function(x,D){return s(t(D),x,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(A=>(x,D,E)=>{for(var _=A(x,D),N=0;N<E.length;N++)_=A(_,E[N]);return _})})});var mC="nthRoot",ZY=["typed","matrix","equalScalar","BigNumber","concat"],Q0=T(mC,ZY,n=>{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,concat:a}=n,o=ti({typed:e}),u=pn({typed:e,equalScalar:r}),s=ps({typed:e,equalScalar:r}),l=xr({typed:e,equalScalar:r}),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(mC,{number:Ey,"number, number":Ey,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 s(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 l(d,h,m,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:u,Ss:l,sS:!1}));function p(m,h){var d=i.precision,v=i.clone({precision:d+2}),y=new i(0),S=new v(1),b=h.isNegative();if(b&&(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 b?new v(1/0):0;if(!m.isFinite())return b?y:m;var w=m.abs().pow(S.div(h));return w=m.isNeg()?w.neg():w,new i((b?S.div(w):w).toPrecision(d))}});var dC="sign",JY=["typed","BigNumber","Fraction","complex"],K0=T(dC,JY,n=>{var{typed:e,BigNumber:t,complex:r,Fraction:i}=n;return e(dC,{number:Fm,Complex:function(o){return o.im===0?r(Fm(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=>lt(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 XY="sqrt",QY=["config","typed","Complex"],eb=T(XY,QY,n=>{var{config:e,typed:t,Complex:r}=n;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 r(a,0).sqrt()}});var hC="square",KY=["typed"],tb=T(hC,KY,n=>{var{typed:e}=n;return e(hC,{number:Dy,Complex:function(r){return r.mul(r)},BigNumber:function(r){return r.times(r)},Fraction:function(r){return r.mul(r)},Unit:function(r){return r.pow(2)}})});var gC="subtract",ej=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],rb=T(gC,ej,n=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:u}=n,s=ti({typed:e}),l=kr({typed:e}),c=fs({typed:e,equalScalar:r}),f=Ni({typed:e,DenseMatrix:o}),p=cr({typed:e,DenseMatrix:o}),m=Ct({typed:e,matrix:t,concat:u});return e(gC,{"any, any":i},m({elop:i,SS:c,DS:s,SD:l,Ss:p,sS:f}))});var vC="xgcd",tj=["typed","config","matrix","BigNumber"],nb=T(vC,tj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(vC,{"number, number":function(u,s){var l=Ny(u,s);return t.matrix==="Array"?l:r(l)},"BigNumber, BigNumber":a});function a(o,u){var s,l,c,f=new i(0),p=new i(1),m=f,h=p,d=p,v=f;if(!o.isInt()||!u.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!u.isZero();)l=o.div(u).floor(),c=o.mod(u),s=m,m=h.minus(l.times(m)),h=s,s=d,d=v.minus(l.times(d)),v=s,o=u,u=c;var y;return o.lt(f)?y=[o.neg(),h.neg(),v.neg()]:y=[o,o.isZero()?0:h,v],t.matrix==="Array"?y:r(y)}});var yC="invmod",rj=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],ib=T(yC,rj,n=>{var{typed:e,config:t,BigNumber:r,xgcd:i,equal:a,smaller:o,mod:u,add:s,isInteger:l}=n;return e(yC,{"number, number":c,"BigNumber, BigNumber":c});function c(f,p){if(!l(f)||!l(p))throw new Error("Parameters in function invmod must be integer numbers");if(f=u(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,r(1))?(d=u(d,p),o(d,r(0))&&(d=s(d,p)),d):NaN}});var nj="matAlgo09xS0Sf",ij=["typed","equalScalar"],km=T(nj,ij,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,v=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(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 y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===v&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=D?[]:void 0,P=[],B,V,z,L,k;for(V=0;V<S;V++){_[V]=E.length;var C=V+1;if(N)for(L=h[V],k=h[V+1],z=L;z<k;z++)B=m[z],P[B]=C,N[B]=p[z];for(L=l[V],k=l[V+1],z=L;z<k;z++)if(B=s[z],N){var W=P[B]===C?N[B]:A,O=x(u[z],W);w(O,A)||(E.push(B),D.push(O))}else E.push(B)}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&v===a._datatype?b:void 0})}});var bC="dotMultiply",aj=["typed","matrix","equalScalar","multiplyScalar","concat"],ab=T(bC,aj,n=>{var{typed:e,matrix:t,equalScalar:r,multiplyScalar:i,concat:a}=n,o=pn({typed:e,equalScalar:r}),u=km({typed:e,equalScalar:r}),s=xr({typed:e,equalScalar:r}),l=Ct({typed:e,matrix:t,concat:a});return e(bC,l({elop:i,SS:u,DS:o,Ss:s}))});function xC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero()||e.eq(-1)||n.eq(e))return n;if(e.isZero()||n.eq(-1))return e;if(!n.isFinite()||!e.isFinite()){if(!n.isFinite()&&!e.isFinite())return n.isNegative()===e.isNegative()?n:new t(0);if(!n.isFinite())return e.isNegative()?n:n.isNegative()?new t(0):e;if(!e.isFinite())return n.isNegative()?e:e.isNegative()?new t(0):n}return ob(n,e,function(r,i){return r&i})}function dl(n){if(n.isFinite()&&!n.isInteger())throw new Error("Integer expected in function bitNot");var e=n.constructor,t=e.precision;e.config({precision:1e9});var r=n.plus(new e(1));return r.s=-r.s||null,e.config({precision:t}),r}function wC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);var r=new t(-1);return n.isZero()||e.eq(r)||n.eq(e)?e:e.isZero()||n.eq(r)?n:!n.isFinite()||!e.isFinite()?!n.isFinite()&&!n.isNegative()&&e.isNegative()||n.isNegative()&&!e.isNegative()&&!e.isFinite()?r:n.isNegative()&&e.isNegative()?n.isFinite()?n:e:n.isFinite()?e:n:ob(n,e,function(i,a){return i|a})}function ob(n,e,t){var r=n.constructor,i,a,o=+(n.s<0),u=+(e.s<0);if(o){i=Bm(dl(n));for(var s=0;s<i.length;++s)i[s]^=1}else i=Bm(n);if(u){a=Bm(dl(e));for(var l=0;l<a.length;++l)a[l]^=1}else a=Bm(e);var c,f,p;i.length<=a.length?(c=i,f=a,p=o):(c=a,f=i,p=u);var m=c.length,h=f.length,d=t(o,u)^1,v=new r(d^1),y=new r(1),S=new r(2),b=r.precision;for(r.config({precision:1e9});m>0;)t(c[--m],f[--h])===d&&(v=v.plus(y)),y=y.times(S);for(;h>0;)t(p,f[--h])===d&&(v=v.plus(y)),y=y.times(S);return r.config({precision:b}),d===0&&(v.s=-v.s),v}function Bm(n){for(var e=n.d,t=e[0]+"",r=1;r<e.length;++r){for(var i=e[r]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;t.charAt(o)==="0";)o--;var u=n.e,s=t.slice(0,o+1||1),l=s.length;if(u>0)if(++u>l)for(u-=l;u--;)s+="0";else u<l&&(s=s.slice(0,u)+"."+s.slice(u));for(var c=[0],f=0;f<s.length;){for(var p=c.length;p--;)c[p]*=10;c[0]+=parseInt(s.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 _C(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero())return e;if(e.isZero())return n;if(n.eq(e))return new t(0);var r=new t(-1);return n.eq(r)?dl(e):e.eq(r)?dl(n):!n.isFinite()||!e.isFinite()?!n.isFinite()&&!e.isFinite()?r:new t(n.isNegative()===e.isNegative()?1/0:-1/0):ob(n,e,function(i,a){return i^a})}function SC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:!n.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?n.times(Math.pow(2,e.toNumber())+""):n.times(new t(2).pow(e))}function AC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:e.isFinite()?e.lt(55)?n.div(Math.pow(2,e.toNumber())+"").floor():n.div(new t(2).pow(e)).floor():n.isNegative()?new t(-1):n.isFinite()?new t(0):new t(NaN)}var MC="bitAnd",oj=["typed","matrix","equalScalar","concat"],Fc=T(MC,oj,n=>{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=pn({typed:e,equalScalar:r}),o=ps({typed:e,equalScalar:r}),u=xr({typed:e,equalScalar:r}),s=Ct({typed:e,matrix:t,concat:i});return e(MC,{"number, number":Cy,"BigNumber, BigNumber":xC},s({SS:o,DS:a,Ss:u}))});var EC="bitNot",sj=["typed"],sb=T(EC,sj,n=>{var{typed:e}=n;return e(EC,{number:Fy,BigNumber:dl,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var DC="bitOr",uj=["typed","matrix","equalScalar","DenseMatrix","concat"],Ic=T(DC,uj,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=ti({typed:e}),u=ml({typed:e,equalScalar:r}),s=Ni({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e(DC,{"number, number":Iy,"BigNumber, BigNumber":wC},l({SS:u,DS:o,Ss:s}))});var lj="matAlgo07xSSf",cj=["typed","DenseMatrix"],Mn=T(lj,cj,n=>{var{typed:e,DenseMatrix:t}=n;return function(a,o,u){var s=a._size,l=a._datatype||a._data===void 0?a._datatype:a.getDataType(),c=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(s.length!==c.length)throw new Dt(s.length,c.length);if(s[0]!==c[0]||s[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");var p=s[0],m=s[1],h,d=0,v=u;typeof l=="string"&&l===f&&l!=="mixed"&&(h=l,d=e.convert(0,h),v=e.find(u,[h,h]));var y,S,b=[];for(y=0;y<p;y++)b[y]=[];var w=[],A=[],x=[],D=[];for(S=0;S<m;S++){var E=S+1;for(r(a,S,x,w,E),r(o,S,D,A,E),y=0;y<p;y++){var _=x[y]===E?w[y]:d,N=D[y]===E?A[y]:d;b[y][S]=v(_,N)}}return new t({data:b,size:[p,m],datatype:l===a._datatype&&f===o._datatype?h:void 0})};function r(i,a,o,u,s){for(var l=i._values,c=i._index,f=i._ptr,p=f[a],m=f[a+1];p<m;p++){var h=c[p];o[h]=s,u[h]=l[p]}}});var NC="bitXor",fj=["typed","matrix","DenseMatrix","concat"],ub=T(NC,fj,n=>{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=kr({typed:e}),o=Mn({typed:e,DenseMatrix:r}),u=cr({typed:e,DenseMatrix:r}),s=Ct({typed:e,matrix:t,concat:i});return e(NC,{"number, number":Py,"BigNumber, BigNumber":_C},s({SS:o,DS:a,Ss:u}))});var TC="arg",pj=["typed"],lb=T(TC,pj,n=>{var{typed:e}=n;return e(TC,{number:function(r){return Math.atan2(0,r)},BigNumber:function(r){return r.constructor.atan2(0,r)},Complex:function(r){return r.arg()},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var CC="conj",mj=["typed"],cb=T(CC,mj,n=>{var{typed:e}=n;return e(CC,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var FC="im",dj=["typed"],fb=T(FC,dj,n=>{var{typed:e}=n;return e(FC,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var IC="re",hj=["typed"],pb=T(IC,hj,n=>{var{typed:e}=n;return e(IC,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var PC="not",gj=["typed"],mb=T(PC,gj,n=>{var{typed:e}=n;return e(PC,{"null | undefined":()=>!0,number:Vy,Complex:function(r){return r.re===0&&r.im===0},BigNumber:function(r){return r.isZero()||r.isNaN()},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var kC="or",vj=["typed","matrix","equalScalar","DenseMatrix","concat"],Pc=T(kC,vj,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=fs({typed:e,equalScalar:r}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e(kC,{"number, number":Uy,"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))},l({SS:u,DS:o,Ss:s}))});var BC="xor",yj=["typed","matrix","DenseMatrix","concat"],db=T(BC,yj,n=>{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=kr({typed:e}),o=Mn({typed:e,DenseMatrix:r}),u=cr({typed:e,DenseMatrix:r}),s=Ct({typed:e,matrix:t,concat:i});return e(BC,{"number, number":qy,"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(l=>(c,f)=>l(c.value||0,f.value||0))},s({SS:o,DS:a,Ss:u}))});var OC="concat",bj=["typed","matrix","isInteger"],kc=T(OC,bj,n=>{var{typed:e,matrix:t,isInteger:r}=n;return e(OC,{"...Array | Matrix | number | BigNumber":function(a){var o,u=a.length,s=-1,l,c=!1,f=[];for(o=0;o<u;o++){var p=a[o];if(ot(p)&&(c=!0),At(p)||pt(p)){if(o!==u-1)throw new Error("Dimension must be specified as last argument");if(l=s,s=p.valueOf(),!r(s))throw new TypeError("Integer number expected for dimension");if(s<0||o>0&&s>l)throw new $n(s,l+1)}else{var m=vt(p).valueOf(),h=_t(m);if(f[o]=m,l=s,s=h.length-1,o>0&&s!==l)throw new Dt(l+1,s+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=$v(d,f.shift(),s);return c?t(d):d},"...string":function(a){return a.join("")}})});var RC="column",xj=["typed","Index","matrix","range"],Bc=T(RC,xj,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(RC,{"Matrix, number":a,"Array, number":function(u,s){return a(r(vt(u)),s).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");br(u,o.size()[1]);var s=i(0,o.size()[0]),l=new t(s,u),c=o.subset(l);return ot(c)?c:r([[c]])}});var LC="count",wj=["typed","size","prod"],hb=T(LC,wj,n=>{var{typed:e,size:t,prod:r}=n;return e(LC,{string:function(a){return a.length},"Matrix | Array":function(a){return r(t(a))}})});var VC="cross",_j=["typed","matrix","subtract","multiply"],gb=T(VC,_j,n=>{var{typed:e,matrix:t,subtract:r,multiply:i}=n;return e(VC,{"Matrix, Matrix":function(u,s){return t(a(u.toArray(),s.toArray()))},"Matrix, Array":function(u,s){return t(a(u.toArray(),s))},"Array, Matrix":function(u,s){return t(a(u,s.toArray()))},"Array, Array":a});function a(o,u){var s=Math.max(_t(o).length,_t(u).length);o=il(o),u=il(u);var l=_t(o),c=_t(u);if(l.length!==1||c.length!==1||l[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+l.join(", ")+"], B = ["+c.join(", ")+"])");var f=[r(i(o[1],u[2]),i(o[2],u[1])),r(i(o[2],u[0]),i(o[0],u[2])),r(i(o[0],u[1]),i(o[1],u[0]))];return s>1?[f]:f}});var UC="diag",Sj=["typed","matrix","DenseMatrix","SparseMatrix"],vb=T(UC,Sj,n=>{var{typed:e,matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e(UC,{Array:function(l){return a(l,0,_t(l),null)},"Array, number":function(l,c){return a(l,c,_t(l),null)},"Array, BigNumber":function(l,c){return a(l,c.toNumber(),_t(l),null)},"Array, string":function(l,c){return a(l,0,_t(l),c)},"Array, number, string":function(l,c,f){return a(l,c,_t(l),f)},"Array, BigNumber, string":function(l,c,f){return a(l,c.toNumber(),_t(l),f)},Matrix:function(l){return a(l,0,l.size(),l.storage())},"Matrix, number":function(l,c){return a(l,c,l.size(),l.storage())},"Matrix, BigNumber":function(l,c){return a(l,c.toNumber(),l.size(),l.storage())},"Matrix, string":function(l,c){return a(l,0,l.size(),c)},"Matrix, number, string":function(l,c,f){return a(l,c,l.size(),f)},"Matrix, BigNumber, string":function(l,c,f){return a(l,c.toNumber(),l.size(),f)}});function a(s,l,c,f){if(!nt(l))throw new TypeError("Second parameter in function diag must be an integer");var p=l>0?l:0,m=l<0?-l:0;switch(c.length){case 1:return o(s,l,f,c[0],m,p);case 2:return u(s,l,f,c,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(s,l,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,s,l):r.diagonal(h,s,l);return c!==null?d:d.valueOf()}function u(s,l,c,f,p,m){if(ot(s)){var h=s.diagonal(l);return c!==null?c!==h.storage()?t(h,c):h:h.valueOf()}for(var d=Math.min(f[0]-p,f[1]-m),v=[],y=0;y<d;y++)v[y]=s[y+p][y+m];return c!==null?t(v):v}});var Oc=wr(Bv(),1);function ca(n,e,t,r,i){if(Oc.default.isTypedFunction(n)){var a=[e,t,r],o=Oc.default.resolve(n,a);if(o)return f(o.implementation,a);var u=[e,t],s=Oc.default.resolve(n,u);if(s)return f(s.implementation,u);var l=[e],c=Oc.default.resolve(n,l);return c?f(c.implementation,l):f(n,a)}else return n(e,t,r);function f(p,m){try{return p.apply(p,m)}catch(v){var h;if(v instanceof TypeError&&((h=v.data)===null||h===void 0?void 0:h.category)==="wrongType"){var d=[];throw d.push("value: ".concat(Kt(e))),m.length>=2&&d.push("index: ".concat(Kt(t))),m.length>=3&&d.push("array: ".concat(Kt(r))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(n.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(n.name,": ").concat(v.message))}}}var Aj="filter",Mj=["typed"],yb=T(Aj,Mj,n=>{var{typed:e}=n;return e("filter",{"Array, function":qC,"Matrix, function":function(r,i){return r.create(qC(r.toArray(),i))},"Array, RegExp":al,"Matrix, RegExp":function(r,i){return r.create(al(r.toArray(),i))}})});function qC(n,e){return ym(n,function(t,r,i){return ca(e,t,[r],i,"filter")})}var zC="flatten",Ej=["typed","matrix"],bb=T(zC,Ej,n=>{var{typed:e,matrix:t}=n;return e(zC,{Array:function(i){return kt(i)},Matrix:function(i){var a=kt(i.toArray());return t(a)}})});var $C="forEach",Dj=["typed"],xb=T($C,Dj,n=>{var{typed:e}=n;return e($C,{"Array, function":Nj,"Matrix, function":function(r,i){r.forEach(i)}})});function Nj(n,e){var t=function r(i,a){if(Array.isArray(i))ns(i,function(o,u){r(o,a.concat(u))});else return ca(e,i,a,n,"forEach")};t(n,[])}var HC="getMatrixDataType",Tj=["typed"],wb=T(HC,Tj,n=>{var{typed:e}=n;return e(HC,{Array:function(r){return is(r,Kt)},Matrix:function(r){return r.getDataType()}})});var GC="identity",Cj=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],_b=T(GC,Cj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=n;return e(GC,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(c){return r(c)},"number | BigNumber":function(c){return s(c,c,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return s(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return s(c,f,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,p){return s(c,f,p)},Array:function(c){return u(c)},"Array, string":function(c,f){return u(c,f)},Matrix:function(c){return u(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return u(c.valueOf(),f)}});function u(l,c){switch(l.length){case 0:return c?r(c):[];case 1:return s(l[0],l[0],c);case 2:return s(l[0],l[1],c);default:throw new Error("Vector containing two values expected")}}function s(l,c,f){var p=pt(l)||pt(c)?i:null;if(pt(l)&&(l=l.toNumber()),pt(c)&&(c=c.toNumber()),!nt(l)||l<1)throw new Error("Parameters in function identity must be positive integers");if(!nt(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=[l,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 v=Fa([],d,h),y=l<c?l:c,S=0;S<y;S++)v[S][S]=m;return v}});var WC="kron",Fj=["typed","matrix","multiplyScalar"],Sb=T(WC,Fj,n=>{var{typed:e,matrix:t,multiplyScalar:r}=n;return e(WC,{"Matrix, Matrix":function(o,u){return t(i(o.toArray(),u.toArray()))},"Matrix, Array":function(o,u){return t(i(o.toArray(),u))},"Array, Matrix":function(o,u){return t(i(o,u.toArray()))},"Array, Array":i});function i(a,o){if(_t(a).length===1&&(a=[a]),_t(o).length===1&&(o=[o]),_t(a).length>2||_t(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 u=[],s=[];return a.map(function(l){return o.map(function(c){return s=[],u.push(s),l.map(function(f){return c.map(function(p){return s.push(r(f,p))})})})})&&u}});var YC="map",Ij=["typed"],Ab=T(YC,Ij,n=>{var{typed:e}=n;return e(YC,{"Array, function":Pj,"Matrix, function":function(r,i){return r.map(i)}})});function Pj(n,e){var t=function r(i,a){return Array.isArray(i)?i.map(function(o,u){return r(o,a.concat(u))}):ca(e,i,a,n,"map")};return t(n,[])}var jC="diff",kj=["typed","matrix","subtract","number"],Rc=T(jC,kj,n=>{var{typed:e,matrix:t,subtract:r,number:i}=n;return e(jC,{"Array | Matrix":function(c){return ot(c)?t(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!nt(f))throw new RangeError("Dimension must be a whole number");return ot(c)?t(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",l=>(c,f)=>l(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",l=>(c,f)=>l(c,i(f)))});function a(l,c){if(ot(l)&&(l=l.toArray()),!Array.isArray(l))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return l.forEach(p=>{f.push(a(p,c-1))}),f}else{if(c===0)return o(l);throw RangeError("Cannot have negative dimension")}}function o(l){for(var c=[],f=l.length,p=1;p<f;p++)c.push(u(l[p-1],l[p]));return c}function u(l,c){ot(l)&&(l=l.toArray()),ot(c)&&(c=c.toArray());var f=Array.isArray(l),p=Array.isArray(c);if(f&&p)return s(l,c);if(!f&&!p)return r(c,l);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function s(l,c){if(l.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],p=l.length,m=0;m<p;m++)f.push(u(l[m],c[m]));return f}});var Bj="ones",Oj=["typed","config","matrix","BigNumber"],Mb=T(Bj,Oj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e("ones",{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(l){var c=l[l.length-1];if(typeof c=="string"){var f=l.pop();return a(l,f)}else return t.matrix==="Array"?a(l):a(l,"default")},Array:a,Matrix:function(l){var c=l.storage();return a(l.valueOf(),c)},"Array | Matrix, string":function(l,c){return a(l.valueOf(),c)}});function a(s,l){var c=o(s),f=c?new i(1):1;if(u(s),l){var p=r(l);return s.length>0?p.resize(s,f):p}else{var m=[];return s.length>0?Fa(m,s,f):m}}function o(s){var l=!1;return s.forEach(function(c,f,p){pt(c)&&(l=!0,p[f]=c.toNumber())}),l}function u(s){s.forEach(function(l){if(typeof l!="number"||!nt(l)||l<0)throw new Error("Parameters in function ones must be positive integers")})}});function hl(){throw new Error('No "bignumber" implementation available')}function Om(){throw new Error('No "fraction" implementation available')}function Rm(){throw new Error('No "matrix" implementation available')}var ZC="range",Rj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Lc=T(ZC,Rj,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,isPositive:c}=n;return e(ZC,{string:p,"string, boolean":p,"number, number":function(v,y){return f(m(v,y,1,!1))},"number, number, number":function(v,y,S){return f(m(v,y,S,!1))},"number, number, boolean":function(v,y,S){return f(m(v,y,1,S))},"number, number, number, boolean":function(v,y,S,b){return f(m(v,y,S,b))},"BigNumber, BigNumber":function(v,y){var S=v.constructor;return f(m(v,y,new S(1),!1))},"BigNumber, BigNumber, BigNumber":function(v,y,S){return f(m(v,y,S,!1))},"BigNumber, BigNumber, boolean":function(v,y,S){var b=v.constructor;return f(m(v,y,new b(1),S))},"BigNumber, BigNumber, BigNumber, boolean":function(v,y,S,b){return f(m(v,y,S,b))},"Unit, Unit, Unit":function(v,y,S){return f(m(v,y,S,!1))},"Unit, Unit, Unit, boolean":function(v,y,S,b){return f(m(v,y,S,b))}});function f(d){return t.matrix==="Matrix"?r?r(d):Rm():d}function p(d,v){var y=h(d);if(!y)throw new SyntaxError('String "'+d+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&hl(),f(m(i(y.start),i(y.end),i(y.step)),v)):f(m(y.start,y.end,y.step,v))}function m(d,v,y,S){for(var b=[],w=c(y)?S?o:a:S?s:u,A=d;w(A,v);)b.push(A),A=l(A,y);return b}function h(d){var v=d.split(":"),y=v.map(function(b){return Number(b)}),S=y.some(function(b){return isNaN(b)});if(S)return null;switch(y.length){case 2:return{start:y[0],end:y[1],step:1};case 3:return{start:y[0],end:y[2],step:y[1]};default:return null}}});var JC="reshape",Lj=["typed","isInteger","matrix"],Eb=T(JC,Lj,n=>{var{typed:e,isInteger:t}=n;return e(JC,{"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)}),wc(i,a)}})});var Vj="resize",Uj=["config","matrix"],Db=T(Vj,Uj,n=>{var{config:e,matrix:t}=n;return function(a,o,u){if(arguments.length!==2&&arguments.length!==3)throw new Do("resize",arguments.length,2,3);if(ot(o)&&(o=o.valueOf()),pt(o[0])&&(o=o.map(function(c){return pt(c)?c.toNumber():c})),ot(a))return a.resize(o,u,!0);if(typeof a=="string")return r(a,o,u);var s=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return vt(a)}else{Array.isArray(a)||(a=[a]),a=vt(a);var l=Fa(a,o,u);return s?t(l):l}};function r(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 Dt(a.length,1);var u=a[0];if(typeof u!="number"||!nt(u))throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(a)+")");if(i.length>u)return i.substring(0,u);if(i.length<u){for(var s=i,l=0,c=u-i.length;l<c;l++)s+=o;return s}else return i}});var XC="rotate",qj=["typed","multiply","rotationMatrix"],Nb=T(XC,qj,n=>{var{typed:e,multiply:t,rotationMatrix:r}=n;return e(XC,{"Array , number | BigNumber | Complex | Unit":function(o,u){i(o,2);var s=t(r(u),o);return s.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,u){return i(o,2),t(r(u),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,s){i(o,3);var l=t(r(u,s),o);return l},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,s){return i(o,3),t(r(u,s),o)}});function i(a,o){var u=Array.isArray(a)?_t(a):a.size();if(u.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u.length===2&&u[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var QC="rotationMatrix",zj=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],Tb=T(QC,zj,n=>{var{typed:e,config:t,multiplyScalar:r,addScalar:i,unaryMinus:a,norm:o,BigNumber:u,matrix:s,DenseMatrix:l,SparseMatrix:c,cos:f,sin:p}=n;return e(QC,{"":function(){return t.matrix==="Matrix"?s([]):[]},string:function(b){return s(b)},"number | BigNumber | Complex | Unit":function(b){return m(b,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(b,w){return m(b,w)},"number | BigNumber | Complex | Unit, Array":function(b,w){var A=s(w);return h(A),y(b,A,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(b,w){h(w);var A=w.storage()||(t.matrix==="Matrix"?"dense":void 0);return y(b,w,A)},"number | BigNumber | Complex | Unit, Array, string":function(b,w,A){var x=s(w);return h(x),y(b,x,A)},"number | BigNumber | Complex | Unit, Matrix, string":function(b,w,A){return h(w),y(b,w,A)}});function m(S,b){var w=pt(S),A=w?new u(-1):-1,x=f(S),D=p(S),E=[[x,r(A,D)],[D,x]];return v(E,b)}function h(S){var b=S.size();if(b.length<1||b[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(S){return S.reduce((b,w)=>r(b,w))}function v(S,b){if(b){if(b==="sparse")return new c(S);if(b==="dense")return new l(S);throw new TypeError('Unknown matrix type "'.concat(b,'"'))}return S}function y(S,b,w){var A=o(b);if(A===0)throw new RangeError("Rotation around zero vector");var x=pt(S)?u:null,D=x?new x(1):1,E=x?new x(-1):-1,_=x?new x(b.get([0])/A):b.get([0])/A,N=x?new x(b.get([1])/A):b.get([1])/A,P=x?new x(b.get([2])/A):b.get([2])/A,B=f(S),V=i(D,a(B)),z=p(S),L=i(B,d([_,_,V])),k=i(d([_,N,V]),d([E,P,z])),C=i(d([_,P,V]),d([N,z])),W=i(d([_,N,V]),d([P,z])),O=i(B,d([N,N,V])),H=i(d([N,P,V]),d([E,_,z])),Z=i(d([_,P,V]),d([E,N,z])),Q=i(d([N,P,V]),d([_,z])),U=i(B,d([P,P,V])),de=[[L,k,C],[W,O,H],[Z,Q,U]];return v(de,w)}});var KC="row",$j=["typed","Index","matrix","range"],Vc=T(KC,$j,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(KC,{"Matrix, number":a,"Array, number":function(u,s){return a(r(vt(u)),s).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");br(u,o.size()[0]);var s=i(0,o.size()[1]),l=new t(u,s),c=o.subset(l);return ot(c)?c:r([[c]])}});var e2="size",Hj=["typed","config","?matrix"],Cb=T(e2,Hj,n=>{var{typed:e,config:t,matrix:r}=n;return e(e2,{Matrix:function(a){return a.create(a.size())},Array:_t,string:function(a){return t.matrix==="Array"?[a.length]:r([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:r?r([]):Rm()}})});var t2="squeeze",Gj=["typed","matrix"],Fb=T(t2,Gj,n=>{var{typed:e,matrix:t}=n;return e(t2,{Array:function(i){return il(vt(i))},Matrix:function(i){var a=il(i.toArray());return Array.isArray(a)?t(a):a},any:function(i){return vt(i)}})});var r2="subset",Wj=["typed","matrix","zeros","add"],Uc=T(r2,Wj,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n;return e(r2,{"Matrix, Index":function(u,s){return Xs(s)?t():(xc(u,s),u.subset(s))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(u,s){var l=o(t(u),s);return s.isScalar()?l:l.valueOf()}}),"Object, Index":jj,"string, Index":Yj,"Matrix, Index, any, any":function(u,s,l,c){return Xs(s)?u:(xc(u,s),u.clone().subset(s,a(l,s),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l,c){var f=o(t(u),s,l,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l){return o(t(u),s,l,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l){return o(u,s,l,void 0)}}),"string, Index, string":n2,"string, Index, string, string":n2,"Object, Index, any":Zj});function a(o,u){if(typeof o=="string")throw new Error("can't boradcast a string");if(u._isScalar)return o;var s=u.size();if(s.every(l=>l>0))try{return i(o,r(s))}catch{return o}else return o}});function Yj(n,e){if(!es(e))throw new TypeError("Index expected");if(Xs(e))return"";if(xc(Array.from(n),e),e.size().length!==1)throw new Dt(e.size().length,1);var t=n.length;br(e.min()[0],t),br(e.max()[0],t);var r=e.dimension(0),i="";return r.forEach(function(a){i+=n.charAt(a)}),i}function n2(n,e,t,r){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Xs(e))return n;if(xc(Array.from(n),e),e.size().length!==1)throw new Dt(e.size().length,1);if(r!==void 0){if(typeof r!="string"||r.length!==1)throw new TypeError("Single character expected as defaultValue")}else r=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new Dt(i.size()[0],t.length);var o=n.length;br(e.min()[0]),br(e.max()[0]);for(var u=[],s=0;s<o;s++)u[s]=n.charAt(s);if(i.forEach(function(f,p){u[f]=t.charAt(p[0])}),u.length>o)for(var l=o-1,c=u.length;l<c;l++)u[l]||(u[l]=r);return u.join("")}function jj(n,e){if(!Xs(e)){if(e.size().length!==1)throw new Dt(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 $r(n,t)}}function Zj(n,e,t){if(Xs(e))return n;if(e.size().length!==1)throw new Dt(e.size(),1);var r=e.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");var i=vt(n);return ja(i,r,t),i}var i2="transpose",Jj=["typed","matrix"],Ib=T(i2,Jj,n=>{var{typed:e,matrix:t}=n;return e(i2,{Array:o=>r(t(o)).valueOf(),Matrix:r,any:vt});function r(o){var u=o.size(),s;switch(u.length){case 1:s=o.clone();break;case 2:{var l=u[0],c=u[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Mt(u)+")");switch(o.storage()){case"dense":s=i(o,l,c);break;case"sparse":s=a(o,l,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Mt(u)+")")}return s}function i(o,u,s){for(var l=o._data,c=[],f,p=0;p<s;p++){f=c[p]=[];for(var m=0;m<u;m++)f[m]=vt(l[m][p])}return o.createDenseMatrix({data:c,size:[s,u],datatype:o._datatype})}function a(o,u,s){for(var l=o._values,c=o._index,f=o._ptr,p=l?[]:void 0,m=[],h=[],d=[],v=0;v<u;v++)d[v]=0;var y,S,b;for(y=0,S=c.length;y<S;y++)d[c[y]]++;for(var w=0,A=0;A<u;A++)h.push(w),w+=d[A],d[A]=h[A];for(h.push(w),b=0;b<s;b++)for(var x=f[b],D=f[b+1],E=x;E<D;E++){var _=d[c[E]]++;m[_]=b,l&&(p[_]=vt(l[E]))}return o.createSparseMatrix({values:p,index:m,ptr:h,size:[s,u],datatype:o._datatype})}});var a2="ctranspose",Xj=["typed","transpose","conj"],Pb=T(a2,Xj,n=>{var{typed:e,transpose:t,conj:r}=n;return e(a2,{any:function(a){return r(t(a))}})});var o2="zeros",Qj=["typed","config","matrix","BigNumber"],kb=T(o2,Qj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(o2,{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(l){var c=l[l.length-1];if(typeof c=="string"){var f=l.pop();return a(l,f)}else return t.matrix==="Array"?a(l):a(l,"default")},Array:a,Matrix:function(l){var c=l.storage();return a(l.valueOf(),c)},"Array | Matrix, string":function(l,c){return a(l.valueOf(),c)}});function a(s,l){var c=o(s),f=c?new i(0):0;if(u(s),l){var p=r(l);return s.length>0?p.resize(s,f):p}else{var m=[];return s.length>0?Fa(m,s,f):m}}function o(s){var l=!1;return s.forEach(function(c,f,p){pt(c)&&(l=!0,p[f]=c.toNumber())}),l}function u(s){s.forEach(function(l){if(typeof l!="number"||!nt(l)||l<0)throw new Error("Parameters in function zeros must be positive integers")})}});var s2="fft",Kj=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Bb=T(s2,Kj,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,divideScalar:a,exp:o,tau:u,i:s,dotDivide:l,conj:c,pow:f,ceil:p,log2:m}=n;return e(s2,{Array:h,Matrix:function(b){return b.create(h(b.toArray()))}});function h(S){var b=_t(S);return b.length===1?y(S,b[0]):d(S.map(w=>h(w,b.slice(1))),0)}function d(S,b){var w=_t(S);if(b!==0)return new Array(w[0]).fill(0).map((x,D)=>d(S[D],b-1));if(w.length===1)return y(S);function A(x){var D=_t(x);return new Array(D[1]).fill(0).map((E,_)=>new Array(D[0]).fill(0).map((N,P)=>x[P][_]))}return A(d(A(S),1))}function v(S){for(var b=S.length,w=o(a(i(-1,i(s,u)),b)),A=[],x=1-b;x<b;x++)A.push(f(w,a(f(x,2),2)));for(var D=f(2,p(m(b+b-1))),E=[...new Array(b).fill(0).map((k,C)=>i(S[C],A[b-1+C])),...new Array(D-b).fill(0)],_=[...new Array(b+b-1).fill(0).map((k,C)=>a(1,A[C])),...new Array(D-(b+b-1)).fill(0)],N=y(E),P=y(_),B=new Array(D).fill(0).map((k,C)=>i(N[C],P[C])),V=l(c(h(c(B))),D),z=[],L=b-1;L<b+b-1;L++)z.push(i(V[L],A[L]));return z}function y(S){var b=S.length;if(b===1)return[S[0]];if(b%2===0){for(var w=[...y(S.filter((E,_)=>_%2===0),b/2),...y(S.filter((E,_)=>_%2===1),b/2)],A=0;A<b/2;A++){var x=w[A],D=i(w[A+b/2],o(i(i(u,s),a(-A,b))));w[A]=r(x,D),w[A+b/2]=r(x,i(-1,D))}return w}else return v(S)}});var u2="ifft",eZ=["typed","fft","dotDivide","conj"],Ob=T(u2,eZ,n=>{var{typed:e,fft:t,dotDivide:r,conj:i}=n;return e(u2,{"Array | Matrix":function(o){var u=ot(o)?o.size():_t(o);return r(i(t(i(o))),u.reduce((s,l)=>s*l,1))}})});function ms(n){"@babel/helpers - typeof";return ms=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},ms(n)}function Rb(n,e){if(ms(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(ms(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Lb(n){var e=Rb(n,"string");return ms(e)=="symbol"?e:e+""}function fr(n,e,t){return e=Lb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function l2(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function tZ(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?l2(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):l2(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var rZ="solveODE",nZ=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],Vb=T(rZ,nZ,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,max:o,map:u,abs:s,isPositive:l,isNegative:c,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:d}=n;function v(E){return function(_,N,P,B){var V=!(N.length===2&&(N.every(x)||N.every(Un)));if(V)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var z=N[0],L=N[1],k=f(L,z),C=B.firstStep;if(C!==void 0&&!l(C))throw new Error('"firstStep" must be positive');var W=B.maxStep;if(W!==void 0&&!l(W))throw new Error('"maxStep" must be positive');var O=B.minStep;if(O&&c(O))throw new Error('"minStep" must be positive or zero');var H=[z,L,C,O,W].filter(Ze=>Ze!==void 0);if(!(H.every(x)||H.every(Un)))throw new Error('Inconsistent type of "t" dependant variables');for(var Z=1,Q=B.tol?B.tol:1e-4,U=B.minDelta?B.minDelta:.2,de=B.maxDelta?B.maxDelta:5,De=B.maxIter?B.maxIter:1e4,me=[z,L,...P,W,O].some(pt),[_e,Ne,Se,Me]=me?[h(E.a),h(E.c),h(E.b),h(E.bp)]:[E.a,E.c,E.b,E.bp],Ee=C?k?C:d(C):a(r(L,z),Z),Ce=[z],Ge=[P],We=r(Se,Me),te=0,oe=0,ge=w(k),ie=A(k);ge(Ce[te],L);){var re=[];Ee=ie(Ce[te],L,Ee),re.push(_(Ce[te],Ge[te]));for(var le=1;le<Ne.length;++le)re.push(_(t(Ce[te],i(Ne[le],Ee)),t(Ge[te],i(Ee,_e[le],re))));var Te=o(s(u(i(We,re),Ze=>Un(Ze)?Ze.value:Ze)));Te<Q&&Q/Te>1/4&&(Ce.push(t(Ce[te],Ee)),Ge.push(t(Ge[te],i(Ee,Se,re))),te++);var Ie=.84*(Q/Te)**(1/5);if(p(Ie,U)?Ie=U:f(Ie,de)&&(Ie=de),Ie=me?h(Ie):Ie,Ee=i(Ee,Ie),W&&f(s(Ee),W)?Ee=k?W:d(W):O&&p(s(Ee),O)&&(Ee=k?O:d(O)),oe++,oe>De)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ce,y:Ge}}}function y(E,_,N,P){var B=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],V=[null,1/2,3/4,1],z=[2/9,1/3,4/9,0],L=[7/24,1/4,1/3,1/8],k={a:B,c:V,b:z,bp:L};return v(k)(E,_,N,P)}function S(E,_,N,P){var B=[[],[.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]],V=[null,1/5,3/10,4/5,8/9,1,1],z=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],L=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],k={a:B,c:V,b:z,bp:L};return v(k)(E,_,N,P)}function b(E,_,N,P){var B=P.method?P.method:"RK45",V={RK23:y,RK45:S};if(B.toUpperCase()in V){var z=tZ({},P);return delete z.method,V[B.toUpperCase()](E,_,N,z)}else{var L=Object.keys(V).map(C=>'"'.concat(C,'"')),k="".concat(L.slice(0,-1).join(", ")," and ").concat(L.slice(-1));throw new Error('Unavailable method "'.concat(B,'". Available methods are ').concat(k))}}function w(E){return E?p:f}function A(E){var _=E?f:p;return function(N,P,B){var V=t(N,B);return _(V,P)?r(P,N):B}}function x(E){return pt(E)||At(E)}function D(E,_,N,P){var B=b(E,_.toArray(),N.toArray(),P);return{t:m(B.t),y:m(B.y)}}return e("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":D,"function, Array, Array":(E,_,N)=>b(E,_,N,{}),"function, Matrix, Matrix":(E,_,N)=>D(E,_,N,{}),"function, Array, number | BigNumber | Unit":(E,_,N)=>{var P=b(E,_,[N],{});return{t:P.t,y:P.y.map(B=>B[0])}},"function, Matrix, number | BigNumber | Unit":(E,_,N)=>{var P=b(E,_.toArray(),[N],{});return{t:m(P.t),y:m(P.y.map(B=>B[0]))}},"function, Array, number | BigNumber | Unit, Object":(E,_,N,P)=>{var B=b(E,_,[N],P);return{t:B.t,y:B.y.map(V=>V[0])}},"function, Matrix, number | BigNumber | Unit, Object":(E,_,N,P)=>{var B=b(E,_.toArray(),[N],P);return{t:m(B.t),y:m(B.y.map(V=>V[0]))}}})});var iZ="erf",aZ=["typed"],Ub=T(iZ,aZ,n=>{var{typed:e}=n;return e("name",{number:function(o){var u=Math.abs(o);return u>=uZ?sa(o):u<=oZ?sa(o)*t(u):u<=4?sa(o)*(1-r(u)):sa(o)*(1-i(u))},"Array | Matrix":e.referToSelf(a=>o=>lt(o,a))});function t(a){var o=a*a,u=No[0][4]*o,s=o,l;for(l=0;l<3;l+=1)u=(u+No[0][l])*o,s=(s+gl[0][l])*o;return a*(u+No[0][3])/(s+gl[0][3])}function r(a){var o=No[1][8]*a,u=a,s;for(s=0;s<7;s+=1)o=(o+No[1][s])*a,u=(u+gl[1][s])*a;var l=(o+No[1][7])/(u+gl[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*l}function i(a){var o=1/(a*a),u=No[2][5]*o,s=o,l;for(l=0;l<4;l+=1)u=(u+No[2][l])*o,s=(s+gl[2][l])*o;var c=o*(u+No[2][4])/(s+gl[2][4]);c=(sZ-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),oZ=.46875,sZ=.5641895835477563,No=[[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]],gl=[[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]],uZ=Math.pow(2,53);var c2="zeta",lZ=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],qb=T(c2,lZ,n=>{var{typed:e,config:t,multiply:r,pow:i,divide:a,factorial:o,equal:u,smallerEq:s,isNegative:l,gamma:c,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:v}=n;return e(c2,{number:x=>y(x,D=>D,()=>20),BigNumber:x=>y(x,D=>new d(D),()=>Math.abs(Math.log10(t.epsilon))),Complex:S});function y(x,D,E){return u(x,0)?D(-.5):u(x,1)?D(NaN):isFinite(x)?b(x,D,E,_=>_):l(x)?D(NaN):D(1)}function S(x){return x.re===0&&x.im===0?new h(-.5):x.re===1?new h(NaN,NaN):x.re===1/0&&x.im===0?new h(1):x.im===1/0||x.re===-1/0?new h(NaN,NaN):b(x,D=>D,D=>Math.round(1.3*15+.9*Math.abs(D.im)),D=>D.re)}function b(x,D,E,_){var N=E(x);if(_(x)>-(N-1)/2)return A(x,D(N),D);var P=r(i(2,x),i(D(v),p(x,1)));return P=r(P,f(r(a(D(v),2),x))),P=r(P,c(p(1,x))),r(P,b(p(1,x),D,E,_))}function w(x,D){for(var E=x,_=x;s(_,D);_=m(_,1)){var N=a(r(o(m(D,p(_,1))),i(4,_)),r(o(p(D,_)),o(r(2,_))));E=m(E,N)}return r(D,E)}function A(x,D,E){for(var _=a(1,r(w(E(0),D),p(1,i(2,p(1,x))))),N=E(0),P=E(1);s(P,D);P=m(P,1))N=m(N,a(r((-1)**(P-1),w(P,D)),i(P,x)));return r(_,N)}});var f2="mode",cZ=["typed","isNaN","isNumeric"],zb=T(f2,cZ,n=>{var{typed:e,isNaN:t,isNumeric:r}=n;return e(f2,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=kt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},s=[],l=0,c=0;c<a.length;c++){var f=a[c];if(r(f)&&t(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in u||(u[f]=0),u[f]++,u[f]===l?s.push(f):u[f]>l&&(l=u[f],s=[f])}return s}});function nn(n,e,t){var r;return String(n).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+Kt(t)+", value: "+JSON.stringify(t)+")":" (type: "+n.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(n).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+Kt(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):n}var p2="prod",fZ=["typed","config","multiplyScalar","numeric"],$b=T(p2,fZ,n=>{var{typed:e,config:t,multiplyScalar:r,numeric:i}=n;return e(p2,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(u,s){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return a(u)}});function a(o){var u;if(ei(o,function(s){try{u=u===void 0?s:r(u,s)}catch(l){throw nn(l,"prod",s)}}),typeof u=="string"&&(u=i(u,t.number)),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}});var m2="format",pZ=["typed"],Hb=T(m2,pZ,n=>{var{typed:e}=n;return e(m2,{any:Mt,"any, Object | function | number | BigNumber":Mt})});var d2="bin",mZ=["typed","format"],Gb=T(d2,mZ,n=>{var{typed:e,format:t}=n;return e(d2,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var h2="oct",dZ=["typed","format"],Wb=T(h2,dZ,n=>{var{typed:e,format:t}=n;return e(h2,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var g2="hex",hZ=["typed","format"],Yb=T(g2,hZ,n=>{var{typed:e,format:t}=n;return e(g2,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var Lm=/\$([\w.]+)/g;var v2="print",gZ=["typed"],qc=T(v2,gZ,n=>{var{typed:e}=n;return e(v2,{"string, Object | Array":y2,"string, Object | Array, number | Object":y2})});function y2(n,e,t){return n.replace(Lm,function(r,i){var a=i.split("."),o=e[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var u=a.shift();o=u?o[u]:o+"."}return o!==void 0?tn(o)?o:Mt(o,t):r})}var b2="to",vZ=["typed","matrix","concat"],jb=T(b2,vZ,n=>{var{typed:e,matrix:t,concat:r}=n,i=Ct({typed:e,matrix:t,concat:r});return e(b2,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var x2="isPrime",yZ=["typed"],Zb=T(x2,yZ,n=>{var{typed:e}=n;return e(x2,{number:function(r){if(r*0!==0)return!1;if(r<=3)return r>1;if(r%2===0||r%3===0)return!1;for(var i=5;i*i<=r;i+=6)if(r%i===0||r%(i+2)===0)return!1;return!0},BigNumber:function(r){if(r.toNumber()*0!==0)return!1;if(r.lte(3))return r.gt(1);if(r.mod(2).eq(0)||r.mod(3).eq(0))return!1;if(r.lt(Math.pow(2,32))){for(var i=r.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(S,b,w){for(var A=1;!b.eq(0);)b.mod(2).eq(0)?(b=b.div(2),S=S.mul(S).mod(w)):(b=b.sub(1),A=S.mul(A).mod(w));return A}var u=r.constructor.clone({precision:r.toFixed(0).length*2});r=new u(r);for(var s=0,l=r.sub(1);l.mod(2).eq(0);)l=l.div(2),s+=1;var c=null;if(r.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(S=>S<r);else{var f=Math.min(r.toNumber()-2,Math.floor(2*Math.pow(r.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(r.sub(r).add(h),l,r);if(!d.eq(1)){for(var v=0,y=d;!y.eq(r.sub(1));v+=1,y=y.mul(y).mod(r))if(v===s-1)return!1}}return!0},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var bZ="numeric",xZ=["number","?bignumber","?fraction"],Jb=T(bZ,xZ,n=>{var{number:e,bignumber:t,fraction:r}=n,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):hl,Fraction:r?o=>r(o):Om};return function(u){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",l=arguments.length>2?arguments[2]:void 0;if(l!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=Kt(u);if(!(c in i))throw new TypeError("Cannot convert "+u+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(s in a))throw new TypeError("Cannot convert "+u+' to type "'+s+'"; valid output types are '+Object.keys(a).join(", "));return s===c?u:a[s](u)}});var w2="divideScalar",wZ=["typed","numeric"],Xb=T(w2,wZ,n=>{var{typed:e,numeric:t}=n;return e(w2,{"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":(r,i)=>r.divide(i),"number | Fraction | Complex | BigNumber, Unit":(r,i)=>i.divideInto(r)})});var _2="pow",_Z=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],Qb=T(_2,_Z,n=>{var{typed:e,config:t,identity:r,multiply:i,matrix:a,inv:o,number:u,fraction:s,Complex:l}=n;return e(_2,{"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 l(h.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(h,d){var v=h.pow(d);if(v!=null)return v;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&&!nt(h)&&m<0)try{var d=s(h),v=u(d);if((h===v||Math.abs((h-v)/h)<1e-14)&&d.d%2===1)return(d.n%2===0?1:-1)*Math.pow(-m,h)}catch{}return t.predictable&&(m<-1&&h===1/0||m>-1&&m<0&&h===-1/0)?NaN:nt(h)||m>=0||t.predictable?Ty(m,h):m*m<1&&h===1/0||m*m>1&&h===-1/0?0:new l(m,0).pow(h,0)}function f(m,h){if(!nt(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=_t(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(S){throw S.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+")"):S}for(var v=r(d[0]).valueOf(),y=m;h>=1;)(h&1)===1&&(v=i(y,v)),h>>=1,y=i(y,y);return v}function p(m,h){return a(f(m.valueOf(),h))}});var vl="Number of decimals in function round must be an integer",S2="round",SZ=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Kb=T(S2,SZ,n=>{var{typed:e,config:t,matrix:r,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:i}),l=cr({typed:e,DenseMatrix:u}),c=fn({typed:e});function f(p){return Math.abs(nl(p).exponent)}return e(S2,{number:function(m){var h=fl(m,f(t.epsilon)),d=Jr(m,h,t.epsilon)?h:m;return fl(d)},"number, number":function(m,h){var d=f(t.epsilon);if(h>=d)return fl(m,h);var v=fl(m,d),y=Jr(m,v,t.epsilon)?v:m;return fl(y,h)},"number, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(vl);return new o(m).toDecimalPlaces(h.toNumber())},Complex:function(m){return m.round()},"Complex, number":function(m,h){if(h%1)throw new TypeError(vl);return m.round(h)},"Complex, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(vl);var d=h.toNumber();return m.round(d)},BigNumber:function(m){var h=new o(m).toDecimalPlaces(f(t.epsilon)),d=gn(m,h,t.epsilon)?h:m;return d.toDecimalPlaces(0)},"BigNumber, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(vl);var d=f(t.epsilon);if(h>=d)return m.toDecimalPlaces(h.toNumber());var v=m.toDecimalPlaces(d),y=gn(m,v,t.epsilon)?v:m;return y.toDecimalPlaces(h.toNumber())},Fraction:function(m){return m.round()},"Fraction, number":function(m,h){if(h%1)throw new TypeError(vl);return m.round(h)},"Fraction, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(vl);return m.round(h.toNumber())},"Unit, number, Unit":e.referToSelf(p=>function(m,h,d){var v=m.toNumeric(d);return d.multiply(p(v,h))}),"Unit, BigNumber, Unit":e.referToSelf(p=>(m,h,d)=>p(m,h.toNumber(),d)),"Unit, Unit":e.referToSelf(p=>(m,h)=>p(m,0,h)),"Array | Matrix, number, Unit":e.referToSelf(p=>(m,h,d)=>lt(m,v=>p(v,h,d),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(p=>(m,h,d)=>p(m,h.toNumber(),d)),"Array | Matrix, Unit":e.referToSelf(p=>(m,h)=>p(m,0,h)),"Array | Matrix":e.referToSelf(p=>m=>lt(m,p,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>c(r(m),h,p,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(p=>(m,h)=>i(m,0)?a(h.size(),h.storage()):l(h,m,p,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(p=>(m,h)=>i(m,0)?a(h.size(),h.storage()):c(h,m,p,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(p=>(m,h)=>c(r(h),m,p,!0).valueOf())})});var A2="log",AZ=["config","typed","divideScalar","Complex"],ex=T(A2,AZ,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n;return e(A2,{number:function(o){return o>=0||t.predictable?DT(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,u)=>r(a(o),a(u)))})});var M2="log1p",MZ=["typed","config","divideScalar","log","Complex"],tx=T(M2,MZ,n=>{var{typed:e,config:t,divideScalar:r,log:i,Complex:a}=n;return e(M2,{number:function(s){return s>=-1||t.predictable?pm(s):o(new a(s,0))},Complex:o,BigNumber:function(s){var l=s.plus(1);return!l.isNegative()||t.predictable?l.ln():o(new a(s.toNumber(),0))},"Array | Matrix":e.referToSelf(u=>s=>lt(s,u)),"any, any":e.referToSelf(u=>(s,l)=>r(u(s),i(l)))});function o(u){var s=u.re+1;return new a(Math.log(Math.sqrt(s*s+u.im*u.im)),Math.atan2(u.im,s))}});var E2="nthRoots",EZ=["config","typed","divideScalar","Complex"],rx=T(E2,EZ,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n,a=[function(s){return new i(s,0)},function(s){return new i(0,s)},function(s){return new i(-s,0)},function(s){return new i(0,-s)}];function o(u,s){if(s<0)throw new Error("Root must be greater than zero");if(s===0)throw new Error("Root must be non-zero");if(s%1!==0)throw new Error("Root must be an integer");if(u===0||u.abs()===0)return[new i(0,0)];var l=typeof u=="number",c;(l||u.re===0||u.im===0)&&(l?c=2*+(u<0):u.im===0?c=2*+(u.re<0):c=2*+(u.im<0)+1);for(var f=u.arg(),p=u.abs(),m=[],h=Math.pow(p,1/s),d=0;d<s;d++){var v=(c+4*d)/s;if(v===Math.round(v)){m.push(a[v%4](h));continue}m.push(new i({r:h,phi:(f+2*Math.PI*d)/s}))}return m}return e(E2,{Complex:function(s){return o(s,2)},"Complex, number":o})});var D2="dotPow",DZ=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],nx=T(D2,DZ,n=>{var{typed:e,equalScalar:t,matrix:r,pow:i,DenseMatrix:a,concat:o}=n,u=kr({typed:e}),s=Mn({typed:e,DenseMatrix:a}),l=xr({typed:e,equalScalar:t}),c=cr({typed:e,DenseMatrix:a}),f=Ct({typed:e,matrix:r,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(D2,f({elop:h,SS:s,DS:u,Ss:l,sS:c}))});var N2="dotDivide",NZ=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],ix=T(N2,NZ,n=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:i,DenseMatrix:a,concat:o}=n,u=pn({typed:e,equalScalar:r}),s=kr({typed:e}),l=Mn({typed:e,DenseMatrix:a}),c=xr({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:a}),p=Ct({typed:e,matrix:t,concat:o});return e(N2,p({elop:i,SS:l,DS:s,SD:u,Ss:c,sS:f}))});function Xa(n){var{DenseMatrix:e}=n;return function(r,i,a){var o=r.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Mt(o)+")");var u=o[0],s=o[1];if(u!==s)throw new RangeError("Matrix must be square (size: "+Mt(o)+")");var l=[];if(ot(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var p=0;p<u;p++)l[p]=[f[p]];return new e({data:l,size:[u,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==u||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Zs(i)){if(a){l=[];for(var m=0;m<u;m++)l[m]=[f[m][0]];return new e({data:l,size:[u,1],datatype:i._datatype})}return i}if(Na(i)){for(var h=0;h<u;h++)l[h]=[0];for(var d=i._values,v=i._index,y=i._ptr,S=y[1],b=y[0];b<S;b++){var w=v[b];l[w][0]=d[b]}return new e({data:l,size:[u,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(nr(i)){var A=_t(i);if(A.length===1){if(A[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var x=0;x<u;x++)l[x]=[i[x]];return new e({data:l,size:[u,1]})}if(A.length===2){if(A[0]!==u||A[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var D=0;D<u;D++)l[D]=[i[D][0]];return new e({data:l,size:[u,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var T2="lsolve",TZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],ax=T(T2,TZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Xa({DenseMatrix:u});return e(T2,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.valueOf()}});function l(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],v=[],y=f._data,S=0;S<d;S++){var b=m[S][0]||0,w=void 0;if(o(b,0))w=0;else{var A=y[S][S];if(o(A,0))throw new Error("Linear system cannot be solved since matrix is singular");w=r(b,A);for(var x=S+1;x<h;x++)m[x]=[a(m[x][0]||0,i(w,y[x][S]))]}v[S]=[w]}return new u({data:v,size:[h,1]})}function c(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],v=f._values,y=f._index,S=f._ptr,b=[],w=0;w<d;w++){var A=m[w][0]||0;if(o(A,0))b[w]=[0];else{for(var x=0,D=[],E=[],_=S[w],N=S[w+1],P=_;P<N;P++){var B=y[P];B===w?x=v[P]:B>w&&(D.push(v[P]),E.push(B))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var V=r(A,x),z=0,L=E.length;z<L;z++){var k=E[z];m[k]=[a(m[k][0]||0,i(V,D[z]))]}b[w]=[V]}}return new u({data:b,size:[h,1]})}});var C2="usolve",CZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],ox=T(C2,CZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Xa({DenseMatrix:u});return e(C2,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.valueOf()}});function l(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],v=[],y=f._data,S=d-1;S>=0;S--){var b=m[S][0]||0,w=void 0;if(o(b,0))w=0;else{var A=y[S][S];if(o(A,0))throw new Error("Linear system cannot be solved since matrix is singular");w=r(b,A);for(var x=S-1;x>=0;x--)m[x]=[a(m[x][0]||0,i(w,y[x][S]))]}v[S]=[w]}return new u({data:v,size:[h,1]})}function c(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],v=f._values,y=f._index,S=f._ptr,b=[],w=d-1;w>=0;w--){var A=m[w][0]||0;if(o(A,0))b[w]=[0];else{for(var x=0,D=[],E=[],_=S[w],N=S[w+1],P=N-1;P>=_;P--){var B=y[P];B===w?x=v[P]:B<w&&(D.push(v[P]),E.push(B))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var V=r(A,x),z=0,L=E.length;z<L;z++){var k=E[z];m[k]=[a(m[k][0],i(V,D[z]))]}b[w]=[V]}}return new u({data:b,size:[h,1]})}});var F2="lsolveAll",FZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],sx=T(F2,FZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Xa({DenseMatrix:u});return e(F2,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.map(v=>v.valueOf())}});function l(f,p){for(var m=[s(f,p,!0)._data.map(E=>E[0])],h=f._data,d=f._size[0],v=f._size[1],y=0;y<v;y++)for(var S=m.length,b=0;b<S;b++){var w=m[b];if(o(h[y][y],0))if(o(w[y],0)){if(b===0){var x=[...w];x[y]=1;for(var D=y+1;D<v;D++)x[D]=a(x[D],h[D][y]);m.push(x)}}else{if(b===0)return[];m.splice(b,1),b-=1,S-=1}else{w[y]=r(w[y],h[y][y]);for(var A=y+1;A<v;A++)w[A]=a(w[A],i(w[y],h[A][y]))}}return m.map(E=>new u({data:E.map(_=>[_]),size:[d,1]}))}function c(f,p){for(var m=[s(f,p,!0)._data.map(Z=>Z[0])],h=f._size[0],d=f._size[1],v=f._values,y=f._index,S=f._ptr,b=0;b<d;b++)for(var w=m.length,A=0;A<w;A++){for(var x=m[A],D=[],E=[],_=S[b],N=S[b+1],P=0,B=_;B<N;B++){var V=y[B];V===b?P=v[B]:V>b&&(D.push(v[B]),E.push(V))}if(o(P,0))if(o(x[b],0)){if(A===0){var C=[...x];C[b]=1;for(var W=0,O=E.length;W<O;W++){var H=E[W];C[H]=a(C[H],D[W])}m.push(C)}}else{if(A===0)return[];m.splice(A,1),A-=1,w-=1}else{x[b]=r(x[b],P);for(var z=0,L=E.length;z<L;z++){var k=E[z];x[k]=a(x[k],i(x[b],D[z]))}}}return m.map(Z=>new u({data:Z.map(Q=>[Q]),size:[h,1]}))}});var I2="usolveAll",IZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],ux=T(I2,IZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Xa({DenseMatrix:u});return e(I2,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.map(v=>v.valueOf())}});function l(f,p){for(var m=[s(f,p,!0)._data.map(E=>E[0])],h=f._data,d=f._size[0],v=f._size[1],y=v-1;y>=0;y--)for(var S=m.length,b=0;b<S;b++){var w=m[b];if(o(h[y][y],0))if(o(w[y],0)){if(b===0){var x=[...w];x[y]=1;for(var D=y-1;D>=0;D--)x[D]=a(x[D],h[D][y]);m.push(x)}}else{if(b===0)return[];m.splice(b,1),b-=1,S-=1}else{w[y]=r(w[y],h[y][y]);for(var A=y-1;A>=0;A--)w[A]=a(w[A],i(w[y],h[A][y]))}}return m.map(E=>new u({data:E.map(_=>[_]),size:[d,1]}))}function c(f,p){for(var m=[s(f,p,!0)._data.map(Z=>Z[0])],h=f._size[0],d=f._size[1],v=f._values,y=f._index,S=f._ptr,b=d-1;b>=0;b--)for(var w=m.length,A=0;A<w;A++){for(var x=m[A],D=[],E=[],_=S[b],N=S[b+1],P=0,B=N-1;B>=_;B--){var V=y[B];V===b?P=v[B]:V<b&&(D.push(v[B]),E.push(V))}if(o(P,0))if(o(x[b],0)){if(A===0){var C=[...x];C[b]=1;for(var W=0,O=E.length;W<O;W++){var H=E[W];C[H]=a(C[H],D[W])}m.push(C)}}else{if(A===0)return[];m.splice(A,1),A-=1,w-=1}else{x[b]=r(x[b],P);for(var z=0,L=E.length;z<L;z++){var k=E[z];x[k]=a(x[k],i(x[b],D[z]))}}}return m.map(Z=>new u({data:Z.map(Q=>[Q]),size:[h,1]}))}});var PZ="matAlgo08xS0Sid",kZ=["typed","equalScalar"],yl=T(PZ,kZ,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,v=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(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(!u||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===v&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));for(var D=[],E=[],_=[],N=[],P=[],B,V,z,L,k=0;k<S;k++){_[k]=E.length;var C=k+1;for(V=l[k],z=l[k+1],B=V;B<z;B++)L=s[B],P[L]=C,N[L]=u[B],E.push(L);for(V=h[k],z=h[k+1],B=V;B<z;B++)L=m[B],P[L]===C&&(N[L]=x(N[L],p[B]));for(B=_[k];B<E.length;){L=E[B];var W=N[L];w(W,A)?E.splice(B,1):(D.push(W),B++)}}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&v===a._datatype?b:void 0})}});var bl=T("useMatrixForArrayScalar",["typed","matrix"],n=>{var{typed:e,matrix:t}=n;return{"Array, number":e.referTo("DenseMatrix, number",r=>(i,a)=>r(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",r=>(i,a)=>r(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf())}});var P2="leftShift",BZ=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],lx=T(P2,BZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ti({typed:e}),s=pn({typed:e,equalScalar:r}),l=yl({typed:e,equalScalar:r}),c=Ni({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=fn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=bl({typed:e,matrix:t});return e(P2,{"number, number":ky,"BigNumber, BigNumber":SC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():f(v,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():p(v,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):c(y,v,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):p(y,v,d,!0))},h,m({SS:l,DS:u,SD:s}))});var k2="rightArithShift",OZ=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],cx=T(k2,OZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ti({typed:e}),s=pn({typed:e,equalScalar:r}),l=yl({typed:e,equalScalar:r}),c=Ni({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=fn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=bl({typed:e,matrix:t});return e(k2,{"number, number":By,"BigNumber, BigNumber":AC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():f(v,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():p(v,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):c(y,v,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):p(y,v,d,!0))},h,m({SS:l,DS:u,SD:s}))});var B2="rightLogShift",RZ=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],fx=T(B2,RZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ti({typed:e}),s=pn({typed:e,equalScalar:r}),l=yl({typed:e,equalScalar:r}),c=Ni({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=fn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=bl({typed:e,matrix:t});return e(B2,{"number, number":Oy,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():f(v,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(v,y)=>r(y,0)?v.clone():p(v,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):c(y,v,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(v,y)=>r(v,0)?i(y.size(),y.storage()):p(y,v,d,!0))},h,m({SS:l,DS:u,SD:s}))});var O2="and",LZ=["typed","matrix","equalScalar","zeros","not","concat"],zc=T(O2,LZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=pn({typed:e,equalScalar:r}),s=ps({typed:e,equalScalar:r}),l=xr({typed:e,equalScalar:r}),c=fn({typed:e}),f=Ct({typed:e,matrix:t,concat:o});return e(O2,{"number, number":zy,"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()):l(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()):l(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:s,DS:u}))});var Vm="compare",VZ=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],px=T(Vm,VZ,n=>{var{typed:e,config:t,equalScalar:r,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:u,concat:s}=n,l=kr({typed:e}),c=fs({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:u}),p=Ct({typed:e,matrix:i,concat:s}),m=la({typed:e});return e(Vm,UZ({typed:e,config:t}),{"boolean, boolean":function(d,v){return d===v?0:d>v?1:-1},"BigNumber, BigNumber":function(d,v){return gn(d,v,t.epsilon)?new a(0):new a(d.cmp(v))},"Fraction, Fraction":function(d,v){return new o(d.compare(v))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:c,DS:l,Ss:f}))}),UZ=T(Vm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Vm,{"number, number":function(i,a){return Jr(i,a,t.epsilon)?0:i>a?1:-1}})});var nu=wr(L2(),1);var V2="compareNatural",qZ=["typed","compare"],mx=T(V2,qZ,n=>{var{typed:e,compare:t}=n,r=t.signatures["boolean,boolean"];return e(V2,{"any, any":i});function i(s,l){var c=Kt(s),f=Kt(l),p;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return p=t(s,l),p.toString()!=="0"?p>0?1:-1:(0,nu.default)(c,f);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(c)||m.includes(f))return p=a(i,s,l),p!==0?p:(0,nu.default)(c,f);if(c!==f)return(0,nu.default)(c,f);if(c==="Complex")return zZ(s,l);if(c==="Unit")return s.equalBase(l)?i(s.value,l.value):o(i,s.formatUnits(),l.formatUnits());if(c==="boolean")return r(s,l);if(c==="string")return(0,nu.default)(s,l);if(c==="Object")return u(i,s,l);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(s,l,c){return Na(l)&&Na(c)?o(s,l.toJSON().values,c.toJSON().values):Na(l)?a(s,l.toArray(),c):Na(c)?a(s,l,c.toArray()):Zs(l)?a(s,l.toJSON().data,c):Zs(c)?a(s,l,c.toJSON().data):Array.isArray(l)?Array.isArray(c)?o(s,l,c):a(s,l,[c]):a(s,[l],c)}function o(s,l,c){for(var f=0,p=Math.min(l.length,c.length);f<p;f++){var m=s(l[f],c[f]);if(m!==0)return m}return l.length>c.length?1:l.length<c.length?-1:0}function u(s,l,c){var f=Object.keys(l),p=Object.keys(c);f.sort(nu.default),p.sort(nu.default);var m=o(s,f,p);if(m!==0)return m;for(var h=0;h<f.length;h++){var d=s(l[f[h]],c[p[h]]);if(d!==0)return d}return 0}});function zZ(n,e){return n.re>e.re?1:n.re<e.re?-1:n.im>e.im?1:n.im<e.im?-1:0}var U2="compareText",$Z=["typed","matrix","concat"];gm.signature="any, any";var dx=T(U2,$Z,n=>{var{typed:e,matrix:t,concat:r}=n,i=Ct({typed:e,matrix:t,concat:r});return e(U2,gm,i({elop:gm,Ds:!0}))});var Um="equal",HZ=["typed","matrix","equalScalar","DenseMatrix","concat"],hx=T(Um,HZ,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e(Um,GZ({typed:e,equalScalar:r}),l({elop:r,SS:u,DS:o,Ss:s}))}),GZ=T(Um,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e(Um,{"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 q2="equalText",WZ=["typed","compareText","isZero"],gx=T(q2,WZ,n=>{var{typed:e,compareText:t,isZero:r}=n;return e(q2,{"any, any":function(a,o){return r(t(a,o))}})});var qm="smaller",YZ=["typed","config","matrix","DenseMatrix","concat"],vx=T(qm,YZ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=la({typed:e});return e(qm,jZ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<p,"BigNumber, BigNumber":function(p,m){return p.lt(m)&&!gn(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,l({SS:u,DS:o,Ss:s}))}),jZ=T(qm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(qm,{"number, number":function(i,a){return i<a&&!Jr(i,a,t.epsilon)}})});var zm="smallerEq",ZZ=["typed","config","matrix","DenseMatrix","concat"],yx=T(zm,ZZ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=la({typed:e});return e(zm,JZ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||gn(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,l({SS:u,DS:o,Ss:s}))}),JZ=T(zm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(zm,{"number, number":function(i,a){return i<=a||Jr(i,a,t.epsilon)}})});var $m="larger",XZ=["typed","config","matrix","DenseMatrix","concat"],bx=T($m,XZ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=la({typed:e});return e($m,QZ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!gn(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,l({SS:u,DS:o,Ss:s}))}),QZ=T($m,["typed","config"],n=>{var{typed:e,config:t}=n;return e($m,{"number, number":function(i,a){return i>a&&!Jr(i,a,t.epsilon)}})});var Hm="largerEq",KZ=["typed","config","matrix","DenseMatrix","concat"],xx=T(Hm,KZ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=la({typed:e});return e(Hm,eJ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||gn(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,l({SS:u,DS:o,Ss:s}))}),eJ=T(Hm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Hm,{"number, number":function(i,a){return i>=a||Jr(i,a,t.epsilon)}})});var z2="deepEqual",tJ=["typed","equal"],wx=T(z2,tJ,n=>{var{typed:e,equal:t}=n;return e(z2,{"any, any":function(a,o){return r(a.valueOf(),o.valueOf())}});function r(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var u=0;u<o;u++)if(!r(i[u],a[u]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:t(i,a)}});var Gm="unequal",rJ=["typed","config","equalScalar","matrix","DenseMatrix","concat"],_x=T(Gm,rJ,n=>{var{typed:e,config:t,equalScalar:r,matrix:i,DenseMatrix:a,concat:o}=n,u=kr({typed:e}),s=Mn({typed:e,DenseMatrix:a}),l=cr({typed:e,DenseMatrix:a}),c=Ct({typed:e,matrix:i,concat:o});return e(Gm,nJ({typed:e,equalScalar:r}),c({elop:f,SS:s,DS:u,Ss:l}));function f(p,m){return!r(p,m)}}),nJ=T(Gm,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e(Gm,{"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 $2="partitionSelect",iJ=["typed","isNumeric","isNaN","compare"],Sx=T($2,iJ,n=>{var{typed:e,isNumeric:t,isNaN:r,compare:i}=n,a=i,o=(l,c)=>-i(l,c);return e($2,{"Array | Matrix, number":function(c,f){return u(c,f,a)},"Array | Matrix, number, string":function(c,f,p){if(p==="asc")return u(c,f,a);if(p==="desc")return u(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(l,c,f){if(!nt(c)||c<0)throw new Error("k must be a non-negative integer");if(ot(l)){var p=l.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return s(l.valueOf(),c,f)}if(Array.isArray(l))return s(l,c,f)}function s(l,c,f){if(c>=l.length)throw new Error("k out of bounds");for(var p=0;p<l.length;p++)if(t(l[p])&&r(l[p]))return l[p];for(var m=0,h=l.length-1;m<h;){for(var d=m,v=h,y=l[Math.floor(Math.random()*(h-m+1))+m];d<v;)if(f(l[d],y)>=0){var S=l[v];l[v]=l[d],l[d]=S,--v}else++d;f(l[d],y)>0&&--d,c<=d?h=d:m=d+1}return l[c]}});var H2="sort",aJ=["typed","matrix","compare","compareNatural"],Ax=T(H2,aJ,n=>{var{typed:e,matrix:t,compare:r,compareNatural:i}=n,a=r,o=(c,f)=>-r(c,f);return e(H2,{Array:function(f){return s(f),f.sort(a)},Matrix:function(f){return l(f),t(f.toArray().sort(a),f.storage())},"Array, function":function(f,p){return s(f),f.sort(p)},"Matrix, function":function(f,p){return l(f),t(f.toArray().sort(p),f.storage())},"Array, string":function(f,p){return s(f),f.sort(u(p))},"Matrix, string":function(f,p){return l(f),t(f.toArray().sort(u(p)),f.storage())}});function u(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 s(c){if(_t(c).length!==1)throw new Error("One dimensional array expected")}function l(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var G2="max",oJ=["typed","config","numeric","larger"],$c=T(G2,oJ,n=>{var{typed:e,config:t,numeric:r,larger:i}=n;return e(G2,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(s,l){return cs(s,l.valueOf(),a)},"...":function(s){if(ua(s))throw new TypeError("Scalar values expected in function max");return o(s)}});function a(u,s){try{return i(u,s)?u:s}catch(l){throw nn(l,"max",s)}}function o(u){var s;if(ei(u,function(l){try{isNaN(l)&&typeof l=="number"?s=NaN:(s===void 0||i(l,s))&&(s=l)}catch(c){throw nn(c,"max",l)}}),s===void 0)throw new Error("Cannot calculate max of an empty array");return typeof s=="string"&&(s=r(s,t.number)),s}});var W2="min",sJ=["typed","config","numeric","smaller"],Hc=T(W2,sJ,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n;return e(W2,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(s,l){return cs(s,l.valueOf(),a)},"...":function(s){if(ua(s))throw new TypeError("Scalar values expected in function min");return o(s)}});function a(u,s){try{return i(u,s)?u:s}catch(l){throw nn(l,"min",s)}}function o(u){var s;if(ei(u,function(l){try{isNaN(l)&&typeof l=="number"?s=NaN:(s===void 0||i(l,s))&&(s=l)}catch(c){throw nn(c,"min",l)}}),s===void 0)throw new Error("Cannot calculate min of an empty array");return typeof s=="string"&&(s=r(s,t.number)),s}});var uJ="ImmutableDenseMatrix",lJ=["smaller","DenseMatrix"],Mx=T(uJ,lJ,n=>{var{smaller:e,DenseMatrix:t}=n;function r(i,a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!tn(a))throw new Error("Invalid datatype: "+a);if(ot(i)||nr(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&&nr(i.data)&&nr(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+Kt(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return r.prototype=new t,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return ot(a)?new r({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")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:vt(this._data),size:vt(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(i){return new r(i)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.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},r.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},r},{isClass:!0});var cJ="Index",fJ=["ImmutableDenseMatrix","getMatrixDataType"],Ex=T(cJ,fJ,n=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=n;function r(a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,u=arguments.length;o<u;o++){var s=arguments[o],l=nr(s),c=ot(s),f=null;if(tl(s))this._dimensions.push(s),this._isScalar=!1;else if(l||c){var p=void 0;t(s)==="boolean"?(l&&(p=i(Y2(s).valueOf())),c&&(p=i(Y2(s._data).valueOf())),f=s.valueOf().length):p=i(s.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof s=="number")this._dimensions.push(i([s]));else if(typeof s=="string")this._dimensions.push(s);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}r.prototype.type="Index",r.prototype.isIndex=!0;function i(a){for(var o=0,u=a.length;o<u;o++)if(typeof a[o]!="number"||!nt(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new e(a)}return r.prototype.clone=function(){var a=new r;return a._dimensions=vt(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},r.create=function(a){var o=new r;return r.apply(o,a),o},r.prototype.size=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?1:s.size()[0]}return a},r.prototype.max=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?s:s.max()}return a},r.prototype.min=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?s:s.min()}return a},r.prototype.forEach=function(a){for(var o=0,u=this._dimensions.length;o<u;o++)a(this._dimensions[o],o,this)},r.prototype.dimension=function(a){return this._dimensions[a]||null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a.push(typeof s=="string"?s:s.toArray())}return a},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];typeof s=="string"?a.push(JSON.stringify(s)):a.push(s.toString())}return"["+a.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(a){return r.create(a.dimensions)},r},{isClass:!0});function Y2(n){var e=[];return n.forEach((t,r)=>{t&&e.push(r)}),e}var pJ="FibonacciHeap",mJ=["smaller","larger"],Dx=T(pJ,mJ,n=>{var{smaller:e,larger:t}=n,r=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=l(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),u(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 u(c,f){var p=f.parent;p&&(f.mark?(o(c,f,p),u(p)):f.mark=!0)}var s=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 l(c,f){var p=Math.floor(Math.log(f)*r)+1,m=new Array(p),h=0,d=c;if(d)for(h++,d=d.right;d!==c;)h++,d=d.right;for(var v;h>0;){for(var y=d.degree,S=d.right;v=m[y],!!v;){if(t(d.key,v.key)){var b=v;v=d,d=b}s(v,d),m[y]=null,y++}m[y]=d,d=S,h--}c=null;for(var w=0;w<p;w++)v=m[w],v&&(c?(v.left.right=v.right,v.right.left=v.left,v.left=c,v.right=c.right,c.right=v,v.right.left=v,e(v.key,c.key)&&(c=v)):c=v);return c}return i},{isClass:!0});var dJ="Spa",hJ=["addScalar","equalScalar","FibonacciHeap"],Nx=T(dJ,hJ,n=>{var{addScalar:e,equalScalar:t,FibonacciHeap:r}=n;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}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 u=this._heap.insert(a,o);this._values[a]=u}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var u=this._values[a];u?u.value=e(u.value,o):(u=this._heap.insert(a,o),this._values[a]=u)},i.prototype.forEach=function(a,o,u){var s=this._heap,l=this._values,c=[],f=s.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(t(f.value,0)||u(f.key,f.value,this)),f=s.extractMinimum(),f&&c.push(f);for(var p=0;p<c.length;p++){var m=c[p];f=s.insert(m.key,m.value),l[f.key]=f}},i.prototype.swap=function(a,o){var u=this._values[a],s=this._values[o];if(!u&&s)u=this._heap.insert(a,s.value),this._heap.remove(s),this._values[a]=u,this._values[o]=void 0;else if(u&&!s)s=this._heap.insert(o,u.value),this._heap.remove(u),this._values[o]=s,this._values[a]=void 0;else if(u&&s){var l=u.value;u.value=s.value,s.value=l}},i},{isClass:!0});var j2=eu(function(n){return new n(1).exp()},{hasher:Wm}),Z2=eu(function(n){return new n(1).plus(new n(5).sqrt()).div(2)},{hasher:Wm}),Gc=eu(function(n){return n.acos(-1)},{hasher:Wm}),J2=eu(function(n){return Gc(n).times(2)},{hasher:Wm});function Wm(n){return n[0].precision}function X2(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tx(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?X2(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):X2(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var gJ="Unit",vJ=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],Cx=T(gJ,vJ,n=>{var{on:e,config:t,addScalar:r,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:u,abs:s,fix:l,round:c,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:v,Fraction:y}=n,S=h;function b(te,oe){if(!(this instanceof b))throw new Error("Constructor must be called with the new operator");if(!(te==null||p(te)||hi(te)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,oe===void 0)this.units=[],this.dimensions=W.map(ie=>0);else if(typeof oe=="string"){var ge=b.parse(oe);this.units=ge.units,this.dimensions=ge.dimensions}else if(Un(oe)&&oe.value===null)this.fixPrefix=oe.fixPrefix,this.skipAutomaticSimplification=oe.skipAutomaticSimplification,this.dimensions=oe.dimensions.slice(0),this.units=oe.units.map(ie=>zr({},ie));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(te)}Object.defineProperty(b,"name",{value:"Unit"}),b.prototype.constructor=b,b.prototype.type="Unit",b.prototype.isUnit=!0;var w,A,x;function D(){for(;x===" "||x===" ";)N()}function E(te){return te>="0"&&te<="9"||te==="."}function _(te){return te>="0"&&te<="9"}function N(){A++,x=w.charAt(A)}function P(te){A=te,x=w.charAt(A)}function B(){var te="",oe=A;if(x==="+"?N():x==="-"&&(te+=x,N()),!E(x))return P(oe),null;if(x==="."){if(te+=x,N(),!_(x))return P(oe),null}else{for(;_(x);)te+=x,N();x==="."&&(te+=x,N())}for(;_(x);)te+=x,N();if(x==="E"||x==="e"){var ge="",ie=A;if(ge+=x,N(),(x==="+"||x==="-")&&(ge+=x,N()),!_(x))return P(ie),te;for(te=te+ge;_(x);)te+=x,N()}return te}function V(){for(var te="";_(x)||b.isValidAlpha(x);)te+=x,N();var oe=te.charAt(0);return b.isValidAlpha(oe)?te:null}function z(te){return x===te?(N(),te):null}b.parse=function(te,oe){if(oe=oe||{},w=te,A=-1,x="",typeof w!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ge=new b;ge.units=[];var ie=1,re=!1;N(),D();var le=B(),Te=null;if(le){if(t.number==="BigNumber")Te=new v(le);else if(t.number==="Fraction")try{Te=new y(le)}catch{Te=parseFloat(le)}else Te=parseFloat(le);D(),z("*")?(ie=1,re=!0):z("/")&&(ie=-1,re=!0)}for(var Ie=[],Ze=1;;){for(D();x==="(";)Ie.push(ie),Ze*=ie,ie=1,N(),D();var we=void 0;if(x){var ht=x;if(we=V(),we===null)throw new SyntaxError('Unexpected "'+ht+'" in "'+w+'" at index '+A.toString())}else break;var Nt=L(we);if(Nt===null)throw new SyntaxError('Unit "'+we+'" not found.');var Ht=ie*Ze;if(D(),z("^")){D();var Et=B();if(Et===null)throw new SyntaxError('In "'+te+'", "^" must be followed by a floating-point number');Ht*=Et}ge.units.push({unit:Nt.unit,prefix:Nt.prefix,power:Ht});for(var ae=0;ae<W.length;ae++)ge.dimensions[ae]+=(Nt.unit.dimensions[ae]||0)*Ht;for(D();x===")";){if(Ie.length===0)throw new SyntaxError('Unmatched ")" in "'+w+'" at index '+A.toString());Ze/=Ie.pop(),N(),D()}if(re=!1,z("*")?(ie=1,re=!0):z("/")?(ie=-1,re=!0):ie=1,Nt.unit.base){var he=Nt.unit.base.key;me.auto[he]={unit:Nt.unit,prefix:Nt.prefix}}}if(D(),x)throw new SyntaxError('Could not parse: "'+te+'"');if(re)throw new SyntaxError('Trailing characters: "'+te+'"');if(Ie.length!==0)throw new SyntaxError('Unmatched "(" in "'+w+'"');if(ge.units.length===0&&!oe.allowNoUnits)throw new SyntaxError('"'+te+'" contains no units');return ge.value=Te!==void 0?ge._normalize(Te):null,ge},b.prototype.clone=function(){var te=new b;te.fixPrefix=this.fixPrefix,te.skipAutomaticSimplification=this.skipAutomaticSimplification,te.value=vt(this.value),te.dimensions=this.dimensions.slice(0),te.units=[];for(var oe=0;oe<this.units.length;oe++){te.units[oe]={};for(var ge in this.units[oe])ut(this.units[oe],ge)&&(te.units[oe][ge]=this.units[oe][ge])}return te},b.prototype.valueType=function(){return Kt(this.value)},b.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},b.prototype._normalize=function(te){if(te==null||this.units.length===0)return te;for(var oe=te,ge=b._getNumberConverter(Kt(te)),ie=0;ie<this.units.length;ie++){var re=ge(this.units[ie].unit.value),le=ge(this.units[ie].prefix.value),Te=ge(this.units[ie].power);oe=a(oe,u(a(re,le),Te))}return oe},b.prototype._denormalize=function(te,oe){if(te==null||this.units.length===0)return te;for(var ge=te,ie=b._getNumberConverter(Kt(te)),re=0;re<this.units.length;re++){var le=ie(this.units[re].unit.value),Te=ie(this.units[re].prefix.value),Ie=ie(this.units[re].power);ge=o(ge,u(a(le,Te),Ie))}return ge};var L=eu(te=>{if(ut(U,te)){var oe=U[te],ge=oe.prefixes[""];return{unit:oe,prefix:ge}}for(var ie in U)if(ut(U,ie)&&WN(te,ie)){var re=U[ie],le=te.length-ie.length,Te=te.substring(0,le),Ie=ut(re.prefixes,Te)?re.prefixes[Te]:void 0;if(Ie!==void 0)return{unit:re,prefix:Ie}}return null},{hasher:te=>te[0],limit:100});b.isValuelessUnit=function(te){return L(te)!==null},b.prototype.hasBase=function(te){if(typeof te=="string"&&(te=O[te]),!te)return!1;for(var oe=0;oe<W.length;oe++)if(Math.abs((this.dimensions[oe]||0)-(te.dimensions[oe]||0))>1e-12)return!1;return!0},b.prototype.equalBase=function(te){for(var oe=0;oe<W.length;oe++)if(Math.abs((this.dimensions[oe]||0)-(te.dimensions[oe]||0))>1e-12)return!1;return!0},b.prototype.equals=function(te){return this.equalBase(te)&&f(this.value,te.value)},b.prototype.multiply=function(te){for(var oe=this.clone(),ge=Un(te)?te:new b(te),ie=0;ie<W.length;ie++)oe.dimensions[ie]=(this.dimensions[ie]||0)+(ge.dimensions[ie]||0);for(var re=0;re<ge.units.length;re++){var le=Tx({},ge.units[re]);oe.units.push(le)}if(this.value!==null||ge.value!==null){var Te=this.value===null?this._normalize(1):this.value,Ie=ge.value===null?ge._normalize(1):ge.value;oe.value=a(Te,Ie)}else oe.value=null;return Un(te)&&(oe.skipAutomaticSimplification=!1),k(oe)},b.prototype.divideInto=function(te){return new b(te).divide(this)},b.prototype.divide=function(te){for(var oe=this.clone(),ge=Un(te)?te:new b(te),ie=0;ie<W.length;ie++)oe.dimensions[ie]=(this.dimensions[ie]||0)-(ge.dimensions[ie]||0);for(var re=0;re<ge.units.length;re++){var le=Tx(Tx({},ge.units[re]),{},{power:-ge.units[re].power});oe.units.push(le)}if(this.value!==null||ge.value!==null){var Te=this.value===null?this._normalize(1):this.value,Ie=ge.value===null?ge._normalize(1):ge.value;oe.value=o(Te,Ie)}else oe.value=null;return Un(te)&&(oe.skipAutomaticSimplification=!1),k(oe)},b.prototype.pow=function(te){for(var oe=this.clone(),ge=0;ge<W.length;ge++)oe.dimensions[ge]=(this.dimensions[ge]||0)*te;for(var ie=0;ie<oe.units.length;ie++)oe.units[ie].power*=te;return oe.value!==null?oe.value=u(oe.value,te):oe.value=null,oe.skipAutomaticSimplification=!1,k(oe)};function k(te){return te.equalBase(O.NONE)&&te.value!==null&&!t.predictable?te.value:te}b.prototype.abs=function(){var te=this.clone();if(te.value!==null)if(te._isDerived()||te.units.length===0||te.units[0].unit.offset===0)te.value=s(te.value);else{var oe=te._numberConverter(),ge=oe(te.units[0].unit.value),ie=oe(te.units[0].unit.offset),re=a(ge,ie);te.value=i(s(r(te.value,re)),re)}for(var le in te.units)(te.units[le].unit.name==="VA"||te.units[le].unit.name==="VAR")&&(te.units[le].unit=U.W);return te},b.prototype.to=function(te){var oe=this.value===null?this._normalize(1):this.value,ge;if(typeof te=="string")ge=b.parse(te);else if(Un(te))ge=te.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(ge))throw new Error("Units do not match ('".concat(ge.toString(),"' != '").concat(this.toString(),"')"));if(ge.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||ge.units.length===0||this.units[0].unit.offset===ge.units[0].unit.offset)ge.value=vt(oe);else{var ie=b._getNumberConverter(Kt(oe)),re=this.units[0].unit.value,le=this.units[0].unit.offset,Te=a(re,le),Ie=ge.units[0].unit.value,Ze=ge.units[0].unit.offset,we=a(Ie,Ze);ge.value=r(oe,ie(i(Te,we)))}return ge.fixPrefix=!0,ge.skipAutomaticSimplification=!0,ge},b.prototype.toNumber=function(te){return S(this.toNumeric(te))},b.prototype.toNumeric=function(te){var oe;return te?oe=this.to(te):oe=this.clone(),oe._isDerived()||oe.units.length===0?oe._denormalize(oe.value):oe._denormalize(oe.value,oe.units[0].prefix.value)},b.prototype.toString=function(){return this.format()},b.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},b.fromJSON=function(te){var oe=new b(te.value,te.unit);return oe.fixPrefix=te.fixPrefix||!1,oe},b.prototype.valueOf=b.prototype.toString,b.prototype.simplify=function(){var te=this.clone(),oe=[],ge;for(var ie in _e)if(ut(_e,ie)&&te.hasBase(O[ie])){ge=ie;break}if(ge==="NONE")te.units=[];else{var re;if(ge&&ut(_e,ge)&&(re=_e[ge]),re)te.units=[{unit:re.unit,prefix:re.prefix,power:1}];else{for(var le=!1,Te=0;Te<W.length;Te++){var Ie=W[Te];Math.abs(te.dimensions[Te]||0)>1e-12&&(ut(_e,Ie)?oe.push({unit:_e[Ie].unit,prefix:_e[Ie].prefix,power:te.dimensions[Te]||0}):le=!0)}oe.length<te.units.length&&!le&&(te.units=oe)}}return te},b.prototype.toSI=function(){for(var te=this.clone(),oe=[],ge=0;ge<W.length;ge++){var ie=W[ge];if(Math.abs(te.dimensions[ge]||0)>1e-12)if(ut(me.si,ie))oe.push({unit:me.si[ie].unit,prefix:me.si[ie].prefix,power:te.dimensions[ge]||0});else throw new Error("Cannot express custom unit "+ie+" in SI units")}return te.units=oe,te.fixPrefix=!0,te.skipAutomaticSimplification=!0,this.value!==null?(te.value=null,this.to(te)):te},b.prototype.formatUnits=function(){for(var te="",oe="",ge=0,ie=0,re=0;re<this.units.length;re++)this.units[re].power>0?(ge++,te+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power-1)>1e-15&&(te+="^"+this.units[re].power)):this.units[re].power<0&&ie++;if(ie>0)for(var le=0;le<this.units.length;le++)this.units[le].power<0&&(ge>0?(oe+=" "+this.units[le].prefix.name+this.units[le].unit.name,Math.abs(this.units[le].power+1)>1e-15&&(oe+="^"+-this.units[le].power)):(oe+=" "+this.units[le].prefix.name+this.units[le].unit.name,oe+="^"+this.units[le].power));te=te.substr(1),oe=oe.substr(1),ge>1&&ie>0&&(te="("+te+")"),ie>1&&ge>0&&(oe="("+oe+")");var Te=te;return ge>0&&ie>0&&(Te+=" / "),Te+=oe,Te},b.prototype.format=function(te){var oe=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ge=!1;typeof oe.value<"u"&&oe.value!==null&&hi(oe.value)&&(ge=Math.abs(oe.value.re)<1e-14);for(var ie in oe.units)ut(oe.units,ie)&&oe.units[ie].unit&&(oe.units[ie].unit.name==="VA"&&ge?oe.units[ie].unit=U.VAR:oe.units[ie].unit.name==="VAR"&&!ge&&(oe.units[ie].unit=U.VA));oe.units.length===1&&!oe.fixPrefix&&Math.abs(oe.units[0].power-Math.round(oe.units[0].power))<1e-14&&(oe.units[0].prefix=oe._bestPrefix());var re=oe._denormalize(oe.value),le=oe.value!==null?m(re,te||{}):"",Te=oe.formatUnits();return oe.value&&hi(oe.value)&&(le="("+le+")"),Te.length>0&&le.length>0&&(le+=" "),le+=Te,le},b.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 te=this.value!==null?s(this.value):0,oe=s(this.units[0].unit.value),ge=this.units[0].prefix;if(te===0)return ge;var ie=this.units[0].power,re=Math.log(te/Math.pow(ge.value*oe,ie))/Math.LN10-1.2;if(re>-2.200001&&re<1.800001)return ge;re=Math.abs(re);var le=this.units[0].unit.prefixes;for(var Te in le)if(ut(le,Te)){var Ie=le[Te];if(Ie.scientific){var Ze=Math.abs(Math.log(te/Math.pow(Ie.value*oe,ie))/Math.LN10-1.2);(Ze<re||Ze===re&&Ie.name.length<ge.name.length)&&(ge=Ie,re=Ze)}}return ge},b.prototype.splitUnit=function(te){for(var oe=this.clone(),ge=[],ie=0;ie<te.length&&(oe=oe.to(te[ie]),ie!==te.length-1);ie++){var re=oe.toNumeric(),le=c(re),Te=void 0,Ie=f(le,re);Ie?Te=le:Te=l(oe.toNumeric());var Ze=new b(Te,te[ie].toString());ge.push(Ze),oe=i(oe,Ze)}for(var we=0,ht=0;ht<ge.length;ht++)we=r(we,ge[ht].value);return f(we,this.value)&&(oe.value=0),ge.push(oe),ge};var C={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}}};C.SHORTLONG=zr({},C.SHORT,C.LONG),C.BINARY_SHORT=zr({},C.BINARY_SHORT_SI,C.BINARY_SHORT_IEC),C.BINARY_LONG=zr({},C.BINARY_LONG_SI,C.BINARY_LONG_IEC);var W=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],O={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 H in O)ut(O,H)&&(O[H].key=H);var Z={},Q={name:"",base:Z,value:1,offset:0,dimensions:W.map(te=>0)},U={meter:{name:"meter",base:O.LENGTH,prefixes:C.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:C.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:C.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:C.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:C.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:C.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:C.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:C.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:C.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:C.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:C.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:C.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:C.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:C.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:C.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:C.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:C.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:C.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:C.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:C.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:C.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:C.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:C.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:C.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:C.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:C.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:C.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:C.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:C.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:C.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:O.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:O.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:O.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:O.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:O.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:O.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:O.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:O.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},obl:{name:"obl",base:O.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},g:{name:"g",base:O.MASS,prefixes:C.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:C.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:C.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:C.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:C.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:C.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:C.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:C.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:C.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:C.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:C.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:C.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:C.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:C.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:C.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:C.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:C.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:C.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:C.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:C.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:C.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:C.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:C.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:C.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:C.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:C.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:C.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:C.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:C.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:C.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:C.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:C.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:C.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:C.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:C.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:C.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:C.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:C.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:C.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:C.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:C.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:C.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:C.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:C.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:C.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:C.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:C.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:C.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:C.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:C.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:C.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:C.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:C.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:C.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:C.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:C.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:C.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:C.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:C.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:C.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:C.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:C.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:C.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:C.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:C.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:C.SHORT,value:d.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:C.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:C.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:C.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:C.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:C.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:C.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:C.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:C.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:C.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:C.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:C.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:C.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:C.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:C.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:C.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:C.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:C.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:C.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:C.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:C.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:C.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:C.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:C.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:C.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:C.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:C.BINARY_LONG,value:8,offset:0}},de={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 De(te){if(te.number==="BigNumber"){var oe=Gc(v);U.rad.value=new v(1),U.deg.value=oe.div(180),U.grad.value=oe.div(200),U.cycle.value=oe.times(2),U.arcsec.value=oe.div(648e3),U.arcmin.value=oe.div(10800)}else U.rad.value=1,U.deg.value=Math.PI/180,U.grad.value=Math.PI/200,U.cycle.value=Math.PI*2,U.arcsec.value=Math.PI/648e3,U.arcmin.value=Math.PI/10800;U.radian.value=U.rad.value,U.degree.value=U.deg.value,U.gradian.value=U.grad.value}De(t),e&&e("config",function(te,oe){te.number!==oe.number&&De(te)});var me={si:{NONE:{unit:Q,prefix:C.NONE[""]},LENGTH:{unit:U.m,prefix:C.SHORT[""]},MASS:{unit:U.g,prefix:C.SHORT.k},TIME:{unit:U.s,prefix:C.SHORT[""]},CURRENT:{unit:U.A,prefix:C.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:C.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:C.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:C.SHORT[""]},ANGLE:{unit:U.rad,prefix:C.SHORT[""]},BIT:{unit:U.bits,prefix:C.SHORT[""]},FORCE:{unit:U.N,prefix:C.SHORT[""]},ENERGY:{unit:U.J,prefix:C.SHORT[""]},POWER:{unit:U.W,prefix:C.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:C.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:C.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:C.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:C.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:C.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:C.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:C.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:C.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:C.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:C.SHORT[""]}}};me.cgs=JSON.parse(JSON.stringify(me.si)),me.cgs.LENGTH={unit:U.m,prefix:C.SHORT.c},me.cgs.MASS={unit:U.g,prefix:C.SHORT[""]},me.cgs.FORCE={unit:U.dyn,prefix:C.SHORT[""]},me.cgs.ENERGY={unit:U.erg,prefix:C.NONE[""]},me.us=JSON.parse(JSON.stringify(me.si)),me.us.LENGTH={unit:U.ft,prefix:C.NONE[""]},me.us.MASS={unit:U.lbm,prefix:C.NONE[""]},me.us.TEMPERATURE={unit:U.degF,prefix:C.NONE[""]},me.us.FORCE={unit:U.lbf,prefix:C.NONE[""]},me.us.ENERGY={unit:U.BTU,prefix:C.BTU[""]},me.us.POWER={unit:U.hp,prefix:C.NONE[""]},me.us.PRESSURE={unit:U.psi,prefix:C.NONE[""]},me.auto=JSON.parse(JSON.stringify(me.si));var _e=me.auto;b.setUnitSystem=function(te){if(ut(me,te))_e=me[te];else throw new Error("Unit system "+te+" does not exist. Choices are: "+Object.keys(me).join(", "))},b.getUnitSystem=function(){for(var te in me)if(ut(me,te)&&me[te]===_e)return te},b.typeConverters={BigNumber:function(oe){return oe!=null&&oe.isFraction?new v(oe.n).div(oe.d).times(oe.s):new v(oe+"")},Fraction:function(oe){return new y(oe)},Complex:function(oe){return oe},number:function(oe){return oe!=null&&oe.isFraction?h(oe):oe}},b.prototype._numberConverter=function(){var te=b.typeConverters[this.valueType()];if(te)return te;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},b._getNumberConverter=function(te){if(!b.typeConverters[te])throw new TypeError('Unsupported type "'+te+'"');return b.typeConverters[te]};for(var Ne in U)if(ut(U,Ne)){var Se=U[Ne];Se.dimensions=Se.base.dimensions}for(var Me in de)if(ut(de,Me)){var Ee=U[de[Me]],Ce={};for(var Ge in Ee)ut(Ee,Ge)&&(Ce[Ge]=Ee[Ge]);Ce.name=Me,U[Me]=Ce}b.isValidAlpha=function(oe){return/^[a-zA-Z]$/.test(oe)};function We(te){for(var oe=0;oe<te.length;oe++){if(x=te.charAt(oe),oe===0&&!b.isValidAlpha(x))throw new Error('Invalid unit name (must begin with alpha character): "'+te+'"');if(oe>0&&!(b.isValidAlpha(x)||_(x)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+te+'"')}}return b.createUnit=function(te,oe){if(typeof te!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(oe&&oe.override){for(var ge in te)if(ut(te,ge)&&b.deleteUnit(ge),te[ge].aliases)for(var ie=0;ie<te[ge].aliases.length;ie++)b.deleteUnit(te[ge].aliases[ie])}var re;for(var le in te)ut(te,le)&&(re=b.createUnitSingle(le,te[le]));return re},b.createUnitSingle=function(te,oe){if((typeof oe>"u"||oe===null)&&(oe={}),typeof te!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(ut(U,te))throw new Error('Cannot create unit "'+te+'": a unit with that name already exists');We(te);var ge=null,ie=[],re=0,le,Te,Ie;if(oe&&oe.type==="Unit")ge=oe.clone();else if(typeof oe=="string")oe!==""&&(le=oe);else if(typeof oe=="object")le=oe.definition,Te=oe.prefixes,re=oe.offset,Ie=oe.baseName,oe.aliases&&(ie=oe.aliases.valueOf());else throw new TypeError('Cannot create unit "'+te+'" from "'+oe.toString()+'": expecting "string" or "Unit" or "Object"');if(ie){for(var Ze=0;Ze<ie.length;Ze++)if(ut(U,ie[Ze]))throw new Error('Cannot create alias "'+ie[Ze]+'": a unit with that name already exists')}if(le&&typeof le=="string"&&!ge)try{ge=b.parse(le,{allowNoUnits:!0})}catch(F){throw F.message='Could not create unit "'+te+'" from "'+le+'": '+F.message,F}else le&&le.type==="Unit"&&(ge=le.clone());ie=ie||[],re=re||0,Te&&Te.toUpperCase?Te=C[Te.toUpperCase()]||C.NONE:Te=C.NONE;var we={};if(ge){we={name:te,value:ge.value,dimensions:ge.dimensions.slice(0),prefixes:Te,offset:re};var Et=!1;for(var ae in O)if(ut(O,ae)){for(var he=!0,ve=0;ve<W.length;ve++)if(Math.abs((we.dimensions[ve]||0)-(O[ae].dimensions[ve]||0))>1e-12){he=!1;break}if(he){Et=!0,we.base=O[ae];break}}if(!Et){Ie=Ie||te+"_STUFF";var qe={dimensions:ge.dimensions.slice(0)};qe.key=Ie,O[Ie]=qe,_e[Ie]={unit:we,prefix:C.NONE[""]},we.base=O[Ie]}}else{if(Ie=Ie||te+"_STUFF",W.indexOf(Ie)>=0)throw new Error('Cannot create new base unit "'+te+'": a base unit with that name already exists (and cannot be overridden)');W.push(Ie);for(var ht in O)ut(O,ht)&&(O[ht].dimensions[W.length-1]=0);for(var Nt={dimensions:[]},Ht=0;Ht<W.length;Ht++)Nt.dimensions[Ht]=0;Nt.dimensions[W.length-1]=1,Nt.key=Ie,O[Ie]=Nt,we={name:te,value:1,dimensions:O[Ie].dimensions.slice(0),prefixes:Te,offset:re,base:O[Ie]},_e[Ie]={unit:we,prefix:C.NONE[""]}}b.UNITS[te]=we;for(var $e=0;$e<ie.length;$e++){var Re=ie[$e],ze={};for(var Xe in we)ut(we,Xe)&&(ze[Xe]=we[Xe]);ze.name=Re,b.UNITS[Re]=ze}return delete L.cache,new b(null,te)},b.deleteUnit=function(te){delete b.UNITS[te],delete L.cache},b.PREFIXES=C,b.BASE_DIMENSIONS=W,b.BASE_UNITS=O,b.UNIT_SYSTEMS=me,b.UNITS=U,b},{isClass:!0});var Q2="unit",yJ=["typed","Unit"],Fx=T(Q2,yJ,n=>{var{typed:e,Unit:t}=n;return e(Q2,{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(r=>i=>lt(i,r))})});var K2="sparse",bJ=["typed","SparseMatrix"],Ix=T(K2,bJ,n=>{var{typed:e,SparseMatrix:t}=n;return e(K2,{"":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 eF="createUnit",xJ=["typed","Unit"],Px=T(eF,xJ,n=>{var{typed:e,Unit:t}=n;return e(eF,{"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 u={};return u[i]=a,t.createUnit(u,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 tF="acos",wJ=["typed","config","Complex"],kx=T(tF,wJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(tF,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new r(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var rF="acosh",_J=["typed","config","Complex"],Bx=T(rF,_J,n=>{var{typed:e,config:t,Complex:r}=n;return e(rF,{number:function(a){return a>=1||t.predictable?Gy(a):a<=-1?new r(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new r(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var nF="acot",SJ=["typed","BigNumber"],Ox=T(nF,SJ,n=>{var{typed:e,BigNumber:t}=n;return e(nF,{number:Wy,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var iF="acoth",AJ=["typed","config","Complex","BigNumber"],Rx=T(iF,AJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(iF,{number:function(o){return o>=1||o<=-1||t.predictable?Yy(o):new r(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var aF="acsc",MJ=["typed","config","Complex","BigNumber"],Lx=T(aF,MJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(aF,{number:function(o){return o<=-1||o>=1||t.predictable?jy(o):new r(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var oF="acsch",EJ=["typed","BigNumber"],Vx=T(oF,EJ,n=>{var{typed:e,BigNumber:t}=n;return e(oF,{number:Zy,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var sF="asec",DJ=["typed","config","Complex","BigNumber"],Ux=T(sF,DJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(sF,{number:function(o){return o<=-1||o>=1||t.predictable?Jy(o):new r(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var uF="asech",NJ=["typed","config","Complex","BigNumber"],qx=T(uF,NJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(uF,{number:function(o){if(o<=1&&o>=-1||t.predictable){var u=1/o;if(u>0||t.predictable)return Xy(o);var s=Math.sqrt(u*u-1);return new r(Math.log(s-u),Math.PI)}return new r(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var lF="asin",TJ=["typed","config","Complex"],zx=T(lF,TJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(lF,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new r(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var CJ="asinh",FJ=["typed"],$x=T(CJ,FJ,n=>{var{typed:e}=n;return e("asinh",{number:Qy,Complex:function(r){return r.asinh()},BigNumber:function(r){return r.asinh()}})});var IJ="atan",PJ=["typed"],Hx=T(IJ,PJ,n=>{var{typed:e}=n;return e("atan",{number:function(r){return Math.atan(r)},Complex:function(r){return r.atan()},BigNumber:function(r){return r.atan()}})});var cF="atan2",kJ=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Gx=T(cF,kJ,n=>{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,DenseMatrix:a,concat:o}=n,u=pn({typed:e,equalScalar:r}),s=kr({typed:e}),l=km({typed:e,equalScalar:r}),c=xr({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:a}),p=Ct({typed:e,matrix:t,concat:o});return e(cF,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,h)=>i.atan2(m,h)},p({scalar:"number | BigNumber",SS:l,DS:s,SD:u,Ss:c,sS:f}))});var fF="atanh",BJ=["typed","config","Complex"],Wx=T(fF,BJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(fF,{number:function(a){return a<=1&&a>=-1||t.predictable?Ky(a):new r(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var fa=T("trigUnit",["typed"],n=>{var{typed:e}=n;return{Unit:e.referToSelf(t=>r=>{if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,r.valueType())(r.value)})}});var pF="cos",OJ=["typed"],Yx=T(pF,OJ,n=>{var{typed:e}=n,t=fa({typed:e});return e(pF,{number:Math.cos,"Complex | BigNumber":r=>r.cos()},t)});var mF="cosh",RJ=["typed"],jx=T(mF,RJ,n=>{var{typed:e}=n;return e(mF,{number:dm,"Complex | BigNumber":t=>t.cosh()})});var dF="cot",LJ=["typed","BigNumber"],Zx=T(dF,LJ,n=>{var{typed:e,BigNumber:t}=n,r=fa({typed:e});return e(dF,{number:e0,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},r)});var hF="coth",VJ=["typed","BigNumber"],Jx=T(hF,VJ,n=>{var{typed:e,BigNumber:t}=n;return e(hF,{number:t0,Complex:r=>r.coth(),BigNumber:r=>new t(1).div(r.tanh())})});var gF="csc",UJ=["typed","BigNumber"],Xx=T(gF,UJ,n=>{var{typed:e,BigNumber:t}=n,r=fa({typed:e});return e(gF,{number:r0,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},r)});var vF="csch",qJ=["typed","BigNumber"],Qx=T(vF,qJ,n=>{var{typed:e,BigNumber:t}=n;return e(vF,{number:n0,Complex:r=>r.csch(),BigNumber:r=>new t(1).div(r.sinh())})});var yF="sec",zJ=["typed","BigNumber"],Kx=T(yF,zJ,n=>{var{typed:e,BigNumber:t}=n,r=fa({typed:e});return e(yF,{number:i0,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},r)});var bF="sech",$J=["typed","BigNumber"],e1=T(bF,$J,n=>{var{typed:e,BigNumber:t}=n;return e(bF,{number:a0,Complex:r=>r.sech(),BigNumber:r=>new t(1).div(r.cosh())})});var xF="sin",HJ=["typed"],t1=T(xF,HJ,n=>{var{typed:e}=n,t=fa({typed:e});return e(xF,{number:Math.sin,"Complex | BigNumber":r=>r.sin()},t)});var wF="sinh",GJ=["typed"],r1=T(wF,GJ,n=>{var{typed:e}=n;return e(wF,{number:o0,"Complex | BigNumber":t=>t.sinh()})});var _F="tan",WJ=["typed"],n1=T(_F,WJ,n=>{var{typed:e}=n,t=fa({typed:e});return e(_F,{number:Math.tan,"Complex | BigNumber":r=>r.tan()},t)});var YJ="tanh",jJ=["typed"],i1=T(YJ,jJ,n=>{var{typed:e}=n;return e("tanh",{number:hm,"Complex | BigNumber":t=>t.tanh()})});var SF="setCartesian",ZJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],a1=T(SF,ZJ,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(SF,{"Array | Matrix, Array | Matrix":function(s,l){var c=[];if(r(t(s),new a(0))!==0&&r(t(l),new a(0))!==0){var f=kt(Array.isArray(s)?s:s.toArray()).sort(i),p=kt(Array.isArray(l)?l:l.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(s)&&Array.isArray(l)?c:new o(c)}})});var AF="setDifference",JJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],o1=T(AF,JJ,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(AF,{"Array | Matrix, Array | Matrix":function(s,l){var c;if(r(t(s),new a(0))===0)c=[];else{if(r(t(l),new a(0))===0)return kt(s.toArray());var f=So(kt(Array.isArray(s)?s:s.toArray()).sort(i)),p=So(kt(Array.isArray(l)?l:l.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(s)&&Array.isArray(l)?ol(c):new o(ol(c))}})});var MF="setDistinct",XJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],s1=T(MF,XJ,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(MF,{"Array | Matrix":function(s){var l;if(r(t(s),new a(0))===0)l=[];else{var c=kt(Array.isArray(s)?s:s.toArray()).sort(i);l=[],l.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&l.push(c[f])}return Array.isArray(s)?l:new o(l)}})});var EF="setIntersect",QJ=["typed","size","subset","compareNatural","Index","DenseMatrix"],u1=T(EF,QJ,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(EF,{"Array | Matrix, Array | Matrix":function(s,l){var c;if(r(t(s),new a(0))===0||r(t(l),new a(0))===0)c=[];else{var f=So(kt(Array.isArray(s)?s:s.toArray()).sort(i)),p=So(kt(Array.isArray(l)?l:l.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(s)&&Array.isArray(l)?ol(c):new o(ol(c))}})});var DF="setIsSubset",KJ=["typed","size","subset","compareNatural","Index"],l1=T(DF,KJ,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(DF,{"Array | Matrix, Array | Matrix":function(u,s){if(r(t(u),new a(0))===0)return!0;if(r(t(s),new a(0))===0)return!1;for(var l=So(kt(Array.isArray(u)?u:u.toArray()).sort(i)),c=So(kt(Array.isArray(s)?s:s.toArray()).sort(i)),f,p=0;p<l.length;p++){f=!1;for(var m=0;m<c.length;m++)if(i(l[p].value,c[m].value)===0&&l[p].identifier===c[m].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var NF="setMultiplicity",eX=["typed","size","subset","compareNatural","Index"],c1=T(NF,eX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(NF,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(u,s){if(r(t(s),new a(0))===0)return 0;for(var l=kt(Array.isArray(s)?s:s.toArray()),c=0,f=0;f<l.length;f++)i(l[f],u)===0&&c++;return c}})});var TF="setPowerset",tX=["typed","size","subset","compareNatural","Index"],f1=T(TF,tX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(TF,{"Array | Matrix":function(l){if(r(t(l),new a(0))===0)return[];for(var c=kt(Array.isArray(l)?l:l.toArray()).sort(i),f=[],p=0;p.toString(2).length<=c.length;)f.push(o(c,p.toString(2).split("").reverse())),p++;return u(f)}});function o(s,l){for(var c=[],f=0;f<l.length;f++)l[f]==="1"&&c.push(s[f]);return c}function u(s){for(var l=[],c=s.length-1;c>0;c--)for(var f=0;f<c;f++)s[f].length>s[f+1].length&&(l=s[f],s[f]=s[f+1],s[f+1]=l);return s}});var CF="setSize",rX=["typed","compareNatural"],p1=T(CF,rX,n=>{var{typed:e,compareNatural:t}=n;return e(CF,{"Array | Matrix":function(i){return Array.isArray(i)?kt(i).length:kt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?kt(i).length:kt(i.toArray()).length;for(var o=kt(Array.isArray(i)?i:i.toArray()).sort(t),u=1,s=1;s<o.length;s++)t(o[s],o[s-1])!==0&&u++;return u}})});var FF="setSymDifference",nX=["typed","size","concat","subset","setDifference","Index"],m1=T(FF,nX,n=>{var{typed:e,size:t,concat:r,subset:i,setDifference:a,Index:o}=n;return e(FF,{"Array | Matrix, Array | Matrix":function(s,l){if(i(t(s),new o(0))===0)return kt(l);if(i(t(l),new o(0))===0)return kt(s);var c=kt(s),f=kt(l);return r(a(c,f),a(f,c))}})});var IF="setUnion",iX=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],d1=T(IF,iX,n=>{var{typed:e,size:t,concat:r,subset:i,setIntersect:a,setSymDifference:o,Index:u}=n;return e(IF,{"Array | Matrix, Array | Matrix":function(l,c){if(i(t(l),new u(0))===0)return kt(c);if(i(t(c),new u(0))===0)return kt(l);var f=kt(l),p=kt(c);return r(o(f,p),a(f,p))}})});var PF="add",aX=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],h1=T(PF,aX,n=>{var{typed:e,matrix:t,addScalar:r,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:u}=n,s=ti({typed:e}),l=ml({typed:e,equalScalar:i}),c=Ni({typed:e,DenseMatrix:a}),f=Ct({typed:e,matrix:t,concat:u});return e(PF,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(m,h,d)=>{for(var v=p(m,h),y=0;y<d.length;y++)v=p(v,d[y]);return v})},f({elop:r,DS:s,SS:l,Ss:c}))});var kF="hypot",oX=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],g1=T(kF,oX,n=>{var{typed:e,abs:t,addScalar:r,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:u,isPositive:s}=n;return e(kF,{"... number | BigNumber":l,Array:l,Matrix:c=>l(kt(c.toArray()))});function l(c){for(var f=0,p=0,m=0;m<c.length;m++){if(hi(c[m]))throw new TypeError("Unexpected type of argument to hypot");var h=t(c[m]);u(p,h)?(f=a(f,a(i(p,h),i(p,h))),f=r(f,1),p=h):f=r(f,s(h)?a(i(h,p),i(h,p)):h)}return a(p,o(f))}});var BF="norm",sX=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],v1=T(BF,sX,n=>{var{typed:e,abs:t,add:r,pow:i,conj:a,sqrt:o,multiply:u,equalScalar:s,larger:l,smaller:c,matrix:f,ctranspose:p,eigs:m}=n;return e(BF,{number:Math.abs,Complex:function(E){return E.abs()},BigNumber:function(E){return E.abs()},boolean:function(E){return Math.abs(E)},Array:function(E){return x(f(E),2)},Matrix:function(E){return x(E,2)},"Array, number | BigNumber | string":function(E,_){return x(f(E),_)},"Matrix, number | BigNumber | string":function(E,_){return x(E,_)}});function h(D){var E=0;return D.forEach(function(_){var N=t(_);l(N,E)&&(E=N)},!0),E}function d(D){var E;return D.forEach(function(_){var N=t(_);(!E||c(N,E))&&(E=N)},!0),E||0}function v(D,E){if(E===Number.POSITIVE_INFINITY||E==="inf")return h(D);if(E===Number.NEGATIVE_INFINITY||E==="-inf")return d(D);if(E==="fro")return x(D,2);if(typeof E=="number"&&!isNaN(E)){if(!s(E,0)){var _=0;return D.forEach(function(N){_=r(i(t(N),E),_)},!0),i(_,1/E)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function y(D){var E=0;return D.forEach(function(_,N){E=r(E,u(_,a(_)))}),t(o(E))}function S(D){var E=[],_=0;return D.forEach(function(N,P){var B=P[1],V=r(E[B]||0,t(N));l(V,_)&&(_=V),E[B]=V},!0),_}function b(D){var E=D.size();if(E[0]!==E[1])throw new RangeError("Invalid matrix dimensions");var _=p(D),N=u(_,D),P=m(N).values.toArray(),B=P[P.length-1];return t(o(B))}function w(D){var E=[],_=0;return D.forEach(function(N,P){var B=P[0],V=r(E[B]||0,t(N));l(V,_)&&(_=V),E[B]=V},!0),_}function A(D,E){if(E===1)return S(D);if(E===Number.POSITIVE_INFINITY||E==="inf")return w(D);if(E==="fro")return y(D);if(E===2)return b(D);throw new Error("Unsupported parameter value "+E)}function x(D,E){var _=D.size();if(_.length===1)return v(D,E);if(_.length===2){if(_[0]&&_[1])return A(D,E);throw new RangeError("Invalid matrix dimensions")}}});var OF="dot",uX=["typed","addScalar","multiplyScalar","conj","size"],y1=T(OF,uX,n=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:i,size:a}=n;return e(OF,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":s});function o(c,f){var p=l(c),m=l(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 u(c,f){var p=o(c,f),m=ot(c)?c._data:c,h=ot(c)?c._datatype||c.getDataType():void 0,d=ot(f)?f._data:f,v=ot(f)?f._datatype||f.getDataType():void 0,y=l(c).length===2,S=l(f).length===2,b=t,w=r;if(h&&v&&h===v&&typeof h=="string"&&h!=="mixed"){var A=h;b=e.find(t,[A,A]),w=e.find(r,[A,A])}if(!y&&!S){for(var x=w(i(m[0]),d[0]),D=1;D<p;D++)x=b(x,w(i(m[D]),d[D]));return x}if(!y&&S){for(var E=w(i(m[0]),d[0][0]),_=1;_<p;_++)E=b(E,w(i(m[_]),d[_][0]));return E}if(y&&!S){for(var N=w(i(m[0][0]),d[0]),P=1;P<p;P++)N=b(N,w(i(m[P][0]),d[P]));return N}if(y&&S){for(var B=w(i(m[0][0]),d[0][0]),V=1;V<p;V++)B=b(B,w(i(m[V][0]),d[V][0]));return B}}function s(c,f){o(c,f);for(var p=c._index,m=c._values,h=f._index,d=f._values,v=0,y=t,S=r,b=0,w=0;b<p.length&&w<h.length;){var A=p[b],x=h[w];if(A<x){b++;continue}if(A>x){w++;continue}A===x&&(v=y(v,S(m[b],d[w])),b++,w++)}return v}function l(c){return ot(c)?c.size():a(c)}});var lX="trace",cX=["typed","matrix","add"],b1=T(lX,cX,n=>{var{typed:e,matrix:t,add:r}=n;return e("trace",{Array:function(u){return i(t(u))},SparseMatrix:a,DenseMatrix:i,any:vt});function i(o){var u=o._size,s=o._data;switch(u.length){case 1:if(u[0]===1)return vt(s[0]);throw new RangeError("Matrix must be square (size: "+Mt(u)+")");case 2:{var l=u[0],c=u[1];if(l===c){for(var f=0,p=0;p<l;p++)f=r(f,s[p][p]);return f}else throw new RangeError("Matrix must be square (size: "+Mt(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(u)+")")}}function a(o){var u=o._values,s=o._index,l=o._ptr,c=o._size,f=c[0],p=c[1];if(f===p){var m=0;if(u.length>0)for(var h=0;h<p;h++)for(var d=l[h],v=l[h+1],y=d;y<v;y++){var S=s[y];if(S===h){m=r(m,u[y]);break}if(S>h)break}return m}throw new RangeError("Matrix must be square (size: "+Mt(c)+")")}});var RF="index",fX=["typed","Index"],x1=T(RF,fX,n=>{var{typed:e,Index:t}=n;return e(RF,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(u){return pt(u)?u.toNumber():nr(u)||ot(u)?u.map(function(s){return pt(s)?s.toNumber():s}):u}),o=new t;return t.apply(o,a),o}})});var Ym=new Set(["end"]);var pX="Node",mX=["mathWithTransform"],w1=T(pX,mX,n=>{var{mathWithTransform:e}=n;function t(i){for(var a of[...Ym])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class r{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(e,{}),o={},u=null;function s(l){var c=Ao(l);return t(c),a(c,o,u)}return{evaluate:s}}_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(!jt(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(u,s){u.forEach(function(l,c,f){s(l,c,f),o(l,s)})}o(this,a)}transform(a){function o(u,s,l){var c=a(u,s,l);return c!==u?c:u.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(u,s,l){a(u,s,l)&&o.push(u)}),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&&Ta(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?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<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?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 r},{isClass:!0,isNode:!0});function Br(n){return n&&n.isIndexError?new $n(n.index+1,n.min+1,n.max!==void 0?n.max+1:void 0):n}function jm(n){var{subset:e}=n;return function(r,i){try{if(Array.isArray(r))return e(r,i);if(r&&typeof r.subset=="function")return r.subset(i);if(typeof r=="string")return e(r,i);if(typeof r=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return $r(r,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Br(a)}}}var Zm="AccessorNode",dX=["subset","Node"],_1=T(Zm,dX,n=>{var{subset:e,Node:t}=n,r=jm({subset:e});function i(o){return!(zi(o)||qn(o)||zt(o)||gi(o)||rs(o)||zn(o)||Fr(o))}class a extends t{constructor(u,s){if(super(),!jt(u))throw new TypeError('Node expected for parameter "object"');if(!oa(s))throw new TypeError('IndexNode expected for parameter "index"');this.object=u,this.index=s}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Zm}get isAccessorNode(){return!0}_compile(u,s){var l=this.object._compile(u,s),c=this.index._compile(u,s);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(m,h,d){return $r(l(m,h,d),f)}}else return function(m,h,d){var v=l(m,h,d),y=c(m,h,v);return r(v,y)}}forEach(u){u(this.object,"object",this),u(this.index,"index",this)}map(u){return new a(this._ifNode(u(this.object,"object",this)),this._ifNode(u(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(u){var s=this.object.toString(u);return i(this.object)&&(s="("+s+")"),s+this.index.toString(u)}_toHTML(u){var s=this.object.toHTML(u);return i(this.object)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+this.index.toHTML(u)}_toTex(u){var s=this.object.toTex(u);return i(this.object)&&(s="\\left(' + object + '\\right)"),s+this.index.toTex(u)}toJSON(){return{mathjs:Zm,object:this.object,index:this.index}}static fromJSON(u){return new a(u.object,u.index)}}return fr(a,"name",Zm),a},{isClass:!0,isNode:!0});var Jm="ArrayNode",hX=["Node"],S1=T(Jm,hX,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(jt))throw new TypeError("Array containing Nodes expected")}get type(){return Jm}get isArrayNode(){return!0}_compile(i,a){var o=Mi(this.items,function(l){return l._compile(i,a)}),u=i.config.matrix!=="Array";if(u){var s=i.matrix;return function(c,f,p){return s(Mi(o,function(m){return m(c,f,p)}))}}else return function(c,f,p){return Mi(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:Jm,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,u){var s=o.some(qn)&&!o.every(qn),l=u||s,c=l?"&":"\\\\",f=o.map(function(p){return p.items?a(p.items,!u):p.toTex(i)}).join(c);return s||!l||l&&!u?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return fr(t,"name",Jm),t},{isClass:!0,isNode:!0});function LF(n){var{subset:e,matrix:t}=n;return function(i,a,o){try{if(Array.isArray(i)){var u=t(i).subset(a,o).valueOf();return u.forEach((s,l)=>{i[l]=s}),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 ja(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(s){throw Br(s)}}}var pa=[{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 Xm(n,e){if(!e||e!=="auto")return n;for(var t=n;zn(t);)t=t.content;return t}function gr(n,e,t,r){var i=n;e!=="keep"&&(i=n.getContent());for(var a=i.getIdentifier(),o=null,u=0;u<pa.length;u++)if(a in pa[u]){o=u;break}if(a==="OperatorNode:multiply"&&i.implicit&&t!=="show"){var s=Xm(i.args[0],e);!(zt(s)&&r&&r.getIdentifier()==="OperatorNode:divide"&&bc(Xm(r.args[0],e)))&&!(s.getIdentifier()==="OperatorNode:divide"&&bc(Xm(s.args[0],e))&&zt(Xm(s.args[1])))&&(o+=1)}return o}function xl(n,e){var t=n;e!=="keep"&&(t=n.getContent());var r=t.getIdentifier(),i=gr(t,e);if(i===null)return null;var a=pa[i][r];if(ut(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+r+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Qm(n,e,t){var r=t!=="keep"?n.getContent():n,i=t!=="keep"?n.getContent():e,a=r.getIdentifier(),o=i.getIdentifier(),u=gr(r,t);if(u===null)return null;var s=pa[u][a];if(ut(s,"associativeWith")&&s.associativeWith instanceof Array){for(var l=0;l<s.associativeWith.length;l++)if(s.associativeWith[l]===o)return!0;return!1}return null}function VF(n){var e="OperatorNode:"+n;for(var t of pa)if(e in t)return t[e].op;return null}var Km="AssignmentNode",gX=["subset","?matrix","Node"],A1=T(Km,gX,n=>{var{subset:e,matrix:t,Node:r}=n,i=jm({subset:e}),a=LF({subset:e,matrix:t});function o(s,l,c){l||(l="keep");var f=gr(s,l,c),p=gr(s.value,l,c);return l==="all"||p!==null&&p<=f}class u extends r{constructor(l,c,f){if(super(),this.object=l,this.index=f?c:null,this.value=f||c,!Fr(l)&&!zi(l))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Fr(l)&&l.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!oa(this.index))throw new TypeError('IndexNode expected as "index"');if(!jt(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 Km}get isAssignmentNode(){return!0}_compile(l,c){var f=this.object._compile(l,c),p=this.index?this.index._compile(l,c):null,m=this.value._compile(l,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(w,A,x){var D=f(w,A,x),E=m(w,A,x);return ja(D,d,E),E}}else{if(Fr(this.object))return function(w,A,x){var D=f(w,A,x),E=m(w,A,x),_=p(w,A,D);return w.set(h,a(D,_,E)),E};var v=this.object.object._compile(l,c);if(this.object.index.isObjectProperty()){var y=this.object.index.getObjectProperty();return function(w,A,x){var D=v(w,A,x),E=$r(D,y),_=p(w,A,E),N=m(w,A,x);return ja(D,y,a(E,_,N)),N}}else{var S=this.object.index._compile(l,c);return function(w,A,x){var D=v(w,A,x),E=S(w,A,D),_=i(D,E),N=p(w,A,_),P=m(w,A,x);return a(D,E,a(_,N,P)),P}}}else{if(!Fr(this.object))throw new TypeError("SymbolNode expected as object");return function(w,A,x){var D=m(w,A,x);return w.set(h,D),D}}}forEach(l){l(this.object,"object",this),this.index&&l(this.index,"index",this),l(this.value,"value",this)}map(l){var c=this._ifNode(l(this.object,"object",this)),f=this.index?this._ifNode(l(this.index,"index",this)):null,p=this._ifNode(l(this.value,"value",this));return new u(c,f,p)}clone(){return new u(this.object,this.index,this.value)}_toString(l){var c=this.object.toString(l),f=this.index?this.index.toString(l):"",p=this.value.toString(l);return o(this,l&&l.parenthesis,l&&l.implicit)&&(p="("+p+")"),c+f+" = "+p}toJSON(){return{mathjs:Km,object:this.object,index:this.index,value:this.value}}static fromJSON(l){return new u(l.object,l.index,l.value)}_toHTML(l){var c=this.object.toHTML(l),f=this.index?this.index.toHTML(l):"",p=this.value.toHTML(l);return o(this,l&&l.parenthesis,l&&l.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(l){var c=this.object.toTex(l),f=this.index?this.index.toTex(l):"",p=this.value.toTex(l);return o(this,l&&l.parenthesis,l&&l.implicit)&&(p="\\left(".concat(p,"\\right)")),c+f+"="+p}}return fr(u,"name",Km),u},{isClass:!0,isNode:!0});var ed="BlockNode",vX=["ResultSet","Node"],M1=T(ed,vX,n=>{var{ResultSet:e,Node:t}=n;class r extends t{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var u=o&&o.node,s=o&&o.visible!==void 0?o.visible:!0;if(!jt(u))throw new TypeError('Property "node" must be a Node');if(typeof s!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:u,visible:s}})}get type(){return ed}get isBlockNode(){return!0}_compile(a,o){var u=Mi(this.blocks,function(s){return{evaluate:s.node._compile(a,o),visible:s.visible}});return function(l,c,f){var p=[];return ns(u,function(h){var d=h.evaluate(l,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=[],u=0;u<this.blocks.length;u++){var s=this.blocks[u],l=this._ifNode(a(s.node,"blocks["+u+"].node",this));o[u]={node:l,visible:s.visible}}return new r(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new r(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:ed,blocks:this.blocks}}static fromJSON(a){return new r(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 fr(r,"name",ed),r},{isClass:!0,isNode:!0});var td="ConditionalNode",yX=["Node"],E1=T(td,yX,n=>{var{Node:e}=n;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(pt(i))return!i.isZero();if(hi(i))return!!(i.re||i.im);if(Un(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Kt(i)+'"')}class r extends e{constructor(a,o,u){if(super(),!jt(a))throw new TypeError("Parameter condition must be a Node");if(!jt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!jt(u))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=u}get type(){return td}get isConditionalNode(){return!0}_compile(a,o){var u=this.condition._compile(a,o),s=this.trueExpr._compile(a,o),l=this.falseExpr._compile(a,o);return function(f,p,m){return t(u(f,p,m))?s(f,p,m):l(f,p,m)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new r(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.condition.toString(a),l=gr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=u)&&(s="("+s+")");var c=this.trueExpr.toString(a),f=gr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(c="("+c+")");var p=this.falseExpr.toString(a),m=gr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p="("+p+")"),s+" ? "+c+" : "+p}toJSON(){return{mathjs:td,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new r(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.condition.toHTML(a),l=gr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=u)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=gr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(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=gr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+'<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 fr(r,"name",td),r},{isClass:!0,isNode:!0});var $F=wr(qF(),1);var N1={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{?}"},pr={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"},T1={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(pr.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(pr.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(pr.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(pr.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(pr.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(pr.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(pr.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(pr.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(pr.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(pr.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(pr.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(pr.bitAnd,"${args[1]}\\right)")},bitNot:{1:pr.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(pr.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(pr.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(pr.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(pr.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(pr.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(pr.and,"${args[1]}\\right)")},not:{1:pr.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(pr.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(pr.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(pr.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(pr.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(pr.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(pr.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(pr.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(pr.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(pr.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(pr.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(pr.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(pr.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(pr.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(N1.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)"}},HF="\\mathrm{${name}}\\left(${args}\\right)",zF={deg:"^\\circ"};function rd(n){return(0,$F.default)(n,{preserveFormatting:!0})}function nd(n,e){return e=typeof e>"u"?!1:e,e?ut(zF,n)?zF[n]:"\\mathrm{"+rd(n)+"}":ut(N1,n)?N1[n]:rd(n)}var id="ConstantNode",_X=["Node"],C1=T(id,_X,n=>{var{Node:e}=n;class t extends e{constructor(i){super(),this.value=i}get type(){return id}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 Mt(this.value,i)}_toHTML(i){var a=this._toString(i);switch(Kt(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:id,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i),o=Kt(this.value);switch(o){case"string":return"\\mathtt{"+rd(a)+"}";case"number":case"BigNumber":{var u=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!u)return this.value.valueOf()<0?"-\\infty":"\\infty";var s=a.toLowerCase().indexOf("e");return s!==-1?a.substring(0,s)+"\\cdot10^{"+a.substring(s+1)+"}":a}case"Fraction":return this.value.toLatex();default:return a}}}return fr(t,"name",id),t},{isClass:!0,isNode:!0});var ad="FunctionAssignmentNode",SX=["typed","Node"],F1=T(ad,SX,n=>{var{typed:e,Node:t}=n;function r(a,o,u){var s=gr(a,o,u),l=gr(a.expr,o,u);return o==="all"||l!==null&&l<=s}class i extends t{constructor(o,u,s){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(u))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!jt(s))throw new TypeError('Node expected for parameter "expr"');if(Ym.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var l=new Set;for(var c of u){var f=typeof c=="string"?c:c.name;if(l.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));l.add(f)}this.name=o,this.params=u.map(function(p){return p&&p.name||p}),this.types=u.map(function(p){return p&&p.type||"any"}),this.expr=s}get type(){return ad}get isFunctionAssignmentNode(){return!0}_compile(o,u){var s=Object.create(u);ns(this.params,function(h){s[h]=!0});var l=this.expr._compile(o,s),c=this.name,f=this.params,p=zv(this.types,","),m=c+"("+zv(this.params,", ")+")";return function(d,v,y){var S={};S[p]=function(){for(var w=Object.create(v),A=0;A<f.length;A++)w[f[A]]=arguments[A];return l(d,w,y)};var b=e(c,S);return b.syntax=m,d.set(c,b),b}}forEach(o){o(this.expr,"expr",this)}map(o){var u=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),u)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=this.expr.toString(o);return r(this,u,o&&o.implicit)&&(s="("+s+")"),this.name+"("+this.params.join(", ")+") = "+s}toJSON(){var o=this.types;return{mathjs:ad,name:this.name,params:this.params.map(function(u,s){return{name:u,type:o[s]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var u=o&&o.parenthesis?o.parenthesis:"keep",s=[],l=0;l<this.params.length;l++)s.push('<span class="math-symbol math-parameter">'+Cn(this.params[l])+"</span>");var c=this.expr.toHTML(o);return r(this,u,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">'+Cn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+s.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 u=o&&o.parenthesis?o.parenthesis:"keep",s=this.expr.toTex(o);return r(this,u,o&&o.implicit)&&(s="\\left(".concat(s,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(nd).join(",")+"\\right)="+s}}return fr(i,"name",ad),i},{isClass:!0,isNode:!0});var od="IndexNode",AX=["Node","size"],I1=T(od,AX,n=>{var{Node:e,size:t}=n;class r extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(jt))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 od}get isIndexNode(){return!0}_compile(a,o){var u=Mi(this.dimensions,function(l,c){var f=l.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var p=Object.create(o);p.end=!0;var m=l._compile(a,p);return function(d,v,y){if(!ot(y)&&!nr(y)&&!tn(y))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Kt(y));var S=t(y).valueOf(),b=Object.create(v);return b.end=S[c],m(d,b,y)}}else return l._compile(a,o)}),s=$r(a,"index");return function(c,f,p){var m=Mi(u,function(h){return h(c,f,p)});return s(...m)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this._ifNode(a(this.dimensions[u],"dimensions["+u+"]",this));return new r(o,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&zt(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:od,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new r(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this.dimensions[u].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Cn(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(u){return u.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return fr(r,"name",od),r},{isClass:!0,isNode:!0});var sd="ObjectNode",MX=["Node"],P1=T(sd,MX,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return jt(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return sd}get isObjectNode(){return!0}_compile(i,a){var o={};for(var u in this.properties)if(ut(this.properties,u)){var s=Js(u),l=JSON.parse(s),c=$r(this.properties,u);o[l]=c._compile(i,a)}return function(p,m,h){var d={};for(var v in o)ut(o,v)&&(d[v]=o[v](p,m,h));return d}}forEach(i){for(var a in this.properties)ut(this.properties,a)&&i(this.properties[a],"properties["+Js(a)+"]",this)}map(i){var a={};for(var o in this.properties)ut(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Js(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)ut(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)ut(this.properties,o)&&a.push(Js(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:sd,properties:this.properties}}static fromJSON(i){return new t(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)ut(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Cn(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)ut(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var u="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return u}}return fr(t,"name",sd),t},{isClass:!0,isNode:!0});function iu(n,e){return new sl(n,new Qs(e),new Set(Object.keys(e)))}var ud="OperatorNode",EX=["Node"],k1=T(ud,EX,n=>{var{Node:e}=n;function t(a,o){var u=a;if(o==="auto")for(;zn(u);)u=u.content;return zt(u)?!0:Vr(u)?t(u.args[0],o):!1}function r(a,o,u,s,l){var c=gr(a,o,u),f=xl(a,o);if(o==="all"||s.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return s.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(s.length){case 0:p=[];break;case 1:{var m=gr(s[0],o,u,a);if(l&&m!==null){var h,d;if(o==="keep"?(h=s[0].getIdentifier(),d=a.getIdentifier()):(h=s[0].getContent().getIdentifier(),d=a.getContent().getIdentifier()),pa[c][d].latexLeftParens===!1){p=[!1];break}if(pa[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 v,y=gr(s[0],o,u,a),S=Qm(a,s[0],o);y===null?v=!1:y===c&&f==="right"&&!S||y<c?v=!0:v=!1;var b,w=gr(s[1],o,u,a),A=Qm(a,s[1],o);if(w===null?b=!1:w===c&&f==="left"&&!A||w<c?b=!0:b=!1,l){var x,D,E;o==="keep"?(x=a.getIdentifier(),D=a.args[0].getIdentifier(),E=a.args[1].getIdentifier()):(x=a.getContent().getIdentifier(),D=a.args[0].getContent().getIdentifier(),E=a.args[1].getContent().getIdentifier()),y!==null&&(pa[c][x].latexLeftParens===!1&&(v=!1),pa[y][D].latexParens===!1&&(v=!1)),w!==null&&(pa[c][x].latexRightParens===!1&&(b=!1),pa[w][E].latexParens===!1&&(b=!1))}p=[v,b]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=s.map(function(N){var P=gr(N,o,u,a),B=Qm(a,N,o),V=xl(N,o);return P===null?!1:c===P&&f===V&&!B?!0:P<c}));break}if(s.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&u==="hide")for(var _=1;_<p.length;++_)t(s[_],o)&&!p[_-1]&&(o!=="keep"||!zn(s[_-1]))&&(p[_]=!0);return p}class i extends e{constructor(o,u,s,l,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof u!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(s)||!s.every(jt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=l===!0,this.isPercentage=c===!0,this.op=o,this.fn=u,this.args=s||[]}get type(){return ud}get isOperatorNode(){return!0}_compile(o,u){if(typeof this.fn!="string"||!bm(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 s=$r(o,this.fn),l=Mi(this.args,function(h){return h._compile(o,u)});if(typeof s=="function"&&s.rawArgs===!0){var c=this.args;return function(d,v,y){return s(c,o,iu(d,v))}}else if(l.length===1){var f=l[0];return function(d,v,y){return s(f(d,v,y))}}else if(l.length===2){var p=l[0],m=l[1];return function(d,v,y){return s(p(d,v,y),m(d,v,y))}}else return function(d,v,y){return s.apply(null,Mi(l,function(S){return S(d,v,y)}))}}forEach(o){for(var u=0;u<this.args.length;u++)o(this.args[u],"args["+u+"]",this)}map(o){for(var u=[],s=0;s<this.args.length;s++)u[s]=this._ifNode(o(this.args[s],"args["+s+"]",this));return new i(this.op,this.fn,u,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 u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!1);if(l.length===1){var f=xl(this,u),p=l[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(l.length===2){var h=l[0].toString(o),d=l[1].toString(o);return c[0]&&(h="("+h+")"),c[1]&&(d="("+d+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?h+" "+d:h+" "+this.op+" "+d}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=l.map(function(y,S){return y=y.toString(o),c[S]&&(y="("+y+")"),y});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?v.join(" "):v.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:ud,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 u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!1);if(l.length===1){var f=xl(this,u),p=l[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">'+Cn(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Cn(this.op)+"</span>"}else if(l.length===2){var m=l[0].toHTML(o),h=l[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"&&s==="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">'+Cn(this.op)+"</span>"+h}else{var d=l.map(function(v,y){return v=v.toHTML(o),c[y]&&(v='<span class="math-parenthesis math-round-parenthesis">(</span>'+v+'<span class="math-parenthesis math-round-parenthesis">)</span>'),v});return l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="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">'+Cn(this.op)+"</span>"):'<span class="math-function">'+Cn(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 u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!0),f=pr[this.fn];if(f=typeof f>"u"?this.op:f,l.length===1){var p=xl(this,u),m=l[0].toTex(o);return c[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?f+m:m+f}else if(l.length===2){var h=l[0],d=h.toTex(o);c[0]&&(d="\\left(".concat(d,"\\right)"));var v=l[1],y=v.toTex(o);c[1]&&(y="\\left(".concat(y,"\\right)"));var S;switch(u==="keep"?S=h.getIdentifier():S=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+y+"}";case"OperatorNode:pow":switch(d="{"+d+"}",y="{"+y+"}",S){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&s==="hide")return d+"~"+y}return d+f+y}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var b=l.map(function(w,A){return w=w.toTex(o),c[A]&&(w="\\left(".concat(w,"\\right)")),w});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&s==="hide"?b.join("~"):b.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+l.map(function(w){return w.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return fr(i,"name",ud),i},{isClass:!0,isNode:!0});var ld="ParenthesisNode",DX=["Node"],B1=T(ld,DX,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),!jt(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return ld}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:ld,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 fr(t,"name",ld),t},{isClass:!0,isNode:!0});var cd="RangeNode",NX=["Node"],O1=T(cd,NX,n=>{var{Node:e}=n;function t(i,a,o){var u=gr(i,a,o),s={},l=gr(i.start,a,o);if(s.start=l!==null&&l<=u||a==="all",i.step){var c=gr(i.step,a,o);s.step=c!==null&&c<=u||a==="all"}var f=gr(i.end,a,o);return s.end=f!==null&&f<=u||a==="all",s}class r extends e{constructor(a,o,u){if(super(),!jt(a))throw new TypeError("Node expected");if(!jt(o))throw new TypeError("Node expected");if(u&&!jt(u))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=u||null}get type(){return cd}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Fr(o)&&o.name==="end"});return a.length>0}_compile(a,o){var u=a.range,s=this.start._compile(a,o),l=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(p,m,h){return u(s(p,m,h),l(p,m,h),c(p,m,h))}}else return function(p,m,h){return u(s(p,m,h),l(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 r(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 r(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s,l=this.start.toString(a);if(u.start&&(l="("+l+")"),s=l,this.step){var c=this.step.toString(a);u.step&&(c="("+c+")"),s+=":"+c}var f=this.end.toString(a);return u.end&&(f="("+f+")"),s+=":"+f,s}toJSON(){return{mathjs:cd,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new r(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s,l=this.start.toHTML(a);if(u.start&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s=l,this.step){var c=this.step.toHTML(a);u.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return u.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+='<span class="math-operator math-range-operator">:</span>'+f,s}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s=this.start.toTex(a);if(u.start&&(s="\\left(".concat(s,"\\right)")),this.step){var l=this.step.toTex(a);u.step&&(l="\\left(".concat(l,"\\right)")),s+=":"+l}var c=this.end.toTex(a);return u.end&&(c="\\left(".concat(c,"\\right)")),s+=":"+c,s}}return fr(r,"name",cd),r},{isClass:!0,isNode:!0});var fd="RelationalNode",TX=["Node"],R1=T(fd,TX,n=>{var{Node:e}=n,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r 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 fd}get isRelationalNode(){return!0}_compile(a,o){var u=this,s=this.params.map(l=>l._compile(a,o));return function(c,f,p){for(var m,h=s[0](c,f,p),d=0;d<u.conditionals.length;d++){m=h,h=s[d+1](c,f,p);var v=$r(a,u.conditionals[d]);if(!v(m,h))return!1}return!0}}forEach(a){this.params.forEach((o,u)=>a(o,"params["+u+"]",this),this)}map(a){return new r(this.conditionals.slice(),this.params.map((o,u)=>this._ifNode(a(o,"params["+u+"]",this)),this))}clone(){return new r(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"("+f.toString(a)+")":f.toString(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+=" "+t[this.conditionals[c]],l+=" "+s[c+1];return l}toJSON(){return{mathjs:fd,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new r(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Cn(t[this.conditionals[c]])+"</span>"+s[c+1];return l}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+=pr[this.conditionals[c]]+s[c+1];return l}}return fr(r,"name",fd),r},{isClass:!0,isNode:!0});var CX="SymbolNode",FX=["math","?Unit","Node"],L1=T(CX,FX,n=>{var{math:e,Unit:t,Node:r}=n;function i(o){return t?t.isValuelessUnit(o):!1}class a extends r{constructor(u){if(super(),typeof u!="string")throw new TypeError('String expected for parameter "name"');this.name=u}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(u,s){var l=this.name;if(s[l]===!0)return function(f,p,m){return $r(p,l)};if(l in u)return function(f,p,m){return f.has(l)?f.get(l):$r(u,l)};var c=i(l);return function(f,p,m){return f.has(l)?f.get(l):c?new t(null,l):a.onUndefinedSymbol(l)}}forEach(u){}map(u){return this.clone()}static onUndefinedSymbol(u){throw new Error("Undefined symbol "+u)}clone(){return new a(this.name)}_toString(u){return this.name}_toHTML(u){var s=Cn(this.name);return s==="true"||s==="false"?'<span class="math-symbol math-boolean">'+s+"</span>":s==="i"?'<span class="math-symbol math-imaginary-symbol">'+s+"</span>":s==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+s+"</span>":s==="NaN"?'<span class="math-symbol math-nan-symbol">'+s+"</span>":s==="null"?'<span class="math-symbol math-null-symbol">'+s+"</span>":s==="undefined"?'<span class="math-symbol math-undefined-symbol">'+s+"</span>":'<span class="math-symbol">'+s+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(u){return new a(u.name)}_toTex(u){var s=!1;typeof e[this.name]>"u"&&i(this.name)&&(s=!0);var l=nd(this.name,s);return l[0]==="\\"?l:" "+l}}return a},{isClass:!0,isNode:!0});var pd="FunctionNode",IX=["math","Node","SymbolNode"],V1=T(pd,IX,n=>{var e,{math:t,Node:r,SymbolNode:i}=n,a=s=>Mt(s,{truncate:78});function o(s,l,c){for(var f="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,h;(h=p.exec(s))!==null;)if(f+=s.substring(m,h.index),m=h.index,h[0]==="$$")f+="$",m++;else{m+=h[0].length;var d=l[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(jt(d))f+=d.toTex(c);else if(Array.isArray(d))f+=d.map(function(v,y){if(jt(v))return v.toTex(c);throw new TypeError("Template: "+h[1]+"["+y+"] 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(jt(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+=s.slice(m),f}class u extends r{constructor(l,c){if(super(),typeof l=="string"&&(l=new i(l)),!jt(l))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(jt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=l,this.args=c||[]}get name(){return this.fn.name||""}get type(){return pd}get isFunctionNode(){return!0}_compile(l,c){var f=this.args.map(E=>E._compile(l,c));if(Fr(this.fn)){var p=this.fn.name;if(c[p]){var y=this.args;return function(_,N,P){var B=$r(N,p);if(typeof B!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(B)));if(B.rawArgs)return B(y,l,iu(_,N));var V=f.map(z=>z(_,N,P));return B.apply(B,V)}}else{var m=p in l?$r(l,p):void 0,h=typeof m=="function"&&m.rawArgs===!0,d=E=>{var _;if(E.has(p))_=E.get(p);else if(p in l)_=$r(l,p);else return u.onUndefinedFunction(p);if(typeof _=="function")return _;throw new TypeError("'".concat(p,`' is not a function; its value is:
`).concat(a(_)))};if(h){var v=this.args;return function(_,N,P){var B=d(_);return B(v,l,iu(_,N))}}else switch(f.length){case 0:return function(_,N,P){var B=d(_);return B()};case 1:return function(_,N,P){var B=d(_),V=f[0];return B(V(_,N,P))};case 2:return function(_,N,P){var B=d(_),V=f[0],z=f[1];return B(V(_,N,P),z(_,N,P))};default:return function(_,N,P){var B=d(_),V=f.map(z=>z(_,N,P));return B(...V)}}}}else if(zi(this.fn)&&oa(this.fn.index)&&this.fn.index.isObjectProperty()){var S=this.fn.object._compile(l,c),b=this.fn.index.getObjectProperty(),w=this.args;return function(_,N,P){var B=S(_,N,P),V=tT(B,b);if(V!=null&&V.rawArgs)return V(w,l,iu(_,N));var z=f.map(L=>L(_,N,P));return V.apply(B,z)}}else{var A=this.fn.toString(),x=this.fn._compile(l,c),D=this.args;return function(_,N,P){var B=x(_,N,P);if(typeof B!="function")throw new TypeError("Expression '".concat(A,"' did not evaluate to a function; value is:")+`
`.concat(a(B)));if(B.rawArgs)return B(D,l,iu(_,N));var V=f.map(z=>z(_,N,P));return B.apply(B,V)}}}forEach(l){l(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)l(this.args[c],"args["+c+"]",this)}map(l){for(var c=this._ifNode(l(this.fn,"fn",this)),f=[],p=0;p<this.args.length;p++)f[p]=this._ifNode(l(this.args[p],"args["+p+"]",this));return new u(c,f)}clone(){return new u(this.fn,this.args.slice(0))}toString(l){var c,f=this.fn.toString(l);return l&&typeof l.handler=="object"&&ut(l.handler,f)&&(c=l.handler[f](this,l)),typeof c<"u"?c:super.toString(l)}_toString(l){var c=this.args.map(function(p){return p.toString(l)}),f=Ya(this.fn)?"("+this.fn.toString(l)+")":this.fn.toString(l);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:pd,fn:this.fn,args:this.args}}_toHTML(l){var c=this.args.map(function(f){return f.toHTML(l)});return'<span class="math-function">'+Cn(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(l){var c;return l&&typeof l.handler=="object"&&ut(l.handler,this.name)&&(c=l.handler[this.name](this,l)),typeof c<"u"?c:super.toTex(l)}_toTex(l){var c=this.args.map(function(m){return m.toTex(l)}),f;T1[this.name]&&(f=T1[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,l);break;case"string":p=o(f,this,l);break;case"object":switch(typeof f[c.length]){case"function":p=f[c.length](this,l);break;case"string":p=o(f[c.length],this,l);break}}return typeof p<"u"?p:o(HF,this,l)}getIdentifier(){return this.type+":"+this.name}}return e=u,fr(u,"name",pd),fr(u,"onUndefinedFunction",function(s){throw new Error("Undefined function "+s)}),fr(u,"fromJSON",function(s){return new e(s.fn,s.args)}),u},{isClass:!0,isNode:!0});var GF="parse",PX=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],U1=T(GF,PX,n=>{var{typed:e,numeric:t,config:r,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:u,ConditionalNode:s,ConstantNode:l,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:v,RelationalNode:y,SymbolNode:S}=n,b=e(GF,{string:function(X){return Z(X,{})},"Array | Matrix":function(X){return w(X,{})},"string, Object":function(X,Ae){var Le=Ae.nodes!==void 0?Ae.nodes:{};return Z(X,Le)},"Array | Matrix, Object":w});function w(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ae=X.nodes!==void 0?X.nodes:{};return lt(F,function(Le){if(typeof Le!="string")throw new TypeError("String expected");return Z(Le,Ae)})}var A={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},x={",":!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},D={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},E={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],N={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function P(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:A.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,X){return F.expression.substr(F.index,X)}function V(F){return B(F,1)}function z(F){F.index++}function L(F){return F.expression.charAt(F.index-1)}function k(F){return F.expression.charAt(F.index+1)}function C(F){for(F.tokenType=A.NULL,F.token="",F.comment="";;){if(V(F)==="#")for(;V(F)!==`
`&&V(F)!=="";)F.comment+=V(F),z(F);if(b.isWhitespace(V(F),F.nestingLevel))z(F);else break}if(V(F)===""){F.tokenType=A.DELIMITER;return}if(V(F)===`
`&&!F.nestingLevel){F.tokenType=A.DELIMITER,F.token=V(F),z(F);return}var X=V(F),Ae=B(F,2),Le=B(F,3);if(Le.length===3&&x[Le]){F.tokenType=A.DELIMITER,F.token=Le,z(F),z(F),z(F);return}if(Ae.length===2&&x[Ae]){F.tokenType=A.DELIMITER,F.token=Ae,z(F),z(F);return}if(x[X]){F.tokenType=A.DELIMITER,F.token=X,z(F);return}if(b.isDigitDot(X)){F.tokenType=A.NUMBER;var ft=B(F,2);if(ft==="0b"||ft==="0o"||ft==="0x"){for(F.token+=V(F),z(F),F.token+=V(F),z(F);b.isHexDigit(V(F));)F.token+=V(F),z(F);if(V(F)===".")for(F.token+=".",z(F);b.isHexDigit(V(F));)F.token+=V(F),z(F);else if(V(F)==="i")for(F.token+="i",z(F);b.isDigit(V(F));)F.token+=V(F),z(F);return}if(V(F)==="."){if(F.token+=V(F),z(F),!b.isDigit(V(F))){F.tokenType=A.DELIMITER;return}}else{for(;b.isDigit(V(F));)F.token+=V(F),z(F);b.isDecimalMark(V(F),k(F))&&(F.token+=V(F),z(F))}for(;b.isDigit(V(F));)F.token+=V(F),z(F);if(V(F)==="E"||V(F)==="e"){if(b.isDigit(k(F))||k(F)==="-"||k(F)==="+"){if(F.token+=V(F),z(F),(V(F)==="+"||V(F)==="-")&&(F.token+=V(F),z(F)),!b.isDigit(V(F)))throw ze(F,'Digit expected, got "'+V(F)+'"');for(;b.isDigit(V(F));)F.token+=V(F),z(F);if(b.isDecimalMark(V(F),k(F)))throw ze(F,'Digit expected, got "'+V(F)+'"')}else if(k(F)===".")throw z(F),ze(F,'Digit expected, got "'+V(F)+'"')}return}if(b.isAlpha(V(F),L(F),k(F))){for(;b.isAlpha(V(F),L(F),k(F))||b.isDigit(V(F));)F.token+=V(F),z(F);ut(D,F.token)?F.tokenType=A.DELIMITER:F.tokenType=A.SYMBOL;return}for(F.tokenType=A.UNKNOWN;V(F)!=="";)F.token+=V(F),z(F);throw ze(F,'Syntax error in part "'+F.token+'"')}function W(F){do C(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function H(F){F.nestingLevel--}b.isAlpha=function(X,Ae,Le){return b.isValidLatinOrGreek(X)||b.isValidMathSymbol(X,Le)||b.isValidMathSymbol(Ae,X)},b.isValidLatinOrGreek=function(X){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(X)},b.isValidMathSymbol=function(X,Ae){return/^[\uD835]$/.test(X)&&/^[\uDC00-\uDFFF]$/.test(Ae)&&/^[^\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(Ae)},b.isWhitespace=function(X,Ae){return X===" "||X===" "||X===`
`&&Ae>0},b.isDecimalMark=function(X,Ae){return X==="."&&Ae!=="/"&&Ae!=="*"&&Ae!=="^"},b.isDigitDot=function(X){return X>="0"&&X<="9"||X==="."},b.isDigit=function(X){return X>="0"&&X<="9"},b.isHexDigit=function(X){return X>="0"&&X<="9"||X>="a"&&X<="f"||X>="A"&&X<="F"};function Z(F,X){var Ae=P();zr(Ae,{expression:F,extraNodes:X}),C(Ae);var Le=Q(Ae);if(Ae.token!=="")throw Ae.tokenType===A.DELIMITER?Xe(Ae,"Unexpected operator "+Ae.token):ze(Ae,'Unexpected part "'+Ae.token+'"');return Le}function Q(F){var X,Ae=[],Le;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(X=U(F),F.comment&&(X.comment=F.comment));F.token===`
`||F.token===";";)Ae.length===0&&X&&(Le=F.token!==";",Ae.push({node:X,visible:Le})),C(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(X=U(F),F.comment&&(X.comment=F.comment),Le=F.token!==";",Ae.push({node:X,visible:Le}));return Ae.length>0?new u(Ae):(X||(X=new l(void 0),F.comment&&(X.comment=F.comment)),X)}function U(F){var X,Ae,Le,ft,St=de(F);if(F.token==="="){if(Fr(St))return X=St.name,W(F),Le=U(F),new o(new S(X),Le);if(zi(St))return W(F),Le=U(F),new o(St.object,St.index,Le);if(gi(St)&&Fr(St.fn)&&(ft=!0,Ae=[],X=St.name,St.args.forEach(function(Ye,kn){Fr(Ye)?Ae[kn]=Ye.name:ft=!1}),ft))return W(F),Le=U(F),new c(X,Ae,Le);throw ze(F,"Invalid left hand side of assignment operator =")}return St}function de(F){for(var X=De(F);F.token==="?";){var Ae=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Le=X,ft=U(F);if(F.token!==":")throw ze(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var St=U(F);X=new s(Le,ft,St),F.conditionalLevel=Ae}return X}function De(F){for(var X=me(F);F.token==="or";)W(F),X=new h("or","or",[X,me(F)]);return X}function me(F){for(var X=_e(F);F.token==="xor";)W(F),X=new h("xor","xor",[X,_e(F)]);return X}function _e(F){for(var X=Ne(F);F.token==="and";)W(F),X=new h("and","and",[X,Ne(F)]);return X}function Ne(F){for(var X=Se(F);F.token==="|";)W(F),X=new h("|","bitOr",[X,Se(F)]);return X}function Se(F){for(var X=Me(F);F.token==="^|";)W(F),X=new h("^|","bitXor",[X,Me(F)]);return X}function Me(F){for(var X=Ee(F);F.token==="&";)W(F),X=new h("&","bitAnd",[X,Ee(F)]);return X}function Ee(F){for(var X=[Ce(F)],Ae=[],Le={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};ut(Le,F.token);){var ft={name:F.token,fn:Le[F.token]};Ae.push(ft),W(F),X.push(Ce(F))}return X.length===1?X[0]:X.length===2?new h(Ae[0].name,Ae[0].fn,X):new y(Ae.map(St=>St.fn),X)}function Ce(F){var X,Ae,Le,ft;X=Ge(F);for(var St={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),ft=[X,Ge(F)],X=new h(Ae,Le,ft);return X}function Ge(F){var X,Ae,Le,ft;X=We(F);for(var St={to:"to",in:"to"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),Ae==="in"&&F.token===""?X=new h("*","multiply",[X,new S("in")],!0):(ft=[X,We(F)],X=new h(Ae,Le,ft));return X}function We(F){var X,Ae=[];if(F.token===":"?X=new l(1):X=te(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(Ae.push(X);F.token===":"&&Ae.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?Ae.push(new S("end")):Ae.push(te(F));Ae.length===3?X=new v(Ae[0],Ae[2],Ae[1]):X=new v(Ae[0],Ae[1])}return X}function te(F){var X,Ae,Le,ft;X=oe(F);for(var St={"+":"add","-":"subtract"};ut(St,F.token);){Ae=F.token,Le=St[Ae],W(F);var Ye=oe(F);Ye.isPercentage?ft=[X,new h("*","multiply",[X,Ye])]:ft=[X,Ye],X=new h(Ae,Le,ft)}return X}function oe(F){var X,Ae,Le,ft;X=ge(F),Ae=X;for(var St={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};ut(St,F.token);)Le=F.token,ft=St[Le],W(F),Ae=ge(F),X=new h(Le,ft,[X,Ae]);return X}function ge(F){var X,Ae;for(X=ie(F),Ae=X;F.tokenType===A.SYMBOL||F.token==="in"&&zt(X)||F.tokenType===A.NUMBER&&!zt(Ae)&&(!Vr(Ae)||Ae.op==="!")||F.token==="(";)Ae=ie(F),X=new h("*","multiply",[X,Ae],!0);return X}function ie(F){for(var X=re(F),Ae=X,Le=[];F.token==="/"&&bc(Ae);)if(Le.push(zr({},F)),W(F),F.tokenType===A.NUMBER)if(Le.push(zr({},F)),W(F),F.tokenType===A.SYMBOL||F.token==="(")zr(F,Le.pop()),Le.pop(),Ae=re(F),X=new h("/","divide",[X,Ae]);else{Le.pop(),zr(F,Le.pop());break}else{zr(F,Le.pop());break}return X}function re(F){var X,Ae,Le,ft;X=le(F);for(var St={"%":"mod",mod:"mod"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),Ae==="%"&&F.tokenType===A.DELIMITER&&F.token!=="("?X=new h("/","divide",[X,new l(100)],!1,!0):(ft=[X,le(F)],X=new h(Ae,Le,ft));return X}function le(F){var X,Ae,Le,ft={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return ut(ft,F.token)?(Le=ft[F.token],X=F.token,W(F),Ae=[le(F)],new h(X,Le,Ae)):Te(F)}function Te(F){var X,Ae,Le,ft;return X=Ie(F),(F.token==="^"||F.token===".^")&&(Ae=F.token,Le=Ae==="^"?"pow":"dotPow",W(F),ft=[X,le(F)],X=new h(Ae,Le,ft)),X}function Ie(F){var X,Ae,Le,ft;X=Ze(F);for(var St={"!":"factorial","'":"ctranspose"};ut(St,F.token);)Ae=F.token,Le=St[Ae],C(F),ft=[X],X=new h(Ae,Le,ft),X=ht(F,X);return X}function Ze(F){var X=[];if(F.tokenType===A.SYMBOL&&ut(F.extraNodes,F.token)){var Ae=F.extraNodes[F.token];if(C(F),F.token==="("){if(X=[],O(F),C(F),F.token!==")")for(X.push(U(F));F.token===",";)C(F),X.push(U(F));if(F.token!==")")throw ze(F,"Parenthesis ) expected");H(F),C(F)}return new Ae(X)}return we(F)}function we(F){var X,Ae;return F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D?(Ae=F.token,C(F),ut(E,Ae)?X=new l(E[Ae]):_.indexOf(Ae)!==-1?X=new l(t(Ae,"number")):X=new S(Ae),X=ht(F,X),X):Nt(F)}function ht(F,X,Ae){for(var Le;(F.token==="("||F.token==="["||F.token===".")&&(!Ae||Ae.indexOf(F.token)!==-1);)if(Le=[],F.token==="(")if(Fr(X)||zi(X)){if(O(F),C(F),F.token!==")")for(Le.push(U(F));F.token===",";)C(F),Le.push(U(F));if(F.token!==")")throw ze(F,"Parenthesis ) expected");H(F),C(F),X=new f(X,Le)}else return X;else if(F.token==="["){if(O(F),C(F),F.token!=="]")for(Le.push(U(F));F.token===",";)C(F),Le.push(U(F));if(F.token!=="]")throw ze(F,"Parenthesis ] expected");H(F),C(F),X=new i(X,new p(Le))}else{C(F);var ft=F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D;if(!ft)throw ze(F,"Property name expected after dot");Le.push(new l(F.token)),C(F);var St=!0;X=new i(X,new p(Le,St))}return X}function Nt(F){var X,Ae;return F.token==='"'||F.token==="'"?(Ae=Ht(F,F.token),X=new l(Ae),X=ht(F,X),X):Et(F)}function Ht(F,X){for(var Ae="";V(F)!==""&&V(F)!==X;)if(V(F)==="\\"){z(F);var Le=V(F),ft=N[Le];if(ft!==void 0)Ae+=ft,F.index+=1;else if(Le==="u"){var St=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(St))Ae+=String.fromCharCode(parseInt(St,16)),F.index+=5;else throw ze(F,"Invalid unicode character \\u".concat(St))}else throw ze(F,"Bad escape character \\".concat(Le))}else Ae+=V(F),z(F);if(C(F),F.token!==X)throw ze(F,"End of string ".concat(X," expected"));return C(F),Ae}function Et(F){var X,Ae,Le,ft;if(F.token==="["){if(O(F),C(F),F.token!=="]"){var St=ae(F);if(F.token===";"){for(Le=1,Ae=[St];F.token===";";)C(F),F.token!=="]"&&(Ae[Le]=ae(F),Le++);if(F.token!=="]")throw ze(F,"End of matrix ] expected");H(F),C(F),ft=Ae[0].items.length;for(var Ye=1;Ye<Le;Ye++)if(Ae[Ye].items.length!==ft)throw Xe(F,"Column dimensions mismatch ("+Ae[Ye].items.length+" !== "+ft+")");X=new a(Ae)}else{if(F.token!=="]")throw ze(F,"End of matrix ] expected");H(F),C(F),X=St}}else H(F),C(F),X=new a([]);return ht(F,X)}return he(F)}function ae(F){for(var X=[U(F)],Ae=1;F.token===",";)C(F),F.token!=="]"&&F.token!==";"&&(X[Ae]=U(F),Ae++);return new a(X)}function he(F){if(F.token==="{"){O(F);var X,Ae={};do if(C(F),F.token!=="}"){if(F.token==='"'||F.token==="'")X=Ht(F,F.token);else if(F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D)X=F.token,C(F);else throw ze(F,"Symbol or string expected as object key");if(F.token!==":")throw ze(F,"Colon : expected after object key");C(F),Ae[X]=U(F)}while(F.token===",");if(F.token!=="}")throw ze(F,"Comma , or bracket } expected after object value");H(F),C(F);var Le=new m(Ae);return Le=ht(F,Le),Le}return ve(F)}function ve(F){var X;return F.tokenType===A.NUMBER?(X=F.token,C(F),new l(t(X,r.number))):qe(F)}function qe(F){var X;if(F.token==="("){if(O(F),C(F),X=U(F),F.token!==")")throw ze(F,"Parenthesis ) expected");return H(F),C(F),X=new d(X),X=ht(F,X),X}return $e(F)}function $e(F){throw F.token===""?ze(F,"Unexpected end of expression"):ze(F,"Value expected")}function Re(F){return F.index-F.token.length+1}function ze(F,X){var Ae=Re(F),Le=new SyntaxError(X+" (char "+Ae+")");return Le.char=Ae,Le}function Xe(F,X){var Ae=Re(F),Le=new SyntaxError(X+" (char "+Ae+")");return Le.char=Ae,Le}return e.addConversion({from:"string",to:"Node",convert:b}),b});var WF="compile",kX=["typed","parse"],q1=T(WF,kX,n=>{var{typed:e,parse:t}=n;return e(WF,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return lt(i,function(a){return t(a).compile()})}})});var YF="evaluate",BX=["typed","parse"],z1=T(YF,BX,n=>{var{typed:e,parse:t}=n;return e(YF,{string:function(i){var a=as();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=as();return lt(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return lt(i,function(o){return t(o).compile().evaluate(a)})}})});var OX="Parser",RX=["evaluate"],$1=T(OX,RX,n=>{var{evaluate:e}=n;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:as(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(r){return e(r,this.scope)},t.prototype.get=function(r){if(this.scope.has(r))return this.scope.get(r)},t.prototype.getAll=function(){return iT(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(r,i){return this.scope.set(r,i),i},t.prototype.remove=function(r){this.scope.delete(r)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var jF="parser",LX=["typed","Parser"],H1=T(jF,LX,n=>{var{typed:e,Parser:t}=n;return e(jF,{"":function(){return new t}})});var ZF="lup",VX=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],G1=T(ZF,VX,n=>{var{typed:e,matrix:t,abs:r,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:u,larger:s,equalScalar:l,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=n;return e(ZF,{DenseMatrix:function(y){return h(y)},SparseMatrix:function(y){return d(y)},Array:function(y){var S=t(y),b=h(S);return{L:b.L.valueOf(),U:b.U.valueOf(),p:b.p}}});function h(v){var y=v._size[0],S=v._size[1],b=Math.min(y,S),w=vt(v._data),A=[],x=[y,b],D=[],E=[b,S],_,N,P,B=[];for(_=0;_<y;_++)B[_]=_;for(N=0;N<S;N++){if(N>0)for(_=0;_<y;_++){var V=Math.min(_,N),z=0;for(P=0;P<V;P++)z=i(z,o(w[_][P],w[P][N]));w[_][N]=u(w[_][N],z)}var L=N,k=0,C=0;for(_=N;_<y;_++){var W=w[_][N],O=r(W);s(O,k)&&(L=_,k=O,C=W)}if(N!==L&&(B[N]=[B[L],B[L]=B[N]][0],f._swapRows(N,L,w)),N<y)for(_=N+1;_<y;_++){var H=w[_][N];l(H,0)||(w[_][N]=a(w[_][N],C))}}for(N=0;N<S;N++)for(_=0;_<y;_++){if(N===0&&(_<S&&(D[_]=[]),A[_]=[]),_<N){_<S&&(D[_][N]=w[_][N]),N<y&&(A[_][N]=0);continue}if(_===N){_<S&&(D[_][N]=w[_][N]),N<y&&(A[_][N]=1);continue}_<S&&(D[_][N]=0),N<y&&(A[_][N]=w[_][N])}var Z=new f({data:A,size:x}),Q=new f({data:D,size:E}),U=[];for(_=0,b=B.length;_<b;_++)U[B[_]]=_;return{L:Z,U:Q,p:U,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function d(v){var y=v._size[0],S=v._size[1],b=Math.min(y,S),w=v._values,A=v._index,x=v._ptr,D=[],E=[],_=[],N=[y,b],P=[],B=[],V=[],z=[b,S],L,k,C,W=[],O=[];for(L=0;L<y;L++)W[L]=L,O[L]=L;var H=function(U,de){var De=O[U],me=O[de];W[De]=de,W[me]=U,O[U]=me,O[de]=De},Z=function(){var U=new m;k<y&&(_.push(D.length),D.push(1),E.push(k)),V.push(P.length);var de=x[k],De=x[k+1];for(C=de;C<De;C++)L=A[C],U.set(W[L],w[C]);k>0&&U.forEach(0,k-1,function(Se,Me){p._forEachRow(Se,D,E,_,function(Ee,Ce){Ee>Se&&U.accumulate(Ee,c(o(Ce,Me)))})});var me=k,_e=U.get(k),Ne=r(_e);U.forEach(k+1,y-1,function(Se,Me){var Ee=r(Me);s(Ee,Ne)&&(me=Se,Ne=Ee,_e=Me)}),k!==me&&(p._swapRows(k,me,N[1],D,E,_),p._swapRows(k,me,z[1],P,B,V),U.swap(k,me),H(k,me)),U.forEach(0,y-1,function(Se,Me){Se<=k?(P.push(Me),B.push(Se)):(Me=a(Me,_e),l(Me,0)||(D.push(Me),E.push(Se)))})};for(k=0;k<S;k++)Z();return V.push(P.length),_.push(D.length),{L:new p({values:D,index:E,ptr:_,size:N}),U:new p({values:P,index:B,ptr:V,size:z}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var JF="qr",UX=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],W1=T(JF,UX,n=>{var{typed:e,matrix:t,zeros:r,identity:i,isZero:a,equal:o,sign:u,sqrt:s,conj:l,unaryMinus:c,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=n;return zr(e(JF,{DenseMatrix:function(w){return y(w)},SparseMatrix:function(w){return S(w)},Array:function(w){var A=t(w),x=y(A);return{Q:x.Q.valueOf(),R:x.R.valueOf()}}}),{_denseQRimpl:v});function v(b){var w=b._size[0],A=b._size[1],x=i([w],"dense"),D=x._data,E=b.clone(),_=E._data,N,P,B,V=r([w],"");for(B=0;B<Math.min(A,w);++B){var z=_[B][B],L=c(o(z,0)?1:u(z)),k=l(L),C=0;for(N=B;N<w;N++)C=f(C,m(_[N][B],l(_[N][B])));var W=m(L,s(C));if(!a(W)){var O=h(z,W);for(V[B]=1,N=B+1;N<w;N++)V[N]=p(_[N][B],O);var H=c(l(p(O,W))),Z=void 0;for(P=B;P<A;P++){for(Z=0,N=B;N<w;N++)Z=f(Z,m(l(V[N]),_[N][P]));for(Z=m(Z,H),N=B;N<w;N++)_[N][P]=m(h(_[N][P],m(V[N],Z)),k)}for(N=0;N<w;N++){for(Z=0,P=B;P<w;P++)Z=f(Z,m(D[N][P],V[P]));for(Z=m(Z,H),P=B;P<w;++P)D[N][P]=p(h(D[N][P],m(Z,l(V[P]))),k)}}}return{Q:x,R:E,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function y(b){var w=v(b),A=w.R._data;if(b._data.length>0)for(var x=A[0][0].type==="Complex"?d(0):0,D=0;D<A.length;++D)for(var E=0;E<D&&E<(A[0]||[]).length;++E)A[D][E]=x;return w}function S(b){throw new Error("qr not implemented for sparse matrices yet")}});function XF(n,e,t,r){for(var i=n._values,a=n._index,o=n._ptr,u=n._size,s=n._datatype,l=u[0],c=u[1],f=r&&n._values?[]:null,p=[],m=[],h=0,d=0;d<c;d++){m[d]=h;for(var v=t?t[d]:d,y=o[v],S=o[v+1],b=y;b<S;b++){var w=e?e[a[b]]:a[b];p[h]=w,f&&(f[h]=i[b]),h++}}return m[c]=h,n.createSparseMatrix({values:f,index:p,ptr:m,size:[l,c],datatype:s})}function md(n,e,t,r,i,a,o){var u=0;for(t[o]=n;u>=0;){var s=t[o+u],l=t[r+s];l===-1?(u--,a[e++]=s):(t[r+s]=t[i+l],++u,t[o+u]=l)}return e}function QF(n,e){if(!n)return null;var t=0,r,i=[],a=[],o=0,u=e,s=2*e;for(r=0;r<e;r++)a[o+r]=-1;for(r=e-1;r>=0;r--)n[r]!==-1&&(a[u+r]=a[o+n[r]],a[o+n[r]]=r);for(r=0;r<e;r++)n[r]===-1&&(t=md(r,t,a,o,u,i,s));return i}function KF(n,e){if(!n)return null;var t=n._index,r=n._ptr,i=n._size,a=i[0],o=i[1],u=[],s=[],l=0,c=o,f,p;if(e)for(f=0;f<a;f++)s[c+f]=-1;for(var m=0;m<o;m++){u[m]=-1,s[l+m]=-1;for(var h=r[m],d=r[m+1],v=h;v<d;v++){var y=t[v];for(f=e?s[c+y]:y;f!==-1&&f<m;f=p)p=s[l+f],s[l+f]=m,p===-1&&(u[f]=m);e&&(s[c+y]=m)}}return u}function eI(n,e,t){for(var r=n._values,i=n._index,a=n._ptr,o=n._size,u=o[1],s=0,l=0;l<u;l++){var c=a[l];for(a[l]=s;c<a[l+1];c++)e(i[c],l,r?r[c]:1,t)&&(i[s]=i[c],r&&(r[s]=r[c]),s++)}return a[u]=s,i.splice(s,i.length-s),r&&r.splice(s,r.length-s),s}function ka(n){return-n-2}var qX="csAmd",zX=["add","multiply","transpose"],tI=T(qX,zX,n=>{var{add:e,multiply:t,transpose:r}=n;return function(c,f){if(!f||c<=0||c>3)return null;var p=f._size,m=p[0],h=p[1],d=0,v=Math.max(16,10*Math.sqrt(h));v=Math.min(h-2,v);var y=i(c,f,m,h,v);eI(y,s,null);for(var S=y._index,b=y._ptr,w=b[h],A=[],x=[],D=0,E=h+1,_=2*(h+1),N=3*(h+1),P=4*(h+1),B=5*(h+1),V=6*(h+1),z=7*(h+1),L=A,k=a(h,b,x,D,N,L,_,z,E,V,P,B),C=o(h,b,x,B,P,V,v,E,N,L,_),W=0,O,H,Z,Q,U,de,De,me,_e,Ne,Se,Me,Ee,Ce,Ge,We;C<h;){for(Z=-1;W<h&&(Z=x[N+W])===-1;W++);x[_+Z]!==-1&&(L[x[_+Z]]=-1),x[N+W]=x[_+Z];var te=x[P+Z],oe=x[E+Z];C+=oe;var ge=0;x[E+Z]=-oe;var ie=b[Z],re=te===0?ie:w,le=re;for(Q=1;Q<=te+1;Q++){for(Q>te?(de=Z,De=ie,me=x[D+Z]-te):(de=S[ie++],De=b[de],me=x[D+de]),U=1;U<=me;U++)O=S[De++],!((_e=x[E+O])<=0)&&(ge+=_e,x[E+O]=-_e,S[le++]=O,x[_+O]!==-1&&(L[x[_+O]]=L[O]),L[O]!==-1?x[_+L[O]]=x[_+O]:x[N+x[B+O]]=x[_+O]);de!==Z&&(b[de]=ka(Z),x[V+de]=0)}for(te!==0&&(w=le),x[B+Z]=ge,b[Z]=re,x[D+Z]=le-re,x[P+Z]=-2,k=u(k,d,x,V,h),Ne=re;Ne<le;Ne++)if(O=S[Ne],!((Se=x[P+O])<=0)){_e=-x[E+O];var Te=k-_e;for(ie=b[O],Me=b[O]+Se-1;ie<=Me;ie++)de=S[ie],x[V+de]>=k?x[V+de]-=_e:x[V+de]!==0&&(x[V+de]=x[B+de]+Te)}for(Ne=re;Ne<le;Ne++){for(O=S[Ne],Me=b[O],Ee=Me+x[P+O]-1,Ce=Me,Ge=0,We=0,ie=Me;ie<=Ee;ie++)if(de=S[ie],x[V+de]!==0){var Ie=x[V+de]-k;Ie>0?(We+=Ie,S[Ce++]=de,Ge+=de):(b[de]=ka(Z),x[V+de]=0)}x[P+O]=Ce-Me+1;var Ze=Ce,we=Me+x[D+O];for(ie=Ee+1;ie<we;ie++){H=S[ie];var ht=x[E+H];ht<=0||(We+=ht,S[Ce++]=H,Ge+=H)}We===0?(b[O]=ka(Z),_e=-x[E+O],ge-=_e,oe+=_e,C+=_e,x[E+O]=0,x[P+O]=-1):(x[B+O]=Math.min(x[B+O],We),S[Ce]=S[Ze],S[Ze]=S[Me],S[Me]=Z,x[D+O]=Ce-Me+1,Ge=(Ge<0?-Ge:Ge)%h,x[_+O]=x[z+Ge],x[z+Ge]=O,L[O]=Ge)}for(x[B+Z]=ge,d=Math.max(d,ge),k=u(k+d,d,x,V,h),Ne=re;Ne<le;Ne++)if(O=S[Ne],!(x[E+O]>=0))for(Ge=L[O],O=x[z+Ge],x[z+Ge]=-1;O!==-1&&x[_+O]!==-1;O=x[_+O],k++){for(me=x[D+O],Se=x[P+O],ie=b[O]+1;ie<=b[O]+me-1;ie++)x[V+S[ie]]=k;var Nt=O;for(H=x[_+O];H!==-1;){var Ht=x[D+H]===me&&x[P+H]===Se;for(ie=b[H]+1;Ht&&ie<=b[H]+me-1;ie++)x[V+S[ie]]!==k&&(Ht=0);Ht?(b[H]=ka(O),x[E+O]+=x[E+H],x[E+H]=0,x[P+H]=-1,H=x[_+H],x[_+Nt]=H):(Nt=H,H=x[_+H])}}for(ie=re,Ne=re;Ne<le;Ne++)O=S[Ne],!((_e=-x[E+O])<=0)&&(x[E+O]=_e,We=x[B+O]+ge-_e,We=Math.min(We,h-C-_e),x[N+We]!==-1&&(L[x[N+We]]=O),x[_+O]=x[N+We],L[O]=-1,x[N+We]=O,W=Math.min(W,We),x[B+O]=We,S[ie++]=O);x[E+Z]=oe,(x[D+Z]=ie-re)===0&&(b[Z]=-1,x[V+Z]=0),te!==0&&(w=ie)}for(O=0;O<h;O++)b[O]=ka(b[O]);for(H=0;H<=h;H++)x[N+H]=-1;for(H=h;H>=0;H--)x[E+H]>0||(x[_+H]=x[N+b[H]],x[N+b[H]]=H);for(de=h;de>=0;de--)x[E+de]<=0||b[de]!==-1&&(x[_+de]=x[N+b[de]],x[N+b[de]]=de);for(Z=0,O=0;O<=h;O++)b[O]===-1&&(Z=md(O,Z,x,N,_,A,V));return A.splice(A.length-1,1),A};function i(l,c,f,p,m){var h=r(c);if(l===1&&p===f)return e(c,h);if(l===2){for(var d=h._index,v=h._ptr,y=0,S=0;S<f;S++){var b=v[S];if(v[S]=y,!(v[S+1]-b>m))for(var w=v[S+1];b<w;b++)d[y++]=d[b]}return v[f]=y,c=r(h),t(h,c)}return t(h,c)}function a(l,c,f,p,m,h,d,v,y,S,b,w){for(var A=0;A<l;A++)f[p+A]=c[A+1]-c[A];f[p+l]=0;for(var x=0;x<=l;x++)f[m+x]=-1,h[x]=-1,f[d+x]=-1,f[v+x]=-1,f[y+x]=1,f[S+x]=1,f[b+x]=0,f[w+x]=f[p+x];var D=u(0,0,f,S,l);return f[b+l]=-2,c[l]=-1,f[S+l]=0,D}function o(l,c,f,p,m,h,d,v,y,S,b){for(var w=0,A=0;A<l;A++){var x=f[p+A];if(x===0)f[m+A]=-2,w++,c[A]=-1,f[h+A]=0;else if(x>d)f[v+A]=0,f[m+A]=-1,w++,c[A]=ka(l),f[v+l]++;else{var D=f[y+x];D!==-1&&(S[D]=A),f[b+A]=f[y+x],f[y+x]=A}}return w}function u(l,c,f,p,m){if(l<2||l+c<0){for(var h=0;h<m;h++)f[p+h]!==0&&(f[p+h]=1);l=2}return l}function s(l,c){return l!==c}});function rI(n,e,t,r,i,a,o){var u,s,l=0,c;if(n<=e||t[r+e]<=t[i+n])return-1;t[i+n]=t[r+e];var f=t[a+n];if(t[a+n]=e,f===-1)l=1,c=n;else{for(l=2,c=f;c!==t[o+c];c=t[o+c]);for(u=f;u!==c;u=s)s=t[o+u],t[o+u]=c}return{jleaf:l,q:c}}var $X="csCounts",HX=["transpose"],nI=T($X,HX,n=>{var{transpose:e}=n;return function(t,r,i,a){if(!t||!r||!i)return null;var o=t._size,u=o[0],s=o[1],l,c,f,p,m,h,d,v=4*s+(a?s+u+1:0),y=[],S=0,b=s,w=2*s,A=3*s,x=4*s,D=5*s+1;for(f=0;f<v;f++)y[f]=-1;var E=[],_=e(t),N=_._index,P=_._ptr;for(f=0;f<s;f++)for(c=i[f],E[c]=y[A+c]===-1?1:0;c!==-1&&y[A+c]===-1;c=r[c])y[A+c]=f;if(a){for(f=0;f<s;f++)y[i[f]]=f;for(l=0;l<u;l++){for(f=s,h=P[l],d=P[l+1],m=h;m<d;m++)f=Math.min(f,y[N[m]]);y[D+l]=y[x+f],y[x+f]=l}}for(l=0;l<s;l++)y[S+l]=l;for(f=0;f<s;f++){for(c=i[f],r[c]!==-1&&E[r[c]]--,p=a?y[x+f]:c;p!==-1;p=a?y[D+p]:-1)for(m=P[p];m<P[p+1];m++){l=N[m];var B=rI(l,c,y,A,b,w,S);B.jleaf>=1&&E[c]++,B.jleaf===2&&E[B.q]--}r[c]!==-1&&(y[S+c]=r[c])}for(c=0;c<s;c++)r[c]!==-1&&(E[r[c]]+=E[c]);return E}});var GX="csSqr",WX=["add","multiply","transpose"],iI=T(GX,WX,n=>{var{add:e,multiply:t,transpose:r}=n,i=tI({add:e,multiply:t,transpose:r}),a=nI({transpose:r});return function(s,l,c){var f=l._ptr,p=l._size,m=p[1],h,d={};if(d.q=i(s,l),s&&!d.q)return null;if(c){var v=s?XF(l,null,d.q,0):l;d.parent=KF(v,1);var y=QF(d.parent,m);if(d.cp=a(v,d.parent,y,1),v&&d.parent&&d.cp&&o(v,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(u,s){var l=u._ptr,c=u._index,f=u._size,p=f[0],m=f[1];s.pinv=[],s.leftmost=[];var h=s.parent,d=s.pinv,v=s.leftmost,y=[],S=0,b=p,w=p+m,A=p+2*m,x,D,E,_,N;for(D=0;D<m;D++)y[b+D]=-1,y[w+D]=-1,y[A+D]=0;for(x=0;x<p;x++)v[x]=-1;for(D=m-1;D>=0;D--)for(_=l[D],N=l[D+1],E=_;E<N;E++)v[c[E]]=D;for(x=p-1;x>=0;x--)d[x]=-1,D=v[x],D!==-1&&(y[A+D]++===0&&(y[w+D]=x),y[S+x]=y[b+D],y[b+D]=x);for(s.lnz=0,s.m2=p,D=0;D<m;D++)if(x=y[b+D],s.lnz++,x<0&&(x=s.m2++),d[x]=D,!(--A[D]<=0)){s.lnz+=y[A+D];var P=h[D];P!==-1&&(y[A+P]===0&&(y[w+P]=y[w+D]),y[S+y[w+D]]=y[b+P],y[b+P]=y[S+x],y[A+P]+=y[A+D])}for(x=0;x<p;x++)d[x]<0&&(d[x]=D++);return!0}});function Wc(n,e){return n[e]<0}function dd(n,e){n[e]=ka(n[e])}function Y1(n){return n<0?ka(n):n}function aI(n,e,t,r,i){var a=e._index,o=e._ptr,u=e._size,s=u[1],l,c,f,p=0;for(r[0]=n;p>=0;){n=r[p];var m=i?i[n]:n;Wc(o,n)||(dd(o,n),r[s+p]=m<0?0:Y1(o[m]));var h=1;for(c=r[s+p],f=m<0?0:Y1(o[m+1]);c<f;c++)if(l=a[c],!Wc(o,l)){r[s+p]=c,r[++p]=l,h=0;break}h&&(p--,r[--t]=n)}return t}function oI(n,e,t,r,i){var a=n._ptr,o=n._size,u=e._index,s=e._ptr,l=o[1],c,f,p,m=l;for(f=s[t],p=s[t+1],c=f;c<p;c++){var h=u[c];Wc(a,h)||(m=aI(h,n,m,r,i))}for(c=m;c<l;c++)dd(a,r[c]);return m}var YX="csSpsolve",jX=["divideScalar","multiply","subtract"],sI=T(YX,jX,n=>{var{divideScalar:e,multiply:t,subtract:r}=n;return function(a,o,u,s,l,c,f){var p=a._values,m=a._index,h=a._ptr,d=a._size,v=d[1],y=o._values,S=o._index,b=o._ptr,w,A,x,D,E=oI(a,o,u,s,c);for(w=E;w<v;w++)l[s[w]]=0;for(A=b[u],x=b[u+1],w=A;w<x;w++)l[S[w]]=y[w];for(var _=E;_<v;_++){var N=s[_],P=c?c[N]:N;if(!(P<0))for(A=h[P],x=h[P+1],l[N]=e(l[N],p[f?A:x-1]),w=f?A+1:A,D=f?x:x-1;w<D;w++){var B=m[w];l[B]=r(l[B],t(p[w],l[N]))}}return E}});var ZX="csLu",JX=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],uI=T(ZX,JX,n=>{var{abs:e,divideScalar:t,multiply:r,subtract:i,larger:a,largerEq:o,SparseMatrix:u}=n,s=sI({divideScalar:t,multiply:r,subtract:i});return function(c,f,p){if(!c)return null;var m=c._size,h=m[1],d,v=100,y=100;f&&(d=f.q,v=f.lnz||v,y=f.unz||y);var S=[],b=[],w=[],A=new u({values:S,index:b,ptr:w,size:[h,h]}),x=[],D=[],E=[],_=new u({values:x,index:D,ptr:E,size:[h,h]}),N=[],P,B,V=[],z=[];for(P=0;P<h;P++)V[P]=0,N[P]=-1,w[P+1]=0;v=0,y=0;for(var L=0;L<h;L++){w[L]=v,E[L]=y;var k=d?d[L]:L,C=s(A,c,k,z,V,N,1),W=-1,O=-1;for(B=C;B<h;B++)if(P=z[B],N[P]<0){var H=e(V[P]);a(H,O)&&(O=H,W=P)}else D[y]=N[P],x[y++]=V[P];if(W===-1||O<=0)return null;N[k]<0&&o(e(V[k]),r(O,p))&&(W=k);var Z=V[W];for(D[y]=L,x[y++]=Z,N[W]=L,b[v]=W,S[v++]=1,B=C;B<h;B++)P=z[B],N[P]<0&&(b[v]=P,S[v++]=t(V[P],Z)),V[P]=0}for(w[h]=v,E[h]=y,B=0;B<v;B++)b[B]=N[b[B]];return S.splice(v,S.length-v),b.splice(v,b.length-v),x.splice(y,x.length-y),D.splice(y,D.length-y),{L:A,U:_,pinv:N}}});var lI="slu",XX=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],j1=T(lI,XX,n=>{var{typed:e,abs:t,add:r,multiply:i,transpose:a,divideScalar:o,subtract:u,larger:s,largerEq:l,SparseMatrix:c}=n,f=iI({add:r,multiply:i,transpose:a}),p=uI({abs:t,divideScalar:o,multiply:i,subtract:u,larger:s,largerEq:l,SparseMatrix:c});return e(lI,{"SparseMatrix, number, number":function(h,d,v){if(!nt(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(v<0||v>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var y=f(d,h,!1),S=p(h,y,v);return{L:S.L,U:S.U,p:S.pinv,q:y.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function Z1(n,e){var t,r=e.length,i=[];if(n)for(t=0;t<r;t++)i[n[t]]=e[t];else for(t=0;t<r;t++)i[t]=e[t];return i}var cI="lusolve",QX=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],J1=T(cI,QX,n=>{var{typed:e,matrix:t,lup:r,slu:i,usolve:a,lsolve:o,DenseMatrix:u}=n,s=Xa({DenseMatrix:u});return e(cI,{"Array, Array | Matrix":function(p,m){p=t(p);var h=r(p),d=c(h.L,h.U,h.p,null,m);return d.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix, number, number":function(p,m,h,d){var v=i(p,h,d);return c(v.L,v.U,v.p,v.q,m)},"Object, Array | Matrix":function(p,m){return c(p.L,p.U,p.p,p.q,m)}});function l(f){if(ot(f))return f;if(nr(f))return t(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,p,m,h,d){f=l(f),p=l(p),m&&(d=s(f,d,!0),d._data=Z1(m,d._data));var v=o(f,d),y=a(p,v);return h&&(y._data=Z1(h,y._data)),y}});var fI="polynomialRoot",KX=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],X1=T(fI,KX,n=>{var{typed:e,isZero:t,equalScalar:r,add:i,subtract:a,multiply:o,divide:u,sqrt:s,unaryMinus:l,cbrt:c,typeOf:f,im:p,re:m}=n;return e(fI,{"number|Complex, ...number|Complex":(h,d)=>{for(var v=[h,...d];v.length>0&&t(v[v.length-1]);)v.pop();if(v.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(d,"] must have a non-zero non-constant coefficient"));switch(v.length){case 2:return[l(u(v[0],v[1]))];case 3:{var[y,S,b]=v,w=o(2,b),A=o(S,S),x=o(4,b,y);if(r(A,x))return[u(l(S),w)];var D=s(a(A,x));return[u(a(D,S),w),u(a(l(D),S),w)]}case 4:{var[E,_,N,P]=v,B=l(o(3,P)),V=o(N,N),z=o(3,P,_),L=i(o(2,N,N,N),o(27,P,P,E)),k=o(9,P,N,_);if(r(V,z)&&r(L,k))return[u(N,B)];var C=a(V,z),W=a(L,k),O=i(o(18,P,N,_,E),o(N,N,_,_)),H=i(o(4,N,N,N,E),o(4,P,_,_,_),o(27,P,P,E,E));if(r(O,H))return[u(a(o(4,P,N,_),i(o(9,P,P,E),o(N,N,N))),o(P,C)),u(a(o(9,P,E),o(N,_)),o(2,C))];var Z;r(V,z)?Z=W:Z=u(i(W,s(a(o(W,W),o(4,C,C,C)))),2);var Q=!0,U=c(Z,Q).toArray().map(de=>u(i(N,de,u(C,de)),B));return U.map(de=>f(de)==="Complex"&&r(m(de),m(de)+p(de))?m(de):de)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(v))}}})});var eQ="Help",tQ=["evaluate"],Q1=T(eQ,tQ,n=>{var{evaluate:e}=n;function t(r){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!r)throw new Error('Argument "doc" missing');this.doc=r}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var r=this.doc||{},i=`
`;if(r.name&&(i+="Name: "+r.name+`
`),r.category&&(i+="Category: "+r.category+`
`),r.description&&(i+=`Description:
`+r.description+`
`),r.syntax&&(i+=`Syntax:
`+r.syntax.join(`
`)+`
`),r.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),u={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},s=0;s<r.examples.length;s++){var l=r.examples[s];i+=" "+l+`
`;var c=void 0;try{c=e(l,u)}catch(f){c=f}c!==void 0&&!lm(c)&&(i+=" "+Mt(c,{precision:14})+`
`)}i+=`
`,a&&e("config(originalConfig)",{originalConfig:o})}return r.mayThrow&&r.mayThrow.length&&(i+="Throws: "+r.mayThrow.join(", ")+`
`),r.seealso&&r.seealso.length&&(i+="See also: "+r.seealso.join(", ")+`
`),i},t.prototype.toJSON=function(){var r=vt(this.doc);return r.mathjs="Help",r},t.fromJSON=function(r){var i={};return Object.keys(r).filter(a=>a!=="mathjs").forEach(a=>{i[a]=r[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var rQ="Chain",nQ=["?on","math","typed"],K1=T(rQ,nQ,n=>{var{on:e,math:t,typed:r}=n;function i(l){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");cm(l)?this.value=l.value:this.value=l}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 Mt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(l){return new i(l.value)};function a(l,c){typeof c=="function"&&(i.prototype[l]=u(c))}function o(l,c){MN(i.prototype,l,function(){var p=c();if(typeof p=="function")return u(p)})}function u(l){return function(){if(arguments.length===0)return new i(l(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(r.isTypedFunction(l)){var p=r.resolve(l,c);if(p.params.length===1)throw new Error("chain function "+l.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(l,c))}return new i(l.apply(l,c))}}i.createProxy=function(l,c){if(typeof l=="string")a(l,c);else{var f=function(h){ut(l,h)&&s[h]===void 0&&o(h,()=>l[h])};for(var p in l)f(p)}};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),e&&e("import",function(l,c,f){f||o(l,c)}),i},{isClass:!0});var ew={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 pI={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var mI={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 dI={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 hI={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var gI={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var vI={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 yI={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 bI={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var xI={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var wI={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 tw={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 _I={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 SI={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var AI={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 MI={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var EI={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var DI={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 NI={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 TI={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 CI={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 FI={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 II={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 PI={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 kI={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 BI={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 OI={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 RI={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 LI={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 VI={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 UI={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 qI={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 zI={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 $I={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 HI={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 GI={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 WI={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 YI={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 jI={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 ZI={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 JI={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 XI={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 QI={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 KI={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 eP={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 tP={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 rP={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 nP={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 iP={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 aP={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var oP={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 sP={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 uP={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 lP={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 cP={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 fP={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 pP={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 mP={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 dP={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 hP={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 gP={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 vP={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 yP={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 bP={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 xP={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 wP={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 _P={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 SP={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 AP={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 MP={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 EP={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 DP={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 NP={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 TP={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 CP={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 FP={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 IP={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 PP={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 kP={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 BP={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 OP={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 RP={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 LP={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 VP={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 UP={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 qP={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 zP={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 $P={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var HP={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 GP={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 WP={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 YP={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 jP={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 ZP={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 JP={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 XP={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 QP={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 KP={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 ek={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 tk={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 rk={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 nk={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 ik={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 ak={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 ok={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 sk={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 uk={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 lk={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 ck={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 fk={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 pk={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 mk={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 dk={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 hk={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 gk={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 vk={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 yk={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 bk={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 xk={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 wk={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 _k={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 Sk={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 Ak={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 Mk={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 Ek={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 Dk={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 Nk={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 Tk={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 Ck={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 Fk={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 Ik={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 Pk={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 kk={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 Bk={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 Ok={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 Rk={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 Lk={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 Vk={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 Uk={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 qk={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 zk={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 $k={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 Hk={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 Gk={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 Wk={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 Yk={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 jk={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 Zk={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 Jk={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 Xk={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var Qk={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var Kk={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 tB={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 rB={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 nB={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 iB={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 aB={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 oB={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 sB={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 uB={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 lB={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 cB={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 fB={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 pB={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 mB={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 dB={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 hB={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 gB={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 vB={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 yB={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 bB={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 xB={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 _B={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 SB={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 AB={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 MB={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 EB={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 DB={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 NB={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 TB={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 CB={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 FB={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 IB={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 PB={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 kB={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 BB={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 OB={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 RB={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 LB={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 VB={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 UB={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 qB={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 zB={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 $B={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 HB={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 GB={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 WB={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 YB={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 jB={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 ZB={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 JB={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 XB={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 QB={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 KB={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 eO={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 tO={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var rO={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 nO={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 iO={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 aO={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 oO={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 sO={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 uO={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 lO={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 cO={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 fO={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 pO={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 mO={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 dO={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 hO={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 gO={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var vO={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 yO={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 bO={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 xO={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var wO={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 _O={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 SO={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 AO={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var MO={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 EO={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 DO={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 NO={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 TO={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 CO={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 FO={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 IO={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 PO={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var kO={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 BO={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 OO={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 RO={bignumber:DI,boolean:NI,complex:TI,createUnit:CI,fraction:FI,index:II,matrix:PI,number:kI,sparse:BI,splitUnit:OI,string:RI,unit:LI,e:ew,E:ew,false:pI,i:mI,Infinity:dI,LN2:gI,LN10:hI,LOG2E:yI,LOG10E:vI,NaN:bI,null:xI,pi:tw,PI:tw,phi:wI,SQRT1_2:_I,SQRT2:SI,tau:AI,true:MI,version:EI,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:zI,lsolve:HI,lsolveAll:GI,lup:WI,lusolve:YI,leafCount:$I,polynomialRoot:jI,resolve:XI,simplify:QI,simplifyConstant:KI,simplifyCore:eP,symbolicEqual:rP,rationalize:JI,slu:tP,usolve:nP,usolveAll:iP,qr:ZI,abs:aP,add:oP,cbrt:sP,ceil:uP,cube:lP,divide:cP,dotDivide:fP,dotMultiply:pP,dotPow:mP,exp:dP,expm:hP,expm1:gP,fix:vP,floor:yP,gcd:bP,hypot:xP,lcm:_P,log:SP,log2:EP,log1p:MP,log10:AP,mod:DP,multiply:NP,norm:TP,nthRoot:CP,nthRoots:FP,pow:IP,round:PP,sign:kP,sqrt:BP,sqrtm:OP,square:UP,subtract:qP,unaryMinus:zP,unaryPlus:$P,xgcd:HP,invmod:wP,bitAnd:GP,bitNot:WP,bitOr:YP,bitXor:jP,leftShift:ZP,rightArithShift:JP,rightLogShift:XP,bellNumbers:QP,catalan:KP,composition:ek,stirlingS2:tk,config:VI,import:UI,typed:qI,arg:rk,conj:nk,re:ak,im:ik,evaluate:ok,help:sk,distance:uk,intersect:lk,and:ck,not:fk,or:pk,xor:mk,concat:hk,count:gk,cross:vk,column:dk,ctranspose:yk,det:bk,diag:xk,diff:wk,dot:_k,getMatrixDataType:Dk,identity:Nk,filter:Ak,flatten:Mk,forEach:Ek,inv:Tk,pinv:Ck,eigs:Sk,kron:Fk,matrixFromFunction:kk,matrixFromRows:Bk,matrixFromColumns:Pk,map:Ik,ones:Ok,partitionSelect:Rk,range:Lk,resize:Uk,reshape:Vk,rotate:qk,rotationMatrix:zk,row:$k,size:Hk,sort:Gk,squeeze:Wk,subset:Yk,trace:jk,transpose:Zk,zeros:Jk,fft:Xk,ifft:Qk,sylvester:RP,schur:LP,lyap:VP,solveODE:OO,combinations:Kk,combinationsWithRep:eB,factorial:tB,gamma:rB,kldivergence:iB,lgamma:nB,multinomial:aB,permutations:oB,pickRandom:sB,random:uB,randomInt:lB,compare:cB,compareNatural:fB,compareText:pB,deepEqual:mB,equal:dB,equalText:hB,larger:gB,largerEq:vB,smaller:yB,smallerEq:bB,unequal:xB,setCartesian:wB,setDifference:_B,setDistinct:SB,setIntersect:AB,setIsSubset:MB,setMultiplicity:EB,setPowerset:DB,setSize:NB,setSymDifference:TB,setUnion:CB,zpk2tf:FB,freqz:IB,erf:PB,zeta:kB,cumsum:HB,mad:BB,max:OB,mean:RB,median:LB,min:VB,mode:UB,prod:qB,quantileSeq:zB,std:$B,sum:GB,variance:WB,corr:YB,acos:jB,acosh:ZB,acot:JB,acoth:XB,acsc:QB,acsch:KB,asec:eO,asech:tO,asin:rO,asinh:nO,atan:iO,atanh:oO,atan2:aO,cos:sO,cosh:uO,cot:lO,coth:cO,csc:fO,csch:pO,sec:mO,sech:dO,sin:hO,sinh:gO,tan:vO,tanh:yO,to:bO,clone:wO,format:_O,bin:xO,oct:PO,hex:AO,isNaN:EO,isInteger:MO,isNegative:DO,isNumeric:NO,hasNumericValue:SO,isPositive:TO,isPrime:CO,isZero:FO,print:kO,typeOf:BO,numeric:IO};var LO="help",iQ=["typed","mathWithTransform","Help"],rw=T(LO,iQ,n=>{var{typed:e,mathWithTransform:t,Help:r}=n;return e(LO,{any:function(a){var o,u=a;if(typeof a!="string"){for(o in t)if(ut(t,o)&&a===t[o]){u=o;break}}var s=$r(RO,u);if(!s){var l=typeof u=="function"?u.name:u;throw new Error('No documentation found on "'+l+'"')}return new r(s)}})});var VO="chain",aQ=["typed","Chain"],nw=T(VO,aQ,n=>{var{typed:e,Chain:t}=n;return e(VO,{"":function(){return new t},any:function(i){return new t(i)}})});var UO="det",oQ=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],iw=T(UO,oQ,n=>{var{typed:e,matrix:t,subtractScalar:r,multiply:i,divideScalar:a,isZero:o,unaryMinus:u}=n;return e(UO,{any:function(c){return vt(c)},"Array | Matrix":function(c){var f;switch(ot(c)?f=c.size():Array.isArray(c)?(c=t(c),f=c.size()):f=[],f.length){case 0:return vt(c);case 1:if(f[0]===1)return vt(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Mt(f)+")");case 2:{var p=f[0],m=f[1];if(p===m)return s(c.clone().valueOf(),p,m);if(m===0)return 1;throw new RangeError("Matrix must be square (size: "+Mt(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(f)+")")}}});function s(l,c,f){if(c===1)return vt(l[0][0]);if(c===2)return r(i(l[0][0],l[1][1]),i(l[1][0],l[0][1]));for(var p=!1,m=new Array(c).fill(0).map((D,E)=>E),h=0;h<c;h++){var d=m[h];if(o(l[d][h])){var v=void 0;for(v=h+1;v<c;v++)if(!o(l[m[v]][h])){d=m[v],m[v]=m[h],m[h]=d,p=!p;break}if(v===c)return l[d][h]}for(var y=l[d][h],S=h===0?1:l[m[h-1]][h-1],b=h+1;b<c;b++)for(var w=m[b],A=h+1;A<c;A++)l[w][A]=a(r(i(l[w][A],y),i(l[w][h],l[d][A])),S)}var x=l[m[c-1]][c-1];return p?u(x):x}});var qO="inv",sQ=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],aw=T(qO,sQ,n=>{var{typed:e,matrix:t,divideScalar:r,addScalar:i,multiply:a,unaryMinus:o,det:u,identity:s,abs:l}=n;return e(qO,{"Array | Matrix":function(p){var m=ot(p)?p.size():_t(p);switch(m.length){case 1:if(m[0]===1)return ot(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+Mt(m)+")");case 2:{var h=m[0],d=m[1];if(h===d)return ot(p)?t(c(p.valueOf(),h,d),p.storage()):c(p,h,d);throw new RangeError("Matrix must be square (size: "+Mt(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(m)+")")}},any:function(p){return r(1,p)}});function c(f,p,m){var h,d,v,y,S;if(p===1){if(y=f[0][0],y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,y)]]}else if(p===2){var b=u(f);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(f[1][1],b),r(o(f[0][1]),b)],[r(o(f[1][0]),b),r(f[0][0],b)]]}else{var w=f.concat();for(h=0;h<p;h++)w[h]=w[h].concat();for(var A=s(p).valueOf(),x=0;x<m;x++){var D=l(w[x][x]),E=x;for(h=x+1;h<p;)l(w[h][x])>D&&(D=l(w[h][x]),E=h),h++;if(D===0)throw Error("Cannot calculate inverse, determinant is zero");h=E,h!==x&&(S=w[x],w[x]=w[h],w[h]=S,S=A[x],A[x]=A[h],A[h]=S);var _=w[x],N=A[x];for(h=0;h<p;h++){var P=w[h],B=A[h];if(h!==x){if(P[x]!==0){for(v=r(o(P[x]),_[x]),d=x;d<m;d++)P[d]=i(P[d],a(v,_[d]));for(d=0;d<m;d++)B[d]=i(B[d],a(v,N[d]))}}else{for(v=_[x],d=x;d<m;d++)P[d]=r(P[d],v);for(d=0;d<m;d++)B[d]=r(B[d],v)}}}return A}}});var zO="pinv",uQ=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],ow=T(zO,uQ,n=>{var{typed:e,matrix:t,inv:r,deepEqual:i,equal:a,dotDivide:o,dot:u,ctranspose:s,divideScalar:l,multiply:c,add:f,Complex:p}=n;return e(zO,{"Array | Matrix":function(b){var w=ot(b)?b.size():_t(b);switch(w.length){case 1:return y(b)?s(b):w[0]===1?r(b):o(s(b),u(b,b));case 2:{if(y(b))return s(b);var A=w[0],x=w[1];if(A===x)try{return r(b)}catch(D){if(!(D instanceof Error&&D.message.match(/Cannot calculate inverse, determinant is zero/)))throw D}return ot(b)?t(m(b.valueOf(),A,x),b.storage()):m(b,A,x)}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(w)+")")}},any:function(b){return a(b,0)?vt(b):l(1,b)}});function m(S,b,w){var{C:A,F:x}=d(S,b,w),D=c(r(c(s(A),A)),s(A)),E=c(s(x),r(c(x,s(x))));return c(E,D)}function h(S,b,w){for(var A=vt(S),x=0,D=0;D<b;D++){if(w<=x)return A;for(var E=D;v(A[E][x]);)if(E++,b===E&&(E=D,x++,w===x))return A;[A[E],A[D]]=[A[D],A[E]];for(var _=A[D][x],N=0;N<w;N++)A[D][N]=o(A[D][N],_);for(var P=0;P<b;P++)if(P!==D){_=A[P][x];for(var B=0;B<w;B++)A[P][B]=f(A[P][B],c(-1,c(_,A[D][B])))}x++}return A}function d(S,b,w){var A=h(S,b,w),x=S.map((E,_)=>E.filter((N,P)=>P<b&&!v(u(A[P],A[P])))),D=A.filter((E,_)=>!v(u(A[_],A[_])));return{C:x,F:D}}function v(S){return a(f(S,p(1,1)),f(0,p(1,1)))}function y(S){return i(f(S,p(1,1)),f(c(S,0),p(1,1)))}});function $O(n){var{addScalar:e,subtract:t,flatten:r,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:u,abs:s,bignumber:l,diag:c,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:v,equal:y,complex:S,larger:b,smaller:w,matrixFromColumns:A,dot:x}=n;function D(Q,U,de,De){var me=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,_e=E(Q,U,de,De,me);_(Q,U,de,De,me,_e);var{values:Ne,C:Se}=N(Q,U,de,De,me);if(me){var Me=P(Q,U,Se,_e,Ne,de,De);return{values:Ne,eigenvectors:Me}}return{values:Ne}}function E(Q,U,de,De,me){var _e=De==="BigNumber",Ne=De==="Complex",Se=_e?l(0):0,Me=_e?l(1):Ne?S(1):1,Ee=_e?l(1):1,Ce=_e?l(10):2,Ge=a(Ce,Ce),We;me&&(We=Array(U).fill(Me));for(var te=!1;!te;){te=!0;for(var oe=0;oe<U;oe++){for(var ge=Se,ie=Se,re=0;re<U;re++)oe!==re&&(ge=e(ge,s(Q[re][oe])),ie=e(ie,s(Q[oe][re])));if(!y(ge,0)&&!y(ie,0)){for(var le=Ee,Te=ge,Ie=o(ie,Ce),Ze=a(ie,Ce);w(Te,Ie);)Te=a(Te,Ge),le=a(le,Ce);for(;b(Te,Ze);)Te=o(Te,Ge),le=o(le,Ce);var we=w(o(e(Te,ie),le),a(e(ge,ie),.95));if(we){te=!1;for(var ht=o(1,le),Nt=0;Nt<U;Nt++)oe!==Nt&&(Q[oe][Nt]=a(Q[oe][Nt],ht),Q[Nt][oe]=a(Q[Nt][oe],le));me&&(We[oe]=a(We[oe],ht))}}}}return me?c(We):null}function _(Q,U,de,De,me,_e){var Ne=De==="BigNumber",Se=De==="Complex",Me=Ne?l(0):Se?S(0):0;Ne&&(de=l(de));for(var Ee=0;Ee<U-2;Ee++){for(var Ce=0,Ge=Me,We=Ee+1;We<U;We++){var te=Q[We][Ee];w(s(Ge),s(te))&&(Ge=te,Ce=We)}if(!w(s(Ge),de)){if(Ce!==Ee+1){var oe=Q[Ce];Q[Ce]=Q[Ee+1],Q[Ee+1]=oe;for(var ge=0;ge<U;ge++){var ie=Q[ge][Ce];Q[ge][Ce]=Q[ge][Ee+1],Q[ge][Ee+1]=ie}if(me){var re=_e[Ce];_e[Ce]=_e[Ee+1],_e[Ee+1]=re}}for(var le=Ee+2;le<U;le++){var Te=o(Q[le][Ee],Ge);if(Te!==0){for(var Ie=0;Ie<U;Ie++)Q[le][Ie]=t(Q[le][Ie],a(Te,Q[Ee+1][Ie]));for(var Ze=0;Ze<U;Ze++)Q[Ze][Ee+1]=e(Q[Ze][Ee+1],a(Te,Q[Ze][le]));if(me)for(var we=0;we<U;we++)_e[le][we]=t(_e[le][we],a(Te,_e[Ee+1][we]))}}}}return _e}function N(Q,U,de,De,me){var _e=De==="BigNumber",Ne=De==="Complex",Se=_e?l(1):Ne?S(1):1;_e&&(de=l(de));for(var Me=vt(Q),Ee=[],Ce=U,Ge=[],We=me?c(Array(U).fill(Se)):void 0,te=me?c(Array(Ce).fill(Se)):void 0,oe=0;oe<=100;){oe+=1;for(var ge=Me[Ce-1][Ce-1],ie=0;ie<Ce;ie++)Me[ie][ie]=t(Me[ie][ie],ge);var{Q:re,R:le}=h(Me);Me=i(le,re);for(var Te=0;Te<Ce;Te++)Me[Te][Te]=e(Me[Te][Te],ge);if(me&&(te=i(te,re)),Ce===1||w(s(Me[Ce-1][Ce-2]),de)){oe=0,Ee.push(Me[Ce-1][Ce-1]),me&&(Ge.unshift([[1]]),z(te,U),We=i(We,te),Ce>1&&(te=c(Array(Ce-1).fill(Se)))),Ce-=1,Me.pop();for(var Ie=0;Ie<Ce;Ie++)Me[Ie].pop()}else if(Ce===2||w(s(Me[Ce-2][Ce-3]),de)){oe=0;var Ze=B(Me[Ce-2][Ce-2],Me[Ce-2][Ce-1],Me[Ce-1][Ce-2],Me[Ce-1][Ce-1]);Ee.push(...Ze),me&&(Ge.unshift(V(Me[Ce-2][Ce-2],Me[Ce-2][Ce-1],Me[Ce-1][Ce-2],Me[Ce-1][Ce-1],Ze[0],Ze[1],de,De)),z(te,U),We=i(We,te),Ce>2&&(te=c(Array(Ce-2).fill(Se)))),Ce-=2,Me.pop(),Me.pop();for(var we=0;we<Ce;we++)Me[we].pop(),Me[we].pop()}if(Ce===0)break}if(Ee.sort((Ht,Et)=>+t(s(Ht),s(Et))),oe>100){var ht=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+Ee.join(", "));throw ht.values=Ee,ht.vectors=[],ht}var Nt=me?i(We,L(Ge,U)):void 0;return{values:Ee,C:Nt}}function P(Q,U,de,De,me,_e,Ne){var Se=m(de),Me=i(Se,Q,de),Ee=Ne==="BigNumber",Ce=Ne==="Complex",Ge=Ee?l(0):Ce?S(0):0,We=Ee?l(1):Ce?S(1):1,te=[],oe=[];for(var ge of me){var ie=k(te,ge,y);ie===-1?(te.push(ge),oe.push(1)):oe[ie]+=1}for(var re=[],le=te.length,Te=Array(U).fill(Ge),Ie=c(Array(U).fill(We)),Ze=function(){var Nt=te[we],Ht=t(Me,i(Nt,Ie)),Et=v(Ht,Te);for(Et.shift();Et.length<oe[we];){var ae=C(Ht,U,Et,_e,Ne);if(ae===null)break;Et.push(ae)}var he=i(m(De),de);Et=Et.map(ve=>i(he,ve)),re.push(...Et.map(ve=>({value:Nt,vector:r(ve)})))},we=0;we<le;we++)Ze();return re}function B(Q,U,de,De){var me=e(Q,De),_e=t(a(Q,De),a(U,de)),Ne=a(me,.5),Se=a(u(t(a(me,me),a(4,_e))),.5);return[e(Ne,Se),t(Ne,Se)]}function V(Q,U,de,De,me,_e,Ne,Se){var Me=Se==="BigNumber",Ee=Se==="Complex",Ce=Me?l(0):Ee?S(0):0,Ge=Me?l(1):Ee?S(1):1;if(w(s(de),Ne))return[[Ge,Ce],[Ce,Ge]];if(b(s(t(me,_e)),Ne))return[[t(me,De),t(_e,De)],[de,de]];var We=t(Q,me),te=t(De,me);return w(s(U),Ne)&&w(s(te),Ne)?[[We,Ge],[de,Ce]]:[[U,Ce],[te,Ge]]}function z(Q,U){for(var de=0;de<Q.length;de++)Q[de].push(...Array(U-Q[de].length).fill(0));for(var De=Q.length;De<U;De++)Q.push(Array(U).fill(0)),Q[De][De]=1;return Q}function L(Q,U){for(var de=[],De=0;De<U;De++)de[De]=Array(U).fill(0);var me=0;for(var _e of Q){for(var Ne=_e.length,Se=0;Se<Ne;Se++)for(var Me=0;Me<Ne;Me++)de[me+Se][me+Me]=_e[Se][Me];me+=Ne}return de}function k(Q,U,de){for(var De=0;De<Q.length;De++)if(de(Q[De],U))return De;return-1}function C(Q,U,de,De,me){for(var _e=me==="BigNumber"?l(1e3):1e3,Ne,Se=0;Se<5;++Se){Ne=W(U,de,me);try{Ne=d(Q,Ne)}catch{continue}if(b(H(Ne),_e))break}if(Se>=5)return null;for(Se=0;;){var Me=d(Q,Ne);if(w(H(O(Ne,[Me])),De))break;if(++Se>=10)return null;Ne=Z(Me)}return Ne}function W(Q,U,de){var De=de==="BigNumber",me=de==="Complex",_e=Array(Q).fill(0).map(Ne=>2*Math.random()-1);return De&&(_e=_e.map(Ne=>l(Ne))),me&&(_e=_e.map(Ne=>S(Ne))),_e=O(_e,U),Z(_e,de)}function O(Q,U){var de=f(Q);for(var De of U)De=p(De,de),Q=t(Q,i(o(x(De,Q),x(De,De)),De));return Q}function H(Q){return s(u(x(Q,Q)))}function Z(Q,U){var de=U==="BigNumber",De=U==="Complex",me=de?l(1):De?S(1):1;return i(o(me,H(Q)),Q)}return D}function HO(n){var{config:e,addScalar:t,subtract:r,abs:i,atan:a,cos:o,sin:u,multiplyScalar:s,inv:l,bignumber:c,multiply:f,add:p}=n;function m(_,N){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,B=arguments.length>3?arguments[3]:void 0,V=arguments.length>4?arguments[4]:void 0;if(B==="number")return h(_,P,V);if(B==="BigNumber")return d(_,P,V);throw TypeError("Unsupported data type: "+B)}function h(_,N,P){var B=_.length,V=Math.abs(N/B),z,L;if(P){L=new Array(B);for(var k=0;k<B;k++)L[k]=Array(B).fill(0),L[k][k]=1}for(var C=x(_);Math.abs(C[1])>=Math.abs(V);){var W=C[0][0],O=C[0][1];z=v(_[W][W],_[O][O],_[W][O]),_=A(_,z,W,O),P&&(L=S(L,z,W,O)),C=x(_)}for(var H=Array(B).fill(0),Z=0;Z<B;Z++)H[Z]=_[Z][Z];return E(vt(H),L,P)}function d(_,N,P){var B=_.length,V=i(N/B),z,L;if(P){L=new Array(B);for(var k=0;k<B;k++)L[k]=Array(B).fill(0),L[k][k]=1}for(var C=D(_);i(C[1])>=i(V);){var W=C[0][0],O=C[0][1];z=y(_[W][W],_[O][O],_[W][O]),_=w(_,z,W,O),P&&(L=b(L,z,W,O)),C=D(_)}for(var H=Array(B).fill(0),Z=0;Z<B;Z++)H[Z]=_[Z][Z];return E(vt(H),L,P)}function v(_,N,P){var B=N-_;return Math.abs(B)<=e.epsilon?Math.PI/4:.5*Math.atan(2*P/(N-_))}function y(_,N,P){var B=r(N,_);return i(B)<=e.epsilon?c(-1).acos().div(4):s(.5,a(f(2,P,l(B))))}function S(_,N,P,B){for(var V=_.length,z=Math.cos(N),L=Math.sin(N),k=Array(V).fill(0),C=Array(V).fill(0),W=0;W<V;W++)k[W]=z*_[W][P]-L*_[W][B],C[W]=L*_[W][P]+z*_[W][B];for(var O=0;O<V;O++)_[O][P]=k[O],_[O][B]=C[O];return _}function b(_,N,P,B){for(var V=_.length,z=o(N),L=u(N),k=Array(V).fill(c(0)),C=Array(V).fill(c(0)),W=0;W<V;W++)k[W]=r(s(z,_[W][P]),s(L,_[W][B])),C[W]=t(s(L,_[W][P]),s(z,_[W][B]));for(var O=0;O<V;O++)_[O][P]=k[O],_[O][B]=C[O];return _}function w(_,N,P,B){for(var V=_.length,z=c(o(N)),L=c(u(N)),k=s(z,z),C=s(L,L),W=Array(V).fill(c(0)),O=Array(V).fill(c(0)),H=f(c(2),z,L,_[P][B]),Z=t(r(s(k,_[P][P]),H),s(C,_[B][B])),Q=p(s(C,_[P][P]),H,s(k,_[B][B])),U=0;U<V;U++)W[U]=r(s(z,_[P][U]),s(L,_[B][U])),O[U]=t(s(L,_[P][U]),s(z,_[B][U]));_[P][P]=Z,_[B][B]=Q,_[P][B]=c(0),_[B][P]=c(0);for(var de=0;de<V;de++)de!==P&&de!==B&&(_[P][de]=W[de],_[de][P]=W[de],_[B][de]=O[de],_[de][B]=O[de]);return _}function A(_,N,P,B){for(var V=_.length,z=Math.cos(N),L=Math.sin(N),k=z*z,C=L*L,W=Array(V).fill(0),O=Array(V).fill(0),H=k*_[P][P]-2*z*L*_[P][B]+C*_[B][B],Z=C*_[P][P]+2*z*L*_[P][B]+k*_[B][B],Q=0;Q<V;Q++)W[Q]=z*_[P][Q]-L*_[B][Q],O[Q]=L*_[P][Q]+z*_[B][Q];_[P][P]=H,_[B][B]=Z,_[P][B]=0,_[B][P]=0;for(var U=0;U<V;U++)U!==P&&U!==B&&(_[P][U]=W[U],_[U][P]=W[U],_[B][U]=O[U],_[U][B]=O[U]);return _}function x(_){for(var N=_.length,P=0,B=[0,1],V=0;V<N;V++)for(var z=V+1;z<N;z++)Math.abs(P)<Math.abs(_[V][z])&&(P=Math.abs(_[V][z]),B=[V,z]);return[B,P]}function D(_){for(var N=_.length,P=0,B=[0,1],V=0;V<N;V++)for(var z=V+1;z<N;z++)i(P)<i(_[V][z])&&(P=i(_[V][z]),B=[V,z]);return[B,P]}function E(_,N,P){var B=_.length,V=Array(B),z;if(P){z=Array(B);for(var L=0;L<B;L++)z[L]=Array(B)}for(var k=0;k<B;k++){for(var C=0,W=_[0],O=0;O<_.length;O++)i(_[O])<i(W)&&(C=O,W=_[C]);if(V[k]=_.splice(C,1)[0],P)for(var H=0;H<B;H++)z[k][H]=N[H][C],N[H].splice(C,1)}if(!P)return{values:V};var Z=z.map((Q,U)=>({value:V[U],vector:Q}));return{values:V,eigenvectors:Z}}return m}var lQ="eigs",cQ=["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"],sw=T(lQ,cQ,n=>{var{config:e,typed:t,matrix:r,addScalar:i,subtract:a,equal:o,abs:u,atan:s,cos:l,sin:c,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:d,add:v,larger:y,column:S,flatten:b,number:w,complex:A,sqrt:x,diag:D,size:E,reshape:_,qr:N,usolve:P,usolveAll:B,im:V,re:z,smaller:L,matrixFromColumns:k,dot:C}=n,W=HO({config:e,addScalar:i,subtract:a,column:S,flatten:b,equal:o,abs:u,atan:s,cos:l,sin:c,multiplyScalar:f,inv:m,bignumber:h,complex:A,multiply:d,add:v}),O=$O({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:b,divideScalar:p,sqrt:x,abs:u,bignumber:h,diag:D,size:E,reshape:_,qr:N,inv:m,usolve:P,usolveAll:B,equal:o,complex:A,larger:y,smaller:L,matrixFromColumns:k,dot:C});return t("eigs",{Array:function(_e){return H(r(_e))},"Array, number|BigNumber":function(_e,Ne){return H(r(_e),{precision:Ne})},"Array, Object"(me,_e){return H(r(me),_e)},Matrix:function(_e){return H(_e,{matricize:!0})},"Matrix, number|BigNumber":function(_e,Ne){return H(_e,{precision:Ne,matricize:!0})},"Matrix, Object":function(_e,Ne){var Se={matricize:!0};return zr(Se,Ne),H(_e,Se)}});function H(me){var _e,Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Se="eigenvectors"in Ne?Ne.eigenvectors:!0,Me=(_e=Ne.precision)!==null&&_e!==void 0?_e:e.epsilon,Ee=Z(me,Me,Se);return Ne.matricize&&(Ee.values=r(Ee.values),Se&&(Ee.eigenvectors=Ee.eigenvectors.map(Ce=>{var{value:Ge,vector:We}=Ce;return{value:Ge,vector:r(We)}}))),Se&&Object.defineProperty(Ee,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),Ee}function Z(me,_e,Ne){var Se=me.toArray(),Me=me.size();if(Me.length!==2||Me[0]!==Me[1])throw new RangeError("Matrix must be square (size: ".concat(Mt(Me),")"));var Ee=Me[0];if(U(Se,Ee,_e)&&(de(Se,Ee),Q(Se,Ee,_e))){var Ce=De(me,Se,Ee);return W(Se,Ee,_e,Ce,Ne)}var Ge=De(me,Se,Ee);return O(Se,Ee,_e,Ge,Ne)}function Q(me,_e,Ne){for(var Se=0;Se<_e;Se++)for(var Me=Se;Me<_e;Me++)if(y(h(u(a(me[Se][Me],me[Me][Se]))),Ne))return!1;return!0}function U(me,_e,Ne){for(var Se=0;Se<_e;Se++)for(var Me=0;Me<_e;Me++)if(y(h(u(V(me[Se][Me]))),Ne))return!1;return!0}function de(me,_e){for(var Ne=0;Ne<_e;Ne++)for(var Se=0;Se<_e;Se++)me[Ne][Se]=z(me[Ne][Se])}function De(me,_e,Ne){var Se=me.datatype();if(Se==="number"||Se==="BigNumber"||Se==="Complex")return Se;for(var Me=!1,Ee=!1,Ce=!1,Ge=0;Ge<Ne;Ge++)for(var We=0;We<Ne;We++){var te=_e[Ge][We];if(At(te)||_o(te))Me=!0;else if(pt(te))Ee=!0;else if(hi(te))Ce=!0;else throw TypeError("Unsupported type in Matrix: "+Kt(te))}if(Ee&&Ce&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),Ce){for(var oe=0;oe<Ne;oe++)for(var ge=0;ge<Ne;ge++)_e[oe][ge]=A(_e[oe][ge]);return"Complex"}if(Ee){for(var ie=0;ie<Ne;ie++)for(var re=0;re<Ne;re++)_e[ie][re]=h(_e[ie][re]);return"BigNumber"}if(Me){for(var le=0;le<Ne;le++)for(var Te=0;Te<Ne;Te++)_e[le][Te]=w(_e[le][Te]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var GO="expm",fQ=["typed","abs","add","identity","inv","multiply"],uw=T(GO,fQ,n=>{var{typed:e,abs:t,add:r,identity:i,inv:a,multiply:o}=n;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: "+Mt(p)+")");for(var m=p[0],h=1e-15,d=u(f),v=s(d,h),y=v.q,S=v.j,b=o(f,Math.pow(2,-S)),w=i(m),A=i(m),x=1,D=b,E=-1,_=1;_<=y;_++)_>1&&(D=o(D,b),E=-E),x=x*(y-_+1)/((2*y-_+1)*_),w=r(w,o(x,D)),A=r(A,o(x*E,D));for(var N=o(a(A),w),P=0;P<S;P++)N=o(N,N);return Na(f)?f.createSparseMatrix(N):N}});function u(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 s(c,f){for(var p=30,m=0;m<p;m++)for(var h=0;h<=m;h++){var d=m-h;if(l(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 l(c,f,p){for(var m=1,h=2;h<=f;h++)m*=h;for(var d=m,v=f+1;v<=2*f;v++)d*=v;var y=d*(2*f+1);return 8*Math.pow(c/Math.pow(2,p),2*f)*m*m/(d*y)}});var WO="sqrtm",pQ=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],lw=T(WO,pQ,n=>{var{typed:e,abs:t,add:r,multiply:i,map:a,sqrt:o,subtract:u,inv:s,size:l,max:c,identity:f}=n,p=1e3,m=1e-6;function h(d){var v,y=0,S=d,b=f(l(d));do{var w=S;if(S=i(.5,r(w,s(b))),b=i(.5,r(b,s(w))),v=c(t(u(S,w))),v>m&&++y>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(v>m);return S}return e(WO,{"Array | Matrix":function(v){var y=ot(v)?v.size():_t(v);switch(y.length){case 1:if(y[0]===1)return a(v,o);throw new RangeError("Matrix must be square (size: "+Mt(y)+")");case 2:{var S=y[0],b=y[1];if(S===b)return h(v);throw new RangeError("Matrix must be square (size: "+Mt(y)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Mt(y)+")")}}})});var YO="sylvester",mQ=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],cw=T(YO,mQ,n=>{var{typed:e,schur:t,matrixFromColumns:r,matrix:i,multiply:a,range:o,concat:u,transpose:s,index:l,subset:c,add:f,subtract:p,identity:m,lusolve:h,abs:d}=n;return e(YO,{"Matrix, Matrix, Matrix":v,"Array, Matrix, Matrix":function(S,b,w){return v(i(S),b,w)},"Array, Array, Matrix":function(S,b,w){return v(i(S),i(b),w)},"Array, Matrix, Array":function(S,b,w){return v(i(S),b,i(w))},"Matrix, Array, Matrix":function(S,b,w){return v(S,i(b),w)},"Matrix, Array, Array":function(S,b,w){return v(S,i(b),i(w))},"Matrix, Matrix, Array":function(S,b,w){return v(S,b,i(w))},"Array, Array, Array":function(S,b,w){return v(i(S),i(b),i(w)).toArray()}});function v(y,S,b){for(var w=S.size()[0],A=y.size()[0],x=t(y),D=x.T,E=x.U,_=t(a(-1,S)),N=_.T,P=_.U,B=a(a(s(E),b),P),V=o(0,A),z=[],L=(Ce,Ge)=>u(Ce,Ge,1),k=(Ce,Ge)=>u(Ce,Ge,0),C=0;C<w;C++)if(C<w-1&&d(c(N,l(C+1,C)))>1e-5){for(var W=k(c(B,l(V,C)),c(B,l(V,C+1))),O=0;O<C;O++)W=f(W,k(a(z[O],c(N,l(O,C))),a(z[O],c(N,l(O,C+1)))));var H=a(m(A),a(-1,c(N,l(C,C)))),Z=a(m(A),a(-1,c(N,l(C+1,C)))),Q=a(m(A),a(-1,c(N,l(C,C+1)))),U=a(m(A),a(-1,c(N,l(C+1,C+1)))),de=k(L(f(D,H),Z),L(Q,f(D,U))),De=h(de,W);z[C]=De.subset(l(o(0,A),0)),z[C+1]=De.subset(l(o(A,2*A),0)),C++}else{for(var me=c(B,l(V,C)),_e=0;_e<C;_e++)me=f(me,a(z[_e],c(N,l(_e,C))));var Ne=c(N,l(C,C)),Se=p(D,a(Ne,m(A)));z[C]=h(Se,me)}var Me=i(r(...z)),Ee=a(E,a(Me,s(P)));return Ee}});var jO="schur",dQ=["typed","matrix","identity","multiply","qr","norm","subtract"],fw=T(jO,dQ,n=>{var{typed:e,matrix:t,identity:r,multiply:i,qr:a,norm:o,subtract:u}=n;return e(jO,{Array:function(c){var f=s(t(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return s(c)}});function s(l){var c=l.size()[0],f=l,p=r(c),m=0,h;do{h=f;var d=a(f),v=d.Q,y=d.R;if(f=i(y,v),p=i(p,v),m++>100)break}while(o(u(f,h))>1e-4);return{U:p,T:f}}});var ZO="lyap",hQ=["typed","matrix","sylvester","multiply","transpose"],pw=T(ZO,hQ,n=>{var{typed:e,matrix:t,sylvester:r,multiply:i,transpose:a}=n;return e(ZO,{"Matrix, Matrix":function(u,s){return r(u,a(u),i(-1,s))},"Array, Matrix":function(u,s){return r(t(u),a(t(u)),i(-1,s))},"Matrix, Array":function(u,s){return r(u,a(t(u)),t(i(-1,s)))},"Array, Array":function(u,s){return r(t(u),a(t(u)),t(i(-1,s))).toArray()}})});var gQ="divide",vQ=["typed","matrix","multiply","equalScalar","divideScalar","inv"],mw=T(gQ,vQ,n=>{var{typed:e,matrix:t,multiply:r,equalScalar:i,divideScalar:a,inv:o}=n,u=xr({typed:e,equalScalar:i}),s=fn({typed:e});return e("divide",fm({"Array | Matrix, Array | Matrix":function(c,f){return r(c,o(f))},"DenseMatrix, any":function(c,f){return s(c,f,a,!1)},"SparseMatrix, any":function(c,f){return u(c,f,a,!1)},"Array, any":function(c,f){return s(t(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return r(c,o(f))}},a.signatures))});var JO="distance",yQ=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],dw=T(JO,yQ,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:u,abs:s}=n;return e(JO,{"Array, Array, Array":function(A,x,D){if(A.length===2&&x.length===2&&D.length===2){if(!c(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(x,D))throw new TypeError("LinePoint1 should not be same with LinePoint2");var E=r(D[1],x[1]),_=r(x[0],D[0]),N=r(i(D[0],x[1]),i(x[0],D[1]));return v(A[0],A[1],E,_,N)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(A,x,D){if(Object.keys(A).length===2&&Object.keys(x).length===2&&Object.keys(D).length===2){if(!c(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(D))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(x),h(D)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in A&&"pointY"in A&&"lineOnePtX"in x&&"lineOnePtY"in x&&"lineTwoPtX"in D&&"lineTwoPtY"in D){var E=r(D.lineTwoPtY,x.lineOnePtY),_=r(x.lineOnePtX,D.lineTwoPtX),N=r(i(D.lineTwoPtX,x.lineOnePtY),i(x.lineOnePtX,D.lineTwoPtY));return v(A.pointX,A.pointY,E,_,N)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(A,x){if(A.length===2&&x.length===3){if(!c(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return v(A[0],A[1],x[0],x[1],x[2])}else if(A.length===3&&x.length===6){if(!f(A))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(x))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(A[0],A[1],A[2],x[0],x[1],x[2],x[3],x[4],x[5])}else if(A.length===x.length&&A.length>0){if(!p(A))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(x))throw new TypeError("All values of an array should be numbers or BigNumbers");return S(A,x)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(A,x){if(Object.keys(A).length===2&&Object.keys(x).length===3){if(!c(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"xCoeffLine"in x&&"yCoeffLine"in x&&"constant"in x)return v(A.pointX,A.pointY,x.xCoeffLine,x.yCoeffLine,x.constant);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(x).length===6){if(!f(A))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(x))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"x0"in x&&"y0"in x&&"z0"in x&&"a"in x&&"b"in x&&"c"in x)return y(A.pointX,A.pointY,A.pointZ,x.x0,x.y0,x.z0,x.a,x.b,x.c);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===2&&Object.keys(x).length===2){if(!c(A))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointTwoX"in x&&"pointTwoY"in x)return S([A.pointOneX,A.pointOneY],[x.pointTwoX,x.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(x).length===3){if(!f(A))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointOneZ"in A&&"pointTwoX"in x&&"pointTwoY"in x&&"pointTwoZ"in x)return S([A.pointOneX,A.pointOneY,A.pointOneZ],[x.pointTwoX,x.pointTwoY,x.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(A){if(!d(A))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(A)}});function l(w){return typeof w=="number"||pt(w)}function c(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])}function f(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])&&l(w[2])}function p(w){return Array.isArray(w)||(w=h(w)),w.every(l)}function m(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])&&l(w[2])&&l(w[3])&&l(w[4])&&l(w[5])}function h(w){for(var A=Object.keys(w),x=[],D=0;D<A.length;D++)x.push(w[A[D]]);return x}function d(w){if(w[0].length===2&&l(w[0][0])&&l(w[0][1])){if(w.some(A=>A.length!==2||!l(A[0])||!l(A[1])))return!1}else if(w[0].length===3&&l(w[0][0])&&l(w[0][1])&&l(w[0][2])){if(w.some(A=>A.length!==3||!l(A[0])||!l(A[1])||!l(A[2])))return!1}else return!1;return!0}function v(w,A,x,D,E){var _=s(t(t(i(x,w),i(D,A)),E)),N=u(t(i(x,x),i(D,D)));return a(_,N)}function y(w,A,x,D,E,_,N,P,B){var V=[r(i(r(E,A),B),i(r(_,x),P)),r(i(r(_,x),N),i(r(D,w),B)),r(i(r(D,w),P),i(r(E,A),N))];V=u(t(t(i(V[0],V[0]),i(V[1],V[1])),i(V[2],V[2])));var z=u(t(t(i(N,N),i(P,P)),i(B,B)));return a(V,z)}function S(w,A){for(var x=w.length,D=0,E=0,_=0;_<x;_++)E=r(w[_],A[_]),D=t(i(E,E),D);return u(D)}function b(w){for(var A=[],x=[],D=[],E=0;E<w.length-1;E++)for(var _=E+1;_<w.length;_++)w[0].length===2?(x=[w[E][0],w[E][1]],D=[w[_][0],w[_][1]]):w[0].length===3&&(x=[w[E][0],w[E][1],w[E][2]],D=[w[_][0],w[_][1],w[_][2]]),A.push(S(x,D));return A}});var bQ="intersect",xQ=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],hw=T(bQ,xQ,n=>{var{typed:e,config:t,abs:r,add:i,addScalar:a,matrix:o,multiply:u,multiplyScalar:s,divideScalar:l,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=n;return e("intersect",{"Array, Array, Array":v,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(P,B,V){var z=v(P.valueOf(),B.valueOf(),V.valueOf());return z===null?null:o(z)},"Matrix, Matrix, Matrix, Matrix":function(P,B,V,z){var L=y(P.valueOf(),B.valueOf(),V.valueOf(),z.valueOf());return L===null?null:o(L)}});function v(N,P,B){if(N=S(N),P=S(P),B=S(B),!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(B))throw new TypeError("Array with 4 numbers expected as third argument");return _(N[0],N[1],N[2],P[0],P[1],P[2],B[0],B[1],B[2],B[3])}function y(N,P,B,V){if(N=S(N),P=S(P),B=S(B),V=S(V),N.length===2){if(!b(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(V))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return x(N,P,B,V)}else if(N.length===3){if(!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!w(V))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return E(N[0],N[1],N[2],P[0],P[1],P[2],B[0],B[1],B[2],V[0],V[1],V[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function S(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(P=>Array.isArray(P)&&P.length===1)?m(N):N}function b(N){return N.length===2&&d(N[0])&&d(N[1])}function w(N){return N.length===3&&d(N[0])&&d(N[1])&&d(N[2])}function A(N){return N.length===4&&d(N[0])&&d(N[1])&&d(N[2])&&d(N[3])}function x(N,P,B,V){var z=N,L=B,k=c(z,P),C=c(L,V),W=c(s(k[0],C[1]),s(C[0],k[1]));if(h(W)||f(r(W),t.epsilon))return null;var O=s(C[0],z[1]),H=s(C[1],z[0]),Z=s(C[0],L[1]),Q=s(C[1],L[0]),U=l(a(c(c(O,H),Z),Q),W);return i(u(k,U),z)}function D(N,P,B,V,z,L,k,C,W,O,H,Z){var Q=s(c(N,P),c(B,V)),U=s(c(z,L),c(k,C)),de=s(c(W,O),c(H,Z));return a(a(Q,U),de)}function E(N,P,B,V,z,L,k,C,W,O,H,Z){var Q=D(N,k,O,k,P,C,H,C,B,W,Z,W),U=D(O,k,V,N,H,C,z,P,Z,W,L,B),de=D(N,k,V,N,P,C,z,P,B,W,L,B),De=D(O,k,O,k,H,C,H,C,Z,W,Z,W),me=D(V,N,V,N,z,P,z,P,L,B,L,B),_e=c(s(Q,U),s(de,De)),Ne=c(s(me,De),s(U,U));if(h(Ne))return null;var Se=l(_e,Ne),Me=l(a(Q,s(Se,U)),De),Ee=a(N,s(Se,c(V,N))),Ce=a(P,s(Se,c(z,P))),Ge=a(B,s(Se,c(L,B))),We=a(k,s(Me,c(O,k))),te=a(C,s(Me,c(H,C))),oe=a(W,s(Me,c(Z,W)));return p(Ee,We)&&p(Ce,te)&&p(Ge,oe)?[Ee,Ce,Ge]:null}function _(N,P,B,V,z,L,k,C,W,O){var H=s(N,k),Z=s(V,k),Q=s(P,C),U=s(z,C),de=s(B,W),De=s(L,W),me=c(c(c(O,H),Q),de),_e=c(c(c(a(a(Z,U),De),H),Q),de),Ne=l(me,_e),Se=a(N,s(Ne,c(V,N))),Me=a(P,s(Ne,c(z,P))),Ee=a(B,s(Ne,c(L,B)));return[Se,Me,Ee]}});var XO="sum",wQ=["typed","config","add","numeric"],Yc=T(XO,wQ,n=>{var{typed:e,config:t,add:r,numeric:i}=n;return e(XO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(s){if(ua(s))throw new TypeError("Scalar values expected in function sum");return a(s)}});function a(u){var s;return ei(u,function(l){try{s=s===void 0?l:r(s,l)}catch(c){throw nn(c,"sum",l)}}),s===void 0&&(s=i(0,t.number)),typeof s=="string"&&(s=i(s,t.number)),s}function o(u,s){try{var l=cs(u,s,r);return l}catch(c){throw nn(c,"sum")}}});var hd="cumsum",_Q=["typed","add","unaryPlus"],jc=T(hd,_Q,n=>{var{typed:e,add:t,unaryPlus:r}=n;return e(hd,{Array:i,Matrix:function(l){return l.create(i(l.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(l,c){return l.create(o(l.valueOf(),c))},"...":function(l){if(ua(l))throw new TypeError("All values expected to be scalar in function cumsum");return i(l)}});function i(s){try{return a(s)}catch(l){throw nn(l,hd)}}function a(s){if(s.length===0)return[];for(var l=[r(s[0])],c=1;c<s.length;++c)l.push(t(l[c-1],s[c]));return l}function o(s,l){var c=_t(s);if(l<0||l>=c.length)throw new $n(l,c.length);try{return u(s,l)}catch(f){throw nn(f,hd)}}function u(s,l){var c,f,p;if(l<=0){var m=s[0][0];if(Array.isArray(m)){for(p=Tm(s),f=[],c=0;c<p.length;c++)f[c]=u(p[c],l-1);return f}else return a(s)}else{for(f=[],c=0;c<s.length;c++)f[c]=u(s[c],l-1);return f}}});var QO="mean",SQ=["typed","add","divide"],Zc=T(QO,SQ,n=>{var{typed:e,add:t,divide:r}=n;return e(QO,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(u){if(ua(u))throw new TypeError("Scalar values expected in function mean");return a(u)}});function i(o,u){try{var s=cs(o,u,t),l=Array.isArray(o)?_t(o):o.size();return r(s,l[u])}catch(c){throw nn(c,"mean")}}function a(o){var u,s=0;if(ei(o,function(l){try{u=u===void 0?l:t(u,l),s++}catch(c){throw nn(c,"mean",l)}}),s===0)throw new Error("Cannot calculate the mean of an empty array");return r(u,s)}});var KO="median",AQ=["typed","add","divide","compare","partitionSelect"],gw=T(KO,AQ,n=>{var{typed:e,add:t,divide:r,compare:i,partitionSelect:a}=n;function o(l){try{l=kt(l.valueOf());var c=l.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(l,f+1),m=l[f],h=0;h<f;++h)i(l[h],m)>0&&(m=l[h]);return s(m,p)}else{var d=a(l,(c-1)/2);return u(d)}}catch(v){throw nn(v,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(c){return c}}),s=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return r(t(c,f),2)}});return e(KO,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(ua(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var eR="mad",MQ=["typed","abs","map","median","subtract"],vw=T(eR,MQ,n=>{var{typed:e,abs:t,map:r,median:i,subtract:a}=n;return e(eR,{"Array | Matrix":o,"...":function(s){return o(s)}});function o(u){if(u=kt(u.valueOf()),u.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var s=i(u);return i(r(u,function(l){return t(a(l,s))}))}catch(l){throw l instanceof TypeError&&l.message.indexOf("median")!==-1?new TypeError(l.message.replace("median","mad")):nn(l,"mad")}}});var yw="unbiased",tR="variance",EQ=["typed","add","subtract","multiply","divide","apply","isNaN"],Jc=T(tR,EQ,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u}=n;return e(tR,{"Array | Matrix":function(f){return s(f,yw)},"Array | Matrix, string":s,"Array | Matrix, number | BigNumber":function(f,p){return l(f,p,yw)},"Array | Matrix, number | BigNumber, string":l,"...":function(f){return s(f,yw)}});function s(c,f){var p,m=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ei(c,function(v){try{p=p===void 0?v:t(p,v),m++}catch(y){throw nn(y,"variance",v)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var h=a(p,m);if(p=void 0,ei(c,function(v){var y=r(v,h);p=p===void 0?i(y,y):t(p,i(y,y))}),u(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var d=pt(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 l(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=>s(m,p))}catch(m){throw nn(m,"variance")}}});var rR="quantileSeq",DQ=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Xc=T(rR,DQ,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p}=n,m=ru({typed:e,isInteger:l});return e(rR,{"Array | Matrix, number | BigNumber":(S,b)=>d(S,b,!1),"Array | Matrix, number | BigNumber, number":(S,b,w)=>h(S,b,!1,w,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(S,b,w,A)=>h(S,b,w,A,d),"Array | Matrix, Array | Matrix":(S,b)=>v(S,b,!1),"Array | Matrix, Array | Matrix, number":(S,b,w)=>h(S,b,!1,w,v),"Array | Matrix, Array | Matrix, boolean":v,"Array | Matrix, Array | Matrix, boolean, number":(S,b,w,A)=>h(S,b,w,A,v)});function h(S,b,w,A,x){return m(S,A,D=>x(D,b,w))}function d(S,b,w){var A,x=S.valueOf();if(c(b,0))throw new Error("N/prob must be non-negative");if(f(b,1))return At(b)?y(x,b,w):t(y(x,b,w));if(p(b,1)){if(!l(b))throw new Error("N must be a positive integer");if(p(b,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 D=r(b,1);A=[];for(var E=0;c(E,b);E++){var _=a(E+1,D);A.push(y(x,_,w))}return At(b)?A:t(A)}}function v(S,b,w){for(var A=S.valueOf(),x=b.valueOf(),D=[],E=0;E<x.length;++E)D.push(y(A,x[E],w));return D}function y(S,b,w){var A=kt(S),x=A.length;if(x===0)throw new Error("Cannot calculate quantile of an empty sequence");var D=At(b)?b*(x-1):b.times(x-1),E=At(b)?Math.floor(D):D.floor().toNumber(),_=At(b)?D%1:D.minus(E);if(l(D))return w?A[D]:u(A,At(b)?D:D.valueOf());var N,P;if(w)N=A[E],P=A[E+1];else{P=u(A,E+1),N=A[E];for(var B=0;B<E;++B)s(A[B],N)>0&&(N=A[B])}return r(o(N,i(1,_)),o(P,_))}});var nR="std",NQ=["typed","map","sqrt","variance"],Qc=T(nR,NQ,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n;return e(nR,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(u){return a(u)}});function a(o,u){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var s=i.apply(null,arguments);return un(s)?t(s,r):r(s)}catch(l){throw l instanceof TypeError&&l.message.indexOf(" variance")!==-1?new TypeError(l.message.replace(" variance"," std")):l}}});var iR="corr",TQ=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],bw=T(iR,TQ,n=>{var{typed:e,matrix:t,sqrt:r,sum:i,add:a,subtract:o,multiply:u,pow:s,divide:l}=n;return e(iR,{"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),v=i(m),y=p.reduce((x,D,E)=>a(x,u(D,m[E])),0),S=i(p.map(x=>s(x,2))),b=i(m.map(x=>s(x,2))),w=o(u(h,y),u(d,v)),A=r(u(o(u(h,S),s(d,2)),o(u(h,b),s(v,2))));return l(w,A)}});var aR="combinations",CQ=["typed"],xw=T(aR,CQ,n=>{var{typed:e}=n;return e(aR,{"number, number":Ry,"BigNumber, BigNumber":function(r,i){var a=r.constructor,o,u,s=r.minus(i),l=new a(1);if(!oR(r)||!oR(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(r))throw new TypeError("k must be less than n in function combinations");if(o=l,i.lt(s))for(u=l;u.lte(s);u=u.plus(l))o=o.times(i.plus(u)).dividedBy(u);else for(u=l;u.lte(i);u=u.plus(l))o=o.times(s.plus(u)).dividedBy(u);return o}})});function oR(n){return n.isInteger()&&n.gte(0)}var sR="combinationsWithRep",FQ=["typed"],ww=T(sR,FQ,n=>{var{typed:e}=n;return e(sR,{"number, number":function(r,i){if(!nt(r)||r<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!nt(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(r<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<r-1){var a=$i(r,r+i-1);return a/$i(1,i)}var o=$i(i+1,r+i-1);return o/$i(1,r-1)},"BigNumber, BigNumber":function(r,i){var a=r.constructor,o,u,s=new a(1),l=r.minus(s);if(!uR(r)||!uR(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(r.lt(s))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=s,i.lt(l))for(u=s;u.lte(l);u=u.plus(s))o=o.times(i.plus(u)).dividedBy(u);else for(u=s;u.lte(i);u=u.plus(s))o=o.times(l.plus(u)).dividedBy(u);return o}})});function uR(n){return n.isInteger()&&n.gte(0)}var lR="gamma",IQ=["typed","config","multiplyScalar","pow","BigNumber","Complex"],_w=T(lR,IQ,n=>{var{typed:e,config:t,multiplyScalar:r,pow:i,BigNumber:a,Complex:o}=n;function u(l){if(l.im===0)return Ec(l.re);if(l.re<.5){var c=new o(1-l.re,-l.im),f=new o(Math.PI*l.re,Math.PI*l.im);return new o(Math.PI).div(f.sin()).div(u(c))}l=new o(l.re-1,l.im);for(var p=new o(tu[0],0),m=1;m<tu.length;++m){var h=new o(tu[m],0);p=p.add(h.div(l.add(m)))}var d=new o(l.re+$y+.5,l.im),v=Math.sqrt(2*Math.PI),y=d.pow(l.add(.5)),S=d.neg().exp();return p.mul(v).mul(y).mul(S)}return e(lR,{number:Ec,Complex:u,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):s(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(l){if(l<8)return new a([1,1,2,6,24,120,720,5040][l]);var c=t.precision+(Math.log(l.toNumber())|0),f=a.clone({precision:c});if(l%2===1)return l.times(s(new a(l-1)));for(var p=l,m=new f(l),h=l.toNumber();p>2;)p-=2,h+=p,m=m.times(h);return new a(m.toPrecision(a.precision))}});var cR="lgamma",PQ=["Complex","typed"],Sw=T(cR,PQ,n=>{var{Complex:e,typed:t}=n,r=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(cR,{number:Dc,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(l){var c=6.283185307179586,f=1.1447298858494002,p=.1;if(l.isNaN())return new e(NaN,NaN);if(l.im===0)return new e(Dc(l.re),0);if(l.re>=r||Math.abs(l.im)>=i)return u(l);if(l.re<=p){var m=qN(c,l.im)*Math.floor(.5*l.re+.25),h=l.mul(Math.PI).sin().log(),d=o(new e(1-l.re,-l.im));return new e(f,m).sub(h).sub(d)}else return l.im>=0?s(l):s(l.conjugate()).conjugate()}function u(l){for(var c=l.sub(.5).mul(l.log()).sub(l).add(Hy),f=new e(1,0).div(l),p=f.div(l),m=a[0],h=a[1],d=2*p.re,v=p.re*p.re+p.im*p.im,y=2;y<8;y++){var S=h;h=-v*m+a[y],m=d*m+S}var b=f.mul(p.mul(m).add(h));return c.add(b)}function s(l){var c=0,f=0,p=l;for(l=l.add(1);l.re<=r;){p=p.mul(l);var m=p.im<0?1:0;m!==0&&f===0&&c++,f=m,l=l.add(1)}return u(l).sub(p.log()).sub(new e(0,c*2*Math.PI*1))}});var fR="factorial",kQ=["typed","gamma"],Aw=T(fR,kQ,n=>{var{typed:e,gamma:t}=n;return e(fR,{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(r=>i=>lt(i,r))})});var pR="kldivergence",BQ=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],Mw=T(pR,BQ,n=>{var{typed:e,matrix:t,divide:r,sum:i,multiply:a,map:o,dotDivide:u,log:s,isNumeric:l}=n;return e(pR,{"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 v=i(p);if(v===0)throw new Error("Sum of elements in second object must be non zero");var y=r(f,i(f)),S=r(p,i(p)),b=i(a(y,o(u(y,S),w=>s(w))));return l(b)?b:Number.NaN}});var mR="multinomial",OQ=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Ew=T(mR,OQ,n=>{var{typed:e,add:t,divide:r,multiply:i,factorial:a,isInteger:o,isPositive:u}=n;return e(mR,{"Array | Matrix":function(l){var c=0,f=1;return ei(l,function(p){if(!o(p)||!u(p))throw new TypeError("Positive integer value expected in function multinomial");c=t(c,p),f=i(f,a(p))}),r(a(c),f)}})});var dR="permutations",RQ=["typed","factorial"],Dw=T(dR,RQ,n=>{var{typed:e,factorial:t}=n;return e(dR,{"number | BigNumber":t,"number, number":function(i,a){if(!nt(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!nt(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 $i(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,u;if(!hR(i)||!hR(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 s=i.mul(0).add(1);for(o=s,u=i.minus(a).plus(1);u.lte(i);u=u.plus(1))o=o.times(u);return o}})});function hR(n){return n.isInteger()&&n.gte(0)}var kw=wr(FR(),1),HQ=(0,kw.default)(Date.now());function To(n){var e;function t(i){e=i===null?HQ:(0,kw.default)(String(i))}t(n);function r(){return e()}return r}var IR="pickRandom",GQ=["typed","config","?on"],Bw=T(IR,GQ,n=>{var{typed:e,config:t,on:r}=n,i=To(t.randomSeed);return r&&r("config",function(o,u){o.randomSeed!==u.randomSeed&&(i=To(o.randomSeed))}),e(IR,{"Array | Matrix":function(u){return a(u,{})},"Array | Matrix, Object":function(u,s){return a(u,s)},"Array | Matrix, number":function(u,s){return a(u,{number:s})},"Array | Matrix, Array | Matrix":function(u,s){return a(u,{weights:s})},"Array | Matrix, Array | Matrix, number":function(u,s,l){return a(u,{number:l,weights:s})},"Array | Matrix, number, Array | Matrix":function(u,s,l){return a(u,{number:s,weights:l})}});function a(o,u){var{number:s,weights:l,elementWise:c=!0}=u,f=typeof s>"u";f&&(s=1);var p=ot(o)?o.create:ot(l)?l.create:null;o=o.valueOf(),l&&(l=l.valueOf()),c===!0&&(o=kt(o),l=kt(l));var m=0;if(typeof l<"u"){if(l.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,d=l.length;h<d;h++){if(!At(l[h])||l[h]<0)throw new Error("Weights must be an array of positive numbers");m+=l[h]}}for(var v=o.length,y=[],S;y.length<s;){if(typeof l>"u")S=o[Math.floor(i()*v)];else for(var b=i()*m,w=0,A=o.length;w<A;w++)if(b-=l[w],b<0){S=o[w];break}y.push(S)}return f?y[0]:p?p(y):y}});function Kc(n,e){var t=[];if(n=n.slice(0),n.length>1)for(var r=0,i=n.shift();r<i;r++)t.push(Kc(n,e));else for(var a=0,o=n.shift();a<o;a++)t.push(e());return t}var PR="random",WQ=["typed","config","?on"],Ow=T(PR,WQ,n=>{var{typed:e,config:t,on:r}=n,i=To(t.randomSeed);return r&&r("config",function(u,s){u.randomSeed!==s.randomSeed&&(i=To(u.randomSeed))}),e(PR,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,s)=>o(u,s),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,s)=>a(u,0,s),"Array | Matrix, number, number":(u,s,l)=>a(u,s,l)});function a(u,s,l){var c=Kc(u.valueOf(),()=>o(s,l));return ot(u)?u.create(c):c}function o(u,s){return u+i()*(s-u)}});var kR="randomInt",YQ=["typed","config","?on"],Rw=T(kR,YQ,n=>{var{typed:e,config:t,on:r}=n,i=To(t.randomSeed);return r&&r("config",function(u,s){u.randomSeed!==s.randomSeed&&(i=To(u.randomSeed))}),e(kR,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,s)=>o(u,s),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,s)=>a(u,0,s),"Array | Matrix, number, number":(u,s,l)=>a(u,s,l)});function a(u,s,l){var c=Kc(u.valueOf(),()=>o(s,l));return ot(u)?u.create(c):c}function o(u,s){return Math.floor(u+i()*(s-u))}});var BR="stirlingS2",jQ=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],Lw=T(BR,jQ,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,pow:o,factorial:u,combinations:s,isNegative:l,isInteger:c,number:f,bignumber:p,larger:m}=n,h=[],d=[];return e(BR,{"number | BigNumber, number | BigNumber":function(y,S){if(!c(y)||l(y)||!c(S)||l(S))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(S,y))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(At(y)&&At(S)),w=b?d:h,A=b?p:f,x=f(y),D=f(S);if(w[x]&&w[x].length>D)return w[x][D];for(var E=0;E<=x;++E)if(w[E]||(w[E]=[A(E===0?1:0)]),E!==0)for(var _=w[E],N=w[E-1],P=_.length;P<=E&&P<=D;++P)P===E?_[P]=1:_[P]=t(i(A(P),N[P]),N[P-1]);return w[x][D]}})});var OR="bellNumbers",ZQ=["typed","addScalar","isNegative","isInteger","stirlingS2"],Vw=T(OR,ZQ,n=>{var{typed:e,addScalar:t,isNegative:r,isInteger:i,stirlingS2:a}=n;return e(OR,{"number | BigNumber":function(u){if(!i(u)||r(u))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var s=0,l=0;l<=u;l++)s=t(s,a(u,l));return s}})});var RR="catalan",JQ=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Uw=T(RR,JQ,n=>{var{typed:e,addScalar:t,divideScalar:r,multiplyScalar:i,combinations:a,isNegative:o,isInteger:u}=n;return e(RR,{"number | BigNumber":function(l){if(!u(l)||o(l))throw new TypeError("Non-negative integer value expected in function catalan");return r(a(i(l,2),l),t(l,1))}})});var LR="composition",XQ=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],qw=T(LR,XQ,n=>{var{typed:e,addScalar:t,combinations:r,isPositive:i,isNegative:a,isInteger:o,larger:u}=n;return e(LR,{"number | BigNumber, number | BigNumber":function(l,c){if(!o(l)||!i(l)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(u(c,l))throw new TypeError("k must be less than or equal to n in function composition");return r(t(l,-1),t(c,-1))}})});var VR="leafCount",QQ=["parse","typed"],zw=T(VR,QQ,n=>{var{parse:e,typed:t}=n;function r(i){var a=0;return i.forEach(o=>{a+=r(o)}),a||1}return t(VR,{Node:function(a){return r(a)}})});function $w(n){return zt(n)||Vr(n)&&n.isUnary()&&zt(n.args[0])}function ef(n){return!!(zt(n)||(gi(n)||Vr(n))&&n.args.every(ef)||zn(n)&&ef(n.content))}function UR(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Hw(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?UR(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):UR(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var KQ="simplifyUtil",eK=["FunctionNode","OperatorNode","SymbolNode"],wl=T(KQ,eK,n=>{var{FunctionNode:e,OperatorNode:t,SymbolNode:r}=n,i=!0,a=!1,o="defaultF",u={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}},s={divide:{total:a},log:{total:a}},l={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(b,w){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,x=o;if(typeof b=="string"?x=b:Vr(b)?x=b.fn.toString():gi(b)?x=b.name:zn(b)&&(x="paren"),ut(A,x)){var D=A[x];if(ut(D,w))return D[w];if(ut(u,x))return u[x][w]}if(ut(A,o)){var E=A[o];return ut(E,w)?E[w]:u[o][w]}if(ut(u,x)){var _=u[x];if(ut(_,w))return _[w]}return u[o][w]}function f(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return c(b,"commutative",w)}function p(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return c(b,"associative",w)}function m(b,w){var A=Hw({},b);for(var x in w)ut(b,x)?A[x]=Hw(Hw({},w[x]),b[x]):A[x]=w[x];return A}function h(b,w){if(!b.args||b.args.length===0)return b;b.args=d(b,w);for(var A=0;A<b.args.length;A++)h(b.args[A],w)}function d(b,w){var A,x=[],D=function E(_){for(var N=0;N<_.args.length;N++){var P=_.args[N];Vr(P)&&A===P.op?E(P):x.push(P)}};return p(b,w)?(A=b.op,D(b),x):b.args}function v(b,w){if(!(!b.args||b.args.length===0)){for(var A=S(b),x=b.args.length,D=0;D<x;D++)v(b.args[D],w);if(x>2&&p(b,w)){for(var E=b.args.pop();b.args.length>0;)E=A([b.args.pop(),E]);b.args=E.args}}}function y(b,w){if(!(!b.args||b.args.length===0)){for(var A=S(b),x=b.args.length,D=0;D<x;D++)y(b.args[D],w);if(x>2&&p(b,w)){for(var E=b.args.shift();b.args.length>0;)E=A([E,b.args.shift()]);b.args=E.args}}}function S(b){return Vr(b)?function(w){try{return new t(b.op,b.fn,w,b.implicit)}catch(A){return console.error(A),[]}}:function(w){return new e(new r(b.name),w)}}return{createMakeNodeFunction:S,hasProperty:c,isCommutative:f,isAssociative:p,mergeContext:m,flatten:h,allChildren:d,unflattenr:v,unflattenl:y,defaultContext:u,realContext:s,positiveContext:l}});var tK="simplify",rK=["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"],Gw=T(tK,rK,n=>{var{config:e,typed:t,parse:r,add:i,subtract:a,multiply:o,divide:u,pow:s,isZero:l,equal:c,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:h,bignumber:d,mathWithTransform:v,matrix:y,AccessorNode:S,ArrayNode:b,ConstantNode:w,FunctionNode:A,IndexNode:x,ObjectNode:D,OperatorNode:E,ParenthesisNode:_,SymbolNode:N}=n,{hasProperty:P,isCommutative:B,isAssociative:V,mergeContext:z,flatten:L,unflattenr:k,unflattenl:C,createMakeNodeFunction:W,defaultContext:O,realContext:H,positiveContext:Z}=wl({FunctionNode:A,OperatorNode:E,SymbolNode:N});t.addConversion({from:"Object",to:"Map",convert:Ao});var Q=t("simplify",{Node:Se,"Node, Map":(ie,re)=>Se(ie,!1,re),"Node, Map, Object":(ie,re,le)=>Se(ie,!1,re,le),"Node, Array":Se,"Node, Array, Map":Se,"Node, Array, Map, Object":Se});t.removeConversion({from:"Object",to:"Map",convert:Ao}),Q.defaultContext=O,Q.realContext=H,Q.positiveContext=Z;function U(ie){return ie.transform(function(re,le,Te){return zn(re)?U(re.content):re})}var de={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};Q.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 De(ie,re){var le={};if(ie.s){var Te=ie.s.split("->");if(Te.length===2)le.l=Te[0],le.r=Te[1];else throw SyntaxError("Could not parse rule: "+ie.s)}else le.l=ie.l,le.r=ie.r;le.l=U(r(le.l)),le.r=U(r(le.r));for(var Ie of["imposeContext","repeat","assuming"])Ie in ie&&(le[Ie]=ie[Ie]);if(ie.evaluate&&(le.evaluate=r(ie.evaluate)),V(le.l,re)){var Ze=!B(le.l,re),we;Ze&&(we=Ne());var ht=W(le.l),Nt=Ne();le.expanded={},le.expanded.l=ht([le.l,Nt]),L(le.expanded.l,re),k(le.expanded.l,re),le.expanded.r=ht([le.r,Nt]),Ze&&(le.expandedNC1={},le.expandedNC1.l=ht([we,le.l]),le.expandedNC1.r=ht([we,le.r]),le.expandedNC2={},le.expandedNC2.l=ht([we,le.expanded.l]),le.expandedNC2.r=ht([we,le.expanded.r]))}return le}function me(ie,re){for(var le=[],Te=0;Te<ie.length;Te++){var Ie=ie[Te],Ze=void 0,we=typeof Ie;switch(we){case"string":Ie={s:Ie};case"object":Ze=De(Ie,re);break;case"function":Ze=Ie;break;default:throw TypeError("Unsupported type of rule: "+we)}le.push(Ze)}return le}var _e=0;function Ne(){return new N("_p"+_e++)}function Se(ie,re){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:as(),Te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ie=Te.consoleDebug;re=me(re||Q.rules,Te.context);var Ze=f(ie,le);Ze=U(Ze);for(var we={},ht=Ze.toString({parenthesis:"all"});!we[ht];){we[ht]=!0,_e=0;var Nt=ht;Ie&&console.log("Working on: ",ht);for(var Ht=0;Ht<re.length;Ht++){var Et="";if(typeof re[Ht]=="function"?(Ze=re[Ht](Ze,Te),Ie&&(Et=re[Ht].name)):(L(Ze,Te.context),Ze=Ee(Ze,re[Ht],Te.context),Ie&&(Et="".concat(re[Ht].l.toString()," -> ").concat(re[Ht].r.toString()))),Ie){var ae=Ze.toString({parenthesis:"all"});ae!==Nt&&(console.log("Applying",Et,"produced",ae),Nt=ae)}C(Ze,Te.context)}ht=Ze.toString({parenthesis:"all"})}return Ze}function Me(ie,re,le){var Te=ie;if(ie)for(var Ie=0;Ie<ie.length;++Ie){var Ze=Ee(ie[Ie],re,le);Ze!==ie[Ie]&&(Te===ie&&(Te=ie.slice()),Te[Ie]=Ze)}return Te}function Ee(ie,re,le){if(re.assuming){for(var Te in re.assuming)for(var Ie in re.assuming[Te])if(P(Te,Ie,le)!==re.assuming[Te][Ie])return ie}var Ze=z(re.imposeContext,le),we=ie;if(we instanceof E||we instanceof A){var ht=Me(we.args,re,le);ht!==we.args&&(we=we.clone(),we.args=ht)}else if(we instanceof _){if(we.content){var Nt=Ee(we.content,re,le);Nt!==we.content&&(we=new _(Nt))}}else if(we instanceof b){var Ht=Me(we.items,re,le);Ht!==we.items&&(we=new b(Ht))}else if(we instanceof S){var Et=we.object;we.object&&(Et=Ee(we.object,re,le));var ae=we.index;we.index&&(ae=Ee(we.index,re,le)),(Et!==we.object||ae!==we.index)&&(we=new S(Et,ae))}else if(we instanceof x){var he=Me(we.dimensions,re,le);he!==we.dimensions&&(we=new x(he))}else if(we instanceof D){var ve=!1,qe={};for(var $e in we.properties)qe[$e]=Ee(we.properties[$e],re,le),qe[$e]!==we.properties[$e]&&(ve=!0);ve&&(we=new D(qe))}var Re=re.r,ze=oe(re.l,we,Ze)[0];if(!ze&&re.expanded&&(Re=re.expanded.r,ze=oe(re.expanded.l,we,Ze)[0]),!ze&&re.expandedNC1&&(Re=re.expandedNC1.r,ze=oe(re.expandedNC1.l,we,Ze)[0],ze||(Re=re.expandedNC2.r,ze=oe(re.expandedNC2.l,we,Ze)[0])),ze){var Xe=we.implicit;we=Re.clone(),Xe&&"implicit"in Re&&(we.implicit=!0),we=we.transform(function(F){return F.isSymbolNode&&ut(ze.placeholders,F.name)?ze.placeholders[F.name].clone():F})}return re.repeat&&we!==ie&&(we=Ee(we,re,le)),we}function Ce(ie,re){var le=[],Te,Ie,Ze=W(ie);if(B(ie,re))for(var we=0;we<ie.args.length;we++)Ie=ie.args.slice(0),Ie.splice(we,1),Te=Ie.length===1?Ie[0]:Ze(Ie),le.push(Ze([ie.args[we],Te]));else for(var ht=1;ht<ie.args.length;ht++){var Nt=ie.args[0];ht>1&&(Nt=Ze(ie.args.slice(0,ht))),Ie=ie.args.slice(ht),Te=Ie.length===1?Ie[0]:Ze(Ie),le.push(Ze([Nt,Te]))}return le}function Ge(ie,re){var le={placeholders:{}};if(!ie.placeholders&&!re.placeholders)return le;if(ie.placeholders){if(!re.placeholders)return ie}else return re;for(var Te in ie.placeholders)if(ut(ie.placeholders,Te)&&(le.placeholders[Te]=ie.placeholders[Te],ut(re.placeholders,Te)&&!ge(ie.placeholders[Te],re.placeholders[Te])))return null;for(var Ie in re.placeholders)ut(re.placeholders,Ie)&&(le.placeholders[Ie]=re.placeholders[Ie]);return le}function We(ie,re){var le=[];if(ie.length===0||re.length===0)return le;for(var Te,Ie=0;Ie<ie.length;Ie++)for(var Ze=0;Ze<re.length;Ze++)Te=Ge(ie[Ie],re[Ze]),Te&&le.push(Te);return le}function te(ie){if(ie.length===0)return ie;for(var re=ie.reduce(We),le=[],Te={},Ie=0;Ie<re.length;Ie++){var Ze=JSON.stringify(re[Ie]);Te[Ze]||(Te[Ze]=!0,le.push(re[Ie]))}return le}function oe(ie,re,le,Te){var Ie=[{placeholders:{}}];if(ie instanceof E&&re instanceof E||ie instanceof A&&re instanceof A){if(ie instanceof E){if(ie.op!==re.op||ie.fn!==re.fn)return[]}else if(ie instanceof A&&ie.name!==re.name)return[];if(re.args.length===1&&ie.args.length===1||!V(re,le)&&re.args.length===ie.args.length||Te){for(var Ze=[],we=0;we<ie.args.length;we++){var ht=oe(ie.args[we],re.args[we],le);if(ht.length===0)break;Ze.push(ht)}if(Ze.length!==ie.args.length){if(!B(re,le)||ie.args.length===1)return[];if(ie.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Nt=oe(ie.args[0],re.args[1],le);if(Nt.length===0)return[];var Ht=oe(ie.args[1],re.args[0],le);if(Ht.length===0)return[];Ze=[Nt,Ht]}Ie=te(Ze)}else if(re.args.length>=2&&ie.args.length===2){for(var Et=Ce(re,le),ae=[],he=0;he<Et.length;he++){var ve=oe(ie,Et[he],le,!0);ae=ae.concat(ve)}return ae}else{if(ie.args.length>2)throw Error("Unexpected non-binary associative function: "+ie.toString());return[]}}else if(ie instanceof N){if(ie.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(de[ie.name]){if(ie.name!==re.name)return[]}else switch(ie.name[1]>="a"&&ie.name[1]<="z"?ie.name.substring(0,2):ie.name[0]){case"n":case"_p":Ie[0].placeholders[ie.name]=re;break;case"c":case"cl":if(zt(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"v":if(!zt(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"vl":if(Fr(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"cd":if($w(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"vd":if(!$w(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"ce":if(ef(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"ve":if(!ef(re))Ie[0].placeholders[ie.name]=re;else return[];break;default:throw new Error("Invalid symbol in rule: "+ie.name)}}else if(ie instanceof w){if(!c(ie.value,re.value))return[]}else return[];return Ie}function ge(ie,re){if(ie instanceof w&&re instanceof w){if(!c(ie.value,re.value))return!1}else if(ie instanceof N&&re instanceof N){if(ie.name!==re.name)return!1}else if(ie instanceof E&&re instanceof E||ie instanceof A&&re instanceof A){if(ie instanceof E){if(ie.op!==re.op||ie.fn!==re.fn)return!1}else if(ie instanceof A&&ie.name!==re.name)return!1;if(ie.args.length!==re.args.length)return!1;for(var le=0;le<ie.args.length;le++)if(!ge(ie.args[le],re.args[le]))return!1}else return!1;return!0}return Q});var nK="simplifyConstant",iK=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],Ww=T(nK,iK,n=>{var{typed:e,config:t,mathWithTransform:r,matrix:i,fraction:a,bignumber:o,AccessorNode:u,ArrayNode:s,ConstantNode:l,FunctionNode:c,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=n,{isCommutative:d,isAssociative:v,allChildren:y,createMakeNodeFunction:S}=wl({FunctionNode:c,OperatorNode:m,SymbolNode:h}),b=e("simplifyConstant",{Node:L=>D(z(L,{})),"Node, Object":function(k,C){return D(z(k,C))}});function w(L){return _o(L)?L.valueOf():L instanceof Array?L.map(w):ot(L)?i(w(L.valueOf())):L}function A(L,k,C){try{return r[L].apply(null,k)}catch{return k=k.map(w),_(r[L].apply(null,k),C)}}var x=e({Fraction:P,number:function(k){return k<0?N(new l(-k)):new l(k)},BigNumber:function(k){return k<0?N(new l(-k)):new l(k)},Complex:function(k){throw new Error("Cannot convert Complex number to Node")},string:function(k){return new l(k)},Matrix:function(k){return new s(k.valueOf().map(C=>x(C)))}});function D(L){return jt(L)?L:x(L)}function E(L,k){var C=k&&k.exactFractions!==!1;if(C&&isFinite(L)&&a){var W=a(L),O=k&&typeof k.fractionsLimit=="number"?k.fractionsLimit:1/0;if(W.valueOf()===L&&W.n<O&&W.d<O)return W}return L}var _=e({"string, Object":function(k,C){if(t.number==="BigNumber")return o===void 0&&hl(),o(k);if(t.number==="Fraction")return a===void 0&&Om(),a(k);var W=parseFloat(k);return E(W,C)},"Fraction, Object":function(k,C){return k},"BigNumber, Object":function(k,C){return k},"number, Object":function(k,C){return E(k,C)},"Complex, Object":function(k,C){return k.im!==0?k:E(k.re,C)},"Matrix, Object":function(k,C){return i(E(k.valueOf()))},"Array, Object":function(k,C){return k.map(E)}});function N(L){return new m("-","unaryMinus",[L])}function P(L){var k,C=L.s*L.n;return C<0?k=new m("-","unaryMinus",[new l(-C)]):k=new l(C),L.d===1?k:new m("/","divide",[k,new l(L.d)])}function B(L,k,C){if(!oa(k))return new u(D(L),D(k));if(qn(L)||ot(L)){for(var W=Array.from(k.dimensions);W.length>0;)if(zt(W[0])&&typeof W[0].value!="string"){var O=_(W.shift().value,C);qn(L)?L=L.items[O-1]:(L=L.valueOf()[O-1],L instanceof Array&&(L=i(L)))}else if(W.length>1&&zt(W[1])&&typeof W[1].value!="string"){var H=_(W[1].value,C),Z=[],Q=qn(L)?L.items:L.valueOf();for(var U of Q)if(qn(U))Z.push(U.items[H-1]);else if(ot(L))Z.push(U[H-1]);else break;if(Z.length===Q.length)qn(L)?L=new s(Z):L=i(Z),W.splice(1,1);else break}else break;return W.length===k.dimensions.length?new u(D(L),k):W.length>0?(k=new f(W),new u(D(L),k)):L}if(rs(L)&&k.dimensions.length===1&&zt(k.dimensions[0])){var de=k.dimensions[0].value;return de in L.properties?L.properties[de]:new l}return new u(D(L),k)}function V(L,k,C,W){var O=k.shift(),H=k.reduce((Z,Q)=>{if(!jt(Q)){var U=Z.pop();if(jt(U))return[U,Q];try{return Z.push(A(L,[U,Q],W)),Z}catch{Z.push(U)}}Z.push(D(Z.pop()));var de=Z.length===1?Z[0]:C(Z);return[C([de,D(Q)])]},[O]);return H.length===1?H[0]:C([H[0],x(H[1])])}function z(L,k){switch(L.type){case"SymbolNode":return L;case"ConstantNode":switch(typeof L.value){case"number":return _(L.value,k);case"string":return L.value;default:if(!isNaN(L.value))return _(L.value,k)}return L;case"FunctionNode":if(r[L.name]&&r[L.name].rawArgs)return L;{var C=["add","multiply"];if(C.indexOf(L.name)===-1){var W=L.args.map(Ee=>z(Ee,k));if(!W.some(jt))try{return A(L.name,W,k)}catch{}if(L.name==="size"&&W.length===1&&qn(W[0])){for(var O=[],H=W[0];qn(H);)O.push(H.items.length),H=H.items[0];return i(O)}return new c(L.name,W.map(D))}}case"OperatorNode":{var Z=L.fn.toString(),Q,U,de=S(L);if(Vr(L)&&L.isUnary())Q=[z(L.args[0],k)],jt(Q[0])?U=de(Q):U=A(Z,Q,k);else if(v(L,k.context))if(Q=y(L,k.context),Q=Q.map(Ee=>z(Ee,k)),d(Z,k.context)){for(var De=[],me=[],_e=0;_e<Q.length;_e++)jt(Q[_e])?me.push(Q[_e]):De.push(Q[_e]);De.length>1?(U=V(Z,De,de,k),me.unshift(U),U=V(Z,me,de,k)):U=V(Z,Q,de,k)}else U=V(Z,Q,de,k);else Q=L.args.map(Ee=>z(Ee,k)),U=V(Z,Q,de,k);return U}case"ParenthesisNode":return z(L.content,k);case"AccessorNode":return B(z(L.object,k),z(L.index,k),k);case"ArrayNode":{var Ne=L.items.map(Ee=>z(Ee,k));return Ne.some(jt)?new s(Ne.map(D)):i(Ne)}case"IndexNode":return new f(L.dimensions.map(Ee=>b(Ee,k)));case"ObjectNode":{var Se={};for(var Me in L.properties)Se[Me]=b(L.properties[Me],k);return new p(Se)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(L.type))}}return b});var qR="simplifyCore",aK=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Yw=T(qR,aK,n=>{var{typed:e,parse:t,equal:r,isZero:i,add:a,subtract:o,multiply:u,divide:s,pow:l,AccessorNode:c,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:v,ParenthesisNode:y,SymbolNode:S}=n,b=new p(0),w=new p(1),A=new p(!0),x=new p(!1);function D(P){return Vr(P)&&["and","not","or"].includes(P.op)}var{hasProperty:E,isCommutative:_}=wl({FunctionNode:m,OperatorNode:v,SymbolNode:S});function N(P){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=B?B.context:void 0;if(E(P,"trivial",V)){if(gi(P)&&P.args.length===1)return N(P.args[0],B);var z=!1,L=0;if(P.forEach(me=>{++L,L===1&&(z=N(me,B))}),L===1)return z}var k=P;if(gi(k)){var C=VF(k.name);if(C){if(k.args.length>2&&E(k,"associative",V))for(;k.args.length>2;){var W=k.args.pop(),O=k.args.pop();k.args.push(new v(C,k.name,[W,O]))}k=new v(C,k.name,k.args)}else return new m(N(k.fn),k.args.map(me=>N(me,B)))}if(Vr(k)&&k.isUnary()){var H=N(k.args[0],B);if(k.op==="~"&&Vr(H)&&H.isUnary()&&H.op==="~"||k.op==="not"&&Vr(H)&&H.isUnary()&&H.op==="not"&&D(H.args[0]))return H.args[0];var Z=!0;if(k.op==="-"&&Vr(H)&&(H.isBinary()&&H.fn==="subtract"&&(k=new v("-","subtract",[H.args[1],H.args[0]]),Z=!1),H.isUnary()&&H.op==="-"))return H.args[0];if(Z)return new v(k.op,k.fn,[H])}if(Vr(k)&&k.isBinary()){var Q=N(k.args[0],B),U=N(k.args[1],B);if(k.op==="+"){if(zt(Q)&&i(Q.value))return U;if(zt(U)&&i(U.value))return Q;Vr(U)&&U.isUnary()&&U.op==="-"&&(U=U.args[0],k=new v("-","subtract",[Q,U]))}if(k.op==="-")return Vr(U)&&U.isUnary()&&U.op==="-"?N(new v("+","add",[Q,U.args[0]]),B):zt(Q)&&i(Q.value)?N(new v("-","unaryMinus",[U])):zt(U)&&i(U.value)?Q:new v(k.op,k.fn,[Q,U]);if(k.op==="*"){if(zt(Q)){if(i(Q.value))return b;if(r(Q.value,1))return U}if(zt(U)){if(i(U.value))return b;if(r(U.value,1))return Q;if(_(k,V))return new v(k.op,k.fn,[U,Q],k.implicit)}return new v(k.op,k.fn,[Q,U],k.implicit)}if(k.op==="/")return zt(Q)&&i(Q.value)?b:zt(U)&&r(U.value,1)?Q:new v(k.op,k.fn,[Q,U]);if(k.op==="^"&&zt(U)){if(i(U.value))return w;if(r(U.value,1))return Q}if(k.op==="and"){if(zt(Q))if(Q.value){if(D(U))return U;if(zt(U))return U.value?A:x}else return x;if(zt(U))if(U.value){if(D(Q))return Q}else return x}if(k.op==="or"){if(zt(Q)){if(Q.value)return A;if(D(U))return U}if(zt(U)){if(U.value)return A;if(D(Q))return Q}}return new v(k.op,k.fn,[Q,U])}if(Vr(k))return new v(k.op,k.fn,k.args.map(me=>N(me,B)));if(qn(k))return new f(k.items.map(me=>N(me,B)));if(zi(k))return new c(N(k.object,B),N(k.index,B));if(oa(k))return new h(k.dimensions.map(me=>N(me,B)));if(rs(k)){var de={};for(var De in k.properties)de[De]=N(k.properties[De],B);return new d(de)}return k}return e(qR,{Node:N,"Node,Object":N})});var oK="resolve",sK=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],jw=T(oK,sK,n=>{var{typed:e,parse:t,ConstantNode:r,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=n;function u(s,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!l)return s;if(Fr(s)){if(c.has(s.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var p=l.get(s.name);if(jt(p)){var m=new Set(c);return m.add(s.name),u(p,l,m)}else return typeof p=="number"?t(String(p)):p!==void 0?new r(p):s}else if(Vr(s)){var h=s.args.map(function(v){return u(v,l,c)});return new a(s.op,s.fn,h,s.implicit)}else{if(zn(s))return new o(u(s.content,l,c));if(gi(s)){var d=s.args.map(function(v){return u(v,l,c)});return new i(s.name,d)}}return s.map(v=>u(v,l,c))}return e("resolve",{Node:u,"Node, Map | null | undefined":u,"Node, Object":(s,l)=>u(s,Ao(l)),"Array | Matrix":e.referToSelf(s=>l=>l.map(c=>s(c))),"Array | Matrix, null | undefined":e.referToSelf(s=>l=>l.map(c=>s(c))),"Array, Object":e.referTo("Array,Map",s=>(l,c)=>s(l,Ao(c))),"Matrix, Object":e.referTo("Matrix,Map",s=>(l,c)=>s(l,Ao(c))),"Array | Matrix, Map":e.referToSelf(s=>(l,c)=>l.map(f=>s(f,c)))})});var zR="symbolicEqual",uK=["parse","simplify","typed","OperatorNode"],Zw=T(zR,uK,n=>{var{parse:e,simplify:t,typed:r,OperatorNode:i}=n;function a(o,u){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=new i("-","subtract",[o,u]),c=t(l,{},s);return zt(c)&&!c.value}return r(zR,{"Node, Node":a,"Node, Node, Object":a})});var $R="derivative",lK=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Jw=T($R,lK,n=>{var{typed:e,config:t,parse:r,simplify:i,equal:a,isZero:o,numeric:u,ConstantNode:s,FunctionNode:l,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=n;function m(b,w){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},x={};v(x,b,w.name);var D=y(b,x);return A.simplify?i(D):D}e.addConversion({from:"identifier",to:"SymbolNode",convert:r});var h=e($R,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});e.removeConversion({from:"identifier",to:"SymbolNode",convert:r}),h._simplify=!0,h.toTex=function(b){return d.apply(null,b.args)};var d=e("_derivTex",{"Node, SymbolNode":function(w,A){return zt(w)&&Kt(w.value)==="string"?d(r(w.value).toString(),A.toString(),1):d(w.toTex(),A.toString(),1)},"Node, ConstantNode":function(w,A){if(Kt(A.value)==="string")return d(w,r(A.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,A,x){return d(w.toString(),A.name,x.value)},"string, string, number":function(w,A,x){var D;return x===1?D="{d\\over d"+A+"}":D="{d^{"+x+"}\\over d"+A+"^{"+x+"}}",D+"\\left[".concat(w,"\\right]")}}),v=e("constTag",{"Object, ConstantNode, string":function(w,A){return w[A]=!0,!0},"Object, SymbolNode, string":function(w,A,x){return A.name!==x?(w[A]=!0,!0):!1},"Object, ParenthesisNode, string":function(w,A,x){return v(w,A.content,x)},"Object, FunctionAssignmentNode, string":function(w,A,x){return A.params.indexOf(x)===-1?(w[A]=!0,!0):v(w,A.expr,x)},"Object, FunctionNode | OperatorNode, string":function(w,A,x){if(A.args.length>0){for(var D=v(w,A.args[0],x),E=1;E<A.args.length;++E)D=v(w,A.args[E],x)&&D;if(D)return w[A]=!0,!0}return!1}}),y=e("_derivative",{"ConstantNode, Object":function(w){return S(0)},"SymbolNode, Object":function(w,A){return A[w]!==void 0?S(0):S(1)},"ParenthesisNode, Object":function(w,A){return new f(y(w.content,A))},"FunctionAssignmentNode, Object":function(w,A){return A[w]!==void 0?S(0):y(w.expr,A)},"FunctionNode, Object":function(w,A){if(A[w]!==void 0)return S(0);var x=w.args[0],D,E=!1,_=!1,N;switch(w.name){case"cbrt":E=!0,N=new c("*","multiply",[S(3),new c("^","pow",[x,new c("/","divide",[S(2),S(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)E=!0,N=new c("*","multiply",[S(2),new l("sqrt",[x])]);else if(w.args.length===2)return D=new c("/","divide",[S(1),w.args[1]]),A[D]=A[w.args[1]],y(new c("^","pow",[x,D]),A);break;case"log10":D=S(10);case"log":if(!D&&w.args.length===1)N=x.clone(),E=!0;else if(w.args.length===1&&D||w.args.length===2&&A[w.args[1]]!==void 0)N=new c("*","multiply",[x.clone(),new l("log",[D||w.args[1]])]),E=!0;else if(w.args.length===2)return y(new c("/","divide",[new l("log",[x]),new l("log",[w.args[1]])]),A);break;case"pow":if(w.args.length===2)return A[D]=A[w.args[1]],y(new c("^","pow",[x,w.args[1]]),A);break;case"exp":N=new l("exp",[x.clone()]);break;case"sin":N=new l("cos",[x.clone()]);break;case"cos":N=new c("-","unaryMinus",[new l("sin",[x.clone()])]);break;case"tan":N=new c("^","pow",[new l("sec",[x.clone()]),S(2)]);break;case"sec":N=new c("*","multiply",[w,new l("tan",[x.clone()])]);break;case"csc":_=!0,N=new c("*","multiply",[w,new l("cot",[x.clone()])]);break;case"cot":_=!0,N=new c("^","pow",[new l("csc",[x.clone()]),S(2)]);break;case"asin":E=!0,N=new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])]);break;case"acos":E=!0,_=!0,N=new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])]);break;case"atan":E=!0,N=new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)]);break;case"asec":E=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acsc":E=!0,_=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acot":E=!0,_=!0,N=new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)]);break;case"sinh":N=new l("cosh",[x.clone()]);break;case"cosh":N=new l("sinh",[x.clone()]);break;case"tanh":N=new c("^","pow",[new l("sech",[x.clone()]),S(2)]);break;case"sech":_=!0,N=new c("*","multiply",[w,new l("tanh",[x.clone()])]);break;case"csch":_=!0,N=new c("*","multiply",[w,new l("coth",[x.clone()])]);break;case"coth":_=!0,N=new c("^","pow",[new l("csch",[x.clone()]),S(2)]);break;case"asinh":E=!0,N=new l("sqrt",[new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)])]);break;case"acosh":E=!0,N=new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])]);break;case"atanh":E=!0,N=new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])]);break;case"asech":E=!0,_=!0,N=new c("*","multiply",[x.clone(),new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])])]);break;case"acsch":E=!0,_=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acoth":E=!0,_=!0,N=new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])]);break;case"abs":N=new c("/","divide",[new l(new p("abs"),[x.clone()]),x.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+w.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var P,B;E?(P="/",B="divide"):(P="*",B="multiply");var V=y(x,A);return _&&(V=new c("-","unaryMinus",[V])),new c(P,B,[V,N])},"OperatorNode, Object":function(w,A){if(A[w]!==void 0)return S(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(L){return y(L,A)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[y(w.args[0],A)]);if(w.isBinary())return new c(w.op,w.fn,[y(w.args[0],A),y(w.args[1],A)])}if(w.op==="*"){var x=w.args.filter(function(L){return A[L]!==void 0});if(x.length>0){var D=w.args.filter(function(L){return A[L]===void 0}),E=D.length===1?D[0]:new c("*","multiply",D),_=x.concat(y(E,A));return new c("*","multiply",_)}return new c("+","add",w.args.map(function(L){return new c("*","multiply",w.args.map(function(k){return k===L?y(k,A):k.clone()}))}))}if(w.op==="/"&&w.isBinary()){var N=w.args[0],P=w.args[1];return A[P]!==void 0?new c("/","divide",[y(N,A),P]):A[N]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[N]),new c("/","divide",[y(P,A),new c("^","pow",[P.clone(),S(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(N,A),P.clone()]),new c("*","multiply",[N.clone(),y(P,A)])]),new c("^","pow",[P.clone(),S(2)])])}if(w.op==="^"&&w.isBinary()){var B=w.args[0],V=w.args[1];if(A[B]!==void 0)return zt(B)&&(o(B.value)||a(B.value,1))?S(0):new c("*","multiply",[w,new c("*","multiply",[new l("log",[B.clone()]),y(V.clone(),A)])]);if(A[V]!==void 0){if(zt(V)){if(o(V.value))return S(0);if(a(V.value,1))return y(B,A)}var z=new c("^","pow",[B.clone(),new c("-","subtract",[V,S(1)])]);return new c("*","multiply",[V.clone(),new c("*","multiply",[y(B,A),z])])}return new c("*","multiply",[new c("^","pow",[B.clone(),V.clone()]),new c("+","add",[new c("*","multiply",[y(B,A),new c("/","divide",[V.clone(),B.clone()])]),new c("*","multiply",[y(V,A),new l("log",[B.clone()])])])])}throw new Error('Cannot process operator "'+w.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function S(b,w){return new s(u(b,w||t.number))}return h});var HR="rationalize",cK=["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"],Xw=T(HR,cK,n=>{var{config:e,typed:t,equal:r,isZero:i,add:a,subtract:o,multiply:u,divide:s,pow:l,parse:c,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:v,matrix:y,AccessorNode:S,ArrayNode:b,ConstantNode:w,FunctionNode:A,IndexNode:x,ObjectNode:D,OperatorNode:E,SymbolNode:_,ParenthesisNode:N}=n;function P(k){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=V(),H=B(k,C,!0,O.firstRules),Z=H.variables.length,Q={exactFractions:!1},U={exactFractions:!0};if(k=H.expression,Z>=1){k=z(k);var de,De,me=!0,_e=!1;k=m(k,O.firstRules,{},Q);for(var Ne;De=me?O.distrDivRules:O.sucDivRules,k=m(k,De,{},U),me=!me,Ne=k.toString(),Ne!==de;)_e=!0,de=Ne;_e&&(k=m(k,O.firstRulesAgain,{},Q)),k=m(k,O.finalRules,{},Q)}var Se=[],Me={};return k.type==="OperatorNode"&&k.isBinary()&&k.op==="/"?(Z===1&&(k.args[0]=L(k.args[0],Se),k.args[1]=L(k.args[1])),W&&(Me.numerator=k.args[0],Me.denominator=k.args[1])):(Z===1&&(k=L(k,Se)),W&&(Me.numerator=k,Me.denominator=null)),W?(Me.coefficients=Se,Me.variables=H.variables,Me.expression=k,Me):k}return t(HR,{Node:P,"Node, boolean":(k,C)=>P(k,{},C),"Node, Object":P,"Node, Object, boolean":P});function B(k,C,W,O){var H=[],Z=m(k,O,C,{exactFractions:!1});W=!!W;var Q="+-*"+(W?"/":"");de(Z);var U={};return U.expression=Z,U.variables=H,U;function de(De){var me=De.type;if(me==="FunctionNode")throw new Error("There is an unsolved function call");if(me==="OperatorNode")if(De.op==="^"){if(De.args[1].type!=="ConstantNode"||!nt(parseFloat(De.args[1].value)))throw new Error("There is a non-integer exponent");de(De.args[0])}else{if(Q.indexOf(De.op)===-1)throw new Error("Operator "+De.op+" invalid in polynomial expression");for(var _e=0;_e<De.args.length;_e++)de(De.args[_e])}else if(me==="SymbolNode"){var Ne=De.name,Se=H.indexOf(Ne);Se===-1&&H.push(Ne)}else if(me==="ParenthesisNode")de(De.content);else if(me!=="ConstantNode")throw new Error("type "+me+" is not allowed in polynomial expression")}}function V(){var k=[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"}],C=[{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)"}],W=[{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)"}],O=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],H={};return H.firstRules=k.concat(C,O),H.distrDivRules=W,H.sucDivRules=O,H.firstRulesAgain=k.concat(C),H.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))"}],H}function z(k,C,W){var O=k.type,H=arguments.length>1;if(O==="OperatorNode"&&k.isBinary()){var Z=!1,Q;if(k.op==="^"&&(k.args[0].type==="ParenthesisNode"||k.args[0].type==="OperatorNode")&&k.args[1].type==="ConstantNode"&&(Q=parseFloat(k.args[1].value),Z=Q>=2&&nt(Q)),Z){if(Q>2){var U=k.args[0],de=new E("^","pow",[k.args[0].cloneDeep(),new w(Q-1)]);k=new E("*","multiply",[U,de])}else k=new E("*","multiply",[k.args[0],k.args[0].cloneDeep()]);H&&(W==="content"?C.content=k:C.args[W]=k)}}if(O==="ParenthesisNode")z(k.content,k,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var De=0;De<k.args.length;De++)z(k.args[De],k,De);if(!H)return k}function L(k,C){C===void 0&&(C=[]),C[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,H="";Ne(k,null,W),O=C.length-1;for(var Z=!0,Q,U=O;U>=0;U--)if(C[U]!==0){var de=new w(Z?C[U]:Math.abs(C[U])),De=C[U]<0?"-":"+";if(U>0){var me=new _(H);if(U>1){var _e=new w(U);me=new E("^","pow",[me,_e])}C[U]===-1&&Z?de=new E("-","unaryMinus",[me]):Math.abs(C[U])===1?de=me:de=new E("*","multiply",[de,me])}Z?Q=de:De==="+"?Q=new E("+","add",[Q,de]):Q=new E("-","subtract",[Q,de]),Z=!1}if(Z)return new w(0);return Q;function Ne(Se,Me,Ee){var Ce=Se.type;if(Ce==="FunctionNode")throw new Error("There is an unsolved function call");if(Ce==="OperatorNode"){if("+-*^".indexOf(Se.op)===-1)throw new Error("Operator "+Se.op+" invalid");if(Me!==null){if((Se.fn==="unaryMinus"||Se.fn==="pow")&&Me.fn!=="add"&&Me.fn!=="subtract"&&Me.fn!=="multiply")throw new Error("Invalid "+Se.op+" placing");if((Se.fn==="subtract"||Se.fn==="add"||Se.fn==="multiply")&&Me.fn!=="add"&&Me.fn!=="subtract")throw new Error("Invalid "+Se.op+" placing");if((Se.fn==="subtract"||Se.fn==="add"||Se.fn==="unaryMinus")&&Ee.noFil!==0)throw new Error("Invalid "+Se.op+" placing")}(Se.op==="^"||Se.op==="*")&&(Ee.fire=Se.op);for(var Ge=0;Ge<Se.args.length;Ge++)Se.fn==="unaryMinus"&&(Ee.oper="-"),(Se.op==="+"||Se.fn==="subtract")&&(Ee.fire="",Ee.cte=1,Ee.oper=Ge===0?"+":Se.op),Ee.noFil=Ge,Ne(Se.args[Ge],Se,Ee)}else if(Ce==="SymbolNode"){if(Se.name!==H&&H!=="")throw new Error("There is more than one variable");if(H=Se.name,Me===null){C[1]=1;return}if(Me.op==="^"&&Ee.noFil!==0)throw new Error("In power the variable should be the first parameter");if(Me.op==="*"&&Ee.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(Ee.fire===""||Ee.fire==="*")&&(O<1&&(C[1]=0),C[1]+=Ee.cte*(Ee.oper==="+"?1:-1),O=Math.max(1,O))}else if(Ce==="ConstantNode"){var We=parseFloat(Se.value);if(Me===null){C[0]=We;return}if(Me.op==="^"){if(Ee.noFil!==1)throw new Error("Constant cannot be powered");if(!nt(We)||We<=0)throw new Error("Non-integer exponent is not allowed");for(var te=O+1;te<We;te++)C[te]=0;We>O&&(C[We]=0),C[We]+=Ee.cte*(Ee.oper==="+"?1:-1),O=Math.max(We,O);return}Ee.cte=We,Ee.fire===""&&(C[0]+=Ee.cte*(Ee.oper==="+"?1:-1))}else throw new Error("Type "+Ce+" is not allowed")}}});var GR="zpk2tf",fK=["typed","add","multiply","Complex","number"],Qw=T(GR,fK,n=>{var{typed:e,add:t,multiply:r,Complex:i,number:a}=n;return e(GR,{"Array,Array,number":function(l,c,f){return o(l,c,f)},"Array,Array":function(l,c){return o(l,c,1)},"Matrix,Matrix,number":function(l,c,f){return o(l.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(l,c){return o(l.valueOf(),c.valueOf(),1)}});function o(s,l,c){s.some(S=>S.type==="BigNumber")&&(s=s.map(S=>a(S))),l.some(S=>S.type==="BigNumber")&&(l=l.map(S=>a(S)));for(var f=[i(1,0)],p=[i(1,0)],m=0;m<s.length;m++){var h=s[m];typeof h=="number"&&(h=i(h,0)),f=u(f,[i(1,0),i(-h.re,-h.im)])}for(var d=0;d<l.length;d++){var v=l[d];typeof v=="number"&&(v=i(v,0)),p=u(p,[i(1,0),i(-v.re,-v.im)])}for(var y=0;y<f.length;y++)f[y]=r(f[y],c);return[f,p]}function u(s,l){for(var c=[],f=0;f<s.length+l.length-1;f++){c[f]=i(0,0);for(var p=0;p<s.length;p++)f-p>=0&&f-p<l.length&&(c[f]=t(c[f],r(s[p],l[f-p])))}return c}});var WR="freqz",pK=["typed","add","multiply","Complex","divide","matrix"],Kw=T(WR,pK,n=>{var{typed:e,add:t,multiply:r,Complex:i,divide:a,matrix:o}=n;return e(WR,{"Array, Array":function(c,f){var p=s(512);return u(c,f,p)},"Array, Array, Array":function(c,f,p){return u(c,f,p)},"Array, Array, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=s(p);return u(c,f,m)},"Matrix, Matrix":function(c,f){var p=s(512),{w:m,h}=u(c.valueOf(),f.valueOf(),p);return{w:o(m),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,p){var{h:m}=u(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=s(p),{h}=u(c.valueOf(),f.valueOf(),m);return{h:o(h),w:o(m)}}});function u(l,c,f){for(var p=[],m=[],h=0;h<f.length;h++){for(var d=i(0,0),v=i(0,0),y=0;y<l.length;y++)d=t(d,r(l[y],i(Math.cos(-y*f[h]),Math.sin(-y*f[h]))));for(var S=0;S<c.length;S++)v=t(v,r(c[S],i(Math.cos(-S*f[h]),Math.sin(-S*f[h]))));p.push(d),m.push(v)}for(var b=[],w=0;w<p.length;w++)b.push(a(p[w],m[w]));return{h:b,w:f}}function s(l){for(var c=[],f=0;f<l;f++)c.push(f/l*Math.PI);return c}});var mK="reviver",dK=["classes"],e_=T(mK,dK,n=>{var{classes:e}=n;return function(r,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var hK="replacer",gK=[],t_=T(hK,gK,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var YR="12.4.1";var r_=T("true",[],()=>!0),n_=T("false",[],()=>!1),i_=T("null",[],()=>null),a_=Hi("Infinity",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1/0):1/0}),o_=Hi("NaN",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(NaN):NaN}),s_=Hi("pi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?Gc(t):NT}),u_=Hi("tau",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?J2(t):TT}),l_=Hi("e",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?j2(t):CT}),c_=Hi("phi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?Z2(t):FT}),f_=Hi("LN2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),p_=Hi("LN10",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),m_=Hi("LOG2E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),d_=Hi("LOG10E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),h_=Hi("SQRT1_2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),g_=Hi("SQRT2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),v_=Hi("i",["Complex"],n=>{var{Complex:e}=n;return e.I});var y_=T("version",[],()=>YR);function Hi(n,e,t){return T(n,e,t,{recreateOnConfigChange:!0})}var b_=Jt("speedOfLight","299792458","m s^-1"),x_=Jt("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),w_=Jt("planckConstant","6.62607015e-34","J s"),__=Jt("reducedPlanckConstant","1.0545718176461565e-34","J s"),S_=Jt("magneticConstant","1.25663706212e-6","N A^-2"),A_=Jt("electricConstant","8.8541878128e-12","F m^-1"),M_=Jt("vacuumImpedance","376.730313667","ohm"),E_=Jt("coulomb","8.987551792261171e9","N m^2 C^-2"),D_=Jt("elementaryCharge","1.602176634e-19","C"),N_=Jt("bohrMagneton","9.2740100783e-24","J T^-1"),T_=Jt("conductanceQuantum","7.748091729863649e-5","S"),C_=Jt("inverseConductanceQuantum","12906.403729652257","ohm"),F_=Jt("magneticFluxQuantum","2.0678338484619295e-15","Wb"),I_=Jt("nuclearMagneton","5.0507837461e-27","J T^-1"),P_=Jt("klitzing","25812.807459304513","ohm");var k_=Jt("bohrRadius","5.29177210903e-11","m"),B_=Jt("classicalElectronRadius","2.8179403262e-15","m"),O_=Jt("electronMass","9.1093837015e-31","kg"),R_=Jt("fermiCoupling","1.1663787e-5","GeV^-2"),L_=vd("fineStructure",.0072973525693),V_=Jt("hartreeEnergy","4.3597447222071e-18","J"),U_=Jt("protonMass","1.67262192369e-27","kg"),q_=Jt("deuteronMass","3.3435830926e-27","kg"),z_=Jt("neutronMass","1.6749271613e-27","kg"),$_=Jt("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),H_=Jt("rydberg","10973731.568160","m^-1"),G_=Jt("thomsonCrossSection","6.6524587321e-29","m^2"),W_=vd("weakMixingAngle",.2229),Y_=vd("efimovFactor",22.7),j_=Jt("atomicMass","1.66053906660e-27","kg"),Z_=Jt("avogadro","6.02214076e23","mol^-1"),J_=Jt("boltzmann","1.380649e-23","J K^-1"),X_=Jt("faraday","96485.33212331001","C mol^-1"),Q_=Jt("firstRadiation","3.7417718521927573e-16","W m^2"),K_=Jt("loschmidt","2.686780111798444e25","m^-3"),eS=Jt("gasConstant","8.31446261815324","J K^-1 mol^-1"),tS=Jt("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),rS=Jt("molarVolume","0.022413969545014137","m^3 mol^-1"),nS=vd("sackurTetrode",-1.16487052358),iS=Jt("secondRadiation","0.014387768775039337","m K"),aS=Jt("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),oS=Jt("wienDisplacement","2.897771955e-3","m K"),sS=Jt("molarMass","0.99999999965e-3","kg mol^-1"),uS=Jt("molarMassC12","11.9999999958e-3","kg mol^-1"),lS=Jt("gravity","9.80665","m s^-2"),cS=Jt("planckLength","1.616255e-35","m"),fS=Jt("planckMass","2.176435e-8","kg"),pS=Jt("planckTime","5.391245e-44","s"),mS=Jt("planckCharge","1.87554603778e-18","C"),dS=Jt("planckTemperature","1.416785e+32","K");function Jt(n,e,t){var r=["config","Unit","BigNumber"];return T(n,r,i=>{var{config:a,Unit:o,BigNumber:u}=i,s=a.number==="BigNumber"?new u(e):parseFloat(e),l=new o(s,t);return l.fixPrefix=!0,l})}function vd(n,e){var t=["config","BigNumber"];return T(n,t,r=>{var{config:i,BigNumber:a}=r;return i.number==="BigNumber"?new a(e):e})}var vK="apply",yK=["typed","isInteger"],hS=T(vK,yK,n=>{var{typed:e,isInteger:t}=n,r=ru({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];At(o)?a[1]=o-1:pt(o)&&(a[1]=o.minus(1));try{return r.apply(null,a)}catch(u){throw Br(u)}}})},{isTransformFunction:!0});var bK="column",xK=["typed","Index","matrix","range"],gS=T(bK,xK,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=Bc({typed:e,Index:t,matrix:r,range:i});return e("column",{"...any":function(u){var s=u.length-1,l=u[s];At(l)&&(u[s]=l-1);try{return a.apply(null,u)}catch(c){throw Br(c)}}})},{isTransformFunction:!0});function _l(n,e,t){var r=n.filter(function(s){return Fr(s)&&!(s.name in e)&&!t.has(s.name)})[0];if(!r)throw new Error('No undefined variable found in inline expression "'+n+'"');var i=r.name,a=new Map,o=new sl(t,a,new Set([i])),u=n.compile();return function(l){return a.set(i,l),u.evaluate(o)}}var wK="filter",_K=["typed"],vS=T(wK,_K,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||Ya(i[1])?s=i[1].compile().evaluate(o):s=_l(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("filter",{"Array, function":jR,"Matrix, function":function(a,o){return a.create(jR(a.toArray(),o))},"Array, RegExp":al,"Matrix, RegExp":function(a,o){return a.create(al(a.toArray(),o))}});return t},{isTransformFunction:!0});function jR(n,e){return ym(n,function(t,r,i){return ca(e,t,[r+1],i,"filter")})}var SK="forEach",AK=["typed"],yS=T(SK,AK,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||Ya(i[1])?s=i[1].compile().evaluate(o):s=_l(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("forEach",{"Array | Matrix, function":function(a,o){var u=function s(l,c){if(Array.isArray(l))ns(l,function(f,p){s(f,c.concat(p+1))});else return ca(o,l,c,a,"forEach")};u(a.valueOf(),[])}});return t},{isTransformFunction:!0});var MK="index",EK=["Index","getMatrixDataType"],bS=T(MK,EK,n=>{var{Index:e,getMatrixDataType:t}=n;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var u=arguments[a];if(tl(u))u.start--,u.end-=u.step>0?0:2;else if(u&&u.isSet===!0)u=u.map(function(l){return l-1});else if(nr(u)||ot(u))t(u)!=="boolean"&&(u=u.map(function(l){return l-1}));else if(At(u))u--;else if(pt(u))u=u.toNumber()-1;else if(typeof u!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=u}var s=new e;return e.apply(s,i),s}},{isTransformFunction:!0});var DK="map",NK=["typed"],xS=T(DK,NK,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||Ya(i[1])?s=i[1].compile().evaluate(o):s=_l(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("map",{"Array, function":function(a,o){return ZR(a,o,a)},"Matrix, function":function(a,o){return a.create(ZR(a.valueOf(),o,a))}});return t},{isTransformFunction:!0});function ZR(n,e,t){function r(i,a){return Array.isArray(i)?Mi(i,function(o,u){return r(o,a.concat(u+1))}):ca(e,i,a,t,"map")}return r(n,[])}function ri(n){if(n.length===2&&un(n[0])){n=n.slice();var e=n[1];At(e)?n[1]=e-1:pt(e)&&(n[1]=e.minus(1))}return n}var TK="max",CK=["typed","config","numeric","larger"],wS=T(TK,CK,n=>{var{typed:e,config:t,numeric:r,larger:i}=n,a=$c({typed:e,config:t,numeric:r,larger:i});return e("max",{"...any":function(u){u=ri(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var FK="mean",IK=["typed","add","divide"],_S=T(FK,IK,n=>{var{typed:e,add:t,divide:r}=n,i=Zc({typed:e,add:t,divide:r});return e("mean",{"...any":function(o){o=ri(o);try{return i.apply(null,o)}catch(u){throw Br(u)}}})},{isTransformFunction:!0});var PK="min",kK=["typed","config","numeric","smaller"],SS=T(PK,kK,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n,a=Hc({typed:e,config:t,numeric:r,smaller:i});return e("min",{"...any":function(u){u=ri(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var BK="range",OK=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],AS=T(BK,OK,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,isPositive:c}=n,f=Lc({typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,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 RK="row",LK=["typed","Index","matrix","range"],MS=T(RK,LK,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=Vc({typed:e,Index:t,matrix:r,range:i});return e("row",{"...any":function(u){var s=u.length-1,l=u[s];At(l)&&(u[s]=l-1);try{return a.apply(null,u)}catch(c){throw Br(c)}}})},{isTransformFunction:!0});var VK="subset",UK=["typed","matrix","zeros","add"],ES=T(VK,UK,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=Uc({typed:e,matrix:t,zeros:r,add:i});return e("subset",{"...any":function(u){try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var qK="concat",zK=["typed","matrix","isInteger"],DS=T(qK,zK,n=>{var{typed:e,matrix:t,isInteger:r}=n,i=kc({typed:e,matrix:t,isInteger:r});return e("concat",{"...any":function(o){var u=o.length-1,s=o[u];At(s)?o[u]=s-1:pt(s)&&(o[u]=s.minus(1));try{return i.apply(null,o)}catch(l){throw Br(l)}}})},{isTransformFunction:!0});var JR="diff",$K=["typed","matrix","subtract","number","bignumber"],NS=T(JR,$K,n=>{var{typed:e,matrix:t,subtract:r,number:i,bignumber:a}=n,o=Rc({typed:e,matrix:t,subtract:r,number:i,bignumber:a});return e(JR,{"...any":function(s){s=ri(s);try{return o.apply(null,s)}catch(l){throw Br(l)}}})},{isTransformFunction:!0});var HK="std",GK=["typed","map","sqrt","variance"],TS=T(HK,GK,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n,a=Qc({typed:e,map:t,sqrt:r,variance:i});return e("std",{"...any":function(u){u=ri(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var XR="sum",WK=["typed","config","add","numeric"],CS=T(XR,WK,n=>{var{typed:e,config:t,add:r,numeric:i}=n,a=Yc({typed:e,config:t,add:r,numeric:i});return e(XR,{"...any":function(u){u=ri(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var YK="quantileSeq",jK=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],FS=T(YK,jK,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p}=n,m=Xc({typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(d,v,y)=>m(d,v,h(y)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(d,v,y,S)=>m(d,v,y,h(S)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(d,v,y)=>m(d,v,h(y)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(d,v,y,S)=>m(d,v,y,h(S))});function h(d){return ri([[],d])[1]}},{isTransformFunction:!0});var QR="cumsum",ZK=["typed","add","unaryPlus"],IS=T(QR,ZK,n=>{var{typed:e,add:t,unaryPlus:r}=n,i=jc({typed:e,add:t,unaryPlus:r});return e(QR,{"...any":function(o){if(o.length===2&&un(o[0])){var u=o[1];At(u)?o[1]=u-1:pt(u)&&(o[1]=u.minus(1))}try{return i.apply(null,o)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var KR="variance",JK=["typed","add","subtract","multiply","divide","apply","isNaN"],PS=T(KR,JK,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u}=n,s=Jc({typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u});return e(KR,{"...any":function(c){c=ri(c);try{return s.apply(null,c)}catch(f){throw Br(f)}}})},{isTransformFunction:!0});var eL="print",XK=["typed","matrix","zeros","add"],kS=T(eL,XK,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=qc({typed:e,matrix:t,zeros:r,add:i});return e(eL,{"string, Object | Array":function(s,l){return a(o(s),l)},"string, Object | Array, number | Object":function(s,l,c){return a(o(s),l,c)}});function o(u){return u.replace(Lm,s=>{var l=s.slice(1).split("."),c=l.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var QK="and",KK=["typed","matrix","zeros","add","equalScalar","not","concat"],BS=T(QK,KK,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=zc({typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o});function s(l,c,f){var p=l[0].compile().evaluate(f);if(!un(p)&&!u(p,!0))return!1;var m=l[1].compile().evaluate(f);return u(p,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var eee="or",tee=["typed","matrix","equalScalar","DenseMatrix","concat"],OS=T(eee,tee,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=Pc({typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a});function u(s,l,c){var f=s[0].compile().evaluate(c);if(!un(f)&&o(f,!1))return!0;var p=s[1].compile().evaluate(c);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var ree="bitAnd",nee=["typed","matrix","zeros","add","equalScalar","not","concat"],RS=T(ree,nee,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=Fc({typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o});function s(l,c,f){var p=l[0].compile().evaluate(f);if(!un(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=l[1].compile().evaluate(f);return u(p,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var iee="bitOr",aee=["typed","matrix","equalScalar","DenseMatrix","concat"],LS=T(iee,aee,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=Ic({typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a});function u(s,l,c){var f=s[0].compile().evaluate(c);if(!un(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var p=s[1].compile().evaluate(c);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var tt=ny({config:Ue}),Or=ay({}),VS=l_({BigNumber:tt,config:Ue}),tL=n_({}),rL=L_({BigNumber:tt,config:Ue}),ds=sy({}),US=v_({Complex:Or}),nL=a_({BigNumber:tt,config:Ue}),iL=p_({BigNumber:tt,config:Ue}),aL=d_({BigNumber:tt,config:Ue}),tf=ly({}),oL=o_({BigNumber:tt,config:Ue}),sL=i_({}),uL=c_({BigNumber:tt,config:Ue}),lL=uy({}),qS=Jv({}),cL=h_({BigNumber:tt,config:Ue}),fL=nS({BigNumber:tt,config:Ue}),zS=u_({BigNumber:tt,config:Ue}),pL=r_({}),mL=y_({}),er=cy({Matrix:tf}),dL=Y_({BigNumber:tt,config:Ue}),hL=f_({BigNumber:tt,config:Ue}),yd=s_({BigNumber:tt,config:Ue}),gL=t_({}),vL=g_({BigNumber:tt,config:Ue}),se=Zv({BigNumber:tt,Complex:Or,DenseMatrix:er,Fraction:ds}),bd=I0({BigNumber:tt,config:Ue,typed:se}),yL=W_({BigNumber:tt,config:Ue}),ni=P0({typed:se}),bL=kx({Complex:Or,config:Ue,typed:se}),xL=Ox({BigNumber:tt,typed:se}),wL=Lx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),En=k0({typed:se}),_L=lb({typed:se}),SL=qx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),AL=$x({typed:se}),$S=Hx({typed:se}),ML=Wx({Complex:Or,config:Ue,typed:se}),Ti=S0({BigNumber:tt,typed:se}),EL=sb({typed:se}),DL=_0({typed:se}),NL=fy({typed:se}),rf=xw({typed:se}),nf=A0({Complex:Or,typed:se}),hs=cb({typed:se}),xd=Yx({typed:se}),TL=Zx({BigNumber:tt,typed:se}),CL=Xx({BigNumber:tt,typed:se}),FL=V0({typed:se}),ar=y0({config:Ue,typed:se}),IL=Ub({typed:se}),HS=U0({typed:se}),PL=q0({Complex:Or,typed:se}),kL=yb({typed:se}),BL=xb({typed:se}),Sl=Hb({typed:se}),wd=wb({typed:se}),OL=Yb({format:Sl,typed:se}),_d=fb({typed:se}),vi=my({typed:se}),Co=f0({typed:se}),gs=d0({typed:se}),ma=h0({typed:se}),RL=m_({BigNumber:tt,config:Ue}),LL=Sw({Complex:Or,typed:se}),VL=j0({Complex:Or,config:Ue,typed:se}),GS=Z0({Complex:Or,config:Ue,typed:se}),vs=Ab({typed:se}),ln=J0({typed:se}),af=mb({typed:se}),Qa=x0({typed:se}),UL=Wb({format:Sl,typed:se}),qL=Bw({config:Ue,typed:se}),zL=qc({typed:se}),$L=Ow({config:Ue,typed:se}),Sd=pb({typed:se}),HL=Kx({BigNumber:tt,typed:se}),WS=K0({BigNumber:tt,Fraction:ds,complex:nf,typed:se}),of=t1({typed:se}),Ka=b0({Matrix:tf,equalScalar:ar,typed:se}),GL=C0({typed:se}),WL=tb({typed:se}),YL=w0({typed:se}),Gi=B0({typed:se}),jL=n1({typed:se}),YS=v0({typed:se}),ZL=Bx({Complex:Or,config:Ue,typed:se}),JL=Vx({BigNumber:tt,typed:se}),Ad=ru({isInteger:vi,typed:se}),XL=Ux({BigNumber:tt,Complex:Or,config:Ue,typed:se}),QL=Gb({format:Sl,typed:se}),KL=ww({typed:se}),e3=jx({typed:se}),t3=Qx({BigNumber:tt,typed:se}),Al=g0({typed:se}),r3=Zb({typed:se}),n3=Rw({config:Ue,typed:se}),i3=e1({BigNumber:tt,typed:se}),a3=r1({typed:se}),o3=Ix({SparseMatrix:Ka,typed:se}),da=eb({Complex:Or,config:Ue,typed:se}),s3=i1({typed:se}),Ba=F0({typed:se}),u3=Rx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),l3=Jx({BigNumber:tt,typed:se}),ou=M0({Fraction:ds,typed:se}),ys=p0({typed:se}),Qe=E0({DenseMatrix:er,Matrix:tf,SparseMatrix:Ka,typed:se}),c3=D0({isZero:ma,matrix:Qe,typed:se}),f3=zb({isNaN:Al,isNumeric:ys,typed:se}),ha=Jb({bignumber:Ti,fraction:ou,number:Qa}),jS=$b({config:Ue,multiplyScalar:ln,numeric:ha,typed:se}),ZS=Eb({isInteger:vi,matrix:Qe,typed:se}),Rn=Cb({matrix:Qe,config:Ue,typed:se}),p3=Fb({matrix:Qe,typed:se}),Ml=Ib({matrix:Qe,typed:se}),JS=nb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),Ln=kb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),m3=zx({Complex:Or,config:Ue,typed:se}),XS=O0({BigNumber:tt,Complex:Or,Fraction:ds,config:Ue,isNegative:Co,matrix:Qe,typed:se,unaryMinus:Ba}),mr=kc({isInteger:vi,matrix:Qe,typed:se}),d3=hb({prod:jS,size:Rn,typed:se}),Md=Pb({conj:hs,transpose:Ml,typed:se}),QS=vb({DenseMatrix:er,SparseMatrix:Ka,matrix:Qe,typed:se}),Xr=Xb({numeric:ha,typed:se}),El=ix({DenseMatrix:er,concat:mr,divideScalar:Xr,equalScalar:ar,matrix:Qe,typed:se}),Wi=hx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),Dl=bb({matrix:Qe,typed:se}),h3=m0({isNumeric:ys,typed:se}),Fo=_b({BigNumber:tt,DenseMatrix:er,SparseMatrix:Ka,config:Ue,matrix:Qe,typed:se}),g3=Sb({matrix:Qe,multiplyScalar:ln,typed:se}),sf=xx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),v3=lx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),KS=ax({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:ln,subtractScalar:Gi,typed:se}),Ed=T0({flatten:Dl,matrix:Qe,size:Rn,typed:se}),y3=Q0({BigNumber:tt,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),b3=Mb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),Dd=W1({addScalar:En,complex:nf,conj:hs,divideScalar:Xr,equal:Wi,identity:Fo,isZero:ma,matrix:Qe,multiplyScalar:ln,sign:WS,sqrt:da,subtractScalar:Gi,typed:se,unaryMinus:Ba,zeros:Ln}),x3=Db({config:Ue,matrix:Qe}),w3=cx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),su=Kb({BigNumber:tt,DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),ii=vx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),cn=rb({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,subtractScalar:Gi,typed:se,unaryMinus:Ba}),_3=jb({concat:mr,matrix:Qe,typed:se}),S3=_x({DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,typed:se}),Nd=ox({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:ln,subtractScalar:Gi,typed:se}),A3=db({DenseMatrix:er,concat:mr,matrix:Qe,typed:se}),lr=h1({DenseMatrix:er,SparseMatrix:Ka,addScalar:En,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),M3=Gx({BigNumber:tt,DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),E3=Fc({concat:mr,equalScalar:ar,matrix:Qe,typed:se}),D3=Ic({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),N3=ub({DenseMatrix:er,concat:mr,matrix:Qe,typed:se}),T3=Uw({addScalar:En,combinations:rf,divideScalar:Xr,isInteger:vi,isNegative:Co,multiplyScalar:ln,typed:se}),bs=px({BigNumber:tt,DenseMatrix:er,Fraction:ds,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,typed:se}),eA=dx({concat:mr,matrix:Qe,typed:se}),C3=jc({add:lr,typed:se,unaryPlus:bd}),Td=wx({equal:Wi,typed:se}),F3=Rc({matrix:Qe,number:Qa,subtract:cn,typed:se}),I3=dw({abs:ni,addScalar:En,deepEqual:Td,divideScalar:Xr,multiplyScalar:ln,sqrt:da,subtractScalar:Gi,typed:se}),uf=y1({addScalar:En,conj:hs,multiplyScalar:ln,size:Rn,typed:se}),P3=gx({compareText:eA,isZero:ma,typed:se}),tA=Tc({DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,round:su,typed:se,zeros:Ln}),k3=W0({BigNumber:tt,DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,round:su,typed:se,zeros:Ln}),B3=g1({abs:ni,addScalar:En,divideScalar:Xr,isPositive:gs,multiplyScalar:ln,smaller:ii,sqrt:da,typed:se}),rA=Mx({DenseMatrix:er,smaller:ii}),Gn=Ex({ImmutableDenseMatrix:rA,getMatrixDataType:wd}),ai=bx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),Cd=ex({Complex:Or,config:Ue,divideScalar:Xr,typed:se}),O3=sx({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:ln,subtractScalar:Gi,typed:se}),R3=N0({flatten:Dl,matrix:Qe,size:Rn,typed:se}),L3=Hc({config:Ue,numeric:ha,smaller:ii,typed:se}),nA=Cc({DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,round:su,typed:se,zeros:Ln}),_r=X0({addScalar:En,dot:uf,equalScalar:ar,matrix:Qe,multiplyScalar:ln,typed:se}),V3=rx({Complex:Or,config:Ue,divideScalar:Xr,typed:se}),U3=Pc({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),lf=Sx({compare:bs,isNaN:Al,isNumeric:ys,typed:se}),q3=fx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),iA=j1({SparseMatrix:Ka,abs:ni,add:lr,divideScalar:Xr,larger:ai,largerEq:sf,multiply:_r,subtract:cn,transpose:Ml,typed:se}),Ci=Uc({add:lr,matrix:Qe,typed:se,zeros:Ln}),Fd=Yc({add:lr,config:Ue,numeric:ha,typed:se}),z3=b1({add:lr,matrix:Qe,typed:se}),aA=ux({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:ln,subtractScalar:Gi,typed:se}),$3=Qw({Complex:Or,add:lr,multiply:_r,number:Qa,typed:se}),Id=L0({DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,round:su,typed:se,zeros:Ln}),Oa=mx({compare:bs,typed:se}),H3=qw({addScalar:En,combinations:rf,isInteger:vi,isNegative:Co,isPositive:gs,larger:ai,typed:se}),G3=gb({matrix:Qe,multiply:_r,subtract:cn,typed:se}),oA=iw({divideScalar:Xr,isZero:ma,matrix:Qe,multiply:_r,subtractScalar:Gi,typed:se,unaryMinus:Ba}),W3=ab({concat:mr,equalScalar:ar,matrix:Qe,multiplyScalar:ln,typed:se}),sA=Dx({larger:ai,smaller:ii}),uA=$0({Complex:Or,DenseMatrix:er,ceil:Id,equalScalar:ar,floor:tA,matrix:Qe,typed:se,zeros:Ln}),lA=x1({Index:Gn,typed:se}),Y3=hw({abs:ni,add:lr,addScalar:En,config:Ue,divideScalar:Xr,equalScalar:ar,flatten:Dl,isNumeric:ys,isZero:ma,matrix:Qe,multiply:_r,multiplyScalar:ln,smaller:ii,subtract:cn,typed:se}),j3=ib({BigNumber:tt,add:lr,config:Ue,equal:Wi,isInteger:vi,mod:nA,smaller:ii,typed:se,xgcd:JS}),Z3=Y0({concat:mr,equalScalar:ar,matrix:Qe,typed:se}),J3=tx({Complex:Or,config:Ue,divideScalar:Xr,log:Cd,typed:se}),Pd=$c({config:Ue,larger:ai,numeric:ha,typed:se}),X3=a1({DenseMatrix:er,Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),Q3=s1({DenseMatrix:er,Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),K3=l1({Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),e4=f1({Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),uu=yx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),t4=Ax({compare:bs,compareNatural:Oa,matrix:Qe,typed:se}),r4=zc({concat:mr,equalScalar:ar,matrix:Qe,not:af,typed:se,zeros:Ln}),lu=Lc({bignumber:Ti,matrix:Qe,add:lr,config:Ue,isPositive:gs,larger:ai,largerEq:sf,smaller:ii,smallerEq:uu,typed:se}),n4=Vc({Index:Gn,matrix:Qe,range:lu,typed:se}),cA=o1({DenseMatrix:er,Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),i4=c1({Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),fA=m1({Index:Gn,concat:mr,setDifference:cA,size:Rn,subset:Ci,typed:se}),pA=Nx({FibonacciHeap:sA,addScalar:En,equalScalar:ar}),mA=Bc({Index:Gn,matrix:Qe,range:lu,typed:se}),xs=aw({abs:ni,addScalar:En,det:oA,divideScalar:Xr,identity:Fo,matrix:Qe,multiply:_r,typed:se,unaryMinus:Ba}),dA=G1({DenseMatrix:er,Spa:pA,SparseMatrix:Ka,abs:ni,addScalar:En,divideScalar:Xr,equalScalar:ar,larger:ai,matrix:Qe,multiplyScalar:ln,subtractScalar:Gi,typed:se,unaryMinus:Ba}),a4=ow({Complex:Or,add:lr,ctranspose:Md,deepEqual:Td,divideScalar:Xr,dot:uf,dotDivide:El,equal:Wi,inv:xs,matrix:Qe,multiply:_r,typed:se}),Yi=Qb({Complex:Or,config:Ue,fraction:ou,identity:Fo,inv:xs,matrix:Qe,multiply:_r,number:Qa,typed:se}),hA=u1({DenseMatrix:er,Index:Gn,compareNatural:Oa,size:Rn,subset:Ci,typed:se}),o4=d1({Index:Gn,concat:mr,setIntersect:hA,setSymDifference:fA,size:Rn,subset:Ci,typed:se}),s4=lw({abs:ni,add:lr,identity:Fo,inv:xs,map:vs,max:Pd,multiply:_r,size:Rn,sqrt:da,subtract:cn,typed:se}),Rt=Cx({BigNumber:tt,Complex:Or,Fraction:ds,abs:ni,addScalar:En,config:Ue,divideScalar:Xr,equal:Wi,fix:uA,format:Sl,isNumeric:ys,multiplyScalar:ln,number:Qa,pow:Yi,round:su,subtractScalar:Gi}),u4=M_({BigNumber:tt,Unit:Rt,config:Ue}),l4=oS({BigNumber:tt,Unit:Rt,config:Ue}),c4=j_({BigNumber:tt,Unit:Rt,config:Ue}),f4=N_({BigNumber:tt,Unit:Rt,config:Ue}),p4=J_({BigNumber:tt,Unit:Rt,config:Ue}),m4=T_({BigNumber:tt,Unit:Rt,config:Ue}),d4=E_({BigNumber:tt,Unit:Rt,config:Ue}),h4=q_({BigNumber:tt,Unit:Rt,config:Ue}),g4=nx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,pow:Yi,typed:se}),v4=A_({BigNumber:tt,Unit:Rt,config:Ue}),y4=D_({BigNumber:tt,Unit:Rt,config:Ue}),b4=uw({abs:ni,add:lr,identity:Fo,inv:xs,multiply:_r,typed:se}),x4=X_({BigNumber:tt,Unit:Rt,config:Ue}),gA=Bb({addScalar:En,ceil:Id,conj:hs,divideScalar:Xr,dotDivide:El,exp:HS,i:US,log2:GS,matrix:Qe,multiplyScalar:ln,pow:Yi,tau:zS,typed:se}),kd=_w({BigNumber:tt,Complex:Or,config:Ue,multiplyScalar:ln,pow:Yi,typed:se}),w4=x_({BigNumber:tt,Unit:Rt,config:Ue}),_4=V_({BigNumber:tt,Unit:Rt,config:Ue}),S4=Ob({conj:hs,dotDivide:El,fft:gA,typed:se}),A4=P_({BigNumber:tt,Unit:Rt,config:Ue}),M4=K_({BigNumber:tt,Unit:Rt,config:Ue}),E4=S_({BigNumber:tt,Unit:Rt,config:Ue}),D4=sS({BigNumber:tt,Unit:Rt,config:Ue}),N4=tS({BigNumber:tt,Unit:Rt,config:Ue}),T4=z_({BigNumber:tt,Unit:Rt,config:Ue}),C4=I_({BigNumber:tt,Unit:Rt,config:Ue}),F4=mS({BigNumber:tt,Unit:Rt,config:Ue}),I4=cS({BigNumber:tt,Unit:Rt,config:Ue}),P4=dS({BigNumber:tt,Unit:Rt,config:Ue}),k4=U_({BigNumber:tt,Unit:Rt,config:Ue}),B4=$_({BigNumber:tt,Unit:Rt,config:Ue}),O4=__({BigNumber:tt,Unit:Rt,config:Ue}),R4=H_({BigNumber:tt,Unit:Rt,config:Ue}),L4=iS({BigNumber:tt,Unit:Rt,config:Ue}),V4=b_({BigNumber:tt,Unit:Rt,config:Ue}),U4=aS({BigNumber:tt,Unit:Rt,config:Ue}),q4=G_({BigNumber:tt,Unit:Rt,config:Ue}),z4=Z_({BigNumber:tt,Unit:Rt,config:Ue}),$4=k_({BigNumber:tt,Unit:Rt,config:Ue}),H4=Px({Unit:Rt,typed:se}),In=mw({divideScalar:Xr,equalScalar:ar,inv:xs,matrix:Qe,multiply:_r,typed:se}),G4=O_({BigNumber:tt,Unit:Rt,config:Ue}),Nl=Aw({gamma:kd,typed:se}),W4=Q_({BigNumber:tt,Unit:Rt,config:Ue}),Y4=lS({BigNumber:tt,Unit:Rt,config:Ue}),j4=C_({BigNumber:tt,Unit:Rt,config:Ue}),vA=J1({DenseMatrix:er,lsolve:KS,lup:dA,matrix:Qe,slu:iA,typed:se,usolve:Nd}),Z4=F_({BigNumber:tt,Unit:Rt,config:Ue}),J4=uS({BigNumber:tt,Unit:Rt,config:Ue}),X4=Ew({add:lr,divide:In,factorial:Nl,isInteger:vi,isPositive:gs,multiply:_r,typed:se}),Q4=Dw({factorial:Nl,typed:se}),K4=fS({BigNumber:tt,Unit:Rt,config:Ue}),eV=X1({add:lr,cbrt:XS,divide:In,equalScalar:ar,im:_d,isZero:ma,multiply:_r,re:Sd,sqrt:da,subtract:cn,typeOf:YS,typed:se,unaryMinus:Ba}),tV=p1({compareNatural:Oa,typed:se}),rV=Vb({abs:ni,add:lr,bignumber:Ti,divide:In,isNegative:Co,isPositive:gs,larger:ai,map:vs,matrix:Qe,max:Pd,multiply:_r,smaller:ii,subtract:cn,typed:se,unaryMinus:Ba}),yA=Lw({bignumber:Ti,addScalar:En,combinations:rf,divideScalar:Xr,factorial:Nl,isInteger:vi,isNegative:Co,larger:ai,multiplyScalar:ln,number:Qa,pow:Yi,subtractScalar:Gi,typed:se}),nV=Fx({Unit:Rt,typed:se}),iV=Vw({addScalar:En,isInteger:vi,isNegative:Co,stirlingS2:yA,typed:se}),bA=sw({abs:ni,add:lr,addScalar:En,atan:$S,bignumber:Ti,column:mA,complex:nf,config:Ue,cos:xd,diag:QS,divideScalar:Xr,dot:uf,equal:Wi,flatten:Dl,im:_d,inv:xs,larger:ai,matrix:Qe,matrixFromColumns:Ed,multiply:_r,multiplyScalar:ln,number:Qa,qr:Dd,re:Sd,reshape:ZS,sin:of,size:Rn,smaller:ii,sqrt:da,subtract:cn,typed:se,usolve:Nd,usolveAll:aA}),aV=R_({BigNumber:tt,Unit:Rt,config:Ue}),oV=eS({BigNumber:tt,Unit:Rt,config:Ue}),sV=Mw({divide:In,dotDivide:El,isNumeric:ys,log:Cd,map:vs,matrix:Qe,multiply:_r,sum:Fd,typed:se}),xA=Zc({add:lr,divide:In,typed:se}),uV=rS({BigNumber:tt,Unit:Rt,config:Ue}),lV=w_({BigNumber:tt,Unit:Rt,config:Ue}),cV=Xc({bignumber:Ti,add:lr,compare:bs,divide:In,isInteger:vi,larger:ai,multiply:_r,partitionSelect:lf,smaller:ii,smallerEq:uu,subtract:cn,typed:se}),Bd=Jc({add:lr,apply:Ad,divide:In,isNaN:Al,multiply:_r,subtract:cn,typed:se}),fV=B_({BigNumber:tt,Unit:Rt,config:Ue}),wA=gw({add:lr,compare:bs,divide:In,partitionSelect:lf,typed:se}),pV=bw({add:lr,divide:In,matrix:Qe,mean:xA,multiply:_r,pow:Yi,sqrt:da,subtract:cn,sum:Fd,typed:se}),mV=Kw({Complex:Or,add:lr,divide:In,matrix:Qe,multiply:_r,typed:se}),dV=vw({abs:ni,map:vs,median:wA,subtract:cn,typed:se}),hV=Qc({map:vs,sqrt:da,typed:se,variance:Bd}),gV=qb({BigNumber:tt,Complex:Or,add:lr,config:Ue,divide:In,equal:Wi,factorial:Nl,gamma:kd,isNegative:Co,multiply:_r,pi:yd,pow:Yi,sin:of,smallerEq:uu,subtract:cn,typed:se}),Od=v1({abs:ni,add:lr,conj:hs,ctranspose:Md,eigs:bA,equalScalar:ar,larger:ai,matrix:Qe,multiply:_r,pow:Yi,smaller:ii,sqrt:da,typed:se}),_A=Tb({BigNumber:tt,DenseMatrix:er,SparseMatrix:Ka,addScalar:En,config:Ue,cos:xd,matrix:Qe,multiplyScalar:ln,norm:Od,sin:of,typed:se,unaryMinus:Ba}),vV=pS({BigNumber:tt,Unit:Rt,config:Ue}),SA=fw({identity:Fo,matrix:Qe,multiply:_r,norm:Od,qr:Dd,subtract:cn,typed:se}),yV=Nb({multiply:_r,rotationMatrix:_A,typed:se}),AA=cw({abs:ni,add:lr,concat:mr,identity:Fo,index:lA,lusolve:vA,matrix:Qe,matrixFromColumns:Ed,multiply:_r,range:lu,schur:SA,subset:Ci,subtract:cn,transpose:Ml,typed:se}),bV=pw({matrix:Qe,multiply:_r,sylvester:AA,transpose:Ml,typed:se});var Tl={},Cl={},xV={},oi=w1({mathWithTransform:Cl}),Fl=P1({Node:oi}),Io=k1({Node:oi}),cu=B1({Node:oi}),wV=R1({Node:oi}),Il=S1({Node:oi}),_V=M1({Node:oi,ResultSet:qS}),SV=E1({Node:oi}),ws=C1({Node:oi}),AV=O1({Node:oi}),oee=e_({classes:xV}),MA=K1({math:Tl,typed:se}),MV=F1({Node:oi,typed:se}),see=nw({Chain:MA,typed:se}),Pl=I1({Node:oi,size:Rn}),kl=_1({Node:oi,subset:Ci}),EV=A1({matrix:Qe,Node:oi,subset:Ci}),_s=L1({Unit:Rt,Node:oi,math:Tl}),Ss=V1({Node:oi,SymbolNode:_s,math:Tl}),eo=U1({AccessorNode:kl,ArrayNode:Il,AssignmentNode:EV,BlockNode:_V,ConditionalNode:SV,ConstantNode:ws,FunctionAssignmentNode:MV,FunctionNode:Ss,IndexNode:Pl,ObjectNode:Fl,OperatorNode:Io,ParenthesisNode:cu,RangeNode:AV,RelationalNode:wV,SymbolNode:_s,config:Ue,numeric:ha,typed:se}),DV=jw({ConstantNode:ws,FunctionNode:Ss,OperatorNode:Io,ParenthesisNode:cu,parse:eo,typed:se}),EA=Ww({bignumber:Ti,fraction:ou,AccessorNode:kl,ArrayNode:Il,ConstantNode:ws,FunctionNode:Ss,IndexNode:Pl,ObjectNode:Fl,OperatorNode:Io,SymbolNode:_s,config:Ue,mathWithTransform:Cl,matrix:Qe,typed:se}),DA=q1({parse:eo,typed:se}),NA=Yw({AccessorNode:kl,ArrayNode:Il,ConstantNode:ws,FunctionNode:Ss,IndexNode:Pl,ObjectNode:Fl,OperatorNode:Io,ParenthesisNode:cu,SymbolNode:_s,add:lr,divide:In,equal:Wi,isZero:ma,multiply:_r,parse:eo,pow:Yi,subtract:cn,typed:se}),TA=z1({parse:eo,typed:se}),NV=Q1({evaluate:TA}),TV=$1({evaluate:TA}),Rd=Gw({bignumber:Ti,fraction:ou,AccessorNode:kl,ArrayNode:Il,ConstantNode:ws,FunctionNode:Ss,IndexNode:Pl,ObjectNode:Fl,OperatorNode:Io,ParenthesisNode:cu,SymbolNode:_s,add:lr,config:Ue,divide:In,equal:Wi,isZero:ma,mathWithTransform:Cl,matrix:Qe,multiply:_r,parse:eo,pow:Yi,resolve:DV,simplifyConstant:EA,simplifyCore:NA,subtract:cn,typed:se}),uee=Zw({OperatorNode:Io,parse:eo,simplify:Rd,typed:se}),lee=zw({parse:eo,typed:se}),cee=H1({Parser:TV,typed:se}),fee=Xw({bignumber:Ti,fraction:ou,AccessorNode:kl,ArrayNode:Il,ConstantNode:ws,FunctionNode:Ss,IndexNode:Pl,ObjectNode:Fl,OperatorNode:Io,ParenthesisNode:cu,SymbolNode:_s,add:lr,config:Ue,divide:In,equal:Wi,isZero:ma,mathWithTransform:Cl,matrix:Qe,multiply:_r,parse:eo,pow:Yi,simplify:Rd,simplifyConstant:EA,simplifyCore:NA,subtract:cn,typed:se}),pee=Jw({ConstantNode:ws,FunctionNode:Ss,OperatorNode:Io,ParenthesisNode:cu,SymbolNode:_s,config:Ue,equal:Wi,isZero:ma,numeric:ha,parse:eo,simplify:Rd,typed:se}),mee=rw({Help:NV,mathWithTransform:Cl,typed:se});zr(Tl,{e:VS,false:tL,fineStructure:rL,i:US,Infinity:nL,LN10:iL,LOG10E:aL,NaN:oL,null:sL,phi:uL,SQRT1_2:cL,sackurTetrode:fL,tau:zS,true:pL,E:VS,version:mL,efimovFactor:dL,LN2:hL,pi:yd,replacer:gL,reviver:oee,SQRT2:vL,typed:se,unaryPlus:bd,PI:yd,weakMixingAngle:yL,abs:ni,acos:bL,acot:xL,acsc:wL,addScalar:En,arg:_L,asech:SL,asinh:AL,atan:$S,atanh:ML,bignumber:Ti,bitNot:EL,boolean:DL,clone:NL,combinations:rf,complex:nf,conj:hs,cos:xd,cot:TL,csc:CL,cube:FL,equalScalar:ar,erf:IL,exp:HS,expm1:PL,filter:kL,forEach:BL,format:Sl,getMatrixDataType:wd,hex:OL,im:_d,isInteger:vi,isNegative:Co,isPositive:gs,isZero:ma,LOG2E:RL,lgamma:LL,log10:VL,log2:GS,map:vs,multiplyScalar:ln,not:af,number:Qa,oct:UL,pickRandom:qL,print:zL,random:$L,re:Sd,sec:HL,sign:WS,sin:of,splitUnit:GL,square:WL,string:YL,subtractScalar:Gi,tan:jL,typeOf:YS,acosh:ZL,acsch:JL,apply:Ad,asec:XL,bin:QL,chain:see,combinationsWithRep:KL,cosh:e3,csch:t3,isNaN:Al,isPrime:r3,randomInt:n3,sech:i3,sinh:a3,sparse:o3,sqrt:da,tanh:s3,unaryMinus:Ba,acoth:u3,coth:l3,fraction:ou,isNumeric:ys,matrix:Qe,matrixFromFunction:c3,mode:f3,numeric:ha,prod:jS,reshape:ZS,size:Rn,squeeze:p3,transpose:Ml,xgcd:JS,zeros:Ln,asin:m3,cbrt:XS,concat:mr,count:d3,ctranspose:Md,diag:QS,divideScalar:Xr,dotDivide:El,equal:Wi,flatten:Dl,hasNumericValue:h3,identity:Fo,kron:g3,largerEq:sf,leftShift:v3,lsolve:KS,matrixFromColumns:Ed,nthRoot:y3,ones:b3,qr:Dd,resize:x3,rightArithShift:w3,round:su,smaller:ii,subtract:cn,to:_3,unequal:S3,usolve:Nd,xor:A3,add:lr,atan2:M3,bitAnd:E3,bitOr:D3,bitXor:N3,catalan:T3,compare:bs,compareText:eA,cumsum:C3,deepEqual:Td,diff:F3,distance:I3,dot:uf,equalText:P3,floor:tA,gcd:k3,hypot:B3,larger:ai,log:Cd,lsolveAll:O3,matrixFromRows:R3,min:L3,mod:nA,multiply:_r,nthRoots:V3,or:U3,partitionSelect:lf,rightLogShift:q3,slu:iA,subset:Ci,sum:Fd,trace:z3,usolveAll:aA,zpk2tf:$3,ceil:Id,compareNatural:Oa,composition:H3,cross:G3,det:oA,dotMultiply:W3,fix:uA,index:lA,intersect:Y3,invmod:j3,lcm:Z3,log1p:J3,max:Pd,setCartesian:X3,setDistinct:Q3,setIsSubset:K3,setPowerset:e4,smallerEq:uu,sort:t4,and:r4,range:lu,row:n4,setDifference:cA,setMultiplicity:i4,setSymDifference:fA,column:mA,inv:xs,lup:dA,pinv:a4,pow:Yi,setIntersect:hA,setUnion:o4,sqrtm:s4,vacuumImpedance:u4,wienDisplacement:l4,atomicMass:c4,bohrMagneton:f4,boltzmann:p4,conductanceQuantum:m4,coulomb:d4,deuteronMass:h4,dotPow:g4,electricConstant:v4,elementaryCharge:y4,expm:b4,faraday:x4,fft:gA,gamma:kd,gravitationConstant:w4,hartreeEnergy:_4,ifft:S4,klitzing:A4,loschmidt:M4,magneticConstant:E4,molarMass:D4,molarPlanckConstant:N4,neutronMass:T4,nuclearMagneton:C4,planckCharge:F4,planckLength:I4,planckTemperature:P4,protonMass:k4,quantumOfCirculation:B4,reducedPlanckConstant:O4,rydberg:R4,secondRadiation:L4,speedOfLight:V4,stefanBoltzmann:U4,thomsonCrossSection:q4,avogadro:z4,bohrRadius:$4,createUnit:H4,divide:In,electronMass:G4,factorial:Nl,firstRadiation:W4,gravity:Y4,inverseConductanceQuantum:j4,lusolve:vA,magneticFluxQuantum:Z4,molarMassC12:J4,multinomial:X4,parse:eo,permutations:Q4,planckMass:K4,polynomialRoot:eV,resolve:DV,setSize:tV,simplifyConstant:EA,solveODE:rV,stirlingS2:yA,unit:nV,bellNumbers:iV,compile:DA,eigs:bA,fermiCoupling:aV,gasConstant:oV,kldivergence:sV,mean:xA,molarVolume:uV,planckConstant:lV,quantileSeq:cV,simplifyCore:NA,variance:Bd,classicalElectronRadius:fV,evaluate:TA,median:wA,simplify:Rd,symbolicEqual:uee,corr:pV,freqz:mV,leafCount:lee,mad:dV,parser:cee,rationalize:fee,std:hV,zeta:gV,derivative:pee,norm:Od,rotationMatrix:_A,help:mee,planckTime:vV,schur:SA,rotate:yV,sylvester:AA,lyap:bV,config:Ue});zr(Cl,Tl,{filter:vS({typed:se}),forEach:yS({typed:se}),map:xS({typed:se}),apply:hS({isInteger:vi,typed:se}),or:OS({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),and:BS({add:lr,concat:mr,equalScalar:ar,matrix:Qe,not:af,typed:se,zeros:Ln}),concat:DS({isInteger:vi,matrix:Qe,typed:se}),max:wS({config:Ue,larger:ai,numeric:ha,typed:se}),print:kS({add:lr,matrix:Qe,typed:se,zeros:Ln}),bitAnd:RS({add:lr,concat:mr,equalScalar:ar,matrix:Qe,not:af,typed:se,zeros:Ln}),diff:NS({bignumber:Ti,matrix:Qe,number:Qa,subtract:cn,typed:se}),min:SS({config:Ue,numeric:ha,smaller:ii,typed:se}),subset:ES({add:lr,matrix:Qe,typed:se,zeros:Ln}),bitOr:LS({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),cumsum:IS({add:lr,typed:se,unaryPlus:bd}),index:bS({Index:Gn,getMatrixDataType:wd}),sum:CS({add:lr,config:Ue,numeric:ha,typed:se}),range:AS({bignumber:Ti,matrix:Qe,add:lr,config:Ue,isPositive:gs,larger:ai,largerEq:sf,smaller:ii,smallerEq:uu,typed:se}),row:MS({Index:Gn,matrix:Qe,range:lu,typed:se}),column:gS({Index:Gn,matrix:Qe,range:lu,typed:se}),mean:_S({add:lr,divide:In,typed:se}),quantileSeq:FS({add:lr,bignumber:Ti,compare:bs,divide:In,isInteger:vi,larger:ai,multiply:_r,partitionSelect:lf,smaller:ii,smallerEq:uu,subtract:cn,typed:se}),variance:PS({add:lr,apply:Ad,divide:In,isNaN:Al,multiply:_r,subtract:cn,typed:se}),std:TS({map:vs,sqrt:da,typed:se,variance:Bd})});zr(xV,{BigNumber:tt,Complex:Or,Fraction:ds,Matrix:tf,Node:oi,ObjectNode:Fl,OperatorNode:Io,ParenthesisNode:cu,Range:lL,RelationalNode:wV,ResultSet:qS,ArrayNode:Il,BlockNode:_V,ConditionalNode:SV,ConstantNode:ws,DenseMatrix:er,RangeNode:AV,Chain:MA,FunctionAssignmentNode:MV,SparseMatrix:Ka,IndexNode:Pl,ImmutableDenseMatrix:rA,Index:Gn,AccessorNode:kl,AssignmentNode:EV,FibonacciHeap:sA,Spa:pA,Unit:Rt,SymbolNode:_s,FunctionNode:Ss,Help:NV,Parser:TV});MA.createProxy(Tl);var Ld=class extends Wa{constructor(e){super(e),this.hidden=!1,this.hasError=!1}buildVariables(){let e=0;this.expressionStr="",this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let r={bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:`MB_VAR_${e}`};this.variables.push(r),this.expressionStr+=r.contextName,e+=1}else this.expressionStr+=t;this.expression=DA(this.expressionStr)}buildMathJSContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}computeValue(){if(this.hasError=!1,!this.expression)return this.handleComputeError(new _a({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{return Vi(this.expression.evaluate(e)?.toString())}catch(t){return t instanceof Error?this.handleComputeError(new _a({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:t,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?mt.addClass(e,"mb-error"):mt.removeClass(e,"mb-error"),e.innerText=t}handleComputeError(e){return this.hasError=!0,console.warn(e),e.message}};var Vd=class extends Wa{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let r={bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:`MB_VAR_${e}`};this.variables.push(r),this.textParts.push(e),e+=1}else this.textParts.push(t)}computeValue(){if(!this.textParts)throw new _a({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="number"?yp(this.variables[e].inputSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty):e).join("")}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&mt.addClass(e,"mb-view-markdown")}async onRerender(e,t){this.renderMarkdown?(this.markdownUnloadCallback?.(),this.markdownUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())):e.innerText=t}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};function dee(n){let e,t,r;return{c(){e=ee("div"),t=ee("img"),q(t,"class","mb-image-card-image"),na(t.src,r=n[0].internal.imagePathToUri(n[1]))||q(t,"src",r),q(t,"alt",n[1]),q(e,"class","mb-image-card")},m(i,a){J(i,e,a),K(e,t)},p(i,[a]){a&3&&!na(t.src,r=i[0].internal.imagePathToUri(i[1]))&&q(t,"src",r),a&2&&q(t,"alt",i[1])},i:Ke,o:Ke,d(i){i&&Y(e)}}}function hee(n,e,t){let{plugin:r}=e,{image:i}=e;return n.$$set=a=>{"plugin"in a&&t(0,r=a.plugin),"image"in a&&t(1,i=a.image)},[r,i]}var CA=class extends Pe{constructor(e){super(),Be(this,e,hee,dee,ke,{plugin:0,image:1})}},CV=CA;function FV(n,e,t){let r=n.slice();return r[2]=e[t],r}function IV(n){let e,t;return e=new CV({props:{plugin:n[1],image:n[2]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),i&1&&(a.image=r[2]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function gee(n){let e,t,r=ct(n[0]),i=[];for(let o=0;o<r.length;o+=1)i[o]=IV(FV(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){e=ee("div");for(let o=0;o<i.length;o+=1)i[o].c();q(e,"class","mb-image-card-grid")},m(o,u){J(o,e,u);for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(e,null);t=!0},p(o,[u]){if(u&3){r=ct(o[0]);let s;for(s=0;s<r.length;s+=1){let l=FV(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=IV(l),i[s].c(),j(i[s],1),i[s].m(e,null))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function vee(n,e,t){let{images:r=[]}=e,{plugin:i}=e;return n.$$set=a=>{"images"in a&&t(0,r=a.images),"plugin"in a&&t(1,i=a.plugin)},[r,i]}var FA=class extends Pe{constructor(e){super(),Be(this,e,vee,gee,ke,{images:0,plugin:1})}},IA=FA;var Ud=class extends Wa{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(r=>typeof r=="string"?r:!0);if(e.length!==1)throw new Go({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new Go({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new _a({errorLevel:"CRITICAL",effect:"failed to evaluate image view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?sn.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>sn.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new IA({target:e,props:{images:[],plugin:this.mountable.plugin}})}async onRerender(e,t){let r=sn.parseLinkList(t);this.component?.$destroy(),this.component=new IA({target:e,props:{images:r.map(i=>i.target),plugin:this.mountable.plugin}})}onUnmount(){super.onUnmount(),this.component?.$destroy()}};var qd=class{constructor(e){this.plugin=e}createViewField(e){let t=e.declaration.viewFieldType;if(t==="math")return new Ld(e);if(t==="text")return new Vd(e);if(t==="link")return new um(e);if(t==="image")return new Ud(e);}};var As=class n{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 r of this.path.slice(1))t=r.get(t.child);return t}tryGet(e){try{return this.get(e)}catch{return}}set(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);for(let i of this.path.slice(1))r=i.get(r.child);r.access.set(r.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);r.child===void 0&&(r.access.set(r.parent,this.getNextPathElementValue(0,t)),r=r.access.get(r.parent));for(let i=1;i<this.path.length;i++)r=this.path[i].get(r.child),r.child===void 0&&(r.access.set(r.parent,this.getNextPathElementValue(i,t)),r=r.access.get(r.parent));r.access.set(r.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let r=this.getNextPathElement(e);return r===void 0?t:r.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new n(this.path.concat(e.path))}compareDiffArray(e){let t=Math.min(this.path.length,e.length);for(let r=0;r<t;r++){let i=this.path[r],a=e[r];if(i.prop!==a.toString())return!1}return!0}};var zd=class{constructor(e){this.plugin=e}fromString(e){return Tn(za,e)}fromStringAndValidate(e,t,r){return this.validate(e,this.fromString(e),t,r)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:Li(e.storageType),storagePath:Li(e.storagePath),storageProp:e.storageProp.path.map(t=>({type:t.type,prop:Li(t.prop)})),listenToChildren:e.listenToChildren}}validate(e,t,r,i){let a={};a.listenToChildren=t.listenToChildren,a.storageProp=new As(t.storageProp.map(l=>new zs(l.type,l.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,u=t.storagePath??{value:r},s=this.plugin.metadataManager.getSource(a.storageType);if(s===void 0)throw new Ut({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=s.validateStoragePath(u,o,e,this),s.resolveBindTargetScope(a,i,this)}resolveScope(e,t){if(t===void 0)throw new _n("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 r of this.plugin.metadataManager.iterateSources())if(r===e.value)return r;throw new _n("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,t,e?.position)}validateStoragePathAsFilePath(e,t){let r=e?.value;if(r===void 0)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",t,e?.position);let i=this.plugin.internal.getFilePathByName(r);if(i===void 0)throw new _n("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${r}' not found.`,t,e?.position);return i}};var Bl=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(Zr))e[t]=0;for(let t of this.arguments){let r=t.getConfig();if(e[r.type]+=1,e[r.type]>1&&!r.allowMultiple)throw new Cr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${r.type}' does not allow duplicates`,docs:[qt.linkToSearch(r.type)]})}}mergeByOverride(e){for(let t of e.arguments){let r=t.getConfig();r.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==r.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let r=t.getConfig();if(!r.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===r.type).length>0)throw new Cr({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 $d=class extends Bl{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Ol=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(r=>r.length===e.length)===void 0)throw new Cr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(r=>r.length===0?"none":r.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[qt.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?"all":this.getConfig().allowedFieldTypes.join(", ")}};var dr=class extends Ol{};var Hd=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.addLabels}};var Gd=class extends dr{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return yr.class}};var Wd=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=Vi(t[0].value)}getConfig(){return yr.defaultValue}};var Yd=class extends dr{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.limit}};var jd=class extends dr{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.maxValue}};var Zd=class extends dr{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.minValue}};var Jd=class extends dr{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=Vi(t[0].value)}getConfig(){return yr.offValue}};var Xd=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=Vi(t[0].value)}getConfig(){return yr.onValue}};var Qd=class extends dr{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=Vi(t[0].value),this.name=t[0].value):t.length===2&&(this.value=Vi(t[0].value),this.name=t[1].value)}getConfig(){return yr.option}};var Kd=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.optionQuery}};var eh=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.placeholder}};var th=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.showcase}};var rh=class extends dr{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.stepSize}};var nh=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.title}};function PV(n,e,t){return t==="true"?`[[${n}|${e}]]`:t==="partial"?`[[${e}]]`:`${e}`}var ih=class extends dr{constructor(){super(...arguments);this.value="true"}_parseValue(t){let r=t[0]?.value.toLowerCase();if(r===void 0){this.value="true";return}if(r==="true"||r==="partial"||r==="false"){this.value=r;return}throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${xE(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.useLinks}};var ah=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.multiLine}};var oh=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.allowOther}};var kV={class:Gd,addLabels:Hd,minValue:Zd,maxValue:jd,stepSize:rh,option:Qd,title:nh,optionQuery:Kd,showcase:th,offValue:Jd,onValue:Xd,defaultValue:Wd,placeholder:eh,useLinks:ih,limit:Yd,allowOther:oh,multiLine:ah},sh=class{static createInputFieldArgument(e){if(e in kV){let t=kV[e];if(t)return new t}throw new wa({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var uh=class{constructor(e,t,r){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=r,this.errorCollection=new Gt("input field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:t,bindTarget:r,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(Ho))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new _n("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be an input field type but received '${e?.value}'.`,this.unvalidatedDeclaration.declarationString,e?.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.bindTarget!==void 0)try{return this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.bindTarget,this.filePath,e)}catch(t){this.errorCollection.add(t)}}validateArguments(e){let t=new $d;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=sh.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new _n("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.declarationString,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(Zr))if(t[1]===e.value)return t[1];return this.errorCollection.add(new _n("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var si=wr(Oi()),Gr=wr(Si());var bee=Gr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},jn.node(fi).trim(si.P_UTILS.optionalWhitespace()).describe("input field type"),dc.trim(si.P_UTILS.optionalWhitespace()).wrap(Gr.P.string("(").describe('arguments paren "("'),Gr.P.string(")").describe('arguments paren ")"')).trim(si.P_UTILS.optionalWhitespace()).optional([]),Gr.P.sequence(Gr.P.string(":").trim(si.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),za).trim(si.P_UTILS.optionalWhitespace()).optional()),BV=Gr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},jn.node(fi).trim(si.P_UTILS.optionalWhitespace()).optional().describe("input field type"),dc.trim(si.P_UTILS.optionalWhitespace()).wrap(Gr.P.string("(").describe('arguments paren "("'),Gr.P.string(")").describe('arguments paren ")"')).trim(si.P_UTILS.optionalWhitespace()).optional([]),Gr.P.sequence(Gr.P.string(":").trim(si.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),za).trim(si.P_UTILS.optionalWhitespace()).optional()),OV=Gr.P.or(Gr.P.sequenceMap((n,e,t)=>(t.templateName=e,t),Gr.P.string("INPUT"),Gr.P.sequenceMap((n,e,t)=>e,Gr.P.string("["),OE.node(fi).trim(si.P_UTILS.optionalWhitespace()).describe("template name"),Gr.P.string("]").skip(si.P_UTILS.optionalWhitespace())),BV.wrap(Gr.P.string("["),Gr.P.string("]")),si.P_UTILS.eof()),Gr.P.sequenceMap((n,e)=>e,Gr.P.string("INPUT"),bee.wrap(Gr.P.string("["),Gr.P.string("]")),si.P_UTILS.eof())),RV=Gr.P.sequenceMap((n,e)=>e,Gr.P.string("INPUT"),BV.wrap(Gr.P.string("["),Gr.P.string("]")),si.P_UTILS.eof());var lh=class{constructor(e){this.plugin=e,this.templates=[]}fromString(e){let t=new Gt("InputField");try{let r=Tn(OV,e),i=this.partialToFullDeclaration(r,e,t);return i=this.applyTemplate(i),i}catch(r){t.add(r)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}fromStringAndValidate(e,t,r){return this.validate(this.fromString(e),t,r)}fromSimpleDeclaration(e){let t=new Gt("InputField");return{declarationString:void 0,inputFieldType:Li(e.inputFieldType),bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(r=>({name:Li(r.name),value:r.value.map(i=>Li(i))})),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,r){return this.validate(this.fromSimpleDeclaration(e),t,r)}partialToFullDeclaration(e,t,r){return{...structuredClone(e),declarationString:t,errorCollection:r}}validate(e,t,r){return new uh(this.plugin,e,t).validate(r)}merge(e,t){let r;return e.bindTarget===void 0?r=t.bindTarget:(r=e.bindTarget,t.bindTarget?.storagePath!==void 0&&(r.storagePath=t.bindTarget.storagePath),t.bindTarget?.storageProp!==void 0&&(r.storageProp=t.bindTarget.storageProp)),{declarationString:t.declarationString,inputFieldType:t.inputFieldType??e.inputFieldType,bindTarget:r,arguments:t.arguments.concat(e.arguments).reduce((i,a)=>(i.find(o=>o.name===a.name)===void 0&&i.push(a),i),[]),errorCollection:new Gt("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}parseTemplateString(e){let t=new Gt("InputFieldParser");try{let r=Tn(RV,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new Gt("input field template parser");for(let r of e){let i=this.parseTemplateString(r.declaration);t.merge(i.errorCollection);let a={name:r.name,template:i};this.templates.push(Dg(a))}return t}getTemplate(e){return this.templates.find(t=>t.name===e)?.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 _n("WARNING","Input Field Parser",`Invalid template name. Could not find template with name '${e.templateName.value}'`,e.declarationString,e.templateName.position,["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/"])),e):this.merge(t,e)}};var ch=class extends Bl{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Ms=class extends Ol{};var fh=class extends Ms{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Ru.hidden}};var ph=class extends Ms{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Ru.renderMarkdown}};var mh=class extends Ms{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return Ru.class}};var LV={renderMarkdown:ph,hidden:fh,class:mh},dh=class{static createViewFieldArgument(e){if(e in LV){let t=LV[e];if(t)return new t}throw new wa({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var hh=class{constructor(e,t,r){this.unvalidatedDeclaration=e,this.plugin=r,this.filePath=t,this.errorCollection=new Gt("view field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:t,writeToBindTarget:r,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(sc))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new _n("ERROR","Declaration Validator",`Encountered invalid identifier. Expected token to be a view field type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}checkForDeprecation(e){}validateBindTarget(e){if(this.unvalidatedDeclaration.writeToBindTarget!==void 0)return this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,this.unvalidatedDeclaration.writeToBindTarget,this.filePath,e)}validateArguments(e){let t=new ch;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=dh.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new _n("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.declarationString,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(Vs))if(t[1]===e.value)return t[1];return this.errorCollection.add(new _n("WARNING","Declaration Validator",`Encountered invalid identifier. Expected identifier to be a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}validateTemplateDeclaration(e){try{return this.unvalidatedDeclaration.templateDeclaration?.map(t=>typeof t=="string"?t:this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,t,this.filePath,e))??[]}catch(t){return this.errorCollection.add(t),[]}}};var gh=class{constructor(e){this.plugin=e}fromString(e){let t=new Gt("ViewFieldDeclaration");try{let r=Tn(zE,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,t,r){return this.validate(this.fromString(e),t,r)}fromSimpleDeclaration(e){let t=new Gt("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(r=>typeof r=="string"?r:this.plugin.api.bindTargetParser.fromExistingDeclaration(r)),viewFieldType:Li(e.viewFieldType),arguments:(e.arguments??[]).map(r=>({name:Li(r.name),value:r.value.map(i=>Li(i))})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,r){return this.validate(this.fromSimpleDeclaration(e),t,r)}partialToFullDeclaration(e,t,r){return{...structuredClone(e),declarationString:t,errorCollection:r}}validate(e,t,r){return new hh(e,t,this.plugin).validate(r)}};var vh=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.depth=i,this.content=a}async parseContent(){let e=this.content.split(`
`).map(a=>a.trim()).filter(a=>a.length>0);if(e.length===0)return"";if(e.length>1)throw new Us({errorLevel:"ERROR",effect:"can not create embed",cause:"embed may only contain one link"});let t=e[0],r=sn.parseLink(t);if(!r.internal)throw new Us({errorLevel:"ERROR",effect:"can not create embed",cause:"embed link is not an internal link"});let i=this.plugin.internal.getFilePathByName(r.target,this.getFilePath());if(i===void 0)throw new Us({errorLevel:"ERROR",effect:"can not create embed",cause:"link target not found"});return await this.plugin.internal.readFilePath(i)}checkMaxDepth(){if(this.depth>qf)throw new Us({errorLevel:"ERROR",effect:"can not create embed",cause:"embed depth exceeds maximum"})}async renderContent(e){try{this.checkMaxDepth();let r=(await this.parseContent()).replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.plugin.internal.renderMarkdown(r,e,this.getFilePath())}catch(t){let r=new Gt("Embed");r.add(t),this.plugin.internal.createErrorIndicator(e,{errorCollection:r})}}onMount(e){console.debug("meta-bind | EmbedMountable >> mount",this.content),super.onMount(e),this.renderContent(e)}onUnmount(e){console.debug("meta-bind | EmbedMountable >> unmount",this.content),super.onUnmount(e),this.markdownUnloadCallback?.(),Wn(e,"Embed")}};var yh=class extends An{constructor(e,t,r){super(e,t,r)}onMount(e){console.debug("meta-bind | ExcludedMountable >> mount"),super.onMount(e),mt.empty(e),mt.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){console.debug("meta-bind | ExcludedMountable >> unmount"),super.onUnmount(e),mt.empty(e),Wn(e,"Excluded")}};var e5=wr(Oi()),df=wr(Si());var Dr;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},n.getValidEnumValues=i=>{let a=n.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),o={};for(let u of a)o[u]=i[u];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(a){return i[a]}),n.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},n.find=(i,a)=>{for(let o of i)if(a(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}n.joinValues=r,n.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Dr||(Dr={}));var kA;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(kA||(kA={}));var dt=Dr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Es=n=>{switch(typeof n){case"undefined":return dt.undefined;case"string":return dt.string;case"number":return isNaN(n)?dt.nan:dt.number;case"boolean":return dt.boolean;case"function":return dt.function;case"bigint":return dt.bigint;case"symbol":return dt.symbol;case"object":return Array.isArray(n)?dt.array:n===null?dt.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?dt.promise:typeof Map<"u"&&n instanceof Map?dt.map:typeof Set<"u"&&n instanceof Set?dt.set:typeof Date<"u"&&n instanceof Date?dt.date:dt.object;default:return dt.unknown}},it=Dr.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"]),xee=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ji=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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},r={_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)r._errors.push(t(o));else{let u=r,s=0;for(;s<o.path.length;){let l=o.path[s];s===o.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(t(o))):u[l]=u[l]||{_errors:[]},u=u[l],s++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];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))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ji.create=n=>new ji(n);var cf=(n,e)=>{let t;switch(n.code){case it.invalid_type:n.received===dt.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case it.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Dr.jsonStringifyReplacer)}`;break;case it.unrecognized_keys:t=`Unrecognized key(s) in object: ${Dr.joinValues(n.keys,", ")}`;break;case it.invalid_union:t="Invalid input";break;case it.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Dr.joinValues(n.options)}`;break;case it.invalid_enum_value:t=`Invalid enum value. Expected ${Dr.joinValues(n.options)}, received '${n.received}'`;break;case it.invalid_arguments:t="Invalid function arguments";break;case it.invalid_return_type:t="Invalid function return type";break;case it.invalid_date:t="Invalid date";break;case it.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Dr.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case it.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case it.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case it.custom:t="Invalid input";break;case it.invalid_intersection_types:t="Intersection results could not be merged";break;case it.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case it.not_finite:t="Number must be finite";break;default:t=e.defaultError,Dr.assertNever(n)}return{message:t}},qV=cf;function wee(n){qV=n}function xh(){return qV}var wh=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,a=[...t,...i.path||[]],o={...i,path:a},u="",s=r.filter(l=>!!l).slice().reverse();for(let l of s)u=l(o,{data:e,defaultError:u}).message;return{...i,path:a,message:i.message||u}},_ee=[];function wt(n,e){let t=wh({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xh(),cf].filter(r=>!!r)});n.common.issues.push(t)}var ui=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ir;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t)r.push({key:await i.key,value:await i.value});return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return ir;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},ir=Object.freeze({status:"aborted"}),zV=n=>({status:"dirty",value:n}),yi=n=>({status:"valid",value:n}),BA=n=>n.status==="aborted",OA=n=>n.status==="dirty",ff=n=>n.status==="valid",_h=n=>typeof Promise<"u"&&n instanceof Promise,Pt;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Pt||(Pt={}));var ga=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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}},VV=(n,e)=>{if(ff(e))return{success:!0,data:e.value};if(!n.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 ji(n.common.issues);return this._error=t,this._error}}};function or(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))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,u)=>o.code!=="invalid_type"?{message:u.defaultError}:typeof u.data>"u"?{message:r??u.defaultError}:{message:t??u.defaultError},description:i}}var sr=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 Es(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Es(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ui,ctx:{common:e.parent.common,data:e.data,parsedType:Es(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(_h(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let i={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Es(e)},a=this._parseSync({data:e,path:i.path,parent:i});return VV(i,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Es(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(_h(i)?i:Promise.resolve(i));return VV(r,a)}refine(e,t){let r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{let o=e(i),u=()=>a.addIssue({code:it.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(s=>s?!0:(u(),!1)):o?!0:(u(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new Zi({schema:this,typeName:$t.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ra.create(this,this._def)}nullable(){return Bo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ko.create(this,this._def)}promise(){return Ts.create(this,this._def)}or(e){return vu.create([this,e],this._def)}and(e){return yu.create(this,e,this._def)}transform(e){return new Zi({...or(this._def),schema:this,typeName:$t.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Su({...or(this._def),innerType:this,defaultValue:t,typeName:$t.ZodDefault})}brand(){return new Eh({typeName:$t.ZodBranded,type:this,...or(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new zl({...or(this._def),innerType:this,catchValue:t,typeName:$t.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pf.create(this,e)}readonly(){return Hl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},See=/^c[^\s-]{8,}$/i,Aee=/^[a-z][a-z0-9]*$/,Mee=/^[0-9A-HJKMNP-TV-Z]{26}$/,Eee=/^[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,Dee=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nee="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",PA,Tee=/^(((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}))$/,Cee=/^(([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})))$/,Fee=n=>n.precision?n.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`):n.precision===0?n.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$"):n.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 Iee(n,e){return!!((e==="v4"||!e)&&Tee.test(n)||(e==="v6"||!e)&&Cee.test(n))}var Ds=class n extends sr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dt.string){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.string,received:a.parsedType}),ir}let r=new ui,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,u=e.data.length<a.value;(o||u)&&(i=this._getOrReturnCtx(e,i),o?wt(i,{code:it.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&wt(i,{code:it.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Dee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"email",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")PA||(PA=new RegExp(Nee,"u")),PA.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"emoji",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Eee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"uuid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")See.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"cuid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Aee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"cuid2",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Mee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"ulid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),wt(i,{validation:"url",code:it.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"regex",code:it.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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),wt(i,{code:it.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Fee(a).test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="ip"?Iee(e.data,a.version)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"ip",code:it.invalid_string,message:a.message}),r.dirty()):Dr.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:it.invalid_string,...Pt.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Pt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pt.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?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Pt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Pt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Pt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Pt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Pt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Pt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Pt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Pt.errToObj(t)})}nonempty(e){return this.min(1,Pt.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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}};Ds.create=n=>{var e;return new Ds({checks:[],typeName:$t.ZodString,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...or(n)})};function Pee(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,a=parseInt(n.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var fu=class n extends sr{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)!==dt.number){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.number,received:a.parsedType}),ir}let r,i=new ui;for(let a of this._def.checks)a.kind==="int"?Dr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),wt(r,{code:it.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.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)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Pee(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_finite,message:a.message}),i.dirty()):Dr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pt.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Pt.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Pt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Pt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pt.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"&&Dr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};fu.create=n=>new fu({checks:[],typeName:$t.ZodNumber,coerce:n?.coerce||!1,...or(n)});var pu=class n extends sr{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)!==dt.bigint){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.bigint,received:a.parsedType}),ir}let r,i=new ui;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.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)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Dr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pt.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Pt.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pt.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}};pu.create=n=>{var e;return new pu({checks:[],typeName:$t.ZodBigInt,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...or(n)})};var mu=class extends sr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dt.boolean){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.boolean,received:r.parsedType}),ir}return yi(e.data)}};mu.create=n=>new mu({typeName:$t.ZodBoolean,coerce:n?.coerce||!1,...or(n)});var du=class n extends sr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dt.date){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.date,received:a.parsedType}),ir}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_date}),ir}let r=new ui,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Dr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Pt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Pt.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}};du.create=n=>new du({checks:[],coerce:n?.coerce||!1,typeName:$t.ZodDate,...or(n)});var Ll=class extends sr{_parse(e){if(this._getType(e)!==dt.symbol){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.symbol,received:r.parsedType}),ir}return yi(e.data)}};Ll.create=n=>new Ll({typeName:$t.ZodSymbol,...or(n)});var hu=class extends sr{_parse(e){if(this._getType(e)!==dt.undefined){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.undefined,received:r.parsedType}),ir}return yi(e.data)}};hu.create=n=>new hu({typeName:$t.ZodUndefined,...or(n)});var gu=class extends sr{_parse(e){if(this._getType(e)!==dt.null){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.null,received:r.parsedType}),ir}return yi(e.data)}};gu.create=n=>new gu({typeName:$t.ZodNull,...or(n)});var Ns=class extends sr{constructor(){super(...arguments),this._any=!0}_parse(e){return yi(e.data)}};Ns.create=n=>new Ns({typeName:$t.ZodAny,...or(n)});var Po=class extends sr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yi(e.data)}};Po.create=n=>new Po({typeName:$t.ZodUnknown,...or(n)});var La=class extends sr{_parse(e){let t=this._getOrReturnCtx(e);return wt(t,{code:it.invalid_type,expected:dt.never,received:t.parsedType}),ir}};La.create=n=>new La({typeName:$t.ZodNever,...or(n)});var Vl=class extends sr{_parse(e){if(this._getType(e)!==dt.undefined){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.void,received:r.parsedType}),ir}return yi(e.data)}};Vl.create=n=>new Vl({typeName:$t.ZodVoid,...or(n)});var ko=class n extends sr{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==dt.array)return wt(t,{code:it.invalid_type,expected:dt.array,received:t.parsedType}),ir;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(o||u)&&(wt(t,{code:o?it.too_big:it.too_small,minimum:u?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(wt(t,{code:it.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(wt(t,{code:it.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,u)=>i.type._parseAsync(new ga(t,o,t.path,u)))).then(o=>ui.mergeArray(r,o));let a=[...t.data].map((o,u)=>i.type._parseSync(new ga(t,o,t.path,u)));return ui.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:Pt.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:Pt.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:Pt.toString(t)}})}nonempty(e){return this.min(1,e)}};ko.create=(n,e)=>new ko({type:n,minLength:null,maxLength:null,exactLength:null,typeName:$t.ZodArray,...or(e)});function Rl(n){if(n instanceof Fi){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=Ra.create(Rl(r))}return new Fi({...n._def,shape:()=>e})}else return n instanceof ko?new ko({...n._def,type:Rl(n.element)}):n instanceof Ra?Ra.create(Rl(n.unwrap())):n instanceof Bo?Bo.create(Rl(n.unwrap())):n instanceof to?to.create(n.items.map(e=>Rl(e))):n}var Fi=class n extends sr{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=Dr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==dt.object){let l=this._getOrReturnCtx(e);return wt(l,{code:it.invalid_type,expected:dt.object,received:l.parsedType}),ir}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),u=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||u.push(l);let s=[];for(let l of o){let c=a[l],f=i.data[l];s.push({key:{status:"valid",value:l},value:c._parse(new ga(i,f,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof La){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of u)s.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(l==="strict")u.length>0&&(wt(i,{code:it.unrecognized_keys,keys:u}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of u){let f=i.data[c];s.push({key:{status:"valid",value:c},value:l._parse(new ga(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of s){let f=await c.key;l.push({key:f,value:await c.value,alwaysSet:c.alwaysSet})}return l}).then(l=>ui.mergeObjectSync(r,l)):ui.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(e){return Pt.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,a,o,u;let s=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(u=Pt.errToObj(e).message)!==null&&u!==void 0?u:s}:{message:s}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$t.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};return Dr.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}omit(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}deepPartial(){return Rl(this)}partial(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new n({...this._def,shape:()=>t})}required(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Ra;)a=a._def.innerType;t[r]=a}}),new n({...this._def,shape:()=>t})}keyof(){return $V(Dr.objectKeys(this.shape))}};Fi.create=(n,e)=>new Fi({shape:()=>n,unknownKeys:"strip",catchall:La.create(),typeName:$t.ZodObject,...or(e)});Fi.strictCreate=(n,e)=>new Fi({shape:()=>n,unknownKeys:"strict",catchall:La.create(),typeName:$t.ZodObject,...or(e)});Fi.lazycreate=(n,e)=>new Fi({shape:n,unknownKeys:"strip",catchall:La.create(),typeName:$t.ZodObject,...or(e)});var vu=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(a){for(let u of a)if(u.result.status==="valid")return u.result;for(let u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let o=a.map(u=>new ji(u.ctx.common.issues));return wt(t,{code:it.invalid_union,unionErrors:o}),ir}if(t.common.async)return Promise.all(r.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 s of r){let l={...t,common:{...t.common,issues:[]},parent:null},c=s._parseSync({data:t.data,path:t.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let u=o.map(s=>new ji(s));return wt(t,{code:it.invalid_union,unionErrors:u}),ir}}get options(){return this._def.options}};vu.create=(n,e)=>new vu({options:n,typeName:$t.ZodUnion,...or(e)});var bh=n=>n instanceof bu?bh(n.schema):n instanceof Zi?bh(n.innerType()):n instanceof xu?[n.value]:n instanceof wu?n.options:n instanceof _u?Object.keys(n.enum):n instanceof Su?bh(n._def.innerType):n instanceof hu?[void 0]:n instanceof gu?[null]:null,Sh=class n extends sr{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.object)return wt(t,{code:it.invalid_type,expected:dt.object,received:t.parsedType}),ir;let r=this.discriminator,i=t.data[r],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}):(wt(t,{code:it.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ir)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let a of t){let o=bh(a.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of o){if(i.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);i.set(u,a)}}return new n({typeName:$t.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...or(r)})}};function RA(n,e){let t=Es(n),r=Es(e);if(n===e)return{valid:!0,data:n};if(t===dt.object&&r===dt.object){let i=Dr.objectKeys(e),a=Dr.objectKeys(n).filter(u=>i.indexOf(u)!==-1),o={...n,...e};for(let u of a){let s=RA(n[u],e[u]);if(!s.valid)return{valid:!1};o[u]=s.data}return{valid:!0,data:o}}else if(t===dt.array&&r===dt.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<n.length;a++){let o=n[a],u=e[a],s=RA(o,u);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}else return t===dt.date&&r===dt.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var yu=class extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(BA(a)||BA(o))return ir;let u=RA(a.value,o.value);return u.valid?((OA(a)||OA(o))&&t.dirty(),{status:t.value,value:u.data}):(wt(r,{code:it.invalid_intersection_types}),ir)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};yu.create=(n,e,t)=>new yu({left:n,right:e,typeName:$t.ZodIntersection,...or(t)});var to=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.array)return wt(r,{code:it.invalid_type,expected:dt.array,received:r.parsedType}),ir;if(r.data.length<this._def.items.length)return wt(r,{code:it.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ir;!this._def.rest&&r.data.length>this._def.items.length&&(wt(r,{code:it.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((o,u)=>{let s=this._def.items[u]||this._def.rest;return s?s._parse(new ga(r,o,r.path,u)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>ui.mergeArray(t,o)):ui.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};to.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new to({items:n,typeName:$t.ZodTuple,rest:null,...or(e)})};var Ah=class n extends sr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.object)return wt(r,{code:it.invalid_type,expected:dt.object,received:r.parsedType}),ir;let i=[],a=this._def.keyType,o=this._def.valueType;for(let u in r.data)i.push({key:a._parse(new ga(r,u,r.path,u)),value:o._parse(new ga(r,r.data[u],r.path,u))});return r.common.async?ui.mergeObjectAsync(t,i):ui.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof sr?new n({keyType:e,valueType:t,typeName:$t.ZodRecord,...or(r)}):new n({keyType:Ds.create(),valueType:e,typeName:$t.ZodRecord,...or(t)})}},Ul=class extends sr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.map)return wt(r,{code:it.invalid_type,expected:dt.map,received:r.parsedType}),ir;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([u,s],l)=>({key:i._parse(new ga(r,u,r.path,[l,"key"])),value:a._parse(new ga(r,s,r.path,[l,"value"]))}));if(r.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let s of o){let l=await s.key,c=await s.value;if(l.status==="aborted"||c.status==="aborted")return ir;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),u.set(l.value,c.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let s of o){let l=s.key,c=s.value;if(l.status==="aborted"||c.status==="aborted")return ir;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),u.set(l.value,c.value)}return{status:t.value,value:u}}}};Ul.create=(n,e,t)=>new Ul({valueType:e,keyType:n,typeName:$t.ZodMap,...or(t)});var ql=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.set)return wt(r,{code:it.invalid_type,expected:dt.set,received:r.parsedType}),ir;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(wt(r,{code:it.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(wt(r,{code:it.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(s){let l=new Set;for(let c of s){if(c.status==="aborted")return ir;c.status==="dirty"&&t.dirty(),l.add(c.value)}return{status:t.value,value:l}}let u=[...r.data.values()].map((s,l)=>a._parse(new ga(r,s,r.path,l)));return r.common.async?Promise.all(u).then(s=>o(s)):o(u)}min(e,t){return new n({...this._def,minSize:{value:e,message:Pt.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:Pt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ql.create=(n,e)=>new ql({valueType:n,minSize:null,maxSize:null,typeName:$t.ZodSet,...or(e)});var Mh=class n extends sr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.function)return wt(t,{code:it.invalid_type,expected:dt.function,received:t.parsedType}),ir;function r(u,s){return wh({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xh(),cf].filter(l=>!!l),issueData:{code:it.invalid_arguments,argumentsError:s}})}function i(u,s){return wh({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xh(),cf].filter(l=>!!l),issueData:{code:it.invalid_return_type,returnTypeError:s}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ts){let u=this;return yi(async function(...s){let l=new ji([]),c=await u._def.args.parseAsync(s,a).catch(m=>{throw l.addIssue(r(s,m)),l}),f=await Reflect.apply(o,this,c);return await u._def.returns._def.type.parseAsync(f,a).catch(m=>{throw l.addIssue(i(f,m)),l})})}else{let u=this;return yi(function(...s){let l=u._def.args.safeParse(s,a);if(!l.success)throw new ji([r(s,l.error)]);let c=Reflect.apply(o,this,l.data),f=u._def.returns.safeParse(c,a);if(!f.success)throw new ji([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:to.create(e).rest(Po.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||to.create([]).rest(Po.create()),returns:t||Po.create(),typeName:$t.ZodFunction,...or(r)})}},bu=class extends sr{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})}};bu.create=(n,e)=>new bu({getter:n,typeName:$t.ZodLazy,...or(e)});var xu=class extends sr{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return wt(t,{received:t.data,code:it.invalid_literal,expected:this._def.value}),ir}return{status:"valid",value:e.data}}get value(){return this._def.value}};xu.create=(n,e)=>new xu({value:n,typeName:$t.ZodLiteral,...or(e)});function $V(n,e){return new wu({values:n,typeName:$t.ZodEnum,...or(e)})}var wu=class n extends sr{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return wt(t,{expected:Dr.joinValues(r),received:t.parsedType,code:it.invalid_type}),ir}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return wt(t,{received:t.data,code:it.invalid_enum_value,options:r}),ir}return yi(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 n.create(e)}exclude(e){return n.create(this.options.filter(t=>!e.includes(t)))}};wu.create=$V;var _u=class extends sr{_parse(e){let t=Dr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==dt.string&&r.parsedType!==dt.number){let i=Dr.objectValues(t);return wt(r,{expected:Dr.joinValues(i),received:r.parsedType,code:it.invalid_type}),ir}if(t.indexOf(e.data)===-1){let i=Dr.objectValues(t);return wt(r,{received:r.data,code:it.invalid_enum_value,options:i}),ir}return yi(e.data)}get enum(){return this._def.values}};_u.create=(n,e)=>new _u({values:n,typeName:$t.ZodNativeEnum,...or(e)});var Ts=class extends sr{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.promise&&t.common.async===!1)return wt(t,{code:it.invalid_type,expected:dt.promise,received:t.parsedType}),ir;let r=t.parsedType===dt.promise?t.data:Promise.resolve(t.data);return yi(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ts.create=(n,e)=>new Ts({type:n,typeName:$t.ZodPromise,...or(e)});var Zi=class extends sr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$t.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{wt(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(o).then(u=>this._def.schema._parseAsync({data:u,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}if(i.type==="refinement"){let o=u=>{let s=i.refinement(u,a);if(r.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?ir:(u.status==="dirty"&&t.dirty(),o(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?ir:(u.status==="dirty"&&t.dirty(),o(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ff(o))return o;let u=i.transform(o.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ff(o)?Promise.resolve(i.transform(o.value,a)).then(u=>({status:t.value,value:u})):o);Dr.assertNever(i)}};Zi.create=(n,e,t)=>new Zi({schema:n,typeName:$t.ZodEffects,effect:e,...or(t)});Zi.createWithPreprocess=(n,e,t)=>new Zi({schema:e,effect:{type:"preprocess",transform:n},typeName:$t.ZodEffects,...or(t)});var Ra=class extends sr{_parse(e){return this._getType(e)===dt.undefined?yi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ra.create=(n,e)=>new Ra({innerType:n,typeName:$t.ZodOptional,...or(e)});var Bo=class extends sr{_parse(e){return this._getType(e)===dt.null?yi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bo.create=(n,e)=>new Bo({innerType:n,typeName:$t.ZodNullable,...or(e)});var Su=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===dt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Su.create=(n,e)=>new Su({innerType:n,typeName:$t.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...or(e)});var zl=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return _h(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ji(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ji(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};zl.create=(n,e)=>new zl({innerType:n,typeName:$t.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...or(e)});var $l=class extends sr{_parse(e){if(this._getType(e)!==dt.nan){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.nan,received:r.parsedType}),ir}return{status:"valid",value:e.data}}};$l.create=n=>new $l({typeName:$t.ZodNaN,...or(n)});var kee=Symbol("zod_brand"),Eh=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},pf=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ir:a.status==="dirty"?(t.dirty(),zV(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ir:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:$t.ZodPipeline})}},Hl=class extends sr{_parse(e){let t=this._def.innerType._parse(e);return ff(t)&&(t.value=Object.freeze(t.value)),t}};Hl.create=(n,e)=>new Hl({innerType:n,typeName:$t.ZodReadonly,...or(e)});var HV=(n,e={},t)=>n?Ns.create().superRefine((r,i)=>{var a,o;if(!n(r)){let u=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,s=(o=(a=u.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0,l=typeof u=="string"?{message:u}:u;i.addIssue({code:"custom",...l,fatal:s})}}):Ns.create(),Bee={object:Fi.lazycreate},$t;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})($t||($t={}));var Oee=(n,e={message:`Input not instance of ${n.name}`})=>HV(t=>t instanceof n,e),GV=Ds.create,WV=fu.create,Ree=$l.create,Lee=pu.create,YV=mu.create,Vee=du.create,Uee=Ll.create,qee=hu.create,zee=gu.create,$ee=Ns.create,Hee=Po.create,Gee=La.create,Wee=Vl.create,Yee=ko.create,jee=Fi.create,Zee=Fi.strictCreate,Jee=vu.create,Xee=Sh.create,Qee=yu.create,Kee=to.create,ete=Ah.create,tte=Ul.create,rte=ql.create,nte=Mh.create,ite=bu.create,ate=xu.create,ote=wu.create,ste=_u.create,ute=Ts.create,UV=Zi.create,lte=Ra.create,cte=Bo.create,fte=Zi.createWithPreprocess,pte=pf.create,mte=()=>GV().optional(),dte=()=>WV().optional(),hte=()=>YV().optional(),gte={string:n=>Ds.create({...n,coerce:!0}),number:n=>fu.create({...n,coerce:!0}),boolean:n=>mu.create({...n,coerce:!0}),bigint:n=>pu.create({...n,coerce:!0}),date:n=>du.create({...n,coerce:!0})},vte=ir,pe=Object.freeze({__proto__:null,defaultErrorMap:cf,setErrorMap:wee,getErrorMap:xh,makeIssue:wh,EMPTY_PATH:_ee,addIssueToContext:wt,ParseStatus:ui,INVALID:ir,DIRTY:zV,OK:yi,isAborted:BA,isDirty:OA,isValid:ff,isAsync:_h,get util(){return Dr},get objectUtil(){return kA},ZodParsedType:dt,getParsedType:Es,ZodType:sr,ZodString:Ds,ZodNumber:fu,ZodBigInt:pu,ZodBoolean:mu,ZodDate:du,ZodSymbol:Ll,ZodUndefined:hu,ZodNull:gu,ZodAny:Ns,ZodUnknown:Po,ZodNever:La,ZodVoid:Vl,ZodArray:ko,ZodObject:Fi,ZodUnion:vu,ZodDiscriminatedUnion:Sh,ZodIntersection:yu,ZodTuple:to,ZodRecord:Ah,ZodMap:Ul,ZodSet:ql,ZodFunction:Mh,ZodLazy:bu,ZodLiteral:xu,ZodEnum:wu,ZodNativeEnum:_u,ZodPromise:Ts,ZodEffects:Zi,ZodTransformer:Zi,ZodOptional:Ra,ZodNullable:Bo,ZodDefault:Su,ZodCatch:zl,ZodNaN:$l,BRAND:kee,ZodBranded:Eh,ZodPipeline:pf,ZodReadonly:Hl,custom:HV,Schema:sr,ZodSchema:sr,late:Bee,get ZodFirstPartyTypeKind(){return $t},coerce:gte,any:$ee,array:Yee,bigint:Lee,boolean:YV,date:Vee,discriminatedUnion:Xee,effect:UV,enum:ote,function:nte,instanceof:Oee,intersection:Qee,lazy:ite,literal:ate,map:tte,nan:Ree,nativeEnum:ste,never:Gee,null:zee,nullable:cte,number:WV,object:jee,oboolean:hte,onumber:dte,optional:lte,ostring:mte,pipeline:pte,preprocess:fte,promise:ute,record:ete,set:rte,strictObject:Zee,string:GV,symbol:Uee,transformer:UV,tuple:Kee,undefined:qee,union:Jee,unknown:Hee,void:Wee,NEVER:vte,ZodIssueCode:it,quotelessJson:xee,ZodError:ji});function jV(n,e){return(t,r)=>t[n]===void 0==(t[e]===void 0)?(r.addIssue({code:pe.ZodIssueCode.custom,message:`Either ${n} or ${e} must be filled, but not both`}),!1):!0}function Lt(){return function(n){return n}}function Qr(n,e){let t=n.safeParse(e);if(!t.success)throw new Ut({errorLevel:"CRITICAL",effect:"invalid arguments supplied to function",cause:t.error})}var yte=Lt()(pe.object({type:pe.literal("command"),command:pe.string()})),bte=Lt()(pe.object({type:pe.literal("js"),file:pe.string(),args:pe.record(pe.unknown()).optional()})),xte=Lt()(pe.object({type:pe.literal("open"),link:pe.string(),newTab:pe.boolean().optional()})),wte=Lt()(pe.object({type:pe.literal("input"),str:pe.string()})),_te=Lt()(pe.object({type:pe.literal("sleep"),ms:pe.number()})),Ste=Lt()(pe.object({type:pe.literal("templaterCreateNote"),templateFile:pe.string(),folderPath:pe.string().optional(),fileName:pe.string().optional(),openNote:pe.boolean().optional()})),Ate=Lt()(pe.object({type:pe.literal("updateMetadata"),bindTarget:pe.string(),evaluate:pe.boolean(),value:pe.coerce.string()})),Mte=Lt()(pe.object({type:pe.literal("createNote"),folderPath:pe.string().optional(),fileName:pe.string(),openNote:pe.boolean().optional()})),Ete=Lt()(pe.object({type:pe.literal("replaceInNote"),fromLine:pe.number(),toLine:pe.number(),replacement:pe.string(),templater:pe.boolean().optional()})),Dte=Lt()(pe.object({type:pe.literal("replaceSelf"),replacement:pe.string(),templater:pe.boolean().optional()})),Nte=Lt()(pe.object({type:pe.literal("regexpReplaceInNote"),regexp:pe.string(),replacement:pe.string()})),Tte=Lt()(pe.object({type:pe.literal("insertIntoNote"),line:pe.number(),value:pe.string(),templater:pe.boolean().optional()})),Cte=Lt()(pe.object({type:pe.literal("inlineJS"),code:pe.string()})),ZV=Lt()(pe.union([yte,bte,xte,wte,_te,Ste,Ate,Mte,Ete,Dte,Nte,Tte,Cte])),Fte=pe.nativeEnum(hn),Gl=Lt()(pe.object({label:pe.string(),icon:pe.string().optional(),style:Fte,class:pe.string().optional(),tooltip:pe.string().optional(),id:pe.string().optional(),hidden:pe.boolean().optional(),action:ZV.optional(),actions:ZV.array().optional()}).superRefine(jV("action","actions")));var Ite=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function JV(n){return n.length===1?n[0].toString():n.reduce((e,t)=>{if(typeof t=="number")return e+"["+t.toString()+"]";if(t.includes('"'))return e+'["'+Pte(t)+'"]';if(!Ite.test(t))return e+'["'+t+'"]';let r=e.length===0?"":".";return e+r+t},"")}function Pte(n){return n.replace(/"/g,'\\"')}function XV(n){return n.length!==0}var kte=99,Bte="; ",Ote=", or ",QV="Validation error",Rte=": ",Dh=class extends Error{details;name;constructor(e,t=[]){super(e),this.details=t,this.name="ZodValidationError"}toString(){return this.message}};function KV(n){let{issue:e,issueSeparator:t,unionSeparator:r,includePath:i}=n;if(e.code==="invalid_union")return e.unionErrors.reduce((a,o)=>{let u=o.issues.map(s=>KV({issue:s,issueSeparator:t,unionSeparator:r,includePath:i})).join(t);return a.includes(u)||a.push(u),a},[]).join(r);if(i&&XV(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 "${JV(e.path)}"`}return e.message}function Lte(n,e,t){return e!==null?n.length>0?[e,n].join(t):e:n.length>0?n:QV}function mf(n,e={}){let{maxIssuesInMessage:t=kte,issueSeparator:r=Bte,unionSeparator:i=Ote,prefixSeparator:a=Rte,prefix:o=QV,includePath:u=!0}=e,s=n.errors.slice(0,t).map(c=>KV({issue:c,issueSeparator:r,unionSeparator:i,includePath:u})).join(r),l=Lte(s,o,a);return new Dh(l,n.errors)}var Vte=df.P.sequenceMap((n,e)=>e,df.P.string("BUTTON"),df.P.manyNotOf("[],^").separateBy(df.P.string(",").trim(e5.P_UTILS.optionalWhitespace())).wrapString("[","]")),Nh=class{constructor(e){this.plugin=e}fromGroupString(e){let t=new Gt("ButtonGroup"),r=[];try{r=Tn(Vte,e)}catch(i){t.add(i)}return{declarationString:e,referencedButtonIds:r,errorCollection:t}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Gt("ButtonGroup")}}fromString(e){let t=new Gt("Button"),r;try{let i=this.plugin.internal.parseYaml(e);r=this.validateConfig(i)}catch(i){t.add(i)}return{declarationString:e,config:r,errorCollection:t}}validateConfig(e){let t=Gl.safeParse(e);if(!t.success){let r=mf(t.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});throw new vo({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:r.message,docs:[qt.linkToButtonConfig()]})}return t.data}validate(e){let t=new Gt("Button"),r;try{r=this.validateConfig(e)}catch(i){t.add(i)}return{declarationString:void 0,config:r,errorCollection:t}}};var Th=class{constructor(e){this.plugin=e}fromString(e){let t=new Gt("JsViewFieldDeclaration");try{let r=Tn($E,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,errorCollection:t,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}fromStringAndValidate(e,t){return this.validate(this.fromString(e),t)}fromSimpleDeclaration(e){let t=new Gt("JsViewFieldDeclaration");return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(r=>({bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(r.bindTarget),name:r.name})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),hidden:e.hidden??!1,errorCollection:t}}fromSimpleDeclarationAndValidate(e,t){return this.validate(this.fromSimpleDeclaration(e),t)}partialToFullDeclaration(e,t,r){let i=e;return i.declarationString=t,i.errorCollection=r,i.bindTargetMappings=[...i.bindTargetMappings],i}validate(e,t){let r={};r.declarationString=e.declarationString,r.errorCollection=e.errorCollection;try{return r.bindTargetMappings=e.bindTargetMappings.map(i=>({bindTarget:this.plugin.api.bindTargetParser.validate(e.declarationString,i.bindTarget,t),name:i.name})),e.writeToBindTarget!==void 0&&(r.writeToBindTarget=this.plugin.api.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,t)),r.code=e.code,r.hidden=e.hidden,r}catch(i){r.errorCollection.add(i)}return{declarationString:e.declarationString,errorCollection:r.errorCollection,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}};function Ch(n){return new As(n.map(e=>QE.tryParse(e).success?new zs("array",e):new zs("object",e)))}var Wl=class{constructor(e){this.scope=e}};var Xi=Lt()(pe.string()),Yl=Lt()(pe.nativeEnum(mi)),hf=Lt()(pe.nativeEnum(ju)),r5=Lt()(pe.nativeEnum(Ho)),n5=Lt()(pe.instanceof(HTMLElement)),jl=Lt()(pe.instanceof(Wl)),fXe=Lt()(pe.instanceof(Lr)),pXe=Lt()(pe.function().args().returns(pe.void())),mXe=Lt()(pe.instanceof(An)),i5=Lt()(pe.instanceof(Zn)),a5=Lt()(pe.instanceof(Wo)),t5=Lt()(pe.object({index:pe.number(),line:pe.number(),column:pe.number()})),Ute=Lt()(pe.object({from:t5,to:t5})),Cs=Lt()(pe.object({value:pe.string(),position:Ute.optional()})),o5=Lt()(pe.object({name:Cs,value:Cs.array()})),qte=Lt()(pe.object({type:pe.nativeEnum($s),prop:Cs})),LA=Lt()(pe.object({storageType:Cs.optional(),storagePath:Cs.optional(),storageProp:qte.array(),listenToChildren:pe.boolean()})),dXe=Lt()(pe.object({declarationString:pe.string().optional(),inputFieldType:Cs.optional(),templateName:Cs.optional(),bindTarget:LA.optional(),arguments:o5.array(),errorCollection:pe.instanceof(Gt)})),hXe=Lt()(pe.object({declarationString:pe.string().optional(),templateDeclaration:pe.array(pe.union([pe.string(),LA])).optional(),viewFieldType:Cs.optional(),arguments:o5.array(),writeToBindTarget:LA.optional(),errorCollection:pe.instanceof(Gt)})),Ji=Lt()(pe.object({storageType:pe.string(),storagePath:pe.string(),storageProp:pe.instanceof(As),listenToChildren:pe.boolean()})),s5=Lt()(pe.object({name:pe.string(),value:pe.string().array()})),gXe=Lt()(pe.object({type:pe.nativeEnum($s),prop:pe.string()})),u5=Lt()(pe.object({inputFieldType:r5.optional(),templateName:pe.string().optional(),bindTarget:Ji.optional(),arguments:s5.array().optional()})),l5=Lt()(pe.object({viewFieldType:r5.optional(),templateDeclaration:pe.union([pe.string(),Ji]).array().optional(),arguments:s5.array().optional(),writeToBindTarget:Ji.optional()})),zte=Lt()(pe.object({bindTarget:Ji,name:pe.string()})),$te=Lt()(pe.object({bindTargetMappings:zte.array(),writeToBindTarget:Ji.optional(),code:pe.string()})),Hte=Lt()(pe.object({referencedButtonIds:pe.string().array()})),c5=Lt()(pe.object({renderChildType:Yl,declaration:pe.union([pe.string(),u5]),scope:jl.optional()})),f5=Lt()(pe.object({renderChildType:Yl,declaration:pe.union([pe.string(),l5]),scope:jl.optional()})),p5=Lt()(pe.object({declaration:pe.union([pe.string(),$te])})),m5=Lt()(pe.object({bindTarget:Ji,tableHead:pe.string().array(),columns:pe.array(pe.union([u5,l5,pe.string()]))})),d5=Lt()(pe.object({renderChildType:Yl,declaration:pe.union([pe.string(),Hte]),position:a5.optional()})),h5=Lt()(pe.object({declaration:pe.union([pe.string(),Gl]),position:a5.optional(),isPreview:pe.boolean()})),g5=Lt()(pe.object({depth:pe.number(),content:pe.string()}));function Gte(n){let e,t;return{c(){e=ee("td"),t=ee("div")},m(r,i){J(r,e,i),K(e,t),n[3](t)},p:Ke,i:Ke,o:Ke,d(r){r&&Y(e),n[3](null)}}}function Wte(n,e,t){let{table:r}=e,{cell:i}=e,a,o;qi(()=>{o=r.createCell(i,a)}),Gs(()=>{o?.()});function u(s){Pr[s?"unshift":"push"](()=>{a=s,t(0,a)})}return n.$$set=s=>{"table"in s&&t(1,r=s.table),"cell"in s&&t(2,i=s.cell)},[a,r,i,u]}var VA=class extends Pe{constructor(e){super(),Be(this,e,Wte,Gte,ke,{table:1,cell:2})}},v5=VA;function y5(n,e,t){let r=n.slice();return r[7]=e[t],r}function b5(n,e,t){let r=n.slice();return r[10]=e[t],r[11]=e,r[12]=t,r}function x5(n,e,t){let r=n.slice();return r[13]=e[t],r}function w5(n){let e,t=n[13]+"",r;return{c(){e=ee("th"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&2&&t!==(t=i[13]+"")&&yt(r,t)},d(i){i&&Y(e)}}}function Yte(n){let e,t,r;return{c(){e=ee("td"),t=He("invalid data"),q(e,"class","meta-bind-error"),q(e,"colspan",r=n[1].length)},m(i,a){J(i,e,a),K(e,t)},p(i,a){a&2&&r!==(r=i[1].length)&&q(e,"colspan",r)},i:Ke,o:Ke,d(i){i&&Y(e)}}}function jte(n){let e,t,r=ct(n[7].cells),i=[];for(let o=0;o<r.length;o+=1)i[o]=_5(b5(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,u){if(u&5){r=ct(o[7].cells);let s;for(s=0;s<r.length;s+=1){let l=b5(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=_5(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function _5(n){let e,t,r;function i(o){n[4](o,n[10],n[11],n[12])}let a={table:n[0]};return n[10]!==void 0&&(a.cell=n[10]),e=new v5({props:a}),Pr.push(()=>Qn(e,"cell",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){n=o;let s={};u&1&&(s.table=n[0]),!t&&u&4&&(t=!0,s.cell=n[10],Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function Zte(n){let e,t;return e=new qr({props:{plugin:n[0].plugin,iconName:"x"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0].plugin),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function S5(n,e){let t,r,i,a,o,u,s,l,c=[jte,Yte],f=[];function p(h,d){return h[7].isValid?0:1}r=p(e,-1),i=f[r]=c[r](e);function m(){return e[5](e[7])}return u=new It({props:{$$slots:{default:[Zte]},$$scope:{ctx:e}}}),u.$on("click",m),{key:n,first:null,c(){t=ee("tr"),i.c(),a=fe(),o=ee("td"),xe(u.$$.fragment),s=fe(),q(o,"class","mb-html-table-button-cell"),this.first=t},m(h,d){J(h,t,d),f[r].m(t,null),K(t,a),K(t,o),ye(u,o,null),K(t,s),l=!0},p(h,d){e=h;let v=r;r=p(e,d),r===v?f[r].p(e,d):(bt(),ne(f[v],1,1,()=>{f[v]=null}),xt(),i=f[r],i?i.p(e,d):(i=f[r]=c[r](e),i.c()),j(i,1),i.m(t,a));let y={};d&65537&&(y.$$scope={dirty:d,ctx:e}),u.$set(y)},i(h){l||(j(i),j(u.$$.fragment,h),l=!0)},o(h){ne(i),ne(u.$$.fragment,h),l=!1},d(h){h&&Y(t),f[r].d(),be(u)}}}function Jte(n){let e;return{c(){e=He("Add Column")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Xte(n){let e,t,r,i,a,o,u,s,l=[],c=new Map,f,p,m,h=ct(n[1]),d=[];for(let S=0;S<h.length;S+=1)d[S]=w5(x5(n,h,S));let v=ct(n[2]),y=S=>S[7].index;for(let S=0;S<v.length;S+=1){let b=y5(n,v,S),w=y(b);c.set(w,l[S]=S5(w,b))}return p=new It({props:{$$slots:{default:[Jte]},$$scope:{ctx:n}}}),p.$on("click",n[6]),{c(){e=ee("div"),t=ee("table"),r=ee("thead"),i=ee("tr");for(let S=0;S<d.length;S+=1)d[S].c();a=fe(),o=ee("th"),u=fe(),s=ee("tbody");for(let S=0;S<l.length;S+=1)l[S].c();f=fe(),xe(p.$$.fragment),q(o,"class","mb-html-table-button-cell"),q(t,"class","mb-html-table"),q(e,"class","mb-table-wrapper")},m(S,b){J(S,e,b),K(e,t),K(t,r),K(r,i);for(let w=0;w<d.length;w+=1)d[w]&&d[w].m(i,null);K(i,a),K(i,o),K(t,u),K(t,s);for(let w=0;w<l.length;w+=1)l[w]&&l[w].m(s,null);J(S,f,b),ye(p,S,b),m=!0},p(S,[b]){if(b&2){h=ct(S[1]);let A;for(A=0;A<h.length;A+=1){let x=x5(S,h,A);d[A]?d[A].p(x,b):(d[A]=w5(x),d[A].c(),d[A].m(i,a))}for(;A<d.length;A+=1)d[A].d(1);d.length=h.length}b&7&&(v=ct(S[2]),bt(),l=Qu(l,b,y,1,S,v,c,s,Np,S5,null,y5),xt());let w={};b&65536&&(w.$$scope={dirty:b,ctx:S}),p.$set(w)},i(S){if(!m){for(let b=0;b<v.length;b+=1)j(l[b]);j(p.$$.fragment,S),m=!0}},o(S){for(let b=0;b<l.length;b+=1)ne(l[b]);ne(p.$$.fragment,S),m=!1},d(S){S&&(Y(e),Y(f)),Qt(d,S);for(let b=0;b<l.length;b+=1)l[b].d();be(p,S)}}}function Qte(n,e,t){let{table:r}=e,{tableHead:i=[]}=e,a=[];function o(c){t(2,a=c)}function u(c,f,p,m){p[m]=c,t(2,a)}let s=c=>r.removeColumn(c.index),l=()=>r.addColumn();return n.$$set=c=>{"table"in c&&t(0,r=c.table),"tableHead"in c&&t(1,i=c.tableHead)},[r,i,a,o,u,s,l]}var UA=class extends Pe{constructor(e){super(),Be(this,e,Qte,Xte,ke,{table:0,tableHead:1,updateTable:3})}get updateTable(){return this.$$.ctx[3]}},A5=UA;var Fh=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new Lr(void 0),this.outputSignal=new Lr(void 0),this.value=void 0}registerSelfToMetadataManager(){this.metadataManagerOutputSignalListener=this.outputSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.metadataSubscription=this.plugin.metadataManager.subscribe(this.getUuid(),this.inputSignal,this.bindTarget,()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),this.metadataSubscription?.unsubscribe()}updateMetadataManager(e){this.metadataSubscription?.update(e)}updateDisplayValue(e){e=e??[];let t=[];for(let r=0;r<e.length;r++)if(typeof e[r]=="object"){let i=new Wl({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(Ch([r.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),a=this.columns.map(o=>typeof o=="string"?this.plugin.api.createInlineFieldFromString(o,this.getFilePath(),i,"inline"):"inputFieldType"in o?this.plugin.api.createInputFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}):this.plugin.api.createViewFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}));t.push({cells:a,index:r,value:e[r],isValid:!0})}else t.push({cells:[],index:r,value:e[r],isValid:!1});this.tableComponent?.updateTable(t)}createCell(e,t){return e.mount(t),()=>e.unmount()}removeColumn(e){this.value=this.value??[],this.value.splice(e,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){this.value=this.value??[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onMount(e){super.onMount(e),this.tableComponent=new A5({target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:t=>{this.value=t,this.updateDisplayValue(t)}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent?.$destroy(),Wn(e,"table")}};var Ih=class{constructor(e,t){this.plugin=e,this.inputFieldParser=t?.inputFieldParser??new lh(e),this.viewFieldParser=t?.viewFieldParser??new gh(e),this.jsViewFieldParser=t?.jsViewFieldParser??new Th(e),this.buttonParser=t?.buttonParser??new Nh(e),this.bindTargetParser=t?.bindTargetParser??new zd(e),this.inputFieldFactory=t?.inputFieldFactory??new am(e),this.viewFieldFactory=t?.viewFieldFactory??new qd(e),this.buttonActionRunner=t?.buttonActionRunner??new bp(e),this.buttonManager=t?.buttonManager??new Ip(e),this.syntaxHighlighting=t?.syntaxHighlighting??new vp(e)}createField(e,t,r,i=!0){if(Qr(pe.object({type:hf,filePath:Xi,options:pe.any(),honorExcludedSetting:pe.boolean()}),{type:e,filePath:t,options:r,honorExcludedSetting:i}),this.plugin.internal.isFilePathExcluded(t)&&i)return this.createExcludedMountable(t);if(e==="INPUT")return this.createInputFieldMountable(t,r);if(e==="VIEW")return this.createViewFieldMountable(t,r);if(e==="JS_VIEW")return this.createJsViewFieldMountable(t,r);if(e==="TABLE")return this.createTableMountable(t,r);if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(t,r);if(e==="BUTTON")return this.createButtonMountable(t,r);if(e==="EMBED")return this.createEmbedMountable(t,r);if(e==="EXCLUDED")return this.createExcludedMountable(t);throw new Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,t,r,i="inline",a,o=!0){Qr(pe.object({fieldString:pe.string(),filePath:Xi,scope:jl.optional(),renderChildType:Yl,honorExcludedSetting:pe.boolean()}),{fieldString:e,filePath:t,scope:r,renderChildType:i,honorExcludedSetting:o});let u=this.isInlineFieldDeclarationAndGetType(e);if(u===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${u}"`});return this.createInlineFieldOfTypeFromString(u,e,t,r,i,a,o)}createInlineFieldOfTypeFromString(e,t,r,i,a="inline",o,u=!0){if(Qr(pe.object({type:hf,declaration:pe.string(),filePath:Xi,scope:jl.optional(),renderChildType:Yl,honorExcludedSetting:pe.boolean()}),{type:e,declaration:t,filePath:r,scope:i,renderChildType:a,honorExcludedSetting:u}),this.plugin.internal.isFilePathExcluded(r)&&u)return this.createExcludedMountable(r);if(e==="INPUT")return this.createInputFieldMountable(r,{renderChildType:a,declaration:t,scope:i});if(e==="VIEW")return this.createViewFieldMountable(r,{renderChildType:a,declaration:t,scope:i});if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(r,{renderChildType:a,declaration:t,position:o});throw new Ut({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,t){Qr(pe.object({filePath:Xi,options:c5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.inputFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.inputFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new Ku(this.plugin,r,e,t.renderChildType,i)}createViewFieldMountable(e,t){Qr(pe.object({filePath:Xi,options:f5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.viewFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.viewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new sm(this.plugin,r,e,t.renderChildType,i)}createJsViewFieldMountable(e,t){Qr(pe.object({filePath:Xi,options:p5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.jsViewFieldParser.fromStringAndValidate(t.declaration,e):i=this.jsViewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e),new om(this.plugin,r,e,i)}createTableMountable(e,t){Qr(pe.object({filePath:Xi,options:m5}),{filePath:e,options:t});let r=Ir();return new Fh(this.plugin,r,e,t.bindTarget,t.tableHead,t.columns)}createButtonGroupMountable(e,t){Qr(pe.object({filePath:Xi,options:d5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromGroupString(t.declaration):i=this.buttonParser.validateGroup(t.declaration),new kp(this.plugin,r,e,i,t.renderChildType,t.position)}createButtonMountable(e,t){Qr(pe.object({filePath:Xi,options:h5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromString(t.declaration):i=this.buttonParser.validate(t.declaration),new Cp(this.plugin,r,e,i,t.position,t.isPreview)}createEmbedMountable(e,t){Qr(pe.object({filePath:Xi,options:g5}),{filePath:e,options:t});let r=Ir();return new vh(this.plugin,r,e,t.depth,t.content)}createExcludedMountable(e){Qr(pe.object({filePath:Xi}),{filePath:e});let t=Ir();return new yh(this.plugin,t,e)}getInlineFieldDeclarationPrefix(e){if(Qr(pe.object({fieldType:hf}),{fieldType:e}),e==="INPUT")return"INPUT";if(e==="VIEW")return"VIEW";if(e==="BUTTON_GROUP")return"BUTTON";throw new Ut({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,t){Qr(pe.object({fieldType:hf,str:pe.string()}),{fieldType:e,str:t});let r=this.getInlineFieldDeclarationPrefix(e)+"[";return t.startsWith(r)&&t.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(Qr(pe.object({str:pe.string()}),{str:e}),!!e.endsWith("]"))for(let t of Object.values(ju)){if(!gp(t))continue;let r=this.getInlineFieldDeclarationPrefix(t)+"[";if(e.startsWith(r))return t}}createSignal(e){return new Lr(e)}createBindTarget(e,t,r,i=!1){return Qr(pe.object({storageType:pe.string(),storagePath:pe.string(),property:pe.string().array(),listenToChildren:pe.boolean()}),{storageType:e,storagePath:t,property:r,listenToChildren:i}),{storageType:e,storagePath:t,storageProp:Ch(r),listenToChildren:i}}parseBindTarget(e,t,r){return Qr(pe.object({declarationString:pe.string(),filePath:Xi,scope:jl.optional()}),{declarationString:e,filePath:t,scope:r}),this.bindTargetParser.fromStringAndValidate(e,t,r)}setMetadata(e,t){Qr(pe.object({bindTarget:Ji}),{bindTarget:e}),this.plugin.metadataManager.write(t,e)}getMetadata(e){return Qr(pe.object({bindTarget:Ji}),{bindTarget:e}),this.plugin.metadataManager.read(e)}updateMetadata(e,t){Qr(pe.object({bindTarget:Ji,updateFn:pe.function().args(pe.any()).returns(pe.any())}),{bindTarget:e,updateFn:t});let r=this.plugin.metadataManager.read(e),i=t(r);this.plugin.metadataManager.write(i,e)}subscribeToMetadata(e,t,r){Qr(pe.object({bindTarget:Ji,lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:pe.function().args(pe.any()).returns(pe.void())}),{bindTarget:e,lifecycleHook:t,callback:r});let i=Ir(),a=new Lr(void 0);a.registerListener({callback:r});let o=this.plugin.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});t.register(()=>{o.unsubscribe()})}createNotePosition(e,t){return Qr(pe.object({lineStart:pe.number(),lineEnd:pe.number()}),{lineStart:e,lineEnd:t}),new Wo({lineStart:e,lineEnd:t})}};var M5=require("@codemirror/view"),Ph=class extends M5.WidgetType{constructor(e,t,r,i,a){super(),this.type=e,this.content=t,this.filePath=r,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement("span");t.addClass("cm-inline-code");let r=this.plugin.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.plugin.api.wrapInMDRC(r,t,this.parentComponent),t}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var E5=require("obsidian"),kh=class extends E5.MarkdownRenderChild{constructor(e,t,r){super(r),this.plugin=e,this.mountable=t,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function D5(n){return n.dependencyManager.checkDependency("dataview").api}function Fs(n){return n.dependencyManager.checkDependency("js-engine").api}function qA(n){return n.dependencyManager.checkDependency("templater-obsidian").templater}var Kte=pe.object({addChild:pe.function().args(pe.instanceof(N5.Component)).returns(pe.void())}),Bh=class extends Ih{constructor(e){super(e)}wrapInMDRC(e,t,r){Qr(pe.object({field:i5,containerEl:n5,component:Kte}),{field:e,containerEl:t,component:r});let i=new kh(this.plugin,e,t);return r.addChild(i),i}constructMDRCWidget(e,t,r,i){if(gp(e))return new Ph(e,t,r,i,this.plugin);throw new Ut({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline mdrc type "${e}"`})}reactiveMetadata(e,t,r){Qr(pe.object({bindTargets:Ji.array(),lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:pe.function()}),{bindTargets:e,lifecycleHook:t,callback:r});let i=Fs(this.plugin),a=Ir(),o=new Lr(void 0),u=e.map(c=>({bindTarget:c,callbackSignal:new Lr(void 0)})),s,l=this.plugin.metadataManager.subscribeComputed(a,o,void 0,u,c=>s?.refresh(...c),()=>{});return t.register(()=>l.unsubscribe()),s=i.reactive(r,...u.map(c=>c.callbackSignal.get())),s}};var Ur=require("obsidian");var ro=class{constructor(e,t){this.plugin=e,this.selectCallback=t}onSelected(e){this.selectCallback(e)}};var Oh=class extends ro{getItemText(e){return e.name}getItems(){return this.plugin.internal.getAllCommands()}};var Rh=class extends ro{getItemText(e){return e}getItems(){return this.plugin.internal.getAllFiles()}};var Lh=class extends ro{getItemText(e){return e}getItems(){return this.plugin.internal.getAllFolders()}};function ere(n){ia(n,"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 tre(n){let e,t,r,i=(n[0]??"")+"",a,o,u,s=(n[1]??"")+"",l,c,f,p,m=n[5].default,h=Aa(m,n,n[4],null);return{c(){e=ee("div"),t=ee("div"),r=ee("div"),a=He(i),o=fe(),u=ee("div"),l=He(s),c=fe(),f=ee("div"),h&&h.c(),q(r,"class","setting-item-name"),q(u,"class","setting-item-description"),q(t,"class","setting-item-info"),q(f,"class","setting-item-control svelte-17mpvkc"),Yt(f,"vertical-control",n[3]),q(e,"class","setting-item svelte-17mpvkc"),Yt(e,"setting-item-heading",n[2]),Yt(e,"vertical",n[3])},m(d,v){J(d,e,v),K(e,t),K(t,r),K(r,a),K(t,o),K(t,u),K(u,l),K(e,c),K(e,f),h&&h.m(f,null),p=!0},p(d,[v]){(!p||v&1)&&i!==(i=(d[0]??"")+"")&&yt(a,i),(!p||v&2)&&s!==(s=(d[1]??"")+"")&&yt(l,s),h&&h.p&&(!p||v&16)&&Ea(h,m,d,d[4],p?Ma(m,d[4],v,null):Da(d[4]),null),(!p||v&8)&&Yt(f,"vertical-control",d[3]),(!p||v&4)&&Yt(e,"setting-item-heading",d[2]),(!p||v&8)&&Yt(e,"vertical",d[3])},i(d){p||(j(h,d),p=!0)},o(d){ne(h,d),p=!1},d(d){d&&Y(e),h&&h.d(d)}}}function rre(n,e,t){let{$$slots:r={},$$scope:i}=e,{name:a=void 0}=e,{description:o=void 0}=e,{heading:u=!1}=e,{vertical:s=!1}=e;return n.$$set=l=>{"name"in l&&t(0,a=l.name),"description"in l&&t(1,o=l.description),"heading"in l&&t(2,u=l.heading),"vertical"in l&&t(3,s=l.vertical),"$$scope"in l&&t(4,i=l.$$scope)},[a,o,u,s,i,r]}var zA=class extends Pe{constructor(e){super(),Be(this,e,rre,tre,ke,{name:0,description:1,heading:2,vertical:3},ere)}},Xt=zA;function nre(n){let e,t,r=n[1].default,i=Aa(r,n,n[0],null);return{c(){e=ee("div"),i&&i.c(),q(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)&&Ea(i,r,a,a[0],t?Ma(r,a[0],o,null):Da(a[0]),null)},i(a){t||(j(i,a),t=!0)},o(a){ne(i,a),t=!1},d(a){a&&Y(e),i&&i.d(a)}}}function ire(n,e,t){let{$$slots:r={},$$scope:i}=e;return n.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,r]}var $A=class extends Pe{constructor(e){super(),Be(this,e,ire,nre,ke,{})}},no=$A;function are(n){let e,t,r,i,a,o;return{c(){e=ee("div"),t=ee("input"),q(t,"type","checkbox"),q(t,"tabindex","-1"),t.checked=r=n[0]??!1,q(e,"class","checkbox-container"),q(e,"role","switch"),q(e,"tabindex","0"),q(e,"aria-checked",i=n[0]??!1),Yt(e,"is-enabled",n[0]??!1)},m(u,s){J(u,e,s),K(e,t),a||(o=[Fe(e,"click",n[1]),Fe(e,"keydown",n[2])],a=!0)},p(u,[s]){s&1&&r!==(r=u[0]??!1)&&(t.checked=r),s&1&&i!==(i=u[0]??!1)&&q(e,"aria-checked",i),s&1&&Yt(e,"is-enabled",u[0]??!1)},i:Ke,o:Ke,d(u){u&&Y(e),a=!1,Ft(o)}}}function ore(n,e,t){let{checked:r}=e,i=()=>t(0,r=!r),a=o=>{o.key===" "&&t(0,r=!r)};return n.$$set=o=>{"checked"in o&&t(0,r=o.checked)},[r,i,a]}var HA=class extends Pe{constructor(e){super(),Be(this,e,ore,are,ke,{checked:0})}},io=HA;function sre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function ure(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[sre]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&32&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function lre(n){let e,t;return e=new Xt({props:{name:"Command: "+(n[0].command||"none"),description:"The command to execute when this action runs.",$$slots:{default:[ure]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,[i]){let a={};i&1&&(a.name="Command: "+(r[0].command||"none")),i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function cre(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(s){s.type==="command"&&i.internal.openCommandSelectModal(l=>{s.command=l.id,a()})}let u=()=>o(r);return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(2,i=s.plugin),"updateActions"in s&&t(3,a=s.updateActions)},[r,o,i,a,u]}var GA=class extends Pe{constructor(e){super(),Be(this,e,cre,lre,ke,{action:0,plugin:2,updateActions:3})}},T5=GA;function fre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","someJsFile.js")},m(i,a){J(i,e,a),je(e,n[0].file),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].file&&je(e,i[0].file)},d(i){i&&Y(e),t=!1,r()}}}function pre(n){let e,t;return e=new Xt({props:{name:"JS File",description:"The JavaScript file to run.",$$slots:{default:[fre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function mre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.file=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var WA=class extends Pe{constructor(e){super(),Be(this,e,mre,pre,ke,{action:0,plugin:1})}},C5=WA;function dre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","[[Some Note]] or https://www.example.com")},m(i,a){J(i,e,a),je(e,n[0].link),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].link&&je(e,i[0].link)},d(i){i&&Y(e),t=!1,r()}}}function hre(n){let e,t,r;function i(o){n[3](o)}let a={};return n[0].newTab!==void 0&&(a.checked=n[0].newTab),e=new io({props:a}),Pr.push(()=>Qn(e,"checked",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].newTab,Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function gre(n){let e,t,r,i;return e=new Xt({props:{name:"Link",description:"The link to open.",$$slots:{default:[dre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"New Tab",description:"Whether to open the link in a new tab.",$$slots:{default:[hre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,[o]){let u={};o&17&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&17&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function vre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.link=this.value,t(0,r)}function o(u){n.$$.not_equal(r.newTab,u)&&(r.newTab=u,t(0,r))}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var YA=class extends Pe{constructor(e){super(),Be(this,e,vre,gre,ke,{action:0,plugin:1})}},F5=YA;function yre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some text")},m(i,a){J(i,e,a),je(e,n[0].str),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].str&&je(e,i[0].str)},d(i){i&&Y(e),t=!1,r()}}}function bre(n){let e,t;return e=new Xt({props:{name:"Text",description:"The text to input at the cursor.",$$slots:{default:[yre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function xre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.str=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var jA=class extends Pe{constructor(e){super(),Be(this,e,xre,bre,ke,{action:0,plugin:1})}},I5=jA;function wre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","100 ms")},m(i,a){J(i,e,a),je(e,n[0].ms),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Jn(e.value)!==i[0].ms&&je(e,i[0].ms)},d(i){i&&Y(e),t=!1,r()}}}function _re(n){let e,t;return e=new Xt({props:{name:"Sleep Time",description:"The time to sleep in milliseconds.",$$slots:{default:[wre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Sre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.ms=Jn(this.value),t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var ZA=class extends Pe{constructor(e){super(),Be(this,e,Sre,_re,ke,{action:0,plugin:1})}},P5=ZA;function Are(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Mre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Are]},$$scope:{ctx:n}}}),e.$on("click",n[5]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&512&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Ere(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Dre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Ere]},$$scope:{ctx:n}}}),e.$on("click",n[6]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&512&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Nre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some name")},m(i,a){J(i,e,a),je(e,n[0].fileName),t||(r=Fe(e,"input",n[7]),t=!0)},p(i,a){a&1&&e.value!==i[0].fileName&&je(e,i[0].fileName)},d(i){i&&Y(e),t=!1,r()}}}function Tre(n){let e,t,r;function i(o){n[8](o)}let a={};return n[0].openNote!==void 0&&(a.checked=n[0].openNote),e=new io({props:a}),Pr.push(()=>Qn(e,"checked",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].openNote,Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function Cre(n){let e,t,r,i,a,o,u,s;return e=new Xt({props:{name:"Template File: "+(n[0].templateFile||"none"),description:"The template file to create a new note of.",$$slots:{default:[Mre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Folder: "+(n[0].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[Dre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"File Name: "+(n[0].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[Nre]},$$scope:{ctx:n}}}),u=new Xt({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[Tre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),xe(a.$$.fragment),o=fe(),xe(u.$$.fragment)},m(l,c){ye(e,l,c),J(l,t,c),ye(r,l,c),J(l,i,c),ye(a,l,c),J(l,o,c),ye(u,l,c),s=!0},p(l,[c]){let f={};c&1&&(f.name="Template File: "+(l[0].templateFile||"none")),c&513&&(f.$$scope={dirty:c,ctx:l}),e.$set(f);let p={};c&1&&(p.name="Folder: "+(l[0].folderPath||"none")),c&513&&(p.$$scope={dirty:c,ctx:l}),r.$set(p);let m={};c&1&&(m.name="File Name: "+(l[0].fileName||"default")),c&513&&(m.$$scope={dirty:c,ctx:l}),a.$set(m);let h={};c&513&&(h.$$scope={dirty:c,ctx:l}),u.$set(h)},i(l){s||(j(e.$$.fragment,l),j(r.$$.fragment,l),j(a.$$.fragment,l),j(u.$$.fragment,l),s=!0)},o(l){ne(e.$$.fragment,l),ne(r.$$.fragment,l),ne(a.$$.fragment,l),ne(u.$$.fragment,l),s=!1},d(l){l&&(Y(t),Y(i),Y(o)),be(e,l),be(r,l),be(a,l),be(u,l)}}}function Fre(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(p){p.type==="templaterCreateNote"&&i.internal.openFileSelectModal(m=>{p.templateFile=m,a()})}function u(p){p.type==="templaterCreateNote"&&i.internal.openFolderSelectModal(m=>{p.folderPath=m,a()})}let s=()=>o(r),l=()=>u(r);function c(){r.fileName=this.value,t(0,r)}function f(p){n.$$.not_equal(r.openNote,p)&&(r.openNote=p,t(0,r))}return n.$$set=p=>{"action"in p&&t(0,r=p.action),"plugin"in p&&t(3,i=p.plugin),"updateActions"in p&&t(4,a=p.updateActions)},[r,o,u,i,a,s,l,c,f]}var JA=class extends Pe{constructor(e){super(),Be(this,e,Fre,Cre,ke,{action:0,plugin:3,updateActions:4})}},k5=JA;function Ire(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some value")},m(i,a){J(i,e,a),je(e,n[0].bindTarget),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].bindTarget&&je(e,i[0].bindTarget)},d(i){i&&Y(e),t=!1,r()}}}function Pre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some value")},m(i,a){J(i,e,a),je(e,n[0].value),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&1&&e.value!==i[0].value&&je(e,i[0].value)},d(i){i&&Y(e),t=!1,r()}}}function kre(n){let e,t,r;function i(o){n[4](o)}let a={};return n[0].evaluate!==void 0&&(a.checked=n[0].evaluate),e=new io({props:a}),Pr.push(()=>Qn(e,"checked",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].evaluate,Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function Bre(n){let e,t,r,i,a,o;return e=new Xt({props:{name:"Metadata Property",description:"The metadata property in form of a bind target.",$$slots:{default:[Ire]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Value",description:"The new value.",$$slots:{default:[Pre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",$$slots:{default:[kre]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),xe(a.$$.fragment)},m(u,s){ye(e,u,s),J(u,t,s),ye(r,u,s),J(u,i,s),ye(a,u,s),o=!0},p(u,[s]){let l={};s&33&&(l.$$scope={dirty:s,ctx:u}),e.$set(l);let c={};s&33&&(c.$$scope={dirty:s,ctx:u}),r.$set(c);let f={};s&33&&(f.$$scope={dirty:s,ctx:u}),a.$set(f)},i(u){o||(j(e.$$.fragment,u),j(r.$$.fragment,u),j(a.$$.fragment,u),o=!0)},o(u){ne(e.$$.fragment,u),ne(r.$$.fragment,u),ne(a.$$.fragment,u),o=!1},d(u){u&&(Y(t),Y(i)),be(e,u),be(r,u),be(a,u)}}}function Ore(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.bindTarget=this.value,t(0,r)}function o(){r.value=this.value,t(0,r)}function u(s){n.$$.not_equal(r.evaluate,s)&&(r.evaluate=s,t(0,r))}return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(1,i=s.plugin)},[r,i,a,o,u]}var XA=class extends Pe{constructor(e){super(),Be(this,e,Ore,Bre,ke,{action:0,plugin:1})}},B5=XA;function Rre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Lre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Rre]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&128&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Vre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some name")},m(i,a){J(i,e,a),je(e,n[0].fileName),t||(r=Fe(e,"input",n[5]),t=!0)},p(i,a){a&1&&e.value!==i[0].fileName&&je(e,i[0].fileName)},d(i){i&&Y(e),t=!1,r()}}}function Ure(n){let e,t,r;function i(o){n[6](o)}let a={};return n[0].openNote!==void 0&&(a.checked=n[0].openNote),e=new io({props:a}),Pr.push(()=>Qn(e,"checked",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].openNote,Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function qre(n){let e,t,r,i,a,o;return e=new Xt({props:{name:"Folder: "+(n[0].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[Lre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"File Name: "+(n[0].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[Vre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[Ure]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),xe(a.$$.fragment)},m(u,s){ye(e,u,s),J(u,t,s),ye(r,u,s),J(u,i,s),ye(a,u,s),o=!0},p(u,[s]){let l={};s&1&&(l.name="Folder: "+(u[0].folderPath||"none")),s&129&&(l.$$scope={dirty:s,ctx:u}),e.$set(l);let c={};s&1&&(c.name="File Name: "+(u[0].fileName||"default")),s&129&&(c.$$scope={dirty:s,ctx:u}),r.$set(c);let f={};s&129&&(f.$$scope={dirty:s,ctx:u}),a.$set(f)},i(u){o||(j(e.$$.fragment,u),j(r.$$.fragment,u),j(a.$$.fragment,u),o=!0)},o(u){ne(e.$$.fragment,u),ne(r.$$.fragment,u),ne(a.$$.fragment,u),o=!1},d(u){u&&(Y(t),Y(i)),be(e,u),be(r,u),be(a,u)}}}function zre(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(c){c.type==="createNote"&&i.internal.openFolderSelectModal(f=>{c.folderPath=f,a()})}let u=()=>o(r);function s(){r.fileName=this.value,t(0,r)}function l(c){n.$$.not_equal(r.openNote,c)&&(r.openNote=c,t(0,r))}return n.$$set=c=>{"action"in c&&t(0,r=c.action),"plugin"in c&&t(2,i=c.plugin),"updateActions"in c&&t(3,a=c.updateActions)},[r,o,i,a,u,s,l]}var QA=class extends Pe{constructor(e){super(),Be(this,e,zre,qre,ke,{action:0,plugin:2,updateActions:3})}},O5=QA;function $re(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].fromLine),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Jn(e.value)!==i[0].fromLine&&je(e,i[0].fromLine)},d(i){i&&Y(e),t=!1,r()}}}function Hre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].toLine),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&1&&Jn(e.value)!==i[0].toLine&&je(e,i[0].toLine)},d(i){i&&Y(e),t=!1,r()}}}function Gre(n){let e,t,r,i,a,o,u,s,l,c,f;return e=new Xt({props:{name:"Line From",description:"The line that marks the start of the area to replace.",$$slots:{default:[$re]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Line To",description:"The line that marks the end of the area to replace.",$$slots:{default:[Hre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Replacement Text",description:"The text to replace the note section."}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),xe(a.$$.fragment),o=fe(),u=ee("div"),s=ee("textarea"),q(u,"class","meta-bind-full-width meta-bind-high")},m(p,m){ye(e,p,m),J(p,t,m),ye(r,p,m),J(p,i,m),ye(a,p,m),J(p,o,m),J(p,u,m),K(u,s),je(s,n[0].replacement),l=!0,c||(f=Fe(s,"input",n[4]),c=!0)},p(p,[m]){let h={};m&33&&(h.$$scope={dirty:m,ctx:p}),e.$set(h);let d={};m&33&&(d.$$scope={dirty:m,ctx:p}),r.$set(d),m&1&&je(s,p[0].replacement)},i(p){l||(j(e.$$.fragment,p),j(r.$$.fragment,p),j(a.$$.fragment,p),l=!0)},o(p){ne(e.$$.fragment,p),ne(r.$$.fragment,p),ne(a.$$.fragment,p),l=!1},d(p){p&&(Y(t),Y(i),Y(o),Y(u)),be(e,p),be(r,p),be(a,p),c=!1,f()}}}function Wre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.fromLine=Jn(this.value),t(0,r)}function o(){r.toLine=Jn(this.value),t(0,r)}function u(){r.replacement=this.value,t(0,r)}return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(1,i=s.plugin)},[r,i,a,o,u]}var KA=class extends Pe{constructor(e){super(),Be(this,e,Wre,Gre,ke,{action:0,plugin:1})}},R5=KA;function Yre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].regexp),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].regexp&&je(e,i[0].regexp)},d(i){i&&Y(e),t=!1,r()}}}function jre(n){let e,t,r,i,a,o,u,s,l;return e=new Xt({props:{name:"Regexp",description:"The regexp to find replacements.",$$slots:{default:[Yre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Replacement Text",description:"The text to replace the button with."}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),a=ee("div"),o=ee("textarea"),q(a,"class","meta-bind-full-width meta-bind-high")},m(c,f){ye(e,c,f),J(c,t,f),ye(r,c,f),J(c,i,f),J(c,a,f),K(a,o),je(o,n[0].replacement),u=!0,s||(l=Fe(o,"input",n[3]),s=!0)},p(c,[f]){let p={};f&17&&(p.$$scope={dirty:f,ctx:c}),e.$set(p),f&1&&je(o,c[0].replacement)},i(c){u||(j(e.$$.fragment,c),j(r.$$.fragment,c),u=!0)},o(c){ne(e.$$.fragment,c),ne(r.$$.fragment,c),u=!1},d(c){c&&(Y(t),Y(i),Y(a)),be(e,c),be(r,c),s=!1,l()}}}function Zre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.regexp=this.value,t(0,r)}function o(){r.replacement=this.value,t(0,r)}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var eM=class extends Pe{constructor(e){super(),Be(this,e,Zre,jre,ke,{action:0,plugin:1})}},L5=eM;function Jre(n){let e,t,r,i,a,o,u;return e=new Xt({props:{name:"Replacement Text",description:"The text to replace the match with."}}),{c(){xe(e.$$.fragment),t=fe(),r=ee("div"),i=ee("textarea"),q(r,"class","meta-bind-full-width meta-bind-high")},m(s,l){ye(e,s,l),J(s,t,l),J(s,r,l),K(r,i),je(i,n[0].replacement),a=!0,o||(u=Fe(i,"input",n[2]),o=!0)},p(s,[l]){l&1&&je(i,s[0].replacement)},i(s){a||(j(e.$$.fragment,s),a=!0)},o(s){ne(e.$$.fragment,s),a=!1},d(s){s&&(Y(t),Y(r)),be(e,s),o=!1,u()}}}function Xre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.replacement=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var tM=class extends Pe{constructor(e){super(),Be(this,e,Xre,Jre,ke,{action:0,plugin:1})}},V5=tM;function Qre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].line),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Jn(e.value)!==i[0].line&&je(e,i[0].line)},d(i){i&&Y(e),t=!1,r()}}}function Kre(n){let e,t,r,i,a,o,u,s,l;return e=new Xt({props:{name:"Line",description:"The line number to insert at.",$$slots:{default:[Qre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Text to Insert",description:"The text to insert into the note."}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),a=ee("div"),o=ee("textarea"),q(a,"class","meta-bind-full-width meta-bind-high")},m(c,f){ye(e,c,f),J(c,t,f),ye(r,c,f),J(c,i,f),J(c,a,f),K(a,o),je(o,n[0].value),u=!0,s||(l=Fe(o,"input",n[3]),s=!0)},p(c,[f]){let p={};f&17&&(p.$$scope={dirty:f,ctx:c}),e.$set(p),f&1&&je(o,c[0].value)},i(c){u||(j(e.$$.fragment,c),j(r.$$.fragment,c),u=!0)},o(c){ne(e.$$.fragment,c),ne(r.$$.fragment,c),u=!1},d(c){c&&(Y(t),Y(i),Y(a)),be(e,c),be(r,c),s=!1,l()}}}function ene(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.line=Jn(this.value),t(0,r)}function o(){r.value=this.value,t(0,r)}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var rM=class extends Pe{constructor(e){super(),Be(this,e,ene,Kre,ke,{action:0,plugin:1})}},U5=rM;function tne(n){let e,t,r,i,a,o,u;return e=new Xt({props:{name:"JS Code",description:"The JavaScript code to run."}}),{c(){xe(e.$$.fragment),t=fe(),r=ee("div"),i=ee("textarea"),q(r,"class","meta-bind-full-width meta-bind-high")},m(s,l){ye(e,s,l),J(s,t,l),J(s,r,l),K(r,i),je(i,n[0].code),a=!0,o||(u=Fe(i,"input",n[2]),o=!0)},p(s,[l]){l&1&&je(i,s[0].code)},i(s){a||(j(e.$$.fragment,s),a=!0)},o(s){ne(e.$$.fragment,s),a=!1},d(s){s&&(Y(t),Y(r)),be(e,s),o=!1,u()}}}function rne(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.code=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var nM=class extends Pe{constructor(e){super(),Be(this,e,rne,tne,ke,{action:0,plugin:1})}},q5=nM;function nne(n){let e,t,r,i=n[3].default,a=Aa(i,n,n[2],null);return{c(){e=ee("div"),a&&a.c(),q(e,"class",t=(n[0]?"mb-flex-row-reverse ":"mb-flex-row ")+(n[1]?"mb-flex-row-stretch ":""))},m(o,u){J(o,e,u),a&&a.m(e,null),r=!0},p(o,[u]){a&&a.p&&(!r||u&4)&&Ea(a,i,o,o[2],r?Ma(i,o[2],u,null):Da(o[2]),null),(!r||u&3&&t!==(t=(o[0]?"mb-flex-row-reverse ":"mb-flex-row ")+(o[1]?"mb-flex-row-stretch ":"")))&&q(e,"class",t)},i(o){r||(j(a,o),r=!0)},o(o){ne(a,o),r=!1},d(o){o&&Y(e),a&&a.d(o)}}}function ine(n,e,t){let{$$slots:r={},$$scope:i}=e,{reverse:a=!1}=e,{stretchChildren:o=!0}=e;return n.$$set=u=>{"reverse"in u&&t(0,a=u.reverse),"stretchChildren"in u&&t(1,o=u.stretchChildren),"$$scope"in u&&t(2,i=u.$$scope)},[a,o,i,r]}var iM=class extends Pe{constructor(e){super(),Be(this,e,ine,nne,ke,{reverse:0,stretchChildren:1})}},Is=iM;function z5(n,e,t){let r=n.slice();return r[28]=e[t],r[30]=t,r}function $5(n,e,t){let r=n.slice();return r[31]=e[t],r}function H5(n,e,t){let r=n.slice();return r[31]=e[t],r}function ane(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].label),t||(r=Fe(e,"input",n[9]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].label&&je(e,i[0].label)},d(i){i&&Y(e),t=!1,r()}}}function one(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].icon),t||(r=Fe(e,"input",n[10]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].icon&&je(e,i[0].icon)},d(i){i&&Y(e),t=!1,r()}}}function G5(n){let e,t=n[31]+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[31],je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p:Ke,d(a){a&&Y(e)}}}function sne(n){let e,t,r,i=ct(Object.values(hn)),a=[];for(let o=0;o<i.length;o+=1)a[o]=G5(H5(n,i,o));return{c(){e=ee("select");for(let o=0;o<a.length;o+=1)a[o].c();q(e,"class","dropdown"),n[0].style===void 0&&Ga(()=>n[11].call(e))},m(o,u){J(o,e,u);for(let s=0;s<a.length;s+=1)a[s]&&a[s].m(e,null);Jo(e,n[0].style,!0),t||(r=Fe(e,"change",n[11]),t=!0)},p(o,u){if(u&0){i=ct(Object.values(hn));let s;for(s=0;s<i.length;s+=1){let l=H5(o,i,s);a[s]?a[s].p(l,u):(a[s]=G5(l),a[s].c(),a[s].m(e,null))}for(;s<a.length;s+=1)a[s].d(1);a.length=i.length}u[0]&1&&Jo(e,o[0].style)},d(o){o&&Y(e),Qt(a,o),t=!1,r()}}}function une(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].class),t||(r=Fe(e,"input",n[12]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].class&&je(e,i[0].class)},d(i){i&&Y(e),t=!1,r()}}}function lne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].tooltip),t||(r=Fe(e,"input",n[13]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].tooltip&&je(e,i[0].tooltip)},d(i){i&&Y(e),t=!1,r()}}}function cne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].id),t||(r=Fe(e,"input",n[14]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].id&&je(e,i[0].id)},d(i){i&&Y(e),t=!1,r()}}}function fne(n){let e,t,r;function i(o){n[15](o)}let a={};return n[0].hidden!==void 0&&(a.checked=n[0].hidden),e=new io({props:a}),Pr.push(()=>Qn(e,"checked",i)),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){let s={};!t&&u[0]&1&&(t=!0,s.checked=o[0].hidden,Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function W5(n){let e,t=n[31]+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[31],je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p:Ke,d(a){a&&Y(e)}}}function pne(n){let e;return{c(){e=He("Add Action")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function mne(n){let e,t;return e=new qr({props:{iconName:"more-vertical",plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function dne(n){let e,t=n[7](n[28].type)+"",r,i,a,o;function u(...s){return n[18](n[30],...s)}return a=new It({props:{variant:"plain",$$slots:{default:[mne]},$$scope:{ctx:n}}}),a.$on("click",u),{c(){e=ee("h5"),r=He(t),i=fe(),xe(a.$$.fragment)},m(s,l){J(s,e,l),K(e,r),J(s,i,l),ye(a,s,l),o=!0},p(s,l){n=s,(!o||l[0]&1)&&t!==(t=n[7](n[28].type)+"")&&yt(r,t);let c={};l[0]&2|l[1]&32&&(c.$$scope={dirty:l,ctx:n}),a.$set(c)},i(s){o||(j(a.$$.fragment,s),o=!0)},o(s){ne(a.$$.fragment,s),o=!1},d(s){s&&(Y(e),Y(i)),be(a,s)}}}function Y5(n){let e,t;return e=new T5({props:{action:n[28],plugin:n[1],updateActions:n[19]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function j5(n){let e,t;return e=new F5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Z5(n){let e,t;return e=new C5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function J5(n){let e,t;return e=new I5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function X5(n){let e,t;return e=new P5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Q5(n){let e,t;return e=new k5({props:{action:n[28],plugin:n[1],updateActions:n[20]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function K5(n){let e,t;return e=new B5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function e8(n){let e,t;return e=new O5({props:{action:n[28],plugin:n[1],updateActions:n[21]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function t8(n){let e,t;return e=new R5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function r8(n){let e,t;return e=new L5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function n8(n){let e,t;return e=new V5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function i8(n){let e,t;return e=new U5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function a8(n){let e,t;return e=new q5({props:{action:n[28],plugin:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function o8(n,e){let t,r,i,a,o,u,s,l,c,f,p,m,h,d,v,y,S;r=new Is({props:{$$slots:{default:[dne]},$$scope:{ctx:e}}});let b=e[28].type==="command"&&Y5(e),w=e[28].type==="open"&&j5(e),A=e[28].type==="js"&&Z5(e),x=e[28].type==="input"&&J5(e),D=e[28].type==="sleep"&&X5(e),E=e[28].type==="templaterCreateNote"&&Q5(e),_=e[28].type==="updateMetadata"&&K5(e),N=e[28].type==="createNote"&&e8(e),P=e[28].type==="replaceInNote"&&t8(e),B=e[28].type==="regexpReplaceInNote"&&r8(e),V=e[28].type==="replaceSelf"&&n8(e),z=e[28].type==="insertIntoNote"&&i8(e),L=e[28].type==="inlineJS"&&a8(e);return{key:n,first:null,c(){t=Er(),xe(r.$$.fragment),i=fe(),b&&b.c(),a=fe(),w&&w.c(),o=fe(),A&&A.c(),u=fe(),x&&x.c(),s=fe(),D&&D.c(),l=fe(),E&&E.c(),c=fe(),_&&_.c(),f=fe(),N&&N.c(),p=fe(),P&&P.c(),m=fe(),B&&B.c(),h=fe(),V&&V.c(),d=fe(),z&&z.c(),v=fe(),L&&L.c(),y=Er(),this.first=t},m(k,C){J(k,t,C),ye(r,k,C),J(k,i,C),b&&b.m(k,C),J(k,a,C),w&&w.m(k,C),J(k,o,C),A&&A.m(k,C),J(k,u,C),x&&x.m(k,C),J(k,s,C),D&&D.m(k,C),J(k,l,C),E&&E.m(k,C),J(k,c,C),_&&_.m(k,C),J(k,f,C),N&&N.m(k,C),J(k,p,C),P&&P.m(k,C),J(k,m,C),B&&B.m(k,C),J(k,h,C),V&&V.m(k,C),J(k,d,C),z&&z.m(k,C),J(k,v,C),L&&L.m(k,C),J(k,y,C),S=!0},p(k,C){e=k;let W={};C[0]&3|C[1]&32&&(W.$$scope={dirty:C,ctx:e}),r.$set(W),e[28].type==="command"?b?(b.p(e,C),C[0]&1&&j(b,1)):(b=Y5(e),b.c(),j(b,1),b.m(a.parentNode,a)):b&&(bt(),ne(b,1,1,()=>{b=null}),xt()),e[28].type==="open"?w?(w.p(e,C),C[0]&1&&j(w,1)):(w=j5(e),w.c(),j(w,1),w.m(o.parentNode,o)):w&&(bt(),ne(w,1,1,()=>{w=null}),xt()),e[28].type==="js"?A?(A.p(e,C),C[0]&1&&j(A,1)):(A=Z5(e),A.c(),j(A,1),A.m(u.parentNode,u)):A&&(bt(),ne(A,1,1,()=>{A=null}),xt()),e[28].type==="input"?x?(x.p(e,C),C[0]&1&&j(x,1)):(x=J5(e),x.c(),j(x,1),x.m(s.parentNode,s)):x&&(bt(),ne(x,1,1,()=>{x=null}),xt()),e[28].type==="sleep"?D?(D.p(e,C),C[0]&1&&j(D,1)):(D=X5(e),D.c(),j(D,1),D.m(l.parentNode,l)):D&&(bt(),ne(D,1,1,()=>{D=null}),xt()),e[28].type==="templaterCreateNote"?E?(E.p(e,C),C[0]&1&&j(E,1)):(E=Q5(e),E.c(),j(E,1),E.m(c.parentNode,c)):E&&(bt(),ne(E,1,1,()=>{E=null}),xt()),e[28].type==="updateMetadata"?_?(_.p(e,C),C[0]&1&&j(_,1)):(_=K5(e),_.c(),j(_,1),_.m(f.parentNode,f)):_&&(bt(),ne(_,1,1,()=>{_=null}),xt()),e[28].type==="createNote"?N?(N.p(e,C),C[0]&1&&j(N,1)):(N=e8(e),N.c(),j(N,1),N.m(p.parentNode,p)):N&&(bt(),ne(N,1,1,()=>{N=null}),xt()),e[28].type==="replaceInNote"?P?(P.p(e,C),C[0]&1&&j(P,1)):(P=t8(e),P.c(),j(P,1),P.m(m.parentNode,m)):P&&(bt(),ne(P,1,1,()=>{P=null}),xt()),e[28].type==="regexpReplaceInNote"?B?(B.p(e,C),C[0]&1&&j(B,1)):(B=r8(e),B.c(),j(B,1),B.m(h.parentNode,h)):B&&(bt(),ne(B,1,1,()=>{B=null}),xt()),e[28].type==="replaceSelf"?V?(V.p(e,C),C[0]&1&&j(V,1)):(V=n8(e),V.c(),j(V,1),V.m(d.parentNode,d)):V&&(bt(),ne(V,1,1,()=>{V=null}),xt()),e[28].type==="insertIntoNote"?z?(z.p(e,C),C[0]&1&&j(z,1)):(z=i8(e),z.c(),j(z,1),z.m(v.parentNode,v)):z&&(bt(),ne(z,1,1,()=>{z=null}),xt()),e[28].type==="inlineJS"?L?(L.p(e,C),C[0]&1&&j(L,1)):(L=a8(e),L.c(),j(L,1),L.m(y.parentNode,y)):L&&(bt(),ne(L,1,1,()=>{L=null}),xt())},i(k){S||(j(r.$$.fragment,k),j(b),j(w),j(A),j(x),j(D),j(E),j(_),j(N),j(P),j(B),j(V),j(z),j(L),S=!0)},o(k){ne(r.$$.fragment,k),ne(b),ne(w),ne(A),ne(x),ne(D),ne(E),ne(_),ne(N),ne(P),ne(B),ne(V),ne(z),ne(L),S=!1},d(k){k&&(Y(t),Y(i),Y(a),Y(o),Y(u),Y(s),Y(l),Y(c),Y(f),Y(p),Y(m),Y(h),Y(d),Y(v),Y(y)),be(r,k),b&&b.d(k),w&&w.d(k),A&&A.d(k),x&&x.d(k),D&&D.d(k),E&&E.d(k),_&&_.d(k),N&&N.d(k),P&&P.d(k),B&&B.d(k),V&&V.d(k),z&&z.d(k),L&&L.d(k)}}}function hne(n){let e=n[2].options.submitText+"",t;return{c(){t=He(e)},m(r,i){J(r,t,i)},p(r,i){i[0]&4&&e!==(e=r[2].options.submitText+"")&&yt(t,e)},d(r){r&&Y(t)}}}function gne(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function vne(n){let e,t,r,i;return e=new It({props:{variant:"primary",$$slots:{default:[hne]},$$scope:{ctx:n}}}),e.$on("click",n[23]),r=new It({props:{variant:"default",$$slots:{default:[gne]},$$scope:{ctx:n}}}),r.$on("click",n[24]),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,o){let u={};o[0]&4|o[1]&32&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o[1]&32&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function yne(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h,d,v,y,S,b,w,A=[],x=new Map,D,E,_,N,P,B,V,z,L;e=new Xt({props:{name:"Label",description:"The label shown on the button.",$$slots:{default:[ane]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",$$slots:{default:[one]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Style",description:"The style variant of the button",$$slots:{default:[sne]},$$scope:{ctx:n}}}),u=new Xt({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:[une]},$$scope:{ctx:n}}}),l=new Xt({props:{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",$$slots:{default:[lne]},$$scope:{ctx:n}}}),f=new Xt({props:{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",$$slots:{default:[cne]},$$scope:{ctx:n}}}),m=new Xt({props:{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",$$slots:{default:[fne]},$$scope:{ctx:n}}});let k=ct(Object.values(bo)),C=[];for(let H=0;H<k.length;H+=1)C[H]=W5($5(n,k,H));b=new It({props:{variant:"primary",$$slots:{default:[pne]},$$scope:{ctx:n}}}),b.$on("click",n[17]);let W=ct(n[0].actions??[]),O=H=>H[30];for(let H=0;H<W.length;H+=1){let Z=z5(n,W,H),Q=O(Z);x.set(Q,A[H]=o8(Q,Z))}return B=new no({props:{$$slots:{default:[vne]},$$scope:{ctx:n}}}),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment),i=fe(),xe(a.$$.fragment),o=fe(),xe(u.$$.fragment),s=fe(),xe(l.$$.fragment),c=fe(),xe(f.$$.fragment),p=fe(),xe(m.$$.fragment),h=fe(),d=ee("h4"),d.textContent="Actions",v=He(`
Add action of type
`),y=ee("select");for(let H=0;H<C.length;H+=1)C[H].c();S=fe(),xe(b.$$.fragment),w=fe();for(let H=0;H<A.length;H+=1)A[H].c();D=fe(),E=ee("h4"),E.textContent="Preview",_=fe(),N=ee("div"),P=fe(),xe(B.$$.fragment),q(y,"class","dropdown"),n[4]===void 0&&Ga(()=>n[16].call(y))},m(H,Z){ye(e,H,Z),J(H,t,Z),ye(r,H,Z),J(H,i,Z),ye(a,H,Z),J(H,o,Z),ye(u,H,Z),J(H,s,Z),ye(l,H,Z),J(H,c,Z),ye(f,H,Z),J(H,p,Z),ye(m,H,Z),J(H,h,Z),J(H,d,Z),J(H,v,Z),J(H,y,Z);for(let Q=0;Q<C.length;Q+=1)C[Q]&&C[Q].m(y,null);Jo(y,n[4],!0),J(H,S,Z),ye(b,H,Z),J(H,w,Z);for(let Q=0;Q<A.length;Q+=1)A[Q]&&A[Q].m(H,Z);J(H,D,Z),J(H,E,Z),J(H,_,Z),J(H,N,Z),n[22](N),J(H,P,Z),ye(B,H,Z),V=!0,z||(L=Fe(y,"change",n[16]),z=!0)},p(H,Z){let Q={};Z[0]&1|Z[1]&32&&(Q.$$scope={dirty:Z,ctx:H}),e.$set(Q);let U={};Z[0]&1|Z[1]&32&&(U.$$scope={dirty:Z,ctx:H}),r.$set(U);let de={};Z[0]&1|Z[1]&32&&(de.$$scope={dirty:Z,ctx:H}),a.$set(de);let De={};Z[0]&1|Z[1]&32&&(De.$$scope={dirty:Z,ctx:H}),u.$set(De);let me={};Z[0]&1|Z[1]&32&&(me.$$scope={dirty:Z,ctx:H}),l.$set(me);let _e={};Z[0]&1|Z[1]&32&&(_e.$$scope={dirty:Z,ctx:H}),f.$set(_e);let Ne={};if(Z[0]&1|Z[1]&32&&(Ne.$$scope={dirty:Z,ctx:H}),m.$set(Ne),Z&0){k=ct(Object.values(bo));let Ee;for(Ee=0;Ee<k.length;Ee+=1){let Ce=$5(H,k,Ee);C[Ee]?C[Ee].p(Ce,Z):(C[Ee]=W5(Ce),C[Ee].c(),C[Ee].m(y,null))}for(;Ee<C.length;Ee+=1)C[Ee].d(1);C.length=k.length}Z[0]&16&&Jo(y,H[4]);let Se={};Z[1]&32&&(Se.$$scope={dirty:Z,ctx:H}),b.$set(Se),Z[0]&451&&(W=ct(H[0].actions??[]),bt(),A=Qu(A,Z,O,1,H,W,x,D.parentNode,Np,o8,D,z5),xt());let Me={};Z[0]&5|Z[1]&32&&(Me.$$scope={dirty:Z,ctx:H}),B.$set(Me)},i(H){if(!V){j(e.$$.fragment,H),j(r.$$.fragment,H),j(a.$$.fragment,H),j(u.$$.fragment,H),j(l.$$.fragment,H),j(f.$$.fragment,H),j(m.$$.fragment,H),j(b.$$.fragment,H);for(let Z=0;Z<W.length;Z+=1)j(A[Z]);j(B.$$.fragment,H),V=!0}},o(H){ne(e.$$.fragment,H),ne(r.$$.fragment,H),ne(a.$$.fragment,H),ne(u.$$.fragment,H),ne(l.$$.fragment,H),ne(f.$$.fragment,H),ne(m.$$.fragment,H),ne(b.$$.fragment,H);for(let Z=0;Z<A.length;Z+=1)ne(A[Z]);ne(B.$$.fragment,H),V=!1},d(H){H&&(Y(t),Y(i),Y(o),Y(s),Y(c),Y(p),Y(h),Y(d),Y(v),Y(y),Y(S),Y(w),Y(D),Y(E),Y(_),Y(N),Y(P)),be(e,H),be(r,H),be(a,H),be(u,H),be(l,H),be(f,H),be(m,H),Qt(C,H),be(b,H);for(let Z=0;Z<A.length;Z+=1)A[Z].d(H);n[22](null),be(B,H),z=!1,L()}}}function bne(n,e,t){let{plugin:r}=e,{modal:i}=e,{buttonConfig:a}=e,o,u,s;Gs(()=>{u?.unmount()});function l(L,k){u?.unmount(),k&&(mt.empty(k),u=new Qo(r,L,"","block",void 0,!0),u.mount(k))}function c(){a.actions?.push(r.api.buttonActionRunner.createDefaultAction(s)),t(0,a)}function f(L){a.actions?.splice(L,1),t(0,a)}function p(){t(0,a)}function m(L){return L==="command"?"Run a Command":L==="open"?"Open a Link":L==="js"?"Run a JavaScript File":L==="input"?"Insert Text at Cursor":L==="sleep"?"Sleep for Some Time":L==="templaterCreateNote"?"Create a New Note Using Templater":L==="updateMetadata"?"Update Metadata":L==="createNote"?"Create a New Note":L==="replaceInNote"?"Replace Text in Note":L==="regexpReplaceInNote"?"Replace Text in Note using Regexp":L==="replaceSelf"?"Replace Button with Text":L==="insertIntoNote"?"Insert Text into the Note":L==="inlineJS"?"Run JavaScript Code":"CHANGE ME"}function h(L,k){if(a.actions===void 0)return;let C=[];L>0&&C.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(a.actions===void 0)return;let W=a.actions[L-1];t(0,a.actions[L-1]=a.actions[L],a),t(0,a.actions[L]=W,a)}}),L<a.actions.length-1&&C.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(a.actions===void 0)return;let W=a.actions[L+1];t(0,a.actions[L+1]=a.actions[L],a),t(0,a.actions[L]=W,a)}}),C.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(L)}),r.internal.createContextMenu(C).showWithEvent(k)}function d(){a.label=this.value,t(0,a)}function v(){a.icon=this.value,t(0,a)}function y(){a.style=vc(this),t(0,a)}function S(){a.class=this.value,t(0,a)}function b(){a.tooltip=this.value,t(0,a)}function w(){a.id=this.value,t(0,a)}function A(L){n.$$.not_equal(a.hidden,L)&&(a.hidden=L,t(0,a))}function x(){s=vc(this),t(4,s)}let D=()=>c(),E=(L,k)=>h(L,k),_=()=>p(),N=()=>p(),P=()=>p();function B(L){Pr[L?"unshift":"push"](()=>{o=L,t(3,o)})}let V=()=>i.okay(a),z=()=>i.cancel();return n.$$set=L=>{"plugin"in L&&t(1,r=L.plugin),"modal"in L&&t(2,i=L.modal),"buttonConfig"in L&&t(0,a=L.buttonConfig)},n.$$.update=()=>{n.$$.dirty[0]&9&&l(a,o)},[a,r,i,o,s,c,p,m,h,d,v,y,S,b,w,A,x,D,E,_,N,P,B,V,z]}var aM=class extends Pe{constructor(e){super(),Be(this,e,bne,yne,ke,{plugin:1,modal:2,buttonConfig:0},null,[-1,-1])}},s8=aM;var Zl=class extends Zn{setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new Ut({errorLevel:"CRITICAL",effect:"Failed to close modal.",cause:"Modal reference in ModalContent is undefined."})}};var Vh=class extends Zl{constructor(e,t){super(),this.plugin=e,this.options=t}onMount(e){mt.empty(e),this.component&&this.component.$destroy(),this.component=new s8({target:e,props:{plugin:this.plugin,modal:this,buttonConfig:this.options.config??this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){mt.empty(e),this.component&&this.component.$destroy()}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var Au=class extends Zl{constructor(e){super(),this.createComponent=e}onMount(e){mt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component?.$destroy(),mt.empty(e)}};var c8=wr(pc());function xne(n){ia(n,"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 u8(n,e,t){let r=n.slice();return r[10]=e[t],r}function wne(n,e,t){let r=n.slice();return r[13]=e[t],r}function _ne(n){let e,t,r;return{c(){e=ee("div"),t=ee("span"),t.textContent=`${n[13]}`,r=fe(),q(t,"class","cell-text svelte-12l82wb"),q(e,"class","cell header-cell svelte-12l82wb")},m(i,a){J(i,e,a),K(e,t),K(e,r)},p:Ke,d(i){i&&Y(e)}}}function l8(n,e){let t,r,i=(e[10]||"")+"",a,o,u,s;function l(){return e[6](e[10])}function c(...f){return e[7](e[10],...f)}return{key:n,first:null,c(){t=ee("div"),r=ee("span"),a=He(i),o=fe(),q(r,"class","cell-text svelte-12l82wb"),q(t,"class","cell svelte-12l82wb"),q(t,"role","button"),q(t,"tabindex","0"),Yt(t,"highlight",e[10]),Yt(t,"content-cell",e[10]),Yt(t,"selected",e[0]?.year()===e[2]&&e[0]?.month()===e[1]&&e[0]?.date()===e[10]),this.first=t},m(f,p){J(f,t,p),K(t,r),K(r,a),K(t,o),u||(s=[Fe(t,"click",l),Fe(t,"keydown",c)],u=!0)},p(f,p){e=f,p&8&&i!==(i=(e[10]||"")+"")&&yt(a,i),p&8&&Yt(t,"highlight",e[10]),p&8&&Yt(t,"content-cell",e[10]),p&15&&Yt(t,"selected",e[0]?.year()===e[2]&&e[0]?.month()===e[1]&&e[0]?.date()===e[10])},d(f){f&&Y(t),u=!1,Ft(s)}}}function Sne(n){let e,t,r,i,a=[],o=new Map,u=ct(EE()),s=[];for(let f=0;f<u.length;f+=1)s[f]=_ne(wne(n,u,f));let l=ct(n[3]),c=f=>DE();for(let f=0;f<l.length;f+=1){let p=u8(n,l,f),m=c(p);o.set(m,a[f]=l8(m,p))}return{c(){e=ee("div"),t=ee("div");for(let f=0;f<s.length;f+=1)s[f].c();r=fe(),i=ee("div");for(let f=0;f<a.length;f+=1)a[f].c();q(t,"class","calendar-header svelte-12l82wb"),q(i,"class","calendar-content svelte-12l82wb"),q(e,"class","calendar svelte-12l82wb")},m(f,p){J(f,e,p),K(e,t);for(let m=0;m<s.length;m+=1)s[m]&&s[m].m(t,null);K(e,r),K(e,i);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(i,null)},p(f,[p]){p&63&&(l=ct(f[3]),a=Qu(a,p,c,1,f,l,o,i,fD,l8,null,u8))},i:Ke,o:Ke,d(f){f&&Y(e),Qt(s,f);for(let p=0;p<a.length;p+=1)a[p].d()}}}function Ane(n,e,t){let r=Ws(),{selectedDate:i}=e,{month:a}=e,{year:o}=e,u;function s(m){r("dateChange",(0,c8.default)(new Date(o,a,m)))}function l(m){m&&s(m)}function c(m,h){m.key===" "&&l(h)}let f=m=>l(m),p=(m,h)=>c(h,m);return n.$$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)},n.$$.update=()=>{n.$$.dirty&6&&t(3,u=ME(a,o))},[i,a,o,u,l,c,f,p]}var oM=class extends Pe{constructor(e){super(),Be(this,e,Ane,Sne,ke,{selectedDate:0,month:1,year:2},xne)}},f8=oM;var Uh=wr(pc());function Mne(n){ia(n,"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 Ene(n){let e,t,r,i,a,o,u=Ig(n[1])+"",s,l,c,f,p,m,h,d,v,y,S,b,w,A,x,D;return d=new f8({props:{month:n[1],year:n[2],selectedDate:n[0]}}),d.$on("dateChange",n[6]),{c(){e=ee("div"),t=ee("div"),r=ee("button"),r.textContent="Prev",i=fe(),a=ee("div"),o=ee("span"),s=He(u),l=fe(),c=ee("input"),p=fe(),m=ee("button"),m.textContent="Next",h=fe(),xe(d.$$.fragment),v=fe(),y=ee("div"),S=ee("button"),S.textContent="Set no Date",b=fe(),w=ee("button"),w.textContent="Set to Now",q(r,"class","month-switch-button svelte-berpp6"),q(o,"class","date-picker-header-text-month svelte-berpp6"),q(c,"class","date-picker-header-text-year svelte-berpp6"),q(c,"type","number"),c.value=f=n[2].toString(),q(a,"class","date-picker-header-text svelte-berpp6"),q(m,"class","month-switch-button svelte-berpp6"),q(t,"class","date-picker-header svelte-berpp6"),q(S,"class","none-button svelte-berpp6"),q(w,"class","none-button svelte-berpp6"),q(y,"class","date-picker-footer svelte-berpp6"),q(e,"class","date-picker svelte-berpp6")},m(E,_){J(E,e,_),K(e,t),K(t,r),K(t,i),K(t,a),K(a,o),K(o,s),K(a,l),K(a,c),K(t,p),K(t,m),K(e,h),ye(d,e,null),K(e,v),K(e,y),K(y,S),K(y,b),K(y,w),A=!0,x||(D=[Fe(r,"click",n[4]),Fe(c,"input",n[5]),Fe(m,"click",n[3]),Fe(S,"click",n[7]),Fe(w,"click",n[8])],x=!0)},p(E,[_]){(!A||_&2)&&u!==(u=Ig(E[1])+"")&&yt(s,u),(!A||_&4&&f!==(f=E[2].toString())&&c.value!==f)&&(c.value=f);let N={};_&2&&(N.month=E[1]),_&4&&(N.year=E[2]),_&1&&(N.selectedDate=E[0]),d.$set(N)},i(E){A||(j(d.$$.fragment,E),A=!0)},o(E){ne(d.$$.fragment,E),A=!1},d(E){E&&Y(e),be(d),x=!1,Ft(D)}}}function Dne(n,e,t){let{selectedDate:r=(0,Uh.default)()}=e,{dateChangeCallback:i}=e,a,o;function u(){if(a===11){t(1,a=0),t(2,o+=1);return}t(1,a=a+1)}function s(){if(a===0){t(1,a=11),t(2,o-=1);return}t(1,a-=1)}function l(m){let h=m.target.value,d=Number.parseInt(h);Number.isNaN(d)||t(2,o=d)}function c(m){t(0,r=m.detail),i(m.detail)}function f(){t(0,r=null),i(null)}function p(){t(0,r=(0,Uh.default)()),i(r)}return n.$$set=m=>{"selectedDate"in m&&t(0,r=m.selectedDate),"dateChangeCallback"in m&&t(9,i=m.dateChangeCallback)},n.$$.update=()=>{if(n.$$.dirty&1)if(r)t(1,a=r.month()),t(2,o=r.year());else{let m=(0,Uh.default)();t(1,a=m.month()),t(2,o=m.year())}},[r,a,o,u,s,l,c,f,p,i]}var sM=class extends Pe{constructor(e){super(),Be(this,e,Dne,Ene,ke,{selectedDate:0,dateChangeCallback:9},Mne)}},p8=sM;function Nne(n){let e,t,r,i,a,o,u,s,l;return{c(){e=ee("div"),t=ee("img"),i=fe(),a=ee("div"),o=ee("span"),u=He(n[1]),q(t,"class","mb-image-card-image"),na(t.src,r=n[0].internal.imagePathToUri(n[1]))||q(t,"src",r),q(t,"alt",n[1]),q(a,"class","mb-image-card-footer"),q(e,"class","mb-image-card"),q(e,"role","button"),q(e,"tabindex","0")},m(c,f){J(c,e,f),K(e,t),K(e,i),K(e,a),K(a,o),K(o,u),s||(l=[Fe(e,"click",n[4]),Fe(e,"keydown",n[5])],s=!0)},p(c,[f]){f&3&&!na(t.src,r=c[0].internal.imagePathToUri(c[1]))&&q(t,"src",r),f&2&&q(t,"alt",c[1]),f&2&&yt(u,c[1])},i:Ke,o:Ke,d(c){c&&Y(e),s=!1,Ft(l)}}}function Tne(n,e,t){let{plugin:r}=e,{image:i}=e,{onSelect:a}=e;function o(l,c){l.key===" "&&a(c)}let u=()=>a(i),s=l=>o(l,i);return n.$$set=l=>{"plugin"in l&&t(0,r=l.plugin),"image"in l&&t(1,i=l.image),"onSelect"in l&&t(2,a=l.onSelect)},[r,i,a,o,u,s]}var uM=class extends Pe{constructor(e){super(),Be(this,e,Tne,Nne,ke,{plugin:0,image:1,onSelect:2})}},m8=uM;function d8(n,e,t){let r=n.slice();return r[8]=e[t],r}function h8(n){let e,t;return e=new m8({props:{plugin:n[0],image:n[8].value,onSelect:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),i&8&&(a.image=r[8].value),i&2&&(a.onSelect=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Cne(n){let e,t,r,i,a,o,u,s=ct(n[3]),l=[];for(let f=0;f<s.length;f+=1)l[f]=h8(d8(n,s,f));let c=f=>ne(l[f],1,1,()=>{l[f]=null});return{c(){e=ee("div"),t=ee("input"),r=fe(),i=ee("div");for(let f=0;f<l.length;f+=1)l[f].c();q(t,"type","text"),q(t,"placeholder","Search Images..."),q(e,"class","mb-image-search-container"),q(i,"class","mb-image-card-grid")},m(f,p){J(f,e,p),K(e,t),je(t,n[2]),J(f,r,p),J(f,i,p);for(let m=0;m<l.length;m+=1)l[m]&&l[m].m(i,null);a=!0,o||(u=Fe(t,"input",n[5]),o=!0)},p(f,[p]){if(p&4&&t.value!==f[2]&&je(t,f[2]),p&11){s=ct(f[3]);let m;for(m=0;m<s.length;m+=1){let h=d8(f,s,m);l[m]?(l[m].p(h,p),j(l[m],1)):(l[m]=h8(h),l[m].c(),j(l[m],1),l[m].m(i,null))}for(bt(),m=s.length;m<l.length;m+=1)c(m);xt()}},i(f){if(!a){for(let p=0;p<s.length;p+=1)j(l[p]);a=!0}},o(f){l=l.filter(Boolean);for(let p=0;p<l.length;p+=1)ne(l[p]);a=!1},d(f){f&&(Y(e),Y(r),Y(i)),Qt(l,f),o=!1,u()}}}function Fne(n,e,t){let{plugin:r}=e,{options:i}=e,{onSelect:a}=e,o="",u,s=r.internal.createFuzzySearch();function l(f){if(!f){t(3,u=i);return}s.setSearch(f),t(3,u=s.filterItems(i,p=>p.value))}function c(){o=this.value,t(2,o)}return n.$$set=f=>{"plugin"in f&&t(0,r=f.plugin),"options"in f&&t(4,i=f.options),"onSelect"in f&&t(1,a=f.onSelect)},n.$$.update=()=>{n.$$.dirty&4&&l(o)},[r,a,o,u,i,c]}var lM=class extends Pe{constructor(e){super(),Be(this,e,Fne,Cne,ke,{plugin:0,options:4,onSelect:1})}},g8=lM;function v8(n,e,t){let r=n.slice();return r[1]=e[t],r}function Ine(n){let e,t,r,i=n[0].stack+"",a;return{c(){e=ee("div"),t=ee("pre"),r=ee("code"),a=He(i),q(r,"class","language-none mb-none"),q(t,"class","mb-pre"),q(e,"class","mb-card")},m(o,u){J(o,e,u),K(e,t),K(t,r),K(r,a)},p(o,u){u&1&&i!==(i=o[0].stack+"")&&yt(a,i)},d(o){o&&Y(e)}}}function Pne(n){let e,t,r,i=n[0].errorLevel+"",a,o,u=n[0].getErrorType()+"",s,l,c,f,p=n[0].effect+"",m,h,d,v,y,S,b,w,A,x=n[0].cause+"",D,E,_,N,P,B,V=n[0].effect+"",z,L,k,C,W=n[0].positionContext&&y8(n),O=n[0].tip&&b8(n),H=n[0].docs&&x8(n),Z=n[0].context&&_8(n);return{c(){e=ee("div"),t=ee("h6"),r=ee("span"),a=He(i),o=He(`
[`),s=He(u),l=He("]"),f=He(`
- `),m=He(p),h=fe(),W&&W.c(),d=fe(),v=ee("table"),y=ee("tbody"),S=ee("tr"),b=ee("td"),b.textContent="Cause",w=fe(),A=ee("td"),D=He(x),E=fe(),_=ee("tr"),N=ee("td"),N.textContent="Effect",P=fe(),B=ee("td"),z=He(V),L=fe(),O&&O.c(),k=fe(),H&&H.c(),C=fe(),Z&&Z.c(),q(r,"class",c=n[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),q(e,"class","mb-card mb-card-full-width markdown-rendered")},m(Q,U){J(Q,e,U),K(e,t),K(t,r),K(r,a),K(r,o),K(r,s),K(r,l),K(t,f),K(t,m),K(e,h),W&&W.m(e,null),K(e,d),K(e,v),K(v,y),K(y,S),K(S,b),K(S,w),K(S,A),K(A,D),K(y,E),K(y,_),K(_,N),K(_,P),K(_,B),K(B,z),K(y,L),O&&O.m(y,null),K(y,k),H&&H.m(y,null),K(y,C),Z&&Z.m(y,null)},p(Q,U){U&1&&i!==(i=Q[0].errorLevel+"")&&yt(a,i),U&1&&u!==(u=Q[0].getErrorType()+"")&&yt(s,u),U&1&&c!==(c=Q[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")&&q(r,"class",c),U&1&&p!==(p=Q[0].effect+"")&&yt(m,p),Q[0].positionContext?W?W.p(Q,U):(W=y8(Q),W.c(),W.m(e,d)):W&&(W.d(1),W=null),U&1&&x!==(x=Q[0].cause+"")&&yt(D,x),U&1&&V!==(V=Q[0].effect+"")&&yt(z,V),Q[0].tip?O?O.p(Q,U):(O=b8(Q),O.c(),O.m(y,k)):O&&(O.d(1),O=null),Q[0].docs?H?H.p(Q,U):(H=x8(Q),H.c(),H.m(y,C)):H&&(H.d(1),H=null),Q[0].context?Z?Z.p(Q,U):(Z=_8(Q),Z.c(),Z.m(y,null)):Z&&(Z.d(1),Z=null)},d(Q){Q&&Y(e),W&&W.d(),O&&O.d(),H&&H.d(),Z&&Z.d()}}}function y8(n){let e,t,r=n[0].positionContext+"",i;return{c(){e=ee("pre"),t=ee("code"),i=He(r),q(t,"class","language-none mb-none"),q(e,"class","mb-pre")},m(a,o){J(a,e,o),K(e,t),K(t,i)},p(a,o){o&1&&r!==(r=a[0].positionContext+"")&&yt(i,r)},d(a){a&&Y(e)}}}function b8(n){let e,t,r,i,a=n[0].tip+"",o;return{c(){e=ee("tr"),t=ee("td"),t.textContent="Tip",r=fe(),i=ee("td"),o=He(a)},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i),K(i,o)},p(u,s){s&1&&a!==(a=u[0].tip+"")&&yt(o,a)},d(u){u&&Y(e)}}}function x8(n){let e,t,r,i,a=ct(n[0].docs),o=[];for(let u=0;u<a.length;u+=1)o[u]=w8(v8(n,a,u));return{c(){e=ee("tr"),t=ee("td"),t.textContent="Docs",r=fe(),i=ee("td");for(let u=0;u<o.length;u+=1)o[u].c()},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i);for(let l=0;l<o.length;l+=1)o[l]&&o[l].m(i,null)},p(u,s){if(s&1){a=ct(u[0].docs);let l;for(l=0;l<a.length;l+=1){let c=v8(u,a,l);o[l]?o[l].p(c,s):(o[l]=w8(c),o[l].c(),o[l].m(i,null))}for(;l<o.length;l+=1)o[l].d(1);o.length=a.length}},d(u){u&&Y(e),Qt(o,u)}}}function w8(n){let e,t=n[1]+"",r,i,a;return{c(){e=ee("a"),r=He(t),a=ee("br"),q(e,"href",i=n[1])},m(o,u){J(o,e,u),K(e,r),J(o,a,u)},p(o,u){u&1&&t!==(t=o[1]+"")&&yt(r,t),u&1&&i!==(i=o[1])&&q(e,"href",i)},d(o){o&&(Y(e),Y(a))}}}function _8(n){let e,t,r,i,a,o,u=JSON.stringify(n[0].context,null,4)+"",s;return{c(){e=ee("tr"),t=ee("td"),t.textContent="Context",r=fe(),i=ee("td"),a=ee("pre"),o=ee("code"),s=He(u),q(o,"class","language-none mb-none"),q(a,"class","mb-pre")},m(l,c){J(l,e,c),K(e,t),K(e,r),K(e,i),K(i,a),K(a,o),K(o,s)},p(l,c){c&1&&u!==(u=JSON.stringify(l[0].context,null,4)+"")&&yt(s,u)},d(l){l&&Y(e)}}}function kne(n){let e;function t(a,o){return a[0]instanceof wn?Pne:Ine}let r=t(n,-1),i=r(n);return{c(){i.c(),e=Er()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Ke,o:Ke,d(a){a&&Y(e),i.d(a)}}}function Bne(n,e,t){let{error:r}=e;return n.$$set=i=>{"error"in i&&t(0,r=i.error)},[r]}var cM=class extends Pe{constructor(e){super(),Be(this,e,Bne,kne,ke,{error:0})}},fM=cM;function S8(n,e,t){let r=n.slice();return r[1]=e[t],r}function A8(n,e,t){let r=n.slice();return r[4]=e[t],r}function M8(n){let e,t=n[0].text+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].text+"")&&yt(r,t)},d(i){i&&Y(e)}}}function E8(n){let e,t,r=n[0].code+"",i;return{c(){e=ee("pre"),t=ee("code"),i=He(r),q(t,"class","language-none meta-bind-none"),q(e,"class","mb-pre")},m(a,o){J(a,e,o),K(e,t),K(t,i)},p(a,o){o&1&&r!==(r=a[0].code+"")&&yt(i,r)},d(a){a&&Y(e)}}}function D8(n){let e,t,r,i,a,o=n[0].errorText&&N8(n),u=ct(n[0].errorCollection.getErrors()),s=[];for(let c=0;c<u.length;c+=1)s[c]=T8(A8(n,u,c));let l=c=>ne(s[c],1,1,()=>{s[c]=null});return{c(){e=ee("h6"),e.textContent="Errors",t=fe(),o&&o.c(),r=fe();for(let c=0;c<s.length;c+=1)s[c].c();i=Er()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,r,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].errorText?o?o.p(c,f):(o=N8(c),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null),f&1){u=ct(c[0].errorCollection.getErrors());let p;for(p=0;p<u.length;p+=1){let m=A8(c,u,p);s[p]?(s[p].p(m,f),j(s[p],1)):(s[p]=T8(m),s[p].c(),j(s[p],1),s[p].m(i.parentNode,i))}for(bt(),p=u.length;p<s.length;p+=1)l(p);xt()}},i(c){if(!a){for(let f=0;f<u.length;f+=1)j(s[f]);a=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)ne(s[f]);a=!1},d(c){c&&(Y(e),Y(t),Y(r),Y(i)),o&&o.d(c),Qt(s,c)}}}function N8(n){let e,t=n[0].errorText+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].errorText+"")&&yt(r,t)},d(i){i&&Y(e)}}}function T8(n){let e,t;return e=new fM({props:{error:n[4]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.error=r[4]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function C8(n){let e,t,r,i,a,o=n[0].warningText&&F8(n),u=ct(n[0].errorCollection.getWarnings()),s=[];for(let c=0;c<u.length;c+=1)s[c]=I8(S8(n,u,c));let l=c=>ne(s[c],1,1,()=>{s[c]=null});return{c(){e=ee("h6"),e.textContent="Warnings",t=fe(),o&&o.c(),r=fe();for(let c=0;c<s.length;c+=1)s[c].c();i=Er()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,r,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].warningText?o?o.p(c,f):(o=F8(c),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null),f&1){u=ct(c[0].errorCollection.getWarnings());let p;for(p=0;p<u.length;p+=1){let m=S8(c,u,p);s[p]?(s[p].p(m,f),j(s[p],1)):(s[p]=I8(m),s[p].c(),j(s[p],1),s[p].m(i.parentNode,i))}for(bt(),p=u.length;p<s.length;p+=1)l(p);xt()}},i(c){if(!a){for(let f=0;f<u.length;f+=1)j(s[f]);a=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)ne(s[f]);a=!1},d(c){c&&(Y(e),Y(t),Y(r),Y(i)),o&&o.d(c),Qt(s,c)}}}function F8(n){let e,t=n[0].warningText+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].warningText+"")&&yt(r,t)},d(i){i&&Y(e)}}}function I8(n){let e,t;return e=new fM({props:{error:n[1]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.error=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function One(n){let e,t,r=n[0].errorCollection.hasErrors(),i,a=n[0].errorCollection.hasWarnings(),o,u,s=n[0].text&&M8(n),l=n[0].code&&E8(n),c=r&&D8(n),f=a&&C8(n);return{c(){s&&s.c(),e=fe(),l&&l.c(),t=fe(),c&&c.c(),i=fe(),f&&f.c(),o=Er()},m(p,m){s&&s.m(p,m),J(p,e,m),l&&l.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),u=!0},p(p,[m]){p[0].text?s?s.p(p,m):(s=M8(p),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),p[0].code?l?l.p(p,m):(l=E8(p),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null),m&1&&(r=p[0].errorCollection.hasErrors()),r?c?(c.p(p,m),m&1&&j(c,1)):(c=D8(p),c.c(),j(c,1),c.m(i.parentNode,i)):c&&(bt(),ne(c,1,1,()=>{c=null}),xt()),m&1&&(a=p[0].errorCollection.hasWarnings()),a?f?(f.p(p,m),m&1&&j(f,1)):(f=C8(p),f.c(),j(f,1),f.m(o.parentNode,o)):f&&(bt(),ne(f,1,1,()=>{f=null}),xt())},i(p){u||(j(c),j(f),u=!0)},o(p){ne(c),ne(f),u=!1},d(p){p&&(Y(e),Y(t),Y(i),Y(o)),s&&s.d(p),l&&l.d(p),c&&c.d(p),f&&f.d(p)}}}function Rne(n,e,t){let{settings:r}=e;return n.$$set=i=>{"settings"in i&&t(0,r=i.settings)},[r]}var pM=class extends Pe{constructor(e){super(),Be(this,e,Rne,One,ke,{settings:0})}},Ps=pM;function P8(n){let e,t,r,i,a;function o(l,c){return c&1&&(t=null),c&1&&(r=null),t==null&&(t=!!l[0].errorCollection.hasErrors()),t?Une:(r==null&&(r=!!l[0].errorCollection.hasWarnings()),r?Vne:Lne)}let u=o(n,-1),s=u(n);return{c(){e=ee("div"),s.c(),q(e,"class","mb-error-collection"),q(e,"role","button"),q(e,"tabindex","0")},m(l,c){J(l,e,c),s.m(e,null),i||(a=[Fe(e,"click",n[3]),Fe(e,"keydown",n[4])],i=!0)},p(l,c){u!==(u=o(l,c))&&(s.d(1),s=u(l),s&&(s.c(),s.m(e,null)))},d(l){l&&Y(e),s.d(),i=!1,Ft(a)}}}function Lne(n){let e,t,r,i;return{c(){e=Ui("svg"),t=Ui("circle"),r=Ui("path"),i=Ui("path"),q(t,"cx","12"),q(t,"cy","12"),q(t,"r","10"),q(r,"d","M12 16v-4"),q(i,"d","M12 8h.01"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-info")},m(a,o){J(a,e,o),K(e,t),K(e,r),K(e,i)},d(a){a&&Y(e)}}}function Vne(n){let e,t,r,i;return{c(){e=Ui("svg"),t=Ui("path"),r=Ui("line"),i=Ui("line"),q(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"),q(r,"x1","12"),q(r,"x2","12"),q(r,"y1","9"),q(r,"y2","13"),q(i,"x1","12"),q(i,"x2","12.01"),q(i,"y1","17"),q(i,"y2","17"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-alert-triangle")},m(a,o){J(a,e,o),K(e,t),K(e,r),K(e,i)},d(a){a&&Y(e)}}}function Une(n){let e,t,r,i,a,o;return{c(){e=Ui("svg"),t=Ui("circle"),r=Ui("line"),i=Ui("line"),a=fe(),o=ee("span"),o.textContent="[META_BIND_ERROR]",q(t,"cx","12"),q(t,"cy","12"),q(t,"r","10"),q(r,"x1","12"),q(r,"x2","12"),q(r,"y1","8"),q(r,"y2","12"),q(i,"x1","12"),q(i,"x2","12.01"),q(i,"y1","16"),q(i,"y2","16"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-alert-circle"),q(o,"class","mb-error")},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i),J(u,a,s),J(u,o,s)},d(u){u&&(Y(e),Y(a),Y(o))}}}function qne(n){let e=!n[0].errorCollection.isEmpty(),t,r=e&&P8(n);return{c(){r&&r.c(),t=Er()},m(i,a){r&&r.m(i,a),J(i,t,a)},p(i,[a]){a&1&&(e=!i[0].errorCollection.isEmpty()),e?r?r.p(i,a):(r=P8(i),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},i:Ke,o:Ke,d(i){i&&Y(t),r&&r.d(i)}}}function zne(n,e,t){let{plugin:r}=e,{settings:i}=e;function a(){r.internal.openErrorCollectionViewModal(i)}let o=()=>a(),u=s=>{s.key===" "&&a()};return n.$$set=s=>{"plugin"in s&&t(2,r=s.plugin),"settings"in s&&t(0,i=s.settings)},[i,a,r,o,u]}var mM=class extends Pe{constructor(e){super(),Be(this,e,zne,qne,ke,{plugin:2,settings:0})}},gf=mM;var qh=class extends ro{constructor(e,t,r){super(e,t),this.ipf=r}getItemText(e){return e.displayValue}getItems(){return this.plugin.internal.getSuggesterOptions(this.ipf)}};function $ne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[1]),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&2&&e.value!==i[1]&&je(e,i[1])},d(i){i&&Y(e),t=!1,r()}}}function Hne(n){let e,t,r;return{c(){e=ee("textarea")},m(i,a){J(i,e,a),je(e,n[1]),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&2&&je(e,i[1])},d(i){i&&Y(e),t=!1,r()}}}function Gne(n){let e;return{c(){e=He("OK")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Wne(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Yne(n){let e,t,r,i;return e=new It({props:{variant:"primary",$$slots:{default:[Gne]},$$scope:{ctx:n}}}),e.$on("click",n[4]),r=new It({props:{$$slots:{default:[Wne]},$$scope:{ctx:n}}}),r.$on("click",n[5]),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,o){let u={};o&64&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&64&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function jne(n){let e,t=n[0].subTitle+"",r,i,a,o,u,s;function l(p,m){return p[0].multiline?Hne:$ne}let c=l(n,-1),f=c(n);return u=new no({props:{$$slots:{default:[Yne]},$$scope:{ctx:n}}}),{c(){e=ee("p"),r=He(t),i=fe(),a=ee("div"),f.c(),o=fe(),xe(u.$$.fragment),q(a,"class","mb-full-width-text-input")},m(p,m){J(p,e,m),K(e,r),J(p,i,m),J(p,a,m),f.m(a,null),J(p,o,m),ye(u,p,m),s=!0},p(p,[m]){(!s||m&1)&&t!==(t=p[0].subTitle+"")&&yt(r,t),c===(c=l(p,m))&&f?f.p(p,m):(f.d(1),f=c(p),f&&(f.c(),f.m(a,null)));let h={};m&67&&(h.$$scope={dirty:m,ctx:p}),u.$set(h)},i(p){s||(j(u.$$.fragment,p),s=!0)},o(p){ne(u.$$.fragment,p),s=!1},d(p){p&&(Y(e),Y(i),Y(a),Y(o)),f.d(),be(u,p)}}}function Zne(n,e,t){let{options:r}=e,i=r.value;function a(){i=this.value,t(1,i)}function o(){i=this.value,t(1,i)}let u=()=>r.onSubmit(i),s=()=>r.onCancel();return n.$$set=l=>{"options"in l&&t(0,r=l.options)},[r,i,a,o,u,s]}var dM=class extends Pe{constructor(e){super(),Be(this,e,Zne,jne,ke,{options:0})}},k8=dM;var zh=class{constructor(e){this.plugin=e}openCommandSelectModal(e){this.createSearchModal(new Oh(this.plugin,e)).open()}openFileSelectModal(e){this.createSearchModal(new Rh(this.plugin,e)).open()}openFolderSelectModal(e){this.createSearchModal(new Lh(this.plugin,e)).open()}openButtonBuilderModal(e){this.createModal(new Vh(this.plugin,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,t){this.createSearchModal(new qh(this.plugin,t,e)).open()}openImageSuggesterModal(e,t){this.createModal(new Au((r,i)=>new g8({target:i,props:{plugin:this.plugin,options:this.getImageSuggesterOptions(e),onSelect:a=>{t(a),r.closeModal()}}})),{title:"Meta Bind Image Suggester",classes:["mb-image-suggester-modal"]}).open()}openDatePickerModal(e){this.createModal(new Au((t,r)=>new p8({target:r,props:{selectedDate:e.getInternalValue(),dateChangeCallback:i=>{e.setInternalValue(i),t.closeModal()}}})),{title:"Meta Bind Date Picker"}).open()}openTextPromptModal(e){this.createModal(new Au((t,r)=>new k8({target:r,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),t.closeModal()},onCancel:()=>{e.onCancel(),t.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new Au((t,r)=>new Ps({target:r,props:{settings:e}})),{title:"Meta Bind Error Overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,t){new gf({target:e,props:{plugin:this.plugin,settings:t}})}isFilePathExcluded(e){for(let t of this.plugin.settings.excludedFolders)if(e.startsWith(t))return!0;return!1}};var vf=require("obsidian");var $h=class{constructor(e,t,r,i,a){this.plugin=e,this.containerEl=t,this.code=i,this.hidden=a;let o=e.app.vault.getAbstractFileByPath(r);if(!(o instanceof vf.TFile))throw new Error(`File not found: ${r}`);this.file=o,this.jsEngine=Fs(this.plugin),this.renderComponent=new vf.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{mt.empty(this.containerEl),mt.removeClass(this.containerEl,"mb-error"),this.renderComponent.unload(),this.renderComponent=new vf.Component,this.renderComponent.load();let t=await this.evaluateCode(e),r=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);this.hidden||await r.render(t.result);let i=r.convertToSimpleObject(t.result);return console.log(i,typeof i),i}catch(t){t instanceof Error&&(this.containerEl.innerText=t.message,mt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var B8=require("obsidian");var Hh=class extends B8.Modal{constructor(e,t,r){super(e.app),this.content=t,t.setModal(this),this.options=r}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&mt.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}};var O8=require("obsidian"),Gh=class extends O8.FuzzySuggestModal{constructor(e,t){super(e.app),this.content=t}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,t){this.content.onSelected(e)}};var Ii=require("obsidian");var ks=class{constructor(e,t){this.value=e,this.displayValue=t}valueAsString(){return this.value?.toString()??"null"}};function R8(n){let e=[];for(let t of n.children)t instanceof Ii.TFile&&L8(t.extension)&&e.push(new ks(t.path,t.name)),t instanceof Ii.TFolder&&e.push(...R8(t));return e}function Jne(n,e,t){let r=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let u=new Cr({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 Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof Ii.TFolder)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}r.push(...R8(o))}for(let i of n){let a=Sa(i.value);if(!a){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof Ii.TFile)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!L8(o.extension)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Ii.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}r.push(new ks(o.path,o.name))}return r}function L8(n){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(n)}function V8(n,e){let t=e.mountable.getArguments("option"),r=e.mountable.getArguments("optionQuery");return Jne(t,r,n)}var U8=require("obsidian");function Xne(n,e,t,r,i){let a=[];for(let o of t)a.push(new ks(o.value,o.name));if(r.length>0){let o;try{o=D5(n)}catch(s){return new U8.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",s),a}let u=pe.object({name:pe.string().min(1),path:pe.string().min(1)});for(let s of r)o.pages(s.value,e).forEach(c=>{try{let f=c.file;if(!u.safeParse(f).success)return;let p=PV(f.path,f.name,i);a.push(new ks(p,`file: ${f.name}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function q8(n,e){let t=e.mountable.getArguments("option"),r=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return Xne(n,e.mountable.getFilePath(),t,r,i===void 0?"true":i.value)}var z8=require("obsidian"),Wh=class{constructor(){}setSearch(e){this.preparedSearch=(0,z8.prepareFuzzySearch)(e)}filterItems(e,t){return this.preparedSearch?e.filter(r=>this.preparedSearch?.(t(r))?.score!=null):e}};var $8=require("obsidian"),Yh=class{constructor(){this.menu=new $8.Menu}setItems(e){for(let t of e)this.menu.addItem(r=>{r.setTitle(t.name),t.icon&&r.setIcon(t.icon),t.warning&&r.setWarning(t.warning),r.onClick(t.onclick)})}show(e,t){this.menu.showAtPosition({x:e,y:t},document)}showWithEvent(e){this.menu.showAtMouseEvent(e)}};var jh=class extends zh{constructor(e){super(e),this.app=e.app}getLifecycleHookValidator(){return pe.instanceof(Ur.Component)}getImageSuggesterOptions(e){return V8(this.plugin,e)}getSuggesterOptions(e){return q8(this.plugin,e)}async renderMarkdown(e,t,r){let i=new Ur.Component;return i.load(),await Ur.MarkdownRenderer.render(this.app,e,t,r,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return Fs(this.plugin),!0}catch{return!1}}async jsEngineRunFile(e,t,r,i){let a=Fs(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof Ur.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),s=new Ur.Component;return await a.internal.executeFile(e,{component:s,container:i,context:{metadata:u,file:o,line:0},contextOverrides:r}),()=>s.unload()}async jsEngineRunCode(e,t,r,i){let a=Fs(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof Ur.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),s=new Ur.Component;return await a.internal.execute({code:e,component:s,container:i,context:{metadata:u,file:o,line:0},contextOverrides:r}),()=>s.unload()}createJsRenderer(e,t,r,i){return new $h(this.plugin,e,t,r,i)}openFile(e,t,r){this.app.workspace.openLinkText(e,t,r)}getFilePathByName(e,t=""){return this.app.metadataCache.getFirstLinkpathDest(e,t)?.path}showNotice(e){new Ur.Notice(e)}parseYaml(e){return(0,Ur.parseYaml)(e)}stringifyYaml(e){return(0,Ur.stringifyYaml)(e)}setIcon(e,t){(0,Ur.setIcon)(e,t)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,t){return new Hh(this.plugin,e,t)}createSearchModal(e){return new Gh(this.plugin,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Ur.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Ur.TFolder).map(e=>e.path)}createFuzzySearch(){return new Wh}async readFilePath(e){let t=this.app.vault.getAbstractFileByPath(e);if(!t||!(t instanceof Ur.TFile))throw new Error(`file not found: ${e}`);return this.app.vault.cachedRead(t)}writeFilePath(e,t){return this.app.vault.adapter.write(e,t)}createContextMenu(e){let t=new Yh;return t.setItems(e),t}async createFile(e,t,r,i){let a=this.app.vault.getAvailablePath((0,Ur.normalizePath)(e+"/"+t),r),o=await this.app.vault.create(a,"");if(i){let u=this.app.workspace.getLeaf(!1);u&&await u.openFile(o,{state:{mode:"source"}})}return o.path}async evaluateTemplaterTemplate(e,t){let r=qA(this.plugin),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof Ur.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof Ur.TFile))throw new Error(`Target file not found: ${t}`);let o=r.create_running_config(i,a,4);return await r.read_and_parse_template(o)}async createNoteWithTemplater(e,t,r,i){let a=qA(this.plugin),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof Ur.TFile))throw new Error(`Template file not found: ${e}`);let u;if(t!==void 0){let l=this.app.vault.getAbstractFileByPath(t);if(!l||!(l instanceof Ur.TFolder))throw new Error(`Folder not found: ${t}`);u=l}return(await a.create_new_note_from_template(o,u,r,i??!0))?.path}};var hM=require("obsidian");var Zh=class extends Lu{constructor(e,t,r){super(t,r),this.plugin=e,this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(i,a,o)=>{this.manager.onExternalUpdate(this,i.path,structuredClone(o.frontmatter)??{})}))}readExternal(e){let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof hM.TFile))throw new Ut({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let r=this.plugin.app.metadataCache.getFileCache(t)?.frontmatter;return structuredClone(r)??{}}getDefaultCacheItem(e){let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof hM.TFile))throw new Ut({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let r=this.plugin.app.metadataCache.getFileCache(t)?.frontmatter;return console.log("meta-bind | Obs Source >> loaded frontmatter",structuredClone(r),e),{data:structuredClone(r)??{},storagePath:e,file:t,...this.manager.getDefaultCacheItem()}}getTags(e){let t=this.plugin.app.metadataCache.getFileCache(e);if(!t)return[];let r=t.tags?.map(a=>a.tag.substring(1))??[],i=t.frontmatter?.tags;return i&&(Array.isArray(i)?r.push(...i):r.push(i)),Array.from(new Set(r))}async syncExternal(e){await this.plugin.app.fileManager.processFrontMatter(e.file,t=>{Object.assign(t,e.data)})}};var Qne=["true","false","on","off","yes","no"],Kne=new RegExp("\\b(("+Qne.join(")|(")+"))$","i"),yf={name:"yaml",token:function(n,e){var t=n.peek(),r=e.escaped;if(e.escaped=!1,t=="#"&&(n.pos==0||/\s/.test(n.string.charAt(n.pos-1))))return n.skipToEnd(),"comment";if(n.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&n.indentation()>e.keyCol)return n.skipToEnd(),"string";if(e.literal&&(e.literal=!1),n.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,n.match("---")||n.match("..."))return"def";if(n.match(/^\s*-\s+/))return"meta"}if(n.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!r&&t==",")return n.next(),"meta";if(e.inlinePairs>0&&!r&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,n.next(),"meta";if(e.pairStart){if(n.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(n.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&n.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&n.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(n.match(Kne))return"keyword"}return!e.pair&&n.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=n.indentation(),"atom"):e.pair&&n.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",n.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function Jh(n){var e=n.statementIndent,t=n.jsonld,r=n.json||t,i=n.typescript,a=n.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function $(yn){return{type:yn,style:"keyword"}}var ue=$("keyword a"),Ve=$("keyword b"),at=$("keyword c"),et=$("keyword d"),Vt=$("operator"),Ar={type:"atom",style:"atom"};return{if:$("if"),while:ue,with:ue,else:Ve,do:Ve,try:Ve,finally:Ve,return:et,break:et,continue:et,new:$("new"),delete:at,void:at,throw:at,debugger:$("debugger"),var:$("var"),const:$("var"),let:$("var"),function:$("function"),catch:$("catch"),for:$("for"),switch:$("switch"),case:$("case"),default:$("default"),in:Vt,typeof:Vt,instanceof:Vt,true:Ar,false:Ar,null:Ar,undefined:Ar,NaN:Ar,Infinity:Ar,this:$("this"),class:$("class"),super:$("atom"),yield:at,export:$("export"),import:$("import"),extends:at,await:at}}(),u=/[+\-*&%=<>!?|~^@]/,s=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function l($){for(var ue=!1,Ve,at=!1;(Ve=$.next())!=null;){if(!ue){if(Ve=="/"&&!at)return;Ve=="["?at=!0:at&&Ve=="]"&&(at=!1)}ue=!ue&&Ve=="\\"}}var c,f;function p($,ue,Ve){return c=$,f=Ve,ue}function m($,ue){var Ve=$.next();if(Ve=='"'||Ve=="'")return ue.tokenize=h(Ve),ue.tokenize($,ue);if(Ve=="."&&$.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(Ve=="."&&$.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ve))return p(Ve);if(Ve=="="&&$.eat(">"))return p("=>","operator");if(Ve=="0"&&$.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(Ve))return $.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(Ve=="/")return $.eat("*")?(ue.tokenize=d,d($,ue)):$.eat("/")?($.skipToEnd(),p("comment","comment")):Yr($,ue,1)?(l($),$.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string.special")):($.eat("="),p("operator","operator",$.current()));if(Ve=="`")return ue.tokenize=v,v($,ue);if(Ve=="#"&&$.peek()=="!")return $.skipToEnd(),p("meta","meta");if(Ve=="#"&&$.eatWhile(a))return p("variable","property");if(Ve=="<"&&$.match("!--")||Ve=="-"&&$.match("->")&&!/\S/.test($.string.slice(0,$.start)))return $.skipToEnd(),p("comment","comment");if(u.test(Ve))return(Ve!=">"||!ue.lexical||ue.lexical.type!=">")&&($.eat("=")?(Ve=="!"||Ve=="=")&&$.eat("="):/[<>*+\-|&?]/.test(Ve)&&($.eat(Ve),Ve==">"&&$.eat(Ve))),Ve=="?"&&$.eat(".")?p("."):p("operator","operator",$.current());if(a.test(Ve)){$.eatWhile(a);var at=$.current();if(ue.lastType!="."){if(o.propertyIsEnumerable(at)){var et=o[at];return p(et.type,et.style,at)}if(at=="async"&&$.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",at)}return p("variable","variable",at)}}function h($){return function(ue,Ve){var at=!1,et;if(t&&ue.peek()=="@"&&ue.match(s))return Ve.tokenize=m,p("jsonld-keyword","meta");for(;(et=ue.next())!=null&&!(et==$&&!at);)at=!at&&et=="\\";return at||(Ve.tokenize=m),p("string","string")}}function d($,ue){for(var Ve=!1,at;at=$.next();){if(at=="/"&&Ve){ue.tokenize=m;break}Ve=at=="*"}return p("comment","comment")}function v($,ue){for(var Ve=!1,at;(at=$.next())!=null;){if(!Ve&&(at=="`"||at=="$"&&$.eat("{"))){ue.tokenize=m;break}Ve=!Ve&&at=="\\"}return p("quasi","string.special",$.current())}var y="([{}])";function S($,ue){ue.fatArrowAt&&(ue.fatArrowAt=null);var Ve=$.string.indexOf("=>",$.start);if(!(Ve<0)){if(i){var at=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec($.string.slice($.start,Ve));at&&(Ve=at.index)}for(var et=0,Vt=!1,Ar=Ve-1;Ar>=0;--Ar){var yn=$.string.charAt(Ar),bn=y.indexOf(yn);if(bn>=0&&bn<3){if(!et){++Ar;break}if(--et==0){yn=="("&&(Vt=!0);break}}else if(bn>=3&&bn<6)++et;else if(a.test(yn))Vt=!0;else if(/["'\/`]/.test(yn))for(;;--Ar){if(Ar==0)return;var lo=$.string.charAt(Ar-1);if(lo==yn&&$.string.charAt(Ar-2)!="\\"){Ar--;break}}else if(Vt&&!et){++Ar;break}}Vt&&!et&&(ue.fatArrowAt=Ar)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function w($,ue,Ve,at,et,Vt){this.indented=$,this.column=ue,this.type=Ve,this.prev=et,this.info=Vt,at!=null&&(this.align=at)}function A($,ue){for(var Ve=$.localVars;Ve;Ve=Ve.next)if(Ve.name==ue)return!0;for(var at=$.context;at;at=at.prev)for(var Ve=at.vars;Ve;Ve=Ve.next)if(Ve.name==ue)return!0}function x($,ue,Ve,at,et){var Vt=$.cc;for(D.state=$,D.stream=et,D.marked=null,D.cc=Vt,D.style=ue,$.lexical.hasOwnProperty("align")||($.lexical.align=!0);;){var Ar=Vt.length?Vt.pop():r?De:U;if(Ar(Ve,at)){for(;Vt.length&&Vt[Vt.length-1].lex;)Vt.pop()();return D.marked?D.marked:Ve=="variable"&&A($,at)?"variableName.local":ue}}}var D={state:null,column:null,marked:null,cc:null};function E(){for(var $=arguments.length-1;$>=0;$--)D.cc.push(arguments[$])}function _(){return E.apply(null,arguments),!0}function N($,ue){for(var Ve=ue;Ve;Ve=Ve.next)if(Ve.name==$)return!0;return!1}function P($){var ue=D.state;if(D.marked="def",ue.context){if(ue.lexical.info=="var"&&ue.context&&ue.context.block){var Ve=B($,ue.context);if(Ve!=null){ue.context=Ve;return}}else if(!N($,ue.localVars)){ue.localVars=new L($,ue.localVars);return}}n.globalVars&&!N($,ue.globalVars)&&(ue.globalVars=new L($,ue.globalVars))}function B($,ue){if(ue)if(ue.block){var Ve=B($,ue.prev);return Ve?Ve==ue.prev?ue:new z(Ve,ue.vars,!0):null}else return N($,ue.vars)?ue:new z(ue.prev,new L($,ue.vars),!1);else return null}function V($){return $=="public"||$=="private"||$=="protected"||$=="abstract"||$=="readonly"}function z($,ue,Ve){this.prev=$,this.vars=ue,this.block=Ve}function L($,ue){this.name=$,this.next=ue}var k=new L("this",new L("arguments",null));function C(){D.state.context=new z(D.state.context,D.state.localVars,!1),D.state.localVars=k}function W(){D.state.context=new z(D.state.context,D.state.localVars,!0),D.state.localVars=null}C.lex=W.lex=!0;function O(){D.state.localVars=D.state.context.vars,D.state.context=D.state.context.prev}O.lex=!0;function H($,ue){var Ve=function(){var at=D.state,et=at.indented;if(at.lexical.type=="stat")et=at.lexical.indented;else for(var Vt=at.lexical;Vt&&Vt.type==")"&&Vt.align;Vt=Vt.prev)et=Vt.indented;at.lexical=new w(et,D.stream.column(),$,null,at.lexical,ue)};return Ve.lex=!0,Ve}function Z(){var $=D.state;$.lexical.prev&&($.lexical.type==")"&&($.indented=$.lexical.indented),$.lexical=$.lexical.prev)}Z.lex=!0;function Q($){function ue(Ve){return Ve==$?_():$==";"||Ve=="}"||Ve==")"||Ve=="]"?E():_(ue)}return ue}function U($,ue){return $=="var"?_(H("vardef",ue),St,Q(";"),Z):$=="keyword a"?_(H("form"),_e,U,Z):$=="keyword b"?_(H("form"),U,Z):$=="keyword d"?D.stream.match(/^\s*$/,!1)?_():_(H("stat"),Se,Q(";"),Z):$=="debugger"?_(Q(";")):$=="{"?_(H("}"),W,Nt,Z,O):$==";"?_():$=="if"?(D.state.lexical.info=="else"&&D.state.cc[D.state.cc.length-1]==Z&&D.state.cc.pop()(),_(H("form"),_e,U,Z,ur)):$=="function"?_(Ki):$=="for"?_(H("form"),W,Uo,U,O,Z):$=="class"||i&&ue=="interface"?(D.marked="keyword",_(H("form",$=="class"?$:ue),Kr,Z)):$=="variable"?i&&ue=="declare"?(D.marked="keyword",_(U)):i&&(ue=="module"||ue=="enum"||ue=="type")&&D.stream.match(/^\s*\w/,!1)?(D.marked="keyword",ue=="enum"?_(Fu):ue=="type"?_(mn,Q("operator"),ve,Q(";")):_(H("form"),Ye,Q("{"),H("}"),Nt,Z,Z)):i&&ue=="namespace"?(D.marked="keyword",_(H("form"),De,U,Z)):i&&ue=="abstract"?(D.marked="keyword",_(U)):_(H("stat"),re):$=="switch"?_(H("form"),_e,Q("{"),H("}","switch"),W,Nt,Z,Z,O):$=="case"?_(De,Q(":")):$=="default"?_(Q(":")):$=="catch"?_(H("form"),C,de,U,Z,O):$=="export"?_(H("stat"),Kl,Z):$=="import"?_(H("stat"),so,Z):$=="async"?_(U):ue=="@"?_(De,U):E(H("stat"),De,Q(";"),Z)}function de($){if($=="(")return _(Nn,Q(")"))}function De($,ue){return Ne($,ue,!1)}function me($,ue){return Ne($,ue,!0)}function _e($){return $!="("?E():_(H(")"),Se,Q(")"),Z)}function Ne($,ue,Ve){if(D.state.fatArrowAt==D.stream.start){var at=Ve?te:We;if($=="(")return _(C,H(")"),we(Nn,")"),Z,Q("=>"),at,O);if($=="variable")return E(C,Ye,Q("=>"),at,O)}var et=Ve?Ee:Me;return b.hasOwnProperty($)?_(et):$=="function"?_(Ki,et):$=="class"||i&&ue=="interface"?(D.marked="keyword",_(H("form"),xi,Z)):$=="keyword c"||$=="async"?_(Ve?me:De):$=="("?_(H(")"),Se,Q(")"),Z,et):$=="operator"||$=="spread"?_(Ve?me:De):$=="["?_(H("]"),Cu,Z,et):$=="{"?ht(Te,"}",null,et):$=="quasi"?E(Ce,et):$=="new"?_(oe(Ve)):_()}function Se($){return $.match(/[;\}\)\],]/)?E():E(De)}function Me($,ue){return $==","?_(Se):Ee($,ue,!1)}function Ee($,ue,Ve){var at=Ve==!1?Me:Ee,et=Ve==!1?De:me;if($=="=>")return _(C,Ve?te:We,O);if($=="operator")return/\+\+|--/.test(ue)||i&&ue=="!"?_(at):i&&ue=="<"&&D.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?_(H(">"),we(ve,">"),Z,at):ue=="?"?_(De,Q(":"),et):_(et);if($=="quasi")return E(Ce,at);if($!=";"){if($=="(")return ht(me,")","call",at);if($==".")return _(le,at);if($=="[")return _(H("]"),Se,Q("]"),Z,at);if(i&&ue=="as")return D.marked="keyword",_(ve,at);if($=="regexp")return D.state.lastType=D.marked="operator",D.stream.backUp(D.stream.pos-D.stream.start-1),_(et)}}function Ce($,ue){return $!="quasi"?E():ue.slice(ue.length-2)!="${"?_(Ce):_(Se,Ge)}function Ge($){if($=="}")return D.marked="string.special",D.state.tokenize=v,_(Ce)}function We($){return S(D.stream,D.state),E($=="{"?U:De)}function te($){return S(D.stream,D.state),E($=="{"?U:me)}function oe($){return function(ue){return ue=="."?_($?ie:ge):ue=="variable"&&i?_(Ae,$?Ee:Me):E($?me:De)}}function ge($,ue){if(ue=="target")return D.marked="keyword",_(Me)}function ie($,ue){if(ue=="target")return D.marked="keyword",_(Ee)}function re($){return $==":"?_(Z,U):E(Me,Q(";"),Z)}function le($){if($=="variable")return D.marked="property",_()}function Te($,ue){if($=="async")return D.marked="property",_(Te);if($=="variable"||D.style=="keyword"){if(D.marked="property",ue=="get"||ue=="set")return _(Ie);var Ve;return i&&D.state.fatArrowAt==D.stream.start&&(Ve=D.stream.match(/^\s*:\s*/,!1))&&(D.state.fatArrowAt=D.stream.pos+Ve[0].length),_(Ze)}else{if($=="number"||$=="string")return D.marked=t?"property":D.style+" property",_(Ze);if($=="jsonld-keyword")return _(Ze);if(i&&V(ue))return D.marked="keyword",_(Te);if($=="[")return _(De,Ht,Q("]"),Ze);if($=="spread")return _(me,Ze);if(ue=="*")return D.marked="keyword",_(Te);if($==":")return E(Ze)}}function Ie($){return $!="variable"?E(Ze):(D.marked="property",_(Ki))}function Ze($){if($==":")return _(me);if($=="(")return E(Ki)}function we($,ue,Ve){function at(et,Vt){if(Ve?Ve.indexOf(et)>-1:et==","){var Ar=D.state.lexical;return Ar.info=="call"&&(Ar.pos=(Ar.pos||0)+1),_(function(yn,bn){return yn==ue||bn==ue?E():E($)},at)}return et==ue||Vt==ue?_():Ve&&Ve.indexOf(";")>-1?E($):_(Q(ue))}return function(et,Vt){return et==ue||Vt==ue?_():E($,at)}}function ht($,ue,Ve){for(var at=3;at<arguments.length;at++)D.cc.push(arguments[at]);return _(H(ue,Ve),we($,ue),Z)}function Nt($){return $=="}"?_():E(U,Nt)}function Ht($,ue){if(i){if($==":")return _(ve);if(ue=="?")return _(Ht)}}function Et($,ue){if(i&&($==":"||ue=="in"))return _(ve)}function ae($){if(i&&$==":")return D.stream.match(/^\s*\w+\s+is\b/,!1)?_(De,he,ve):_(ve)}function he($,ue){if(ue=="is")return D.marked="keyword",_()}function ve($,ue){if(ue=="keyof"||ue=="typeof"||ue=="infer"||ue=="readonly")return D.marked="keyword",_(ue=="typeof"?me:ve);if($=="variable"||ue=="void")return D.marked="type",_(X);if(ue=="|"||ue=="&")return _(ve);if($=="string"||$=="number"||$=="atom")return _(X);if($=="[")return _(H("]"),we(ve,"]",","),Z,X);if($=="{")return _(H("}"),$e,Z,X);if($=="(")return _(we(F,")"),qe,X);if($=="<")return _(we(ve,">"),ve);if($=="quasi")return E(ze,X)}function qe($){if($=="=>")return _(ve)}function $e($){return $.match(/[\}\)\]]/)?_():$==","||$==";"?_($e):E(Re,$e)}function Re($,ue){if($=="variable"||D.style=="keyword")return D.marked="property",_(Re);if(ue=="?"||$=="number"||$=="string")return _(Re);if($==":")return _(ve);if($=="[")return _(Q("variable"),Et,Q("]"),Re);if($=="(")return E(ki,Re);if(!$.match(/[;\}\)\],]/))return _()}function ze($,ue){return $!="quasi"?E():ue.slice(ue.length-2)!="${"?_(ze):_(ve,Xe)}function Xe($){if($=="}")return D.marked="string.special",D.state.tokenize=v,_(ze)}function F($,ue){return $=="variable"&&D.stream.match(/^\s*[?:]/,!1)||ue=="?"?_(F):$==":"?_(ve):$=="spread"?_(F):E(ve)}function X($,ue){if(ue=="<")return _(H(">"),we(ve,">"),Z,X);if(ue=="|"||$=="."||ue=="&")return _(ve);if($=="[")return _(ve,Q("]"),X);if(ue=="extends"||ue=="implements")return D.marked="keyword",_(ve);if(ue=="?")return _(ve,Q(":"),ve)}function Ae($,ue){if(ue=="<")return _(H(">"),we(ve,">"),Z,X)}function Le(){return E(ve,ft)}function ft($,ue){if(ue=="=")return _(ve)}function St($,ue){return ue=="enum"?(D.marked="keyword",_(Fu)):E(Ye,Ht,Wr,Dn)}function Ye($,ue){if(i&&V(ue))return D.marked="keyword",_(Ye);if($=="variable")return P(ue),_();if($=="spread")return _(Ye);if($=="[")return ht(li,"]");if($=="{")return ht(kn,"}")}function kn($,ue){return $=="variable"&&!D.stream.match(/^\s*:/,!1)?(P(ue),_(Wr)):($=="variable"&&(D.marked="property"),$=="spread"?_(Ye):$=="}"?E():$=="["?_(De,Q("]"),Q(":"),kn):_(Q(":"),Ye,Wr))}function li(){return E(Ye,Wr)}function Wr($,ue){if(ue=="=")return _(me)}function Dn($){if($==",")return _(St)}function ur($,ue){if($=="keyword b"&&ue=="else")return _(H("form","else"),U,Z)}function Uo($,ue){if(ue=="await")return _(Uo);if($=="(")return _(H(")"),Sr,Z)}function Sr($){return $=="var"?_(St,bi):$=="variable"?_(bi):E(bi)}function bi($,ue){return $==")"?_():$==";"?_(bi):ue=="in"||ue=="of"?(D.marked="keyword",_(De,bi)):E(De,bi)}function Ki($,ue){if(ue=="*")return D.marked="keyword",_(Ki);if($=="variable")return P(ue),_(Ki);if($=="(")return _(C,H(")"),we(Nn,")"),Z,ae,U,O);if(i&&ue=="<")return _(H(">"),we(Le,">"),Z,Ki)}function ki($,ue){if(ue=="*")return D.marked="keyword",_(ki);if($=="variable")return P(ue),_(ki);if($=="(")return _(C,H(")"),we(Nn,")"),Z,ae,O);if(i&&ue=="<")return _(H(">"),we(Le,">"),Z,ki)}function mn($,ue){if($=="keyword"||$=="variable")return D.marked="type",_(mn);if(ue=="<")return _(H(">"),we(Le,">"),Z)}function Nn($,ue){return ue=="@"&&_(De,Nn),$=="spread"?_(Nn):i&&V(ue)?(D.marked="keyword",_(Nn)):i&&$=="this"?_(Ht,Wr):E(Ye,Ht,Wr)}function xi($,ue){return $=="variable"?Kr($,ue):Bn($,ue)}function Kr($,ue){if($=="variable")return P(ue),_(Bn)}function Bn($,ue){if(ue=="<")return _(H(">"),we(Le,">"),Z,Bn);if(ue=="extends"||ue=="implements"||i&&$==",")return ue=="implements"&&(D.marked="keyword"),_(i?ve:De,Bn);if($=="{")return _(H("}"),dn,Z)}function dn($,ue){if($=="async"||$=="variable"&&(ue=="static"||ue=="get"||ue=="set"||i&&V(ue))&&D.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return D.marked="keyword",_(dn);if($=="variable"||D.style=="keyword")return D.marked="property",_(wi,dn);if($=="number"||$=="string")return _(wi,dn);if($=="[")return _(De,Ht,Q("]"),wi,dn);if(ue=="*")return D.marked="keyword",_(dn);if(i&&$=="(")return E(ki,dn);if($==";"||$==",")return _(dn);if($=="}")return _();if(ue=="@")return _(De,dn)}function wi($,ue){if(ue=="!"||ue=="?")return _(wi);if($==":")return _(ve,Wr);if(ue=="=")return _(me);var Ve=D.state.lexical.prev,at=Ve&&Ve.info=="interface";return E(at?ki:Ki)}function Kl($,ue){return ue=="*"?(D.marked="keyword",_(ya,Q(";"))):ue=="default"?(D.marked="keyword",_(De,Q(";"))):$=="{"?_(we(Nu,"}"),ya,Q(";")):E(U)}function Nu($,ue){if(ue=="as")return D.marked="keyword",_(Q("variable"));if($=="variable")return E(me,Nu)}function so($){return $=="string"?_():$=="("?E(De):$=="."?E(Me):E(uo,Tu,ya)}function uo($,ue){return $=="{"?ht(uo,"}"):($=="variable"&&P(ue),ue=="*"&&(D.marked="keyword"),_(qa))}function Tu($){if($==",")return _(uo,Tu)}function qa($,ue){if(ue=="as")return D.marked="keyword",_(uo)}function ya($,ue){if(ue=="from")return D.marked="keyword",_(De)}function Cu($){return $=="]"?_():E(we(me,"]"))}function Fu(){return E(H("form"),Ye,Q("{"),H("}"),we(ec,"}"),Z,Z)}function ec(){return E(Ye,Wr)}function tc($,ue){return $.lastType=="operator"||$.lastType==","||u.test(ue.charAt(0))||/[,.]/.test(ue.charAt(0))}function Yr($,ue,Ve){return ue.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(ue.lastType)||ue.lastType=="quasi"&&/\{\s*$/.test($.string.slice(0,$.pos-(Ve||0)))}return{name:n.name,startState:function($){var ue={tokenize:m,lastType:"sof",cc:[],lexical:new w(-$,0,"block",!1),localVars:n.localVars,context:n.localVars&&new z(null,null,!1),indented:0};return n.globalVars&&typeof n.globalVars=="object"&&(ue.globalVars=n.globalVars),ue},token:function($,ue){if($.sol()&&(ue.lexical.hasOwnProperty("align")||(ue.lexical.align=!1),ue.indented=$.indentation(),S($,ue)),ue.tokenize!=d&&$.eatSpace())return null;var Ve=ue.tokenize($,ue);return c=="comment"?Ve:(ue.lastType=c=="operator"&&(f=="++"||f=="--")?"incdec":c,x(ue,Ve,c,f,$))},indent:function($,ue,Ve){if($.tokenize==d||$.tokenize==v)return null;if($.tokenize!=m)return 0;var at=ue&&ue.charAt(0),et=$.lexical,Vt;if(!/^\s*else\b/.test(ue))for(var Ar=$.cc.length-1;Ar>=0;--Ar){var yn=$.cc[Ar];if(yn==Z)et=et.prev;else if(yn!=ur&&yn!=O)break}for(;(et.type=="stat"||et.type=="form")&&(at=="}"||(Vt=$.cc[$.cc.length-1])&&(Vt==Me||Vt==Ee)&&!/^[,\.=+\-*:?[\(]/.test(ue));)et=et.prev;e&&et.type==")"&&et.prev.type=="stat"&&(et=et.prev);var bn=et.type,lo=at==bn;return bn=="vardef"?et.indented+($.lastType=="operator"||$.lastType==","?et.info.length+1:0):bn=="form"&&at=="{"?et.indented:bn=="form"?et.indented+Ve.unit:bn=="stat"?et.indented+(tc($,ue)?e||Ve.unit:0):et.info=="switch"&&!lo&&n.doubleIndentSwitch!=!1?et.indented+(/^(?:case|default)\b/.test(ue)?Ve.unit:2*Ve.unit):et.align?et.column+(lo?0:1):et.indented+(lo?0:Ve.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:r?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var bf=Jh({name:"javascript"}),prt=Jh({name:"json",json:!0}),mrt=Jh({name:"json",jsonld:!0}),drt=Jh({name:"typescript",typescript:!0});function H8(n){if(!n.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>yf.startState?.(4),blankLine:i=>yf.blankLine?.(i,4),copyState:i=>yf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${yf.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",t=>({startState:()=>bf.startState?.(4),blankLine:i=>bf.blankLine?.(i,4),copyState:i=>bf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${bf.token?.(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 s=[i.string],l=1,c=i.lookAhead(l);for(;c!==void 0&&!e.test(c)&&(s.push(c),l+=1,c=i.lookAhead(l),!(l>100)););a.str=s.filter(p=>p.trim()!=="").join(`
`);let f=n.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new yo(a.str,[]):(a.mdrcType=f,a.highlights=n.api.syntaxHighlighting.highlight(a.str,a.mdrcType,!0))}let u=a.highlights.getHighlights().filter(s=>s.range.from.line===a.line).find(s=>s.range.from.column===i.pos+1);return u===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<u.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${u.tokenClass}`)}}))}var AM=require("@codemirror/language"),Eu=require("@codemirror/view");var an=class extends Error{},xf=class extends Error{};var Jl=function(n){return this instanceof Jl?(this.v=n,this):new Jl(n)},eie=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Jl?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},Va;(function(n){n[n.SHORTEST=0]="SHORTEST",n[n.LONGEST=1]="LONGEST",n[n.STRICT_EQUAL=2]="STRICT_EQUAL"})(Va||(Va={}));function*gM(n,e,...t){if(t.length===0)return;let r=[];for(let i of t)r.push(G8(i));e:for(;;){let i=Y8.map(r,s=>s.next()),a=[],o=!0,u=!1;for(let s of i){let l;s.done?(o=!1,l=e):(u=!0,l=s.value),a.push(l)}if(!o&&u)switch(n){case Va.SHORTEST:break e;case Va.STRICT_EQUAL:throw new xf("Iterators must have equal lengths")}if(!u)break;yield a}}function vM(n,e,...t){return eie(this,arguments,function*(){if(t.length===0)return yield Jl(void 0);let i=[];for(let a of t)i.push(W8(a));e:for(;;){let a=[];for(let l of i){let c=yield Jl(l.next());a.push(c)}let o=[],u=!0,s=!1;for(let l of a){let c;l.done?(u=!1,c=e):(s=!0,c=l.value),o.push(c)}if(!u&&s)switch(n){case Va.SHORTEST:break e;case Va.STRICT_EQUAL:throw new xf("Iterators must have equal lengths")}if(!s)break;yield yield Jl(o)}})}var j8=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},Oo=function(n){return this instanceof Oo?(this.v=n,this):new Oo(n)},Z8=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Oo?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*J8(...n){for(let e of gM(Va.SHORTEST,void 0,...n))yield e}function X8(...n){return Z8(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=j8(vM(Va.SHORTEST,void 0,...n)),s;s=yield Oo(u.next()),t=s.done,!t;){a=s.value,o=!1;try{yield yield Oo(a)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield Oo(i.call(u)))}finally{if(r)throw r.error}}})}function*Q8(...n){for(let e of gM(Va.STRICT_EQUAL,void 0,...n))yield e}function K8(...n){return Z8(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=j8(vM(Va.STRICT_EQUAL,void 0,...n)),s;s=yield Oo(u.next()),t=s.done,!t;){a=s.value,o=!1;try{yield yield Oo(a)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield Oo(i.call(u)))}finally{if(r)throw r.error}}})}var eU=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},tie=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function rie(n,e,t){let r=t;for(let i of Nr(n))r=e(r,i);return r}function nie(n,e,t){var r,i,a,o;return eU(this,void 0,void 0,function*(){let u=t;try{for(var s=!0,l=tie(Tr(n)),c;c=yield l.next(),r=c.done,!r;){o=c.value,s=!1;try{u=yield e(u,o)}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield a.call(l))}finally{if(i)throw i.error}}return u})}function yM(n){switch(!0){case n instanceof Array:return n.length;case ao(n):return n.length;case n instanceof Set:return n.size;case n instanceof Map:return n.size}return rie(n,e=>e+1,0)}function tU(n){return eU(this,void 0,void 0,function*(){switch(!0){case n instanceof Array:case ao(n):case n instanceof Set:case n instanceof Map:return yM(n)}return yield nie(n,e=>e+1,0)})}var Ua=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},Ro=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function rU(n,e){for(let t of Nr(n))if(!e(t))return!1;return!0}function nU(n,e){var t,r,i,a;return Ua(this,void 0,void 0,function*(){try{for(var o=!0,u=Ro(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(!(yield e(a)))return!1}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!0})}function iU(n){let e=new Set;for(let t of Nr(n)){if(e.has(t))return!1;e.add(t)}return!0}function aU(n){var e,t,r,i;return Ua(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,u=Ro(Tr(n)),s;s=yield u.next(),e=s.done,!e;){i=s.value,o=!1;try{let l=i;if(a.has(l))return!1;a.add(l)}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=u.return)&&(yield r.call(u))}finally{if(t)throw t.error}}return!0})}function oU(n,e){for(let t of Nr(n))if(e(t))return!0;return!1}function sU(n,e){var t,r,i,a;return Ua(this,void 0,void 0,function*(){try{for(var o=!0,u=Ro(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(yield e(a))return!0}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!1})}function uU(n,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let r=0;for(let i of Nr(n))if(t(i)&&(r++,r>e))return!1;return r===e}function lU(n,e,t){var r,i,a,o;return Ua(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=f=>!!f);let u=0;try{for(var s=!0,l=Ro(Tr(n)),c;c=yield l.next(),r=c.done,!r;){o=c.value,s=!1;try{if((yield t(o))&&(u++,u>e))return!1}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield a.call(l))}finally{if(i)throw i.error}}return u===e})}function cU(n){for(let e of Nr(n))return!1;return!0}function fU(n){var e,t,r,i;return Ua(this,void 0,void 0,function*(){try{for(var a=!0,o=Ro(Tr(n)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let s=i;return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function Pi(n){return n==null?!1:typeof n[Symbol.iterator]=="function"}function Lo(n){return n==null?!1:typeof n[Symbol.asyncIterator]=="function"}function va(n){return n==null?!1:n.next!==void 0&&typeof n.next=="function"}function pU(n){for(let[e,t]of Mu(Nr(n)))if(e<t)return!1;return!0}function mU(n){var e,t,r,i;return Ua(this,void 0,void 0,function*(){try{for(var a=!0,o=Ro(_f(Tr(n))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[s,l]=i;if(s<l)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function dU(n){for(let[e,t]of Mu(Nr(n)))if(e>t)return!1;return!0}function hU(n){var e,t,r,i;return Ua(this,void 0,void 0,function*(){try{for(var a=!0,o=Ro(_f(Tr(n))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[s,l]=i;if(s>l)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function ao(n){return typeof n=="string"||n instanceof String}function gU(n,e){for(let t of Nr(n))if(e(t))return!1;return!0}function vU(n,e){var t,r,i,a;return Ua(this,void 0,void 0,function*(){try{for(var o=!0,u=Ro(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(yield e(a))return!1}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!0})}function yU(...n){try{for(let e of Q8(...n))for(let[t,r]of Mu(e))if(t!==r)return!1}catch{return!1}return!0}function bU(...n){var e,t,r,i;return Ua(this,void 0,void 0,function*(){try{try{for(var a=!0,o=Ro(K8(...n)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let s=i;for(let[l,c]of Mu(s))if(l!==c)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}}catch{return!1}return!0})}function xU(...n){if(n.length<=1)return!0;let e=n.map(t=>yM(t));return new Set(e).size===1}function wU(...n){return Ua(this,void 0,void 0,function*(){if(n.length<=1)return!0;let e=yield Xh(n,t=>Ua(this,void 0,void 0,function*(){return yield tU(t)}));return new Set(yield wf(e)).size===1})}var iie=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},oo=function(n){return this instanceof oo?(this.v=n,this):new oo(n)},bM=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof oo?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},_U=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function Nr(n){if(Pi(n))return n;if(va(n))return{[Symbol.iterator](){return n}};if(typeof n=="object"&&n!==null)return function*(){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(yield[e,n[e]])}();throw new an("Given collection is not iterable or iterator.")}function Tr(n){if(Lo(n))return n;if(va(n))return{[Symbol.asyncIterator](){return bM(this,arguments,function*(){for(;;){let t=yield oo(n.next());if(t.done)return yield oo(void 0);yield yield oo(t.value)}})}};if(typeof n=="object"&&n!==null&&(n=Nr(n)),Pi(n))return{[Symbol.asyncIterator](){return bM(this,arguments,function*(){for(let t of n)yield yield oo(t)})}};throw new an("Given collection is not async iterable or iterator.")}function G8(n){if(va(n))return n;if(Pi(n))return function*(){for(let e of n)yield e}();throw new an("Given collection is not iterable or iterator.")}function W8(n){if((va(n)||Pi(n))&&(n=Tr(n)),Lo(n))return function(){return bM(this,arguments,function*(){var e,t,r,i;try{for(var a=!0,o=_U(n),u;u=yield oo(o.next()),e=u.done,!e;){i=u.value,a=!1;try{yield yield oo(i)}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield oo(r.call(o)))}finally{if(t)throw t.error}}})}();throw new an("Given collection is not iterable or iterator.")}function xM(n){let e=[];for(let t of Nr(n))e.push(t);return e}function wf(n){var e,t,r,i;return iie(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,u=_U(Tr(n)),s;s=yield u.next(),e=s.done,!e;){i=s.value,o=!1;try{let l=i;a.push(l)}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=u.return)&&(yield r.call(u))}finally{if(t)throw t.error}}return a})}var Bs=function(n){return this instanceof Bs?(this.v=n,this):new Bs(n)},aie=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},oie=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Bs?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*wM(n,e){let t=new Set;if(n instanceof Map){e===void 0&&(e=r=>r[1]);for(let r of n){let i=e(r);t.has(i)||(yield r,t.add(i))}}else{e===void 0&&(e=r=>r);for(let r of Nr(n)){let i=e(r);t.has(i)||(yield r,t.add(i))}}}function SU(n,e){return oie(this,arguments,function*(){var r,i,a,o;let u=new Set;if(n instanceof Map)for(let f of wM(n,e))yield yield Bs(yield Bs(f));else{e===void 0&&(e=f=>f);try{for(var s=!0,l=aie(Tr(n)),c;c=yield Bs(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o,p=e(f);u.has(p)||(yield yield Bs(f),u.add(p))}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield Bs(a.call(l)))}finally{if(i)throw i.error}}}})}var vn=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},st=function(n){return this instanceof st?(this.v=n,this):new st(n)},Pn=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof st?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*AU(n,e){for(let t of Nr(n))yield e(t)}function Xh(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{yield yield st(yield st(e(o)))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*MU(n,e){for(let[t,r]of J8(n,e))r&&(yield t)}function EU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(X8(n,e)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let[c,f]=o;f&&(yield yield st(c))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*DU(n,e){let t=!0;for(let r of Nr(n)){if(t){if(!e(r)){t=!1,yield r;continue}continue}yield r}}function NU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;let u=!0;try{for(var s=!0,l=vn(Tr(n)),c;c=yield st(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o;if(u){if(!(yield st(e(f)))){u=!1,yield yield st(f);continue}continue}yield yield st(f)}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield st(a.call(l)))}finally{if(i)throw i.error}}})}function*TU(n,e){for(let t of Nr(n))if(e(t))yield t;else break}function CU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let c=o;if(yield st(e(c)))yield yield st(c);else break}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*FU(n,e){if(e<0)throw new an(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield n}function IU(n,e){return Pn(this,arguments,function*(){if(e<0)throw new an(`Number of repetitions cannot be negative: ${e}`);let r=yield st(n);for(let i=e;i>0;--i)yield yield st(r)})}function*PU(n,e){for(let t of Nr(n)){let r=e(t,e);if(Pi(r))for(let i of Nr(r))yield i;else yield r}}function kU(n,e){return Pn(this,arguments,function*(){var r,i,a,o,u,s,l,c;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),r=m.done,!r;){o=m.value,f=!1;try{let S=yield st(e(o,e));if(Pi(S)||Lo(S))try{for(var h=!0,d=(s=void 0,vn(Tr(S))),v;v=yield st(d.next()),u=v.done,!u;){c=v.value,h=!1;try{yield yield st(c)}finally{h=!0}}}catch(b){s={error:b}}finally{try{!h&&!u&&(l=d.return)&&(yield st(l.call(d)))}finally{if(s)throw s.error}}else yield yield st(S)}finally{f=!0}}}catch(y){i={error:y}}finally{try{!f&&!r&&(a=p.return)&&(yield st(a.call(p)))}finally{if(i)throw i.error}}})}function*_M(n,e=1/0){if(e<1){for(let t of Nr(n))n instanceof Map&&(t=t[1]),yield t;return}for(let t of Nr(n))if(n instanceof Map&&(t=t[1]),(Pi(t)||va(t))&&!ao(t))for(let r of _M(t,e-1))yield r;else yield t}function SM(n,e=1/0){return Pn(this,arguments,function*(){var r,i,a,o,u,s,l,c,f,p,m,h;if(e<1){try{for(var d=!0,v=vn(Tr(n)),y;y=yield st(v.next()),r=y.done,!r;){o=y.value,d=!1;try{let E=o;n instanceof Map&&(E=E[1]),yield yield st(E)}finally{d=!0}}}catch(E){i={error:E}}finally{try{!d&&!r&&(a=v.return)&&(yield st(a.call(v)))}finally{if(i)throw i.error}}return yield st(void 0)}try{for(var S=!0,b=vn(Tr(n)),w;w=yield st(b.next()),u=w.done,!u;){c=w.value,S=!1;try{let E=c;if(n instanceof Map&&(E=E[1]),(Lo(E)||Pi(E)||va(E))&&!ao(E))try{for(var A=!0,x=(p=void 0,vn(SM(E,e-1))),D;D=yield st(x.next()),f=D.done,!f;){h=D.value,A=!1;try{yield yield st(h)}finally{A=!0}}}catch(_){p={error:_}}finally{try{!A&&!f&&(m=x.return)&&(yield st(m.call(x)))}finally{if(p)throw p.error}}else yield yield st(E)}finally{S=!0}}}catch(E){s={error:E}}finally{try{!S&&!u&&(l=b.return)&&(yield st(l.call(b)))}finally{if(s)throw s.error}}})}function*BU(n,e){for(let t of Nr(n))e(t)&&(yield t)}function OU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let c=o;(yield st(e(c)))&&(yield yield st(c))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*Qh(n,e,t,r=!0){if(e<1)throw new an(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new an("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Nr(n))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&r&&(yield i)}function Kh(n,e,t,r=!0){return Pn(this,arguments,function*(){var a,o,u,s;if(e<1)throw new an(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new an("Overlap size must be less than chunk size");let l=[],c=!1;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),a=m.done,!a;){s=m.value,f=!1;try{let h=s;c=!1,l.push(h),l.length===e&&(yield yield st(l),l=l.slice(e-t),c=!0)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(u=p.return)&&(yield st(u.call(p)))}finally{if(o)throw o.error}}!c&&l.length>0&&r&&(yield yield st(l))})}function*RU(n,e){for(let t of Qh(n,e,0))yield t}function LU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Kh(n,e,0)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{yield yield st(o)}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*Mu(n){let e=Qh(n,2,1,!1);for(let t of e)yield t}function _f(n){return Pn(this,arguments,function*(){var t,r,i,a;let o=Kh(n,2,1,!1);try{for(var u=!0,s=vn(o),l;l=yield st(s.next()),t=l.done,!t;){a=l.value,u=!1;try{yield yield st(a)}finally{u=!0}}}catch(c){r={error:c}}finally{try{!u&&!t&&(i=s.return)&&(yield st(i.call(s)))}finally{if(r)throw r.error}}})}function*VU(n,e){if(e<0)throw new an(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let r of Nr(n)){if(t>=e)return;yield r,++t}}function UU(n,e){return Pn(this,arguments,function*(){var r,i,a,o;if(e<0)throw new an(`Limit must be \u2265 0. Got ${e}`);let u=0;try{for(var s=!0,l=vn(Tr(n)),c;c=yield st(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o;if(u>=e)return yield st(void 0);yield yield st(f),++u}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield st(a.call(l)))}finally{if(i)throw i.error}}})}function*qU(n){let e=0;for(let t of Nr(n))yield[e++,t]}function zU(n){return Pn(this,arguments,function*(){var t,r,i,a;let o=0;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),t=l.done,!t;){a=l.value,u=!1;try{let c=a;yield yield st([o++,c])}finally{u=!0}}}catch(c){r={error:c}}finally{try{!u&&!t&&(i=s.return)&&(yield st(i.call(s)))}finally{if(r)throw r.error}}})}function*$U(n,e=0,t,r=1){if(e<0)throw new an("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new an("Parameter 'count' cannot be negative");if(r<=0)throw new an("Parameter 'step' must be positive");let i=0,a=0;for(let o of Nr(n))if(!(i++<e||(i-e-1)%r!==0)){if(a++===t&&t!==void 0)break;yield o}}function HU(n,e=0,t,r=1){return Pn(this,arguments,function*(){var a,o,u,s;if(e<0)throw new an("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new an("Parameter 'count' cannot be negative");if(r<=0)throw new an("Parameter 'step' must be positive");let l=0,c=0;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),a=m.done,!a;){s=m.value,f=!1;try{let h=s;if(l++<e||(l-e-1)%r!==0)continue;if(c++===t&&t!==void 0)break;yield yield st(h)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(u=p.return)&&(yield st(u.call(p)))}finally{if(o)throw o.error}}})}function*GU(n){for(let[e]of Nr(n))yield e}function WU(n){return Pn(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=vn(Tr(n)),s;s=yield st(u.next()),t=s.done,!t;){a=s.value,o=!1;try{let[l]=a;yield yield st(l)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield st(i.call(u)))}finally{if(r)throw r.error}}})}function*YU(n,e,t=0){if(e<0||t<0)throw new an;let r=-t;for(let i of Nr(n))(r<0||r>=e)&&(yield i),++r}function jU(n,e,t=0){return Pn(this,arguments,function*(){var i,a,o,u;if(e<0||t<0)throw new an;let s=-t;try{for(var l=!0,c=vn(Tr(n)),f;f=yield st(c.next()),i=f.done,!i;){u=f.value,l=!1;try{let p=u;(s<0||s>=e)&&(yield yield st(p)),++s}finally{l=!0}}}catch(p){a={error:p}}finally{try{!l&&!i&&(o=c.return)&&(yield st(o.call(c)))}finally{if(a)throw a.error}}})}function*ZU(n){for(let[,e]of Nr(n))yield e}function JU(n){return Pn(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=vn(Tr(n)),s;s=yield st(u.next()),t=s.done,!t;){a=s.value,o=!1;try{let[,l]=a;yield yield st(l)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield st(i.call(u)))}finally{if(r)throw r.error}}})}function*XU(n,e,t){let r=new Map,i=a=>{r.has(a)||(t!==void 0?r.set(a,{}):r.set(a,[]))};for(let a of Nr(n)){let o=e(a),u=t!==void 0?t(a):void 0,s=(Pi(o)||va(o))&&!ao(o)?o:[o];for(let l of wM(s))i(l),u===void 0?r.get(l).push(a):r.get(l)[u]=a}for(let a of r)yield a}function QU(n,e,t){return Pn(this,arguments,function*(){var i,a,o,u,s,l,c,f;let p=new Map,m=w=>{p.has(w)||(t!==void 0?p.set(w,{}):p.set(w,[]))};try{for(var h=!0,d=vn(Tr(n)),v;v=yield st(d.next()),i=v.done,!i;){u=v.value,h=!1;try{let w=u,A=yield st(e(w)),x=t!==void 0?yield st(t(w)):void 0,D=(Lo(A)||Pi(A)||va(A))&&!ao(A)?A:[A];try{for(var y=!0,S=(l=void 0,vn(SU(D))),b;b=yield st(S.next()),s=b.done,!s;){f=b.value,y=!1;try{let E=f;m(E),x===void 0?p.get(E).push(w):p.get(E)[x]=w}finally{y=!0}}}catch(E){l={error:E}}finally{try{!y&&!s&&(c=S.return)&&(yield st(c.call(S)))}finally{if(l)throw l.error}}}finally{h=!0}}}catch(w){a={error:w}}finally{try{!h&&!i&&(o=d.return)&&(yield st(o.call(d)))}finally{if(a)throw a.error}}for(let w of p)yield yield st(w)})}function*KU(n,e){let t=xM(n);e!==void 0?t.sort(e):t.sort();for(let r of t)yield r}function e6(n,e){return Pn(this,arguments,function*(){let r=yield st(wf(n));e!==void 0?r.sort(e):r.sort();for(let i of r)yield yield st(i)})}var Y8={chunkwise:RU,chunkwiseOverlap:Qh,compress:MU,dropWhile:DU,enumerate:qU,filter:BU,flatMap:PU,flatten:_M,groupBy:XU,keys:GU,limit:VU,map:AU,pairwise:Mu,repeat:FU,skip:YU,slice:$U,sort:KU,takeWhile:TU,values:ZU,chunkwiseAsync:LU,chunkwiseOverlapAsync:Kh,compressAsync:EU,dropWhileAsync:NU,enumerateAsync:zU,filterAsync:OU,flatMapAsync:kU,flattenAsync:SM,groupByAsync:QU,keysAsync:WU,limitAsync:UU,mapAsync:Xh,pairwiseAsync:_f,repeatAsync:IU,skipAsync:jU,sliceAsync:HU,sortAsync:e6,takeWhileAsync:CU,valuesAsync:JU};var t6={allMatch:rU,allUnique:iU,anyMatch:oU,exactlyN:uU,isEmpty:cU,isAsyncIterable:Lo,isIterable:Pi,isIterator:va,isReversed:pU,isSorted:dU,isString:ao,noneMatch:gU,same:yU,sameCount:xU,allMatchAsync:nU,allUniqueAsync:aU,anyMatchAsync:sU,exactlyNAsync:lU,isEmptyAsync:fU,isReversedAsync:mU,isSortedAsync:hU,noneMatchAsync:vU,sameAsync:bU,sameCountAsync:wU};var eg=require("obsidian");var r6=require("obsidian");var Vo=class{static checkSelectionOverlap(e,t,r){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=r)return!0;return!1}static checkRangeOverlap(e,t,r,i){return e<=i&&r<=t}static getContent(e,t,r){return e.sliceDoc(t,r)}static getCurrentFile(e){return e.state.field(r6.editorInfoField).file}static existsDecorationBetween(e,t,r){let i=!1;return e.between(t,r,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,r,i){let a=!1;return e.between(r,i,(o,u,s)=>{s.spec.mb_widgetType===t&&(a=!0)}),a}};function n6(n){return Eu.ViewPlugin.fromClass(class{constructor(e){this.component=new eg.Component,this.component.load(),this.decorations=this.renderWidgets(e)??Eu.Decoration.none,e.dom.addEventListener("click",t=>this.handleClick(t))}handleClick(e){if(e.target instanceof HTMLElement){let t=e.target;for(;t!==null;){if(t.classList.contains("mb-input")){e.preventDefault(),e.stopPropagation();break}t=t.parentElement}}}isLivePreview(e){return e.field(eg.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,r,i)=>t6.anyMatch(e.visibleRanges,o=>Vo.checkRangeOverlap(t,r,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:t,to:r}of e.visibleRanges)(0,AM.syntaxTree)(e.state).iterate({from:t,to:r,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,(r,i,a)=>{this.decorations=this.decorations.update({filterFrom:r,filterTo:i,filter:(o,u,s)=>t&&s.spec.mb_widgetType===t?!0:(s.spec.mb_unload?.(),!1)})})}addDecoration(e,t,r,i,a){let o=e.from-1,u=e.to+1;if(Vo.existsDecorationOfTypeBetween(this.decorations,r,o,u))return;let s=Vo.getCurrentFile(t);if(!s)return;let l=this.renderWidget(e,a,r,i,s),c=Array.isArray(l)?l:[l];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,t){let r=new Set(t.type.name?.split("_"));if(r.has("inline-code")&&!r.has("formatting")){let i=e.state.selection,a=Vo.checkSelectionOverlap(i,t.from-1,t.to+1),o=this.readNode(e,t.from,t.to),u=this.isLivePreview(e.state);return{shouldRender:!a&&u,shouldHighlight:(a||!u)&&n.settings.enableSyntaxHighlighting,content:o.content,widgetType:o.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,r){let i=Vo.getContent(e.state,t,r);return{content:i,widgetType:n.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let t=Vo.getCurrentFile(e);if(!t)return;let r=[];for(let i of e.visibleRanges)(0,AM.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,u=this.getRenderInfo(e,o);if(!u.widgetType||!u.content)return;let s;u.shouldRender&&(s=this.renderWidget(o,u.widgetType,"field",u.content,t)),u.shouldHighlight&&(s=this.renderWidget(o,u.widgetType,"highlight",u.content,t)),s&&(Array.isArray(s)?r.push(...s):r.push(s))}});return Eu.Decoration.set(r,!0)}renderWidget(e,t,r,i,a){if(r==="field"){let o=n.api.constructMDRCWidget(t,i,a.path,this.component);return Eu.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return n.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(u=>Eu.Decoration.mark({class:`mb-highlight-${u.tokenClass}`}).range(e.from+u.range.from.index,e.from+u.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Sf=wr(Oi()),Af=wr(Si());var sie=Af.P.sequenceMap((n,e,t,r)=>{let i=parseInt(n),a=parseInt(e),o=parseInt(t);return new Qi(i,a,o,r)},Sf.P_UTILS.digits().skip(Af.P.string(".")),Sf.P_UTILS.digits().skip(Af.P.string(".")),Sf.P_UTILS.digits(),Af.P.string("-").then(Sf.P_UTILS.remaining()).optional()),Qi=class n{constructor(e,t,r,i){this.major=e,this.minor=t,this.patch=r,this.prerelease=i}static fromString(e){return Tn(sie,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 n.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 tg=class{constructor(e,t){this.plugin=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(r=>r.pluginId===e);if(t===void 0)throw new qs({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 qs({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,t){if(Qi.lessThan(t,e.minVersion))throw new qs({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&&(Qi.greaterThan(t,e.maxVersion)||Qi.equals(t,e.maxVersion)))throw new qs({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),r=this.getPlugin(e);if(r==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Qi.fromString(r.manifest.version);return this.checkDependencyVersion(t,i),r}checkDependencyOnStartup(e){let t=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let r=Qi.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(t,r)}checkDependenciesOnStartup(){let e=new Gt("Dependency Validation");for(let t of this.dependencies)if(t.checkOnStartup)try{this.checkDependencyOnStartup(t.pluginId)}catch(r){e.add(r)}return e.hasErrors()?(this.plugin.internal.openErrorCollectionViewModal({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.",errorCollection:e}),!0):!1}};var h6=require("obsidian");function uie(n){let e;return{c(){e=ee("div")},m(t,r){J(t,e,r),n[2](e)},p:Ke,i:Ke,o:Ke,d(t){t&&Y(e),n[2](null)}}}function lie(n,e,t){let{mountable:r}=e,i;qi(()=>{r.mount(i)}),Gs(()=>{r.unmount()});function a(o){Pr[o?"unshift":"push"](()=>{i=o,t(0,i)})}return n.$$set=o=>{"mountable"in o&&t(1,r=o.mountable)},[i,r,a]}var MM=class extends Pe{constructor(e){super(),Be(this,e,lie,uie,ke,{mountable:1})}},Mf=MM;function cie(n){let e,t;return e=new Mf({props:{mountable:n[0]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p:Ke,i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function fie(n,e,t){let{declaration:r}=e,{plugin:i}=e,a=new Ku(i,Ir(),"","block",r);return n.$$set=o=>{"declaration"in o&&t(1,r=o.declaration),"plugin"in o&&t(2,i=o.plugin)},[a,r,i]}var EM=class extends Pe{constructor(e){super(),Be(this,e,fie,cie,ke,{declaration:1,plugin:2})}},i6=EM;function pie(n){let e,t,r=n[0].title+"",i,a,o,u,s,l,c,f=n[0].display+"",p,m;return o=new Mf({props:{mountable:n[1]}}),s=new Mf({props:{mountable:n[2]}}),{c(){e=ee("div"),t=ee("h3"),i=He(r),a=fe(),xe(o.$$.fragment),u=fe(),xe(s.$$.fragment),l=fe(),c=ee("code"),p=He(f),q(e,"class","mb-card")},m(h,d){J(h,e,d),K(e,t),K(t,i),K(e,a),ye(o,e,null),K(e,u),ye(s,e,null),K(e,l),K(e,c),K(c,p),m=!0},p(h,[d]){(!m||d&1)&&r!==(r=h[0].title+"")&&yt(i,r),(!m||d&1)&&f!==(f=h[0].display+"")&&yt(p,f)},i(h){m||(j(o.$$.fragment,h),j(s.$$.fragment,h),m=!0)},o(h){ne(o.$$.fragment,h),ne(s.$$.fragment,h),m=!1},d(h){h&&Y(e),be(o),be(s)}}}function mie(n,e,t){let{declaration:r}=e,{plugin:i}=e,a=i.api.createInlineFieldFromString(r.inputField,"",void 0,"block"),o=i.api.createInlineFieldFromString(r.declaration,"",void 0,"block");return n.$$set=u=>{"declaration"in u&&t(0,r=u.declaration),"plugin"in u&&t(3,i=u.plugin)},[r,a,o,i]}var DM=class extends Pe{constructor(e){super(),Be(this,e,mie,pie,ke,{declaration:0,plugin:3})}},a6=DM;function o6(n,e,t){let r=n.slice();return r[6]=e[t],r}function s6(n,e,t){let r=n.slice();return r[9]=e[t],r}function u6(n,e,t){let r=n.slice();return r[9]=e[t],r}function die(n){let e;return{c(){e=He("Docs")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function hie(n){let e;return{c(){e=He("GitHub")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function gie(n){let e;return{c(){e=He("Report Issue")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function vie(n){let e,t,r,i,a,o,u,s,l;return i=new It({props:{variant:"primary",$$slots:{default:[die]},$$scope:{ctx:n}}}),i.$on("click",n[3]),o=new It({props:{$$slots:{default:[hie]},$$scope:{ctx:n}}}),o.$on("click",n[4]),s=new It({props:{$$slots:{default:[gie]},$$scope:{ctx:n}}}),s.$on("click",n[5]),{c(){e=ee("h1"),e.textContent="Meta Bind Playground",t=fe(),r=ee("span"),xe(i.$$.fragment),a=fe(),xe(o.$$.fragment),u=fe(),xe(s.$$.fragment)},m(c,f){J(c,e,f),J(c,t,f),J(c,r,f),ye(i,r,null),K(r,a),ye(o,r,null),K(r,u),ye(s,r,null),l=!0},p(c,f){let p={};f&16384&&(p.$$scope={dirty:f,ctx:c}),i.$set(p);let m={};f&16384&&(m.$$scope={dirty:f,ctx:c}),o.$set(m);let h={};f&16384&&(h.$$scope={dirty:f,ctx:c}),s.$set(h)},i(c){l||(j(i.$$.fragment,c),j(o.$$.fragment,c),j(s.$$.fragment,c),l=!0)},o(c){ne(i.$$.fragment,c),ne(o.$$.fragment,c),ne(s.$$.fragment,c),l=!1},d(c){c&&(Y(e),Y(t),Y(r)),be(i),be(o),be(s)}}}function l6(n){let e,t;return e=new i6({props:{declaration:n[9][1],plugin:n[0]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.declaration=r[9][1]),i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function c6(n){let e,t;return e=new a6({props:{declaration:n[9],plugin:n[0]}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function f6(n){let e,t,r=ct(n[6]),i=[];for(let o=0;o<r.length;o+=1)i[o]=c6(s6(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,u){if(u&1){r=ct(o[6]);let s;for(s=0;s<r.length;s+=1){let l=s6(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=c6(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function yie(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h,d,v,y,S,b,w,A,x,D,E,_,N,P,B,V,z,L,k,C,W,O,H,Z,Q,U,de,De,me,_e,Ne,Se,Me,Ee,Ce;t=new Is({props:{$$slots:{default:[vie]},$$scope:{ctx:n}}}),S=new gf({props:{plugin:n[0],settings:{errorCollection:n[1],code:p6}}}),x=new gf({props:{plugin:n[0],settings:{errorCollection:n[2],code:m6}}});let Ge=ct(Pg(n[0])),We=[];for(let re=0;re<Ge.length;re+=1)We[re]=l6(u6(n,Ge,re));let te=re=>ne(We[re],1,1,()=>{We[re]=null}),oe=ct(Object.values(Xf)),ge=[];for(let re=0;re<oe.length;re+=1)ge[re]=f6(o6(n,oe,re));let ie=re=>ne(ge[re],1,1,()=>{ge[re]=null});return{c(){e=ee("div"),xe(t.$$.fragment),r=fe(),i=ee("h2"),i.textContent="Quick Reference",a=fe(),o=ee("h3"),o.textContent="Error Messages",u=fe(),s=ee("p"),l=He("When creating "),c=ee("a"),c.textContent="Input Fields",p=He(` or
`),m=ee("a"),m.textContent="View Fields",d=fe(),v=ee("strong"),v.textContent="warnings",y=He(` (
`),xe(S.$$.fragment),b=He(`
) and `),w=ee("strong"),w.textContent="errors",A=He(` (
`),xe(x.$$.fragment),D=He(`
) can occur. These are `),E=ee("strong"),E.textContent="clickable",_=He(` and will show a modal with detailed information about the error
when clicked.`),N=fe(),P=ee("h3"),P.textContent="Unloaded Message",B=fe(),V=ee("p"),V.innerHTML=`A message like this <span class="mb-warning">[MB_UNLOADED] ...</span> means that Obsidian told Meta Bind to unload
the field that was once displayed there. This usually happens when Meta Bind was disabled, such as after a plugin
update, or when another plugin is interfering with Meta Bind.`,z=fe(),L=ee("p"),L.textContent="Usually reopening the note or restarting Obsidian causes the field to display normally again.",k=fe(),C=ee("h3"),C.textContent="Bind Targets",W=fe(),O=ee("p"),O.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="${qt.linkToInputFields()}">Input Fields</a>
and
<a href="${qt.linkToViewFields()}">View Fields</a> to.`,H=fe(),Z=ee("h2"),Z.textContent="Playground",Q=fe(),U=ee("h3"),U.textContent="Input Fields",de=fe(),De=ee("p"),De.innerHTML=`<a href="${qt.linkToInputFields()}">Input Fields</a> let you change the frontmatter of your notes from inside
of notes.`,me=fe();for(let re=0;re<We.length;re+=1)We[re].c();_e=fe(),Ne=ee("h3"),Ne.textContent="View Fields",Se=fe(),Me=ee("p"),Me.innerHTML=`<a href="${qt.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.`,Ee=fe();for(let re=0;re<ge.length;re+=1)ge[re].c();q(c,"href",f=qt.linkToInputFields()),q(m,"href",h=qt.linkToViewFields()),q(e,"class","mb-faq-view markdown-rendered")},m(re,le){J(re,e,le),ye(t,e,null),K(e,r),K(e,i),K(e,a),K(e,o),K(e,u),K(e,s),K(s,l),K(s,c),K(s,p),K(s,m),K(s,d),K(s,v),K(s,y),ye(S,s,null),K(s,b),K(s,w),K(s,A),ye(x,s,null),K(s,D),K(s,E),K(s,_),K(e,N),K(e,P),K(e,B),K(e,V),K(e,z),K(e,L),K(e,k),K(e,C),K(e,W),K(e,O),K(e,H),K(e,Z),K(e,Q),K(e,U),K(e,de),K(e,De),K(e,me);for(let Te=0;Te<We.length;Te+=1)We[Te]&&We[Te].m(e,null);K(e,_e),K(e,Ne),K(e,Se),K(e,Me),K(e,Ee);for(let Te=0;Te<ge.length;Te+=1)ge[Te]&&ge[Te].m(e,null);Ce=!0},p(re,[le]){let Te={};le&16384&&(Te.$$scope={dirty:le,ctx:re}),t.$set(Te);let Ie={};le&1&&(Ie.plugin=re[0]),le&2&&(Ie.settings={errorCollection:re[1],code:p6}),S.$set(Ie);let Ze={};if(le&1&&(Ze.plugin=re[0]),le&4&&(Ze.settings={errorCollection:re[2],code:m6}),x.$set(Ze),le&1){Ge=ct(Pg(re[0]));let we;for(we=0;we<Ge.length;we+=1){let ht=u6(re,Ge,we);We[we]?(We[we].p(ht,le),j(We[we],1)):(We[we]=l6(ht),We[we].c(),j(We[we],1),We[we].m(e,_e))}for(bt(),we=Ge.length;we<We.length;we+=1)te(we);xt()}if(le&1){oe=ct(Object.values(Xf));let we;for(we=0;we<oe.length;we+=1){let ht=o6(re,oe,we);ge[we]?(ge[we].p(ht,le),j(ge[we],1)):(ge[we]=f6(ht),ge[we].c(),j(ge[we],1),ge[we].m(e,null))}for(bt(),we=oe.length;we<ge.length;we+=1)ie(we);xt()}},i(re){if(!Ce){j(t.$$.fragment,re),j(S.$$.fragment,re),j(x.$$.fragment,re);for(let le=0;le<Ge.length;le+=1)j(We[le]);for(let le=0;le<oe.length;le+=1)j(ge[le]);Ce=!0}},o(re){ne(t.$$.fragment,re),ne(S.$$.fragment,re),ne(x.$$.fragment,re),We=We.filter(Boolean);for(let le=0;le<We.length;le+=1)ne(We[le]);ge=ge.filter(Boolean);for(let le=0;le<ge.length;le+=1)ne(ge[le]);Ce=!1},d(re){re&&Y(e),be(t),be(S),be(x),Qt(We,re),Qt(ge,re)}}}var p6="INPUT[someInputFieldDeclaration]",m6="INPUT[someInputFieldDeclaration]";function bie(n,e,t){let{plugin:r}=e,i=new Gt("exampleWarningErrorCollection"),a=new Gt("exampleErrorErrorCollection");qi(()=>{i.add(new lc({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),t(1,i),a.add(new lc({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"})),t(2,a)});let o=()=>{qt.open(qt.linkToHome())},u=()=>{qt.open(qt.linkToGithub())},s=()=>{qt.open(qt.linkToIssues())};return n.$$set=l=>{"plugin"in l&&t(0,r=l.plugin)},[r,i,a,o,u,s]}var NM=class extends Pe{constructor(e){super(),Be(this,e,bie,yie,ke,{plugin:0})}},d6=NM;var Du="mb-playground-view-type",rg=class extends h6.ItemView{constructor(e,t){super(e),this.plugin=t}getViewType(){return Du}getDisplayText(){return"Meta Bind Playground"}async onOpen(){this.contentEl.empty(),this.component=new d6({target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component?.$destroy()}};var Vn=require("obsidian");var w6=require("obsidian");var Xl=require("obsidian");function xie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"pen-line"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function wie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"copy"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function _ie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"x"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Sie(n){let e,t=n[0].id+"",r,i,a,o,u,s,l,c;return a=new It({props:{variant:"primary",tooltip:"Edit",$$slots:{default:[xie]},$$scope:{ctx:n}}}),a.$on("click",n[5]),u=new It({props:{variant:"default",tooltip:"Copy",$$slots:{default:[wie]},$$scope:{ctx:n}}}),u.$on("click",n[6]),l=new It({props:{variant:"destructive",tooltip:"Delete",$$slots:{default:[_ie]},$$scope:{ctx:n}}}),l.$on("click",n[7]),{c(){e=ee("span"),r=He(t),i=fe(),xe(a.$$.fragment),o=fe(),xe(u.$$.fragment),s=fe(),xe(l.$$.fragment)},m(f,p){J(f,e,p),K(e,r),J(f,i,p),ye(a,f,p),J(f,o,p),ye(u,f,p),J(f,s,p),ye(l,f,p),c=!0},p(f,p){(!c||p&1)&&t!==(t=f[0].id+"")&&yt(r,t);let m={};p&514&&(m.$$scope={dirty:p,ctx:f}),a.$set(m);let h={};p&514&&(h.$$scope={dirty:p,ctx:f}),u.$set(h);let d={};p&514&&(d.$$scope={dirty:p,ctx:f}),l.$set(d)},i(f){c||(j(a.$$.fragment,f),j(u.$$.fragment,f),j(l.$$.fragment,f),c=!0)},o(f){ne(a.$$.fragment,f),ne(u.$$.fragment,f),ne(l.$$.fragment,f),c=!1},d(f){f&&(Y(e),Y(i),Y(o),Y(s)),be(a,f),be(u,f),be(l,f)}}}function Aie(n){let e,t,r,i,a,o=(0,Xl.stringifyYaml)(n[0])+"",u,s;return t=new Is({props:{$$slots:{default:[Sie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),xe(t.$$.fragment),r=fe(),i=ee("pre"),a=ee("code"),u=He(o),q(a,"class","mb-none"),q(i,"class","mb-pre"),q(e,"class","mb-card markdown-rendered")},m(l,c){J(l,e,c),ye(t,e,null),K(e,r),K(e,i),K(i,a),K(a,u),s=!0},p(l,[c]){let f={};c&515&&(f.$$scope={dirty:c,ctx:l}),t.$set(f),(!s||c&1)&&o!==(o=(0,Xl.stringifyYaml)(l[0])+"")&&yt(u,o)},i(l){s||(j(t.$$.fragment,l),s=!0)},o(l){ne(t.$$.fragment,l),s=!1},d(l){l&&Y(e),be(t)}}}function Mie(n,e,t){let{template:r}=e,{plugin:i}=e,a=Ws();function o(){a("delete-template",{template:r})}function u(){i.internal.openButtonBuilderModal({submitText:"Submit",config:structuredClone(r),onOkay:p=>{t(0,r=p)}})}function s(){let p=(0,Xl.stringifyYaml)(r);navigator.clipboard.writeText(p),new Xl.Notice("meta-bind | Copied to Clipboard")}let l=()=>u(),c=()=>s(),f=()=>o();return n.$$set=p=>{"template"in p&&t(0,r=p.template),"plugin"in p&&t(1,i=p.plugin)},[r,i,o,u,s,l,c,f]}var TM=class extends Pe{constructor(e){super(),Be(this,e,Mie,Aie,ke,{template:0,plugin:1})}},g6=TM;var Ef=require("obsidian");function v6(n,e,t){let r=n.slice();return r[14]=e[t],r[15]=e,r[16]=t,r}function y6(n){let e,t,r;function i(o){n[8](o,n[14],n[15],n[16])}let a={plugin:n[1].plugin};return n[14]!==void 0&&(a.template=n[14]),e=new g6({props:a}),Pr.push(()=>Qn(e,"template",i)),e.$on("delete-template",n[9]),{c(){xe(e.$$.fragment)},m(o,u){ye(e,o,u),r=!0},p(o,u){n=o;let s={};u&2&&(s.plugin=n[1].plugin),!t&&u&1&&(t=!0,s.template=n[14],Xn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){be(e,o)}}}function Eie(n){let e;return{c(){e=He("Add Template")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Die(n){let e;return{c(){e=He("Add Template from Clipboard")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function b6(n){let e,t,r,i,a;return i=new Ps({props:{settings:{errorCollection:n[2]}}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Templates Failed to Parse",r=fe(),xe(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ye(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.settings={errorCollection:o[2]}),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),be(i)}}}function Nie(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Tie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Cie(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[Nie]},$$scope:{ctx:n}}}),e.$on("click",n[12]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[Tie]},$$scope:{ctx:n}}}),r.$on("click",n[13]),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,o){let u={};o&131072&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&131072&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function Fie(n){let e,t,r,i,a,o,u,s,l,c,f,p=ct(n[0]),m=[];for(let v=0;v<p.length;v+=1)m[v]=y6(v6(n,p,v));let h=v=>ne(m[v],1,1,()=>{m[v]=null});a=new It({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[Eie]},$$scope:{ctx:n}}}),a.$on("click",n[10]),u=new It({props:{variant:"default",tooltip:"Create New Template from YAML in Clipboard",$$slots:{default:[Die]},$$scope:{ctx:n}}}),u.$on("click",n[11]);let d=n[2]&&b6(n);return c=new no({props:{$$slots:{default:[Cie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("h2"),t.textContent="Meta Bind Button Templates",r=fe();for(let v=0;v<m.length;v+=1)m[v].c();i=fe(),xe(a.$$.fragment),o=fe(),xe(u.$$.fragment),s=fe(),d&&d.c(),l=fe(),xe(c.$$.fragment)},m(v,y){J(v,e,y),K(e,t),K(e,r);for(let S=0;S<m.length;S+=1)m[S]&&m[S].m(e,null);K(e,i),ye(a,e,null),K(e,o),ye(u,e,null),K(e,s),d&&d.m(e,null),K(e,l),ye(c,e,null),f=!0},p(v,[y]){if(y&11){p=ct(v[0]);let A;for(A=0;A<p.length;A+=1){let x=v6(v,p,A);m[A]?(m[A].p(x,y),j(m[A],1)):(m[A]=y6(x),m[A].c(),j(m[A],1),m[A].m(e,i))}for(bt(),A=p.length;A<m.length;A+=1)h(A);xt()}let S={};y&131072&&(S.$$scope={dirty:y,ctx:v}),a.$set(S);let b={};y&131072&&(b.$$scope={dirty:y,ctx:v}),u.$set(b),v[2]?d?(d.p(v,y),y&4&&j(d,1)):(d=b6(v),d.c(),j(d,1),d.m(e,l)):d&&(bt(),ne(d,1,1,()=>{d=null}),xt());let w={};y&131072&&(w.$$scope={dirty:y,ctx:v}),c.$set(w)},i(v){if(!f){for(let y=0;y<p.length;y+=1)j(m[y]);j(a.$$.fragment,v),j(u.$$.fragment,v),j(d),j(c.$$.fragment,v),f=!0}},o(v){m=m.filter(Boolean);for(let y=0;y<m.length;y+=1)ne(m[y]);ne(a.$$.fragment,v),ne(u.$$.fragment,v),ne(d),ne(c.$$.fragment,v),f=!1},d(v){v&&Y(e),Qt(m,v),be(a),be(u),d&&d.d(),be(c)}}}function Iie(n,e,t){let{buttonConfigs:r}=e,{modal:i}=e,a;function o(y){t(0,r=r.filter(S=>S!==y))}function u(){r.push(i.plugin.api.buttonActionRunner.createDefaultButtonConfig()),t(0,r)}async function s(){let y;try{y=(0,Ef.parseYaml)(await navigator.clipboard.readText())}catch(b){console.warn(b),new Ef.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let S=Gl.safeParse(y);if(!S.success){let b=mf(S.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new vo({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:b.message,docs:[qt.linkToButtonConfig()]})),console.warn(b),new Ef.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}r.push(y),t(0,r)}function l(){t(2,a=i.save(r)),a===void 0&&i.close()}function c(){i.close()}function f(y,S,b,w){b[w]=y,t(0,r)}let p=y=>o(y.detail.template),m=()=>u(),h=()=>s(),d=()=>l(),v=()=>c();return n.$$set=y=>{"buttonConfigs"in y&&t(0,r=y.buttonConfigs),"modal"in y&&t(1,i=y.modal)},[r,i,a,o,u,s,l,c,f,p,m,h,d,v]}var CM=class extends Pe{constructor(e){super(),Be(this,e,Iie,Fie,ke,{buttonConfigs:0,modal:1})}},x6=CM;var ng=class extends w6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new x6({target:this.contentEl,props:{buttonConfigs:bE(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 E6=require("obsidian");function _6(n,e,t){let r=n.slice();return r[12]=e[t],r[13]=e,r[14]=t,r}function Pie(n){let e,t;return e=new qr({props:{plugin:n[1].plugin,iconName:"x"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1].plugin),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function S6(n){let e,t,r,i,a,o,u,s,l,c;function f(){n[7].call(r,n[13],n[14])}function p(){return n[8](n[12])}return o=new It({props:{tooltip:"Delete",$$slots:{default:[Pie]},$$scope:{ctx:n}}}),o.$on("click",p),{c(){e=ee("tr"),t=ee("td"),r=ee("input"),i=fe(),a=ee("td"),xe(o.$$.fragment),u=fe(),q(r,"type","text"),q(r,"placeholder","path/to/folder"),xo(r,"width","100%"),xo(t,"width","100%")},m(m,h){J(m,e,h),K(e,t),K(t,r),je(r,n[12]),K(e,i),K(e,a),ye(o,a,null),K(e,u),s=!0,l||(c=Fe(r,"input",f),l=!0)},p(m,h){n=m,h&1&&r.value!==n[12]&&je(r,n[12]);let d={};h&32770&&(d.$$scope={dirty:h,ctx:n}),o.$set(d)},i(m){s||(j(o.$$.fragment,m),s=!0)},o(m){ne(o.$$.fragment,m),s=!1},d(m){m&&Y(e),be(o),l=!1,c()}}}function kie(n){let e;return{c(){e=He("Add Folder")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function A6(n){let e,t,r,i,a;return i=new Ps({props:{errorCollection:n[2],declaration:void 0}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Folder Paths are invalid",r=fe(),xe(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ye(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.errorCollection=o[2]),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),be(i)}}}function Bie(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Oie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Rie(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[Bie]},$$scope:{ctx:n}}}),e.$on("click",n[10]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[Oie]},$$scope:{ctx:n}}}),r.$on("click",n[11]),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,o){let u={};o&32768&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&32768&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function Lie(n){let e,t,r,i,a,o,u,s,l,c,f,p=ct(n[0]),m=[];for(let v=0;v<p.length;v+=1)m[v]=S6(_6(n,p,v));let h=v=>ne(m[v],1,1,()=>{m[v]=null});u=new It({props:{variant:"primary",tooltip:"Add new excluded Folder",$$slots:{default:[kie]},$$scope:{ctx:n}}}),u.$on("click",n[9]);let d=n[2]&&A6(n);return c=new no({props:{$$slots:{default:[Rie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("table"),r=ee("thead"),r.innerHTML="<tr><th>Folder Path</th> <th></th></tr>",i=fe(),a=ee("tbody");for(let v=0;v<m.length;v+=1)m[v].c();o=fe(),xe(u.$$.fragment),s=fe(),d&&d.c(),l=fe(),xe(c.$$.fragment)},m(v,y){J(v,e,y),K(e,t),K(t,r),K(t,i),K(t,a);for(let S=0;S<m.length;S+=1)m[S]&&m[S].m(a,null);K(e,o),ye(u,e,null),K(e,s),d&&d.m(e,null),K(e,l),ye(c,e,null),f=!0},p(v,[y]){if(y&11){p=ct(v[0]);let w;for(w=0;w<p.length;w+=1){let A=_6(v,p,w);m[w]?(m[w].p(A,y),j(m[w],1)):(m[w]=S6(A),m[w].c(),j(m[w],1),m[w].m(a,null))}for(bt(),w=p.length;w<m.length;w+=1)h(w);xt()}let S={};y&32768&&(S.$$scope={dirty:y,ctx:v}),u.$set(S),v[2]?d?(d.p(v,y),y&4&&j(d,1)):(d=A6(v),d.c(),j(d,1),d.m(e,l)):d&&(bt(),ne(d,1,1,()=>{d=null}),xt());let b={};y&32768&&(b.$$scope={dirty:y,ctx:v}),c.$set(b)},i(v){if(!f){for(let y=0;y<p.length;y+=1)j(m[y]);j(u.$$.fragment,v),j(d),j(c.$$.fragment,v),f=!0}},o(v){m=m.filter(Boolean);for(let y=0;y<m.length;y+=1)ne(m[y]);ne(u.$$.fragment,v),ne(d),ne(c.$$.fragment,v),f=!1},d(v){v&&Y(e),Qt(m,v),be(u),d&&d.d(),be(c)}}}function Vie(n,e,t){let{excludedFolders:r}=e,{modal:i}=e,a;function o(d){t(0,r=r.filter(v=>v!==d))}function u(){r.push(""),t(0,r)}function s(){t(2,a=i.save(r)),a===void 0&&i.close()}function l(){i.close()}function c(d,v){d[v]=this.value,t(0,r)}let f=d=>o(d),p=()=>u(),m=()=>s(),h=()=>l();return n.$$set=d=>{"excludedFolders"in d&&t(0,r=d.excludedFolders),"modal"in d&&t(1,i=d.modal)},[r,i,a,o,u,s,l,c,f,p,m,h]}var FM=class extends Pe{constructor(e){super(),Be(this,e,Vie,Lie,ke,{excludedFolders:0,modal:1})}},M6=FM;var ig=class extends E6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new M6({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 r=new Gt("Excluded Folders");return r.add(new Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),r}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var I6=require("obsidian");function Uie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"x"}}),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function qie(n){let e,t,r,i,a,o;return r=new It({props:{variant:"destructive",tooltip:"Delete Template",$$slots:{default:[Uie]},$$scope:{ctx:n}}}),r.$on("click",n[4]),{c(){e=ee("input"),t=fe(),xe(r.$$.fragment),q(e,"type","text"),q(e,"placeholder","template-name")},m(u,s){J(u,e,s),je(e,n[0].name),J(u,t,s),ye(r,u,s),i=!0,a||(o=Fe(e,"input",n[3]),a=!0)},p(u,s){s&1&&e.value!==u[0].name&&je(e,u[0].name);let l={};s&130&&(l.$$scope={dirty:s,ctx:u}),r.$set(l)},i(u){i||(j(r.$$.fragment,u),i=!0)},o(u){ne(r.$$.fragment,u),i=!1},d(u){u&&(Y(e),Y(t)),be(r,u),a=!1,o()}}}function zie(n){let e,t,r,i,a,o,u;return t=new Is({props:{$$slots:{default:[qie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),xe(t.$$.fragment),r=fe(),i=ee("textarea"),q(i,"type","text"),q(i,"placeholder","INPUT[slider(addLabels)]"),xo(i,"width","100%"),xo(i,"height","100px"),xo(i,"resize","vertical"),q(e,"class","mb-card")},m(s,l){J(s,e,l),ye(t,e,null),K(e,r),K(e,i),je(i,n[0].declaration),a=!0,o||(u=Fe(i,"input",n[5]),o=!0)},p(s,[l]){let c={};l&131&&(c.$$scope={dirty:l,ctx:s}),t.$set(c),l&1&&je(i,s[0].declaration)},i(s){a||(j(t.$$.fragment,s),a=!0)},o(s){ne(t.$$.fragment,s),a=!1},d(s){s&&Y(e),be(t),o=!1,u()}}}function $ie(n,e,t){let{plugin:r}=e,{template:i}=e,a=Ws();function o(){a("delete-template",{template:i})}function u(){i.name=this.value,t(0,i)}let s=()=>o();function l(){i.declaration=this.value,t(0,i)}return n.$$set=c=>{"plugin"in c&&t(1,r=c.plugin),"template"in c&&t(0,i=c.template)},[i,r,o,u,s,l]}var IM=class extends Pe{constructor(e){super(),Be(this,e,$ie,zie,ke,{plugin:1,template:0})}},D6=IM;function N6(n,e,t){let r=n.slice();return r[11]=e[t],r}function T6(n){let e,t;return e=new D6({props:{plugin:n[1].plugin,template:n[11]}}),e.$on("delete-template",n[7]),{c(){xe(e.$$.fragment)},m(r,i){ye(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1].plugin),i&1&&(a.template=r[11]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){be(e,r)}}}function Hie(n){let e;return{c(){e=He("Add Template")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function C6(n){let e,t,r,i,a;return i=new Ps({props:{settings:{errorCollection:n[2]}}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Templates Failed to Parse",r=fe(),xe(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ye(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.settings={errorCollection:o[2]}),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),be(i)}}}function Gie(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Wie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Yie(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[Gie]},$$scope:{ctx:n}}}),e.$on("click",n[9]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[Wie]},$$scope:{ctx:n}}}),r.$on("click",n[10]),{c(){xe(e.$$.fragment),t=fe(),xe(r.$$.fragment)},m(a,o){ye(e,a,o),J(a,t,o),ye(r,a,o),i=!0},p(a,o){let u={};o&16384&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&16384&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),be(e,a),be(r,a)}}}function jie(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let h=0;h<c.length;h+=1)f[h]=T6(N6(n,c,h));let p=h=>ne(f[h],1,1,()=>{f[h]=null});a=new It({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[Hie]},$$scope:{ctx:n}}}),a.$on("click",n[8]);let m=n[2]&&C6(n);return s=new no({props:{$$slots:{default:[Yie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("h2"),t.textContent="Meta Bind Input Field Templates",r=fe();for(let h=0;h<f.length;h+=1)f[h].c();i=fe(),xe(a.$$.fragment),o=fe(),m&&m.c(),u=fe(),xe(s.$$.fragment)},m(h,d){J(h,e,d),K(e,t),K(e,r);for(let v=0;v<f.length;v+=1)f[v]&&f[v].m(e,null);K(e,i),ye(a,e,null),K(e,o),m&&m.m(e,null),K(e,u),ye(s,e,null),l=!0},p(h,[d]){if(d&11){c=ct(h[0]);let S;for(S=0;S<c.length;S+=1){let b=N6(h,c,S);f[S]?(f[S].p(b,d),j(f[S],1)):(f[S]=T6(b),f[S].c(),j(f[S],1),f[S].m(e,i))}for(bt(),S=c.length;S<f.length;S+=1)p(S);xt()}let v={};d&16384&&(v.$$scope={dirty:d,ctx:h}),a.$set(v),h[2]?m?(m.p(h,d),d&4&&j(m,1)):(m=C6(h),m.c(),j(m,1),m.m(e,u)):m&&(bt(),ne(m,1,1,()=>{m=null}),xt());let y={};d&16384&&(y.$$scope={dirty:d,ctx:h}),s.$set(y)},i(h){if(!l){for(let d=0;d<c.length;d+=1)j(f[d]);j(a.$$.fragment,h),j(m),j(s.$$.fragment,h),l=!0}},o(h){f=f.filter(Boolean);for(let d=0;d<f.length;d+=1)ne(f[d]);ne(a.$$.fragment,h),ne(m),ne(s.$$.fragment,h),l=!1},d(h){h&&Y(e),Qt(f,h),be(a),m&&m.d(),be(s)}}}function Zie(n,e,t){let{inputFieldTemplates:r}=e,{modal:i}=e,a;function o(h){t(0,r=r.filter(d=>d!==h))}function u(){r.push({name:"",declaration:""}),t(0,r)}function s(){t(2,a=i.save(r)),a===void 0&&i.close()}function l(){i.close()}let c=h=>o(h.detail.template),f=()=>u(),p=()=>s(),m=()=>l();return n.$$set=h=>{"inputFieldTemplates"in h&&t(0,r=h.inputFieldTemplates),"modal"in h&&t(1,i=h.modal)},[r,i,a,o,u,s,l,c,f,p,m]}var PM=class extends Pe{constructor(e){super(),Be(this,e,Zie,jie,ke,{inputFieldTemplates:0,modal:1})}},F6=PM;var ag=class extends I6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new F6({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()}};var og=class extends Vn.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 Vn.ButtonComponent(e);t.setButtonText("Learn About Canary Builds"),t.setCta(),t.onClick(()=>{qt.open(qt.linkToCanaryBuilds())})}new Vn.Setting(e).setName("Quick access").addButton(t=>{t.setCta(),t.setButtonText("Docs"),t.onClick(()=>{qt.open(qt.linkToHome())})}).addButton(t=>{t.setButtonText("Open FAQ"),t.onClick(()=>{this.plugin.activateView(Du)})}).addButton(t=>{t.setButtonText("GitHub"),t.onClick(()=>{qt.open(qt.linkToGithub())})}).addButton(t=>{t.setButtonText("Report Issue"),t.onClick(()=>{qt.open(qt.linkToIssues())})}),e.createEl("h2",{text:"General Settings"}),new Vn.Setting(e).setName("Enable Syntax Highlighting").setDesc("Enable syntax highlighting for. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableSyntaxHighlighting),t.onChange(r=>{this.plugin.settings.enableSyntaxHighlighting=r,this.plugin.saveSettings()})}),new Vn.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(r=>{this.plugin.settings.enableEditorRightClickMenu=r,this.plugin.saveSettings()})}),new Vn.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 ag(this.app,this.plugin).open()})}),new Vn.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 ng(this.app,this.plugin).open()})}),new Vn.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 ig(this.app,this.plugin).open()})}),new Vn.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(r=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=r,this.plugin.saveSettings()})}),new Vn.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(r=>{this.plugin.settings.enableJs=r,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and Time Settings"}),new Vn.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(r=>{this.plugin.settings.preferredDateFormat=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(t=>{for(let r of Ls)t.addOption(r.name,r.name);t.setValue(this.plugin.settings.firstWeekday.name),t.onChange(r=>{this.plugin.settings.firstWeekday=Ls.find(i=>i.name===r),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced Settings"}),new Vn.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(r=>{this.plugin.settings.devMode=r,this.plugin.saveSettings()})}),new Vn.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(r=>{this.plugin.settings.ignoreCodeBlockRestrictions=r,this.plugin.saveSettings()})}),new Vn.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: ${xa.syncInterval}; Minimum: ${xa.minSyncInterval}; Maximum: ${xa.maxSyncInterval}`).addText(t=>{t.setValue(this.plugin.settings.syncInterval.toString()),t.onChange(r=>{this.plugin.settings.syncInterval=Number.parseInt(r),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=xa.syncInterval),this.plugin.settings.syncInterval<xa.minSyncInterval&&(this.plugin.settings.syncInterval=xa.minSyncInterval),this.plugin.settings.syncInterval>xa.maxSyncInterval&&(this.plugin.settings.syncInterval=xa.maxSyncInterval),this.plugin.saveSettings()})})}};var Df=class extends Wo{constructor(e,t){super(void 0),this.ctx=e,this.element=t}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};var kM=(r=>(r.DEV="dev",r.CANARY="canary",r.RELEASE="release",r))(kM||{}),sg=class extends Ql.Plugin{async onload(){console.log("meta-bind | Main >> load"),this.build=this.determineBuild(),await this.loadSettings(),this.addSettingTab(new og(this.app,this)),this.dependencyManager=new tg(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Qi(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Qi(0,1,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new Qi(2,2,3)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new Bh(this),this.internal=new jh(this),this.mountableManager=new Kf,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(n6(this)),this.addCommands(),H8(this),this.registerView(Du,e=>new rg(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,t)=>{IE(e,t,this)})),await(0,Ql.loadPrism)())}onunload(){console.log("meta-bind | Main >> unload"),this.mountableManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}setUpMetadataManager(){this.metadataManager=new Jf,this.metadataManager.registerSource(new Zh(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new $f("memory",this.metadataManager)),this.metadataManager.registerSource(new Hf("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new Gf("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,t)=>{this.mountableManager.unloadFile(t),this.metadataManager.onStoragePathRenamed(t,e.path)})),this.registerEvent(this.app.vault.on("delete",e=>{this.mountableManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.settings.syncInterval))}addPostProcessors(){this.registerMarkdownPostProcessor((e,t)=>{let r=e.querySelectorAll("code"),i=t.sourcePath;for(let a=0;a<r.length;a++){let o=r.item(a);if(o.hasClass("mb-none"))continue;let u=o.innerText,s=this.api.isInlineFieldDeclarationAndGetType(u);if(s===void 0)continue;let l=this.api.createInlineFieldOfTypeFromString(s,u,i,void 0);this.api.wrapInMDRC(l,o,t)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,t,r)=>{let i=t,a=e.trim(),o=r.sourcePath,u=this.api.isInlineFieldDeclarationAndGetType(a);if(u===void 0)return;let s=this.api.createInlineFieldOfTypeFromString(u,a,o,void 0,"block",new Df(r,t));this.api.wrapInMDRC(s,i,r)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,t,r)=>{let i=this.api.createJsViewFieldMountable(r.sourcePath,{declaration:e});this.api.wrapInMDRC(i,t,r)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,t,r)=>{let i=this.api.createEmbedMountable(r.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,t,r)});for(let e=1;e<=qf;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(t,r,i)=>{let a=this.api.createEmbedMountable(i.sourcePath,{content:t,depth:e});this.api.wrapInMDRC(a,r,i)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,t,r)=>{let i=this.api.createButtonMountable(r.sourcePath,{declaration:e,isPreview:!1,position:new Df(r,t)});this.api.wrapInMDRC(i,t,r)})}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-playground",name:"Open Meta Bind Playground",callback:()=>{this.activateView(Du)}}),this.addCommand({id:"open-help",name:"Open Meta Bind Help",callback:()=>{this.activateView(Du)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,Ql.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.addCommand({id:"copy-command-id",name:"Select and Copy Command ID",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){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(){if(!this.api)return;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)}async loadSettings(){console.log("meta-bind | Main >> settings load");let e=await this.loadData();this.settings=Object.assign({},xa,e),await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){Yn.dateFormat=this.settings.preferredDateFormat,AE(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:t}=this.app,r,i=t.getLeavesOfType(e);i.length>0?r=i[0]:(r=t.getLeaf("tab"),await r.setViewState({type:e,active:!0})),t.revealLeaf(r)}};
/*! Bundled license information:
moment/moment.js:
(*! moment.js *)
(*! version : 2.30.1 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
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
*)
*/