/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Wed, 15 Jan 2025 13:02:01 GMT
Version: 1.3.1
-------------------------------------------
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) 2025 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 H7=Object.create;var od=Object.defineProperty;var G7=Object.getOwnPropertyDescriptor;var W7=Object.getOwnPropertyNames;var Y7=Object.getPrototypeOf,j7=Object.prototype.hasOwnProperty;var ai=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Z7=(t,e)=>{for(var r in e)od(t,r,{get:e[r],enumerable:!0})},LC=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of W7(e))!j7.call(t,i)&&i!==r&&od(t,i,{get:()=>e[i],enumerable:!(n=G7(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?H7(Y7(t)):{},LC(e||!t||!t.__esModule?od(r,"default",{value:t,enumerable:!0}):r,t)),J7=t=>LC(od({},"__esModule",{value:!0}),t);var mp=ai((Wx,Ac)=>{(function(t,e){typeof Wx=="object"&&typeof Ac<"u"?Ac.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Wx,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(g){t=g}function n(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,S){return Object.prototype.hasOwnProperty.call(g,S)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;var S;for(S in g)if(a(g,S))return!1;return!0}function s(g){return g===void 0}function l(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function u(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function c(g,S){var I=[],$,H=g.length;for($=0;$<H;++$)I.push(S(g[$],$));return I}function f(g,S){for(var I in S)a(S,I)&&(g[I]=S[I]);return a(S,"toString")&&(g.toString=S.toString),a(S,"valueOf")&&(g.valueOf=S.valueOf),g}function m(g,S,I,$){return gC(g,S,I,$,!0).utc()}function p(){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 d(g){return g._pf==null&&(g._pf=p()),g._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(g){var S=Object(this),I=S.length>>>0,$;for($=0;$<I;$++)if($ in S&&g.call(this,S[$],$,S))return!0;return!1};function x(g){var S=null,I=!1,$=g._d&&!isNaN(g._d.getTime());if($&&(S=d(g),I=h.call(S.parsedDateParts,function(H){return H!=null}),$=S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&I),g._strict&&($=$&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(g))g._isValid=$;else return $;return g._isValid}function b(g){var S=m(NaN);return g!=null?f(d(S),g):d(S).userInvalidated=!0,S}var T=e.momentProperties=[],v=!1;function A(g,S){var I,$,H,oe=T.length;if(s(S._isAMomentObject)||(g._isAMomentObject=S._isAMomentObject),s(S._i)||(g._i=S._i),s(S._f)||(g._f=S._f),s(S._l)||(g._l=S._l),s(S._strict)||(g._strict=S._strict),s(S._tzm)||(g._tzm=S._tzm),s(S._isUTC)||(g._isUTC=S._isUTC),s(S._offset)||(g._offset=S._offset),s(S._pf)||(g._pf=d(S)),s(S._locale)||(g._locale=S._locale),oe>0)for(I=0;I<oe;I++)$=T[I],H=S[$],s(H)||(g[$]=H);return g}function w(g){A(this,g),this._d=new Date(g._d!=null?g._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),v===!1&&(v=!0,e.updateOffset(this),v=!1)}function y(g){return g instanceof w||g!=null&&g._isAMomentObject!=null}function E(g){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+g)}function D(g,S){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,g),I){var $=[],H,oe,Me,gt=arguments.length;for(oe=0;oe<gt;oe++){if(H="",typeof arguments[oe]=="object"){H+=`
[`+oe+"] ";for(Me in arguments[0])a(arguments[0],Me)&&(H+=Me+": "+arguments[0][Me]+", ");H=H.slice(0,-2)}else H=arguments[oe];$.push(H)}E(g+`
Arguments: `+Array.prototype.slice.call($).join("")+`
`+new Error().stack),I=!1}return S.apply(this,arguments)},S)}var _={};function N(g,S){e.deprecationHandler!=null&&e.deprecationHandler(g,S),_[g]||(E(S),_[g]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function C(g){return typeof Function<"u"&&g instanceof Function||Object.prototype.toString.call(g)==="[object Function]"}function B(g){var S,I;for(I in g)a(g,I)&&(S=g[I],C(S)?this[I]=S:this["_"+I]=S);this._config=g,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function R(g,S){var I=f({},g),$;for($ in S)a(S,$)&&(i(g[$])&&i(S[$])?(I[$]={},f(I[$],g[$]),f(I[$],S[$])):S[$]!=null?I[$]=S[$]:delete I[$]);for($ in g)a(g,$)&&!a(S,$)&&i(g[$])&&(I[$]=f({},I[$]));return I}function V(g){g!=null&&this.set(g)}var L;Object.keys?L=Object.keys:L=function(g){var S,I=[];for(S in g)a(g,S)&&I.push(S);return I};var P={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function k(g,S,I){var $=this._calendar[g]||this._calendar.sameElse;return C($)?$.call(S,I):$}function W(g,S,I){var $=""+Math.abs(g),H=S-$.length,oe=g>=0;return(oe?I?"+":"":"-")+Math.pow(10,Math.max(0,H)).toString().substr(1)+$}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,X=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ae={},J={};function U(g,S,I,$){var H=$;typeof $=="string"&&(H=function(){return this[$]()}),g&&(J[g]=H),S&&(J[S[0]]=function(){return W(H.apply(this,arguments),S[1],S[2])}),I&&(J[I]=function(){return this.localeData().ordinal(H.apply(this,arguments),g)})}function de(g){return g.match(/\[[\s\S]/)?g.replace(/^\[|\]$/g,""):g.replace(/\\/g,"")}function we(g){var S=g.match(O),I,$;for(I=0,$=S.length;I<$;I++)J[S[I]]?S[I]=J[S[I]]:S[I]=de(S[I]);return function(H){var oe="",Me;for(Me=0;Me<$;Me++)oe+=C(S[Me])?S[Me].call(H,g):S[Me];return oe}}function se(g,S){return g.isValid()?(S=be(S,g.localeData()),ae[S]=ae[S]||we(S),ae[S](g)):g.localeData().invalidDate()}function be(g,S){var I=5;function $(H){return S.longDateFormat(H)||H}for(X.lastIndex=0;I>=0&&X.test(g);)g=g.replace(X,$),X.lastIndex=0,I-=1;return g}var K={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 j(g){var S=this._longDateFormat[g],I=this._longDateFormat[g.toUpperCase()];return S||!I?S:(this._longDateFormat[g]=I.match(O).map(function($){return $==="MMMM"||$==="MM"||$==="DD"||$==="dddd"?$.slice(1):$}).join(""),this._longDateFormat[g])}var ne="Invalid date";function pe(){return this._invalidDate}var fe="%d",Ae=/\d{1,2}/;function _e(g){return this._ordinal.replace("%d",g)}var G={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 Z(g,S,I,$){var H=this._relativeTime[I];return C(H)?H(g,S,I,$):H.replace(/%d/i,g)}function ge(g,S){var I=this._relativeTime[g>0?"future":"past"];return C(I)?I(S):I.replace(/%s/i,S)}var xe={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 Ee(g){return typeof g=="string"?xe[g]||xe[g.toLowerCase()]:void 0}function Be(g){var S={},I,$;for($ in g)a(g,$)&&(I=Ee($),I&&(S[I]=g[$]));return S}var Ve={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 et(g){var S=[],I;for(I in g)a(g,I)&&S.push({unit:I,priority:Ve[I]});return S.sort(function($,H){return $.priority-H.priority}),S}var St=/\d/,Ye=/\d\d/,ur=/\d{3}/,Jt=/\d{4}/,He=/[+-]?\d{6}/,at=/\d\d?/,Q=/\d\d\d\d?/,me=/\d\d\d\d\d\d?/,he=/\d{1,3}/,Fe=/\d{1,4}/,ke=/[+-]?\d{1,6}/,Se=/\d+/,Xe=/[+-]?\d+/,F=/Z|[+-]\d\d:?\d\d/gi,Y=/Z|[+-]\d\d(?::?\d\d)?/gi,ie=/[+-]?\d+(\.\d{1,3})?/,Ce=/[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,tt=/^[1-9]\d?/,xt=/^([1-9]\d|\d)/,_r;_r={};function qe(g,S,I){_r[g]=C(S)?S:function($,H){return $&&I?I:S}}function Ti(g,S){return a(_r,g)?_r[g](S._strict,S._locale):new RegExp(Gi(g))}function Gi(g){return un(g.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(S,I,$,H,oe){return I||$||H||oe}))}function un(g){return g.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function jn(g){return g<0?Math.ceil(g)||0:Math.floor(g)}function gr(g){var S=+g,I=0;return S!==0&&isFinite(S)&&(I=jn(S)),I}var lu={};function kr(g,S){var I,$=S,H;for(typeof g=="string"&&(g=[g]),l(S)&&($=function(oe,Me){Me[S]=gr(oe)}),H=g.length,I=0;I<H;I++)lu[g[I]]=$}function aa(g,S){kr(g,function(I,$,H,oe){H._w=H._w||{},S(I,H._w,H,oe)})}function Ka(g,S,I){S!=null&&a(lu,g)&&lu[g](S,I._a,I,g)}function Da(g){return g%4===0&&g%100!==0||g%400===0}var Bn=0,Zn=1,oa=2,hn=3,ii=4,kn=5,sa=6,Qf=7,uc=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"),qe("Y",Xe),qe("YY",at,Ye),qe("YYYY",Fe,Jt),qe("YYYYY",ke,He),qe("YYYYYY",ke,He),kr(["YYYYY","YYYYYY"],Bn),kr("YYYY",function(g,S){S[Bn]=g.length===2?e.parseTwoDigitYear(g):gr(g)}),kr("YY",function(g,S){S[Bn]=e.parseTwoDigitYear(g)}),kr("Y",function(g,S){S[Bn]=parseInt(g,10)});function xs(g){return Da(g)?366:365}e.parseTwoDigitYear=function(g){return gr(g)+(gr(g)>68?1900:2e3)};var bs=Ko("FullYear",!0);function lc(){return Da(this.year())}function Ko(g,S){return function(I){return I!=null?(cc(this,g,I),e.updateOffset(this,S),this):Do(this,g)}}function Do(g,S){if(!g.isValid())return NaN;var I=g._d,$=g._isUTC;switch(S){case"Milliseconds":return $?I.getUTCMilliseconds():I.getMilliseconds();case"Seconds":return $?I.getUTCSeconds():I.getSeconds();case"Minutes":return $?I.getUTCMinutes():I.getMinutes();case"Hours":return $?I.getUTCHours():I.getHours();case"Date":return $?I.getUTCDate():I.getDate();case"Day":return $?I.getUTCDay():I.getDay();case"Month":return $?I.getUTCMonth():I.getMonth();case"FullYear":return $?I.getUTCFullYear():I.getFullYear();default:return NaN}}function cc(g,S,I){var $,H,oe,Me,gt;if(!(!g.isValid()||isNaN(I))){switch($=g._d,H=g._isUTC,S){case"Milliseconds":return void(H?$.setUTCMilliseconds(I):$.setMilliseconds(I));case"Seconds":return void(H?$.setUTCSeconds(I):$.setSeconds(I));case"Minutes":return void(H?$.setUTCMinutes(I):$.setMinutes(I));case"Hours":return void(H?$.setUTCHours(I):$.setHours(I));case"Date":return void(H?$.setUTCDate(I):$.setDate(I));case"FullYear":break;default:return}oe=I,Me=g.month(),gt=g.date(),gt=gt===29&&Me===1&&!Da(oe)?28:gt,H?$.setUTCFullYear(oe,Me,gt):$.setFullYear(oe,Me,gt)}}function fc(g){return g=Ee(g),C(this[g])?this[g]():this}function Kf(g,S){if(typeof g=="object"){g=Be(g);var I=et(g),$,H=I.length;for($=0;$<H;$++)this[I[$].unit](g[I[$].unit])}else if(g=Ee(g),C(this[g]))return this[g](S);return this}function ep(g,S){return(g%S+S)%S}var ln;Array.prototype.indexOf?ln=Array.prototype.indexOf:ln=function(g){var S;for(S=0;S<this.length;++S)if(this[S]===g)return S;return-1};function q(g,S){if(isNaN(g)||isNaN(S))return NaN;var I=ep(S,12);return g+=(S-I)/12,I===1?Da(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)}),qe("M",at,tt),qe("MM",at,Ye),qe("MMM",function(g,S){return S.monthsShortRegex(g)}),qe("MMMM",function(g,S){return S.monthsRegex(g)}),kr(["M","MM"],function(g,S){S[Zn]=gr(g)-1}),kr(["MMM","MMMM"],function(g,S,I,$){var H=I._locale.monthsParse(g,$,I._strict);H!=null?S[Zn]=H:d(I).invalidMonth=g});var re="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ge=Ce,zt=Ce;function $r(g,S){return g?n(this._months)?this._months[g.month()]:this._months[(this._months.isFormat||Ke).test(S)?"format":"standalone"][g.month()]:n(this._months)?this._months:this._months.standalone}function Rn(g,S){return g?n(this._monthsShort)?this._monthsShort[g.month()]:this._monthsShort[Ke.test(S)?"format":"standalone"][g.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ln(g,S,I){var $,H,oe,Me=g.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],$=0;$<12;++$)oe=m([2e3,$]),this._shortMonthsParse[$]=this.monthsShort(oe,"").toLocaleLowerCase(),this._longMonthsParse[$]=this.months(oe,"").toLocaleLowerCase();return I?S==="MMM"?(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:null):(H=ln.call(this._longMonthsParse,Me),H!==-1?H:null):S==="MMM"?(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:(H=ln.call(this._longMonthsParse,Me),H!==-1?H:null)):(H=ln.call(this._longMonthsParse,Me),H!==-1?H:(H=ln.call(this._shortMonthsParse,Me),H!==-1?H:null))}function ws(g,S,I){var $,H,oe;if(this._monthsParseExact)return Ln.call(this,g,S,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),$=0;$<12;$++){if(H=m([2e3,$]),I&&!this._longMonthsParse[$]&&(this._longMonthsParse[$]=new RegExp("^"+this.months(H,"").replace(".","")+"$","i"),this._shortMonthsParse[$]=new RegExp("^"+this.monthsShort(H,"").replace(".","")+"$","i")),!I&&!this._monthsParse[$]&&(oe="^"+this.months(H,"")+"|^"+this.monthsShort(H,""),this._monthsParse[$]=new RegExp(oe.replace(".",""),"i")),I&&S==="MMMM"&&this._longMonthsParse[$].test(g))return $;if(I&&S==="MMM"&&this._shortMonthsParse[$].test(g))return $;if(!I&&this._monthsParse[$].test(g))return $}}function iC(g,S){if(!g.isValid())return g;if(typeof S=="string"){if(/^\d+$/.test(S))S=gr(S);else if(S=g.localeData().monthsParse(S),!l(S))return g}var I=S,$=g.date();return $=$<29?$:Math.min($,q(g.year(),I)),g._isUTC?g._d.setUTCMonth(I,$):g._d.setMonth(I,$),g}function aC(g){return g!=null?(iC(this,g),e.updateOffset(this,!0),this):Do(this,"Month")}function D9(){return q(this.year(),this.month())}function M9(g){return this._monthsParseExact?(a(this,"_monthsRegex")||oC.call(this),g?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=Ge),this._monthsShortStrictRegex&&g?this._monthsShortStrictRegex:this._monthsShortRegex)}function C9(g){return this._monthsParseExact?(a(this,"_monthsRegex")||oC.call(this),g?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=zt),this._monthsStrictRegex&&g?this._monthsStrictRegex:this._monthsRegex)}function oC(){function g(tr,Dr){return Dr.length-tr.length}var S=[],I=[],$=[],H,oe,Me,gt;for(H=0;H<12;H++)oe=m([2e3,H]),Me=un(this.monthsShort(oe,"")),gt=un(this.months(oe,"")),S.push(Me),I.push(gt),$.push(gt),$.push(Me);S.sort(g),I.sort(g),$.sort(g),this._monthsRegex=new RegExp("^("+$.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+S.join("|")+")","i")}function N9(g,S,I,$,H,oe,Me){var gt;return g<100&&g>=0?(gt=new Date(g+400,S,I,$,H,oe,Me),isFinite(gt.getFullYear())&&gt.setFullYear(g)):gt=new Date(g,S,I,$,H,oe,Me),gt}function tp(g){var S,I;return g<100&&g>=0?(I=Array.prototype.slice.call(arguments),I[0]=g+400,S=new Date(Date.UTC.apply(null,I)),isFinite(S.getUTCFullYear())&&S.setUTCFullYear(g)):S=new Date(Date.UTC.apply(null,arguments)),S}function Zm(g,S,I){var $=7+S-I,H=(7+tp(g,0,$).getUTCDay()-S)%7;return-H+$-1}function sC(g,S,I,$,H){var oe=(7+I-$)%7,Me=Zm(g,$,H),gt=1+7*(S-1)+oe+Me,tr,Dr;return gt<=0?(tr=g-1,Dr=xs(tr)+gt):gt>xs(g)?(tr=g+1,Dr=gt-xs(g)):(tr=g,Dr=gt),{year:tr,dayOfYear:Dr}}function rp(g,S,I){var $=Zm(g.year(),S,I),H=Math.floor((g.dayOfYear()-$-1)/7)+1,oe,Me;return H<1?(Me=g.year()-1,oe=H+_s(Me,S,I)):H>_s(g.year(),S,I)?(oe=H-_s(g.year(),S,I),Me=g.year()+1):(Me=g.year(),oe=H),{week:oe,year:Me}}function _s(g,S,I){var $=Zm(g,S,I),H=Zm(g+1,S,I);return(xs(g)-$+H)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),qe("w",at,tt),qe("ww",at,Ye),qe("W",at,tt),qe("WW",at,Ye),aa(["w","ww","W","WW"],function(g,S,I,$){S[$.substr(0,1)]=gr(g)});function F9(g){return rp(g,this._week.dow,this._week.doy).week}var I9={dow:0,doy:6};function P9(){return this._week.dow}function B9(){return this._week.doy}function k9(g){var S=this.localeData().week(this);return g==null?S:this.add((g-S)*7,"d")}function $9(g){var S=rp(this,1,4).week;return g==null?S:this.add((g-S)*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"),qe("d",at),qe("e",at),qe("E",at),qe("dd",function(g,S){return S.weekdaysMinRegex(g)}),qe("ddd",function(g,S){return S.weekdaysShortRegex(g)}),qe("dddd",function(g,S){return S.weekdaysRegex(g)}),aa(["dd","ddd","dddd"],function(g,S,I,$){var H=I._locale.weekdaysParse(g,$,I._strict);H!=null?S.d=H:d(I).invalidWeekday=g}),aa(["d","e","E"],function(g,S,I,$){S[$]=gr(g)});function O9(g,S){return typeof g!="string"?g:isNaN(g)?(g=S.weekdaysParse(g),typeof g=="number"?g:null):parseInt(g,10)}function R9(g,S){return typeof g=="string"?S.weekdaysParse(g)%7||7:isNaN(g)?null:g}function gx(g,S){return g.slice(S,7).concat(g.slice(0,S))}var L9="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),uC="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),V9="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),U9=Ce,q9=Ce,z9=Ce;function H9(g,S){var I=n(this._weekdays)?this._weekdays:this._weekdays[g&&g!==!0&&this._weekdays.isFormat.test(S)?"format":"standalone"];return g===!0?gx(I,this._week.dow):g?I[g.day()]:I}function G9(g){return g===!0?gx(this._weekdaysShort,this._week.dow):g?this._weekdaysShort[g.day()]:this._weekdaysShort}function W9(g){return g===!0?gx(this._weekdaysMin,this._week.dow):g?this._weekdaysMin[g.day()]:this._weekdaysMin}function Y9(g,S,I){var $,H,oe,Me=g.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],$=0;$<7;++$)oe=m([2e3,1]).day($),this._minWeekdaysParse[$]=this.weekdaysMin(oe,"").toLocaleLowerCase(),this._shortWeekdaysParse[$]=this.weekdaysShort(oe,"").toLocaleLowerCase(),this._weekdaysParse[$]=this.weekdays(oe,"").toLocaleLowerCase();return I?S==="dddd"?(H=ln.call(this._weekdaysParse,Me),H!==-1?H:null):S==="ddd"?(H=ln.call(this._shortWeekdaysParse,Me),H!==-1?H:null):(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null):S==="dddd"?(H=ln.call(this._weekdaysParse,Me),H!==-1||(H=ln.call(this._shortWeekdaysParse,Me),H!==-1)?H:(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null)):S==="ddd"?(H=ln.call(this._shortWeekdaysParse,Me),H!==-1||(H=ln.call(this._weekdaysParse,Me),H!==-1)?H:(H=ln.call(this._minWeekdaysParse,Me),H!==-1?H:null)):(H=ln.call(this._minWeekdaysParse,Me),H!==-1||(H=ln.call(this._weekdaysParse,Me),H!==-1)?H:(H=ln.call(this._shortWeekdaysParse,Me),H!==-1?H:null))}function j9(g,S,I){var $,H,oe;if(this._weekdaysParseExact)return Y9.call(this,g,S,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),$=0;$<7;$++){if(H=m([2e3,1]).day($),I&&!this._fullWeekdaysParse[$]&&(this._fullWeekdaysParse[$]=new RegExp("^"+this.weekdays(H,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[$]=new RegExp("^"+this.weekdaysShort(H,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[$]=new RegExp("^"+this.weekdaysMin(H,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[$]||(oe="^"+this.weekdays(H,"")+"|^"+this.weekdaysShort(H,"")+"|^"+this.weekdaysMin(H,""),this._weekdaysParse[$]=new RegExp(oe.replace(".",""),"i")),I&&S==="dddd"&&this._fullWeekdaysParse[$].test(g))return $;if(I&&S==="ddd"&&this._shortWeekdaysParse[$].test(g))return $;if(I&&S==="dd"&&this._minWeekdaysParse[$].test(g))return $;if(!I&&this._weekdaysParse[$].test(g))return $}}function Z9(g){if(!this.isValid())return g!=null?this:NaN;var S=Do(this,"Day");return g!=null?(g=O9(g,this.localeData()),this.add(g-S,"d")):S}function J9(g){if(!this.isValid())return g!=null?this:NaN;var S=(this.day()+7-this.localeData()._week.dow)%7;return g==null?S:this.add(g-S,"d")}function X9(g){if(!this.isValid())return g!=null?this:NaN;if(g!=null){var S=R9(g,this.localeData());return this.day(this.day()%7?S:S-7)}else return this.day()||7}function Q9(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||vx.call(this),g?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=U9),this._weekdaysStrictRegex&&g?this._weekdaysStrictRegex:this._weekdaysRegex)}function K9(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||vx.call(this),g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=q9),this._weekdaysShortStrictRegex&&g?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function eq(g){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||vx.call(this),g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=z9),this._weekdaysMinStrictRegex&&g?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function vx(){function g(Wi,Ds){return Ds.length-Wi.length}var S=[],I=[],$=[],H=[],oe,Me,gt,tr,Dr;for(oe=0;oe<7;oe++)Me=m([2e3,1]).day(oe),gt=un(this.weekdaysMin(Me,"")),tr=un(this.weekdaysShort(Me,"")),Dr=un(this.weekdays(Me,"")),S.push(gt),I.push(tr),$.push(Dr),H.push(gt),H.push(tr),H.push(Dr);S.sort(g),I.sort(g),$.sort(g),H.sort(g),this._weekdaysRegex=new RegExp("^("+H.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+$.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+S.join("|")+")","i")}function yx(){return this.hours()%12||12}function tq(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,yx),U("k",["kk",2],0,tq),U("hmm",0,0,function(){return""+yx.apply(this)+W(this.minutes(),2)}),U("hmmss",0,0,function(){return""+yx.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 lC(g,S){U(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),S)})}lC("a",!0),lC("A",!1);function cC(g,S){return S._meridiemParse}qe("a",cC),qe("A",cC),qe("H",at,xt),qe("h",at,tt),qe("k",at,tt),qe("HH",at,Ye),qe("hh",at,Ye),qe("kk",at,Ye),qe("hmm",Q),qe("hmmss",me),qe("Hmm",Q),qe("Hmmss",me),kr(["H","HH"],hn),kr(["k","kk"],function(g,S,I){var $=gr(g);S[hn]=$===24?0:$}),kr(["a","A"],function(g,S,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),kr(["h","hh"],function(g,S,I){S[hn]=gr(g),d(I).bigHour=!0}),kr("hmm",function(g,S,I){var $=g.length-2;S[hn]=gr(g.substr(0,$)),S[ii]=gr(g.substr($)),d(I).bigHour=!0}),kr("hmmss",function(g,S,I){var $=g.length-4,H=g.length-2;S[hn]=gr(g.substr(0,$)),S[ii]=gr(g.substr($,2)),S[kn]=gr(g.substr(H)),d(I).bigHour=!0}),kr("Hmm",function(g,S,I){var $=g.length-2;S[hn]=gr(g.substr(0,$)),S[ii]=gr(g.substr($))}),kr("Hmmss",function(g,S,I){var $=g.length-4,H=g.length-2;S[hn]=gr(g.substr(0,$)),S[ii]=gr(g.substr($,2)),S[kn]=gr(g.substr(H))});function rq(g){return(g+"").toLowerCase().charAt(0)==="p"}var nq=/[ap]\.?m?\.?/i,iq=Ko("Hours",!0);function aq(g,S,I){return g>11?I?"pm":"PM":I?"am":"AM"}var fC={calendar:P,longDateFormat:K,invalidDate:ne,ordinal:fe,dayOfMonthOrdinalParse:Ae,relativeTime:G,months:re,monthsShort:Ne,week:I9,weekdays:L9,weekdaysMin:V9,weekdaysShort:uC,meridiemParse:nq},gn={},np={},ip;function oq(g,S){var I,$=Math.min(g.length,S.length);for(I=0;I<$;I+=1)if(g[I]!==S[I])return I;return $}function pC(g){return g&&g.toLowerCase().replace("_","-")}function sq(g){for(var S=0,I,$,H,oe;S<g.length;){for(oe=pC(g[S]).split("-"),I=oe.length,$=pC(g[S+1]),$=$?$.split("-"):null;I>0;){if(H=Jm(oe.slice(0,I).join("-")),H)return H;if($&&$.length>=I&&oq(oe,$)>=I-1)break;I--}S++}return ip}function uq(g){return!!(g&&g.match("^[^/\\\\]*$"))}function Jm(g){var S=null,I;if(gn[g]===void 0&&typeof Ac<"u"&&Ac&&Ac.exports&&uq(g))try{S=ip._abbr,I=require,I("./locale/"+g),cu(S)}catch{gn[g]=null}return gn[g]}function cu(g,S){var I;return g&&(s(S)?I=As(g):I=xx(g,S),I?ip=I:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),ip._abbr}function xx(g,S){if(S!==null){var I,$=fC;if(S.abbr=g,gn[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."),$=gn[g]._config;else if(S.parentLocale!=null)if(gn[S.parentLocale]!=null)$=gn[S.parentLocale]._config;else if(I=Jm(S.parentLocale),I!=null)$=I._config;else return np[S.parentLocale]||(np[S.parentLocale]=[]),np[S.parentLocale].push({name:g,config:S}),null;return gn[g]=new V(R($,S)),np[g]&&np[g].forEach(function(H){xx(H.name,H.config)}),cu(g),gn[g]}else return delete gn[g],null}function lq(g,S){if(S!=null){var I,$,H=fC;gn[g]!=null&&gn[g].parentLocale!=null?gn[g].set(R(gn[g]._config,S)):($=Jm(g),$!=null&&(H=$._config),S=R(H,S),$==null&&(S.abbr=g),I=new V(S),I.parentLocale=gn[g],gn[g]=I),cu(g)}else gn[g]!=null&&(gn[g].parentLocale!=null?(gn[g]=gn[g].parentLocale,g===cu()&&cu(g)):gn[g]!=null&&delete gn[g]);return gn[g]}function As(g){var S;if(g&&g._locale&&g._locale._abbr&&(g=g._locale._abbr),!g)return ip;if(!n(g)){if(S=Jm(g),S)return S;g=[g]}return sq(g)}function cq(){return L(gn)}function bx(g){var S,I=g._a;return I&&d(g).overflow===-2&&(S=I[Zn]<0||I[Zn]>11?Zn:I[oa]<1||I[oa]>q(I[Bn],I[Zn])?oa:I[hn]<0||I[hn]>24||I[hn]===24&&(I[ii]!==0||I[kn]!==0||I[sa]!==0)?hn:I[ii]<0||I[ii]>59?ii:I[kn]<0||I[kn]>59?kn:I[sa]<0||I[sa]>999?sa:-1,d(g)._overflowDayOfYear&&(S<Bn||S>oa)&&(S=oa),d(g)._overflowWeeks&&S===-1&&(S=Qf),d(g)._overflowWeekday&&S===-1&&(S=uc),d(g).overflow=S),g}var fq=/^\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)?)?$/,pq=/^\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)?)?$/,mq=/Z|[+-]\d\d(?::?\d\d)?/,Xm=[["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]],wx=[["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/]],dq=/^\/?Date\((-?\d+)/i,hq=/^(?:(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}))$/,gq={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 mC(g){var S,I,$=g._i,H=fq.exec($)||pq.exec($),oe,Me,gt,tr,Dr=Xm.length,Wi=wx.length;if(H){for(d(g).iso=!0,S=0,I=Dr;S<I;S++)if(Xm[S][1].exec(H[1])){Me=Xm[S][0],oe=Xm[S][2]!==!1;break}if(Me==null){g._isValid=!1;return}if(H[3]){for(S=0,I=Wi;S<I;S++)if(wx[S][1].exec(H[3])){gt=(H[2]||" ")+wx[S][0];break}if(gt==null){g._isValid=!1;return}}if(!oe&&gt!=null){g._isValid=!1;return}if(H[4])if(mq.exec(H[4]))tr="Z";else{g._isValid=!1;return}g._f=Me+(gt||"")+(tr||""),Ax(g)}else g._isValid=!1}function vq(g,S,I,$,H,oe){var Me=[yq(g),Ne.indexOf(S),parseInt(I,10),parseInt($,10),parseInt(H,10)];return oe&&Me.push(parseInt(oe,10)),Me}function yq(g){var S=parseInt(g,10);return S<=49?2e3+S:S<=999?1900+S:S}function xq(g){return g.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function bq(g,S,I){if(g){var $=uC.indexOf(g),H=new Date(S[0],S[1],S[2]).getDay();if($!==H)return d(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function wq(g,S,I){if(g)return gq[g];if(S)return 0;var $=parseInt(I,10),H=$%100,oe=($-H)/100;return oe*60+H}function dC(g){var S=hq.exec(xq(g._i)),I;if(S){if(I=vq(S[4],S[3],S[2],S[5],S[6],S[7]),!bq(S[1],I,g))return;g._a=I,g._tzm=wq(S[8],S[9],S[10]),g._d=tp.apply(null,g._a),g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),d(g).rfc2822=!0}else g._isValid=!1}function _q(g){var S=dq.exec(g._i);if(S!==null){g._d=new Date(+S[1]);return}if(mC(g),g._isValid===!1)delete g._isValid;else return;if(dC(g),g._isValid===!1)delete g._isValid;else return;g._strict?g._isValid=!1:e.createFromInputFallback(g)}e.createFromInputFallback=D("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 pc(g,S,I){return g??S??I}function Aq(g){var S=new Date(e.now());return g._useUTC?[S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()]:[S.getFullYear(),S.getMonth(),S.getDate()]}function _x(g){var S,I,$=[],H,oe,Me;if(!g._d){for(H=Aq(g),g._w&&g._a[oa]==null&&g._a[Zn]==null&&Sq(g),g._dayOfYear!=null&&(Me=pc(g._a[Bn],H[Bn]),(g._dayOfYear>xs(Me)||g._dayOfYear===0)&&(d(g)._overflowDayOfYear=!0),I=tp(Me,0,g._dayOfYear),g._a[Zn]=I.getUTCMonth(),g._a[oa]=I.getUTCDate()),S=0;S<3&&g._a[S]==null;++S)g._a[S]=$[S]=H[S];for(;S<7;S++)g._a[S]=$[S]=g._a[S]==null?S===2?1:0:g._a[S];g._a[hn]===24&&g._a[ii]===0&&g._a[kn]===0&&g._a[sa]===0&&(g._nextDay=!0,g._a[hn]=0),g._d=(g._useUTC?tp:N9).apply(null,$),oe=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[hn]=24),g._w&&typeof g._w.d<"u"&&g._w.d!==oe&&(d(g).weekdayMismatch=!0)}}function Sq(g){var S,I,$,H,oe,Me,gt,tr,Dr;S=g._w,S.GG!=null||S.W!=null||S.E!=null?(oe=1,Me=4,I=pc(S.GG,g._a[Bn],rp(cn(),1,4).year),$=pc(S.W,1),H=pc(S.E,1),(H<1||H>7)&&(tr=!0)):(oe=g._locale._week.dow,Me=g._locale._week.doy,Dr=rp(cn(),oe,Me),I=pc(S.gg,g._a[Bn],Dr.year),$=pc(S.w,Dr.week),S.d!=null?(H=S.d,(H<0||H>6)&&(tr=!0)):S.e!=null?(H=S.e+oe,(S.e<0||S.e>6)&&(tr=!0)):H=oe),$<1||$>_s(I,oe,Me)?d(g)._overflowWeeks=!0:tr!=null?d(g)._overflowWeekday=!0:(gt=sC(I,$,H,oe,Me),g._a[Bn]=gt.year,g._dayOfYear=gt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Ax(g){if(g._f===e.ISO_8601){mC(g);return}if(g._f===e.RFC_2822){dC(g);return}g._a=[],d(g).empty=!0;var S=""+g._i,I,$,H,oe,Me,gt=S.length,tr=0,Dr,Wi;for(H=be(g._f,g._locale).match(O)||[],Wi=H.length,I=0;I<Wi;I++)oe=H[I],$=(S.match(Ti(oe,g))||[])[0],$&&(Me=S.substr(0,S.indexOf($)),Me.length>0&&d(g).unusedInput.push(Me),S=S.slice(S.indexOf($)+$.length),tr+=$.length),J[oe]?($?d(g).empty=!1:d(g).unusedTokens.push(oe),Ka(oe,$,g)):g._strict&&!$&&d(g).unusedTokens.push(oe);d(g).charsLeftOver=gt-tr,S.length>0&&d(g).unusedInput.push(S),g._a[hn]<=12&&d(g).bigHour===!0&&g._a[hn]>0&&(d(g).bigHour=void 0),d(g).parsedDateParts=g._a.slice(0),d(g).meridiem=g._meridiem,g._a[hn]=Eq(g._locale,g._a[hn],g._meridiem),Dr=d(g).era,Dr!==null&&(g._a[Bn]=g._locale.erasConvertYear(Dr,g._a[Bn])),_x(g),bx(g)}function Eq(g,S,I){var $;return I==null?S:g.meridiemHour!=null?g.meridiemHour(S,I):(g.isPM!=null&&($=g.isPM(I),$&&S<12&&(S+=12),!$&&S===12&&(S=0)),S)}function Tq(g){var S,I,$,H,oe,Me,gt=!1,tr=g._f.length;if(tr===0){d(g).invalidFormat=!0,g._d=new Date(NaN);return}for(H=0;H<tr;H++)oe=0,Me=!1,S=A({},g),g._useUTC!=null&&(S._useUTC=g._useUTC),S._f=g._f[H],Ax(S),x(S)&&(Me=!0),oe+=d(S).charsLeftOver,oe+=d(S).unusedTokens.length*10,d(S).score=oe,gt?oe<$&&($=oe,I=S):($==null||oe<$||Me)&&($=oe,I=S,Me&&(gt=!0));f(g,I||S)}function Dq(g){if(!g._d){var S=Be(g._i),I=S.day===void 0?S.date:S.day;g._a=c([S.year,S.month,I,S.hour,S.minute,S.second,S.millisecond],function($){return $&&parseInt($,10)}),_x(g)}}function Mq(g){var S=new w(bx(hC(g)));return S._nextDay&&(S.add(1,"d"),S._nextDay=void 0),S}function hC(g){var S=g._i,I=g._f;return g._locale=g._locale||As(g._l),S===null||I===void 0&&S===""?b({nullInput:!0}):(typeof S=="string"&&(g._i=S=g._locale.preparse(S)),y(S)?new w(bx(S)):(u(S)?g._d=S:n(I)?Tq(g):I?Ax(g):Cq(g),x(g)||(g._d=null),g))}function Cq(g){var S=g._i;s(S)?g._d=new Date(e.now()):u(S)?g._d=new Date(S.valueOf()):typeof S=="string"?_q(g):n(S)?(g._a=c(S.slice(0),function(I){return parseInt(I,10)}),_x(g)):i(S)?Dq(g):l(S)?g._d=new Date(S):e.createFromInputFallback(g)}function gC(g,S,I,$,H){var oe={};return(S===!0||S===!1)&&($=S,S=void 0),(I===!0||I===!1)&&($=I,I=void 0),(i(g)&&o(g)||n(g)&&g.length===0)&&(g=void 0),oe._isAMomentObject=!0,oe._useUTC=oe._isUTC=H,oe._l=I,oe._i=g,oe._f=S,oe._strict=$,Mq(oe)}function cn(g,S,I,$){return gC(g,S,I,$,!1)}var Nq=D("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=cn.apply(null,arguments);return this.isValid()&&g.isValid()?g<this?this:g:b()}),Fq=D("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var g=cn.apply(null,arguments);return this.isValid()&&g.isValid()?g>this?this:g:b()});function vC(g,S){var I,$;if(S.length===1&&n(S[0])&&(S=S[0]),!S.length)return cn();for(I=S[0],$=1;$<S.length;++$)(!S[$].isValid()||S[$][g](I))&&(I=S[$]);return I}function Iq(){var g=[].slice.call(arguments,0);return vC("isBefore",g)}function Pq(){var g=[].slice.call(arguments,0);return vC("isAfter",g)}var Bq=function(){return Date.now?Date.now():+new Date},ap=["year","quarter","month","week","day","hour","minute","second","millisecond"];function kq(g){var S,I=!1,$,H=ap.length;for(S in g)if(a(g,S)&&!(ln.call(ap,S)!==-1&&(g[S]==null||!isNaN(g[S]))))return!1;for($=0;$<H;++$)if(g[ap[$]]){if(I)return!1;parseFloat(g[ap[$]])!==gr(g[ap[$]])&&(I=!0)}return!0}function $q(){return this._isValid}function Oq(){return Mo(NaN)}function Qm(g){var S=Be(g),I=S.year||0,$=S.quarter||0,H=S.month||0,oe=S.week||S.isoWeek||0,Me=S.day||0,gt=S.hour||0,tr=S.minute||0,Dr=S.second||0,Wi=S.millisecond||0;this._isValid=kq(S),this._milliseconds=+Wi+Dr*1e3+tr*6e4+gt*1e3*60*60,this._days=+Me+oe*7,this._months=+H+$*3+I*12,this._data={},this._locale=As(),this._bubble()}function Km(g){return g instanceof Qm}function Sx(g){return g<0?Math.round(-1*g)*-1:Math.round(g)}function Rq(g,S,I){var $=Math.min(g.length,S.length),H=Math.abs(g.length-S.length),oe=0,Me;for(Me=0;Me<$;Me++)(I&&g[Me]!==S[Me]||!I&&gr(g[Me])!==gr(S[Me]))&&oe++;return oe+H}function yC(g,S){U(g,0,0,function(){var I=this.utcOffset(),$="+";return I<0&&(I=-I,$="-"),$+W(~~(I/60),2)+S+W(~~I%60,2)})}yC("Z",":"),yC("ZZ",""),qe("Z",Y),qe("ZZ",Y),kr(["Z","ZZ"],function(g,S,I){I._useUTC=!0,I._tzm=Ex(Y,g)});var Lq=/([\+\-]|\d\d)/gi;function Ex(g,S){var I=(S||"").match(g),$,H,oe;return I===null?null:($=I[I.length-1]||[],H=($+"").match(Lq)||["-",0,0],oe=+(H[1]*60)+gr(H[2]),oe===0?0:H[0]==="+"?oe:-oe)}function Tx(g,S){var I,$;return S._isUTC?(I=S.clone(),$=(y(g)||u(g)?g.valueOf():cn(g).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+$),e.updateOffset(I,!1),I):cn(g).local()}function Dx(g){return-Math.round(g._d.getTimezoneOffset())}e.updateOffset=function(){};function Vq(g,S,I){var $=this._offset||0,H;if(!this.isValid())return g!=null?this:NaN;if(g!=null){if(typeof g=="string"){if(g=Ex(Y,g),g===null)return this}else Math.abs(g)<16&&!I&&(g=g*60);return!this._isUTC&&S&&(H=Dx(this)),this._offset=g,this._isUTC=!0,H!=null&&this.add(H,"m"),$!==g&&(!S||this._changeInProgress?_C(this,Mo(g-$,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?$:Dx(this)}function Uq(g,S){return g!=null?(typeof g!="string"&&(g=-g),this.utcOffset(g,S),this):-this.utcOffset()}function qq(g){return this.utcOffset(0,g)}function zq(g){return this._isUTC&&(this.utcOffset(0,g),this._isUTC=!1,g&&this.subtract(Dx(this),"m")),this}function Hq(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var g=Ex(F,this._i);g!=null?this.utcOffset(g):this.utcOffset(0,!0)}return this}function Gq(g){return this.isValid()?(g=g?cn(g).utcOffset():0,(this.utcOffset()-g)%60===0):!1}function Wq(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Yq(){if(!s(this._isDSTShifted))return this._isDSTShifted;var g={},S;return A(g,this),g=hC(g),g._a?(S=g._isUTC?m(g._a):cn(g._a),this._isDSTShifted=this.isValid()&&Rq(g._a,S.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function jq(){return this.isValid()?!this._isUTC:!1}function Zq(){return this.isValid()?this._isUTC:!1}function xC(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Jq=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Xq=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Mo(g,S){var I=g,$=null,H,oe,Me;return Km(g)?I={ms:g._milliseconds,d:g._days,M:g._months}:l(g)||!isNaN(+g)?(I={},S?I[S]=+g:I.milliseconds=+g):($=Jq.exec(g))?(H=$[1]==="-"?-1:1,I={y:0,d:gr($[oa])*H,h:gr($[hn])*H,m:gr($[ii])*H,s:gr($[kn])*H,ms:gr(Sx($[sa]*1e3))*H}):($=Xq.exec(g))?(H=$[1]==="-"?-1:1,I={y:al($[2],H),M:al($[3],H),w:al($[4],H),d:al($[5],H),h:al($[6],H),m:al($[7],H),s:al($[8],H)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Me=Qq(cn(I.from),cn(I.to)),I={},I.ms=Me.milliseconds,I.M=Me.months),oe=new Qm(I),Km(g)&&a(g,"_locale")&&(oe._locale=g._locale),Km(g)&&a(g,"_isValid")&&(oe._isValid=g._isValid),oe}Mo.fn=Qm.prototype,Mo.invalid=Oq;function al(g,S){var I=g&&parseFloat(g.replace(",","."));return(isNaN(I)?0:I)*S}function bC(g,S){var I={};return I.months=S.month()-g.month()+(S.year()-g.year())*12,g.clone().add(I.months,"M").isAfter(S)&&--I.months,I.milliseconds=+S-+g.clone().add(I.months,"M"),I}function Qq(g,S){var I;return g.isValid()&&S.isValid()?(S=Tx(S,g),g.isBefore(S)?I=bC(g,S):(I=bC(S,g),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function wC(g,S){return function(I,$){var H,oe;return $!==null&&!isNaN(+$)&&(N(S,"moment()."+S+"(period, number) is deprecated. Please use moment()."+S+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),oe=I,I=$,$=oe),H=Mo(I,$),_C(this,H,g),this}}function _C(g,S,I,$){var H=S._milliseconds,oe=Sx(S._days),Me=Sx(S._months);g.isValid()&&($=$??!0,Me&&iC(g,Do(g,"Month")+Me*I),oe&&cc(g,"Date",Do(g,"Date")+oe*I),H&&g._d.setTime(g._d.valueOf()+H*I),$&&e.updateOffset(g,oe||Me))}var Kq=wC(1,"add"),ez=wC(-1,"subtract");function AC(g){return typeof g=="string"||g instanceof String}function tz(g){return y(g)||u(g)||AC(g)||l(g)||nz(g)||rz(g)||g===null||g===void 0}function rz(g){var S=i(g)&&!o(g),I=!1,$=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],H,oe,Me=$.length;for(H=0;H<Me;H+=1)oe=$[H],I=I||a(g,oe);return S&&I}function nz(g){var S=n(g),I=!1;return S&&(I=g.filter(function($){return!l($)&&AC(g)}).length===0),S&&I}function iz(g){var S=i(g)&&!o(g),I=!1,$=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],H,oe;for(H=0;H<$.length;H+=1)oe=$[H],I=I||a(g,oe);return S&&I}function az(g,S){var I=g.diff(S,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function oz(g,S){arguments.length===1&&(arguments[0]?tz(arguments[0])?(g=arguments[0],S=void 0):iz(arguments[0])&&(S=arguments[0],g=void 0):(g=void 0,S=void 0));var I=g||cn(),$=Tx(I,this).startOf("day"),H=e.calendarFormat(this,$)||"sameElse",oe=S&&(C(S[H])?S[H].call(this,I):S[H]);return this.format(oe||this.localeData().calendar(H,this,cn(I)))}function sz(){return new w(this)}function uz(g,S){var I=y(g)?g:cn(g);return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(S).valueOf()):!1}function lz(g,S){var I=y(g)?g:cn(g);return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(S).valueOf()<I.valueOf()):!1}function cz(g,S,I,$){var H=y(g)?g:cn(g),oe=y(S)?S:cn(S);return this.isValid()&&H.isValid()&&oe.isValid()?($=$||"()",($[0]==="("?this.isAfter(H,I):!this.isBefore(H,I))&&($[1]===")"?this.isBefore(oe,I):!this.isAfter(oe,I))):!1}function fz(g,S){var I=y(g)?g:cn(g),$;return this.isValid()&&I.isValid()?(S=Ee(S)||"millisecond",S==="millisecond"?this.valueOf()===I.valueOf():($=I.valueOf(),this.clone().startOf(S).valueOf()<=$&&$<=this.clone().endOf(S).valueOf())):!1}function pz(g,S){return this.isSame(g,S)||this.isAfter(g,S)}function mz(g,S){return this.isSame(g,S)||this.isBefore(g,S)}function dz(g,S,I){var $,H,oe;if(!this.isValid())return NaN;if($=Tx(g,this),!$.isValid())return NaN;switch(H=($.utcOffset()-this.utcOffset())*6e4,S=Ee(S),S){case"year":oe=ed(this,$)/12;break;case"month":oe=ed(this,$);break;case"quarter":oe=ed(this,$)/3;break;case"second":oe=(this-$)/1e3;break;case"minute":oe=(this-$)/6e4;break;case"hour":oe=(this-$)/36e5;break;case"day":oe=(this-$-H)/864e5;break;case"week":oe=(this-$-H)/6048e5;break;default:oe=this-$}return I?oe:jn(oe)}function ed(g,S){if(g.date()<S.date())return-ed(S,g);var I=(S.year()-g.year())*12+(S.month()-g.month()),$=g.clone().add(I,"months"),H,oe;return S-$<0?(H=g.clone().add(I-1,"months"),oe=(S-$)/($-H)):(H=g.clone().add(I+1,"months"),oe=(S-$)/(H-$)),-(I+oe)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function hz(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function gz(g){if(!this.isValid())return null;var S=g!==!0,I=S?this.clone().utc():this;return I.year()<0||I.year()>9999?se(I,S?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):C(Date.prototype.toISOString)?S?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",se(I,"Z")):se(I,S?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function vz(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var g="moment",S="",I,$,H,oe;return this.isLocal()||(g=this.utcOffset()===0?"moment.utc":"moment.parseZone",S="Z"),I="["+g+'("]',$=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",H="-MM-DD[T]HH:mm:ss.SSS",oe=S+'[")]',this.format(I+$+H+oe)}function yz(g){g||(g=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var S=se(this,g);return this.localeData().postformat(S)}function xz(g,S){return this.isValid()&&(y(g)&&g.isValid()||cn(g).isValid())?Mo({to:this,from:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function bz(g){return this.from(cn(),g)}function wz(g,S){return this.isValid()&&(y(g)&&g.isValid()||cn(g).isValid())?Mo({from:this,to:g}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function _z(g){return this.to(cn(),g)}function SC(g){var S;return g===void 0?this._locale._abbr:(S=As(g),S!=null&&(this._locale=S),this)}var EC=D("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 TC(){return this._locale}var td=1e3,mc=60*td,rd=60*mc,DC=(365*400+97)*24*rd;function dc(g,S){return(g%S+S)%S}function MC(g,S,I){return g<100&&g>=0?new Date(g+400,S,I)-DC:new Date(g,S,I).valueOf()}function CC(g,S,I){return g<100&&g>=0?Date.UTC(g+400,S,I)-DC:Date.UTC(g,S,I)}function Az(g){var S,I;if(g=Ee(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?CC:MC,g){case"year":S=I(this.year(),0,1);break;case"quarter":S=I(this.year(),this.month()-this.month()%3,1);break;case"month":S=I(this.year(),this.month(),1);break;case"week":S=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":S=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":S=I(this.year(),this.month(),this.date());break;case"hour":S=this._d.valueOf(),S-=dc(S+(this._isUTC?0:this.utcOffset()*mc),rd);break;case"minute":S=this._d.valueOf(),S-=dc(S,mc);break;case"second":S=this._d.valueOf(),S-=dc(S,td);break}return this._d.setTime(S),e.updateOffset(this,!0),this}function Sz(g){var S,I;if(g=Ee(g),g===void 0||g==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?CC:MC,g){case"year":S=I(this.year()+1,0,1)-1;break;case"quarter":S=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":S=I(this.year(),this.month()+1,1)-1;break;case"week":S=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":S=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":S=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":S=this._d.valueOf(),S+=rd-dc(S+(this._isUTC?0:this.utcOffset()*mc),rd)-1;break;case"minute":S=this._d.valueOf(),S+=mc-dc(S,mc)-1;break;case"second":S=this._d.valueOf(),S+=td-dc(S,td)-1;break}return this._d.setTime(S),e.updateOffset(this,!0),this}function Ez(){return this._d.valueOf()-(this._offset||0)*6e4}function Tz(){return Math.floor(this.valueOf()/1e3)}function Dz(){return new Date(this.valueOf())}function Mz(){var g=this;return[g.year(),g.month(),g.date(),g.hour(),g.minute(),g.second(),g.millisecond()]}function Cz(){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 Nz(){return this.isValid()?this.toISOString():null}function Fz(){return x(this)}function Iz(){return f({},d(this))}function Pz(){return d(this).overflow}function Bz(){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"),qe("N",Mx),qe("NN",Mx),qe("NNN",Mx),qe("NNNN",Gz),qe("NNNNN",Wz),kr(["N","NN","NNN","NNNN","NNNNN"],function(g,S,I,$){var H=I._locale.erasParse(g,$,I._strict);H?d(I).era=H:d(I).invalidEra=g}),qe("y",Se),qe("yy",Se),qe("yyy",Se),qe("yyyy",Se),qe("yo",Yz),kr(["y","yy","yyy","yyyy"],Bn),kr(["yo"],function(g,S,I,$){var H;I._locale._eraYearOrdinalRegex&&(H=g.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?S[Bn]=I._locale.eraYearOrdinalParse(g,H):S[Bn]=parseInt(g,10)});function kz(g,S){var I,$,H,oe=this._eras||As("en")._eras;for(I=0,$=oe.length;I<$;++I){switch(typeof oe[I].since){case"string":H=e(oe[I].since).startOf("day"),oe[I].since=H.valueOf();break}switch(typeof oe[I].until){case"undefined":oe[I].until=1/0;break;case"string":H=e(oe[I].until).startOf("day").valueOf(),oe[I].until=H.valueOf();break}}return oe}function $z(g,S,I){var $,H,oe=this.eras(),Me,gt,tr;for(g=g.toUpperCase(),$=0,H=oe.length;$<H;++$)if(Me=oe[$].name.toUpperCase(),gt=oe[$].abbr.toUpperCase(),tr=oe[$].narrow.toUpperCase(),I)switch(S){case"N":case"NN":case"NNN":if(gt===g)return oe[$];break;case"NNNN":if(Me===g)return oe[$];break;case"NNNNN":if(tr===g)return oe[$];break}else if([Me,gt,tr].indexOf(g)>=0)return oe[$]}function Oz(g,S){var I=g.since<=g.until?1:-1;return S===void 0?e(g.since).year():e(g.since).year()+(S-g.offset)*I}function Rz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].name;return""}function Lz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].narrow;return""}function Vz(){var g,S,I,$=this.localeData().eras();for(g=0,S=$.length;g<S;++g)if(I=this.clone().startOf("day").valueOf(),$[g].since<=I&&I<=$[g].until||$[g].until<=I&&I<=$[g].since)return $[g].abbr;return""}function Uz(){var g,S,I,$,H=this.localeData().eras();for(g=0,S=H.length;g<S;++g)if(I=H[g].since<=H[g].until?1:-1,$=this.clone().startOf("day").valueOf(),H[g].since<=$&&$<=H[g].until||H[g].until<=$&&$<=H[g].since)return(this.year()-e(H[g].since).year())*I+H[g].offset;return this.year()}function qz(g){return a(this,"_erasNameRegex")||Cx.call(this),g?this._erasNameRegex:this._erasRegex}function zz(g){return a(this,"_erasAbbrRegex")||Cx.call(this),g?this._erasAbbrRegex:this._erasRegex}function Hz(g){return a(this,"_erasNarrowRegex")||Cx.call(this),g?this._erasNarrowRegex:this._erasRegex}function Mx(g,S){return S.erasAbbrRegex(g)}function Gz(g,S){return S.erasNameRegex(g)}function Wz(g,S){return S.erasNarrowRegex(g)}function Yz(g,S){return S._eraYearOrdinalRegex||Se}function Cx(){var g=[],S=[],I=[],$=[],H,oe,Me,gt,tr,Dr=this.eras();for(H=0,oe=Dr.length;H<oe;++H)Me=un(Dr[H].name),gt=un(Dr[H].abbr),tr=un(Dr[H].narrow),S.push(Me),g.push(gt),I.push(tr),$.push(Me),$.push(gt),$.push(tr);this._erasRegex=new RegExp("^("+$.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+S.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 nd(g,S){U(0,[g,g.length],0,S)}nd("gggg","weekYear"),nd("ggggg","weekYear"),nd("GGGG","isoWeekYear"),nd("GGGGG","isoWeekYear"),qe("G",Xe),qe("g",Xe),qe("GG",at,Ye),qe("gg",at,Ye),qe("GGGG",Fe,Jt),qe("gggg",Fe,Jt),qe("GGGGG",ke,He),qe("ggggg",ke,He),aa(["gggg","ggggg","GGGG","GGGGG"],function(g,S,I,$){S[$.substr(0,2)]=gr(g)}),aa(["gg","GG"],function(g,S,I,$){S[$]=e.parseTwoDigitYear(g)});function jz(g){return NC.call(this,g,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Zz(g){return NC.call(this,g,this.isoWeek(),this.isoWeekday(),1,4)}function Jz(){return _s(this.year(),1,4)}function Xz(){return _s(this.isoWeekYear(),1,4)}function Qz(){var g=this.localeData()._week;return _s(this.year(),g.dow,g.doy)}function Kz(){var g=this.localeData()._week;return _s(this.weekYear(),g.dow,g.doy)}function NC(g,S,I,$,H){var oe;return g==null?rp(this,$,H).year:(oe=_s(g,$,H),S>oe&&(S=oe),e7.call(this,g,S,I,$,H))}function e7(g,S,I,$,H){var oe=sC(g,S,I,$,H),Me=tp(oe.year,0,oe.dayOfYear);return this.year(Me.getUTCFullYear()),this.month(Me.getUTCMonth()),this.date(Me.getUTCDate()),this}U("Q",0,"Qo","quarter"),qe("Q",St),kr("Q",function(g,S){S[Zn]=(gr(g)-1)*3});function t7(g){return g==null?Math.ceil((this.month()+1)/3):this.month((g-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),qe("D",at,tt),qe("DD",at,Ye),qe("Do",function(g,S){return g?S._dayOfMonthOrdinalParse||S._ordinalParse:S._dayOfMonthOrdinalParseLenient}),kr(["D","DD"],oa),kr("Do",function(g,S){S[oa]=gr(g.match(at)[0])});var FC=Ko("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),qe("DDD",he),qe("DDDD",ur),kr(["DDD","DDDD"],function(g,S,I){I._dayOfYear=gr(g)});function r7(g){var S=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return g==null?S:this.add(g-S,"d")}U("m",["mm",2],0,"minute"),qe("m",at,xt),qe("mm",at,Ye),kr(["m","mm"],ii);var n7=Ko("Minutes",!1);U("s",["ss",2],0,"second"),qe("s",at,xt),qe("ss",at,Ye),kr(["s","ss"],kn);var i7=Ko("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}),qe("S",he,St),qe("SS",he,Ye),qe("SSS",he,ur);var fu,IC;for(fu="SSSS";fu.length<=9;fu+="S")qe(fu,Se);function a7(g,S){S[sa]=gr(("0."+g)*1e3)}for(fu="S";fu.length<=9;fu+="S")kr(fu,a7);IC=Ko("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function o7(){return this._isUTC?"UTC":""}function s7(){return this._isUTC?"Coordinated Universal Time":""}var je=w.prototype;je.add=Kq,je.calendar=oz,je.clone=sz,je.diff=dz,je.endOf=Sz,je.format=yz,je.from=xz,je.fromNow=bz,je.to=wz,je.toNow=_z,je.get=fc,je.invalidAt=Pz,je.isAfter=uz,je.isBefore=lz,je.isBetween=cz,je.isSame=fz,je.isSameOrAfter=pz,je.isSameOrBefore=mz,je.isValid=Fz,je.lang=EC,je.locale=SC,je.localeData=TC,je.max=Fq,je.min=Nq,je.parsingFlags=Iz,je.set=Kf,je.startOf=Az,je.subtract=ez,je.toArray=Mz,je.toObject=Cz,je.toDate=Dz,je.toISOString=gz,je.inspect=vz,typeof Symbol<"u"&&Symbol.for!=null&&(je[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),je.toJSON=Nz,je.toString=hz,je.unix=Tz,je.valueOf=Ez,je.creationData=Bz,je.eraName=Rz,je.eraNarrow=Lz,je.eraAbbr=Vz,je.eraYear=Uz,je.year=bs,je.isLeapYear=lc,je.weekYear=jz,je.isoWeekYear=Zz,je.quarter=je.quarters=t7,je.month=aC,je.daysInMonth=D9,je.week=je.weeks=k9,je.isoWeek=je.isoWeeks=$9,je.weeksInYear=Qz,je.weeksInWeekYear=Kz,je.isoWeeksInYear=Jz,je.isoWeeksInISOWeekYear=Xz,je.date=FC,je.day=je.days=Z9,je.weekday=J9,je.isoWeekday=X9,je.dayOfYear=r7,je.hour=je.hours=iq,je.minute=je.minutes=n7,je.second=je.seconds=i7,je.millisecond=je.milliseconds=IC,je.utcOffset=Vq,je.utc=qq,je.local=zq,je.parseZone=Hq,je.hasAlignedHourOffset=Gq,je.isDST=Wq,je.isLocal=jq,je.isUtcOffset=Zq,je.isUtc=xC,je.isUTC=xC,je.zoneAbbr=o7,je.zoneName=s7,je.dates=D("dates accessor is deprecated. Use date instead.",FC),je.months=D("months accessor is deprecated. Use month instead",aC),je.years=D("years accessor is deprecated. Use year instead",bs),je.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Uq),je.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Yq);function u7(g){return cn(g*1e3)}function l7(){return cn.apply(null,arguments).parseZone()}function PC(g){return g}var Or=V.prototype;Or.calendar=k,Or.longDateFormat=j,Or.invalidDate=pe,Or.ordinal=_e,Or.preparse=PC,Or.postformat=PC,Or.relativeTime=Z,Or.pastFuture=ge,Or.set=B,Or.eras=kz,Or.erasParse=$z,Or.erasConvertYear=Oz,Or.erasAbbrRegex=zz,Or.erasNameRegex=qz,Or.erasNarrowRegex=Hz,Or.months=$r,Or.monthsShort=Rn,Or.monthsParse=ws,Or.monthsRegex=C9,Or.monthsShortRegex=M9,Or.week=F9,Or.firstDayOfYear=B9,Or.firstDayOfWeek=P9,Or.weekdays=H9,Or.weekdaysMin=W9,Or.weekdaysShort=G9,Or.weekdaysParse=j9,Or.weekdaysRegex=Q9,Or.weekdaysShortRegex=K9,Or.weekdaysMinRegex=eq,Or.isPM=rq,Or.meridiem=aq;function id(g,S,I,$){var H=As(),oe=m().set($,S);return H[I](oe,g)}function BC(g,S,I){if(l(g)&&(S=g,g=void 0),g=g||"",S!=null)return id(g,S,I,"month");var $,H=[];for($=0;$<12;$++)H[$]=id(g,$,I,"month");return H}function Nx(g,S,I,$){typeof g=="boolean"?(l(S)&&(I=S,S=void 0),S=S||""):(S=g,I=S,g=!1,l(S)&&(I=S,S=void 0),S=S||"");var H=As(),oe=g?H._week.dow:0,Me,gt=[];if(I!=null)return id(S,(I+oe)%7,$,"day");for(Me=0;Me<7;Me++)gt[Me]=id(S,(Me+oe)%7,$,"day");return gt}function c7(g,S){return BC(g,S,"months")}function f7(g,S){return BC(g,S,"monthsShort")}function p7(g,S,I){return Nx(g,S,I,"weekdays")}function m7(g,S,I){return Nx(g,S,I,"weekdaysShort")}function d7(g,S,I){return Nx(g,S,I,"weekdaysMin")}cu("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 S=g%10,I=gr(g%100/10)===1?"th":S===1?"st":S===2?"nd":S===3?"rd":"th";return g+I}}),e.lang=D("moment.lang is deprecated. Use moment.locale instead.",cu),e.langData=D("moment.langData is deprecated. Use moment.localeData instead.",As);var Ss=Math.abs;function h7(){var g=this._data;return this._milliseconds=Ss(this._milliseconds),this._days=Ss(this._days),this._months=Ss(this._months),g.milliseconds=Ss(g.milliseconds),g.seconds=Ss(g.seconds),g.minutes=Ss(g.minutes),g.hours=Ss(g.hours),g.months=Ss(g.months),g.years=Ss(g.years),this}function kC(g,S,I,$){var H=Mo(S,I);return g._milliseconds+=$*H._milliseconds,g._days+=$*H._days,g._months+=$*H._months,g._bubble()}function g7(g,S){return kC(this,g,S,1)}function v7(g,S){return kC(this,g,S,-1)}function $C(g){return g<0?Math.floor(g):Math.ceil(g)}function y7(){var g=this._milliseconds,S=this._days,I=this._months,$=this._data,H,oe,Me,gt,tr;return g>=0&&S>=0&&I>=0||g<=0&&S<=0&&I<=0||(g+=$C(Fx(I)+S)*864e5,S=0,I=0),$.milliseconds=g%1e3,H=jn(g/1e3),$.seconds=H%60,oe=jn(H/60),$.minutes=oe%60,Me=jn(oe/60),$.hours=Me%24,S+=jn(Me/24),tr=jn(OC(S)),I+=tr,S-=$C(Fx(tr)),gt=jn(I/12),I%=12,$.days=S,$.months=I,$.years=gt,this}function OC(g){return g*4800/146097}function Fx(g){return g*146097/4800}function x7(g){if(!this.isValid())return NaN;var S,I,$=this._milliseconds;if(g=Ee(g),g==="month"||g==="quarter"||g==="year")switch(S=this._days+$/864e5,I=this._months+OC(S),g){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(S=this._days+Math.round(Fx(this._months)),g){case"week":return S/7+$/6048e5;case"day":return S+$/864e5;case"hour":return S*24+$/36e5;case"minute":return S*1440+$/6e4;case"second":return S*86400+$/1e3;case"millisecond":return Math.floor(S*864e5)+$;default:throw new Error("Unknown unit "+g)}}function Es(g){return function(){return this.as(g)}}var RC=Es("ms"),b7=Es("s"),w7=Es("m"),_7=Es("h"),A7=Es("d"),S7=Es("w"),E7=Es("M"),T7=Es("Q"),D7=Es("y"),M7=RC;function C7(){return Mo(this)}function N7(g){return g=Ee(g),this.isValid()?this[g+"s"]():NaN}function ol(g){return function(){return this.isValid()?this._data[g]:NaN}}var F7=ol("milliseconds"),I7=ol("seconds"),P7=ol("minutes"),B7=ol("hours"),k7=ol("days"),$7=ol("months"),O7=ol("years");function R7(){return jn(this.days()/7)}var Ts=Math.round,hc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function L7(g,S,I,$,H){return H.relativeTime(S||1,!!I,g,$)}function V7(g,S,I,$){var H=Mo(g).abs(),oe=Ts(H.as("s")),Me=Ts(H.as("m")),gt=Ts(H.as("h")),tr=Ts(H.as("d")),Dr=Ts(H.as("M")),Wi=Ts(H.as("w")),Ds=Ts(H.as("y")),pu=oe<=I.ss&&["s",oe]||oe<I.s&&["ss",oe]||Me<=1&&["m"]||Me<I.m&&["mm",Me]||gt<=1&&["h"]||gt<I.h&&["hh",gt]||tr<=1&&["d"]||tr<I.d&&["dd",tr];return I.w!=null&&(pu=pu||Wi<=1&&["w"]||Wi<I.w&&["ww",Wi]),pu=pu||Dr<=1&&["M"]||Dr<I.M&&["MM",Dr]||Ds<=1&&["y"]||["yy",Ds],pu[2]=S,pu[3]=+g>0,pu[4]=$,L7.apply(null,pu)}function U7(g){return g===void 0?Ts:typeof g=="function"?(Ts=g,!0):!1}function q7(g,S){return hc[g]===void 0?!1:S===void 0?hc[g]:(hc[g]=S,g==="s"&&(hc.ss=S-1),!0)}function z7(g,S){if(!this.isValid())return this.localeData().invalidDate();var I=!1,$=hc,H,oe;return typeof g=="object"&&(S=g,g=!1),typeof g=="boolean"&&(I=g),typeof S=="object"&&($=Object.assign({},hc,S),S.s!=null&&S.ss==null&&($.ss=S.s-1)),H=this.localeData(),oe=V7(this,!I,$,H),I&&(oe=H.pastFuture(+this,oe)),H.postformat(oe)}var Ix=Math.abs;function gc(g){return(g>0)-(g<0)||+g}function ad(){if(!this.isValid())return this.localeData().invalidDate();var g=Ix(this._milliseconds)/1e3,S=Ix(this._days),I=Ix(this._months),$,H,oe,Me,gt=this.asSeconds(),tr,Dr,Wi,Ds;return gt?($=jn(g/60),H=jn($/60),g%=60,$%=60,oe=jn(I/12),I%=12,Me=g?g.toFixed(3).replace(/\.?0+$/,""):"",tr=gt<0?"-":"",Dr=gc(this._months)!==gc(gt)?"-":"",Wi=gc(this._days)!==gc(gt)?"-":"",Ds=gc(this._milliseconds)!==gc(gt)?"-":"",tr+"P"+(oe?Dr+oe+"Y":"")+(I?Dr+I+"M":"")+(S?Wi+S+"D":"")+(H||$||g?"T":"")+(H?Ds+H+"H":"")+($?Ds+$+"M":"")+(g?Ds+Me+"S":"")):"P0D"}var Cr=Qm.prototype;Cr.isValid=$q,Cr.abs=h7,Cr.add=g7,Cr.subtract=v7,Cr.as=x7,Cr.asMilliseconds=RC,Cr.asSeconds=b7,Cr.asMinutes=w7,Cr.asHours=_7,Cr.asDays=A7,Cr.asWeeks=S7,Cr.asMonths=E7,Cr.asQuarters=T7,Cr.asYears=D7,Cr.valueOf=M7,Cr._bubble=y7,Cr.clone=C7,Cr.get=N7,Cr.milliseconds=F7,Cr.seconds=I7,Cr.minutes=P7,Cr.hours=B7,Cr.days=k7,Cr.weeks=R7,Cr.months=$7,Cr.years=O7,Cr.humanize=z7,Cr.toISOString=ad,Cr.toString=ad,Cr.toJSON=ad,Cr.locale=SC,Cr.localeData=TC,Cr.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ad),Cr.lang=EC,U("X",0,0,"unix"),U("x",0,0,"valueOf"),qe("x",Xe),qe("X",ie),kr("X",function(g,S,I){I._d=new Date(parseFloat(g)*1e3)}),kr("x",function(g,S,I){I._d=new Date(gr(g))});return e.version="2.30.1",r(cn),e.fn=je,e.min=Iq,e.max=Pq,e.now=Bq,e.utc=m,e.unix=u7,e.months=c7,e.isDate=u,e.locale=cu,e.invalid=b,e.duration=Mo,e.isMoment=y,e.weekdays=p7,e.parseZone=l7,e.localeData=As,e.isDuration=Km,e.monthsShort=f7,e.weekdaysMin=d7,e.defineLocale=xx,e.updateLocale=lq,e.locales=cq,e.weekdaysShort=m7,e.normalizeUnits=Ee,e.relativeTimeRounding=U7,e.relativeTimeThreshold=q7,e.calendarFormat=az,e.prototype=je,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 Nd=ai(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.P_HELPERS=la.ParserHelpers=la.validateRegexFlags=la.validateRange=la.getIndex=la.arrayUnion=void 0;var Zx=Fd();function cH(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;let r=[...t];for(let n of e)r.includes(n)||r.push(n);return r}la.arrayUnion=cH;function fH(t){return t===void 0?-1:t.index}la.getIndex=fH;function pH(t,e){if(e<t)throw new Error(`Invalid Range: max might not be smaller than min. Received [${t}, ${e}].`);if(t<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${t}, ${e}].`);if(t===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${t}, ${e}].`);if(!Number.isInteger(t)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${t}, ${e}].`)}la.validateRange=pH;function mH(t){for(let e of t)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'.`)}la.validateRegexFlags=mH;var Cd=class{followedBy(e){return new Zx.Parser(function(n){return e.p(n.copy())})}notFollowedBy(e){return new Zx.Parser(function(n){let i=n.copy(),a=e.p(i),o=n.sliceTo(i.position.index);return a.success?n.fail("not '"+o+"'"):n.succeed(void 0)})}test(e){return new Zx.Parser(function(n){let i=n.input[n.position.index];return!n.atEOF()&&e(i)?n.succeedOffset(1,i):n.fail(`a character matching ${e}`)})}};la.ParserHelpers=Cd;la.P_HELPERS=new Cd});var oF=ai(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.ParserContext=void 0;var Jx=Nd(),Xx=class t{constructor(e,r){this.input=e,this.position=r}moveToPosition(e){return this.position=e,this}copy(){return new t(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 r=this.position.index;r<e;r++)this.input[r]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,r){return this.succeedAt(this.position.index+e,r)}failOffset(e,r){return this.failAt(this.position.index+e,r)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,r){return this.advanceTo(e),{success:!0,value:r,furthest:void 0,expected:void 0}}failAt(e,r){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(r)?r:[r]}}merge(e,r){if(e===void 0)return r;let n=(0,Jx.getIndex)(e.furthest),i=(0,Jx.getIndex)(r.furthest);if(i>n)return r;let a=i===n?(0,Jx.arrayUnion)(e.expected,r.expected):e.expected;return r.furthest=e.furthest,r.expected=a,r}};Id.ParserContext=Xx});var Ma=ai(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.P_UTILS=void 0;var Pd=Fd(),en=ca(),Qx=class t{static position(){return new Pd.Parser(e=>e.succeed(e.getPosition()))}static any(){return new Pd.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new Pd.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new Pd.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return en.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return en.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return en.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return en.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return en.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return en.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return en.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return en.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return en.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return en.P.regexp(/^\s+/).describe("whitespace")}static cr(){return en.P.string("\r")}static lf(){return en.P.string(`
`)}static crlf(){return en.P.string(`\r
`)}static newline(){return en.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,r,n){return en.P.sequenceMap((i,a)=>i.reduce((o,s)=>n(s,o),a),e.many(),r)}static postfix(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>n(s,o),i),r,e.many())}static binaryRight(e,r,n){return en.P.sequenceMap((i,a)=>i.reverse().reduce((o,s)=>{let[l,u]=s;return n(l,u,o)},a),en.P.sequence(r,e.trim(this.optionalWhitespace())).many(),r)}static binaryLeft(e,r,n){return en.P.sequenceMap((i,a)=>a.reduce((o,s)=>{let[l,u]=s;return n(o,l,u)},i),r,en.P.sequence(e.trim(this.optionalWhitespace()),r).many())}static binaryRightRange(e,r,n){return en.P.sequenceMap((i,a,o)=>i.reverse().reduce((s,l)=>{let[u,c,f]=l;return n({from:u,to:o},c,f,s)},a),en.P.sequence(t.position(),r,e.trim(this.optionalWhitespace())).many(),r,t.position())}static binaryLeftRange(e,r,n){return en.P.sequenceMap((i,a,o)=>o.reduce((s,l)=>{let[u,c,f]=l;return n({from:i,to:f},s,u,c)},a),t.position(),r,en.P.sequence(e.trim(this.optionalWhitespace()),r,t.position()).many())}static func(e,r,n){let i=typeof e=="string"?en.P.string(e):e;return en.P.sequenceMap((a,o,s,l,u,c)=>n(a,l),i,en.P.string("("),this.optionalWhitespace(),r,this.optionalWhitespace(),en.P.string(")"))}};Bd.P_UTILS=Qx});var uF=ai(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.ParsingError=Ec.createParsingErrorMessage=void 0;function sF(t,e,r){let n=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${n} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(r){let o=t.split(`
`)[e.furthest.line-1],s=`${e.furthest.line} |   `;i+=`

${s}${o}`,i+=`
${" ".repeat(e.furthest.column-1+s.length)}^ (${n})`}return i}Ec.createParsingErrorMessage=sF;var Kx=class extends Error{constructor(e,r){super(sF(e,r,!0))}};Ec.ParsingError=Kx});var Fd=ai(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});kd.Parser=void 0;var dH=oF(),ro=ca(),eb=Nd(),Tc=Ma(),hH=uF(),tb=class t{constructor(e){this.p=e}tryParse(e){return this.p(new dH.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let r=this.tryParse(e);if(r.success)return r.value;throw new hH.ParsingError(e,r)}or(e){return ro.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(ro.P.string(e))}wrap(e,r){let n=this;return new t(function(a){let o=e.p(a);if(!o.success)return o;let s=a.merge(o,n.p(a));if(!s.success)return s;let l=a.merge(s,r.p(a));return l.success?a.merge(l,a.succeed(s.value)):l})}wrapString(e,r){return this.wrap(ro.P.string(e),ro.P.string(r))}then(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let r=this;return new t(function(i){let a=r.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 ro.P.sequence(this,e)}many(){let e=this;return new t(function(n){let i,a=n.position.index,o=[];for(;;){let s=n.copy(),l=e.p(s);if(i=n.merge(i,l),i.success){if(s.position.index===a)throw new Error("infinite loop in many() parser detected");n.moveToPosition(s.position),o.push(i.value)}else return n.merge(i,n.succeed(o))}})}repeat(e,r){(0,eb.validateRange)(e,r);let n=this;return new t(function(a){let o,s,l=[],u=0;for(;u<e;u++)if(o=n.p(a),s=a.merge(s,o),o.success)l.push(o.value);else return s;for(;u<r;u++){let c=a.copy();if(o=n.p(c),s=a.merge(s,o),o.success)a.moveToPosition(c.position),l.push(o.value);else break}return a.merge(s,a.succeed(l))})}atMost(e){return this.repeat(0,e)}atLeast(e){return ro.P.sequenceMap((r,n)=>r.concat(n),this.repeat(e,e),this.many())}separateBy(e){return ro.P.separateBy(this,e)}separateByNotEmpty(e){return ro.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let r=this;return new t(function(i){let a=r.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return ro.P.sequenceMap(function(r,n,i){return{value:n,range:{from:r,to:i}}},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}namedMarker(e){return ro.P.sequenceMap(function(n,i,a){return{value:i,name:e,range:{from:n,to:a}}},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}node(e){return ro.P.sequenceMap(function(n,i,a){return e(i,{from:n,to:a})},Tc.P_UTILS.position(),this,Tc.P_UTILS.position())}followedBy(e){return this.skip(eb.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip(eb.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let r=this;return new t(function(i){let a=r.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let r=this;return new t(function(i){var a;let o=r.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(ro.P.succeed(e))}chain(e){let r=this;return new t(function(i){let a=r.p(i);if(!a.success)return a;let s=e(a.value).p(i);return i.merge(a,s)})}thenEof(){let e=this;return new t(function(n){let i=e.p(n);return i.success?n.atEOF()?i:n.merge(i,n.fail("eof")):i})}memorize(){let e=this,r="",n=new Map,i=new Map;return new t(function(o){let s=o.position.index;if(o.input!==r)r=o.input,n.clear(),i.clear();else{let u=n.get(s),c=i.get(s);if(u!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},u)}let l=e.p(o);return n.set(s,Object.assign({},l)),i.set(s,o.getPosition()),l})}};kd.Parser=tb});var ca=ai(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.P=void 0;var Ca=Fd(),$d=Nd(),rb=class t{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Ca.Parser(function(n){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let l=e[o].p(n);if(i=n.merge(i,l),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...r){if(r.length===0)throw new Error("sequenceMap must have at least one parser argument");return new Ca.Parser(function(i){let a,o=new Array(r.length);for(let s=0;s<r.length;s++){let u=r[s].p(i);if(a=i.merge(a,u),!a.success)return a;o[s]=a.value}return a.value=e(...o),a})}static createLanguage(e){let r={},n={},i={};for(let a in e)i[a]=t.reference(()=>e[a](r,i)),Object.defineProperty(n,a,{get:()=>{if(r[a]!==void 0)return r[a];throw new Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let a in e)r[a]=e[a](n,i);return r}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Ca.Parser(function(n){let i;for(let a of e){let o=a,s=n.copy(),l=o.p(s);if(i=n.merge(i,l),i.success)return n.moveToPosition(s.position),i}return i})}static separateBy(e,r){return this.separateByNotEmpty(e,r).or(t.succeed([]))}static separateByNotEmpty(e,r){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,r.then(e).many())}static string(e){let r="'"+e+"'";return new Ca.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(r);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,r){(0,$d.validateRegexFlags)(e.flags);let n=e.source;return r!==void 0?new Ca.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=r??0;if(l>=0&&l<=s.length){let c=s[0],f=s[l];return a.succeedOffset(c.length,f)}let u="expected valid match group (0 to "+s.length+") in "+n;return a.fail(u)}else return a.fail(n)}):new Ca.Parser(function(a){let o=a.input.slice(a.position.index),s=e.exec(o);if(s!==null){let l=s[0];return a.succeedOffset(l.length,l)}else return a.fail(n)})}static succeed(e){return new Ca.Parser(function(n){return n.succeed(e)})}static fail(e){return new Ca.Parser(function(n){return n.fail(e)})}static oneOf(e){return $d.P_HELPERS.test(function(n){return e.includes(n)}).describe(`one character of '${e}'`)}static noneOf(e){return $d.P_HELPERS.test(function(n){return!e.includes(n)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(r=>this.string(r))).describe(e.map(r=>`'${r}'`).join(" or "))}static manyOf(e){return new Ca.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static manyNotOf(e){return new Ca.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&!e.includes(n.input[i]);i++);return n.succeedAt(i,n.sliceTo(i))})}static custom(e){return new Ca.Parser(e)}static range(e,r){let n=e.charCodeAt(0),i=r.charCodeAt(0);return $d.P_HELPERS.test(function(o){let s=o.charCodeAt(0);return n<=s&&s<=i}).describe(`${e}-${r}`)}static takeWhile(e){return new Ca.Parser(function(n){let i=n.position.index;for(;i<n.input.length&&e(n.input[i]);)i++;return n.succeedAt(i,n.input.slice(n.position.index,i))})}static reference(e){return new Ca.Parser(function(n){return e().p(n)})}};Od.P=rb});var k0=ai((P0,B0)=>{(function(t,e){typeof P0=="object"&&typeof B0<"u"?B0.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t["'typed'"]=e())})(P0,function(){"use strict";function t(){return!0}function e(){return!1}function r(){}let n="Argument is not a typed-function.";function i(){function o(Q){return typeof Q=="object"&&Q!==null&&Q.constructor===Object}let s=[{name:"number",test:function(Q){return typeof Q=="number"}},{name:"string",test:function(Q){return typeof Q=="string"}},{name:"boolean",test:function(Q){return typeof Q=="boolean"}},{name:"Function",test:function(Q){return typeof Q=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(Q){return Q instanceof Date}},{name:"RegExp",test:function(Q){return Q instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(Q){return Q===null}},{name:"undefined",test:function(Q){return Q===void 0}}],l={name:"any",test:t,isAny:!0},u,c,f=0,m={createCount:0};function p(Q){let me=u.get(Q);if(me)return me;let he='Unknown type "'+Q+'"',Fe=Q.toLowerCase(),ke;for(ke of c)if(ke.toLowerCase()===Fe){he+='. Did you mean "'+ke+'" ?';break}throw new TypeError(he)}function d(Q){let me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",he=me?p(me).index:c.length,Fe=[];for(let Se=0;Se<Q.length;++Se){if(!Q[Se]||typeof Q[Se].name!="string"||typeof Q[Se].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let Xe=Q[Se].name;if(u.has(Xe))throw new TypeError('Duplicate type name "'+Xe+'"');Fe.push(Xe),u.set(Xe,{name:Xe,test:Q[Se].test,isAny:Q[Se].isAny,index:he+Se,conversionsTo:[]})}let ke=c.slice(he);c=c.slice(0,he).concat(Fe).concat(ke);for(let Se=he+Fe.length;Se<c.length;++Se)u.get(c[Se]).index=Se}function h(){u=new Map,c=[],f=0,d([l],!1)}h(),d(s);function x(){let Q;for(Q of c)u.get(Q).conversionsTo=[];f=0}function b(Q){let me=c.filter(he=>{let Fe=u.get(he);return!Fe.isAny&&Fe.test(Q)});return me.length?me:["any"]}function T(Q){return Q&&typeof Q=="function"&&"_typedFunctionData"in Q}function v(Q,me,he){if(!T(Q))throw new TypeError(n);let Fe=he&&he.exact,ke=Array.isArray(me)?me.join(","):me,Se=N(ke),Xe=y(Se);if(!Fe||Xe in Q.signatures){let Ce=Q._typedFunctionData.signatureMap.get(Xe);if(Ce)return Ce}let F=Se.length,Y;if(Fe){Y=[];let Ce;for(Ce in Q.signatures)Y.push(Q._typedFunctionData.signatureMap.get(Ce))}else Y=Q._typedFunctionData.signatures;for(let Ce=0;Ce<F;++Ce){let tt=Se[Ce],xt=[],_r;for(_r of Y){let qe=V(_r.params,Ce);if(!(!qe||tt.restParam&&!qe.restParam)){if(!qe.hasAny){let Ti=_(qe);if(tt.types.some(Gi=>!Ti.has(Gi.name)))continue}xt.push(_r)}}if(Y=xt,Y.length===0)break}let ie;for(ie of Y)if(ie.params.length<=F)return ie;throw new TypeError("Signature not found (signature: "+(Q.name||"unnamed")+"("+y(Se,", ")+"))")}function A(Q,me,he){return v(Q,me,he).implementation}function w(Q,me){let he=p(me);if(he.test(Q))return Q;let Fe=he.conversionsTo;if(Fe.length===0)throw new Error("There are no conversions to "+me+" defined.");for(let ke=0;ke<Fe.length;ke++)if(p(Fe[ke].from).test(Q))return Fe[ke].convert(Q);throw new Error("Cannot convert "+Q+" to "+me)}function y(Q){let me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return Q.map(he=>he.name).join(me)}function E(Q){let me=Q.indexOf("...")===0,Fe=(me?Q.length>3?Q.slice(3):"any":Q).split("|").map(F=>p(F.trim())),ke=!1,Se=me?"...":"";return{types:Fe.map(function(F){return ke=F.isAny||ke,Se+=F.name+"|",{name:F.name,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:null,conversionIndex:-1}}),name:Se.slice(0,-1),hasAny:ke,hasConversion:!1,restParam:me}}function D(Q){let me=Q.types.map(Xe=>Xe.name),he=U(me),Fe=Q.hasAny,ke=Q.name,Se=he.map(function(Xe){let F=p(Xe.from);return Fe=F.isAny||Fe,ke+="|"+Xe.from,{name:Xe.from,typeIndex:F.index,test:F.test,isAny:F.isAny,conversion:Xe,conversionIndex:Xe.index}});return{types:Q.types.concat(Se),name:ke,hasAny:Fe,hasConversion:Se.length>0,restParam:Q.restParam}}function _(Q){return Q.typeSet||(Q.typeSet=new Set,Q.types.forEach(me=>Q.typeSet.add(me.name))),Q.typeSet}function N(Q){let me=[];if(typeof Q!="string")throw new TypeError("Signatures must be strings");let he=Q.trim();if(he==="")return me;let Fe=he.split(",");for(let ke=0;ke<Fe.length;++ke){let Se=E(Fe[ke].trim());if(Se.restParam&&ke!==Fe.length-1)throw new SyntaxError('Unexpected rest parameter "'+Fe[ke]+'": only allowed for the last parameter');if(Se.types.length===0)return null;me.push(Se)}return me}function C(Q){let me=G(Q);return me?me.restParam:!1}function B(Q){if(!Q||Q.types.length===0)return t;if(Q.types.length===1)return p(Q.types[0].name).test;if(Q.types.length===2){let me=p(Q.types[0].name).test,he=p(Q.types[1].name).test;return function(ke){return me(ke)||he(ke)}}else{let me=Q.types.map(function(he){return p(he.name).test});return function(Fe){for(let ke=0;ke<me.length;ke++)if(me[ke](Fe))return!0;return!1}}}function R(Q){let me,he,Fe;if(C(Q)){me=_e(Q).map(B);let ke=me.length,Se=B(G(Q)),Xe=function(F){for(let Y=ke;Y<F.length;Y++)if(!Se(F[Y]))return!1;return!0};return function(Y){for(let ie=0;ie<me.length;ie++)if(!me[ie](Y[ie]))return!1;return Xe(Y)&&Y.length>=ke+1}}else return Q.length===0?function(Se){return Se.length===0}:Q.length===1?(he=B(Q[0]),function(Se){return he(Se[0])&&Se.length===1}):Q.length===2?(he=B(Q[0]),Fe=B(Q[1]),function(Se){return he(Se[0])&&Fe(Se[1])&&Se.length===2}):(me=Q.map(B),function(Se){for(let Xe=0;Xe<me.length;Xe++)if(!me[Xe](Se[Xe]))return!1;return Se.length===me.length})}function V(Q,me){return me<Q.length?Q[me]:C(Q)?G(Q):null}function L(Q,me){let he=V(Q,me);return he?_(he):new Set}function P(Q){return Q.conversion===null||Q.conversion===void 0}function k(Q,me){let he=new Set;return Q.forEach(Fe=>{let ke=L(Fe.params,me),Se;for(Se of ke)he.add(Se)}),he.has("any")?["any"]:Array.from(he)}function W(Q,me,he){let Fe,ke,Se=Q||"unnamed",Xe=he,F;for(F=0;F<me.length;F++){let tt=[];if(Xe.forEach(xt=>{let _r=V(xt.params,F),qe=B(_r);(F<xt.params.length||C(xt.params))&&qe(me[F])&&tt.push(xt)}),tt.length===0){if(ke=k(Xe,F),ke.length>0){let xt=b(me[F]);return Fe=new TypeError("Unexpected type of argument in function "+Se+" (expected: "+ke.join(" or ")+", actual: "+xt.join(" | ")+", index: "+F+")"),Fe.data={category:"wrongType",fn:Se,index:F,actual:xt,expected:ke},Fe}}else Xe=tt}let Y=Xe.map(function(tt){return C(tt.params)?1/0:tt.params.length});if(me.length<Math.min.apply(null,Y))return ke=k(Xe,F),Fe=new TypeError("Too few arguments in function "+Se+" (expected: "+ke.join(" or ")+", index: "+me.length+")"),Fe.data={category:"tooFewArgs",fn:Se,index:me.length,expected:ke},Fe;let ie=Math.max.apply(null,Y);if(me.length>ie)return Fe=new TypeError("Too many arguments in function "+Se+" (expected: "+ie+", actual: "+me.length+")"),Fe.data={category:"tooManyArgs",fn:Se,index:me.length,expectedLength:ie},Fe;let Ce=[];for(let tt=0;tt<me.length;++tt)Ce.push(b(me[tt]).join("|"));return Fe=new TypeError('Arguments of type "'+Ce.join(", ")+'" do not match any of the defined signatures of function '+Se+"."),Fe.data={category:"mismatch",actual:Ce},Fe}function O(Q){let me=c.length+1;for(let he=0;he<Q.types.length;he++)P(Q.types[he])&&(me=Math.min(me,Q.types[he].typeIndex));return me}function X(Q){let me=f+1;for(let he=0;he<Q.types.length;he++)P(Q.types[he])||(me=Math.min(me,Q.types[he].conversionIndex));return me}function ae(Q,me){if(Q.hasAny){if(!me.hasAny)return 1}else if(me.hasAny)return-1;if(Q.restParam){if(!me.restParam)return 1}else if(me.restParam)return-1;if(Q.hasConversion){if(!me.hasConversion)return 1}else if(me.hasConversion)return-1;let he=O(Q)-O(me);if(he<0)return-1;if(he>0)return 1;let Fe=X(Q)-X(me);return Fe<0?-1:Fe>0?1:0}function J(Q,me){let he=Q.params,Fe=me.params,ke=G(he),Se=G(Fe),Xe=C(he),F=C(Fe);if(Xe&&ke.hasAny){if(!F||!Se.hasAny)return 1}else if(F&&Se.hasAny)return-1;let Y=0,ie=0,Ce;for(Ce of he)Ce.hasAny&&++Y,Ce.hasConversion&&++ie;let tt=0,xt=0;for(Ce of Fe)Ce.hasAny&&++tt,Ce.hasConversion&&++xt;if(Y!==tt)return Y-tt;if(Xe&&ke.hasConversion){if(!F||!Se.hasConversion)return 1}else if(F&&Se.hasConversion)return-1;if(ie!==xt)return ie-xt;if(Xe){if(!F)return 1}else if(F)return-1;let _r=(he.length-Fe.length)*(Xe?-1:1);if(_r!==0)return _r;let qe=[],Ti=0;for(let un=0;un<he.length;++un){let jn=ae(he[un],Fe[un]);qe.push(jn),Ti+=jn}if(Ti!==0)return Ti;let Gi;for(Gi of qe)if(Gi!==0)return Gi;return 0}function U(Q){if(Q.length===0)return[];let me=Q.map(p);Q.length>1&&me.sort((ke,Se)=>ke.index-Se.index);let he=me[0].conversionsTo;if(Q.length===1)return he;he=he.concat([]);let Fe=new Set(Q);for(let ke=1;ke<me.length;++ke){let Se;for(Se of me[ke].conversionsTo)Fe.has(Se.from)||(he.push(Se),Fe.add(Se.from))}return he}function de(Q,me){let he=me;if(Q.some(ke=>ke.hasConversion)){let ke=C(Q),Se=Q.map(we);he=function(){let F=[],Y=ke?arguments.length-1:arguments.length;for(let ie=0;ie<Y;ie++)F[ie]=Se[ie](arguments[ie]);return ke&&(F[Y]=arguments[Y].map(Se[Y])),me.apply(this,F)}}let Fe=he;if(C(Q)){let ke=Q.length-1;Fe=function(){return he.apply(this,Z(arguments,0,ke).concat([Z(arguments,ke)]))}}return Fe}function we(Q){let me,he,Fe,ke,Se=[],Xe=[];switch(Q.types.forEach(function(F){F.conversion&&(Se.push(p(F.conversion.from).test),Xe.push(F.conversion.convert))}),Xe.length){case 0:return function(Y){return Y};case 1:return me=Se[0],Fe=Xe[0],function(Y){return me(Y)?Fe(Y):Y};case 2:return me=Se[0],he=Se[1],Fe=Xe[0],ke=Xe[1],function(Y){return me(Y)?Fe(Y):he(Y)?ke(Y):Y};default:return function(Y){for(let ie=0;ie<Xe.length;ie++)if(Se[ie](Y))return Xe[ie](Y);return Y}}}function se(Q){function me(he,Fe,ke){if(Fe<he.length){let Se=he[Fe],Xe=[];if(Se.restParam){let F=Se.types.filter(P);F.length<Se.types.length&&Xe.push({types:F,name:"..."+F.map(Y=>Y.name).join("|"),hasAny:F.some(Y=>Y.isAny),hasConversion:!1,restParam:!0}),Xe.push(Se)}else Xe=Se.types.map(function(F){return{types:[F],name:F.name,hasAny:F.isAny,hasConversion:F.conversion,restParam:!1}});return xe(Xe,function(F){return me(he,Fe+1,ke.concat([F]))})}else return[ke]}return me(Q,0,[])}function be(Q,me){let he=Math.max(Q.length,me.length);for(let F=0;F<he;F++){let Y=L(Q,F),ie=L(me,F),Ce=!1,tt;for(tt of ie)if(Y.has(tt)){Ce=!0;break}if(!Ce)return!1}let Fe=Q.length,ke=me.length,Se=C(Q),Xe=C(me);return Se?Xe?Fe===ke:ke>=Fe:Xe?Fe>=ke:Fe===ke}function K(Q){return Q.map(me=>St(me)?Ve(me.referToSelf.callback):et(me)?Be(me.referTo.references,me.referTo.callback):me)}function j(Q,me,he){let Fe=[],ke;for(ke of Q){let Se=he[ke];if(typeof Se!="number")throw new TypeError('No definition for referenced signature "'+ke+'"');if(Se=me[Se],typeof Se!="function")return!1;Fe.push(Se)}return Fe}function ne(Q,me,he){let Fe=K(Q),ke=new Array(Fe.length).fill(!1),Se=!0;for(;Se;){Se=!1;let Xe=!0;for(let F=0;F<Fe.length;++F){if(ke[F])continue;let Y=Fe[F];if(St(Y))Fe[F]=Y.referToSelf.callback(he),Fe[F].referToSelf=Y.referToSelf,ke[F]=!0,Xe=!1;else if(et(Y)){let ie=j(Y.referTo.references,Fe,me);ie?(Fe[F]=Y.referTo.callback.apply(this,ie),Fe[F].referTo=Y.referTo,ke[F]=!0,Xe=!1):Se=!0}}if(Xe&&Se)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return Fe}function pe(Q){let me=/\bthis(\(|\.signatures\b)/;Object.keys(Q).forEach(he=>{let Fe=Q[he];if(me.test(Fe.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 fe(Q,me){if(m.createCount++,Object.keys(me).length===0)throw new SyntaxError("No signatures provided");m.warnAgainstDeprecatedThis&&pe(me);let he=[],Fe=[],ke={},Se=[],Xe;for(Xe in me){if(!Object.prototype.hasOwnProperty.call(me,Xe))continue;let Ge=N(Xe);if(!Ge)continue;he.forEach(function(Ln){if(be(Ln,Ge))throw new TypeError('Conflicting signatures "'+y(Ln)+'" and "'+y(Ge)+'".')}),he.push(Ge);let zt=Fe.length;Fe.push(me[Xe]);let $r=Ge.map(D),Rn;for(Rn of se($r)){let Ln=y(Rn);Se.push({params:Rn,name:Ln,fn:zt}),Rn.every(ws=>!ws.hasConversion)&&(ke[Ln]=zt)}}Se.sort(J);let F=ne(Fe,ke,Ke),Y;for(Y in ke)Object.prototype.hasOwnProperty.call(ke,Y)&&(ke[Y]=F[ke[Y]]);let ie=[],Ce=new Map;for(Y of Se)Ce.has(Y.name)||(Y.fn=F[Y.fn],ie.push(Y),Ce.set(Y.name,Y));let tt=ie[0]&&ie[0].params.length<=2&&!C(ie[0].params),xt=ie[1]&&ie[1].params.length<=2&&!C(ie[1].params),_r=ie[2]&&ie[2].params.length<=2&&!C(ie[2].params),qe=ie[3]&&ie[3].params.length<=2&&!C(ie[3].params),Ti=ie[4]&&ie[4].params.length<=2&&!C(ie[4].params),Gi=ie[5]&&ie[5].params.length<=2&&!C(ie[5].params),un=tt&&xt&&_r&&qe&&Ti&&Gi;for(let Ge=0;Ge<ie.length;++Ge)ie[Ge].test=R(ie[Ge].params);let jn=tt?B(ie[0].params[0]):e,gr=xt?B(ie[1].params[0]):e,lu=_r?B(ie[2].params[0]):e,kr=qe?B(ie[3].params[0]):e,aa=Ti?B(ie[4].params[0]):e,Ka=Gi?B(ie[5].params[0]):e,Da=tt?B(ie[0].params[1]):e,Bn=xt?B(ie[1].params[1]):e,Zn=_r?B(ie[2].params[1]):e,oa=qe?B(ie[3].params[1]):e,hn=Ti?B(ie[4].params[1]):e,ii=Gi?B(ie[5].params[1]):e;for(let Ge=0;Ge<ie.length;++Ge)ie[Ge].implementation=de(ie[Ge].params,ie[Ge].fn);let kn=tt?ie[0].implementation:r,sa=xt?ie[1].implementation:r,Qf=_r?ie[2].implementation:r,uc=qe?ie[3].implementation:r,xs=Ti?ie[4].implementation:r,bs=Gi?ie[5].implementation:r,lc=tt?ie[0].params.length:-1,Ko=xt?ie[1].params.length:-1,Do=_r?ie[2].params.length:-1,cc=qe?ie[3].params.length:-1,fc=Ti?ie[4].params.length:-1,Kf=Gi?ie[5].params.length:-1,ep=un?6:0,ln=ie.length,q=ie.map(Ge=>Ge.test),re=ie.map(Ge=>Ge.implementation),Ne=function(){for(let zt=ep;zt<ln;zt++)if(q[zt](arguments))return re[zt].apply(this,arguments);return m.onMismatch(Q,arguments,ie)};function Ke(Ge,zt){return arguments.length===lc&&jn(Ge)&&Da(zt)?kn.apply(this,arguments):arguments.length===Ko&&gr(Ge)&&Bn(zt)?sa.apply(this,arguments):arguments.length===Do&&lu(Ge)&&Zn(zt)?Qf.apply(this,arguments):arguments.length===cc&&kr(Ge)&&oa(zt)?uc.apply(this,arguments):arguments.length===fc&&aa(Ge)&&hn(zt)?xs.apply(this,arguments):arguments.length===Kf&&Ka(Ge)&&ii(zt)?bs.apply(this,arguments):Ne.apply(this,arguments)}try{Object.defineProperty(Ke,"name",{value:Q})}catch{}return Ke.signatures=ke,Ke._typedFunctionData={signatures:ie,signatureMap:Ce},Ke}function Ae(Q,me,he){throw W(Q,me,he)}function _e(Q){return Z(Q,0,Q.length-1)}function G(Q){return Q[Q.length-1]}function Z(Q,me,he){return Array.prototype.slice.call(Q,me,he)}function ge(Q,me){for(let he=0;he<Q.length;he++)if(me(Q[he]))return Q[he]}function xe(Q,me){return Array.prototype.concat.apply([],Q.map(me))}function Ee(){let Q=_e(arguments).map(he=>y(N(he))),me=G(arguments);if(typeof me!="function")throw new TypeError("Callback function expected as last argument");return Be(Q,me)}function Be(Q,me){return{referTo:{references:Q,callback:me}}}function Ve(Q){if(typeof Q!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:Q}}}function et(Q){return Q&&typeof Q.referTo=="object"&&Array.isArray(Q.referTo.references)&&typeof Q.referTo.callback=="function"}function St(Q){return Q&&typeof Q.referToSelf=="object"&&typeof Q.referToSelf.callback=="function"}function Ye(Q,me){if(!Q)return me;if(me&&me!==Q){let he=new Error("Function names do not match (expected: "+Q+", actual: "+me+")");throw he.data={actual:me,expected:Q},he}return Q}function ur(Q){let me;for(let he in Q)Object.prototype.hasOwnProperty.call(Q,he)&&(T(Q[he])||typeof Q[he].signature=="string")&&(me=Ye(me,Q[he].name));return me}function Jt(Q,me){let he;for(he in me)if(Object.prototype.hasOwnProperty.call(me,he)){if(he in Q&&me[he]!==Q[he]){let Fe=new Error('Signature "'+he+'" is defined twice');throw Fe.data={signature:he,sourceFunction:me[he],destFunction:Q[he]},Fe}Q[he]=me[he]}}let He=m;m=function(Q){let me=typeof Q=="string",he=me?1:0,Fe=me?Q:"",ke={};for(let Se=he;Se<arguments.length;++Se){let Xe=arguments[Se],F={},Y;if(typeof Xe=="function"?(Y=Xe.name,typeof Xe.signature=="string"?F[Xe.signature]=Xe:T(Xe)&&(F=Xe.signatures)):o(Xe)&&(F=Xe,me||(Y=ur(Xe))),Object.keys(F).length===0){let ie=new TypeError("Argument to 'typed' at index "+Se+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw ie.data={index:Se,argument:Xe},ie}me||(Fe=Ye(Fe,Y)),Jt(ke,F)}return fe(Fe||"",ke)},m.create=i,m.createCount=He.createCount,m.onMismatch=Ae,m.throwMismatchError=Ae,m.createError=W,m.clear=h,m.clearConversions=x,m.addTypes=d,m._findType=p,m.referTo=Ee,m.referToSelf=Ve,m.convert=w,m.findSignature=v,m.find=A,m.isTypedFunction=T,m.warnAgainstDeprecatedThis=!0,m.addType=function(Q,me){let he="any";me!==!1&&u.has("Object")&&(he="Object"),m.addTypes([Q],he)};function at(Q){if(!Q||typeof Q.from!="string"||typeof Q.to!="string"||typeof Q.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(Q.to===Q.from)throw new SyntaxError('Illegal to define conversion from "'+Q.from+'" to itself.')}return m.addConversion=function(Q){let me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};at(Q);let he=p(Q.to),Fe=he.conversionsTo.find(ke=>ke.from===Q.from);if(Fe)if(me&&me.override)m.removeConversion({from:Fe.from,to:Q.to,convert:Fe.convert});else throw new Error('There is already a conversion from "'+Q.from+'" to "'+he.name+'"');he.conversionsTo.push({from:Q.from,convert:Q.convert,index:f++})},m.addConversions=function(Q,me){Q.forEach(he=>m.addConversion(he,me))},m.removeConversion=function(Q){at(Q);let me=p(Q.to),he=ge(me.conversionsTo,ke=>ke.from===Q.from);if(!he)throw new Error("Attempt to remove nonexistent conversion from "+Q.from+" to "+Q.to);if(he.convert!==Q.convert)throw new Error("Conversion to remove does not match existing conversion");let Fe=me.conversionsTo.indexOf(he);me.conversionsTo.splice(Fe,1)},m.resolve=function(Q,me){if(!T(Q))throw new TypeError(n);let he=Q._typedFunctionData.signatures;for(let Fe=0;Fe<he.length;++Fe)if(he[Fe].test(me))return he[Fe];return null},m}var a=i();return a})});var i$=ai((MLe,n$)=>{n$.exports=function t(e,r){"use strict";var n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,s=/^0/,l=function(v){return t.insensitive&&(""+v).toLowerCase()||""+v},u=l(e).replace(i,"")||"",c=l(r).replace(i,"")||"",f=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=c.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(u.match(o),16)||f.length!==1&&u.match(a)&&Date.parse(u),d=parseInt(c.match(o),16)||p&&c.match(a)&&Date.parse(c)||null,h,x;if(d){if(p<d)return-1;if(p>d)return 1}for(var b=0,T=Math.max(f.length,m.length);b<T;b++){if(h=!(f[b]||"").match(s)&&parseFloat(f[b])||f[b]||0,x=!(m[b]||"").match(s)&&parseFloat(m[b])||m[b]||0,isNaN(h)!==isNaN(x))return isNaN(h)?1:-1;if(typeof h!=typeof x&&(h+="",x+=""),h<x)return-1;if(h>x)return 1}return 0}});var uO=ai((J5e,sO)=>{"use strict";var wS=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},sre={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},ure={"\u2013":"\\--","\u2014":"\\---"," ":"~","	":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},lre=function(e,r){return wS({},e,r)};sO.exports=function(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.preserveFormatting,n=r===void 0?!1:r,i=e.escapeMapFn,a=i===void 0?lre:i,o=String(t),s="",l=a(wS({},sre),n?wS({},ure):{}),u=Object.keys(l),c=function(){var m=!1;u.forEach(function(p,d){m||o.length>=p.length&&o.slice(0,p.length)===p&&(s+=l[u[d]],o=o.slice(p.length,o.length),m=!0)}),m||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return s}});var LV=ai((RV,_E)=>{(function(t,e,r){function n(s){var l=this,u=o();l.next=function(){var c=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=c-(l.c=c|0)},l.c=1,l.s0=u(" "),l.s1=u(" "),l.s2=u(" "),l.s0-=u(s),l.s0<0&&(l.s0+=1),l.s1-=u(s),l.s1<0&&(l.s1+=1),l.s2-=u(s),l.s2<0&&(l.s2+=1),u=null}function i(s,l){return l.c=s.c,l.s0=s.s0,l.s1=s.s1,l.s2=s.s2,l}function a(s,l){var u=new n(s),c=l&&l.state,f=u.next;return f.int32=function(){return u.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,u),f.state=function(){return i(u,{})}),f}function o(){var s=4022871197,l=function(u){u=String(u);for(var c=0;c<u.length;c++){s+=u.charCodeAt(c);var f=.02519603282416938*s;s=f>>>0,f-=s,f*=s,s=f>>>0,f-=s,s+=f*4294967296}return(s>>>0)*23283064365386963e-26};return l}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})(RV,typeof _E=="object"&&_E,typeof define=="function"&&define)});var UV=ai((VV,AE)=>{(function(t,e,r){function n(o){var s=this,l="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var c=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^c^c>>>8},o===(o|0)?s.x=o:l+=o;for(var u=0;u<l.length+64;u++)s.x^=l.charCodeAt(u)|0,s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(VV,typeof AE=="object"&&AE,typeof define=="function"&&define)});var zV=ai((qV,SE)=>{(function(t,e,r){function n(o){var s=this,l="";s.next=function(){var c=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(c^c<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,o===(o|0)?s.x=o:l+=o;for(var u=0;u<l.length+64;u++)s.x^=l.charCodeAt(u)|0,u==l.length&&(s.d=s.x<<10^s.x>>>4),s.next()}function i(o,s){return s.x=o.x,s.y=o.y,s.z=o.z,s.w=o.w,s.v=o.v,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(qV,typeof SE=="object"&&SE,typeof define=="function"&&define)});var GV=ai((HV,EE)=>{(function(t,e,r){function n(o){var s=this;s.next=function(){var u=s.x,c=s.i,f,m,p;return f=u[c],f^=f>>>7,m=f^f<<24,f=u[c+1&7],m^=f^f>>>10,f=u[c+3&7],m^=f^f>>>3,f=u[c+4&7],m^=f^f<<7,f=u[c+7&7],f=f^f<<13,m^=f^f<<9,u[c]=m,s.i=c+1&7,m};function l(u,c){var f,m,p=[];if(c===(c|0))m=p[0]=c;else for(c=""+c,f=0;f<c.length;++f)p[f&7]=p[f&7]<<15^c.charCodeAt(f)+p[f+1&7]<<13;for(;p.length<8;)p.push(0);for(f=0;f<8&&p[f]===0;++f);for(f==8?m=p[7]=-1:m=p[f],u.x=p,u.i=0,f=256;f>0;--f)u.next()}l(s,o)}function i(o,s){return s.x=o.x.slice(),s.i=o.i,s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.x&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(HV,typeof EE=="object"&&EE,typeof define=="function"&&define)});var YV=ai((WV,TE)=>{(function(t,e,r){function n(o){var s=this;s.next=function(){var u=s.w,c=s.X,f=s.i,m,p;return s.w=u=u+1640531527|0,p=c[f+34&127],m=c[f=f+1&127],p^=p<<13,m^=m<<17,p^=p>>>15,m^=m>>>12,p=c[f]=p^m,s.i=f,p+(u^u>>>16)|0};function l(u,c){var f,m,p,d,h,x=[],b=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,b=Math.max(b,c.length)),p=0,d=-32;d<b;++d)c&&(m^=c.charCodeAt((d+32)%c.length)),d===0&&(h=m),m^=m<<10,m^=m>>>15,m^=m<<4,m^=m>>>13,d>=0&&(h=h+1640531527|0,f=x[d&127]^=m+h,p=f==0?p+1:0);for(p>=128&&(x[(c&&c.length||0)&127]=-1),p=127,d=4*128;d>0;--d)m=x[p+34&127],f=x[p=p+1&127],m^=m<<13,f^=f<<17,m^=m>>>15,f^=f>>>12,x[p]=m^f;u.w=h,u.X=x,u.i=p}l(s,o)}function i(o,s){return s.i=o.i,s.w=o.w,s.X=o.X.slice(),s}function a(o,s){o==null&&(o=+new Date);var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(u.X&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(WV,typeof TE=="object"&&TE,typeof define=="function"&&define)});var ZV=ai((jV,DE)=>{(function(t,e,r){function n(o){var s=this,l="";s.next=function(){var c=s.b,f=s.c,m=s.d,p=s.a;return c=c<<25^c>>>7^f,f=f-m|0,m=m<<24^m>>>8^p,p=p-c|0,s.b=c=c<<20^c>>>12^f,s.c=f=f-m|0,s.d=m<<16^f>>>16^p,s.a=p-c|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,o===Math.floor(o)?(s.a=o/4294967296|0,s.b=o|0):l+=o;for(var u=0;u<l.length+20;u++)s.b^=l.charCodeAt(u)|0,s.next()}function i(o,s){return s.a=o.a,s.b=o.b,s.c=o.c,s.d=o.d,s}function a(o,s){var l=new n(o),u=s&&s.state,c=function(){return(l.next()>>>0)/4294967296};return c.double=function(){do var f=l.next()>>>11,m=(l.next()>>>0)/4294967296,p=(f+m)/(1<<21);while(p===0);return p},c.int32=l.next,c.quick=c,u&&(typeof u=="object"&&i(u,l),c.state=function(){return i(l,{})}),c}e&&e.exports?e.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(jV,typeof DE=="object"&&DE,typeof define=="function"&&define)});var XV=ai((JV,Ov)=>{(function(t,e,r){var n=256,i=6,a=52,o="random",s=r.pow(n,i),l=r.pow(2,a),u=l*2,c=n-1,f;function m(v,A,w){var y=[];A=A==!0?{entropy:!0}:A||{};var E=x(h(A.entropy?[v,T(e)]:v??b(),3),y),D=new p(y),_=function(){for(var N=D.g(i),C=s,B=0;N<l;)N=(N+B)*n,C*=n,B=D.g(1);for(;N>=u;)N/=2,C/=2,B>>>=1;return(N+B)/C};return _.int32=function(){return D.g(4)|0},_.quick=function(){return D.g(4)/4294967296},_.double=_,x(T(D.S),e),(A.pass||w||function(N,C,B,R){return R&&(R.S&&d(R,D),N.state=function(){return d(D,{})}),B?(r[o]=N,C):N})(_,E,"global"in A?A.global:this==r,A.state)}function p(v){var A,w=v.length,y=this,E=0,D=y.i=y.j=0,_=y.S=[];for(w||(v=[w++]);E<n;)_[E]=E++;for(E=0;E<n;E++)_[E]=_[D=c&D+v[E%w]+(A=_[E])],_[D]=A;(y.g=function(N){for(var C,B=0,R=y.i,V=y.j,L=y.S;N--;)C=L[R=c&R+1],B=B*n+L[c&(L[R]=L[V=c&V+C])+(L[V]=C)];return y.i=R,y.j=V,B})(n)}function d(v,A){return A.i=v.i,A.j=v.j,A.S=v.S.slice(),A}function h(v,A){var w=[],y=typeof v,E;if(A&&y=="object")for(E in v)try{w.push(h(v[E],A-1))}catch{}return w.length?w:y=="string"?v:v+"\0"}function x(v,A){for(var w=v+"",y,E=0;E<w.length;)A[c&E]=c&(y^=A[c&E]*19)+w.charCodeAt(E++);return T(A)}function b(){try{var v;return f&&(v=f.randomBytes)?v=v(n):(v=new Uint8Array(n),(t.crypto||t.msCrypto).getRandomValues(v)),T(v)}catch{var A=t.navigator,w=A&&A.plugins;return[+new Date,t,w,t.screen,T(e)]}}function T(v){return String.fromCharCode.apply(0,v)}if(x(r.random(),e),typeof Ov=="object"&&Ov.exports){Ov.exports=m;try{f=require("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return m}):r["seed"+o]=m})(typeof self<"u"?self:JV,[],Math)});var KV=ai((xQe,QV)=>{var Tne=LV(),Dne=UV(),Mne=zV(),Cne=GV(),Nne=YV(),Fne=ZV(),ec=XV();ec.alea=Tne;ec.xor128=Dne;ec.xorwow=Mne;ec.xorshift7=Cne;ec.xor4096=Nne;ec.tychei=Fne;QV.exports=ec});var dse={};Z7(dse,{MetaBindBuild:()=>nC,default:()=>dx});module.exports=J7(dse);var hx=require("obsidian");var Yi=(r=>(r.INLINE="inline",r.BLOCK="block",r))(Yi||{}),vc=(l=>(l.INPUT="INPUT",l.VIEW="VIEW",l.JS_VIEW="JS_VIEW",l.TABLE="TABLE",l.BUTTON_GROUP="BUTTON_GROUP",l.BUTTON="BUTTON",l.EMBED="EMBED",l.EXCLUDED="EXCLUDED",l))(vc||{}),mu=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function sd(t){return t==="INPUT"||t==="VIEW"||t==="BUTTON_GROUP"}var du=(y=>(y.TOGGLE="toggle",y.SLIDER="slider",y.TEXT="text",y.TEXT_AREA="textArea",y.SELECT="select",y.MULTI_SELECT="multiSelect",y.DATE="date",y.TIME="time",y.DATE_PICKER="datePicker",y.NUMBER="number",y.SUGGESTER="suggester",y.EDITOR="editor",y.IMAGE_SUGGESTER="imageSuggester",y.PROGRESS_BAR="progressBar",y.INLINE_SELECT="inlineSelect",y.LIST="list",y.LIST_SUGGESTER="listSuggester",y.INLINE_LIST_SUGGESTER="inlineListSuggester",y.INLINE_LIST="inlineList",y.IMAGE_LIST_SUGGESTER="imageListSuggester",y.DATE_TIME="dateTime",y.INVALID="invalid",y))(du||{}),fn=(T=>(T.CLASS="class",T.ADD_LABELS="addLabels",T.MIN_VALUE="minValue",T.MAX_VALUE="maxValue",T.STEP_SIZE="stepSize",T.OPTION="option",T.TITLE="title",T.OPTION_QUERY="optionQuery",T.SHOWCASE="showcase",T.ON_VALUE="onValue",T.OFF_VALUE="offValue",T.DEFAULT_VALUE="defaultValue",T.PLACEHOLDER="placeholder",T.USE_LINKS="useLinks",T.LIMIT="limit",T.MULTI_LINE="multiLine",T.ALLOW_OTHER="allowOther",T.INVALID="invalid",T))(fn||{}),ud={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:!0},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 Nr={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}},op=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(op||{}),sl=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(sl||{}),yc={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}},ld=8;var Jn=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)}},Gt=class extends Jn{getErrorType(){return"MB_INTERNAL"}},Co=class extends Jn{getErrorType(){return"MB_PARSING"}},Ms=class extends Jn{getErrorType(){return"MB_VALIDATION"}},cd=class extends Jn{getErrorType(){return"MB_BIND_TARGET"}};var Hr=class extends Jn{getErrorType(){return"MB_ARGUMENT"}},No=class extends Jn{getErrorType(){return"MB_JS"}},ul=class extends Jn{getErrorType(){return"MB_EXPRESSION"}};var sp=class extends Jn{getErrorType(){return"MB_EXAMPLE"}};var Cs=class extends Jn{getErrorType(){return"MB_BUTTON"}},ll=class extends Jn{getErrorType(){return"MB_DEPENDENCY"}};var eo=class{static get(e,r){return r.get(e).child}static tryGet(e,r){return r.tryGet(e)?.child}static fullGet(e,r){return r.get(e)}static set(e,r,n){r.set(e,n)}static setAndCreate(e,r,n){r.setAndCreate(e,n)}};var xc=class{constructor(e,r){this.id=e,this.manager=r,this.cache=new Map}validateStoragePath(e,r,n,i){return i.validateStoragePathAsFilePath(e,n)}resolveBindTargetScope(e,r,n){return e}getOrCreateCacheItem(e){let r=this.getCacheItemForStoragePath(e);return r===void 0&&(r=this.getDefaultCacheItem(e),this.cache.set(e,r)),r}subscribe(e){if(e.bindTarget===void 0)throw new Gt({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let r=this.getOrCreateCacheItem(e.bindTarget.storagePath);return r.subscriptions.push(e),r}unsubscribe(e){if(e.bindTarget===void 0)throw new Gt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"subscription bind target undefined"});let r=this.cache.get(e.bindTarget.storagePath);if(r===void 0)throw new Gt({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return r.subscriptions=r.subscriptions.filter(n=>n.uuid!==e.uuid),r}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,r){let n=this.getOrCreateCacheItem(r.storagePath);return eo.setAndCreate(n.data,r.storageProp,e),n}writeEntireCache(e,r){r.data=e}readCache(e){if(e.storageType!==this.id)throw new Gt({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let r=this.getCacheItemForStoragePath(e.storagePath);return r===void 0?eo.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(r,e.storageProp)}readCacheItem(e,r){return eo.tryGet(e.data,r)}readEntireCacheItem(e){return e.data}};function Xn(t,e){let r=t.tryParse(e);if(r.success)return r.value;throw new up("ERROR","parsiNOM parser",e,r)}var up=class extends Jn{constructor(e,r,n,i){super({errorLevel:e,effect:"Failed to parse. Check that your syntax is correct.",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=n,this.parseFailure=i,this.source=r,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 r=this.str.split(`
`)[this.parseFailure.furthest.line-1],n=`${this.parseFailure.furthest.line} |   `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let r=" ".repeat(this.parseFailure.furthest.column+e-1),n=`^ (${this.cause})`;return r+n}},Vn=class extends Jn{constructor(e,r,n,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:n,docs:o}),this.str=i,this.position=a,this.source=r,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let r=this.str.split(`
`)[this.position.from.line-1],n=`${this.position.from.line} |   `;this.positionContext=`${n}${r}`,this.positionContext+=`
${this.getUnderline(n.length,r.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,r){if(this.position===void 0)return"";let n=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:r,a="^".repeat(i-this.position.from.column);return n+a}};var fd=class extends xc{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}syncExternal(e){}},pd=class{constructor(e,r){this.id=e,this.manager=r,this.cache={data:{},...this.manager.getDefaultCacheItem()}}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind target validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",n,e.position);return""}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,r){return eo.tryGet(e.data,r)}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(r=>r.uuid!==e.uuid),this.cache}writeCache(e,r){return eo.setAndCreate(this.cache.data,r.storageProp,e),this.cache}writeEntireCache(e,r){r.data=e}readEntireCacheItem(e){return e.data}},md=class{constructor(e,r){this.id=e,this.manager=r}getOrCreateCacheItem(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,r,n,i){if(r)throw new Vn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",n,e.position);return""}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,r){}shouldDelete(e){return!0}subscribe(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,r){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,r){}readEntireCacheItem(e){throw new Gt({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};var vn=class extends Error{},lp=class extends Error{};var VC=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},X7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function Q7(t,e,r){let n=r;for(let i of Rr(t))n=e(n,i);return n}function K7(t,e,r){return VC(this,void 0,void 0,function*(){var n,i,a,o;let s=r;try{for(var l=!0,u=X7(Lr(t)),c;c=yield u.next(),n=c.done,!n;l=!0)o=c.value,l=!1,s=yield e(s,o)}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield a.call(u))}finally{if(i)throw i.error}}return s})}function Px(t){switch(!0){case t instanceof Array:return t.length;case es(t):return t.length;case t instanceof Set:return t.size;case t instanceof Map:return t.size}return Q7(t,e=>e+1,0)}function UC(t){return VC(this,void 0,void 0,function*(){switch(!0){case t instanceof Array:case es(t):case t instanceof Set:case t instanceof Map:return Px(t)}return yield K7(t,e=>e+1,0)})}var qC={chunkwise:nN,chunkwiseOverlap:hd,compress:GC,dropWhile:YC,enumerate:sN,filter:tN,flatMap:KC,flatten:Bx,groupBy:vN,keys:fN,limit:aN,map:HC,pairwise:cl,repeat:XC,skip:mN,slice:lN,sort:xN,takeWhile:ZC,values:hN,chunkwiseAsync:iN,chunkwiseOverlapAsync:gd,compressAsync:WC,dropWhileAsync:jC,enumerateAsync:uN,filterAsync:rN,flatMapAsync:eN,flattenAsync:kx,groupByAsync:yN,keysAsync:pN,limitAsync:oN,mapAsync:dd,pairwiseAsync:cp,repeatAsync:QC,skipAsync:dN,sliceAsync:cN,sortAsync:bN,takeWhileAsync:JC,valuesAsync:gN};var zC={allMatch:wN,allUnique:AN,anyMatch:EN,exactlyN:DN,isEmpty:CN,isAsyncIterable:Ns,isIterable:ua,isIterator:to,isReversed:FN,isSorted:PN,isString:es,noneMatch:kN,same:ON,sameCount:LN,allMatchAsync:_N,allUniqueAsync:SN,anyMatchAsync:TN,exactlyNAsync:MN,isEmptyAsync:NN,isReversedAsync:IN,isSortedAsync:BN,noneMatchAsync:$N,sameAsync:RN,sameCountAsync:VN};var bc=function(t){return this instanceof bc?(this.v=t,this):new bc(t)},eH=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(x,b){a.push([p,h,x,b])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof bc?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}},Fo;(function(t){t[t.SHORTEST=0]="SHORTEST",t[t.LONGEST=1]="LONGEST",t[t.STRICT_EQUAL=2]="STRICT_EQUAL"})(Fo||(Fo={}));function*$x(t,e,...r){if(r.length===0)return;let n=[];for(let i of r)n.push(UN(i));e:for(;;){let i=qC.map(n,l=>l.next()),a=[],o=!0,s=!1;for(let l of i){let u;l.done?(o=!1,u=e):(s=!0,u=l.value),a.push(u)}if(!o&&s)switch(t){case Fo.SHORTEST:break e;case Fo.STRICT_EQUAL:throw new lp("Iterators must have equal lengths")}if(!s)break;yield a}}function Ox(t,e,...r){return eH(this,arguments,function*(){if(r.length===0)return yield bc(void 0);let i=[];for(let a of r)i.push(qN(a));e:for(;;){let a=[];for(let u of i){let c=yield bc(u.next());a.push(c)}let o=[],s=!0,l=!1;for(let u of a){let c;u.done?(s=!1,c=e):(l=!0,c=u.value),o.push(c)}if(!s&&l)switch(t){case Fo.SHORTEST:break e;case Fo.STRICT_EQUAL:throw new lp("Iterators must have equal lengths")}if(!l)break;yield yield bc(o)}})}var hu=function(t){return this instanceof hu?(this.v=t,this):new hu(t)},tH=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},rH=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(x,b){a.push([p,h,x,b])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof hu?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*Rx(t,e){let r=new Set;if(t instanceof Map){e===void 0&&(e=n=>n[1]);for(let n of t){let i=e(n);r.has(i)||(yield n,r.add(i))}}else{e===void 0&&(e=n=>n);for(let n of Rr(t)){let i=e(n);r.has(i)||(yield n,r.add(i))}}}function zN(t,e){return rH(this,arguments,function*(){var n,i,a,o;let s=new Set;if(t instanceof Map)for(let f of Rx(t,e))yield yield hu(yield hu(f));else{e===void 0&&(e=f=>f);try{for(var l=!0,u=tH(Lr(t)),c;c=yield hu(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o,m=e(f);s.has(m)||(yield yield hu(f),s.add(m))}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield hu(a.call(u)))}finally{if(i)throw i.error}}}})}var $n=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},it=function(t){return this instanceof it?(this.v=t,this):new it(t)},Qn=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(x,b){a.push([p,h,x,b])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof it?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*HC(t,e){for(let r of Rr(t))yield e(r)}function dd(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Lr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield it(yield it(e(o)))}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*GC(t,e){for(let[r,n]of wc(t,e))n&&(yield r)}function WC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(HN(t,e)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let[c,f]=o;f&&(yield yield it(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*YC(t,e){let r=!0;for(let n of Rr(t)){if(r){if(!e(n)){r=!1,yield n;continue}continue}yield n}}function jC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;let s=!0;try{for(var l=!0,u=$n(Lr(t)),c;c=yield it(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s){if(!(yield it(e(f)))){s=!1,yield yield it(f);continue}continue}yield yield it(f)}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield it(a.call(u)))}finally{if(i)throw i.error}}})}function*ZC(t,e){for(let r of Rr(t))if(e(r))yield r;else break}function JC(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Lr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;if(yield it(e(c)))yield yield it(c);else break}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*XC(t,e){if(e<0)throw new vn(`Number of repetitions cannot be negative: ${e}`);for(let r=e;r>0;--r)yield t}function QC(t,e){return Qn(this,arguments,function*(){if(e<0)throw new vn(`Number of repetitions cannot be negative: ${e}`);let n=yield it(t);for(let i=e;i>0;--i)yield yield it(n)})}function*KC(t,e){for(let r of Rr(t)){let n=e(r,e);if(ua(n))for(let i of Rr(n))yield i;else yield n}}function eN(t,e){return Qn(this,arguments,function*(){var n,i,a,o,s,l,u,c;try{for(var f=!0,m=$n(Lr(t)),p;p=yield it(m.next()),n=p.done,!n;f=!0){o=p.value,f=!1;let T=yield it(e(o,e));if(ua(T)||Ns(T))try{for(var d=!0,h=(l=void 0,$n(Lr(T))),x;x=yield it(h.next()),s=x.done,!s;d=!0)c=x.value,d=!1,yield yield it(c)}catch(v){l={error:v}}finally{try{!d&&!s&&(u=h.return)&&(yield it(u.call(h)))}finally{if(l)throw l.error}}else yield yield it(T)}}catch(b){i={error:b}}finally{try{!f&&!n&&(a=m.return)&&(yield it(a.call(m)))}finally{if(i)throw i.error}}})}function*Bx(t,e=1/0){if(e<1){for(let r of Rr(t))t instanceof Map&&(r=r[1]),yield r;return}for(let r of Rr(t))if(t instanceof Map&&(r=r[1]),(ua(r)||to(r))&&!es(r))for(let n of Bx(r,e-1))yield n;else yield r}function kx(t){return Qn(this,arguments,function*(r,n=1/0){var i,a,o,s,l,u,c,f,m,p,d,h;if(n<1){try{for(var x=!0,b=$n(Lr(r)),T;T=yield it(b.next()),i=T.done,!i;x=!0){s=T.value,x=!1;let _=s;r instanceof Map&&(_=_[1]),yield yield it(_)}}catch(_){a={error:_}}finally{try{!x&&!i&&(o=b.return)&&(yield it(o.call(b)))}finally{if(a)throw a.error}}return yield it(void 0)}try{for(var v=!0,A=$n(Lr(r)),w;w=yield it(A.next()),l=w.done,!l;v=!0){f=w.value,v=!1;let _=f;if(r instanceof Map&&(_=_[1]),(Ns(_)||ua(_)||to(_))&&!es(_))try{for(var y=!0,E=(p=void 0,$n(kx(_,n-1))),D;D=yield it(E.next()),m=D.done,!m;y=!0)h=D.value,y=!1,yield yield it(h)}catch(N){p={error:N}}finally{try{!y&&!m&&(d=E.return)&&(yield it(d.call(E)))}finally{if(p)throw p.error}}else yield yield it(_)}}catch(_){u={error:_}}finally{try{!v&&!l&&(c=A.return)&&(yield it(c.call(A)))}finally{if(u)throw u.error}}})}function*tN(t,e){for(let r of Rr(t))e(r)&&(yield r)}function rN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(Lr(t)),u;u=yield it(l.next()),n=u.done,!n;s=!0){o=u.value,s=!1;let c=o;(yield it(e(c)))&&(yield yield it(c))}}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*hd(t,e,r,n=!0){if(e<1)throw new vn(`Chunk size must be \u2265 1. Got ${e}`);if(r>=e)throw new vn("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Rr(t))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-r),a=!0);!a&&i.length>0&&n&&(yield i)}function gd(t,e,r){return Qn(this,arguments,function*(i,a,o,s=!0){var l,u,c,f;if(a<1)throw new vn(`Chunk size must be \u2265 1. Got ${a}`);if(o>=a)throw new vn("Overlap size must be less than chunk size");let m=[],p=!1;try{for(var d=!0,h=$n(Lr(i)),x;x=yield it(h.next()),l=x.done,!l;d=!0){f=x.value,d=!1;let b=f;p=!1,m.push(b),m.length===a&&(yield yield it(m),m=m.slice(a-o),p=!0)}}catch(b){u={error:b}}finally{try{!d&&!l&&(c=h.return)&&(yield it(c.call(h)))}finally{if(u)throw u.error}}!p&&m.length>0&&s&&(yield yield it(m))})}function*nN(t,e){for(let r of hd(t,e,0))yield r}function iN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;try{for(var s=!0,l=$n(gd(t,e,0)),u;u=yield it(l.next()),n=u.done,!n;s=!0)o=u.value,s=!1,yield yield it(o)}catch(c){i={error:c}}finally{try{!s&&!n&&(a=l.return)&&(yield it(a.call(l)))}finally{if(i)throw i.error}}})}function*cl(t){let e=hd(t,2,1,!1);for(let r of e)yield r}function cp(t){return Qn(this,arguments,function*(){var r,n,i,a;let o=gd(t,2,1,!1);try{for(var s=!0,l=$n(o),u;u=yield it(l.next()),r=u.done,!r;s=!0)a=u.value,s=!1,yield yield it(a)}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield it(i.call(l)))}finally{if(n)throw n.error}}})}function*aN(t,e){if(e<0)throw new vn(`Limit must be \u2265 0. Got ${e}`);let r=0;for(let n of Rr(t)){if(r>=e)return;yield n,++r}}function oN(t,e){return Qn(this,arguments,function*(){var n,i,a,o;if(e<0)throw new vn(`Limit must be \u2265 0. Got ${e}`);let s=0;try{for(var l=!0,u=$n(Lr(t)),c;c=yield it(u.next()),n=c.done,!n;l=!0){o=c.value,l=!1;let f=o;if(s>=e)return yield it(void 0);yield yield it(f),++s}}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield it(a.call(u)))}finally{if(i)throw i.error}}})}function*sN(t){let e=0;for(let r of Rr(t))yield[e++,r]}function uN(t){return Qn(this,arguments,function*(){var r,n,i,a;let o=0;try{for(var s=!0,l=$n(Lr(t)),u;u=yield it(l.next()),r=u.done,!r;s=!0){a=u.value,s=!1;let c=a;yield yield it([o++,c])}}catch(c){n={error:c}}finally{try{!s&&!r&&(i=l.return)&&(yield it(i.call(l)))}finally{if(n)throw n.error}}})}function*lN(t,e=0,r,n=1){if(e<0)throw new vn("Parameter 'start' cannot be negative");if(r!==void 0&&r<0)throw new vn("Parameter 'count' cannot be negative");if(n<=0)throw new vn("Parameter 'step' must be positive");let i=0,a=0;for(let o of Rr(t))if(!(i++<e||(i-e-1)%n!==0)){if(a++===r&&r!==void 0)break;yield o}}function cN(t){return Qn(this,arguments,function*(r,n=0,i,a=1){var o,s,l,u;if(n<0)throw new vn("Parameter 'start' cannot be negative");if(i!==void 0&&i<0)throw new vn("Parameter 'count' cannot be negative");if(a<=0)throw new vn("Parameter 'step' must be positive");let c=0,f=0;try{for(var m=!0,p=$n(Lr(r)),d;d=yield it(p.next()),o=d.done,!o;m=!0){u=d.value,m=!1;let h=u;if(!(c++<n||(c-n-1)%a!==0)){if(f++===i&&i!==void 0)break;yield yield it(h)}}}catch(h){s={error:h}}finally{try{!m&&!o&&(l=p.return)&&(yield it(l.call(p)))}finally{if(s)throw s.error}}})}function*fN(t){for(let[e]of Rr(t))yield e}function pN(t){return Qn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=$n(Lr(t)),l;l=yield it(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[u]=a;yield yield it(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield it(i.call(s)))}finally{if(n)throw n.error}}})}function*mN(t,e,r=0){if(e<0||r<0)throw new vn;let n=-r;for(let i of Rr(t))(n<0||n>=e)&&(yield i),++n}function dN(t,e){return Qn(this,arguments,function*(n,i,a=0){var o,s,l,u;if(i<0||a<0)throw new vn;let c=-a;try{for(var f=!0,m=$n(Lr(n)),p;p=yield it(m.next()),o=p.done,!o;f=!0){u=p.value,f=!1;let d=u;(c<0||c>=i)&&(yield yield it(d)),++c}}catch(d){s={error:d}}finally{try{!f&&!o&&(l=m.return)&&(yield it(l.call(m)))}finally{if(s)throw s.error}}})}function*hN(t){for(let[,e]of Rr(t))yield e}function gN(t){return Qn(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=$n(Lr(t)),l;l=yield it(s.next()),r=l.done,!r;o=!0){a=l.value,o=!1;let[,u]=a;yield yield it(u)}}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield it(i.call(s)))}finally{if(n)throw n.error}}})}function*vN(t,e,r){let n=new Map,i=a=>{n.has(a)||(r!==void 0?n.set(a,{}):n.set(a,[]))};for(let a of Rr(t)){let o=e(a),s=r!==void 0?r(a):void 0,l=(ua(o)||to(o))&&!es(o)?o:[o];for(let u of Rx(l))i(u),s===void 0?n.get(u).push(a):n.get(u)[s]=a}for(let a of n)yield a}function yN(t,e,r){return Qn(this,arguments,function*(){var i,a,o,s,l,u,c,f;let m=new Map,p=A=>{m.has(A)||(r!==void 0?m.set(A,{}):m.set(A,[]))};try{for(var d=!0,h=$n(Lr(t)),x;x=yield it(h.next()),i=x.done,!i;d=!0){s=x.value,d=!1;let A=s,w=yield it(e(A)),y=r!==void 0?yield it(r(A)):void 0,E=(Ns(w)||ua(w)||to(w))&&!es(w)?w:[w];try{for(var b=!0,T=(u=void 0,$n(zN(E))),v;v=yield it(T.next()),l=v.done,!l;b=!0){f=v.value,b=!1;let D=f;p(D),y===void 0?m.get(D).push(A):m.get(D)[y]=A}}catch(D){u={error:D}}finally{try{!b&&!l&&(c=T.return)&&(yield it(c.call(T)))}finally{if(u)throw u.error}}}}catch(A){a={error:A}}finally{try{!d&&!i&&(o=h.return)&&(yield it(o.call(h)))}finally{if(a)throw a.error}}for(let A of m)yield yield it(A)})}function*xN(t,e){let r=Lx(t);e!==void 0?r.sort(e):r.sort();for(let n of r)yield n}function bN(t,e){return Qn(this,arguments,function*(){let n=yield it(fp(t));e!==void 0?n.sort(e):n.sort();for(let i of n)yield yield it(i)})}var Io=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},Fs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function wN(t,e){for(let r of Rr(t))if(!e(r))return!1;return!0}function _N(t,e){return Io(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Fs(Lr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,!(yield e(a)))return!1}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!0})}function AN(t){let e=new Set;for(let r of Rr(t)){if(e.has(r))return!1;e.add(r)}return!0}function SN(t){return Io(this,void 0,void 0,function*(){var e,r,n,i;let a=new Set;try{for(var o=!0,s=Fs(Lr(t)),l;l=yield s.next(),e=l.done,!e;o=!0){i=l.value,o=!1;let u=i;if(a.has(u))return!1;a.add(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return!0})}function EN(t,e){for(let r of Rr(t))if(e(r))return!0;return!1}function TN(t,e){return Io(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Fs(Lr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,yield e(a))return!0}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!1})}function DN(t,e,r){if(e<0)return!1;r===void 0&&(r=i=>!!i);let n=0;for(let i of Rr(t))if(r(i)&&(n++,n>e))return!1;return n===e}function MN(t,e,r){return Io(this,void 0,void 0,function*(){var n,i,a,o;if(e<0)return!1;r===void 0&&(r=f=>!!f);let s=0;try{for(var l=!0,u=Fs(Lr(t)),c;c=yield u.next(),n=c.done,!n;l=!0)if(o=c.value,l=!1,(yield r(o))&&(s++,s>e))return!1}catch(f){i={error:f}}finally{try{!l&&!n&&(a=u.return)&&(yield a.call(u))}finally{if(i)throw i.error}}return s===e})}function CN(t){for(let e of Rr(t))return!1;return!0}function NN(t){return Io(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Fs(Lr(t)),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let l=i;return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function ua(t){return t==null?!1:typeof t[Symbol.iterator]=="function"}function Ns(t){return t==null?!1:typeof t[Symbol.asyncIterator]=="function"}function to(t){return t==null?!1:t.next!==void 0&&typeof t.next=="function"}function FN(t){for(let[e,r]of cl(Rr(t)))if(e<r)return!1;return!0}function IN(t){return Io(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Fs(cp(Lr(t))),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let[l,u]=i;if(l<u)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function PN(t){for(let[e,r]of cl(Rr(t)))if(e>r)return!1;return!0}function BN(t){return Io(this,void 0,void 0,function*(){var e,r,n,i;try{for(var a=!0,o=Fs(cp(Lr(t))),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let[l,u]=i;if(l>u)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}return!0})}function es(t){return typeof t=="string"||t instanceof String}function kN(t,e){for(let r of Rr(t))if(e(r))return!1;return!0}function $N(t,e){return Io(this,void 0,void 0,function*(){var r,n,i,a;try{for(var o=!0,s=Fs(Lr(t)),l;l=yield s.next(),r=l.done,!r;o=!0)if(a=l.value,o=!1,yield e(a))return!1}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield i.call(s))}finally{if(n)throw n.error}}return!0})}function ON(...t){try{for(let e of GN(...t))for(let[r,n]of cl(e))if(r!==n)return!1}catch{return!1}return!0}function RN(...t){return Io(this,void 0,void 0,function*(){var e,r,n,i;try{try{for(var a=!0,o=Fs(WN(...t)),s;s=yield o.next(),e=s.done,!e;a=!0){i=s.value,a=!1;let l=i;for(let[u,c]of cl(l))if(u!==c)return!1}}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(r)throw r.error}}}catch{return!1}return!0})}function LN(...t){if(t.length<=1)return!0;let e=t.map(r=>Px(r));return new Set(e).size===1}function VN(...t){return Io(this,void 0,void 0,function*(){if(t.length<=1)return!0;let e=yield dd(t,r=>Io(this,void 0,void 0,function*(){return yield UC(r)}));return new Set(yield fp(e)).size===1})}var nH=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})},ts=function(t){return this instanceof ts?(this.v=t,this):new ts(t)},Vx=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(x,b){a.push([p,h,x,b])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof ts?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}},YN=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}};function Rr(t){if(ua(t))return t;if(to(t))return{[Symbol.iterator](){return t}};if(typeof t=="object"&&t!==null)return function*(){for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(yield[e,t[e]])}();throw new vn("Given collection is not iterable or iterator.")}function Lr(t){if(Ns(t))return t;if(to(t))return{[Symbol.asyncIterator](){return Vx(this,arguments,function*(){for(;;){let r=yield ts(t.next());if(r.done)return yield ts(void 0);yield yield ts(r.value)}})}};if(typeof t=="object"&&t!==null&&(t=Rr(t)),ua(t))return{[Symbol.asyncIterator](){return Vx(this,arguments,function*(){for(let r of t)yield yield ts(r)})}};throw new vn("Given collection is not async iterable or iterator.")}function UN(t){if(to(t))return t;if(ua(t))return function*(){for(let e of t)yield e}();throw new vn("Given collection is not iterable or iterator.")}function qN(t){if((to(t)||ua(t))&&(t=Lr(t)),Ns(t))return function(){return Vx(this,arguments,function*(){var e,r,n,i;try{for(var a=!0,o=YN(t),s;s=yield ts(o.next()),e=s.done,!e;a=!0)i=s.value,a=!1,yield yield ts(i)}catch(l){r={error:l}}finally{try{!a&&!e&&(n=o.return)&&(yield ts(n.call(o)))}finally{if(r)throw r.error}}})}();throw new vn("Given collection is not iterable or iterator.")}function Lx(t){let e=[];for(let r of Rr(t))e.push(r);return e}function fp(t){return nH(this,void 0,void 0,function*(){var e,r,n,i;let a=[];try{for(var o=!0,s=YN(Lr(t)),l;l=yield s.next(),e=l.done,!e;o=!0){i=l.value,o=!1;let u=i;a.push(u)}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return a})}var jN=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=t[a]&&function(o){return new Promise(function(s,l){o=t[a](o),i(s,l,o.done,o.value)})}}function i(a,o,s,l){Promise.resolve(l).then(function(u){a({value:u,done:s})},o)}},Is=function(t){return this instanceof Is?(this.v=t,this):new Is(t)},ZN=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(d){return Promise.resolve(d).then(p,f)}}function s(p,d){n[p]&&(i[p]=function(h){return new Promise(function(x,b){a.push([p,h,x,b])>1||l(p,h)})},d&&(i[p]=d(i[p])))}function l(p,d){try{u(n[p](d))}catch(h){m(a[0][3],h)}}function u(p){p.value instanceof Is?Promise.resolve(p.value.v).then(c,f):m(a[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function m(p,d){p(d),a.shift(),a.length&&l(a[0][0],a[0][1])}};function*wc(...t){for(let e of $x(Fo.SHORTEST,void 0,...t))yield e}function HN(...t){return ZN(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=jN(Ox(Fo.SHORTEST,void 0,...t)),l;l=yield Is(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield Is(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield Is(i.call(s)))}finally{if(n)throw n.error}}})}function*GN(...t){for(let e of $x(Fo.STRICT_EQUAL,void 0,...t))yield e}function WN(...t){return ZN(this,arguments,function*(){var r,n,i,a;try{for(var o=!0,s=jN(Ox(Fo.STRICT_EQUAL,void 0,...t)),l;l=yield Is(s.next()),r=l.done,!r;o=!0)a=l.value,o=!1,yield yield Is(a)}catch(u){n={error:u}}finally{try{!o&&!r&&(i=s.return)&&(yield Is(i.call(s)))}finally{if(n)throw n.error}}})}function pp(t,e,r){return Math.min(Math.max(t,e),r)}function yd(t,e,r){return t!==void 0?Math.min(Math.max(t,e),r):void 0}function Ux(t,e,r,n,i){return(t-e)/(r-e)*(i-n)+n}function qx(t,e){return(t%e+e)%e}function vd(t,e){if(t==null&&e==null)return!0;if(t==null||e==null||typeof t!=typeof e)return!1;if(typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!vd(t[i],e[i]))return!1;return!0}let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let i of r)if(!vd(t[i],e[i]))return!1;return!0}return t===e}function zx(t){return!!t}function Hx(t){if(t===void 0)return t;let e=Reflect.ownKeys(t);for(let r of e){let n=t[r];(n&&typeof n=="object"||typeof n=="function")&&Hx(n)}return Object.freeze(t)}function JN(t){return structuredClone(t)}function Fr(){return window.crypto.randomUUID()}function _c(t){try{return new URL(t),!0}catch{return!1}}function xd(t){window.open(t,"_blank")}function XN(t,e,r=", ",n="and"){return t.length===0?"":(t=t.map(e),t.length===1?t[0]:t.length===2?`${t[0]} ${n} ${t[1]}`:`${t.slice(0,-1).join(r)} ${n} ${t.slice(-1)}`)}function Di(t,e){t.innerHTML="",t.className="";let r=document.createElement("span");r.className="mb-warning mb-unloaded",r.innerText=`[MB_UNLOADED] ${e}`,t.appendChild(r)}var mt=class{static createElement(e,r,n){let i=document.createElement(r);return n?.text&&(i.innerText=n.text),n?.class&&(i.className=n.class),e.appendChild(i),i}static addClass(e,r){e.classList.add(...r.split(" "))}static addClasses(e,r){e.classList.add(...r)}static removeClass(e,r){e.classList.remove(...r.split(" "))}static hasClass(e,r){return e.classList.contains(r)}static removeAllClasses(e){e.className=""}static empty(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};function bd(...t){let e=t[0];for(let r=1;r<t.length;r++){let n=e.endsWith("/"),i=t[r].startsWith("/");n&&i?e=e.substring(0,e.length-1):!n&&!i&&(e+="/"),e+=t[r]}return e}function wd(t,e){return e=e.startsWith(".")?e:"."+e,t.endsWith(e)?t:t+e}function _d(t){return t===void 0?[]:Array.isArray(t)?t:[t]}var Ad=class{constructor(e,r,n,i,a,o,s){this.uuid=e,this.metadataManager=r,this.bindTarget=n,this.dependencies=i,this.dependencySignals=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=s,this.deleted=!1}init(){for(let[e,r]of wc(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+Fr();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,r,e,()=>this.delete())),r.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){try{let e=await this.computeFunction();this.bindTarget&&this.metadataManager.write(e,this.bindTarget,this.uuid)}catch(e){let r=e instanceof Error?e:String(e);console.warn(new Gt({errorLevel:"ERROR",effect:"Failed to run derived metadata computation",cause:r}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Sd=class{constructor(e,r,n,i,a,o){this.uuid=e,this.metadataManager=r,this.bindTarget=void 0,this.dependencies=n,this.dependencySignals=i,this.dependencySubscriptions=[],this.effectFunction=a,this.deleted=!1,this.onDelete=o}init(){for(let[e,r]of wc(this.dependencies,this.dependencySignals)){let n=this.uuid+"/"+Fr();this.dependencySubscriptions.push(this.metadataManager.subscribe(n,r,e,()=>this.delete())),r.registerListener({callback:()=>void this.runEffect()})}this.runEffect()}async runEffect(){try{await this.effectFunction()}catch(e){let r=e instanceof Error?e:String(e);console.warn(new Gt({errorLevel:"ERROR",effect:"Failed to run metadata effect",cause:r}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}onUpdate(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Ed=class{constructor(e,r,n,i,a){this.uuid=e,this.callbackSignal=r,this.metadataManager=n,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}write(e){this.metadataManager.write(e,this.bindTarget,this.uuid)}onUpdate(e){try{this.callbackSignal.set(e)}catch(r){let n=r instanceof Error?r:String(r);console.warn(new Gt({errorLevel:"ERROR",effect:"Failed to notify subscription of updated value in the cache",cause:n}))}}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var iH=5,aH=5*60;function Gx(t,e){return t===void 0||e===void 0||t.storageType!==e.storageType||t.storagePath!==e.storagePath?!1:QN(t.storageProp,e.storageProp,e.listenToChildren)}function QN(t,e,r){let n=t.path,i=e.path;for(let a=0;a<Math.min(n.length,i.length);a++)if(n[a].type!==i[a].type||n[a].prop!==i[a].prop)return!1;return n.length>i.length?r:!0}function oH(t){return t===void 0?"undefined":`${t.storagePath}#${t.storageProp.toString()}`}var Td=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 Gt({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,r,n,i){let a=new Ed(e,r,this,n,i);return this.subscribeSubscription(a),a}subscribeDerived(e,r,n,i,a,o){let s=new Ad(e,this,r,n,i,a,o);return this.checkForLoops(s),s.init(),this.subscribeSubscription(s),s}subscribeEffect(e,r,n,i,a){let o=new Sd(e,this,r,n,i,a);return o.init(),this.subscribeSubscription(o),o}unsubscribe(e){if(e.bindTarget===void 0)return;let r=this.getSource(e.bindTarget.storageType);if(r===void 0)throw new Gt({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=r.unsubscribe(e);n.subscriptions.length===0&&(n.cyclesWithoutListeners=0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let r=this.getSource(e.bindTarget.storageType);if(r===void 0)throw new Gt({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let n=r.subscribe(e);n.cyclesWithoutListeners=0,e.onUpdate(r.readCacheItem(n,e.bindTarget.storageProp))}checkForLoops(e){for(let r of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,r])}recCheckForLoops(e){let r=e.at(0),n=e.at(-1);if(!(n===void 0||r===void 0)){if(Gx(r.bindTarget,n.bindTarget))throw new cd({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${oH(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(n))this.recCheckForLoops([...e,i])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(r=>this.getAllSubscriptionsToBindTarget(r)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let r=this.getCacheItemForBindTarget(e);if(!r)return[];let n=[];for(let i of r.subscriptions)Gx(i.bindTarget,e)&&n.push(i);return r.subscriptions.filter(i=>Gx(i.bindTarget,e))}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let r=[];for(let n of e.iterateCacheItems()){if(e.onCycle(n),n.dirty){try{e.syncExternal(n)}catch(i){console.warn(`failed to sync changes to external source for ${e.id}`,i)}n.dirty=!1}n.externalWriteLock>0&&(n.externalWriteLock-=1),n.subscriptions.length===0&&(n.cyclesWithoutListeners+=1),n.cyclesWithoutListeners>aH&&e.shouldDelete(n)&&r.push(n)}for(let n of r)e.deleteCache(n)}}write(e,r,n){let i=this.getSource(r.storageType);if(i===void 0)throw new Gt({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${r.storageType}" does not exist`});let a=i.writeCache(e,r);a.dirty=!0,a.externalWriteLock=iH,this.notifyListeners(r,n)}read(e){let r=this.getSource(e.storageType);if(r===void 0)throw new Gt({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return r.readCache(e)}isCacheExternalWriteLocked(e){return e.externalWriteLock>0}notifyListeners(e,r){let n=this.getSource(e.storageType);if(n===void 0)throw new Gt({errorLevel:"ERROR",effect:"can notify listeners metadata",cause:`Source "${e.storageType}" does not exist`});let i=n.getCacheItemForStoragePath(e.storagePath);if(i!==void 0){for(let a of i.subscriptions)if(!(r!==void 0&&r===a.uuid||a.bindTarget===void 0)&&QN(e.storageProp,a.bindTarget.storageProp,a.bindTarget.listenToChildren)){let o=n.readCache(a.bindTarget);a.onUpdate(o)}}}notifyAllListeners(e,r){for(let n of r.subscriptions){if(n.bindTarget===void 0)continue;let i=e.readCache(n.bindTarget);n.onUpdate(i)}}deleteCachesForStoragePath(e){for(let r of this.sources.values()){let n=r.getCacheItemForStoragePath(e);n!==void 0&&(n.subscriptions.forEach(i=>i.delete()),r.deleteCache(n))}}getDefaultCacheItem(){return{subscriptions:[],externalWriteLock:0,dirty:!1,cyclesWithoutListeners:0}}onExternalUpdate(e,r,n){let i=e.getCacheItemForStoragePath(r);if(i===void 0||this.isCacheExternalWriteLocked(i))return;let a=e.readEntireCacheItem(i);e.writeEntireCache(n,i);for(let o of i.subscriptions){if(o.bindTarget===void 0)continue;let s=o.bindTarget.storageProp,l=eo.tryGet(n,s),u=eo.tryGet(a,s);l!==u&&o.onUpdate(l)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,r){this.deleteCachesForStoragePath(e)}};var Dd=class{constructor(){this.activeMountables=new Map}unloadFile(e){for(let r of this.activeMountables.values())r.getFilePath()===e&&r.unmount()}unload(){for(let e of this.activeMountables.values())e.unmount()}registerMountable(e){this.activeMountables.set(e.getUuid(),e)}unregisterMountable(e){this.activeMountables.delete(e.getUuid())}};var Yx=zr(mp()),oi=class t{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,Yx.default)(e,t.dateFormat)}static getDefaultDate(){return(0,Yx.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var KN=["January","February","March","April","May","June","July","August","September","October","November","December"],fl=[{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"}],Po={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:fl[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"]};var eF=zr(mp());var jx=fl[1];function tF(t){jx=t}function rF(t){return KN[t]}function nF(t,e){let r=(0,eF.default)(new Date(e,t)).daysInMonth(),n=new Array(42).fill(0),i=sH(new Date(e,t,1));for(let a=0;a<r;a++)n[a+i]=a+1;return n=n[n.length-7]?n:n.slice(0,-7),n=n[n.length-7]?n:n.slice(0,-7),n}function sH(t){return qx(t.getDay()-jx.index,7)}function iF(){return fl.map(e=>({index:qx(e.index-jx.index,7),name:e.name,shortName:e.shortName})).sort((e,r)=>e.index-r.index).map(e=>e.shortName)}function aF(){let t=0;return()=>++t}function Md(t){var e=t.statementIndent,r=t.jsonld,n=t.json||r,i=t.typescript,a=t.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function q(Rn){return{type:Rn,style:"keyword"}}var re=q("keyword a"),Ne=q("keyword b"),Ke=q("keyword c"),Ge=q("keyword d"),zt=q("operator"),$r={type:"atom",style:"atom"};return{if:q("if"),while:re,with:re,else:Ne,do:Ne,try:Ne,finally:Ne,return:Ge,break:Ge,continue:Ge,new:q("new"),delete:Ke,void:Ke,throw:Ke,debugger:q("debugger"),var:q("var"),const:q("var"),let:q("var"),function:q("function"),catch:q("catch"),for:q("for"),switch:q("switch"),case:q("case"),default:q("default"),in:zt,typeof:zt,instanceof:zt,true:$r,false:$r,null:$r,undefined:$r,NaN:$r,Infinity:$r,this:q("this"),class:q("class"),super:q("atom"),yield:Ke,export:q("export"),import:q("import"),extends:Ke,await:Ke}}(),s=/[+\-*&%=<>!?|~^@]/,l=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function u(q){for(var re=!1,Ne,Ke=!1;(Ne=q.next())!=null;){if(!re){if(Ne=="/"&&!Ke)return;Ne=="["?Ke=!0:Ke&&Ne=="]"&&(Ke=!1)}re=!re&&Ne=="\\"}}var c,f;function m(q,re,Ne){return c=q,f=Ne,re}function p(q,re){var Ne=q.next();if(Ne=='"'||Ne=="'")return re.tokenize=d(Ne),re.tokenize(q,re);if(Ne=="."&&q.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return m("number","number");if(Ne=="."&&q.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ne))return m(Ne);if(Ne=="="&&q.eat(">"))return m("=>","operator");if(Ne=="0"&&q.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return m("number","number");if(/\d/.test(Ne))return q.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),m("number","number");if(Ne=="/")return q.eat("*")?(re.tokenize=h,h(q,re)):q.eat("/")?(q.skipToEnd(),m("comment","comment")):ln(q,re,1)?(u(q),q.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string.special")):(q.eat("="),m("operator","operator",q.current()));if(Ne=="`")return re.tokenize=x,x(q,re);if(Ne=="#"&&q.peek()=="!")return q.skipToEnd(),m("meta","meta");if(Ne=="#"&&q.eatWhile(a))return m("variable","property");if(Ne=="<"&&q.match("!--")||Ne=="-"&&q.match("->")&&!/\S/.test(q.string.slice(0,q.start)))return q.skipToEnd(),m("comment","comment");if(s.test(Ne))return(Ne!=">"||!re.lexical||re.lexical.type!=">")&&(q.eat("=")?(Ne=="!"||Ne=="=")&&q.eat("="):/[<>*+\-|&?]/.test(Ne)&&(q.eat(Ne),Ne==">"&&q.eat(Ne))),Ne=="?"&&q.eat(".")?m("."):m("operator","operator",q.current());if(a.test(Ne)){q.eatWhile(a);var Ke=q.current();if(re.lastType!="."){if(o.propertyIsEnumerable(Ke)){var Ge=o[Ke];return m(Ge.type,Ge.style,Ke)}if(Ke=="async"&&q.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",Ke)}return m("variable","variable",Ke)}}function d(q){return function(re,Ne){var Ke=!1,Ge;if(r&&re.peek()=="@"&&re.match(l))return Ne.tokenize=p,m("jsonld-keyword","meta");for(;(Ge=re.next())!=null&&!(Ge==q&&!Ke);)Ke=!Ke&&Ge=="\\";return Ke||(Ne.tokenize=p),m("string","string")}}function h(q,re){for(var Ne=!1,Ke;Ke=q.next();){if(Ke=="/"&&Ne){re.tokenize=p;break}Ne=Ke=="*"}return m("comment","comment")}function x(q,re){for(var Ne=!1,Ke;(Ke=q.next())!=null;){if(!Ne&&(Ke=="`"||Ke=="$"&&q.eat("{"))){re.tokenize=p;break}Ne=!Ne&&Ke=="\\"}return m("quasi","string.special",q.current())}var b="([{}])";function T(q,re){re.fatArrowAt&&(re.fatArrowAt=null);var Ne=q.string.indexOf("=>",q.start);if(!(Ne<0)){if(i){var Ke=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(q.string.slice(q.start,Ne));Ke&&(Ne=Ke.index)}for(var Ge=0,zt=!1,$r=Ne-1;$r>=0;--$r){var Rn=q.string.charAt($r),Ln=b.indexOf(Rn);if(Ln>=0&&Ln<3){if(!Ge){++$r;break}if(--Ge==0){Rn=="("&&(zt=!0);break}}else if(Ln>=3&&Ln<6)++Ge;else if(a.test(Rn))zt=!0;else if(/["'\/`]/.test(Rn))for(;;--$r){if($r==0)return;var ws=q.string.charAt($r-1);if(ws==Rn&&q.string.charAt($r-2)!="\\"){$r--;break}}else if(zt&&!Ge){++$r;break}}zt&&!Ge&&(re.fatArrowAt=$r)}}var v={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function A(q,re,Ne,Ke,Ge,zt){this.indented=q,this.column=re,this.type=Ne,this.prev=Ge,this.info=zt,Ke!=null&&(this.align=Ke)}function w(q,re){for(var Ne=q.localVars;Ne;Ne=Ne.next)if(Ne.name==re)return!0;for(var Ke=q.context;Ke;Ke=Ke.prev)for(var Ne=Ke.vars;Ne;Ne=Ne.next)if(Ne.name==re)return!0}function y(q,re,Ne,Ke,Ge){var zt=q.cc;for(E.state=q,E.stream=Ge,E.marked=null,E.cc=zt,E.style=re,q.lexical.hasOwnProperty("align")||(q.lexical.align=!0);;){var $r=zt.length?zt.pop():n?we:U;if($r(Ne,Ke)){for(;zt.length&&zt[zt.length-1].lex;)zt.pop()();return E.marked?E.marked:Ne=="variable"&&w(q,Ke)?"variableName.local":re}}}var E={state:null,column:null,marked:null,cc:null};function D(){for(var q=arguments.length-1;q>=0;q--)E.cc.push(arguments[q])}function _(){return D.apply(null,arguments),!0}function N(q,re){for(var Ne=re;Ne;Ne=Ne.next)if(Ne.name==q)return!0;return!1}function C(q){var re=E.state;if(E.marked="def",re.context){if(re.lexical.info=="var"&&re.context&&re.context.block){var Ne=B(q,re.context);if(Ne!=null){re.context=Ne;return}}else if(!N(q,re.localVars)){re.localVars=new L(q,re.localVars);return}}t.globalVars&&!N(q,re.globalVars)&&(re.globalVars=new L(q,re.globalVars))}function B(q,re){if(re)if(re.block){var Ne=B(q,re.prev);return Ne?Ne==re.prev?re:new V(Ne,re.vars,!0):null}else return N(q,re.vars)?re:new V(re.prev,new L(q,re.vars),!1);else return null}function R(q){return q=="public"||q=="private"||q=="protected"||q=="abstract"||q=="readonly"}function V(q,re,Ne){this.prev=q,this.vars=re,this.block=Ne}function L(q,re){this.name=q,this.next=re}var P=new L("this",new L("arguments",null));function k(){E.state.context=new V(E.state.context,E.state.localVars,!1),E.state.localVars=P}function W(){E.state.context=new V(E.state.context,E.state.localVars,!0),E.state.localVars=null}k.lex=W.lex=!0;function O(){E.state.localVars=E.state.context.vars,E.state.context=E.state.context.prev}O.lex=!0;function X(q,re){var Ne=function(){var Ke=E.state,Ge=Ke.indented;if(Ke.lexical.type=="stat")Ge=Ke.lexical.indented;else for(var zt=Ke.lexical;zt&&zt.type==")"&&zt.align;zt=zt.prev)Ge=zt.indented;Ke.lexical=new A(Ge,E.stream.column(),q,null,Ke.lexical,re)};return Ne.lex=!0,Ne}function ae(){var q=E.state;q.lexical.prev&&(q.lexical.type==")"&&(q.indented=q.lexical.indented),q.lexical=q.lexical.prev)}ae.lex=!0;function J(q){function re(Ne){return Ne==q?_():q==";"||Ne=="}"||Ne==")"||Ne=="]"?D():_(re)}return re}function U(q,re){return q=="var"?_(X("vardef",re),_r,J(";"),ae):q=="keyword a"?_(X("form"),be,U,ae):q=="keyword b"?_(X("form"),U,ae):q=="keyword d"?E.stream.match(/^\s*$/,!1)?_():_(X("stat"),j,J(";"),ae):q=="debugger"?_(J(";")):q=="{"?_(X("}"),W,Jt,ae,O):q==";"?_():q=="if"?(E.state.lexical.info=="else"&&E.state.cc[E.state.cc.length-1]==ae&&E.state.cc.pop()(),_(X("form"),be,U,ae,gr)):q=="function"?_(Ka):q=="for"?_(X("form"),W,lu,U,O,ae):q=="class"||i&&re=="interface"?(E.marked="keyword",_(X("form",q=="class"?q:re),hn,ae)):q=="variable"?i&&re=="declare"?(E.marked="keyword",_(U)):i&&(re=="module"||re=="enum"||re=="type")&&E.stream.match(/^\s*\w/,!1)?(E.marked="keyword",re=="enum"?_(fc):re=="type"?_(Bn,J("operator"),he,J(";")):_(X("form"),qe,J("{"),X("}"),Jt,ae,ae)):i&&re=="namespace"?(E.marked="keyword",_(X("form"),we,U,ae)):i&&re=="abstract"?(E.marked="keyword",_(U)):_(X("stat"),Ee):q=="switch"?_(X("form"),be,J("{"),X("}","switch"),W,Jt,ae,ae,O):q=="case"?_(we,J(":")):q=="default"?_(J(":")):q=="catch"?_(X("form"),k,de,U,ae,O):q=="export"?_(X("stat"),Qf,ae):q=="import"?_(X("stat"),xs,ae):q=="async"?_(U):re=="@"?_(we,U):D(X("stat"),we,J(";"),ae)}function de(q){if(q=="(")return _(Zn,J(")"))}function we(q,re){return K(q,re,!1)}function se(q,re){return K(q,re,!0)}function be(q){return q!="("?D():_(X(")"),j,J(")"),ae)}function K(q,re,Ne){if(E.state.fatArrowAt==E.stream.start){var Ke=Ne?G:_e;if(q=="(")return _(k,X(")"),Ye(Zn,")"),ae,J("=>"),Ke,O);if(q=="variable")return D(k,qe,J("=>"),Ke,O)}var Ge=Ne?pe:ne;return v.hasOwnProperty(q)?_(Ge):q=="function"?_(Ka,Ge):q=="class"||i&&re=="interface"?(E.marked="keyword",_(X("form"),oa,ae)):q=="keyword c"||q=="async"?_(Ne?se:we):q=="("?_(X(")"),j,J(")"),ae,Ge):q=="operator"||q=="spread"?_(Ne?se:we):q=="["?_(X("]"),cc,ae,Ge):q=="{"?ur(Ve,"}",null,Ge):q=="quasi"?D(fe,Ge):q=="new"?_(Z(Ne)):_()}function j(q){return q.match(/[;\}\)\],]/)?D():D(we)}function ne(q,re){return q==","?_(j):pe(q,re,!1)}function pe(q,re,Ne){var Ke=Ne==!1?ne:pe,Ge=Ne==!1?we:se;if(q=="=>")return _(k,Ne?G:_e,O);if(q=="operator")return/\+\+|--/.test(re)||i&&re=="!"?_(Ke):i&&re=="<"&&E.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?_(X(">"),Ye(he,">"),ae,Ke):re=="?"?_(we,J(":"),Ge):_(Ge);if(q=="quasi")return D(fe,Ke);if(q!=";"){if(q=="(")return ur(se,")","call",Ke);if(q==".")return _(Be,Ke);if(q=="[")return _(X("]"),j,J("]"),ae,Ke);if(i&&re=="as")return E.marked="keyword",_(he,Ke);if(q=="regexp")return E.state.lastType=E.marked="operator",E.stream.backUp(E.stream.pos-E.stream.start-1),_(Ge)}}function fe(q,re){return q!="quasi"?D():re.slice(re.length-2)!="${"?_(fe):_(j,Ae)}function Ae(q){if(q=="}")return E.marked="string.special",E.state.tokenize=x,_(fe)}function _e(q){return T(E.stream,E.state),D(q=="{"?U:we)}function G(q){return T(E.stream,E.state),D(q=="{"?U:se)}function Z(q){return function(re){return re=="."?_(q?xe:ge):re=="variable"&&i?_(Ce,q?pe:ne):D(q?se:we)}}function ge(q,re){if(re=="target")return E.marked="keyword",_(ne)}function xe(q,re){if(re=="target")return E.marked="keyword",_(pe)}function Ee(q){return q==":"?_(ae,U):D(ne,J(";"),ae)}function Be(q){if(q=="variable")return E.marked="property",_()}function Ve(q,re){if(q=="async")return E.marked="property",_(Ve);if(q=="variable"||E.style=="keyword"){if(E.marked="property",re=="get"||re=="set")return _(et);var Ne;return i&&E.state.fatArrowAt==E.stream.start&&(Ne=E.stream.match(/^\s*:\s*/,!1))&&(E.state.fatArrowAt=E.stream.pos+Ne[0].length),_(St)}else{if(q=="number"||q=="string")return E.marked=r?"property":E.style+" property",_(St);if(q=="jsonld-keyword")return _(St);if(i&&R(re))return E.marked="keyword",_(Ve);if(q=="[")return _(we,He,J("]"),St);if(q=="spread")return _(se,St);if(re=="*")return E.marked="keyword",_(Ve);if(q==":")return D(St)}}function et(q){return q!="variable"?D(St):(E.marked="property",_(Ka))}function St(q){if(q==":")return _(se);if(q=="(")return D(Ka)}function Ye(q,re,Ne){function Ke(Ge,zt){if(Ne?Ne.indexOf(Ge)>-1:Ge==","){var $r=E.state.lexical;return $r.info=="call"&&($r.pos=($r.pos||0)+1),_(function(Rn,Ln){return Rn==re||Ln==re?D():D(q)},Ke)}return Ge==re||zt==re?_():Ne&&Ne.indexOf(";")>-1?D(q):_(J(re))}return function(Ge,zt){return Ge==re||zt==re?_():D(q,Ke)}}function ur(q,re,Ne){for(var Ke=3;Ke<arguments.length;Ke++)E.cc.push(arguments[Ke]);return _(X(re,Ne),Ye(q,re),ae)}function Jt(q){return q=="}"?_():D(U,Jt)}function He(q,re){if(i){if(q==":")return _(he);if(re=="?")return _(He)}}function at(q,re){if(i&&(q==":"||re=="in"))return _(he)}function Q(q){if(i&&q==":")return E.stream.match(/^\s*\w+\s+is\b/,!1)?_(we,me,he):_(he)}function me(q,re){if(re=="is")return E.marked="keyword",_()}function he(q,re){if(re=="keyof"||re=="typeof"||re=="infer"||re=="readonly")return E.marked="keyword",_(re=="typeof"?se:he);if(q=="variable"||re=="void")return E.marked="type",_(ie);if(re=="|"||re=="&")return _(he);if(q=="string"||q=="number"||q=="atom")return _(ie);if(q=="[")return _(X("]"),Ye(he,"]",","),ae,ie);if(q=="{")return _(X("}"),ke,ae,ie);if(q=="(")return _(Ye(Y,")"),Fe,ie);if(q=="<")return _(Ye(he,">"),he);if(q=="quasi")return D(Xe,ie)}function Fe(q){if(q=="=>")return _(he)}function ke(q){return q.match(/[\}\)\]]/)?_():q==","||q==";"?_(ke):D(Se,ke)}function Se(q,re){if(q=="variable"||E.style=="keyword")return E.marked="property",_(Se);if(re=="?"||q=="number"||q=="string")return _(Se);if(q==":")return _(he);if(q=="[")return _(J("variable"),at,J("]"),Se);if(q=="(")return D(Da,Se);if(!q.match(/[;\}\)\],]/))return _()}function Xe(q,re){return q!="quasi"?D():re.slice(re.length-2)!="${"?_(Xe):_(he,F)}function F(q){if(q=="}")return E.marked="string.special",E.state.tokenize=x,_(Xe)}function Y(q,re){return q=="variable"&&E.stream.match(/^\s*[?:]/,!1)||re=="?"?_(Y):q==":"?_(he):q=="spread"?_(Y):D(he)}function ie(q,re){if(re=="<")return _(X(">"),Ye(he,">"),ae,ie);if(re=="|"||q=="."||re=="&")return _(he);if(q=="[")return _(he,J("]"),ie);if(re=="extends"||re=="implements")return E.marked="keyword",_(he);if(re=="?")return _(he,J(":"),he)}function Ce(q,re){if(re=="<")return _(X(">"),Ye(he,">"),ae,ie)}function tt(){return D(he,xt)}function xt(q,re){if(re=="=")return _(he)}function _r(q,re){return re=="enum"?(E.marked="keyword",_(fc)):D(qe,He,un,jn)}function qe(q,re){if(i&&R(re))return E.marked="keyword",_(qe);if(q=="variable")return C(re),_();if(q=="spread")return _(qe);if(q=="[")return ur(Gi,"]");if(q=="{")return ur(Ti,"}")}function Ti(q,re){return q=="variable"&&!E.stream.match(/^\s*:/,!1)?(C(re),_(un)):(q=="variable"&&(E.marked="property"),q=="spread"?_(qe):q=="}"?D():q=="["?_(we,J("]"),J(":"),Ti):_(J(":"),qe,un))}function Gi(){return D(qe,un)}function un(q,re){if(re=="=")return _(se)}function jn(q){if(q==",")return _(_r)}function gr(q,re){if(q=="keyword b"&&re=="else")return _(X("form","else"),U,ae)}function lu(q,re){if(re=="await")return _(lu);if(q=="(")return _(X(")"),kr,ae)}function kr(q){return q=="var"?_(_r,aa):q=="variable"?_(aa):D(aa)}function aa(q,re){return q==")"?_():q==";"?_(aa):re=="in"||re=="of"?(E.marked="keyword",_(we,aa)):D(we,aa)}function Ka(q,re){if(re=="*")return E.marked="keyword",_(Ka);if(q=="variable")return C(re),_(Ka);if(q=="(")return _(k,X(")"),Ye(Zn,")"),ae,Q,U,O);if(i&&re=="<")return _(X(">"),Ye(tt,">"),ae,Ka)}function Da(q,re){if(re=="*")return E.marked="keyword",_(Da);if(q=="variable")return C(re),_(Da);if(q=="(")return _(k,X(")"),Ye(Zn,")"),ae,Q,O);if(i&&re=="<")return _(X(">"),Ye(tt,">"),ae,Da)}function Bn(q,re){if(q=="keyword"||q=="variable")return E.marked="type",_(Bn);if(re=="<")return _(X(">"),Ye(tt,">"),ae)}function Zn(q,re){return re=="@"&&_(we,Zn),q=="spread"?_(Zn):i&&R(re)?(E.marked="keyword",_(Zn)):i&&q=="this"?_(He,un):D(qe,He,un)}function oa(q,re){return q=="variable"?hn(q,re):ii(q,re)}function hn(q,re){if(q=="variable")return C(re),_(ii)}function ii(q,re){if(re=="<")return _(X(">"),Ye(tt,">"),ae,ii);if(re=="extends"||re=="implements"||i&&q==",")return re=="implements"&&(E.marked="keyword"),_(i?he:we,ii);if(q=="{")return _(X("}"),kn,ae)}function kn(q,re){if(q=="async"||q=="variable"&&(re=="static"||re=="get"||re=="set"||i&&R(re))&&E.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return E.marked="keyword",_(kn);if(q=="variable"||E.style=="keyword")return E.marked="property",_(sa,kn);if(q=="number"||q=="string")return _(sa,kn);if(q=="[")return _(we,He,J("]"),sa,kn);if(re=="*")return E.marked="keyword",_(kn);if(i&&q=="(")return D(Da,kn);if(q==";"||q==",")return _(kn);if(q=="}")return _();if(re=="@")return _(we,kn)}function sa(q,re){if(re=="!"||re=="?")return _(sa);if(q==":")return _(he,un);if(re=="=")return _(se);var Ne=E.state.lexical.prev,Ke=Ne&&Ne.info=="interface";return D(Ke?Da:Ka)}function Qf(q,re){return re=="*"?(E.marked="keyword",_(Do,J(";"))):re=="default"?(E.marked="keyword",_(we,J(";"))):q=="{"?_(Ye(uc,"}"),Do,J(";")):D(U)}function uc(q,re){if(re=="as")return E.marked="keyword",_(J("variable"));if(q=="variable")return D(se,uc)}function xs(q){return q=="string"?_():q=="("?D(we):q=="."?D(ne):D(bs,lc,Do)}function bs(q,re){return q=="{"?ur(bs,"}"):(q=="variable"&&C(re),re=="*"&&(E.marked="keyword"),_(Ko))}function lc(q){if(q==",")return _(bs,lc)}function Ko(q,re){if(re=="as")return E.marked="keyword",_(bs)}function Do(q,re){if(re=="from")return E.marked="keyword",_(we)}function cc(q){return q=="]"?_():D(Ye(se,"]"))}function fc(){return D(X("form"),qe,J("{"),X("}"),Ye(Kf,"}"),ae,ae)}function Kf(){return D(qe,un)}function ep(q,re){return q.lastType=="operator"||q.lastType==","||s.test(re.charAt(0))||/[,.]/.test(re.charAt(0))}function ln(q,re,Ne){return re.tokenize==p&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(re.lastType)||re.lastType=="quasi"&&/\{\s*$/.test(q.string.slice(0,q.pos-(Ne||0)))}return{name:t.name,startState:function(q){var re={tokenize:p,lastType:"sof",cc:[],lexical:new A(-q,0,"block",!1),localVars:t.localVars,context:t.localVars&&new V(null,null,!1),indented:0};return t.globalVars&&typeof t.globalVars=="object"&&(re.globalVars=t.globalVars),re},token:function(q,re){if(q.sol()&&(re.lexical.hasOwnProperty("align")||(re.lexical.align=!1),re.indented=q.indentation(),T(q,re)),re.tokenize!=h&&q.eatSpace())return null;var Ne=re.tokenize(q,re);return c=="comment"?Ne:(re.lastType=c=="operator"&&(f=="++"||f=="--")?"incdec":c,y(re,Ne,c,f,q))},indent:function(q,re,Ne){if(q.tokenize==h||q.tokenize==x)return null;if(q.tokenize!=p)return 0;var Ke=re&&re.charAt(0),Ge=q.lexical,zt;if(!/^\s*else\b/.test(re))for(var $r=q.cc.length-1;$r>=0;--$r){var Rn=q.cc[$r];if(Rn==ae)Ge=Ge.prev;else if(Rn!=gr&&Rn!=O)break}for(;(Ge.type=="stat"||Ge.type=="form")&&(Ke=="}"||(zt=q.cc[q.cc.length-1])&&(zt==ne||zt==pe)&&!/^[,\.=+\-*:?[\(]/.test(re));)Ge=Ge.prev;e&&Ge.type==")"&&Ge.prev.type=="stat"&&(Ge=Ge.prev);var Ln=Ge.type,ws=Ke==Ln;return Ln=="vardef"?Ge.indented+(q.lastType=="operator"||q.lastType==","?Ge.info.length+1:0):Ln=="form"&&Ke=="{"?Ge.indented:Ln=="form"?Ge.indented+Ne.unit:Ln=="stat"?Ge.indented+(ep(q,re)?e||Ne.unit:0):Ge.info=="switch"&&!ws&&t.doubleIndentSwitch!=!1?Ge.indented+(/^(?:case|default)\b/.test(re)?Ne.unit:2*Ne.unit):Ge.align?Ge.column+(ws?0:1):Ge.indented+(ws?0:Ne.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:n?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var dp=Md({name:"javascript"}),Iue=Md({name:"json",json:!0}),Pue=Md({name:"json",jsonld:!0}),Bue=Md({name:"typescript",typescript:!0});var uH=["true","false","on","off","yes","no"],lH=new RegExp("\\b(("+uH.join(")|(")+"))$","i"),hp={name:"yaml",token:function(t,e){var r=t.peek(),n=e.escaped;if(e.escaped=!1,r=="#"&&(t.pos==0||/\s/.test(t.string.charAt(t.pos-1))))return t.skipToEnd(),"comment";if(t.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&t.indentation()>e.keyCol)return t.skipToEnd(),"string";if(e.literal&&(e.literal=!1),t.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,t.match("---")||t.match("..."))return"def";if(t.match(/^\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return r=="{"?e.inlinePairs++:r=="}"?e.inlinePairs--:r=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!n&&r==",")return t.next(),"meta";if(e.inlinePairs>0&&!n&&r==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,t.next(),"meta";if(e.pairStart){if(t.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&t.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(t.match(lH))return"keyword"}return!e.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=t.indentation(),"atom"):e.pair&&t.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=r=="\\",t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};var Sc=class{constructor(e,r){this.range=e,this.tokenClass=r}};var nb=zr(ca());var Lt=class t{static sequence(...e){return nb.P.sequenceMap((...r)=>r.flat(2).filter(n=>n!==void 0),...e)}static separateBy(e,r){return t.sequence(e,t.sequence(r,e).many()).optional([])}static highlight(e,r){return e.node((n,i)=>[new Sc(i,r)])}static highlightStr(e,r){return t.highlight(nb.P.string(e),r)}};var Ps=class{constructor(e,r,n){this.str=e,this.highlights=r.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=n}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e;return this.str[this.parsingError.parseFailure.furthest.index]===`
`?e={index:this.parsingError.parseFailure.furthest.index+1,column:1,line:this.parsingError.parseFailure.furthest.line+1}:e={index:this.parsingError.parseFailure.furthest.index+1,column:this.parsingError.parseFailure.furthest.column+1,line:this.parsingError.parseFailure.furthest.line},[new Sc({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};function lF(t){if(!t.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",r=>({startState:()=>hp.startState?.(4),blankLine:i=>hp.blankLine?.(i,4),copyState:i=>hp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${hp.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",r=>({startState:()=>dp.startState?.(4),blankLine:i=>dp.blankLine?.(i,4),copyState:i=>dp.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${dp.token?.(i,a)}`}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",r=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let l=[i.string],u=1,c=i.lookAhead(u);for(;c!==void 0&&!e.test(c)&&(l.push(c),u+=1,c=i.lookAhead(u),!(u>100)););a.str=l.filter(m=>m.trim()!=="").join(`
`);let f=t.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new Ps(a.str,[]):(a.fieldType=f,a.highlights=t.api.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let s=a.highlights.getHighlights().filter(l=>l.range.from.line===a.line).find(l=>l.range.from.column===i.pos+1);return s===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<s.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${s.tokenClass}`)}}))}var ib=require("@codemirror/language"),pl=require("@codemirror/view");var Rd=require("obsidian");var cF=require("obsidian");var Bs=class{static checkSelectionOverlap(e,r,n){if(!e)return!1;for(let i of e.ranges)if(i.to>=r&&i.from<=n)return!0;return!1}static checkRangeOverlap(e,r,n,i){return e<=i&&n<=r}static getContent(e,r,n){return e.sliceDoc(r,n)}static getCurrentFile(e){return e.state.field(cF.editorInfoField).file}static existsDecorationBetween(e,r,n){let i=!1;return e.between(r,n,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,r,n,i){let a=!1;return e.between(n,i,(o,s,l)=>{l.spec.mb_widgetType===r&&(a=!0)}),a}};function fF(t){return pl.ViewPlugin.fromClass(class{constructor(e){this.component=new Rd.Component,this.component.load(),this.decorations=this.renderWidgets(e)??pl.Decoration.none,e.dom.addEventListener("click",r=>this.handleClick(r))}handleClick(e){if(e.target instanceof HTMLElement){let r=e.target;for(;r!==null;){if(r.classList.contains("mb-input")){e.stopPropagation();break}r=r.parentElement}}}isLivePreview(e){return e.field(Rd.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(r,n,i)=>zC.anyMatch(e.visibleRanges,o=>Bs.checkRangeOverlap(r,n,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:r,to:n}of e.visibleRanges)(0,ib.syntaxTree)(e.state).iterate({from:r,to:n,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,r){this.decorations.between(e.from-1,e.to+1,(n,i,a)=>{this.decorations=this.decorations.update({filterFrom:n,filterTo:i,filter:(o,s,l)=>{let u=l.spec;return r&&u.mb_widgetType===r?!0:(u.mb_unload?.(),!1)}})})}addDecoration(e,r,n,i,a){let o=e.from-1,s=e.to+1;if(Bs.existsDecorationOfTypeBetween(this.decorations,n,o,s))return;let l=Bs.getCurrentFile(r);if(!l)return;let u=this.renderWidget(e,a,n,i,l),c=Array.isArray(u)?u:[u];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,r){let n=new Set(r.type.name?.split("_"));if(n.has("inline-code")&&!n.has("formatting")){let i=Bs.checkSelectionOverlap(e.state.selection,r.from-1,r.to+1),a=this.readNode(e,r.from,r.to),o=this.isLivePreview(e.state),s=!i&&o;return{shouldRender:s,shouldHighlight:!s&&t.settings.enableSyntaxHighlighting,content:a.content,widgetType:a.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,r,n){let i=Bs.getContent(e.state,r,n);return{content:i,widgetType:t.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let r=Bs.getCurrentFile(e);if(!r)return;let n=[];for(let i of e.visibleRanges)(0,ib.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,s=this.getRenderInfo(e,o);if(!s.widgetType||!s.content)return;let l;s.shouldRender&&(l=this.renderWidget(o,s.widgetType,"field",s.content,r)),s.shouldHighlight&&(l=this.renderWidget(o,s.widgetType,"highlight",s.content,r)),l&&(Array.isArray(l)?n.push(...l):n.push(l))}});return pl.Decoration.set(n,!0)}renderWidget(e,r,n,i,a){if(n==="field"){let o=t.api.constructMDRCWidget(r,i,a.path,this.component);return pl.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return t.api.syntaxHighlighting.highlight(i,r,!1).getHighlights().map(s=>pl.Decoration.mark({class:`mb-highlight-${s.tokenClass}`}).range(e.from+s.range.from.index,e.from+s.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Qt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof Jn?this.errors.push(e):this.otherError=e,console.warn(e)):(console.trace(""),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(r=>r.errorLevel==="ERROR"||r.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var gp=zr(Ma()),vp=zr(ca());var vH=vp.P.sequenceMap((t,e,r,n)=>{let i=parseInt(t),a=parseInt(e),o=parseInt(r);return new Na(i,a,o,n)},gp.P_UTILS.digits().skip(vp.P.string(".")),gp.P_UTILS.digits().skip(vp.P.string(".")),gp.P_UTILS.digits(),vp.P.string("-").then(gp.P_UTILS.remaining()).optional()),Na=class t{constructor(e,r,n,i){this.major=e,this.minor=r,this.patch=n,this.prerelease=i}static fromString(e){return Xn(vH,e)}static lessThan(e,r){return e.major<r.major?!0:e.major>r.major?!1:e.minor<r.minor?!0:e.minor>r.minor?!1:e.patch<r.patch?!0:e.patch>r.patch||e.prerelease===void 0?!1:r.prerelease===void 0?!0:e.prerelease<r.prerelease}static greaterThan(e,r){return t.lessThan(r,e)}static equals(e,r){return e.major===r.major&&e.minor===r.minor&&e.patch===r.patch&&e.prerelease===r.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var Ld=class{constructor(e,r){this.plugin=e,this.dependencies=r}getDependency(e){let r=this.dependencies.find(n=>n.pluginId===e);if(r===void 0)throw new ll({errorLevel:"CRITICAL",effect:"Dependency violation detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return r}getPlugin(e){return this.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new ll({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,r){if(Na.lessThan(r,e.minVersion))throw new ll({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${r}. Please update the plugin.`});if(e.maxVersion!==void 0&&(Na.greaterThan(r,e.maxVersion)||Na.equals(r,e.maxVersion)))throw new ll({errorLevel:"ERROR",effect:"Dependency violation detected",cause:`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${r}. Please downgrade the plugin.`})}checkDependency(e){let r=this.getDependency(e),n=this.getPlugin(e);if(n==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Na.fromString(n.manifest.version);return this.checkDependencyVersion(r,i),n}checkDependencyOnStartup(e){let r=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let n=Na.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(r,n)}checkDependenciesOnStartup(){let e=new Qt("Dependency Validation");for(let r of this.dependencies)if(r.checkOnStartup)try{this.checkDependencyOnStartup(r.pluginId)}catch(n){e.add(n)}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 gF=require("obsidian");var pF={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:""},ab={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 mF(t){let e=[];for(let[r,n]of Object.entries(pF)){if(n==="")continue;let i=t.api.inputFieldParser.fromString(`INPUT[${n}]`),a=t.api.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[r]}]});i=t.api.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${n}]`;let o=t.api.inputFieldParser.validate(i,"",void 0);e.push([r,o])}return e}function dF(t){let e=[];for(let[r,n]of Object.entries(pF)){if(n==="")continue;let i=r,a="";ud[i].allowInline?a=`\`INPUT[${n}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${n}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function hF(t){let e=[];for(let r of Object.values(ab))for(let n of r)e.push([n.title,`\`${n.display}\``]);return e.sort((r,n)=>r[0].localeCompare(n[0])),e}function vF(t,e,r){let n=dF(r),i=hF(r);t.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(s=>{s.setTitle("Input Field");let l=s.setSubmenu();for(let[u,c]of n)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Vd(e,c))})}),o.addItem(s=>{s.setTitle("View Field");let l=s.setSubmenu();for(let[u,c]of i)l.addItem(f=>{f.setTitle(u),f.onClick(()=>Vd(e,c))})}),o.addItem(s=>{s.setTitle("Inline Button"),s.onClick(()=>{Vd(e,"`BUTTON[example-id]`")})}),o.addItem(s=>{s.setTitle("Button"),s.onClick(()=>{r.internal.openButtonBuilderModal({onOkay:l=>{Vd(e,`\`\`\`meta-bind-button
${(0,gF.stringifyYaml)(l)}
\`\`\``)},submitText:"Insert"})})})})}function Vd(t,e){t.replaceSelection(e)}var m9=require("obsidian");var NF=zr(Ma());var Sn=zr(Ma()),lb=zr(ca());var _F=zr(Ma()),Zi=zr(ca());var yp=zr(Ma()),Fa=zr(ca()),Mi=Fa.P.sequence(Fa.P.or(yp.P_UTILS.unicodeLetter(),Fa.P.oneOf("_$")),Fa.P.or(yp.P_UTILS.unicodeAlphanumeric(),Fa.P.oneOf("-_$")).many()).map(t=>t[0]+t[1].join("")).describe("identifier"),yF=Fa.P.sequenceMap((t,e)=>t+e.map(r=>r[0]+r[1]).join(""),Mi,Fa.P.sequence(yp.P_UTILS.optionalWhitespace(),Mi).many()).describe("identifier with spaces"),yH=Fa.P.string("\\").then(yp.P_UTILS.any()).map(t=>t==="'"?"'":t==="\\"?"\\":"\\"+t);function xF(t){return Fa.P.or(yH,Fa.P.noneOf(t+"\\")).many().map(e=>e.join("")).trim(Fa.P.string(t))}var Ud=xF("'"),bF=xF('"'),Dc=Fa.P.manyNotOf("{}[]#^|:?").box("file path");function ji(t,e){return{value:t,position:e}}function Ia(t){if(t!==void 0)return typeof t=="string"?{value:t}:t}var dl=(r=>(r.OBJECT="object",r.ARRAY="array",r))(dl||{}),qd=class{constructor(e,r,n){this.parent=e,this.access=r,this.child=n}};function xH(t,e){return t[e]}function wF(t,e,r){t[e]=r}var ml=class{constructor(e,r){if(this.type=e,this.prop=e==="object"?r:"",this.index=e==="array"?Number(r):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new qd(e,this,xH(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 qd(e,this,e[this.index])}}set(e,r){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(e,this.prop,r)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=r}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");wF(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 AF=Mi.node((t,e)=>({type:"object",prop:ji(t,e)})),ob=Zi.P.or(_F.P_UTILS.digits().wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"array",prop:ji(t,e)})),bF.wrap(Zi.P.string("["),Zi.P.string("]")).node((t,e)=>({type:"object",prop:ji(t,e)}))),bH=Zi.P.or(Zi.P.sequenceMap(t=>({storagePath:void 0,listenToChildren:!1,storageProp:t}),ob.atLeast(1)),Zi.P.sequenceMap((t,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[t,...e]}),AF,ob.many())),wH=Zi.P.sequenceMap((t,e)=>[t,...e],AF,ob.many()),sb=Zi.P.sequenceMap((t,e)=>(t.storageProp=t.storageProp.concat(e.flat()),t),bH,Zi.P.string(".").then(wH).many()),rs=Zi.P.sequenceMap((t,e,r)=>(r.storageType=t,r.storagePath=e,r),Mi.describe("storage type").node(ji).skip(Zi.P.string("^").describe('storage type separator "^"')).optional(),Dc.describe("storage path").node(ji).skip(Zi.P.string("#").describe('storage/file path separator "#"')).optional(),sb.describe("property path")).box("bind target");var zd=zr(Ma()),ns=zr(ca());var ub=ns.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),_H=ns.P.or(Ud,ub).node(ji),AH=ns.P.separateBy(_H,ns.P.string(",").describe('argument value separator ","').trim(zd.P_UTILS.optionalWhitespace())),SH=ns.P.sequenceMap((t,e)=>({name:t,value:e}),Mi.node(ji),AH.trim(zd.P_UTILS.optionalWhitespace()).wrap(ns.P.string("(").describe('argument value paren "("'),ns.P.string(")").describe('argument value paren ")"')).optional([])),xp=ns.P.separateBy(SH,ns.P.string(",").describe('argument separator ","').trim(zd.P_UTILS.optionalWhitespace()));var fa=zr(Ma()),Un=zr(ca());var EH=Un.P.string("\\").then(fa.P_UTILS.any()).map(t=>t==="["?"[":t==="]"?"]":t==="{"?"{":t==="}"?"}":t==="\\"?"\\":"\\"+t),Hd=Un.P.sequenceMap((t,e)=>t+e.flat().join(""),Un.P.manyNotOf("{}[]\\"),Un.P.sequence(EH,Un.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),TH=Un.P.sequenceMap((t,e)=>[t,...e.flat()],Hd,Un.P.sequence(rs.wrapString("{","}"),Hd).many()),DH=Un.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{viewFieldType:t,writeToBindTarget:n,arguments:e,templateDeclaration:void 0}},Mi.node(ji).trim(fa.P_UTILS.optionalWhitespace()).optional().describe("input field type"),xp.trim(fa.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(fa.P_UTILS.optionalWhitespace()).optional([]),Un.P.sequence(Un.P.string(":").trim(fa.P_UTILS.optionalWhitespace()),rs).trim(fa.P_UTILS.optionalWhitespace()).optional()),SF=Un.P.sequenceMap((t,e,r,n)=>n===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(n.templateDeclaration=e,n),Un.P.string("VIEW"),TH.wrapString("[","]"),fa.P_UTILS.optionalWhitespace(),DH.wrapString("[","]").optional(),fa.P_UTILS.eof()),MH=Un.P.sequenceMap((t,e,r,n)=>(e!==void 0&&(t.listenToChildren=!0),{bindTarget:t,name:n}),rs.wrapString("{","}"),Un.P.string(" and children").optional(),Un.P.string(" as "),Mi),EF=Un.P.sequenceMap((t,e,r,n)=>({bindTargetMappings:t,writeToBindTarget:e,hidden:r!==void 0,code:n}),MH.separateBy(fa.P_UTILS.whitespace()).skip(fa.P_UTILS.whitespace()),Un.P.string("save to ").then(rs.wrapString("{","}")).skip(fa.P_UTILS.whitespace()).optional(),Un.P.string("hidden").skip(fa.P_UTILS.whitespace()).optional(),Un.P.string("---").then(fa.P_UTILS.remaining()));var cb=Lt.highlight(Mi,"ident"),Gd=Lt.highlight(Mi,"keyword"),fb=Lt.highlightStr(",","control"),Wd=Lt.highlightStr("(","control"),Yd=Lt.highlightStr(")","control"),Mc=Lt.highlightStr("[","control"),Cc=Lt.highlightStr("]","control"),CH=Lt.highlight(Ud,"string"),NH=Lt.highlight(ub,"ident"),FH=lb.P.or(NH,CH),IH=Lt.separateBy(FH,fb.trim(Sn.P_UTILS.optionalWhitespace())),PH=Lt.sequence(Gd,Lt.sequence(Wd,IH.trim(Sn.P_UTILS.optionalWhitespace()),Yd).optional()),pb=Lt.separateBy(PH,fb.trim(Sn.P_UTILS.optionalWhitespace())),Nc=Lt.sequence(Lt.sequence(cb,Lt.highlightStr("^","control")).optional(),Lt.sequence(Lt.highlight(Dc,"ident"),Lt.highlightStr("#","control")).optional(),Lt.highlight(sb,"ident")),BH=Lt.sequence(Gd.trim(Sn.P_UTILS.optionalWhitespace()),Lt.sequence(Wd,pb.trim(Sn.P_UTILS.optionalWhitespace()),Yd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Lt.sequence(Lt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Nc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),kH=Lt.sequence(Gd.trim(Sn.P_UTILS.optionalWhitespace()).optional(),Lt.sequence(Wd,pb.trim(Sn.P_UTILS.optionalWhitespace()),Yd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Lt.sequence(Lt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Nc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),DF=lb.P.or(Lt.sequence(Lt.highlightStr("INPUT","control"),Mc,cb.trim(Sn.P_UTILS.optionalWhitespace()),Cc.skip(Sn.P_UTILS.optionalWhitespace()),Mc,kH,Cc),Lt.sequence(Lt.highlightStr("INPUT","control"),Mc,BH,Cc)),TF=Lt.highlight(Hd,"ident"),$H=Lt.sequence(Lt.highlightStr("{","string"),Nc,Lt.highlightStr("}","string")),OH=Lt.sequence(TF,Lt.sequence($H,TF).many()),RH=Lt.sequence(Gd.trim(Sn.P_UTILS.optionalWhitespace()).optional(),Lt.sequence(Wd,pb.trim(Sn.P_UTILS.optionalWhitespace()).optional(),Yd).trim(Sn.P_UTILS.optionalWhitespace()).optional(),Lt.sequence(Lt.highlightStr(":","control").trim(Sn.P_UTILS.optionalWhitespace()),Nc).trim(Sn.P_UTILS.optionalWhitespace()).optional()),MF=Lt.sequence(Lt.highlightStr("VIEW","control"),Mc,OH,Cc,Lt.sequence(Mc.skip(Sn.P_UTILS.optionalWhitespace()),RH,Cc).optional()),CF=Lt.sequence(Lt.highlightStr("BUTTON","control"),Mc,Lt.separateBy(cb,fb.trim(Sn.P_UTILS.optionalWhitespace())),Cc);var jd=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,r){return this.highlightWithParser(e,r,DF)}highlightViewFieldDeclaration(e,r){return this.highlightWithParser(e,r,MF)}highlightInlineButtonDeclaration(e,r){return this.highlightWithParser(e,r,CF)}highlight(e,r,n){if(r==="INPUT")return this.highlightInputFieldDeclaration(e,n);if(r==="VIEW")return this.highlightViewFieldDeclaration(e,n);if(r==="BUTTON_GROUP")return this.highlightInlineButtonDeclaration(e,n);throw new Error(`Unknown MDRCType ${r}`)}highlightBindTarget(e,r){return this.highlightWithParser(e,r,Nc)}highlightWithParser(e,r,n){try{return r?new Ps(e,Xn(n.trim(NF.P_UTILS.optionalWhitespace()).thenEof(),e)):new Ps(e,Xn(n.thenEof(),e))}catch(i){return i instanceof up?new Ps(e,[],i):(console.error(i),new Ps(e,[]))}}};var on=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(on||{}),Kn=(d=>(d.COMMAND="command",d.JS="js",d.OPEN="open",d.INPUT="input",d.SLEEP="sleep",d.TEMPLATER_CREATE_NOTE="templaterCreateNote",d.RUN_TEMPLATER_FILE="runTemplaterFile",d.UPDATE_METADATA="updateMetadata",d.CREATE_NOTE="createNote",d.REPLACE_IN_NOTE="replaceInNote",d.REGEXP_REPLACE_IN_NOTE="regexpReplaceInNote",d.REPLACE_SELF="replaceSelf",d.INSERT_INTO_NOTE="insertIntoNote",d.INLINE_JS="inlineJS",d))(Kn||{});var Ir;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.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},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ir||(Ir={}));var db;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(db||(db={}));var dt=Ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$s=t=>{switch(typeof t){case"undefined":return dt.undefined;case"string":return dt.string;case"number":return isNaN(t)?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(t)?dt.array:t===null?dt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?dt.promise:typeof Map<"u"&&t instanceof Map?dt.map:typeof Set<"u"&&t instanceof Set?dt.set:typeof Date<"u"&&t instanceof Date?dt.date:dt.object;default:return dt.unknown}},Ue=Ir.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"]),LH=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Pa=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let u=o.path[l];l===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ir.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Pa.create=t=>new Pa(t);var Pc=(t,e)=>{let r;switch(t.code){case Ue.invalid_type:t.received===dt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ir.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ir.joinValues(t.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ir.joinValues(t.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${Ir.joinValues(t.options)}, received '${t.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ir.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ue.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ue.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ir.assertNever(t)}return{message:r}},PF=Pc;function VH(t){PF=t}function Zd(){return PF}var Jd=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(u=>!!u).slice().reverse();for(let u of l)s=u(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},UH=[];function ct(t,e){let r=Zd(),n=Jd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Pc?void 0:Pc].filter(i=>!!i)});t.common.issues.push(n)}var Ci=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Zt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Zt;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Zt=Object.freeze({status:"aborted"}),Ic=t=>({status:"dirty",value:t}),Ji=t=>({status:"valid",value:t}),hb=t=>t.status==="aborted",gb=t=>t.status==="dirty",hl=t=>t.status==="valid",_p=t=>typeof Promise<"u"&&t instanceof Promise;function Xd(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function BF(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var Mt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Mt||(Mt={}));var bp,wp,io=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},FF=(t,e)=>{if(hl(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Pa(t.common.issues);return this._error=r,this._error}}};function mr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{var l,u;let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(l=c??n)!==null&&l!==void 0?l:s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??r)!==null&&u!==void 0?u:s.defaultError}},description:i}}var dr=class{get description(){return this._def.description}_getType(e){return $s(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:$s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ci,ctx:{common:e.parent.common,data:e.data,parsedType:$s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(_p(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$s(e)},a=this._parseSync({data:e,path:i.path,parent:i});return FF(i,a)}"~validate"(e){var r,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$s(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:i});return hl(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>hl(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$s(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(_p(i)?i:Promise.resolve(i));return FF(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:Ue.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Ba({schema:this,typeName:Wt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return no.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rs.create(this)}promise(){return yu.create(this,this._def)}or(e){return _l.create([this,e],this._def)}and(e){return Al.create(this,e,this._def)}transform(e){return new Ba({...mr(this._def),schema:this,typeName:Wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ml({...mr(this._def),innerType:this,defaultValue:r,typeName:Wt.ZodDefault})}brand(){return new Ap({typeName:Wt.ZodBranded,type:this,...mr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Cl({...mr(this._def),innerType:this,catchValue:r,typeName:Wt.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Sp.create(this,e)}readonly(){return Nl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qH=/^c[^\s-]{8,}$/i,zH=/^[0-9a-z]+$/,HH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,GH=/^[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,WH=/^[a-z0-9_-]{21}$/i,YH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jH=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ZH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",mb,XH=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,QH=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,KH=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kF="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",nG=new RegExp(`^${kF}$`);function $F(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function iG(t){return new RegExp(`^${$F(t)}$`)}function OF(t){let e=`${kF}T${$F(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function aG(t,e){return!!((e==="v4"||!e)&&XH.test(t)||(e==="v6"||!e)&&KH.test(t))}function oG(t,e){if(!YH.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function sG(t,e){return!!((e==="v4"||!e)&&QH.test(t)||(e==="v6"||!e)&&eG.test(t))}var gu=class t extends dr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dt.string){let a=this._getOrReturnCtx(e);return ct(a,{code:Ue.invalid_type,expected:dt.string,received:a.parsedType}),Zt}let n=new Ci,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?ct(i,{code:Ue.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&ct(i,{code:Ue.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ZH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"email",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")mb||(mb=new RegExp(JH,"u")),mb.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"emoji",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")GH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"uuid",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")WH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"nanoid",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")qH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"cuid",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")zH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"cuid2",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")HH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"ulid",code:Ue.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ct(i,{validation:"url",code:Ue.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"regex",code:Ue.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?OF(a).test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?nG.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?iG(a).test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?jH.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"duration",code:Ue.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?aG(e.data,a.version)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"ip",code:Ue.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?oG(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"jwt",code:Ue.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?sG(e.data,a.version)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"cidr",code:Ue.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?tG.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"base64",code:Ue.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?rG.test(e.data)||(i=this._getOrReturnCtx(e,i),ct(i,{validation:"base64url",code:Ue.invalid_string,message:a.message}),n.dirty()):Ir.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Ue.invalid_string,...Mt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Mt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Mt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Mt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Mt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Mt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Mt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Mt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Mt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Mt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Mt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Mt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Mt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Mt.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Mt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Mt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Mt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Mt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Mt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Mt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Mt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Mt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Mt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Mt.errToObj(r)})}nonempty(e){return this.min(1,Mt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};gu.create=t=>{var e;return new gu({checks:[],typeName:Wt.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...mr(t)})};function uG(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var gl=class t extends dr{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 ct(a,{code:Ue.invalid_type,expected:dt.number,received:a.parsedType}),Zt}let n,i=new Ci;for(let a of this._def.checks)a.kind==="int"?Ir.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?uG(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.not_finite,message:a.message}),i.dirty()):Ir.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Mt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mt.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Mt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Mt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Mt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Mt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Mt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ir.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};gl.create=t=>new gl({checks:[],typeName:Wt.ZodNumber,coerce:t?.coerce||!1,...mr(t)});var vl=class t extends dr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==dt.bigint)return this._getInvalidInput(e);let n,i=new Ci;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ct(n,{code:Ue.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ir.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ct(r,{code:Ue.invalid_type,expected:dt.bigint,received:r.parsedType}),Zt}gte(e,r){return this.setLimit("min",e,!0,Mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Mt.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mt.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Mt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};vl.create=t=>{var e;return new vl({checks:[],typeName:Wt.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...mr(t)})};var yl=class extends dr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dt.boolean){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.boolean,received:n.parsedType}),Zt}return Ji(e.data)}};yl.create=t=>new yl({typeName:Wt.ZodBoolean,coerce:t?.coerce||!1,...mr(t)});var xl=class t extends dr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dt.date){let a=this._getOrReturnCtx(e);return ct(a,{code:Ue.invalid_type,expected:dt.date,received:a.parsedType}),Zt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return ct(a,{code:Ue.invalid_date}),Zt}let n=new Ci,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),ct(i,{code:Ue.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ir.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Mt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Mt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};xl.create=t=>new xl({checks:[],coerce:t?.coerce||!1,typeName:Wt.ZodDate,...mr(t)});var Bc=class extends dr{_parse(e){if(this._getType(e)!==dt.symbol){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.symbol,received:n.parsedType}),Zt}return Ji(e.data)}};Bc.create=t=>new Bc({typeName:Wt.ZodSymbol,...mr(t)});var bl=class extends dr{_parse(e){if(this._getType(e)!==dt.undefined){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.undefined,received:n.parsedType}),Zt}return Ji(e.data)}};bl.create=t=>new bl({typeName:Wt.ZodUndefined,...mr(t)});var wl=class extends dr{_parse(e){if(this._getType(e)!==dt.null){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.null,received:n.parsedType}),Zt}return Ji(e.data)}};wl.create=t=>new wl({typeName:Wt.ZodNull,...mr(t)});var vu=class extends dr{constructor(){super(...arguments),this._any=!0}_parse(e){return Ji(e.data)}};vu.create=t=>new vu({typeName:Wt.ZodAny,...mr(t)});var Os=class extends dr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ji(e.data)}};Os.create=t=>new Os({typeName:Wt.ZodUnknown,...mr(t)});var Bo=class extends dr{_parse(e){let r=this._getOrReturnCtx(e);return ct(r,{code:Ue.invalid_type,expected:dt.never,received:r.parsedType}),Zt}};Bo.create=t=>new Bo({typeName:Wt.ZodNever,...mr(t)});var kc=class extends dr{_parse(e){if(this._getType(e)!==dt.undefined){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.void,received:n.parsedType}),Zt}return Ji(e.data)}};kc.create=t=>new kc({typeName:Wt.ZodVoid,...mr(t)});var Rs=class t extends dr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==dt.array)return ct(r,{code:Ue.invalid_type,expected:dt.array,received:r.parsedType}),Zt;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(ct(r,{code:o?Ue.too_big:Ue.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(ct(r,{code:Ue.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(ct(r,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new io(r,o,r.path,s)))).then(o=>Ci.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new io(r,o,r.path,s)));return Ci.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Mt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Mt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Mt.toString(r)}})}nonempty(e){return this.min(1,e)}};Rs.create=(t,e)=>new Rs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Wt.ZodArray,...mr(e)});function Fc(t){if(t instanceof pa){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=no.create(Fc(n))}return new pa({...t._def,shape:()=>e})}else return t instanceof Rs?new Rs({...t._def,type:Fc(t.element)}):t instanceof no?no.create(Fc(t.unwrap())):t instanceof as?as.create(Fc(t.unwrap())):t instanceof is?is.create(t.items.map(e=>Fc(e))):t}var pa=class t extends dr{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(),r=Ir.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==dt.object){let u=this._getOrReturnCtx(e);return ct(u,{code:Ue.invalid_type,expected:dt.object,received:u.parsedType}),Zt}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Bo&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let l=[];for(let u of o){let c=a[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new io(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Bo){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(ct(i,{code:Ue.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of s){let f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new io(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let f=await c.key,m=await c.value;u.push({key:f,value:m,alwaysSet:c.alwaysSet})}return u}).then(u=>Ci.mergeObjectSync(n,u)):Ci.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Mt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,a,o,s;let l=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Mt.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Wt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Ir.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Ir.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return Fc(this)}partial(e){let r={};return Ir.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Ir.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof no;)a=a._def.innerType;r[n]=a}}),new t({...this._def,shape:()=>r})}keyof(){return RF(Ir.objectKeys(this.shape))}};pa.create=(t,e)=>new pa({shape:()=>t,unknownKeys:"strip",catchall:Bo.create(),typeName:Wt.ZodObject,...mr(e)});pa.strictCreate=(t,e)=>new pa({shape:()=>t,unknownKeys:"strict",catchall:Bo.create(),typeName:Wt.ZodObject,...mr(e)});pa.lazycreate=(t,e)=>new pa({shape:t,unknownKeys:"strip",catchall:Bo.create(),typeName:Wt.ZodObject,...mr(e)});var _l=class extends dr{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Pa(s.ctx.common.issues));return ct(r,{code:Ue.invalid_union,unionErrors:o}),Zt}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let u={...r,common:{...r.common,issues:[]},parent:null},c=l._parseSync({data:r.data,path:r.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new Pa(l));return ct(r,{code:Ue.invalid_union,unionErrors:s}),Zt}}get options(){return this._def.options}};_l.create=(t,e)=>new _l({options:t,typeName:Wt.ZodUnion,...mr(e)});var ks=t=>t instanceof Sl?ks(t.schema):t instanceof Ba?ks(t.innerType()):t instanceof El?[t.value]:t instanceof Tl?t.options:t instanceof Dl?Ir.objectValues(t.enum):t instanceof Ml?ks(t._def.innerType):t instanceof bl?[void 0]:t instanceof wl?[null]:t instanceof no?[void 0,...ks(t.unwrap())]:t instanceof as?[null,...ks(t.unwrap())]:t instanceof Ap||t instanceof Nl?ks(t.unwrap()):t instanceof Cl?ks(t._def.innerType):[],Qd=class t extends dr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.object)return ct(r,{code:Ue.invalid_type,expected:dt.object,received:r.parsedType}),Zt;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(ct(r,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Zt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=ks(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:Wt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...mr(n)})}};function vb(t,e){let r=$s(t),n=$s(e);if(t===e)return{valid:!0,data:t};if(r===dt.object&&n===dt.object){let i=Ir.objectKeys(e),a=Ir.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=vb(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===dt.array&&n===dt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=vb(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===dt.date&&n===dt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Al=class extends dr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(hb(a)||hb(o))return Zt;let s=vb(a.value,o.value);return s.valid?((gb(a)||gb(o))&&r.dirty(),{status:r.value,value:s.data}):(ct(n,{code:Ue.invalid_intersection_types}),Zt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Al.create=(t,e,r)=>new Al({left:t,right:e,typeName:Wt.ZodIntersection,...mr(r)});var is=class t extends dr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.array)return ct(n,{code:Ue.invalid_type,expected:dt.array,received:n.parsedType}),Zt;if(n.data.length<this._def.items.length)return ct(n,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zt;!this._def.rest&&n.data.length>this._def.items.length&&(ct(n,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new io(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>Ci.mergeArray(r,o)):Ci.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};is.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new is({items:t,typeName:Wt.ZodTuple,rest:null,...mr(e)})};var Kd=class t extends dr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.object)return ct(n,{code:Ue.invalid_type,expected:dt.object,received:n.parsedType}),Zt;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new io(n,s,n.path,s)),value:o._parse(new io(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ci.mergeObjectAsync(r,i):Ci.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof dr?new t({keyType:e,valueType:r,typeName:Wt.ZodRecord,...mr(n)}):new t({keyType:gu.create(),valueType:e,typeName:Wt.ZodRecord,...mr(r)})}},$c=class extends dr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.map)return ct(n,{code:Ue.invalid_type,expected:dt.map,received:n.parsedType}),Zt;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],u)=>({key:i._parse(new io(n,s,n.path,[u,"key"])),value:a._parse(new io(n,l,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return Zt;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return Zt;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}}}};$c.create=(t,e,r)=>new $c({valueType:e,keyType:t,typeName:Wt.ZodMap,...mr(r)});var Oc=class t extends dr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.set)return ct(n,{code:Ue.invalid_type,expected:dt.set,received:n.parsedType}),Zt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ct(n,{code:Ue.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(ct(n,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let u=new Set;for(let c of l){if(c.status==="aborted")return Zt;c.status==="dirty"&&r.dirty(),u.add(c.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((l,u)=>a._parse(new io(n,l,n.path,u)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Mt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Mt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Oc.create=(t,e)=>new Oc({valueType:t,minSize:null,maxSize:null,typeName:Wt.ZodSet,...mr(e)});var eh=class t extends dr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.function)return ct(r,{code:Ue.invalid_type,expected:dt.function,received:r.parsedType}),Zt;function n(s,l){return Jd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Zd(),Pc].filter(u=>!!u),issueData:{code:Ue.invalid_arguments,argumentsError:l}})}function i(s,l){return Jd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Zd(),Pc].filter(u=>!!u),issueData:{code:Ue.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof yu){let s=this;return Ji(async function(...l){let u=new Pa([]),c=await s._def.args.parseAsync(l,a).catch(p=>{throw u.addIssue(n(l,p)),u}),f=await Reflect.apply(o,this,c);return await s._def.returns._def.type.parseAsync(f,a).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{let s=this;return Ji(function(...l){let u=s._def.args.safeParse(l,a);if(!u.success)throw new Pa([n(l,u.error)]);let c=Reflect.apply(o,this,u.data),f=s._def.returns.safeParse(c,a);if(!f.success)throw new Pa([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:is.create(e).rest(Os.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||is.create([]).rest(Os.create()),returns:r||Os.create(),typeName:Wt.ZodFunction,...mr(n)})}},Sl=class extends dr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Sl.create=(t,e)=>new Sl({getter:t,typeName:Wt.ZodLazy,...mr(e)});var El=class extends dr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ct(r,{received:r.data,code:Ue.invalid_literal,expected:this._def.value}),Zt}return{status:"valid",value:e.data}}get value(){return this._def.value}};El.create=(t,e)=>new El({value:t,typeName:Wt.ZodLiteral,...mr(e)});function RF(t,e){return new Tl({values:t,typeName:Wt.ZodEnum,...mr(e)})}var Tl=class t extends dr{constructor(){super(...arguments),bp.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ct(r,{expected:Ir.joinValues(n),received:r.parsedType,code:Ue.invalid_type}),Zt}if(Xd(this,bp,"f")||BF(this,bp,new Set(this._def.values),"f"),!Xd(this,bp,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ct(r,{received:r.data,code:Ue.invalid_enum_value,options:n}),Zt}return Ji(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};bp=new WeakMap;Tl.create=RF;var Dl=class extends dr{constructor(){super(...arguments),wp.set(this,void 0)}_parse(e){let r=Ir.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==dt.string&&n.parsedType!==dt.number){let i=Ir.objectValues(r);return ct(n,{expected:Ir.joinValues(i),received:n.parsedType,code:Ue.invalid_type}),Zt}if(Xd(this,wp,"f")||BF(this,wp,new Set(Ir.getValidEnumValues(this._def.values)),"f"),!Xd(this,wp,"f").has(e.data)){let i=Ir.objectValues(r);return ct(n,{received:n.data,code:Ue.invalid_enum_value,options:i}),Zt}return Ji(e.data)}get enum(){return this._def.values}};wp=new WeakMap;Dl.create=(t,e)=>new Dl({values:t,typeName:Wt.ZodNativeEnum,...mr(e)});var yu=class extends dr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.promise&&r.common.async===!1)return ct(r,{code:Ue.invalid_type,expected:dt.promise,received:r.parsedType}),Zt;let n=r.parsedType===dt.promise?r.data:Promise.resolve(r.data);return Ji(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};yu.create=(t,e)=>new yu({type:t,typeName:Wt.ZodPromise,...mr(e)});var Ba=class extends dr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{ct(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return Zt;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Zt:l.status==="dirty"||r.value==="dirty"?Ic(l.value):l});{if(r.value==="aborted")return Zt;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Zt:s.status==="dirty"||r.value==="dirty"?Ic(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Zt:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Zt:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!hl(o))return o;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>hl(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):o);Ir.assertNever(i)}};Ba.create=(t,e,r)=>new Ba({schema:t,typeName:Wt.ZodEffects,effect:e,...mr(r)});Ba.createWithPreprocess=(t,e,r)=>new Ba({schema:e,effect:{type:"preprocess",transform:t},typeName:Wt.ZodEffects,...mr(r)});var no=class extends dr{_parse(e){return this._getType(e)===dt.undefined?Ji(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};no.create=(t,e)=>new no({innerType:t,typeName:Wt.ZodOptional,...mr(e)});var as=class extends dr{_parse(e){return this._getType(e)===dt.null?Ji(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};as.create=(t,e)=>new as({innerType:t,typeName:Wt.ZodNullable,...mr(e)});var Ml=class extends dr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===dt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ml.create=(t,e)=>new Ml({innerType:t,typeName:Wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...mr(e)});var Cl=class extends dr{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _p(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Pa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Cl.create=(t,e)=>new Cl({innerType:t,typeName:Wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...mr(e)});var Rc=class extends dr{_parse(e){if(this._getType(e)!==dt.nan){let n=this._getOrReturnCtx(e);return ct(n,{code:Ue.invalid_type,expected:dt.nan,received:n.parsedType}),Zt}return{status:"valid",value:e.data}}};Rc.create=t=>new Rc({typeName:Wt.ZodNaN,...mr(t)});var lG=Symbol("zod_brand"),Ap=class extends dr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Sp=class t extends dr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Zt:a.status==="dirty"?(r.dirty(),Ic(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Zt:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Wt.ZodPipeline})}},Nl=class extends dr{_parse(e){let r=this._def.innerType._parse(e),n=i=>(hl(i)&&(i.value=Object.freeze(i.value)),i);return _p(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Nl.create=(t,e)=>new Nl({innerType:t,typeName:Wt.ZodReadonly,...mr(e)});function LF(t,e={},r){return t?vu.create().superRefine((n,i)=>{var a,o;if(!t(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(o=(a=s.fatal)!==null&&a!==void 0?a:r)!==null&&o!==void 0?o:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):vu.create()}var cG={object:pa.lazycreate},Wt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Wt||(Wt={}));var fG=(t,e={message:`Input not instance of ${t.name}`})=>LF(r=>r instanceof t,e),VF=gu.create,UF=gl.create,pG=Rc.create,mG=vl.create,qF=yl.create,dG=xl.create,hG=Bc.create,gG=bl.create,vG=wl.create,yG=vu.create,xG=Os.create,bG=Bo.create,wG=kc.create,_G=Rs.create,AG=pa.create,SG=pa.strictCreate,EG=_l.create,TG=Qd.create,DG=Al.create,MG=is.create,CG=Kd.create,NG=$c.create,FG=Oc.create,IG=eh.create,PG=Sl.create,BG=El.create,kG=Tl.create,$G=Dl.create,OG=yu.create,IF=Ba.create,RG=no.create,LG=as.create,VG=Ba.createWithPreprocess,UG=Sp.create,qG=()=>VF().optional(),zG=()=>UF().optional(),HG=()=>qF().optional(),GG={string:t=>gu.create({...t,coerce:!0}),number:t=>gl.create({...t,coerce:!0}),boolean:t=>yl.create({...t,coerce:!0}),bigint:t=>vl.create({...t,coerce:!0}),date:t=>xl.create({...t,coerce:!0})},WG=Zt,ve=Object.freeze({__proto__:null,defaultErrorMap:Pc,setErrorMap:VH,getErrorMap:Zd,makeIssue:Jd,EMPTY_PATH:UH,addIssueToContext:ct,ParseStatus:Ci,INVALID:Zt,DIRTY:Ic,OK:Ji,isAborted:hb,isDirty:gb,isValid:hl,isAsync:_p,get util(){return Ir},get objectUtil(){return db},ZodParsedType:dt,getParsedType:$s,ZodType:dr,datetimeRegex:OF,ZodString:gu,ZodNumber:gl,ZodBigInt:vl,ZodBoolean:yl,ZodDate:xl,ZodSymbol:Bc,ZodUndefined:bl,ZodNull:wl,ZodAny:vu,ZodUnknown:Os,ZodNever:Bo,ZodVoid:kc,ZodArray:Rs,ZodObject:pa,ZodUnion:_l,ZodDiscriminatedUnion:Qd,ZodIntersection:Al,ZodTuple:is,ZodRecord:Kd,ZodMap:$c,ZodSet:Oc,ZodFunction:eh,ZodLazy:Sl,ZodLiteral:El,ZodEnum:Tl,ZodNativeEnum:Dl,ZodPromise:yu,ZodEffects:Ba,ZodTransformer:Ba,ZodOptional:no,ZodNullable:as,ZodDefault:Ml,ZodCatch:Cl,ZodNaN:Rc,BRAND:lG,ZodBranded:Ap,ZodPipeline:Sp,ZodReadonly:Nl,custom:LF,Schema:dr,ZodSchema:dr,late:cG,get ZodFirstPartyTypeKind(){return Wt},coerce:GG,any:yG,array:_G,bigint:mG,boolean:qF,date:dG,discriminatedUnion:TG,effect:IF,enum:kG,function:IG,instanceof:fG,intersection:DG,lazy:PG,literal:BG,map:NG,nan:pG,nativeEnum:$G,never:bG,null:vG,nullable:LG,number:UF,object:AG,oboolean:HG,onumber:zG,optional:RG,ostring:qG,pipeline:UG,preprocess:VG,promise:OG,record:CG,set:FG,strictObject:SG,string:VF,symbol:hG,transformer:IF,tuple:MG,undefined:gG,union:EG,unknown:xG,void:wG,NEVER:WG,ZodIssueCode:Ue,quotelessJson:LH,ZodError:Pa});function GF(t,e){return(r,n)=>r[t]===void 0==(r[e]===void 0)?(n.addIssue({code:ve.ZodIssueCode.custom,message:`Either ${t} or ${e} must be used, but not both.`}),!1):!0}function Ot(){return function(t){return t}}function pn(t,e){let r=t.safeParse(e);if(!r.success)throw new Gt({errorLevel:"CRITICAL",effect:"Failed to run function due to invalid arguments. Check that the arguments that you are passing to the function match the type definition of the function.",cause:r.error})}function WF(t,e){return t.safeParse(e,{errorMap:ZG})}var zF=["zeroth","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],HF=["twent","thirt","fort","fift","sixt","sevent","eight","ninet"];function jG(t){return t<20?zF[t]:t%10===0?HF[Math.floor(t/10)-2]+"ieth":HF[Math.floor(t/10)-2]+"y-"+zF[t%10]}var ZG=(t,e)=>({message:`At '${t.path.map(n=>typeof n=="string"?n:jG(n+1)+" element").join(" > ")}'. ${e.defaultError}`});function th(t,e,r){return ve.number({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a number.`})}function si(t,e,r){return ve.string({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a string.`})}function Ls(t,e,r){return ve.boolean({required_error:`The ${t} action requires a specified ${r} with the '${e}' field.`,invalid_type_error:`The ${t} action requires the value of the '${e}' fields to be a boolean.`})}var JG=Ot()(ve.object({type:ve.literal("command"),command:si("command","command","command to run")})),XG=Ot()(ve.object({type:ve.literal("js"),file:si("js","file","file path to the file to run"),args:ve.record(ve.unknown()).optional()})),QG=Ot()(ve.object({type:ve.literal("open"),link:si("open","link","link to open"),newTab:Ls("open","newTab","").optional()})),KG=Ot()(ve.object({type:ve.literal("input"),str:si("input","str","value to input")})),eW=Ot()(ve.object({type:ve.literal("sleep"),ms:th("sleep","ms","duration")})),tW=Ot()(ve.object({type:ve.literal("templaterCreateNote"),templateFile:si("templaterCreateNote","templateFile","template file path"),folderPath:si("templaterCreateNote","folderPath","folder path").optional(),fileName:si("templaterCreateNote","fileName","file name").optional(),openNote:Ls("templaterCreateNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Ls("templaterCreateNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),rW=Ot()(ve.object({type:ve.literal("runTemplaterFile"),templateFile:si("runTemplaterFile","templateFile","template file path")})),nW=Ot()(ve.object({type:ve.literal("updateMetadata"),bindTarget:si("updateMetadata","bindTarget","bind target to the metadata to update"),evaluate:Ls("updateMetadata","evaluate","value for whether to evaluate the value as a JavaScript expression"),value:ve.coerce.string({required_error:"The updateMetadata action requires a specified value for the update with the 'value' field.",invalid_type_error:"The updateMetadata action requires the value of the 'value' fields to be a string."})})),iW=Ot()(ve.object({type:ve.literal("createNote"),folderPath:si("createNote","folderPath","folder path").optional(),fileName:si("createNote","fileName","file name"),openNote:Ls("createNote","openNote","value for whether to open the note").optional(),openIfAlreadyExists:Ls("createNote","openIfAlreadyExists","value for whether to open the note if it already exists").optional()})),aW=Ot()(ve.object({type:ve.literal("replaceInNote"),fromLine:th("replaceInNote","fromLine","line to replace from"),toLine:th("replaceInNote","toLine","line to replace to"),replacement:si("replaceInNote","replacement","replacement string"),templater:Ls("replaceInNote","templater","value for whether to use Templater").optional()})),oW=Ot()(ve.object({type:ve.literal("replaceSelf"),replacement:si("replaceSelf","replacement","replacement string"),templater:Ls("replaceSelf","templater","value for whether to use Templater").optional()})),sW=Ot()(ve.object({type:ve.literal("regexpReplaceInNote"),regexp:si("regexpReplaceInNote","regexp","search regular expression"),regexpFlags:si("regexpReplaceInNote","regexpFlags","regular expression flags string").optional(),replacement:si("regexpReplaceInNote","replacement","replacement string")})),uW=Ot()(ve.object({type:ve.literal("insertIntoNote"),line:th("insertIntoNote","line","line to insert at"),value:si("insertIntoNote","value","string to insert"),templater:Ls("insertIntoNote","templater","value for whether to use Templater").optional()})),lW=Ot()(ve.object({type:ve.literal("inlineJS"),code:si("inlineJS","code","code string to run"),args:ve.record(ve.unknown()).optional()})),YF=Ot()(ve.discriminatedUnion("type",[JG,XG,QG,KG,eW,tW,nW,iW,aW,oW,sW,uW,lW,rW])),cW=ve.nativeEnum(on),Lc=Ot()(ve.object({label:ve.string(),icon:ve.string().optional(),style:cW,class:ve.string().optional(),cssStyle:ve.string().optional(),backgroundImage:ve.string().optional(),tooltip:ve.string().optional(),id:ve.string().optional(),hidden:ve.boolean().optional(),action:YF.optional(),actions:YF.array().optional()}).superRefine(GF("action","actions")));var Ni=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){console.warn("Mountable is already mounted",this);return}if(e===void 0){console.error("Mountable target element is undefined",this);return}this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl){console.warn("Mountable is not mounted",this);return}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 qn=class extends Ni{constructor(e,r,n){super(),this.plugin=e,this.filePath=n,this.uuid=r}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.plugin.mountableManager.registerMountable(this)}onUnmount(e){this.plugin.mountableManager.unregisterMountable(this)}};var Vc=class{constructor(e){this.scope=e}};var xu=class t{constructor(e){this.path=e}get(e){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 n of this.path.slice(1))r=n.get(r.child);return r}tryGet(e){try{return this.get(e)}catch{return}}set(e,r){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);for(let i of this.path.slice(1))n=i.get(n.child);n.access.set(n.parent,r)}setAndCreate(e,r){if(this.path.length===0)throw new Error("can not use empty path to access object");let n=this.path[0].get(e);n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(0,r)),n=n.access.get(n.parent));for(let i=1;i<this.path.length;i++)n=this.path[i].get(n.child),n.child===void 0&&(n.access.set(n.parent,this.getNextPathElementValue(i,r)),n=n.access.get(n.parent));n.access.set(n.parent,r)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,r){let n=this.getNextPathElement(e);return n===void 0?r:n.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new t(this.path.concat(e.path))}compareDiffArray(e){let r=Math.min(this.path.length,e.length);for(let n=0;n<r;n++){let i=this.path[n],a=e[n];if(i.prop!==a.toString())return!1}return!0}};var rh=class{constructor(){this.listeners=[]}registerListener(e){let r=e;return r.uuid=Fr(),this.listeners.push(r),r}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(r=>r.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let r of this.listeners)try{r.callback(e)}catch(n){let i=n instanceof Error?n:String(n);console.error(new Gt({errorLevel:"ERROR",effect:"error while calling listener callback",cause:i}))}}},yn=class extends rh{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},nh=class extends rh{constructor(e,r){super(),this.value=r(e),this.mapFn=r}get(){return this.value}set(e){this.value=this.mapFn(e),this.notifyListeners(this.value)}setDirect(e){this.value=e,this.notifyListeners(e)}};var $a=Ot()(ve.string()),Uc=Ot()(ve.nativeEnum(Yi)),Ep=Ot()(ve.nativeEnum(vc)),ZF=Ot()(ve.nativeEnum(du)),JF=Ot()(ve.instanceof(HTMLElement)),qc=Ot()(ve.instanceof(Vc)),dce=Ot()(ve.instanceof(yn)),hce=Ot()(ve.function().args().returns(ve.void())),gce=Ot()(ve.instanceof(qn)),XF=Ot()(ve.instanceof(Ni)),QF=Ot()(ve.instanceof(mu)),jF=Ot()(ve.object({index:ve.number(),line:ve.number(),column:ve.number()})),fW=Ot()(ve.object({from:jF,to:jF})),bu=Ot()(ve.object({value:ve.string(),position:fW.optional()})),KF=Ot()(ve.object({name:bu,value:bu.array()})),pW=Ot()(ve.object({type:ve.nativeEnum(dl),prop:bu})),yb=Ot()(ve.object({storageType:bu.optional(),storagePath:bu.optional(),storageProp:pW.array(),listenToChildren:ve.boolean()})),vce=Ot()(ve.object({declarationString:ve.string().optional(),inputFieldType:bu.optional(),templateName:bu.optional(),bindTarget:yb.optional(),arguments:KF.array(),errorCollection:ve.instanceof(Qt)})),yce=Ot()(ve.object({declarationString:ve.string().optional(),templateDeclaration:ve.array(ve.union([ve.string(),yb])).optional(),viewFieldType:bu.optional(),arguments:KF.array(),writeToBindTarget:yb.optional(),errorCollection:ve.instanceof(Qt)})),ka=Ot()(ve.object({storageType:ve.string(),storagePath:ve.string(),storageProp:ve.instanceof(xu),listenToChildren:ve.boolean()})),eI=Ot()(ve.object({name:ve.string(),value:ve.string().array()})),xce=Ot()(ve.object({type:ve.nativeEnum(dl),prop:ve.string()})),tI=Ot()(ve.object({inputFieldType:ZF.optional(),templateName:ve.string().optional(),bindTarget:ka.optional(),arguments:eI.array().optional()})),rI=Ot()(ve.object({viewFieldType:ZF.optional(),templateDeclaration:ve.union([ve.string(),ka]).array().optional(),arguments:eI.array().optional(),writeToBindTarget:ka.optional()})),mW=Ot()(ve.object({bindTarget:ka,name:ve.string()})),dW=Ot()(ve.object({bindTargetMappings:mW.array(),writeToBindTarget:ka.optional(),code:ve.string()})),hW=Ot()(ve.object({referencedButtonIds:ve.string().array()})),nI=Ot()(ve.object({renderChildType:Uc,declaration:ve.union([ve.string(),tI]),scope:qc.optional()})),iI=Ot()(ve.object({renderChildType:Uc,declaration:ve.union([ve.string(),rI]),scope:qc.optional()})),aI=Ot()(ve.object({declaration:ve.union([ve.string(),dW])})),oI=Ot()(ve.object({bindTarget:ka,tableHead:ve.string().array(),columns:ve.array(ve.union([tI,rI,ve.string()]))})),sI=Ot()(ve.object({renderChildType:Uc,declaration:ve.union([ve.string(),hW]),position:QF.optional()})),uI=Ot()(ve.object({declaration:ve.union([ve.string(),Lc]),position:QF.optional(),isPreview:ve.boolean()})),lI=Ot()(ve.object({depth:ve.number(),content:ve.string()}));var Wr=class{constructor(e,r){this.actionType=e,this.plugin=r}};var ih=class extends Wr{constructor(e){super("command",e)}async run(e,r,n,i,a){this.plugin.internal.executeCommandById(r.command)}create(){return{type:"command",command:""}}getActionLabel(){return"Run a command"}};var ah=class extends Wr{constructor(e){super("createNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists){let o=wd(bd(r.folderPath??"",r.fileName),"md");if(await this.plugin.internal.file.exists(o)){this.plugin.internal.file.open(o,"",!1);return}}await this.plugin.internal.file.create(r.folderPath??"",r.fileName,"md",r.openNote??!1)}create(){return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note"}};var oh=class extends Wr{constructor(e){super("inlineJS",e)}async run(e,r,n,i,a){if(!this.plugin.settings.enableJs)throw new No({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.plugin.internal.jsEngineRunCode(r.code,n,o))()}create(){return{type:"inlineJS",code:'console.log("Hello world")',args:{}}}getActionLabel(){return"Run JavaScript code"}};var sh=class extends Wr{constructor(e){super("input",e)}async run(e,r,n,i,a){let o=document.activeElement;o&&o instanceof HTMLInputElement&&(o.setRangeText(r.str,o.selectionStart,o.selectionEnd,"end"),o.dispatchEvent(new Event("input",{bubbles:!0})))}create(){return{type:"input",str:""}}getActionLabel(){return"Insert text at cursor"}};var uh=class extends Wr{constructor(e){super("insertIntoNote",e)}async run(e,r,n,i,a){let o=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.value),n):r.value;await this.plugin.internal.file.atomicModify(n,s=>{let l=s.split(`
`);if(r.line<1||r.line>l.length+1)throw new Error("Line number out of bounds");return l=[...l.slice(0,r.line-1),o,...l.slice(r.line-1)],l.join(`
`)})}create(){return{type:"insertIntoNote",line:0,value:"Some text",templater:!1}}getActionLabel(){return"Insert text into the note"}};var lh=class extends Wr{constructor(e){super("js",e)}async run(e,r,n,i,a){if(!this.plugin.settings.enableJs)throw new No({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let o={buttonConfig:structuredClone(e),args:structuredClone(r.args),buttonContext:structuredClone(i),click:structuredClone(a)};(await this.plugin.internal.jsEngineRunFile(r.file,n,o))()}create(){return{type:"js",file:"",args:{}}}getActionLabel(){return"Run a JavaScript file"}};var cI=zr(Ma()),ui=zr(ca());var fI=ui.P.sequence(Dc,ui.P.or(ui.P.string("#").then(ui.P.manyNotOf("[]#|:")),ui.P.string("#").result(void 0),ui.P.succeed(void 0)),ui.P.string("|").then(ui.P.manyNotOf("[]")).optional()),ch=ui.P.or(ui.P.sequenceMap((t,e)=>new Fl(t!==void 0,e[0],e[1],e[2],!0),ui.P.string("!").optional(),fI.wrapString("[[","]]")),ui.P.sequenceMap((t,e,r)=>{let n=!_c(r);return new Fl(t!==void 0,r,void 0,e,n)},ui.P.string("!").optional(),ui.P.manyNotOf("[]").wrapString("[","]"),ui.P.manyNotOf("()").wrapString("(",")"))),gW=ui.P.separateBy(ch,ui.P.string(",").trim(cI.P_UTILS.optionalWhitespace())),Fl=class t{constructor(e,r,n,i,a){this.isEmbed=e,this.target=r,this.block=n,this.alias=i,this.internal=a??!0}static fromUrl(e){return new t(!1,e.href,void 0,e.hostname,!1)}fullTarget(){return this.block?`${this.target}#${this.block}`:this.target}open(e,r,n){this.internal?e.internal.file.open(this.fullTarget(),r,n):xd(this.target)}toString(){let e=this.isEmbed?"!":"";if(this.internal){let r=this.alias?`|${this.alias}`:"";return`${e}[[${this.fullTarget()}${r}]]`}else{let r=this.alias??this.fullTarget();return`${e}[${r}](${this.fullTarget()})`}}},Cn=class t{static parseLink(e){return Xn(ch.thenEof(),e)}static parseLinkList(e){return Xn(gW.thenEof(),e)}static isLink(e){return ch.thenEof().tryParse(e).success}static urlToLink(e){return Fl.fromUrl(e)}static parseLinkOrUrl(e){return _c(e)?t.urlToLink(new URL(e)):t.parseLink(e)}static interpretAsLink(e){let r=ch.thenEof().tryParse(e);if(r.success)return r.value;let n=fI.thenEof().tryParse(e);if(n.success)return new Fl(!1,n.value[0],n.value[1],n.value[2],!0);if(_c(e)){let i=new URL(e);return Fl.fromUrl(i)}}};var fh=class extends Wr{constructor(e){super("open",e)}async run(e,r,n,i,a){let o=a.type==="middle"||a.ctrlKey||(r.newTab??!1),s=Cn.interpretAsLink(r.link);if(!s)throw new Error("Invalid link");s.open(this.plugin,n,o)}create(){return{type:"open",link:"",newTab:!0}}getActionLabel(){return"Open a link"}};var ph=class extends Wr{constructor(e){super("regexpReplaceInNote",e)}async run(e,r,n,i,a){if(r.regexp==="")throw new Error("Regexp cannot be empty");await this.plugin.internal.file.atomicModify(n,o=>o.replace(new RegExp(r.regexp,r.regexpFlags??"g"),r.replacement))}create(){return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text",regexpFlags:"g"}}getActionLabel(){return"Replace text in note using regexp"}};var mh=class extends Wr{constructor(e){super("replaceInNote",e)}async run(e,r,n,i,a){if(r.fromLine>r.toLine)throw new Error("From line cannot be greater than to line");let o=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,s=>{let l=s.split(`
`);if(r.fromLine<0||r.toLine>l.length+1)throw new Error("Line numbers out of bounds");return l=[...l.slice(0,r.fromLine-1),o,...l.slice(r.toLine)],l.join(`
`)})}create(){return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace text in note"}};var dh=class extends Wr{constructor(e){super("replaceSelf",e)}async run(e,r,n,i,a){if(i.isInline)throw new Error("Replace self action not supported for inline buttons");if(i.position===void 0)throw new Error("Position of the button in the note is unknown");if(i.position.lineStart>i.position.lineEnd)throw new Error("Position of the button in the note is invalid");let o=i.position,s=r.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.plugin.api.buttonActionRunner.resolveFilePath(r.replacement),n):r.replacement;await this.plugin.internal.file.atomicModify(n,l=>{let u=l.split(`
`);if(o.lineStart<0||o.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");return u=[...u.slice(0,o.lineStart),s,...u.slice(o.lineEnd+1)],u.join(`
`)})}create(){return{type:"replaceSelf",replacement:"Replacement text",templater:!1}}getActionLabel(){return"Replace button with text"}};var hh=class extends Wr{constructor(e){super("runTemplaterFile",e)}async run(e,r,n,i,a){let o=this.plugin.api.buttonActionRunner.resolveFilePath(r.templateFile);await this.plugin.internal.evaluateTemplaterTemplate(o,o)}create(){return{type:"runTemplaterFile",templateFile:""}}getActionLabel(){return"Run a templater file"}};var gh=class extends Wr{constructor(e){super("sleep",e)}async run(e,r,n,i,a){await new Promise(o=>setTimeout(o,r.ms))}create(){return{type:"sleep",ms:0}}getActionLabel(){return"Sleep for some time"}};var vh=class extends Wr{constructor(e){super("templaterCreateNote",e)}async run(e,r,n,i,a){if(r.openIfAlreadyExists&&r.fileName){let o=wd(bd(r.folderPath??"",r.fileName),"md");if(await this.plugin.internal.file.exists(o)){this.plugin.internal.file.open(o,"",!1);return}}await this.plugin.internal.createNoteWithTemplater(r.templateFile,r.folderPath,r.fileName,r.openNote)}create(){return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0,openIfAlreadyExists:!1}}getActionLabel(){return"Create a new note using Templater"}};var Tp=zr(Ma()),wu=zr(ca());var dI=wu.P.sequenceMap((t,e)=>t===void 0?e:-e,wu.P.string("-").optional(),wu.P.or(wu.P.sequenceMap((t,e,r)=>Number(t+e+r),Tp.P_UTILS.digits(),wu.P.string("."),Tp.P_UTILS.digits()),Tp.P_UTILS.digits().map(t=>Number(t)))).thenEof(),hI=wu.P.sequenceMap((t,e)=>t===void 0?e:-e,wu.P.string("-").optional(),Tp.P_UTILS.digits().map(t=>Number(t))).thenEof();function Oa(t){if(t.toLowerCase()==="null")return null;if(t==="true")return!0;if(t==="false")return!1;{let e=dI.tryParse(t);return e.success?e.value:t}}function ko(t){return t===void 0||t===null?"":typeof t=="string"?t:typeof t=="boolean"?t?"true":"false":t.toString()}function _u(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"}function ao(t){if(t!=null){if(_u(t))return[t];if(typeof t=="object"&&Array.isArray(t))return t.filter(e=>_u(e))}}function zc(t){if(typeof t=="number")return t;if(typeof t=="string"){let e=dI.tryParse(t);if(e.success)return e.value}}function os(t){return _u(t)?ko(t):void 0}function Au(t){return _u(t)?t:void 0}function Il(t,e){return Array.isArray(t)?t.map(r=>xb(r,e)).filter(r=>r!=="").join(", "):xb(t,e)}function xb(t,e){return t==null?e?"":"null":typeof t=="function"?"<function>":typeof t=="object"||Array.isArray(t)?JSON.stringify(t):t.toString()}function gI(t,e){return Array.isArray(t)?t.map(r=>mI(r,e)).filter(r=>r!==""):mI(t,e)}function mI(t,e){return typeof t=="string"?Cn.isLink(t)?Cn.parseLink(t):_c(t)?Cn.urlToLink(new URL(t)):t:xb(t,e)}var yh=class extends Wr{constructor(e){super("updateMetadata",e)}async run(e,r,n,i,a){let o=this.plugin.api.bindTargetParser.fromStringAndValidate(r.bindTarget,n);if(r.evaluate){if(!this.plugin.settings.enableJs)throw new No({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let s=new Function("x","getMetadata",`return ${r.value};`);this.plugin.api.updateMetadata(o,l=>s(l,u=>this.plugin.api.getMetadata(this.plugin.api.parseBindTarget(u,n))))}else this.plugin.api.setMetadata(o,Oa(r.value))}create(){return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""}}getActionLabel(){return"Update metadata"}};var xh=class{constructor(e){this.plugin=e,this.actionContexts={command:new ih(e),open:new fh(e),js:new lh(e),input:new sh(e),sleep:new gh(e),templaterCreateNote:new vh(e),updateMetadata:new yh(e),createNote:new ah(e),replaceInNote:new mh(e),replaceSelf:new dh(e),regexpReplaceInNote:new ph(e),insertIntoNote:new uh(e),inlineJS:new oh(e),runTemplaterFile:new hh(e)}}resolveFilePath(e,r){let n=Cn.isLink(e)?Cn.parseLink(e).target:e,i=this.plugin.internal.file.getPathByName(n,r);if(i===void 0)throw new Co({errorLevel:"ERROR",cause:`Could not find a file that matches "${e}".`,effect:`Could not resolve path or link "${e}" relative to "${r}".`});return i}createDefaultButtonConfig(){return{label:"This is a button",icon:"",style:"default",class:"",cssStyle:"",backgroundImage:"",tooltip:"",id:"",hidden:!1,actions:[]}}async runButtonActions(e,r,n,i){try{if(e.action)await this.runAction(e,e.action,r,n,i);else if(e.actions)for(let a of e.actions)await this.runAction(e,a,r,n,i);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(a){console.warn("meta-bind | ButtonMDRC >> error while running action",a),this.plugin.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){return this.actionContexts[e].create()}async runAction(e,r,n,i,a){let o=r.type;await this.actionContexts[o].run(e,r,n,i,a)}getActionLabel(e){return this.actionContexts[e].getActionLabel()}mouseEventToClickContext(e,r){return{type:r,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey}}};var vI="5";typeof window<"u"&&(window.__svelte||={v:new Set}).v.add(vI);var Hc="[",Pl="[!",Bl="]",Su={};var zn=Symbol(),Xi=Symbol("filename"),yI=Symbol("hmr");var vW=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory"];var Gfe=[...vW,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject"];var yW=["touchstart","touchmove"];function xI(t){return yW.includes(t)}var Ze=!1;var oo=Array.isArray,bI=Array.prototype.indexOf,Dp=Array.from,bb=Object.keys,gi=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,wb=Object.getOwnPropertyDescriptors,bh=Object.prototype,wI=Array.prototype,Eu=Object.getPrototypeOf;var Ra=()=>{};function Mp(t){for(var e=0;e<t.length;e++)t[e]()}var La=Symbol("$state"),kl=Symbol("$state metadata"),wh=Symbol("legacy props"),_I=Symbol("");function _h(t){return t===this.v}function Ah(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Gc(t){return!Ah(t,this.v)}function _b(){if(Ze){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function AI(){if(Ze){let t=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function SI(t){if(Ze){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function EI(){if(Ze){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function TI(t){if(Ze){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function DI(){if(Ze){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function MI(){if(Ze){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function CI(){if(Ze){let t=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/invalid_snippet")}function NI(t){if(Ze){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function FI(t){if(Ze){let e=new Error(`props_rest_readonly
Rest element properties of \`$props()\` such as \`${t}\` are readonly
https://svelte.dev/e/props_rest_readonly`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function II(t){if(Ze){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function PI(){if(Ze){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function BI(){if(Ze){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function kI(){if(Ze){let t=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function $I(){if(Ze){let t=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var Vs=!1,ss=!1;var bW="font-weight: bold",wW="font-weight: normal";function Ab(t){Ze?console.warn(`%c[svelte] state_snapshot_uncloneable
%c${t?`The following properties cannot be cloned with \`$state.snapshot\` \u2014 the return value contains the originals:

${t}`:"Value cannot be cloned with `$state.snapshot` \u2014 the original value was returned"}
https://svelte.dev/e/state_snapshot_uncloneable`,bW,wW):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}var _W=[];function li(t,e=!1){if(Ze&&!e){let r=[],n=Cp(t,new Map,"",r);if(r.length===1&&r[0]==="")Ab();else if(r.length>0){let i=r.length>10?r.slice(0,7):r.slice(0,10),a=r.length-i.length,o=i.map(s=>`- <value>${s}`).join(`
`);a>0&&(o+=`
- ...and ${a} more`),Ab(o)}return n}return Cp(t,new Map,"",_W)}function Cp(t,e,r,n,i=null){if(typeof t=="object"&&t!==null){var a=e.get(t);if(a!==void 0)return a;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(oo(t)){var o=Array(t.length);e.set(t,o),i!==null&&e.set(i,o);for(var s=0;s<t.length;s+=1){var l=t[s];s in t&&(o[s]=Cp(l,e,Ze?`${r}[${s}]`:r,n))}return o}if(Eu(t)===bh){o={},e.set(t,o),i!==null&&e.set(i,o);for(var u in t)o[u]=Cp(t[u],e,Ze?`${r}.${u}`:r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return Cp(t.toJSON(),e,Ze?`${r}.toJSON()`:r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return Ze&&n.push(r),t}}var Np=null;function Us(t){let e=Error(),r=e.stack;if(r){let n=r.split(`
`),i=[`
`];for(let a=0;a<n.length;a++){let o=n[a];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;gi(e,"stack",{value:i.join(`
`)}),gi(e,"name",{value:`${t}Error`})}return e}var $l=new Set;function Eb(t){$l=t}function Hn(t,e){var r={f:0,v:t,reactions:null,equals:_h,rv:0,wv:0};return Ze&&ss&&(r.created=e??Us("CreatedAt"),r.debug=null),r}function bt(t){return SW(Hn(t))}function Tu(t,e=!1){let r=Hn(t);return e||(r.equals=Gc),Vs&&xr!==null&&xr.l!==null&&(xr.l.s??=[]).push(r),r}function SW(t){return yr!==null&&yr.f&2&&(Oo===null?LI([t]):Oo.push(t)),t}function $e(t,e){return yr!==null&&zs()&&yr.f&18&&(Oo===null||!Oo.includes(t))&&$I(),jc(t,e)}function jc(t,e){if(!t.equals(e)){var r=t.v;if(t.v=e,t.wv=Ip(),Ze&&ss&&(t.updated=Us("UpdatedAt"),rr!=null&&(t.trace_need_increase=!0,t.trace_v??=r)),RI(t,2048),zs()&&rr!==null&&rr.f&1024&&!(rr.f&96)&&(us===null?VI([t]):us.push(t)),Ze&&$l.size>0){let i=Array.from($l);var n=qs;Wc(!0);try{for(let a of i)a.f&1024&&Qi(a,4096),Du(a)&&Ol(a)}finally{Wc(n)}$l.clear()}}return e}function RI(t,e){var r=t.reactions;if(r!==null)for(var n=zs(),i=r.length,a=0;a<i;a++){var o=r[a],s=o.f;if(!(s&2048)&&!(!n&&o===rr)){if(Ze&&s&262144){$l.add(o);continue}Qi(o,e),s&1280&&(s&2?RI(o,4096):Pp(o))}}}var Bp="font-weight: bold",kp="font-weight: normal";function UI(t,e,r){Ze?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Bp,kp):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Zc(t){Ze?console.warn(`%c[svelte] hydration_mismatch
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Bp,kp):console.warn("https://svelte.dev/e/hydration_mismatch")}function qI(){Ze?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Bp,kp):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Tb(t,e){Ze?console.warn(`%c[svelte] ownership_invalid_mutation
%c${t?`${t} mutated a value owned by ${e}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead`:"Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}
https://svelte.dev/e/ownership_invalid_mutation`,Bp,kp):console.warn("https://svelte.dev/e/ownership_invalid_mutation")}function Sh(t){Ze?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Bp,kp):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var Bt=!1;function ma(t){Bt=t}var Kt;function En(t){if(t===null)throw Zc(),Su;return Kt=t}function Fi(){return En(Ii(Kt))}function ce(t){if(Bt){if(Ii(Kt)!==null)throw Zc(),Su;Kt=t}}function Nt(t=1){if(Bt){for(var e=t,r=Kt;e--;)r=Ii(r);Kt=r}}function Jc(){for(var t=0,e=Kt;;){if(e.nodeType===8){var r=e.data;if(r===Bl){if(t===0)return e;t-=1}else(r===Hc||r===Pl)&&(t+=1)}var n=Ii(e);e.remove(),e=n}}var EW={},TW=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,DW=/@(.+):(\d+):(\d+)$/;function MW(){let t=new Error().stack;if(!t)return null;let e=[];for(let r of t.split(`
`)){let n=TW.exec(r)??DW.exec(r);n&&e.push({file:n[1],line:+n[2],column:+n[3]})}return e}function zI(){let t=MW()?.slice(4);if(!t)return null;for(let e=0;e<t.length;e++){let r=t[e],n=EW[r.file];if(!n){if(e===0)return null;continue}for(let i of n){if(i.end==null)return null;if(i.start.line<r.line&&i.end.line>r.line)return i.component}}return null}var CW=Symbol("ADD_OWNER");function Db(t,e){if(e.owners!==null)for(;t;){if(t.owners===null){e.owners=null;break}for(let r of t.owners)e.owners.add(r);t=t.parent}}function HI(t,e){return t.owners===null?!0:t.owners.has(e)||t.parent!==null&&HI(t.parent,e)}function GI(t){return t?.owners?.values().next().value??GI(t.parent)}var NW=!1;function WI(t){if(NW)return;let e=zI();if(e&&!HI(t,e)){let r=GI(t);r[Xi]!==e[Xi]?Tb(e[Xi],r[Xi]):Tb()}}function Le(t,e=null,r){var n=null;if(Ze&&ss&&(n=Us("CreatedAt")),typeof t!="object"||t===null||La in t)return t;let i=Eu(t);if(i!==bh&&i!==wI)return t;var a=new Map,o=oo(t),s=Hn(0);o&&a.set("length",Hn(t.length,n));var l;if(Ze)if(l={parent:e,owners:null},r){let u=r.v?.[kl]?.owners;l.owners=u?new Set(u):null}else l.owners=e===null?xr!==null?new Set([xr.function]):null:new Set;return new Proxy(t,{defineProperty(u,c,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&PI();var m=a.get(c);return m===void 0?(m=Hn(f.value,n),a.set(c,m)):$e(m,Le(f.value,l)),!0},deleteProperty(u,c){var f=a.get(c);if(f===void 0)c in u&&a.set(c,Hn(zn,n));else{if(o&&typeof c=="string"){var m=a.get("length"),p=Number(c);Number.isInteger(p)&&p<m.v&&$e(m,p)}$e(f,zn),YI(s)}return!0},get(u,c,f){if(Ze&&c===kl)return l;if(c===La)return t;var m=a.get(c),p=c in u;if(m===void 0&&(!p||$o(u,c)?.writable)&&(m=Hn(Le(p?u[c]:zn,l),n),a.set(c,m)),m!==void 0){var d=z(m);if(Ze){var h=d?.[kl];h&&h?.parent!==l&&Db(l,h)}return d===zn?void 0:d}return Reflect.get(u,c,f)},getOwnPropertyDescriptor(u,c){var f=Reflect.getOwnPropertyDescriptor(u,c);if(f&&"value"in f){var m=a.get(c);m&&(f.value=z(m))}else if(f===void 0){var p=a.get(c),d=p?.v;if(p!==void 0&&d!==zn)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(u,c){if(Ze&&c===kl||c===La)return!0;var f=a.get(c),m=f!==void 0&&f.v!==zn||Reflect.has(u,c);if(f!==void 0||rr!==null&&(!m||$o(u,c)?.writable)){f===void 0&&(f=Hn(m?Le(u[c],l):zn,n),a.set(c,f));var p=z(f);if(p===zn)return!1}return m},set(u,c,f,m){var p=a.get(c),d=c in u;if(o&&c==="length")for(var h=f;h<p.v;h+=1){var x=a.get(h+"");x!==void 0?$e(x,zn):h in u&&(x=Hn(zn,n),a.set(h+"",x))}if(p===void 0?(!d||$o(u,c)?.writable)&&(p=Hn(void 0,n),$e(p,Le(f,l)),a.set(c,p)):(d=p.v!==zn,$e(p,Le(f,l))),Ze){var b=f?.[kl];b&&b?.parent!==l&&Db(l,b),WI(l)}var T=Reflect.getOwnPropertyDescriptor(u,c);if(T?.set&&T.set.call(m,f),!d){if(o&&typeof c=="string"){var v=a.get("length"),A=Number(c);Number.isInteger(A)&&A>=v.v&&$e(v,A+1)}YI(s)}return!0},ownKeys(u){z(s);var c=Reflect.ownKeys(u).filter(p=>{var d=a.get(p);return d===void 0||d.v!==zn});for(var[f,m]of a)m.v!==zn&&!(f in u)&&c.push(f);return c},setPrototypeOf(){BI()}})}function YI(t,e=1){$e(t,t.v+e)}function Xc(t){return t!==null&&typeof t=="object"&&La in t?t[La]:t}function Mb(t,e){return Object.is(Xc(t),Xc(e))}function jI(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,o){let s=r.call(this,a,o);if(s===-1){for(let l=o??0;l<this.length;l+=1)if(Xc(this[l])===a){Sh("array.indexOf(...)");break}}return s},t.lastIndexOf=function(a,o){let s=n.call(this,a,o??this.length-1);if(s===-1){for(let l=0;l<=(o??this.length-1);l+=1)if(Xc(this[l])===a){Sh("array.lastIndexOf(...)");break}}return s},t.includes=function(a,o){let s=i.call(this,a,o);if(!s){for(let l=0;l<this.length;l+=1)if(Xc(this[l])===a){Sh("array.includes(...)");break}}return s},Array.__svelte_cleanup=()=>{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var Hs,ZI,JI,XI;function Th(){if(Hs===void 0){Hs=window,ZI=document;var t=Element.prototype,e=Node.prototype;JI=$o(e,"firstChild").get,XI=$o(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t=void 0,Ze&&(t.__svelte_meta=null,jI())}}function ha(t=""){return document.createTextNode(t)}function Nn(t){return JI.call(t)}function Ii(t){return XI.call(t)}function ye(t,e){if(!Bt)return Nn(t);var r=Nn(Kt);if(r===null)r=Kt.appendChild(ha());else if(e&&r.nodeType!==3){var n=ha();return r?.before(n),En(n),n}return En(r),r}function Je(t,e){if(!Bt){var r=Nn(t);return r instanceof Comment&&r.data===""?Ii(r):r}if(e&&Kt?.nodeType!==3){var n=ha();return Kt?.before(n),En(n),n}return Kt}function le(t,e=1,r=!1){let n=Bt?Kt:t;for(var i;e--;)i=n,n=Ii(n);if(!Bt)return n;var a=n?.nodeType;if(r&&a!==3){var o=ha();return n===null?i?.after(o):n.before(o),En(o),o}return En(n),n}function Qc(t){t.textContent=""}function Vt(t){var e=2050;rr===null?e|=256:rr.f|=1048576;var r=yr!==null&&yr.f&2?yr:null;let n={children:null,ctx:xr,deps:null,equals:_h,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??rr};return Ze&&ss&&(n.created=Us("CreatedAt")),r!==null&&(r.children??=[]).push(n),n}function $p(t){let e=Vt(t);return e.equals=Gc,e}function Nb(t){var e=t.children;if(e!==null){t.children=null;for(var r=0;r<e.length;r+=1){var n=e[r];n.f&2?Op(n):yi(n)}}}var Cb=[];function FW(t){for(var e=t.parent;e!==null;){if(!(e.f&2))return e;e=e.parent}return null}function Ib(t){var e,r=rr;if(ei(FW(t)),Ze){let n=$l;Eb(new Set);try{Cb.includes(t)&&AI(),Cb.push(t),Nb(t),e=Dh(t)}finally{ei(r),Eb(n),Cb.pop()}}else try{Nb(t),e=Dh(t)}finally{ei(r)}return e}function Pb(t){var e=Ib(t),r=(Gs||t.f&256)&&t.deps!==null?4096:1024;Qi(t,r),t.equals(e)||(t.v=e,t.wv=Ip())}function Op(t){Nb(t),Rl(t,0),Qi(t,16384),t.v=t.children=t.deps=t.ctx=t.reactions=null}function e2(t){rr===null&&yr===null&&TI(t),yr!==null&&yr.f&256&&EI(),Ch&&SI(t)}function IW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Ll(t,e,r,n=!0){var i=(t&64)!==0,a=rr;if(Ze)for(;a!==null&&a.f&262144;)a=a.parent;var o={ctx:xr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|2048,first:null,fn:e,last:null,next:null,parent:i?null:a,prev:null,teardown:null,transitions:null,wv:0};if(Ze&&(o.component_function=co),r){var s=qs;try{Wc(!0),Ol(o),o.f|=32768}catch(c){throw yi(o),c}finally{Wc(s)}}else e!==null&&Pp(o);var l=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&1048704)===0;if(!l&&!i&&n&&(a!==null&&IW(o,a),yr!==null&&yr.f&2)){var u=yr;(u.children??=[]).push(o)}return o}function po(t){let e=Ll(8,null,!1);return Qi(e,1024),e.teardown=t,e}function ga(t){e2("$effect");var e=rr!==null&&(rr.f&32)!==0&&xr!==null&&!xr.m;if(Ze&&gi(t,"name",{value:"$effect"}),e){var r=xr;(r.e??=[]).push({fn:t,effect:rr,reaction:yr})}else{var n=va(t);return n}}function $b(t){let e=Ll(64,t,!0);return()=>{yi(e)}}function t2(t){let e=Ll(64,t,!0);return(r={})=>new Promise(n=>{r.outro?Lo(e,()=>{yi(e),n(void 0)}):(yi(e),n(void 0))})}function va(t){return Ll(4,t,!1)}function da(t){return Ll(8,t,!0)}function Re(t){return Ze&&gi(t,"name",{value:"{expression}"}),ea(t)}function ea(t,e=0){return Ll(24|e,t,!0)}function xi(t,e=!0){return Ll(40,t,!0,e)}function Ob(t){var e=t.teardown;if(e!==null){let r=Ch,n=yr;Bb(!0),Ki(null);try{e.call(null)}finally{Bb(r),Ki(n)}}}function Rb(t){var e=t.deriveds;if(e!==null){t.deriveds=null;for(var r=0;r<e.length;r+=1)Op(e[r])}}function Lb(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;yi(r,e),r=n}}function r2(t){for(var e=t.first;e!==null;){var r=e.next;e.f&32||yi(e),e=r}}function yi(t,e=!0){var r=!1;if((e||t.f&524288)&&t.nodes_start!==null){for(var n=t.nodes_start,i=t.nodes_end;n!==null;){var a=n===i?null:Ii(n);n.remove(),n=a}r=!0}Lb(t,e&&!r),Rb(t),Rl(t,0),Qi(t,16384);var o=t.transitions;if(o!==null)for(let l of o)l.stop();Ob(t);var s=t.parent;s!==null&&s.first!==null&&Vb(t),Ze&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function Vb(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Lo(t,e){var r=[];Mh(t,r,!0),Ub(r,()=>{yi(t),e&&e()})}function Ub(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function Mh(t,e,r){if(!(t.f&8192)){if(t.f^=8192,t.transitions!==null)for(let o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var i=n.next,a=(n.f&65536)!==0||(n.f&32)!==0;Mh(n,e,a?r:!1),n=i}}}function Cu(t){n2(t,!0)}function n2(t,e){if(t.f&8192){Du(t)&&Ol(t),t.f^=8192;for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;n2(r,i?e:!1),r=n}if(t.transitions!==null)for(let a of t.transitions)(a.is_global||e)&&a.in()}}var PW=typeof requestIdleCallback>"u"?t=>setTimeout(t,1):requestIdleCallback,Nh=!1,Fh=!1,qb=[],zb=[];function i2(){Nh=!1;let t=qb.slice();qb=[],Mp(t)}function a2(){Fh=!1;let t=zb.slice();zb=[],Mp(t)}function mo(t){Nh||(Nh=!0,queueMicrotask(i2)),qb.push(t)}function o2(t){Fh||(Fh=!0,PW(a2)),zb.push(t)}function s2(){Nh&&i2(),Fh&&a2()}function Rp(t){if(Ze){let e=new Error(`lifecycle_outside_component
\`${t}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var m2=0,$W=1,u2=new WeakSet,Ih=!1,Ph=m2,Lp=!1,tf=null,qs=!1,Ch=!1;function Wc(t){qs=t}function Bb(t){Ch=t}var Vl=[],rf=0,Vp=[],yr=null;function Ki(t){yr=t}var rr=null;function ei(t){rr=t}var Oo=null;function LI(t){Oo=t}var ya=null,qa=0,us=null;function VI(t){us=t}var d2=1,kh=0,Gs=!1,Fp=null;var xr=null;var co=null;function Ip(){return++d2}function zs(){return!Vs||xr!==null&&xr.l===null}function Du(t){var e=t.f;if(e&2048)return!0;if(e&4096){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,o=(e&512)!==0,s=n&&rr!==null&&!Gs,l=r.length;if(o||s){for(i=0;i<l;i++)a=r[i],(o||!a?.reactions?.includes(t))&&(a.reactions??=[]).push(t);o&&(t.f^=512)}for(i=0;i<l;i++)if(a=r[i],Du(a)&&Pb(a),a.wv>t.wv)return!0}(!n||rr!==null&&!Gs)&&Qi(t,1024)}return!1}function l2(t,e){for(var r=e;r!==null;){if(r.f&128)try{r.fn(t);return}catch{r.f^=128}r=r.parent}throw Ih=!1,t}function c2(t){return(t.f&16384)===0&&(t.parent===null||(t.parent.f&128)===0)}function nf(t,e,r,n){if(Ih){if(r===null&&(Ih=!1),c2(e))throw t;return}if(r!==null&&(Ih=!0),!Ze||n===null||!(t instanceof Error)||u2.has(t)){l2(t,e);return}u2.add(t);let i=[],a=e.fn?.name;a&&i.push(a);let o=n;for(;o!==null;){if(Ze){var s=o.function?.[Xi];if(s){let c=s.split("/").pop();i.push(c)}}o=o.p}let l=/Firefox/.test(navigator.userAgent)?"  ":"	";gi(t,"message",{value:t.message+`
${i.map(c=>`
${l}in ${c}`).join("")}
`}),gi(t,"component_stack",{value:i});let u=t.stack;if(u){let c=u.split(`
`),f=[];for(let m=0;m<c.length;m++){let p=c[m];p.includes("svelte/src/internal")||f.push(p)}gi(t,"stack",{value:f.join(`
`)})}if(l2(t,e),c2(e))throw t}function h2(t,e,r=0){var n=t.reactions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];a.f&2?h2(a,e,r+1):e===a&&(r===0?Qi(a,2048):a.f&1024&&Qi(a,4096),Pp(a))}}function Dh(t){var e=ya,r=qa,n=us,i=yr,a=Gs,o=Oo,s=xr,l=t.f;ya=null,qa=0,us=null,yr=l&96?null:t,Gs=!qs&&(l&256)!==0,Oo=null,xr=t.ctx,kh++;try{var u=(0,t.fn)(),c=t.deps;if(ya!==null){var f;if(Rl(t,qa),c!==null&&qa>0)for(c.length=qa+ya.length,f=0;f<ya.length;f++)c[qa+f]=ya[f];else t.deps=c=ya;if(!Gs)for(f=qa;f<c.length;f++)(c[f].reactions??=[]).push(t)}else c!==null&&qa<c.length&&(Rl(t,qa),c.length=qa);if(zs()&&us!==null&&!(t.f&6146))for(f=0;f<us.length;f++)h2(us[f],t);return i!==null&&kh++,u}finally{ya=e,qa=r,us=n,yr=i,Gs=a,Oo=o,xr=s}}function OW(t,e){let r=e.reactions;if(r!==null){var n=bI.call(r,t);if(n!==-1){var i=r.length-1;i===0?r=e.reactions=null:(r[n]=r[i],r.pop())}}r===null&&e.f&2&&(ya===null||!ya.includes(e))&&(Qi(e,4096),e.f&768||(e.f^=512),Rl(e,0))}function Rl(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)OW(t,r[n])}function Ol(t){var e=t.f;if(!(e&16384)){Qi(t,1024);var r=rr,n=xr;if(rr=t,Ze){var i=co;co=t.component_function}try{e&16?r2(t):Lb(t),Rb(t),Ob(t);var a=Dh(t);t.teardown=typeof a=="function"?a:null,t.wv=d2;var o=t.deps;if(Ze&&ss&&t.f&2048&&o!==null)for(let l=0;l<o.length;l++){var s=o[l];s.trace_need_increase&&(s.wv=Ip(),s.trace_need_increase=void 0,s.trace_v=void 0)}Ze&&Vp.push(t)}catch(l){nf(l,t,r,n||t.ctx)}finally{rr=r,Ze&&(co=i)}}}function f2(){console.error("Last ten effects were: ",Vp.slice(-10).map(t=>t.fn)),Vp=[]}function g2(){if(rf>1e3){rf=0;try{DI()}catch(t){if(Ze&&gi(t,"stack",{value:""}),tf!==null)if(Ze)try{nf(t,tf,null,null)}catch(e){throw f2(),e}else nf(t,tf,null,null);else throw Ze&&f2(),t}}rf++}function v2(t){var e=t.length;if(e!==0){g2();var r=qs;qs=!0;try{for(var n=0;n<e;n++){var i=t[n];i.f&1024||(i.f^=1024);var a=[];y2(i,a),RW(a)}}finally{qs=r}}}function RW(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if(!(n.f&24576))try{Du(n)&&(Ol(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Vb(n):n.fn=null))}catch(i){nf(i,n,null,n.ctx)}}}function LW(){if(Lp=!1,rf>1001)return;let t=Vl;Vl=[],v2(t),Lp||(rf=0,tf=null,Ze&&(Vp=[]))}function Pp(t){Ph===m2&&(Lp||(Lp=!0,queueMicrotask(LW))),tf=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if(r&96){if(!(r&1024))return;e.f^=1024}}Vl.push(e)}function y2(t,e){var r=t.first,n=[];e:for(;r!==null;){var i=r.f,a=(i&32)!==0,o=a&&(i&1024)!==0,s=r.next;if(!o&&!(i&8192))if(i&8){if(a)r.f^=1024;else try{Du(r)&&Ol(r)}catch(f){nf(f,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(s===null){let f=r.parent;for(;f!==null;){if(t===f)break e;var u=f.next;if(u!==null){r=u;continue e}f=f.parent}}r=s}for(var c=0;c<n.length;c++)l=n[c],e.push(l),y2(l,e)}function af(t){var e=Ph,r=Vl;try{g2();let i=[];Ph=$W,Vl=i,Lp=!1,v2(r);var n=t?.();return s2(),(Vl.length>0||i.length>0)&&af(),rf=0,tf=null,Ze&&(Vp=[]),n}finally{Ph=e,Vl=r}}function z(t){var e=t.f,r=(e&2)!==0;if(r&&e&16384){var n=Ib(t);return Op(t),n}if(Fp!==null&&Fp.add(t),yr!==null){Oo!==null&&Oo.includes(t)&&kI();var i=yr.deps;t.rv<kh&&(t.rv=kh,ya===null&&i!==null&&i[qa]===t?qa++:ya===null?ya=[t]:ya.push(t))}else if(r&&t.deps===null)for(var a=t,o=a.parent,s=a;o!==null;)if(o.f&2){var l=o;s=l,o=l.parent}else{var u=o;u.deriveds?.includes(s)||(u.deriveds??=[]).push(s);break}if(r&&(a=t,Du(a)&&Pb(a)),Ze&&ss&&Np!==null&&yr!==null&&Np.reaction===yr){if(t.debug)t.debug();else if(t.created){var c=Np.entries.get(t);c===void 0&&(c={read:[]},Np.entries.set(t,c)),c.read.push(Us("TracedAt"))}}return t.v}function xn(t){let e=yr;try{return yr=null,t()}finally{yr=e}}var VW=-7169;function Qi(t,e){t.f=t.f&VW|e}function Te(t,e=!1,r){xr={p:xr,c:null,e:null,m:!1,s:t,x:null,l:null},Vs&&!e&&(xr.l={s:null,u:null,r1:[],r2:Hn(!1)}),Ze&&(xr.function=r,co=r)}function De(t){let e=xr;if(e!==null){t!==void 0&&(e.x=t);let o=e.e;if(o!==null){var r=rr,n=yr;e.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];ei(a.effect),Ki(a.reaction),va(a.fn)}}finally{ei(r),Ki(n)}}xr=e.p,Ze&&(co=e.p?.function??null),e.m=!0}return t||{}}if(Ze){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;II(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function On(t){Bt&&Nn(t)!==null&&Qc(t)}var x2=!1;function $h(){x2||(x2=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(let e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function Oh(t){var e=yr,r=rr;Ki(null),ei(null);try{return t()}finally{Ki(e),ei(r)}}function Rh(t,e,r,n=r){t.addEventListener(e,()=>Oh(r));let i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),$h()}var Hb=new Set,Lh=new Set;function b2(t,e,r,n){function i(a){if(n.capture||of.call(e,a),!a.cancelBubble)return Oh(()=>r.call(this,a))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?mo(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Pi(t,e,r,n,i){var a={capture:n,passive:i},o=b2(t,e,r,a);(e===document.body||e===window||e===document)&&po(()=>{e.removeEventListener(t,o,a)})}function kt(t){for(var e=0;e<t.length;e++)Hb.add(t[e]);for(var r of Lh)r(t)}function of(t){var e=this,r=e.ownerDocument,n=t.type,i=t.composedPath?.()||[],a=i[0]||t.target,o=0,s=t.__root;if(s){var l=i.indexOf(s);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;l<=u&&(o=l)}if(a=i[o]||t.target,a!==e){gi(t,"currentTarget",{configurable:!0,get(){return a||r}});var c=yr,f=rr;Ki(null),ei(null);try{for(var m,p=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var h=a["__"+n];if(h!==void 0&&!a.disabled)if(oo(h)){var[x,...b]=h;x.apply(a,[t,...b])}else h.call(a,t)}catch(T){m?p.push(T):m=T}if(t.cancelBubble||d===e||d===null)break;a=d}if(m){for(let T of p)queueMicrotask(()=>{throw T});throw m}}finally{t.__root=e,delete t.currentTarget,Ki(c),ei(f)}}}var qW;function w2(){qW=void 0}function Up(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function ta(t,e){var r=rr;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function ue(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,a=!t.startsWith("<!>");return()=>{if(Bt)return ta(Kt,null),Kt;i===void 0&&(i=Up(a?t:"<!>"+t),r||(i=Nn(i)));var o=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var s=Nn(o),l=o.lastChild;ta(s,l)}else ta(o,o);return o}}function Vh(t,e,r="svg"){var n=!t.startsWith("<!>"),i=(e&1)!==0,a=`<${r}>${n?t:"<!>"+t}</${r}>`,o;return()=>{if(Bt)return ta(Kt,null),Kt;if(!o){var s=Up(a),l=Nn(s);if(i)for(o=document.createDocumentFragment();Nn(l);)o.appendChild(Nn(l));else o=Nn(l)}var u=o.cloneNode(!0);if(i){var c=Nn(u),f=u.lastChild;ta(c,f)}else ta(u,u);return u}}function lr(t=""){if(!Bt){var e=ha(t+"");return ta(e,e),e}var r=Kt;return r.nodeType!==3&&(r.before(r=ha()),En(r)),ta(r,r),r}function Xr(){if(Bt)return ta(Kt,null),Kt;var t=document.createDocumentFragment(),e=document.createComment(""),r=ha();return t.append(e,r),ta(e,r),t}function ee(t,e){if(Bt){rr.nodes_end=Kt,Fi();return}t!==null&&t.before(e)}var Gb=!0;function ht(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r==null?"":r+"")}function Vr(t,e){return A2(t,e)}function Yb(t,e){Th(),e.intro=e.intro??!1;let r=e.target,n=Bt,i=Kt;try{for(var a=Nn(r);a&&(a.nodeType!==8||a.data!==Hc);)a=Ii(a);if(!a)throw Su;ma(!0),En(a),Fi();let o=A2(t,{...e,anchor:a});if(Kt===null||Kt.nodeType!==8||Kt.data!==Bl)throw Zc(),Su;return ma(!1),o}catch(o){if(o===Su)return e.recover===!1&&MI(),Th(),Qc(r),ma(!1),Vr(t,e);throw o}finally{ma(n),En(i),w2()}}var sf=new Map;function A2(t,{target:e,anchor:r,props:n={},events:i,context:a,intro:o=!0}){Th();var s=new Set,l=f=>{for(var m=0;m<f.length;m++){var p=f[m];if(!s.has(p)){s.add(p);var d=xI(p);e.addEventListener(p,of,{passive:d});var h=sf.get(p);h===void 0?(document.addEventListener(p,of,{passive:d}),sf.set(p,1)):sf.set(p,h+1)}}};l(Dp(Hb)),Lh.add(l);var u=void 0,c=t2(()=>{var f=r??e.appendChild(ha());return xi(()=>{if(a){Te({});var m=xr;m.c=a}i&&(n.$$events=i),Bt&&ta(f,null),Gb=o,u=t(f,n)||{},Gb=!0,Bt&&(rr.nodes_end=Kt),a&&De()}),()=>{for(var m of s){e.removeEventListener(m,of);var p=sf.get(m);--p===0?(document.removeEventListener(m,of),sf.delete(m)):sf.set(m,p)}Lh.delete(l),f!==r&&f.parentNode?.removeChild(f)}});return Wb.set(u,c),u}var Wb=new WeakMap;function Ur(t,e){let r=Wb.get(t);return r?(Wb.delete(t),r(e)):(Ze&&qI(),Promise.resolve())}function ot(t,e,r=!1){Bt&&Fi();var n=t,i=null,a=null,o=zn,s=r?65536:0,l=!1;let u=(f,m=!0)=>{l=!0,c(m,f)},c=(f,m)=>{if(o===(o=f))return;let p=!1;if(Bt){let d=n.data===Pl;!!o===d&&(n=Jc(),En(n),ma(!1),p=!0)}o?(i?Cu(i):m&&(i=xi(()=>m(n))),a&&Lo(a,()=>{a=null})):(a?Cu(a):m&&(a=xi(()=>m(n))),i&&Lo(i,()=>{i=null})),p&&ma(!0)};ea(()=>{l=!1,e(u),l||c(null,null)},s),Bt&&(n=Kt)}var qp=null;function er(t,e){return e}function ZW(t,e,r,n){for(var i=[],a=e.length,o=0;o<a;o++)Mh(e[o].e,i,!0);var s=a>0&&i.length===0&&r!==null;if(s){var l=r.parentNode;Qc(l),l.append(r),n.clear(),Nu(t,e[0].prev,e[a-1].next)}Ub(i,()=>{for(var u=0;u<a;u++){var c=e[u];s||(n.delete(c.k),Nu(t,c.prev,c.next)),yi(c.e,!s)}})}function Yt(t,e,r,n,i,a=null){var o=t,s={flags:e,items:new Map,first:null},l=(e&4)!==0;if(l){var u=t;o=Bt?En(Nn(u)):u.appendChild(ha())}Bt&&Fi();var c=null,f=!1,m=$p(()=>{var p=r();return oo(p)?p:p==null?[]:Dp(p)});ea(()=>{var p=z(m),d=p.length;if(f&&d===0)return;f=d===0;let h=!1;if(Bt){var x=o.data===Pl;x!==(d===0)&&(o=Jc(),En(o),ma(!1),h=!0)}if(Bt){for(var b=null,T,v=0;v<d;v++){if(Kt.nodeType===8&&Kt.data===Bl){o=Kt,h=!0,ma(!1);break}var A=p[v],w=n(A,v);T=T2(Kt,s,b,null,A,w,v,i,e,r),s.items.set(w,T),b=T}d>0&&En(Jc())}if(!Bt){var y=yr;JW(p,s,o,i,e,(y.f&8192)!==0,n,r)}a!==null&&(d===0?c?Cu(c):c=xi(()=>a(o)):c!==null&&Lo(c,()=>{c=null})),h&&ma(!0),z(m)}),Bt&&(o=Kt)}function JW(t,e,r,n,i,a,o,s){var l=(i&8)!==0,u=(i&3)!==0,c=t.length,f=e.items,m=e.first,p=m,d,h=null,x,b=[],T=[],v,A,w,y;if(l)for(y=0;y<c;y+=1)v=t[y],A=o(v,y),w=f.get(A),w!==void 0&&(w.a?.measure(),(x??=new Set).add(w));for(y=0;y<c;y+=1){if(v=t[y],A=o(v,y),w=f.get(A),w===void 0){var E=p?p.e.nodes_start:r;h=T2(E,e,h,h===null?e.first:h.next,v,A,y,n,i,s),f.set(A,h),b=[],T=[],p=h.next;continue}if(u&&XW(w,v,y,i),w.e.f&8192&&(Cu(w.e),l&&(w.a?.unfix(),(x??=new Set).delete(w))),w!==p){if(d!==void 0&&d.has(w)){if(b.length<T.length){var D=T[0],_;h=D.prev;var N=b[0],C=b[b.length-1];for(_=0;_<b.length;_+=1)S2(b[_],D,r);for(_=0;_<T.length;_+=1)d.delete(T[_]);Nu(e,N.prev,C.next),Nu(e,h,N),Nu(e,C,D),p=D,h=C,y-=1,b=[],T=[]}else d.delete(w),S2(w,p,r),Nu(e,w.prev,w.next),Nu(e,w,h===null?e.first:h.next),Nu(e,h,w),h=w;continue}for(b=[],T=[];p!==null&&p.k!==A;)(a||!(p.e.f&8192))&&(d??=new Set).add(p),T.push(p),p=p.next;if(p===null)continue;w=p}b.push(w),h=w,p=w.next}if(p!==null||d!==void 0){for(var B=d===void 0?[]:Dp(d);p!==null;)(a||!(p.e.f&8192))&&B.push(p),p=p.next;var R=B.length;if(R>0){var V=i&4&&c===0?r:null;if(l){for(y=0;y<R;y+=1)B[y].a?.measure();for(y=0;y<R;y+=1)B[y].a?.fix()}ZW(e,B,V,f)}}l&&mo(()=>{if(x!==void 0)for(w of x)w.a?.apply()}),rr.first=e.first&&e.first.e,rr.last=h&&h.e}function XW(t,e,r,n){n&1&&jc(t.v,e),n&2?jc(t.i,r):t.i=r}function T2(t,e,r,n,i,a,o,s,l,u){var c=qp,f=(l&1)!==0,m=(l&16)===0,p=f?m?Tu(i):Hn(i):i,d=l&2?Hn(o):o;Ze&&f&&(p.debug=()=>{var x=typeof d=="number"?o:d.v;u()[x]});var h={i:d,v:p,k:a,a:null,e:null,prev:r,next:n};qp=h;try{return h.e=xi(()=>s(t,p,d),Bt),h.e.prev=r&&r.e,h.e.next=n&&n.e,r===null?e.first=h:(r.next=h,r.e.next=h.e),n!==null&&(n.prev=h,n.e.prev=h.e),h}finally{qp=c}}function S2(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,i=e?e.e.nodes_start:r,a=t.e.nodes_start;a!==n;){var o=Ii(a);i.before(a),a=o}}function Nu(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function ho(t,e,...r){var n=t,i=Ra,a;ea(()=>{i!==(i=e())&&(a&&(yi(a),a=null),Ze&&i==null&&CI(),a=xi(()=>i(n,...r)))},65536),Bt&&(n=Kt)}function M2(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=M2(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function C2(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=M2(t))&&(n&&(n+=" "),n+=e);return n}function Ws(t){return typeof t=="object"?C2(t):t??""}function Tt(t){if(Bt){var e=!1,r=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;wt(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;wt(t,"checked",null),t.checked=i}}};t.__on_r=r,o2(r),$h()}}function Xb(t,e){var r=t.__attributes??={};r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e)}function Ys(t,e){var r=t.__attributes??={};r.checked!==(r.checked=e??void 0)&&(t.checked=e)}function wt(t,e,r,n){var i=t.__attributes??={};if(Bt&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||tY(t,e,r??"");return}i[e]!==(i[e]=r)&&(e==="style"&&"__styles"in t&&(t.__styles={}),e==="loading"&&(t[_I]=r),r==null?t.removeAttribute(e):typeof r!="string"&&eY(t).includes(e)?t[e]=r:t.setAttribute(e,r))}var N2=new Map;function eY(t){var e=N2.get(t.nodeName);if(e)return e;N2.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=wb(n);for(var a in r)r[a].set&&e.push(a);n=Eu(n)}return e}function tY(t,e,r){Ze&&(e==="srcset"&&rY(t,r)||Jb(t.getAttribute(e)??"",r)||UI(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function Jb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function F2(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function rY(t,e){var r=F2(t.srcset),n=F2(e);return n.length===r.length&&n.every(([i,a],o)=>a===r[o][1]&&(Jb(r[o][0],i)||Jb(i,r[o][0])))}function xa(t,e,r){var n=t.__className,i=nY(e,r);Bt&&t.className===i?t.__className=i:(n!==i||Bt&&t.className!==i)&&(e==null&&!r?t.removeAttribute("class"):t.className=i,t.__className=i)}function nY(t,e){return(t??"")+(e?" "+e:"")}function tn(t,e,r){if(r){if(t.classList.contains(e))return;t.classList.add(e)}else{if(!t.classList.contains(e))return;t.classList.remove(e)}}function Qb(t,e,r,n){var i=t.__styles??={};i[e]!==r&&(i[e]=r,r==null?t.style.removeProperty(e):t.style.setProperty(e,r,n?"important":""))}function _t(t,e,r=e){var n=zs();Rh(t,"input",i=>{Ze&&t.type==="checkbox"&&_b();var a=i?t.defaultValue:t.value;if(a=Kb(t)?e0(a):a,r(a),n&&a!==(a=e())){var o=t.selectionStart,s=t.selectionEnd;t.value=a??"",s!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(s,t.value.length))}}),(Bt&&t.defaultValue!==t.value||xn(e)==null&&t.value)&&r(Kb(t)?e0(t.value):t.value),da(()=>{Ze&&t.type==="checkbox"&&_b();var i=e();Kb(t)&&i===e0(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function Kb(t){var e=t.type;return e==="number"||e==="range"}function e0(t){return t===""?null:+t}function qh(t,e,r){if(t.multiple)return oY(t,e);for(var n of t.options){var i=zp(n);if(Mb(i,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function I2(t,e){let r=!0;va(()=>{e&&qh(t,xn(e),r),r=!1;var n=new MutationObserver(()=>{var i=t.__value;qh(t,i)});return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{n.disconnect()}})}function uf(t,e,r=e){var n=!0;Rh(t,"change",i=>{var a=i?"[selected]":":checked",o;if(t.multiple)o=[].map.call(t.querySelectorAll(a),zp);else{var s=t.querySelector(a)??t.querySelector("option:not([disabled])");o=s&&zp(s)}r(o)}),va(()=>{var i=e();if(qh(t,i,n),n&&i===void 0){var a=t.querySelector(":checked");a!==null&&(i=zp(a),r(i))}t.__value=i,n=!1}),I2(t)}function oY(t,e){for(var r of t.options)r.selected=~e.indexOf(zp(r))}function zp(t){return"__value"in t?t.__value:t.value}function P2(t,e){return t===e||t?.[La]===e}function Vo(t={},e,r,n){return va(()=>{var i,a;return da(()=>{i=a,a=n?.()||[],xn(()=>{t!==r(...a)&&(e(t,...a),i&&P2(r(...i),t)&&e(null,...i))})}),()=>{mo(()=>{a&&P2(r(...a),t)&&e(null,...a)})}}),t}function t0(t){xr===null&&Rp("onMount"),Vs&&xr.l!==null?pY(xr).m.push(t):ga(()=>{let e=xn(t);if(typeof e=="function")return e})}function lf(t){xr===null&&Rp("onDestroy"),t0(()=>()=>xn(t))}function pY(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}var zh=!1,Uye=Symbol();function r0(t){var e=zh;try{return zh=!1,[t(),zh]}finally{zh=e}}var bY={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return Ze&&FI(`${t.name}.${String(e)}`),!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function or(t,e,r){return new Proxy(Ze?{props:t,exclude:e,name:r,other:{},to_proxy:[]}:{props:t,exclude:e},bY)}function B2(t){for(var e=rr,r=rr;e!==null&&!(e.f&96);)e=e.parent;try{return ei(e),t()}finally{ei(r)}}function lt(t,e,r,n){var i=(r&1)!==0,a=!Vs||(r&2)!==0,o=(r&8)!==0,s=(r&16)!==0,l=!1,u;o?[u,l]=r0(()=>t[e]):u=t[e];var c=La in t||wh in t,f=o&&($o(t,e)?.set??(c&&e in t&&(E=>t[e]=E)))||void 0,m=n,p=!0,d=!1,h=()=>(d=!0,p&&(p=!1,s?m=xn(n):m=n),m);u===void 0&&n!==void 0&&(f&&a&&NI(e),u=h(),f&&f(u));var x;if(a)x=()=>{var E=t[e];return E===void 0?h():(p=!0,d=!1,E)};else{var b=B2(()=>(i?Vt:$p)(()=>t[e]));b.f|=131072,x=()=>{var E=z(b);return E!==void 0&&(m=void 0),E===void 0?m:E}}if(!(r&4))return x;if(f){var T=t.$$legacy;return function(E,D){return arguments.length>0?((!a||!D||T||l)&&f(D?x():E),E):x()}}var v=!1,A=!1,w=Tu(u),y=B2(()=>Vt(()=>{var E=x(),D=z(w);return v?(v=!1,A=!0,D):(A=!1,w.v=E)}));return i||(y.equals=Gc),function(E,D){if(Fp!==null&&(v=A,x(),z(w)),arguments.length>0){let _=D?z(y):a&&o?Le(E):E;return y.equals(_)||(v=!0,$e(w,_),d&&m!==void 0&&(m=_),xn(()=>z(y))),E}return z(y)}}function k2(t){return new n0(t)}var n0=class{#t;#e;constructor(e){var r=new Map,n=(a,o)=>{var s=Tu(o);return r.set(a,s),s};let i=new Proxy({...e.props||{},$$events:{}},{get(a,o){return z(r.get(o)??n(o,Reflect.get(a,o)))},has(a,o){return o===wh?!0:(z(r.get(o)??n(o,Reflect.get(a,o))),Reflect.has(a,o))},set(a,o,s){return $e(r.get(o)??n(o,s),s),Reflect.set(a,o,s)}});this.#e=(e.hydrate?Yb:Vr)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&af(),this.#t=i.$$events;for(let a of Object.keys(this.#e))a==="$set"||a==="$destroy"||a==="$on"||gi(this,a,{get(){return this.#e[a]},set(o){this.#e[a]=o},enumerable:!0});this.#e.$set=a=>{Object.assign(i,a)},this.#e.$destroy=()=>{Ur(this.#e)}}$set(e){this.#e.$set(e)}$on(e,r){this.#t[e]=this.#t[e]||[];let n=(...i)=>r.call(this,...i);return this.#t[e].push(n),()=>{this.#t[e]=this.#t[e].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}};var DY;typeof HTMLElement=="function"&&(DY=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&this.attachShadow({mode:"open"})}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){let n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){let n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return i=>{let a=document.createElement("slot");n!=="default"&&(a.name=n),ee(i,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},r=MY(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(let n of this.attributes){let i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=i0(i,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=k2({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=$b(()=>{da(()=>{this.$$r=!0;for(let n of bb(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let i=i0(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(let n in this.$$l)for(let i of this.$$l[n]){let a=this.$$c.$on(n,i);this.$$l_u.set(i,a)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=i0(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return bb(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function i0(t,e,r,n){let i=r[t]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;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}}function MY(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}var NY=ue('<div class="mb-icon-wrapper"></div>');function Yr(t,e){Te(e,!0);let r=lt(e,"iconName",3,""),n=bt(void 0);ga(()=>z(n)?e.plugin.internal.setIcon(z(n),r()):void 0);var i=Xr(),a=Je(i);{var o=s=>{var l=NY();Vo(l,u=>$e(n,u),()=>z(n)),ee(s,l)};ot(a,s=>{r().length>0&&s(o)})}ee(t,i),De()}var FY=(t,e)=>e(t,"left"),IY=ue('<button class="mb-button-inner"><!> </button>');function Hp(t,e){Te(e,!0);let r=lt(e,"variant",19,()=>"default"),n=lt(e,"disabled",7,!1),i=lt(e,"tooltip",3,""),a=lt(e,"label",3,""),o=lt(e,"icon",3,""),s=lt(e,"cssStyle",3,""),l=lt(e,"backgroundImage",3,""),u=lt(e,"error",3,!1),c=lt(e,"onclick",3,()=>{}),f=lt(e,"onauxclick",3,()=>{});async function m(b,T){if(!n()){n(!0);try{T==="left"?await c()(b):T==="middle"&&await f()(b)}catch(v){console.warn("failed to run button component on click",v)}finally{n(!1)}}}var p=IY();p.__click=[FY,m];var d=ye(p);{var h=b=>{Yr(b,{get plugin(){return e.plugin},get iconName(){return o()}})};ot(d,b=>{o()&&b(h)})}var x=le(d);ce(p),Re(()=>{wt(p,"style",s()),wt(p,"aria-label",i()),p.disabled=n(),tn(p,"mod-cta",r()==="primary"),tn(p,"mod-warning",r()==="destructive"),tn(p,"mod-plain",r()==="plain"),tn(p,"disabled",n()),tn(p,"mb-error",u()),Qb(p,"background-image",l()?`url("${l()}")`:void 0),ht(x,` ${a()??""}`)}),Pi("auxclick",p,b=>m(b,"middle")),ee(t,p),De()}kt(["click"]);var Fu=class extends Ni{constructor(e,r,n,i,a,o,s){super(),this.plugin=e,this.config=r,this.filePath=n,this.isInline=i==="inline",this.position=a,this.isInGroup=o,this.isPreview=s}onMount(e){mt.empty(e),mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.isInline?"mb-button-inline":"mb-button-block"]),!(!this.isInline&&!this.isPreview&&!this.isInGroup&&(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(r=>r!=="")),this.buttonComponent=Vr(Hp,{target:e,props:{plugin:this.plugin,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:zx(this.config.tooltip)?this.config.tooltip:void 0,cssStyle:this.config.cssStyle,backgroundImage:zx(this.config.backgroundImage)?this.plugin.internal.imagePathToUri(this.config.backgroundImage):void 0,onclick:async r=>{await this.plugin.api.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),this.plugin.api.buttonActionRunner.mouseEventToClickContext(r,"left"))},onauxclick:async r=>{await this.plugin.api.buttonActionRunner.runButtonActions(this.config,this.filePath,this.getContext(),this.plugin.api.buttonActionRunner.mouseEventToClickContext(r,"middle"))}}}))}getContext(){return{position:this.position?.getPosition(),isInGroup:this.isInGroup,isInline:this.isInline}}onUnmount(){this.buttonComponent&&Ur(this.buttonComponent),!this.isInline&&!this.isPreview&&this.config?.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var Hh=class extends Ni{constructor(e,r,n,i,a){super(),this.plugin=e,this.referencedIds=r,this.filePath=n,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,r){return mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),Vr(Hp,{target:e,props:{plugin:this.plugin,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${r}' 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 r of this.referencedIds){let n=mt.createElement(e,"span"),i=this.renderInitialButton(n,r),a,o=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,r,s=>{i&&Ur(i),i=void 0,a=new Fu(this.plugin,s,this.filePath,this.renderChildType,this.notePosition,!0,!1),a.mount(n)});this.registerUnmountCb(()=>{i&&Ur(i),i=void 0,a?.unmount(),o()})}}onUnmount(e){mt.empty(e)}};var Gh=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.errorCollection=new Qt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(super.onMount(e),mt.removeAllClasses(e),this.declaration.errorCollection.isEmpty())try{this.buttonField=new Hh(this.plugin,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}catch(r){this.errorCollection.add(r),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(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.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),Di(e,"inline button")}};var Wh=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 Yh=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let r=new Set,n=new Qt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?n.add(new Cs({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."})):r.has(i.id)?n.add(new Cs({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."})):(r.add(i.id),this.buttonTemplates.set(i.id,i));return n.hasErrors()&&this.buttonTemplates.clear(),n}registerButtonLoadListener(e,r,n){let i=this.getButton(e,r);i&&n(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(r)||a.set(r,new Map);let o=a.get(r),s=Fr();return o.set(s,n),()=>this.removeButtonLoadListener(e,r,s)}notifyButtonLoadListeners(e,r){let n=this.getButton(e,r);if(!n)throw new Error(`ButtonManager | button with id ${r} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(r);if(a)for(let[o,s]of a)s(n)}removeButtonLoadListener(e,r,n){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(r);a&&(a.delete(n),a.size===0&&i.delete(r),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,r){if(r.id===void 0||r.id==="")throw new Error("ButtonManager | button id is undefined");if(this.buttonTemplates.has(r.id))throw new Error(`ButtonManager | button with id "${r.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(r.id,new Wh(r)),this.notifyButtonLoadListeners(e,r.id)}getButton(e,r){if(this.buttonTemplates.has(r))return this.buttonTemplates.get(r);let n=this.buttons.get(e);if(n)return n.get(r)?.getValue()}removeButton(e,r){let n=this.buttons.get(e);n&&(n.get(r)?.decrement(),n.get(r)?.isEmpty()&&n.delete(r),n.size===0&&this.buttons.delete(e))}};var jh=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new Qt(this.getUuid()),this.errorCollection.merge(i.errorCollection)}onMount(e){if(super.onMount(e),mt.removeAllClasses(e),this.declaration.config&&this.declaration.errorCollection.isEmpty())try{this.buttonField=new Fu(this.plugin,this.declaration.config,this.getFilePath(),"block",this.position,!1,this.isPreview),this.buttonField.mount(e)}catch(r){this.errorCollection.add(r),this.renderErrorIndicator(e)}else this.renderErrorIndicator(e)}renderErrorIndicator(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.declaration.declarationString})}onUnmount(e){super.onUnmount(e),this.buttonField?.unmount(),Di(e,"button")}};var Zh=class extends qn{constructor(e,r,n,i,a){super(e,r,n),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{content:""};if(e.length>1)return{error:"Embed may only contain one link"};let r=e[0],n=Cn.parseLink(r);if(!n.internal)return{error:`${r} is not an internal link`};let i=this.plugin.internal.file.getPathByName(n.target,this.getFilePath());return i===void 0?{error:`"${n.target}" is not created yet`}:{content:await this.plugin.internal.file.read(i)}}exceedsMaxDepth(){return this.depth>ld}createEmbedMessage(e,r){e.createSpan({text:r,cls:"mb-embed-message"})}async renderContent(e){try{if(this.exceedsMaxDepth()){this.createEmbedMessage(e,"Max embed depth exceeded");return}let r=await this.parseContent();if(r.error){this.createEmbedMessage(e,r.error);return}if(r.content===void 0){this.createEmbedMessage(e,"Embed content not found");return}let n=r.content.replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.plugin.internal.renderMarkdown(n,e,this.getFilePath())}catch(r){let n=new Qt("Embed");n.add(r),this.plugin.internal.createErrorIndicator(e,{errorCollection:n})}}onMount(e){super.onMount(e),e.addClass("mb-embed"),this.renderContent(e)}onUnmount(e){super.onUnmount(e),e.removeClass("mb-embed"),this.markdownUnloadCallback?.(),Di(e,"Embed")}};var Jh=class extends qn{constructor(e,r,n){super(e,r,n)}onMount(e){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){super.onUnmount(e),mt.empty(e),Di(e,"Excluded")}};var Xh=class{constructor(e,r,n){this.plugin=e,this.mounted=!1,this.svelteComponent=r,this.onValueChange=n}setValue(e){this.svelteComponentInstance?.setValue(e)}getInstance(){return this.svelteComponentInstance}mount(e,r,n={}){let i=Object.assign({plugin:this.plugin,value:r,onValueChange:this.onValueChange},n);this.svelteComponentInstance=Vr(this.svelteComponent,{target:e,props:i}),this.mounted=!0}unmount(){this.svelteComponentInstance&&Ur(this.svelteComponentInstance),this.mounted=!1}isMounted(){return this.mounted}};var cr=class extends Ni{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.svelteWrapper=new Xh(this.plugin,this.getSvelteComponent(),r=>{this.updateDataAttributes(r),this.notifySubscription(this.mapValue(r))}),this.inputSignal=new nh(void 0,r=>{let n=this.filterValue(r);return n!==void 0?n:this.getDefaultValue()})}reverseMapValue(e){let r=this.rawReverseMapValue(e);if(r!==void 0)return r;let n=this.rawReverseMapValue(this.getDefaultValue());return n!==void 0?n:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.inputSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.inputSignal.setDirect(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.write(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let r=this.filterValue(e.value);return r!==void 0?r:this.mapValue(this.getFallbackDefaultValue())}updateDataAttributes(e){this.mountTarget&&(this.mountTarget.dataset.internalValue=JSON.stringify(e))}getMountArgs(){return{}}onMount(e){this.mountTarget=e,this.inputSignal.registerListener({callback:n=>this.svelteWrapper.setValue(this.reverseMapValue(n))}),this.inputSignal.registerListener({callback:n=>{this.updateDataAttributes(this.reverseMapValue(n))}});let r=this.mountable.getBindTarget();r&&(this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,r,()=>this.mountable.unmount())),this.svelteWrapper.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.mountTarget=void 0,this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.svelteWrapper.unmount()}};var PY=(t,e,r,n)=>r.onValueChange(z(n)),BY=ue('<input type="date">');function a0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(o){$e(n,Le(o))}var a=BY();return Tt(a),a.__input=[PY,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),ee(t,a),De({setValue:i})}kt(["input"]);var Qh=class extends cr{filterValue(e){return os(e)}getFallbackDefaultValue(){return oi.stringify(oi.getDefaultDate())}getSvelteComponent(){return a0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function kY(t,e,r){r.showDatePicker()}function $Y(t,e,r){t.key===" "&&r.showDatePicker()}var OY=ue('<div class="mb-date-picker-input" role="button" tabindex="0"><span class="mb-date-picker-text"> </span> <!></div>');function o0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(u){$e(n,Le(u))}var a=OY();a.__click=[kY,r,e],a.__keydown=[$Y,r,e];var o=ye(a),s=ye(o,!0);Re(()=>ht(s,z(n)?z(n).format(e.dateFormat):"none")),ce(o);var l=le(o,2);return Yr(l,{get plugin(){return e.plugin},iconName:"calendar"}),ce(a),ee(t,a),De({setValue:i})}kt(["click","keydown"]);var Kh=class extends cr{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 r=oi.parse(e);if(r.isValid())return oi.stringify(r)}getFallbackDefaultValue(){return oi.getDefaultDate()}getSvelteComponent(){return o0}rawMapValue(e){return e===null?null:(console.log("value",e,oi.stringify(e),oi.dateFormat),oi.stringify(e))}rawReverseMapValue(e){if(e===null)return null;let r=oi.parse(e);if(r.isValid())return r}getMountArgs(){return{dateFormat:this.mountable.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.mountable.plugin.internal.openDatePickerModal(this)}}}};var RY=(t,e,r,n)=>r.onValueChange(z(n)),LY=ue('<input type="datetime-local">');function s0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(o){$e(n,Le(o))}var a=LY();return Tt(a),a.__input=[RY,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),ee(t,a),De({setValue:i})}kt(["input"]);var eg=class extends cr{filterValue(e){return os(e)}getFallbackDefaultValue(){return oi.stringify(oi.getDefaultDate())}getSvelteComponent(){return s0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var VY=ue("<div></div>");function u0(t,e){Te(e,!0);let r,n;lf(()=>{n?.()});async function i(o){n?.(),n=await e.plugin.internal.renderMarkdown(o,r,e.filePath)}ga(()=>void i(e.value));var a=VY();Vo(a,o=>r=o,()=>r),ee(t,a),De()}var UY=(t,e)=>e(),qY=(t,e)=>e(),zY=(t,e,r,n)=>r.onValueChange(z(n)),HY=ue("<textarea></textarea>"),GY=ue('<div class="mb-editor-input card" role="button" tabindex="0"><!></div>');function l0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value)),i=bt(!1);function a(p){$e(n,Le(p))}function o(){$e(i,!1)}function s(){$e(i,!0)}function l(p){p.key===" "&&s()}var u=GY();u.__click=[UY,s];var c=ye(u);{var f=p=>{var d=HY();On(d),d.__focusout=[qY,o],d.__input=[zY,r,e,n],_t(d,()=>z(n),h=>$e(n,h)),ee(p,d)},m=p=>{u0(p,{get value(){return z(n)},get plugin(){return e.plugin},get filePath(){return e.filePath}})};ot(c,p=>{z(i)?p(f):p(m,!1)})}return ce(u),Pi("keypress",u,p=>l(p)),ee(t,u),De({setValue:a})}kt(["click","focusout","input"]);var tg=class extends cr{filterValue(e){return _u(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return l0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,r)=>void this.renderInElement(e,r),filePath:this.mountable.getFilePath()}}async renderInElement(e,r){this.mdUnloadCallback?.(),e.innerHTML="",this.mdUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(r,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};var WY=ue("<button><!></button>");function Et(t,e){Te(e,!0);let r=lt(e,"variant",19,()=>"default"),n=lt(e,"disabled",3,!1),i=lt(e,"tooltip",3,""),a=lt(e,"classes",3,""),o=lt(e,"onclick",3,()=>{});var s=WY();s.__click=function(...u){o()?.apply(this,u)};var l=ye(s);ho(l,()=>e.children),ce(s),Re(()=>{xa(s,`mb-button-inner ${a()??""}`),wt(s,"aria-label",i()),s.disabled=n(),tn(s,"mod-cta",r()==="primary"),tn(s,"mod-warning",r()==="destructive"),tn(s,"mod-plain",r()==="plain"),tn(s,"disabled",n())}),ee(t,s),De()}kt(["click"]);var YY=ue('<div class="mb-image-card" role="listitem"><img class="mb-image-card-image"> <div class="mb-image-card-footer"><span> </span></div></div>'),jY=ue('<div class="mb-image-card-grid"></div> <div class="mb-list-input"><!></div>',1);function c0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(m){$e(n,Le(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Copy image path",icon:"copy",onclick:()=>{let h=z(n)[p];navigator.clipboard.writeText(h).then(()=>{e.plugin.internal.showNotice("Image path copied to clipboard")}).catch(()=>{e.plugin.internal.showNotice("Failed to copy image path to clipboard")})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=jY(),u=Je(l);Yt(u,21,()=>z(n),er,(m,p,d)=>{var h=YY();h.__contextmenu=A=>s(A,d);var x=ye(h);Re(()=>wt(x,"src",e.plugin.internal.imagePathToUri(z(p))));var b=le(x,2),T=ye(b),v=ye(T,!0);ce(T),ce(b),ce(h),Re(()=>{wt(x,"alt",z(p)),ht(v,z(p))}),ee(m,h)}),ce(u);var c=le(u,2),f=ye(c);return Et(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(m,p)=>{Nt();var d=lr("Add new image");ee(m,d)},$$slots:{default:!0}}),ce(c),ee(t,l),De({setValue:i,pushValue:a})}kt(["contextmenu"]);var rg=class extends cr{filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return c0}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(r=>ko(r)).filter(r=>r!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>{this.svelteWrapper.getInstance()?.pushValue(e)})}};var ZY=ue('<img class="mb-image-card-image">'),JY=ue('<div class="mb-image-card"><!> <!></div>');function f0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(c){$e(n,Le(c))}function a(){e.showSuggester()}var o=JY(),s=ye(o);{var l=c=>{var f=ZY();Re(()=>wt(f,"src",e.plugin.internal.imagePathToUri(z(n)))),Re(()=>{wt(f,"alt",z(n)),wt(f,"aria-label",z(n))}),ee(c,f)};ot(s,c=>{z(n)&&c(l)})}var u=le(s,2);return Et(u,{get variant(){return"plain"},onclick:a,classes:"mb-image-card-button",tooltip:"Change image",children:(c,f)=>{Yr(c,{iconName:"pencil",get plugin(){return e.plugin}})},$$slots:{default:!0}}),ce(o),ee(t,o),De({setValue:i})}var ng=class extends cr{filterValue(e){return _u(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return f0}rawMapValue(e){return e}rawReverseMapValue(e){return ko(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};var XY=ue('<a target="_blank" rel="noopener"> </a>'),QY=ue('<a target="_blank" rel="noopener"> </a>');function js(t,e){Te(e,!0);let r=Vt(()=>e.mdLink.block?`${e.mdLink.target}#${e.mdLink.block}`:e.mdLink.target),n=Vt(()=>e.mdLink.internal?"internal-link":"external-link");var i=Xr(),a=Je(i);{var o=l=>{var u=XY(),c=ye(u,!0);ce(u),Re(()=>{wt(u,"data-href",z(r)),wt(u,"href",z(r)),xa(u,Ws(z(n))),wt(u,"aria-label",z(r)),ht(c,e.mdLink.alias)}),ee(l,u)},s=l=>{var u=QY(),c=ye(u,!0);ce(u),Re(()=>{wt(u,"data-href",z(r)),wt(u,"href",z(r)),xa(u,Ws(z(n))),ht(c,z(r))}),ee(l,u)};ot(a,l=>{e.mdLink.alias?l(o):l(s,!1)})}ee(t,i),De()}var KY=ue("<!><span>,</span> <span></span>",1),ej=ue("<!> <!>",1);function Gp(t,e){Te(e,!0);let r=lt(e,"elements",19,()=>[]);var n=ej(),i=Je(n);Yt(i,17,()=>r().slice(0,r().length-1),er,(o,s)=>{var l=KY(),u=Je(l);ho(u,()=>e.children,()=>z(s)),Nt(3),ee(o,l)});var a=le(i,2);ho(a,()=>e.children,()=>r()[r().length-1]),ee(t,n),De()}var tj=ue('<span class="mb-whitespace-pre"> </span>'),rj=ue("<span> </span>"),nj=ue("<span><!></span>"),ij=ue("<span><!></span>");function za(t,e){Te(e,!0);let r=lt(e,"value",3,void 0),n=Vt(()=>gI(r(),!1));var i=Xr(),a=Je(i);{var o=l=>{var u=tj(),c=ye(u,!0);ce(u),Re(()=>ht(c,z(n))),ee(l,u)},s=l=>{var u=Xr(),c=Je(u);{var f=p=>{var d=nj(),h=ye(d);Gp(h,{get elements(){return z(n)},children:(b,T=Ra)=>{var v=Xr(),A=Je(v);{var w=E=>{var D=rj(),_=ye(D,!0);ce(D),Re(()=>ht(_,T())),ee(E,D)},y=E=>{js(E,{get mdLink(){return T()}})};ot(A,E=>{typeof T()=="string"?E(w):E(y,!1)})}ee(b,v)},$$slots:{default:!0}}),ce(d),ee(p,d)},m=p=>{var d=ij(),h=ye(d);js(h,{get mdLink(){return z(n)}}),ce(d),ee(p,d)};ot(c,p=>{Array.isArray(z(n))?p(f):p(m,!1)},!0)}ee(l,u)};ot(a,l=>{typeof z(n)=="string"?l(o):l(s,!1)})}ee(t,i),De()}function aj(t,e,r){t.key===" "&&r.showInput()}var oj=ue('<div class="mb-inline-list-item" role="listitem"><!></div>'),sj=(t,e,r)=>r.showInput(),uj=ue('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function p0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(m){$e(n,Le(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Edit",icon:"pencil",onclick:()=>{e.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:ko(z(n)[p]),multiline:!1,onSubmit:h=>{z(n)[p]=h,e.onValueChange(z(n))},onCancel:()=>{}})}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=uj(),u=ye(l);Yt(u,17,()=>z(n),er,(m,p,d)=>{var h=oj();h.__contextmenu=b=>s(b,d);var x=ye(h);za(x,{get value(){return z(p)}}),ce(h),ee(m,h)});var c=le(u,2);c.__click=[sj,r,e],c.__keydown=[aj,r,e];var f=le(ye(c),2);return Yr(f,{get plugin(){return e.plugin},iconName:"plus"}),ce(c),ce(l),ee(t,l),De({setValue:i,pushValue:a})}kt(["contextmenu","click","keydown"]);var ig=class extends cr{filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return p0}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=>{this.svelteWrapper.getInstance()?.pushValue(e)},onCancel:()=>{}})}};function lj(t,e,r){if(!r.allowOther){r.showSuggester();return}r.plugin.internal.createContextMenu([{name:"From Options",onclick:()=>r.showSuggester()},{name:"From Text",onclick:()=>r.showTextPrompt()}]).showWithEvent(t)}function cj(t,e,r){t.key===" "&&r.showSuggester()}var fj=ue('<div class="mb-inline-list-item" role="listitem"><!></div>'),pj=ue('<div class="mb-inline-list"><!> <div class="mb-inline-list-add" role="button" tabindex="0"><span>&#x200B;</span> <!></div></div>');function m0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(m){$e(n,Le(m))}function a(m){z(n).push(m),e.onValueChange(z(n))}function o(m){z(n).splice(m,1),e.onValueChange(z(n))}function s(m,p){let d=[];p>0&&d.push({name:"Move left",icon:"arrow-left",onclick:()=>{let h=z(n)[p-1];z(n)[p-1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),p<z(n).length-1&&d.push({name:"Move right",icon:"arrow-right",onclick:()=>{let h=z(n)[p+1];z(n)[p+1]=z(n)[p],z(n)[p]=h,e.onValueChange(z(n))}}),d.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(p)}),e.plugin.internal.createContextMenu(d).showWithEvent(m)}var l=pj(),u=ye(l);Yt(u,17,()=>z(n),er,(m,p,d)=>{var h=fj();h.__contextmenu=b=>s(b,d);var x=ye(h);za(x,{get value(){return z(p)}}),ce(h),ee(m,h)});var c=le(u,2);c.__click=[lj,r,e],c.__keydown=[cj,r,e];var f=le(ye(c),2);return Yr(f,{get plugin(){return e.plugin},iconName:"plus"}),ce(c),ce(l),ee(t,l),De({setValue:i,pushValue:a})}kt(["contextmenu","click","keydown"]);var ag=class extends cr{filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return m0}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.svelteWrapper.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper.getInstance()?.pushValue(e)},onCancel:()=>{}})}};var mj=(t,e)=>e(),dj=ue("<option> </option>"),hj=ue('<select class="dropdown"></select>');function d0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(s){$e(n,Le(s))}function a(){e.onValueChange(z(n))}var o=hj();return o.__change=[mj,a],Yt(o,21,()=>e.options,er,(s,l)=>{var u=dj(),c={},f=ye(u,!0);ce(u),Re(()=>{c!==(c=z(l).value)&&(u.value=(u.__value=z(l).value)==null?"":z(l).value),ht(f,z(l).name)}),ee(s,u)}),ce(o),uf(o,()=>z(n),s=>$e(n,s)),ee(t,o),De({setValue:i})}kt(["change"]);var og=class extends cr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Au(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return d0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var gj=ue('<div class="mb-list-item" role="listitem"><!></div>'),vj=ue('<span class="mb-list-empty">Empty</span>'),yj=ue('<textarea tabindex="0"></textarea>'),xj=(t,e,r)=>{t.key==="Enter"&&z(e).length>0&&r()},bj=ue('<input type="text" tabindex="0">'),wj=ue("<span> </span>"),_j=ue('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!> <!></div>',1);function h0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value)),i=bt("");function a(A){$e(n,Le(A))}function o(){z(n).push(z(i)),e.onValueChange(z(n)),$e(i,"")}function s(A){z(n).splice(A,1),e.onValueChange(z(n))}function l(A,w){let y=w.toString();return`${A.toString().padStart(y.length,"0")}/${y}`}function u(A,w){let y=[];w>0&&y.push({name:"Move up",icon:"arrow-up",onclick:()=>{let E=z(n)[w-1];z(n)[w-1]=z(n)[w],z(n)[w]=E,e.onValueChange(z(n))}}),w<z(n).length-1&&y.push({name:"Move down",icon:"arrow-down",onclick:()=>{let E=z(n)[w+1];z(n)[w+1]=z(n)[w],z(n)[w]=E,e.onValueChange(z(n))}}),y.push({name:"Edit",icon:"pencil",onclick:()=>{e.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:ko(z(n)[w]),multiline:e.multiLine,onSubmit:E=>{z(n)[w]=E,e.onValueChange(z(n))},onCancel:()=>{}})}}),y.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(w)}),e.plugin.internal.createContextMenu(y).showWithEvent(A)}var c=_j(),f=Je(c);Yt(f,21,()=>z(n),er,(A,w,y)=>{var E=gj();E.__contextmenu=_=>u(_,y);var D=ye(E);za(D,{get value(){return z(w)}}),ce(E),ee(A,E)},A=>{var w=vj();ee(A,w)}),ce(f);var m=le(f,2),p=ye(m);{var d=A=>{var w=yj();On(w),Re(()=>{wt(w,"placeholder",e.placeholder),wt(w,"maxlength",e.limit)}),_t(w,()=>z(i),y=>$e(i,y)),ee(A,w)},h=A=>{var w=bj();Tt(w),w.__keyup=[xj,i,o],Re(()=>{wt(w,"placeholder",e.placeholder),wt(w,"maxlength",e.limit)}),_t(w,()=>z(i),y=>$e(i,y)),ee(A,w)};ot(p,A=>{e.multiLine?A(d):A(h,!1)})}var x=le(p,2);{var b=A=>{var w=wj(),y=ye(w,!0);Re(()=>ht(y,l(z(n).length,e.limit))),ce(w),Re(()=>xa(w,`mb-content-limit-indicator ${z(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),ee(A,w)};ot(x,A=>{e.limit!==void 0&&A(b)})}var T=le(x,2),v=Vt(()=>!z(i));return Et(T,{onclick:()=>o(),get disabled(){return z(v)},children:(A,w)=>{Yr(A,{get plugin(){return e.plugin},iconName:"plus"})},$$slots:{default:!0}}),ce(m),ee(t,c),De({setValue:a})}kt(["contextmenu","keyup"]);var sg=class extends cr{filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return h0}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}}};var Aj=ue('<div class="mb-list-item" role="listitem"><!></div>'),Sj=ue('<span class="mb-list-empty">Empty</span>'),Ej=ue('<div class="mb-list-items"></div> <div class="mb-list-input"><!> <!></div>',1);function g0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(d){$e(n,Le(d))}function a(d){z(n).push(d),e.onValueChange(z(n))}function o(d){z(n).splice(d,1),e.onValueChange(z(n))}function s(d,h){let x=[];h>0&&x.push({name:"Move up",icon:"arrow-up",onclick:()=>{let b=z(n)[h-1];z(n)[h-1]=z(n)[h],z(n)[h]=b,e.onValueChange(z(n))}}),h<z(n).length-1&&x.push({name:"Move down",icon:"arrow-down",onclick:()=>{let b=z(n)[h+1];z(n)[h+1]=z(n)[h],z(n)[h]=b,e.onValueChange(z(n))}}),x.push({name:"Remove",icon:"x",warning:!0,onclick:()=>o(h)}),e.plugin.internal.createContextMenu(x).showWithEvent(d)}var l=Ej(),u=Je(l);Yt(u,21,()=>z(n),er,(d,h,x)=>{var b=Aj();b.__contextmenu=v=>s(v,x);var T=ye(b);za(T,{get value(){return z(h)}}),ce(b),ee(d,b)},d=>{var h=Sj();ee(d,h)}),ce(u);var c=le(u,2),f=ye(c);Et(f,{get variant(){return"default"},onclick:()=>e.showSuggester(),children:(d,h)=>{Nt();var x=lr("Add new item");ee(d,x)},$$slots:{default:!0}});var m=le(f,2);{var p=d=>{Et(d,{get variant(){return"default"},onclick:()=>e.showTextPrompt(),children:(h,x)=>{Nt();var b=lr("Add other item");ee(h,b)},$$slots:{default:!0}})};ot(m,d=>{e.allowOther&&d(p)})}return ce(c),ee(t,l),De({setValue:i,pushValue:a})}kt(["contextmenu"]);var ug=class extends cr{filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return g0}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.svelteWrapper.getInstance()?.pushValue(e.value)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{this.svelteWrapper.getInstance()?.pushValue(e)},onCancel:()=>{}})}};var Tj=(t,e,r)=>{t.target instanceof HTMLInputElement||e(z(r).value)},Dj=(t,e,r)=>e(z(r).value),Mj=ue('<div class="mb-select-input-element mb-mod-multi" role="button" tabindex="0"><input type="checkbox"> <!></div>');function v0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(u){$e(n,Le(u))}function a(u){z(n).includes(u)?$e(n,Le(z(n).filter(c=>c!==u))):z(n).push(u),e.onValueChange(z(n))}function o(u,c){u.key===" "&&a(c)}var s=Xr(),l=Je(s);return Yt(l,17,()=>e.options,er,(u,c)=>{var f=Mj();f.__click=[Tj,a,c];let m=Vt(()=>z(n).includes(z(c).value));Re(()=>tn(f,"is-selected",z(m)));var p=ye(f);Tt(p),Re(()=>Ys(p,z(n).includes(z(c).value))),p.__input=[Dj,a,c];var d=le(p,2);za(d,{get value(){return z(c).name}}),ce(f),Pi("keypress",f,h=>o(h,z(c).value)),ee(u,f)}),ee(t,s),De({setValue:i})}kt(["click","input"]);var lg=class extends cr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return ao(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return v0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var Cj=(t,e,r,n)=>r.onValueChange(z(n)),Nj=ue('<input type="number" tabindex="0">');function y0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(o){$e(n,Le(o))}var a=Nj();return Tt(a),a.__input=[Cj,r,e,n],Re(()=>wt(a,"placeholder",e.placeholder)),_t(a,()=>z(n),o=>$e(n,o)),ee(t,a),De({setValue:i})}kt(["input"]);var cg=class extends cr{filterValue(e){return zc(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return y0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Number"}}};function $2(t,e,r){e(),r(t)}var Fj=ue('<span class="mb-progress-bar-value"> </span> <span class="mb-progress-bar-label-left"> </span> <span class="mb-progress-bar-label-right"> </span>',1),Ij=ue('<div class="mb-progress-bar-input" tabindex="0" role="button"><div class="mb-progress-bar-progress" role="slider" tabindex="0"></div> <!></div>');function x0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value)),i=!1,a,o=0,s;function l(y){$e(n,Le(y))}function u(y){$e(n,Le(y)),e.onValueChange(y)}function c(y){return y=pp(y,e.minValue,e.maxValue),Ux(y,e.minValue,e.maxValue,0,100)}function f(){i=!0}function m(){i=!1}function p(y){if(!i)return;y.stopPropagation&&y.stopPropagation(),y.preventDefault&&y.preventDefault();let E=y instanceof TouchEvent?y.touches[0].clientX:y.clientX;d(E)}function d(y){let E=a.getBoundingClientRect();y=pp(y,E.left,E.right);let D=Ux(y,E.left,E.right,e.minValue,e.maxValue);D=h(D,e.stepSize),u(D)}function h(y,E){return Number.parseFloat((Math.round(y/E)*E).toFixed(10))}function x(y){o<50&&(o+=1);let E=Math.ceil(o/5);if(y.key==="ArrowUp"||y.key==="ArrowRight"){let D=pp(z(n)+E,e.minValue,e.maxValue);u(D)}if(y.key==="ArrowDown"||y.key==="ArrowLeft"){let D=pp(z(n)-E,e.minValue,e.maxValue);u(D)}window.clearTimeout(s),s=window.setTimeout(()=>o=1,100)}var b=Ij();Pi("touchmove",Hs,p,void 0,!1),Pi("touchcancel",Hs,m),Pi("touchend",Hs,m),Pi("mousemove",Hs,p),Pi("mouseup",Hs,m),b.__keydown=x,b.__mousedown=[$2,f,p],b.__touchstart=[$2,f,p];var T=ye(b);let v=Vt(()=>`width: ${c(z(n))}%`);Re(()=>wt(T,"aria-label",z(n).toString()));var A=le(T,2);{var w=y=>{var E=Fj(),D=Je(E),_=ye(D,!0);ce(D);var N=le(D,2),C=ye(N,!0);ce(N);var B=le(N,2),R=ye(B,!0);ce(B),Re(()=>{ht(_,z(n)),ht(C,e.minValue),ht(R,e.maxValue)}),ee(y,E)};ot(A,y=>{e.addLabels&&y(w)})}return ce(b),Vo(b,y=>a=y,()=>a),Re(()=>{wt(T,"style",z(v)),wt(T,"aria-valuemin",e.minValue),wt(T,"aria-valuemax",e.maxValue),wt(T,"aria-valuenow",z(n))}),Pi("dragstart",T,()=>i=!0),ee(t,b),De({setValue:l})}kt(["keydown","mousedown","touchstart"]);var fg=class extends cr{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 Hr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return yd(zc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return x0}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)===!0}}};var Pj=(t,e,r)=>{t.target instanceof HTMLInputElement||e(z(r).value)},Bj=(t,e,r)=>e(z(r).value),kj=ue('<div class="mb-select-input-element" role="button" tabindex="0"><input type="checkbox"> <!></div>');function b0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(u){$e(n,Le(u))}function a(u){z(n)===u?$e(n,null):$e(n,Le(u)),e.onValueChange(z(n))}function o(u,c){u.key===" "&&a(c)}var s=Xr(),l=Je(s);return Yt(l,17,()=>e.options,er,(u,c)=>{var f=kj();f.__click=[Pj,a,c];var m=ye(f);Tt(m),m.__input=[Bj,a,c];var p=le(m,2);za(p,{get value(){return z(c).name}}),ce(f),Re(()=>{tn(f,"is-selected",z(c).value===z(n)),Ys(m,z(c).value===z(n))}),Pi("keypress",f,d=>o(d,z(c).value)),ee(u,f)}),ee(t,s),De({setValue:i})}kt(["click","input"]);var pg=class extends cr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Au(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return b0}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};var $j=ue('<span class="mb-slider-input-label"> </span>'),Oj=(t,e,r,n)=>r.onValueChange(z(n)),Rj=ue('<span class="mb-slider-input-label"> </span>'),Lj=ue('<!> <input class="mb-slider-input slider" type="range" tabindex="0"> <!>',1);function w0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(f){$e(n,Le(f))}var a=Lj(),o=Je(a);{var s=f=>{var m=$j(),p=ye(m,!0);ce(m),Re(()=>ht(p,e.minValue)),ee(f,m)};ot(o,f=>{e.addLabels&&f(s)})}var l=le(o,2);Tt(l),l.__input=[Oj,r,e,n];var u=le(l,2);{var c=f=>{var m=Rj(),p=ye(m,!0);ce(m),Re(()=>ht(p,e.maxValue)),ee(f,m)};ot(u,f=>{e.addLabels&&f(c)})}return Re(()=>{wt(l,"min",e.minValue),wt(l,"max",e.maxValue),wt(l,"step",e.stepSize)}),_t(l,()=>z(n),f=>$e(n,f)),ee(t,a),De({setValue:i})}kt(["input"]);var mg=class extends cr{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 Hr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return yd(zc(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return w0}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}}};var Vj=ue("<span> </span>"),Uj=ue('<div class="mb-suggest-input"><div class="mb-suggest-text"><!></div> <!> <!></div>');function _0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(h){$e(n,Le(h))}let a=Vt(()=>z(n)?.toString()??"null"),o=Vt(()=>{if(Cn.isLink(z(a)))try{return Cn.parseLink(z(a))}catch(h){console.warn(h)}});var s=Uj(),l=ye(s),u=ye(l);{var c=h=>{js(h,{get mdLink(){return z(o)}})},f=h=>{var x=Vj(),b=ye(x,!0);ce(x),Re(()=>ht(b,z(a))),ee(h,x)};ot(u,h=>{z(o)!==void 0?h(c):h(f,!1)})}ce(l);var m=le(l,2);Et(m,{get variant(){return"plain"},get onclick(){return e.showSuggester},children:(h,x)=>{Yr(h,{get plugin(){return e.plugin},iconName:"list"})},$$slots:{default:!0}});var p=le(m,2);{var d=h=>{Et(h,{get variant(){return"plain"},get onclick(){return e.showTextPrompt},children:(x,b)=>{Yr(x,{get plugin(){return e.plugin},iconName:"pencil"})},$$slots:{default:!0}})};ot(p,h=>{e.allowOther&&h(d)})}return ce(s),ee(t,s),De({setValue:i})}var dg=class extends cr{filterValue(e){return Au(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return _0}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:()=>{}})}};var qj=(t,e,r,n)=>r.onValueChange(z(n)),zj=ue("<span> </span>"),Hj=ue('<input type="text" tabindex="0"> <!>',1);function A0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(c){$e(n,Le(c))}function a(c,f){let m=f.toString();return`${c.toString().padStart(m.length,"0")}/${m}`}var o=Hj(),s=Je(o);Tt(s),s.__input=[qj,r,e,n];var l=le(s,2);{var u=c=>{var f=zj(),m=ye(f,!0);Re(()=>ht(m,a(z(n).length,e.limit))),ce(f),Re(()=>xa(f,`mb-content-limit-indicator ${z(n).length>e.limit?"mb-content-limit-indicator-overflow":""}`)),ee(c,f)};ot(l,c=>{e.limit!==void 0&&c(u)})}return Re(()=>{wt(s,"placeholder",e.placeholder),wt(s,"maxlength",e.limit)}),_t(s,()=>z(n),c=>$e(n,c)),ee(t,o),De({setValue:i})}kt(["input"]);var hg=class extends cr{filterValue(e){return os(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return A0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var Gj=(t,e,r,n)=>r.onValueChange(z(n)),Wj=ue('<textarea class="mb-input-textarea" tabindex="0"></textarea>');function S0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(o){$e(n,Le(o))}var a=Wj();return On(a),a.__input=[Gj,r,e,n],Re(()=>{wt(a,"placeholder",e.placeholder),wt(a,"maxlength",e.limit)}),_t(a,()=>z(n),o=>$e(n,o)),ee(t,a),De({setValue:i})}kt(["input"]);var gg=class extends cr{filterValue(e){return os(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return S0}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};var Yj=(t,e,r,n)=>r.onValueChange(z(n)),jj=ue('<input type="time">');function E0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(o){$e(n,Le(o))}var a=jj();return Tt(a),a.__input=[Yj,r,e,n],_t(a,()=>z(n),o=>$e(n,o)),ee(t,a),De({setValue:i})}kt(["input"]);var vg=class extends cr{filterValue(e){return os(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return E0}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var Zj=(t,e)=>e(),Jj=(t,e)=>e(t),Xj=ue('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function T0(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]),n=bt(Le(e.value));function i(u){$e(n,Le(u))}function a(){$e(n,!z(n)),e.onValueChange(z(n))}function o(u){u.key===" "&&a()}var s=Xj();s.__click=[Zj,a],s.__keydown=[Jj,o];var l=ye(s);return Tt(l),ce(s),Re(()=>{wt(s,"aria-checked",z(n)),tn(s,"is-enabled",z(n)),Ys(l,z(n))}),ee(t,s),De({setValue:i})}kt(["click","keydown"]);var yg=class extends cr{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?Au(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return T0}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};var jt=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){xd(e)}};var xg=class{constructor(e){this.plugin=e}createInputField(e){let r=e.declaration.inputFieldType,n=e.renderChildType;if(r!=="invalid"&&this.checkRenderChildTypeAllowed(r,n),r==="toggle")return new yg(e);if(r==="slider")return new mg(e);if(r==="text")return new hg(e);if(r==="textArea")return new gg(e);if(r==="select")return new pg(e);if(r==="multiSelect")return new lg(e);if(r==="datePicker")return new Kh(e);if(r==="number")return new cg(e);if(r==="suggester")return new dg(e);if(r==="editor")return new tg(e);if(r==="progressBar")return new fg(e);if(r==="inlineSelect")return new og(e);if(r==="imageSuggester")return new ng(e);if(r==="list")return new sg(e);if(r==="listSuggester")return new ug(e);if(r==="date")return new Qh(e);if(r==="time")return new vg(e);if(r==="inlineListSuggester")return new ag(e);if(r==="inlineList")return new ig(e);if(r==="imageListSuggester")return new rg(e);if(r==="dateTime")return new eg(e);}checkRenderChildTypeAllowed(e,r){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let n=ud[e];if(r==="block"&&!n.allowInBlock)throw new Co({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[jt.linkToInputField(e)]});if(r==="inline"&&!n.allowInline)throw new Co({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[jt.linkToInputField(e)]})}};var cf=class extends qn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Qt(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 Gt({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",r=this.hasArgument("showcase")||this.hasArgument("title");return this.renderChildType==="block"&&(e||r)}createContainer(e){if(this.shouldAddCardContainer()){let r=mt.createElement(e,"div");mt.addClass(r,"mb-card");let n=this.getArgument("title");return n&&mt.createElement(r,"h3",{text:n.value}),r}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let n=mt.createElement(e,"code",{class:"mb-none"}),i=mt.createElement(n,"a",{text:this.declarationString,class:"mb-no-link"});i.href=jt.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 Gt({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(super.onMount(e),mt.empty(e),mt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=this.createContainer(e);this.createErrorIndicator(r);let n=mt.createElement(r,"div",{class:"mb-input-wrapper"});this.inputField?.mount(n);let i=this.getArguments("class");for(let a of i)mt.addClasses(n,a.value);mt.addClass(n,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-input-block"):mt.addClass(e,"mb-input-inline"),this.addShowcase(r)}onUnmount(e){super.onUnmount(e),this.inputField?.unmount(),Di(e,"input field")}};var Qj=ue("<div></div>");function Iu(t,e){Te(e,!0);let r,n;ga(()=>{n?.unmount(),n=e.mountable,n.mount(r)}),lf(()=>{n?.unmount()});var i=Qj();Vo(i,a=>r=a,()=>r),ee(t,i),De()}var Kj=ue("<th> </th>"),eZ=ue("<td><!></td>"),tZ=ue('<td class="meta-bind-error">invalid data</td>'),rZ=ue('<tr><!><td class="mb-html-table-button-cell"><!></td></tr>'),nZ=ue('<div class="mb-table-wrapper"><table class="mb-html-table"><thead><tr><!><th class="mb-html-table-button-cell"></th></tr></thead><tbody></tbody></table></div> <!>',1);function M0(t,e){Te(e,!0);let r=lt(e,"tableHead",19,()=>[]),n=bt(Le([]));function i(p){$e(n,Le(p))}var a=nZ(),o=Je(a),s=ye(o),l=ye(s),u=ye(l),c=ye(u);Yt(c,17,r,er,(p,d)=>{var h=Kj(),x=ye(h,!0);ce(h),Re(()=>ht(x,z(d))),ee(p,h)}),Nt(),ce(u),ce(l);var f=le(l);Yt(f,21,()=>z(n),p=>p.index,(p,d)=>{var h=rZ(),x=ye(h);{var b=w=>{var y=Xr(),E=Je(y);Yt(E,17,()=>z(d).cells,er,(D,_)=>{var N=eZ(),C=ye(N);Iu(C,{get mountable(){return z(_)}}),ce(N),ee(D,N)}),ee(w,y)},T=w=>{var y=tZ();Re(()=>wt(y,"colspan",r().length)),ee(w,y)};ot(x,w=>{z(d).isValid?w(b):w(T,!1)})}var v=le(x),A=ye(v);Et(A,{onclick:()=>e.table.removeColumn(z(d).index),children:(w,y)=>{Yr(w,{get plugin(){return e.table.plugin},iconName:"x"})},$$slots:{default:!0}}),ce(v),ce(h),ee(p,h)}),ce(f),ce(s),ce(o);var m=le(o,2);return Et(m,{onclick:()=>e.table.addColumn(),children:(p,d)=>{Nt();var h=lr("Add Row");ee(p,h)},$$slots:{default:!0}}),ee(t,a),De({updateTable:i})}function bg(t){return new xu(t.map(e=>hI.tryParse(e).success?new ml("array",e):new ml("object",e)))}var wg=class extends qn{constructor(e,r,n,i,a,o){super(e,r,n),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new yn(void 0),this.outputSignal=new yn(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?.write(e)}updateDisplayValue(e){e=e??[];let r=[];for(let n=0;n<e.length;n++)if(typeof e[n]=="object"){let i=new Vc({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(bg([n.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"}));r.push({cells:a,index:n,value:e[n],isValid:!0})}else r.push({cells:[],index:n,value:e[n],isValid:!1});this.tableComponent?.updateTable(r)}createCell(e,r){return e.mount(r),()=>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=Vr(M0,{target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:r=>{this.value=r,this.updateDisplayValue(r)}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent&&Ur(this.tableComponent),Di(e,"table")}};var _g=class extends qn{constructor(e,r,n,i){super(e,r,n),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Qt(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,metadataSignal:new yn(void 0),uuid:Fr(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let r of this.variables??[])!r.contextName||!r.metadataSignal||(e[r.contextName]=r.metadataSignal.get()??"");return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){this.metadataSubscription=this.plugin.metadataManager.subscribeDerived(this.getUuid(),this.declaration.writeToBindTarget,this.variables.map(e=>e.bindTargetDeclaration),this.variables.map(e=>e.metadataSignal),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(super.onMount(e),mt.addClass(e,"mb-view"),mt.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new No({errorLevel:"ERROR",effect:"can not create js view field",cause:"The JS Engine plugin is not installed and enabled."})),this.plugin.settings.enableJs||this.errorCollection.add(new No({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS evaluation is disabled in the plugin settings."})),this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let r=document.createElement("div");mt.addClass(r,"mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(r,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(r)}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),Di(e,"js view field")}};var fs=class extends Ni{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,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)}async rerender(e,r){this.hidden||await this.onRerender(e,r)}onMount(e){this.buildVariables(),this.initialRender(e),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribeDerived(this.mountable.getUuid(),this.mountable.getDeclaration().writeToBindTarget,this.variables.map(r=>r.bindTargetDeclaration),this.variables.map(r=>r.metadataSignal),async()=>{let r=await this.computeValue();return this.rerender(e,r),this.mapValue(r)},()=>this.mountable.unmount())}onUnmount(){this.metadataSubscription?.unsubscribe()}};var iZ=ue('<div class="mb-image-card"><img class="mb-image-card-image"></div>');function C0(t,e){Te(e,!0);let r=lt(e,"internal",3,!0),n=Vt(()=>r()?e.plugin.internal.imagePathToUri(e.image):e.image);var i=iZ(),a=ye(i);ce(i),Re(()=>{wt(a,"src",z(n)),wt(a,"alt",e.image)}),ee(t,i),De()}var aZ=ue("<span>No images</span>"),oZ=ue('<div class="mb-image-card-grid"></div>');function N0(t,e){Te(e,!0);let r=lt(e,"images",23,()=>[]);function n(a){console.warn("updating images"),r(a)}var i=oZ();return Yt(i,21,r,er,(a,o)=>{C0(a,{get plugin(){return e.plugin},get image(){return z(o).link},get internal(){return z(o).internal}})},a=>{var o=aZ();ee(a,o)}),ce(i),ee(t,i),De({updateImages:n})}var Ag=class extends fs{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(n=>typeof n=="string"?n:!0);if(e.length!==1)throw new Ms({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});let r=e[0];if(typeof r=="string")throw new Ms({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new yn(void 0),uuid:Fr(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable)}computeValue(){let e=this.linkVariable.metadataSignal.get();if(typeof e=="string"){let r=Cn.interpretAsLink(e);return r===void 0?void 0:[r]}else return Array.isArray(e)?e.filter(r=>typeof r=="string").map(r=>Cn.interpretAsLink(r)).filter(r=>r!==void 0):void 0}mapValue(e){return e===void 0?"":Array.isArray(e)?e.map(r=>r.toString()):e.toString()}onInitialRender(e){this.component=Vr(N0,{target:e,props:{images:[],plugin:this.mountable.plugin}})}async onRerender(e,r){this.component?.updateImages(_d(r).map(n=>({link:n.target,internal:n.internal})))}onUnmount(){super.onUnmount(),this.component&&Ur(this.component)}};var sZ=ue("<span></span>");function F0(t,e){Te(e,!0);let r=lt(e,"mdLinkList",7);function n(l){r(l)}var i=Xr(),a=Je(i);{var o=l=>{var u=sZ();ee(l,u)},s=l=>{var u=Xr(),c=Je(u);{var f=p=>{js(p,{get mdLink(){return r()[0]}})},m=p=>{Gp(p,{get elements(){return r()},children:(h,x=Ra)=>{js(h,{get mdLink(){return x()}})},$$slots:{default:!0}})};ot(c,p=>{r().length===1?p(f):p(m,!1)},!0)}ee(l,u)};ot(a,l=>{r().length===0?l(o):l(s,!1)})}return ee(t,i),De({updateList:n})}var Sg=class extends fs{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(a=>typeof a=="string"?a:!0);if(e.length!==1&&e.length!==2&&e.length!==3)throw new Ms({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"'});let r=e[0],n=e[1],i=e[2];if(this.variables=[],e.length===1){if(typeof r=="string")throw new Ms({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}" or "{bindTarget}|{bindTarget}"'});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new yn(void 0),uuid:Fr(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable)}else if(e.length===2||e.length===3){if(typeof r=="string"||typeof n!="string")throw new Ms({errorLevel:"ERROR",effect:"can not create view field",cause:'link view field must be of form "{bindTarget}", "{bindTarget}|alias", or "{bindTarget}|{bindTarget}"'});r.listenToChildren=!0,this.linkVariable={bindTargetDeclaration:r,metadataSignal:new yn(void 0),uuid:Fr(),contextName:"MB_VAR_0"},this.variables.push(this.linkVariable),e.length===2?this.aliasVariable=n.slice(1):typeof i=="string"?this.aliasVariable=i:(i.listenToChildren=!0,this.aliasVariable={bindTargetDeclaration:i,metadataSignal:new yn(void 0),uuid:Fr(),contextName:"MB_VAR_1"},this.variables.push(this.aliasVariable))}else throw new Error("unreachable")}getAlias(){if(this.aliasVariable)return typeof this.aliasVariable=="string"?this.aliasVariable:Il(this.aliasVariable.metadataSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)}computeValue(){let e=this.linkVariable.metadataSignal.get(),r=this.getAlias();if(typeof e=="string"){let n=Cn.interpretAsLink(e);return n===void 0?void 0:(r&&(n.alias=r),[n])}else return Array.isArray(e)?e.filter(n=>typeof n=="string").map(n=>Cn.interpretAsLink(n)).filter(n=>n!==void 0):void 0}mapValue(e){return e===void 0?"":Array.isArray(e)?e.map(r=>r.toString()):e.toString()}onInitialRender(e){this.component=Vr(F0,{target:e,props:{mdLinkList:[]}})}async onRerender(e,r){this.component?.updateList(_d(r))}onUnmount(){super.onUnmount(),this.component&&Ur(this.component)}};function sn(){return sn=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},sn.apply(null,arguments)}var I0={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null};function rn(t,e){if(Wp(t,e))return t[e];throw typeof t[e]=="function"&&Eg(t,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function ps(t,e,r){if(Wp(t,e))return t[e]=r,r;throw new Error('No access to property "'+e+'"')}function Wp(t,e){return!uZ(t)&&!Array.isArray(t)?!1:st(lZ,e)?!0:!(e in Object.prototype||e in Function.prototype)}function O2(t,e){if(!Eg(t,e))throw new Error('No access to method "'+e+'"');return t[e]}function Eg(t,e){return t==null||typeof t[e]!="function"||st(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t)?!1:st(cZ,e)?!0:!(e in Object.prototype||e in Function.prototype)}function uZ(t){return typeof t=="object"&&t&&t.constructor===Object}var lZ={length:!0,name:!0},cZ={toString:!0,valueOf:!0,toLocaleString:!0};var Pu=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return rn(this.wrappedObject,e)}set(e,r){return ps(this.wrappedObject,e,r),this}has(e){return Wp(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return R2(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){Wp(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},ff=class{constructor(e,r,n){this.a=e,this.b=r,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),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 R2(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,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 R2(t,e){return{next:()=>{var r=t.next();return r.done?r:{value:e(r.value),done:!1}}}}function Bu(){return new Map}function Zs(t){if(!t)return Bu();if(Tg(t))return t;if(ku(t))return new Pu(t);throw new Error("createMap can create maps from objects or Maps")}function L2(t){if(t instanceof Pu)return t.wrappedObject;var e={};for(var r of t.keys()){var n=t.get(r);ps(e,r,n)}return e}function At(t){return typeof t=="number"}function ft(t){return!t||typeof t!="object"||typeof t.constructor!="function"?!1:t.isBigNumber===!0&&typeof t.constructor.prototype=="object"&&t.constructor.prototype.isBigNumber===!0||typeof t.constructor.isDecimal=="function"&&t.constructor.isDecimal(t)===!0}function V2(t){return typeof t=="bigint"}function ra(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isComplex===!0||!1}function Js(t){return t&&typeof t=="object"&&Object.getPrototypeOf(t).isFraction===!0||!1}function bi(t){return t&&t.constructor.prototype.isUnit===!0||!1}function bn(t){return typeof t=="string"}var vr=Array.isArray;function rt(t){return t&&t.constructor.prototype.isMatrix===!0||!1}function Tn(t){return Array.isArray(t)||rt(t)}function Ul(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function Uo(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix===!0||!1}function pf(t){return t&&t.constructor.prototype.isRange===!0||!1}function $u(t){return t&&t.constructor.prototype.isIndex===!0||!1}function U2(t){return typeof t=="boolean"}function q2(t){return t&&t.constructor.prototype.isResultSet===!0||!1}function Dg(t){return t&&t.constructor.prototype.isHelp===!0||!1}function z2(t){return typeof t=="function"}function H2(t){return t instanceof Date}function G2(t){return t instanceof RegExp}function ku(t){return!!(t&&typeof t=="object"&&t.constructor===Object&&!ra(t)&&!Js(t))}function Tg(t){return t?t instanceof Map||t instanceof Pu||typeof t.set=="function"&&typeof t.get=="function"&&typeof t.keys=="function"&&typeof t.has=="function":!1}function W2(t){return t===null}function Y2(t){return t===void 0}function Ha(t){return t&&t.isAccessorNode===!0&&t.constructor.prototype.isNode===!0||!1}function wi(t){return t&&t.isArrayNode===!0&&t.constructor.prototype.isNode===!0||!1}function j2(t){return t&&t.isAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function Z2(t){return t&&t.isBlockNode===!0&&t.constructor.prototype.isNode===!0||!1}function J2(t){return t&&t.isConditionalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ht(t){return t&&t.isConstantNode===!0&&t.constructor.prototype.isNode===!0||!1}function Yp(t){return Ht(t)||Qr(t)&&t.args.length===1&&Ht(t.args[0])&&"-+~".includes(t.op)}function ms(t){return t&&t.isFunctionAssignmentNode===!0&&t.constructor.prototype.isNode===!0||!1}function na(t){return t&&t.isFunctionNode===!0&&t.constructor.prototype.isNode===!0||!1}function go(t){return t&&t.isIndexNode===!0&&t.constructor.prototype.isNode===!0||!1}function nr(t){return t&&t.isNode===!0&&t.constructor.prototype.isNode===!0||!1}function Ou(t){return t&&t.isObjectNode===!0&&t.constructor.prototype.isNode===!0||!1}function Qr(t){return t&&t.isOperatorNode===!0&&t.constructor.prototype.isNode===!0||!1}function _i(t){return t&&t.isParenthesisNode===!0&&t.constructor.prototype.isNode===!0||!1}function X2(t){return t&&t.isRangeNode===!0&&t.constructor.prototype.isNode===!0||!1}function Q2(t){return t&&t.isRelationalNode===!0&&t.constructor.prototype.isNode===!0||!1}function Gr(t){return t&&t.isSymbolNode===!0&&t.constructor.prototype.isNode===!0||!1}function Mg(t){return t&&t.constructor.prototype.isChain===!0||!1}function fr(t){var e=typeof t;return e==="object"?t===null?"null":ft(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":e}function yt(t){var e=typeof t;if(e==="number"||e==="bigint"||e==="string"||e==="boolean"||t===null||t===void 0)return t;if(typeof t.clone=="function")return t.clone();if(Array.isArray(t))return t.map(function(r){return yt(r)});if(t instanceof Date)return new Date(t.valueOf());if(ft(t))return t;if(ku(t))return fZ(t,yt);if(e==="function")return t;throw new TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function fZ(t,e){var r={};for(var n in t)st(t,n)&&(r[n]=e(t[n]));return r}function Cg(t,e){for(var r in e)st(e,r)&&(t[r]=e[r]);return t}function ba(t,e){var r,n,i;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;n++)if(!ba(t[n],e[n]))return!1;return!0}else{if(typeof t=="function")return t===e;if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(r in t)if(!(r in e)||!ba(t[r],e[r]))return!1;for(r in e)if(!(r in t))return!1;return!0}else return t===e}}function K2(t,e,r){var n=!0,i;Object.defineProperty(t,e,{get:function(){return n&&(i=r(),n=!1),i},set:function(o){i=o,n=!1},configurable:!0,enumerable:!0})}function st(t,e){return t&&Object.hasOwnProperty.call(t,e)}function eP(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],a=t[i];a!==void 0&&(r[i]=a)}return r}var tP=["Matrix","Array"],rP=["number","BigNumber","Fraction"];var Ie=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(I0)};sn(Ie,I0,{MATRIX_OPTIONS:tP,NUMBER_OPTIONS:rP});var L0=zr(k0(),1);function M(t,e,r,n){function i(a){var o=eP(a,e.map(dZ));return pZ(t,e,a),r(o)}return i.isFactory=!0,i.fn=t,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function pZ(t,e,r){var n=e.filter(a=>!mZ(a)).every(a=>r[a]!==void 0);if(!n){var i=e.filter(a=>r[a]===void 0);throw new Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function mZ(t){return t&&t[0]==="?"}function dZ(t){return t&&t[0]==="?"?t.slice(1):t}function Qe(t){return typeof t=="boolean"?!0:isFinite(t)?t===Math.round(t):!1}function hZ(t){return/^-?\d+$/.test(t)}function Bi(t,e){return e.number==="bigint"&&!hZ(t)?e.numberFallback:e.number}var vo=Math.sign||function(t){return t>0?1:t<0?-1:0},aP=Math.log2||function(e){return Math.log(e)/Math.LN2},oP=Math.log10||function(e){return Math.log(e)/Math.LN10},Ng=Math.log1p||function(t){return Math.log(t+1)},sP=Math.cbrt||function(e){if(e===0)return e;var r=e<0,n;return r&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,r?-n:n},uP=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function $0(t,e,r){var n={2:"0b",8:"0o",16:"0x"},i=n[e],a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Qe(r))throw new Error("size must be an integer");if(t>2**(r-1)-1||t<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!Qe(t))throw new Error("Value must be an integer");t<0&&(t=t+2**r),a="i".concat(r)}var o="";return t<0&&(t=-t,o="-"),"".concat(o).concat(i).concat(t.toString(e)).concat(a)}function qo(t,e){if(typeof e=="function")return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:r,precision:n,wordSize:i}=O0(e);switch(r){case"fixed":return R0(t,n);case"exponential":return lP(t,n);case"engineering":return gZ(t,n);case"bin":return $0(t,2,i);case"oct":return $0(t,8,i);case"hex":return $0(t,16,i);case"auto":return vZ(t,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function O0(t){var e="auto",r,n;if(t!==void 0)if(At(t))r=t;else if(ft(t))r=t.toNumber();else if(ku(t))t.precision!==void 0&&(r=nP(t.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),t.wordSize!==void 0&&(n=nP(t.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(e=t.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:r,wordSize:n}}function df(t){var e=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var r=e[1],n=e[2],i=parseFloat(e[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(s){return i-=s.length,""}).replace(/0*$/,"").split("").map(function(s){return parseInt(s)});return o.length===0&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function gZ(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=Fg(r,e),i=n.exponent,a=n.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 s=Math.abs(i-o)-(a.length-1),l=0;l<s;l++)a.push(0);for(var u=Math.abs(i-o),c=1;u>0;)c++,u--;var f=a.slice(c).join(""),m=At(e)&&f.length||f.match(/[1-9]/)?"."+f:"",p=a.slice(0,c).join("")+m+"e"+(i>=0?"+":"")+o.toString();return n.sign+p}function R0(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=typeof e=="number"?Fg(r,r.exponent+1+e):r,i=n.coefficients,a=n.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(mf(o-i.length))),a<0&&(i=mf(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),n.sign+i.join("")}function lP(t,e){if(isNaN(t)||!isFinite(t))return String(t);var r=df(t),n=e?Fg(r,e):r,i=n.coefficients,a=n.exponent;i.length<e&&(i=i.concat(mf(e-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function vZ(t,e,r){if(isNaN(t)||!isFinite(t))return String(t);var n=iP(r?.lowerExp,-3),i=iP(r?.upperExp,5),a=df(t),o=e?Fg(a,e):a;if(o.exponent<n||o.exponent>=i)return lP(t,e);var s=o.coefficients,l=o.exponent;s.length<e&&(s=s.concat(mf(e-s.length))),s=s.concat(mf(l-s.length+1+(s.length<e?e-s.length:0))),s=mf(-l).concat(s);var u=l>0?l:0;return u<s.length-1&&s.splice(u+1,0,"."),o.sign+s.join("")}function Fg(t,e){for(var r={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=r.coefficients;e<=0;)n.unshift(0),r.exponent++,e++;if(n.length>e){var i=n.splice(e,n.length-e);if(i[0]>=5){var a=e-1;for(n[a]++;n[a]===10;)n.pop(),a===0&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r}function mf(t){for(var e=[],r=0;r<t;r++)e.push(0);return e}function cP(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var BDe=Number.EPSILON||2220446049250313e-31;function Kr(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-8,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return isNaN(t)||isNaN(e)?!1:!isFinite(t)||!isFinite(e)?t===e:t===e?!0:Math.abs(t-e)<=Math.max(r*Math.max(Math.abs(t),Math.abs(e)),n)}var fP=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},pP=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},mP=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},Ig=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},dP=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},Pg=Math.tanh||function(t){var e=Math.exp(2*t);return(e-1)/(e+1)};function hP(t,e){var r=t>0?!0:t<0?!1:1/t===1/0,n=e>0?!0:e<0?!1:1/e===1/0;return r^n?-t:t}function nP(t,e){if(At(t))return t;if(ft(t))return t.toNumber();e()}function iP(t,e){return At(t)?t:ft(t)?t.toNumber():e}var gP=function(){return gP=L0.default.create,L0.default},yZ=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],V0=M("typed",yZ,function(e){var{BigNumber:r,Complex:n,DenseMatrix:i,Fraction:a}=e,o=gP();return o.clear(),o.addTypes([{name:"number",test:At},{name:"Complex",test:ra},{name:"BigNumber",test:ft},{name:"bigint",test:V2},{name:"Fraction",test:Js},{name:"Unit",test:bi},{name:"identifier",test:s=>bn&&/^(?:[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-\u1C8A\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-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\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\uDDC0-\uDDF3\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\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\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\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\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\uDFC0-\uDFE0]|\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\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\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\uDDD0-\uDDED\uDDF0\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\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\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-\u1C8A\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-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\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\uDDC0-\uDDF3\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\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\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\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\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\uDFC0-\uDFE0]|\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\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\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\uDDD0-\uDDED\uDDF0\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\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s)},{name:"string",test:bn},{name:"Chain",test:Mg},{name:"Array",test:vr},{name:"Matrix",test:rt},{name:"DenseMatrix",test:Ul},{name:"SparseMatrix",test:Uo},{name:"Range",test:pf},{name:"Index",test:$u},{name:"boolean",test:U2},{name:"ResultSet",test:q2},{name:"Help",test:Dg},{name:"function",test:z2},{name:"Date",test:H2},{name:"RegExp",test:G2},{name:"null",test:W2},{name:"undefined",test:Y2},{name:"AccessorNode",test:Ha},{name:"ArrayNode",test:wi},{name:"AssignmentNode",test:j2},{name:"BlockNode",test:Z2},{name:"ConditionalNode",test:J2},{name:"ConstantNode",test:Ht},{name:"FunctionNode",test:na},{name:"FunctionAssignmentNode",test:ms},{name:"IndexNode",test:go},{name:"Node",test:nr},{name:"ObjectNode",test:Ou},{name:"OperatorNode",test:Qr},{name:"ParenthesisNode",test:_i},{name:"RangeNode",test:X2},{name:"RelationalNode",test:Q2},{name:"SymbolNode",test:Gr},{name:"Map",test:Tg},{name:"Object",test:ku}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(l){if(r||Bg(l),cP(l)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+l+"). Use function bignumber(x) to convert to BigNumber.");return new r(l)}},{from:"number",to:"Complex",convert:function(l){return n||kg(l),new n(l,0)}},{from:"BigNumber",to:"Complex",convert:function(l){return n||kg(l),new n(l.toNumber(),0)}},{from:"bigint",to:"number",convert:function(l){if(l>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+l+")");return Number(l)}},{from:"bigint",to:"BigNumber",convert:function(l){return r||Bg(l),new r(l.toString())}},{from:"bigint",to:"Fraction",convert:function(l){return a||$g(l),new a(l)}},{from:"Fraction",to:"BigNumber",convert:function(l){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(l){return n||kg(l),new n(l.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(l){a||$g(l);var u=new a(l);if(u.valueOf()!==l)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+l+"). Use function fraction(x) to convert to Fraction.");return u}},{from:"string",to:"number",convert:function(l){var u=Number(l);if(isNaN(u))throw new Error('Cannot convert "'+l+'" to a number');return u}},{from:"string",to:"BigNumber",convert:function(l){r||Bg(l);try{return new r(l)}catch{throw new Error('Cannot convert "'+l+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(l){try{return BigInt(l)}catch{throw new Error('Cannot convert "'+l+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(l){a||$g(l);try{return new a(l)}catch{throw new Error('Cannot convert "'+l+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(l){n||kg(l);try{return new n(l)}catch{throw new Error('Cannot convert "'+l+'" to Complex')}}},{from:"boolean",to:"number",convert:function(l){return+l}},{from:"boolean",to:"BigNumber",convert:function(l){return r||Bg(l),new r(+l)}},{from:"boolean",to:"bigint",convert:function(l){return BigInt(+l)}},{from:"boolean",to:"Fraction",convert:function(l){return a||$g(l),new a(+l)}},{from:"boolean",to:"string",convert:function(l){return String(l)}},{from:"Array",to:"Matrix",convert:function(l){return i||xZ(),new i(l)}},{from:"Matrix",to:"Array",convert:function(l){return l.valueOf()}}]),o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Tn(l[0])&&u.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(s,l,u)=>{var c=o.createError(s,l,u);if(["wrongType","mismatch"].includes(c.data.category)&&l.length===1&&Tn(l[0])&&u.some(m=>!m.params.includes(","))){var f=new TypeError("Function '".concat(s,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(s,")'."));throw f.data=c.data,f}throw c},o});function Bg(t){throw new Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function kg(t){throw new Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function xZ(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function $g(t){throw new Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}var bZ="ResultSet",wZ=[],U0=M(bZ,wZ,()=>{function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0});var hf=9e15,Uu=1e9,q0="0123456789abcdef",Rg="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Lg="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",z0={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-hf,maxE:hf,crypto:!1},bP,Xs,ir=!0,Ug="[DecimalError] ",Vu=Ug+"Invalid argument: ",wP=Ug+"Precision limit exceeded",_P=Ug+"crypto unavailable",AP="[object Decimal]",ki=Math.floor,ti=Math.pow,_Z=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,AZ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,SZ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,SP=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ho=1e7,Ut=7,EZ=9007199254740991,TZ=Rg.length-1,H0=Lg.length-1,Oe={toStringTag:AP};Oe.absoluteValue=Oe.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ft(t)};Oe.ceil=function(){return Ft(new this.constructor(this),this.e+1,2)};Oe.clampedTo=Oe.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(Vu+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};Oe.comparedTo=Oe.cmp=function(t){var e,r,n,i,a=this,o=a.d,s=(t=new a.constructor(t)).d,l=a.s,u=t.s;if(!o||!s)return!l||!u?NaN:l!==u?l:o===s?0:!o^l<0?1:-1;if(!o[0]||!s[0])return o[0]?l:s[0]?-u:0;if(l!==u)return l;if(a.e!==t.e)return a.e>t.e^l<0?1:-1;for(n=o.length,i=s.length,e=0,r=n<i?n:i;e<r;++e)if(o[e]!==s[e])return o[e]>s[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};Oe.cosine=Oe.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ut,n.rounding=1,r=DZ(n,CP(n,r)),n.precision=t,n.rounding=e,Ft(Xs==2||Xs==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};Oe.cubeRoot=Oe.cbrt=function(){var t,e,r,n,i,a,o,s,l,u,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(ir=!1,a=c.s*ti(c.s*c,1/3),!a||Math.abs(a)==1/0?(r=Ai(c.d),t=c.e,(a=(t-r.length+1)%3)&&(r+=a==1||a==-2?"0":"00"),a=ti(r,1/3),t=ki((t+1)/3)-(t%3==(t<0?-1:2)),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new f(r),n.s=c.s):n=new f(a.toString()),o=(t=f.precision)+3;;)if(s=n,l=s.times(s).times(s),u=l.plus(c),n=nn(u.plus(c).times(s),u.plus(l),o+2,1),Ai(s.d).slice(0,o)===(r=Ai(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ft(s,t+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Ft(n,t+1,1),e=!n.times(n).times(n).eq(c));break}return ir=!0,Ft(n,t,f.rounding,e)};Oe.decimalPlaces=Oe.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-ki(this.e/Ut))*Ut,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};Oe.dividedBy=Oe.div=function(t){return nn(this,new this.constructor(t))};Oe.dividedToIntegerBy=Oe.divToInt=function(t){var e=this,r=e.constructor;return Ft(nn(e,new r(t),0,1,1),r.precision,r.rounding)};Oe.equals=Oe.eq=function(t){return this.cmp(t)===0};Oe.floor=function(){return Ft(new this.constructor(this),this.e+1,3)};Oe.greaterThan=Oe.gt=function(t){return this.cmp(t)>0};Oe.greaterThanOrEqualTo=Oe.gte=function(t){var e=this.cmp(t);return e==1||e===0};Oe.hyperbolicCosine=Oe.cosh=function(){var t,e,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(t=Math.ceil(i/3),e=(1/zg(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),a=gf(o,1,a.times(e),new o(1),!0);for(var l,u=t,c=new o(8);u--;)l=a.times(a),a=s.minus(l.times(c.minus(l.times(c))));return Ft(a,o.precision=r,o.rounding=n,!0)};Oe.hyperbolicSine=Oe.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=gf(a,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/zg(5,t)),i=gf(a,2,i,i,!0);for(var o,s=new a(5),l=new a(16),u=new a(20);t--;)o=i.times(i),i=i.times(s.plus(o.times(l.times(o).plus(u))))}return a.precision=e,a.rounding=r,Ft(i,e,r,!0)};Oe.hyperbolicTangent=Oe.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,nn(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};Oe.inverseCosine=Oe.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?n===0?e.isNeg()?zo(r,i,a):new r(0):new r(NaN):e.isZero()?zo(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=zo(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))};Oe.inverseHyperbolicCosine=Oe.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ir=!1,r=r.times(r).minus(1).sqrt().plus(r),ir=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};Oe.inverseHyperbolicSine=Oe.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ir=!1,r=r.times(r).plus(1).sqrt().plus(r),ir=!0,n.precision=t,n.rounding=e,r.ln())};Oe.inverseHyperbolicTangent=Oe.atanh=function(){var t,e,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Ft(new a(i),t,e,!0):(a.precision=r=n-i.e,i=nn(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)};Oe.inverseSine=Oe.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,e!==-1?e===0?(t=zo(a,r+4,n).times(.5),t.s=i.s,t):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))};Oe.inverseTangent=Oe.atan=function(){var t,e,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,m=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&f+4<=H0)return o=zo(c,f+4,m).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(f+4<=H0)return o=zo(c,f+4,m).times(.5),o.s=u.s,o}for(c.precision=s=f+10,c.rounding=1,r=Math.min(28,s/Ut+2|0),t=r;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ir=!1,e=Math.ceil(s/Ut),n=1,l=u.times(u),o=new c(u),i=u;t!==-1;)if(i=i.times(l),a=o.minus(i.div(n+=2)),i=i.times(l),o=a.plus(i.div(n+=2)),o.d[e]!==void 0)for(t=e;o.d[t]===a.d[t]&&t--;);return r&&(o=o.times(2<<r-1)),ir=!0,Ft(o,c.precision=f,c.rounding=m,!0)};Oe.isFinite=function(){return!!this.d};Oe.isInteger=Oe.isInt=function(){return!!this.d&&ki(this.e/Ut)>this.d.length-2};Oe.isNaN=function(){return!this.s};Oe.isNegative=Oe.isNeg=function(){return this.s<0};Oe.isPositive=Oe.isPos=function(){return this.s>0};Oe.isZero=function(){return!!this.d&&this.d[0]===0};Oe.lessThan=Oe.lt=function(t){return this.cmp(t)<0};Oe.lessThanOrEqualTo=Oe.lte=function(t){return this.cmp(t)<1};Oe.logarithm=Oe.log=function(t){var e,r,n,i,a,o,s,l,u=this,c=u.constructor,f=c.precision,m=c.rounding,p=5;if(t==null)t=new c(10),e=!0;else{if(t=new c(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10===0;)i/=10;a=i!==1}if(ir=!1,s=f+p,o=Lu(u,s),n=e?Vg(c,s+10):Lu(t,s),l=nn(o,n,s,1),jp(l.d,i=f,m))do if(s+=10,o=Lu(u,s),n=e?Vg(c,s+10):Lu(t,s),l=nn(o,n,s,1),!a){+Ai(l.d).slice(i+1,i+15)+1==1e14&&(l=Ft(l,f+1,0));break}while(jp(l.d,i+=10,m));return ir=!0,Ft(l,f,m)};Oe.minus=Oe.sub=function(t){var e,r,n,i,a,o,s,l,u,c,f,m,p=this,d=p.constructor;if(t=new d(t),!p.d||!t.d)return!p.s||!t.s?t=new d(NaN):p.d?t.s=-t.s:t=new d(t.d||p.s!==t.s?p:NaN),t;if(p.s!=t.s)return t.s=-t.s,p.plus(t);if(u=p.d,m=t.d,s=d.precision,l=d.rounding,!u[0]||!m[0]){if(m[0])t.s=-t.s;else if(u[0])t=new d(p);else return new d(l===3?-0:0);return ir?Ft(t,s,l):t}if(r=ki(t.e/Ut),c=ki(p.e/Ut),u=u.slice(),a=c-r,a){for(f=a<0,f?(e=u,a=-a,o=m.length):(e=m,r=c,o=u.length),n=Math.max(Math.ceil(s/Ut),o)+2,a>n&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for(n=u.length,o=m.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=m[n]){f=u[n]<m[n];break}a=0}for(f&&(e=u,u=m,m=e,t.s=-t.s),o=u.length,n=m.length-o;n>0;--n)u[o++]=0;for(n=m.length;n>a;){if(u[--n]<m[n]){for(i=n;i&&u[--i]===0;)u[i]=Ho-1;--u[i],u[n]+=Ho}u[n]-=m[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(t.d=u,t.e=qg(u,r),ir?Ft(t,s,l):t):new d(l===3?-0:0)};Oe.modulo=Oe.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Ft(new n(r),n.precision,n.rounding):(ir=!1,n.modulo==9?(e=nn(r,t.abs(),0,3,1),e.s*=t.s):e=nn(r,t,0,n.modulo,1),e=e.times(t),ir=!0,r.minus(e))};Oe.naturalExponential=Oe.exp=function(){return G0(this)};Oe.naturalLogarithm=Oe.ln=function(){return Lu(this)};Oe.negated=Oe.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ft(t)};Oe.plus=Oe.add=function(t){var e,r,n,i,a,o,s,l,u,c,f=this,m=f.constructor;if(t=new m(t),!f.d||!t.d)return!f.s||!t.s?t=new m(NaN):f.d||(t=new m(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(u=f.d,c=t.d,s=m.precision,l=m.rounding,!u[0]||!c[0])return c[0]||(t=new m(f)),ir?Ft(t,s,l):t;if(a=ki(f.e/Ut),n=ki(t.e/Ut),u=u.slice(),i=a-n,i){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),a=Math.ceil(s/Ut),o=a>o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=c.length,o-i<0&&(i=o,r=c,c=u,u=r),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/Ho|0,u[i]%=Ho;for(e&&(u.unshift(e),++n),o=u.length;u[--o]==0;)u.pop();return t.d=u,t.e=qg(u,n),ir?Ft(t,s,l):t};Oe.precision=Oe.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Vu+t);return r.d?(e=EP(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};Oe.round=function(){var t=this,e=t.constructor;return Ft(new e(t),t.e+1,e.rounding)};Oe.sine=Oe.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+Ut,n.rounding=1,r=CZ(n,CP(n,r)),n.precision=t,n.rounding=e,Ft(Xs>2?r.neg():r,t,e,!0)):new n(NaN)};Oe.squareRoot=Oe.sqrt=function(){var t,e,r,n,i,a,o=this,s=o.d,l=o.e,u=o.s,c=o.constructor;if(u!==1||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(ir=!1,u=Math.sqrt(+o),u==0||u==1/0?(e=Ai(s),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=ki((l+1)/2)-(l<0||l%2),u==1/0?e="5e"+l:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new c(e)):n=new c(u.toString()),r=(l=c.precision)+3;;)if(a=n,n=a.plus(nn(o,a,r+2,1)).times(.5),Ai(a.d).slice(0,r)===(e=Ai(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(Ft(a,l+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Ft(n,l+1,1),t=!n.times(n).eq(o));break}return ir=!0,Ft(n,l,c.rounding,t)};Oe.tangent=Oe.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=nn(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ft(Xs==2||Xs==4?r.neg():r,t,e,!0)):new n(NaN)};Oe.times=Oe.mul=function(t){var e,r,n,i,a,o,s,l,u,c=this,f=c.constructor,m=c.d,p=(t=new f(t)).d;if(t.s*=c.s,!m||!m[0]||!p||!p[0])return new f(!t.s||m&&!m[0]&&!p||p&&!p[0]&&!m?NaN:!m||!p?t.s/0:t.s*0);for(r=ki(c.e/Ut)+ki(t.e/Ut),l=m.length,u=p.length,l<u&&(a=m,m=p,p=a,o=l,l=u,u=o),a=[],o=l+u,n=o;n--;)a.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)s=a[i]+p[n]*m[i-n-1]+e,a[i--]=s%Ho|0,e=s/Ho|0;a[i]=(a[i]+e)%Ho|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=qg(a,r),ir?Ft(t,f.precision,f.rounding):t};Oe.toBinary=function(t,e){return Y0(this,2,t,e)};Oe.toDecimalPlaces=Oe.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(wa(t,0,Uu),e===void 0?e=n.rounding:wa(e,0,8),Ft(r,t+r.e+1,e))};Oe.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ds(n,!0):(wa(t,0,Uu),e===void 0?e=i.rounding:wa(e,0,8),n=Ft(new i(n),t+1,e),r=ds(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};Oe.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?r=ds(i):(wa(t,0,Uu),e===void 0?e=a.rounding:wa(e,0,8),n=Ft(new a(i),t+i.e+1,e),r=ds(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};Oe.toFraction=function(t){var e,r,n,i,a,o,s,l,u,c,f,m,p=this,d=p.d,h=p.constructor;if(!d)return new h(p);if(u=r=new h(1),n=l=new h(0),e=new h(n),a=e.e=EP(d)-p.e-1,o=a%Ut,e.d[0]=ti(10,o<0?Ut+o:o),t==null)t=a>0?e:u;else{if(s=new h(t),!s.isInt()||s.lt(u))throw Error(Vu+s);t=s.gt(e)?a>0?e:u:s}for(ir=!1,s=new h(Ai(d)),c=h.precision,h.precision=a=d.length*Ut*2;f=nn(s,e,0,1,1),i=r.plus(f.times(n)),i.cmp(t)!=1;)r=n,n=i,i=u,u=l.plus(f.times(i)),l=i,i=e,e=s.minus(f.times(i)),s=i;return i=nn(t.minus(r),n,0,1,1),l=l.plus(i.times(u)),r=r.plus(i.times(n)),l.s=u.s=p.s,m=nn(u,n,a,1).minus(p).abs().cmp(nn(l,r,a,1).minus(p).abs())<1?[u,n]:[l,r],h.precision=c,ir=!0,m};Oe.toHexadecimal=Oe.toHex=function(t,e){return Y0(this,16,t,e)};Oe.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:wa(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(ir=!1,r=nn(r,t,0,e,1).times(t),ir=!0,Ft(r)):(t.s=r.s,r=t),r};Oe.toNumber=function(){return+this};Oe.toOctal=function(t,e){return Y0(this,8,t,e)};Oe.toPower=Oe.pow=function(t){var e,r,n,i,a,o,s=this,l=s.constructor,u=+(t=new l(t));if(!s.d||!t.d||!s.d[0]||!t.d[0])return new l(ti(+s,u));if(s=new l(s),s.eq(1))return s;if(n=l.precision,a=l.rounding,t.eq(1))return Ft(s,n,a);if(e=ki(t.e/Ut),e>=t.d.length-1&&(r=u<0?-u:u)<=EZ)return i=TP(l,s,r,n),t.s<0?new l(1).div(i):Ft(i,n,a);if(o=s.s,o<0){if(e<t.d.length-1)return new l(NaN);if(t.d[e]&1||(o=1),s.e==0&&s.d[0]==1&&s.d.length==1)return s.s=o,s}return r=ti(+s,u),e=r==0||!isFinite(r)?ki(u*(Math.log("0."+Ai(s.d))/Math.LN10+s.e+1)):new l(r+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?o/0:0):(ir=!1,l.rounding=s.s=1,r=Math.min(12,(e+"").length),i=G0(t.times(Lu(s,n+r)),n),i.d&&(i=Ft(i,n+5,1),jp(i.d,n,a)&&(e=n+10,i=Ft(G0(t.times(Lu(s,e+r)),e),e+5,1),+Ai(i.d).slice(n+1,n+15)+1==1e14&&(i=Ft(i,n+1,0)))),i.s=o,ir=!0,l.rounding=a,Ft(i,n,a))};Oe.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=ds(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(wa(t,1,Uu),e===void 0?e=i.rounding:wa(e,0,8),n=Ft(new i(n),t,e),r=ds(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};Oe.toSignificantDigits=Oe.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(wa(t,1,Uu),e===void 0?e=n.rounding:wa(e,0,8)),Ft(new n(r),t,e)};Oe.toString=function(){var t=this,e=t.constructor,r=ds(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};Oe.truncated=Oe.trunc=function(){return Ft(new this.constructor(this),this.e+1,1)};Oe.valueOf=Oe.toJSON=function(){var t=this,e=t.constructor,r=ds(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function Ai(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=Ut-n.length,r&&(a+=Ru(r)),a+=n;o=t[e],n=o+"",r=Ut-n.length,r&&(a+=Ru(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function wa(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Vu+t)}function jp(t,e,r,n){var i,a,o,s;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=Ut,i=0):(i=Math.ceil((e+1)/Ut),e%=Ut),a=ti(10,Ut-e),s=t[i]%a|0,n==null?e<3?(e==0?s=s/100|0:e==1&&(s=s/10|0),o=r<4&&s==99999||r>3&&s==49999||s==5e4||s==0):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(t[i+1]/a/100|0)==ti(10,e-2)-1||(s==a/2||s==0)&&(t[i+1]/a/100|0)==0:e<4?(e==0?s=s/1e3|0:e==1?s=s/100|0:e==2&&(s=s/10|0),o=(n||r<4)&&s==9999||!n&&r>3&&s==4999):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(t[i+1]/a/1e3|0)==ti(10,e-3)-1,o}function Og(t,e,r){for(var n,i=[0],a,o=0,s=t.length;o<s;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=q0.indexOf(t.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function DZ(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/zg(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=gf(t,1,e.times(i),new t(1));for(var a=r;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return t.precision-=r,e}var nn=function(){function t(n,i,a){var o,s=0,l=n.length;for(n=n.slice();l--;)o=n[l]*i+s,n[l]=o%a|0,s=o/a|0;return s&&n.unshift(s),n}function e(n,i,a,o){var s,l;if(a!=o)l=a>o?1:-1;else for(s=l=0;s<a;s++)if(n[s]!=i[s]){l=n[s]>i[s]?1:-1;break}return l}function r(n,i,a,o){for(var s=0;a--;)n[a]-=s,s=n[a]<i[a]?1:0,n[a]=s*o+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o,s,l){var u,c,f,m,p,d,h,x,b,T,v,A,w,y,E,D,_,N,C,B,R=n.constructor,V=n.s==i.s?1:-1,L=n.d,P=i.d;if(!L||!L[0]||!P||!P[0])return new R(!n.s||!i.s||(L?P&&L[0]==P[0]:!P)?NaN:L&&L[0]==0||!P?V*0:V/0);for(l?(p=1,c=n.e-i.e):(l=Ho,p=Ut,c=ki(n.e/p)-ki(i.e/p)),C=P.length,_=L.length,b=new R(V),T=b.d=[],f=0;P[f]==(L[f]||0);f++);if(P[f]>(L[f]||0)&&c--,a==null?(y=a=R.precision,o=R.rounding):s?y=a+(n.e-i.e)+1:y=a,y<0)T.push(1),d=!0;else{if(y=y/p+2|0,f=0,C==1){for(m=0,P=P[0],y++;(f<_||m)&&y--;f++)E=m*l+(L[f]||0),T[f]=E/P|0,m=E%P|0;d=m||f<_}else{for(m=l/(P[0]+1)|0,m>1&&(P=t(P,m,l),L=t(L,m,l),C=P.length,_=L.length),D=C,v=L.slice(0,C),A=v.length;A<C;)v[A++]=0;B=P.slice(),B.unshift(0),N=P[0],P[1]>=l/2&&++N;do m=0,u=e(P,v,C,A),u<0?(w=v[0],C!=A&&(w=w*l+(v[1]||0)),m=w/N|0,m>1?(m>=l&&(m=l-1),h=t(P,m,l),x=h.length,A=v.length,u=e(h,v,x,A),u==1&&(m--,r(h,C<x?B:P,x,l))):(m==0&&(u=m=1),h=P.slice()),x=h.length,x<A&&h.unshift(0),r(v,h,A,l),u==-1&&(A=v.length,u=e(P,v,C,A),u<1&&(m++,r(v,C<A?B:P,A,l))),A=v.length):u===0&&(m++,v=[0]),T[f++]=m,u&&v[0]?v[A++]=L[D]||0:(v=[L[D]],A=1);while((D++<_||v[0]!==void 0)&&y--);d=v[0]!==void 0}T[0]||T.shift()}if(p==1)b.e=c,bP=d;else{for(f=1,m=T[0];m>=10;m/=10)f++;b.e=f+c*p-1,Ft(b,s?a+b.e+1:a,o,d)}return b}}();function Ft(t,e,r,n){var i,a,o,s,l,u,c,f,m,p=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,s=f[0];s>=10;s/=10)i++;if(a=e-i,a<0)a+=Ut,o=e,c=f[m=0],l=c/ti(10,i-o-1)%10|0;else if(m=Math.ceil((a+1)/Ut),s=f.length,m>=s)if(n){for(;s++<=m;)f.push(0);c=l=0,i=1,a%=Ut,o=a-Ut+1}else break e;else{for(c=s=f[m],i=1;s>=10;s/=10)i++;a%=Ut,o=a-Ut+i,l=o<0?0:c/ti(10,i-o-1)%10|0}if(n=n||e<0||f[m+1]!==void 0||(o<0?c:c%ti(10,i-o-1)),u=r<4?(l||n)&&(r==0||r==(t.s<0?3:2)):l>5||l==5&&(r==4||n||r==6&&(a>0?o>0?c/ti(10,i-o):0:f[m-1])%10&1||r==(t.s<0?8:7)),e<1||!f[0])return f.length=0,u?(e-=t.e+1,f[0]=ti(10,(Ut-e%Ut)%Ut),t.e=-e||0):f[0]=t.e=0,t;if(a==0?(f.length=m,s=1,m--):(f.length=m+1,s=ti(10,Ut-a),f[m]=o>0?(c/ti(10,i-o)%ti(10,o)|0)*s:0),u)for(;;)if(m==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(t.e++,f[0]==Ho&&(f[0]=1));break}else{if(f[m]+=s,f[m]!=Ho)break;f[m--]=0,s=1}for(a=f.length;f[--a]===0;)f.pop()}return ir&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function ds(t,e,r){if(!t.isFinite())return MP(t);var n,i=t.e,a=Ai(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+Ru(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+Ru(-i-1)+a,r&&(n=r-o)>0&&(a+=Ru(n))):i>=o?(a+=Ru(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+Ru(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=Ru(n))),a}function qg(t,e){var r=t[0];for(e*=Ut;r>=10;r/=10)e++;return e}function Vg(t,e,r){if(e>TZ)throw ir=!0,r&&(t.precision=r),Error(wP);return Ft(new t(Rg),e,1,!0)}function zo(t,e,r){if(e>H0)throw Error(wP);return Ft(new t(Lg),e,r,!0)}function EP(t){var e=t.length-1,r=e*Ut+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function Ru(t){for(var e="";t--;)e+="0";return e}function TP(t,e,r,n){var i,a=new t(1),o=Math.ceil(n/Ut+4);for(ir=!1;;){if(r%2&&(a=a.times(e),yP(a.d,o)&&(i=!0)),r=ki(r/2),r===0){r=a.d.length-1,i&&a.d[r]===0&&++a.d[r];break}e=e.times(e),yP(e.d,o)}return ir=!0,a}function vP(t){return t.d[t.d.length-1]&1}function DP(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;)if(n=new t(e[a]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function G0(t,e){var r,n,i,a,o,s,l,u=0,c=0,f=0,m=t.constructor,p=m.rounding,d=m.precision;if(!t.d||!t.d[0]||t.e>17)return new m(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(ir=!1,l=d):l=e,s=new m(.03125);t.e>-2;)t=t.times(s),f+=5;for(n=Math.log(ti(2,f))/Math.LN10*2+5|0,l+=n,r=a=o=new m(1),m.precision=l;;){if(a=Ft(a.times(t),l,1),r=r.times(++c),s=o.plus(nn(a,r,l,1)),Ai(s.d).slice(0,l)===Ai(o.d).slice(0,l)){for(i=f;i--;)o=Ft(o.times(o),l,1);if(e==null)if(u<3&&jp(o.d,l-n,p,u))m.precision=l+=10,r=a=s=new m(1),c=0,u++;else return Ft(o,m.precision=d,p,ir=!0);else return m.precision=d,o}o=s}}function Lu(t,e){var r,n,i,a,o,s,l,u,c,f,m,p=1,d=10,h=t,x=h.d,b=h.constructor,T=b.rounding,v=b.precision;if(h.s<0||!x||!x[0]||!h.e&&x[0]==1&&x.length==1)return new b(x&&!x[0]?-1/0:h.s!=1?NaN:x?0:h);if(e==null?(ir=!1,c=v):c=e,b.precision=c+=d,r=Ai(x),n=r.charAt(0),Math.abs(a=h.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(t),r=Ai(h.d),n=r.charAt(0),p++;a=h.e,n>1?(h=new b("0."+r),a++):h=new b(n+"."+r.slice(1))}else return u=Vg(b,c+2,v).times(a+""),h=Lu(new b(n+"."+r.slice(1)),c-d).plus(u),b.precision=v,e==null?Ft(h,v,T,ir=!0):h;for(f=h,l=o=h=nn(h.minus(1),h.plus(1),c,1),m=Ft(h.times(h),c,1),i=3;;){if(o=Ft(o.times(m),c,1),u=l.plus(nn(o,new b(i),c,1)),Ai(u.d).slice(0,c)===Ai(l.d).slice(0,c))if(l=l.times(2),a!==0&&(l=l.plus(Vg(b,c+2,v).times(a+""))),l=nn(l,new b(p),c,1),e==null)if(jp(l.d,c-d,T,s))b.precision=c+=d,u=o=h=nn(f.minus(1),f.plus(1),c,1),m=Ft(h.times(h),c,1),i=s=1;else return Ft(l,b.precision=v,T,ir=!0);else return b.precision=v,l;l=u,i+=2}}function MP(t){return String(t.s*t.s/0)}function W0(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%Ut,r<0&&(n+=Ut),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Ut;n<i;)t.d.push(+e.slice(n,n+=Ut));e=e.slice(n),n=Ut-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),ir&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function MZ(t,e){var r,n,i,a,o,s,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),SP.test(e))return W0(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(AZ.test(e))r=16,e=e.toLowerCase();else if(_Z.test(e))r=2;else if(SZ.test(e))r=8;else throw Error(Vu+e);for(a=e.search(/p/i),a>0?(l=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,n=t.constructor,o&&(e=e.replace(".",""),s=e.length,a=s-a,i=TP(n,new n(r),a,a*2)),u=Og(e,r,Ho),c=u.length-1,a=c;u[a]===0;--a)u.pop();return a<0?new n(t.s*0):(t.e=qg(u,c),t.d=u,ir=!1,o&&(t=nn(t,i,s*4)),l&&(t=t.times(Math.abs(l)<54?ti(2,l):Zp.pow(2,l))),ir=!0,t)}function CZ(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:gf(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/zg(5,r)),e=gf(t,2,e,e);for(var i,a=new t(5),o=new t(16),s=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(s))));return e}function gf(t,e,r,n,i){var a,o,s,l,u=1,c=t.precision,f=Math.ceil(c/Ut);for(ir=!1,l=r.times(r),s=new t(n);;){if(o=nn(s.times(l),new t(e++*e++),c,1),s=i?n.plus(o):n.minus(o),n=nn(o.times(l),new t(e++*e++),c,1),o=s.plus(n),o.d[f]!==void 0){for(a=f;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=n,n=o,o=a,u++}return ir=!0,o.d.length=f+1,o}function zg(t,e){for(var r=t;--e;)r*=t;return r}function CP(t,e){var r,n=e.s<0,i=zo(t,t.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Xs=n?4:1,e;if(r=e.divToInt(i),r.isZero())Xs=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(a))return Xs=vP(r)?n?2:3:n?4:1,e;Xs=vP(r)?n?1:4:n?3:2}return e.minus(i).abs()}function Y0(t,e,r,n){var i,a,o,s,l,u,c,f,m,p=t.constructor,d=r!==void 0;if(d?(wa(r,1,Uu),n===void 0?n=p.rounding:wa(n,0,8)):(r=p.precision,n=p.rounding),!t.isFinite())c=MP(t);else{for(c=ds(t),o=c.indexOf("."),d?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,o>=0&&(c=c.replace(".",""),m=new p(1),m.e=c.length-o,m.d=Og(ds(m),10,i),m.e=m.d.length),f=Og(c,10,i),a=l=f.length;f[--l]==0;)f.pop();if(!f[0])c=d?"0p+0":"0";else{if(o<0?a--:(t=new p(t),t.d=f,t.e=a,t=nn(t,m,r,n,0,i),f=t.d,a=t.e,u=bP),o=f[r],s=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(t.s<0?3:2)):o>s||o===s&&(n===4||u||n===6&&f[r-1]&1||n===(t.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++a,f.unshift(1));for(l=f.length;!f[l-1];--l);for(o=0,c="";o<l;o++)c+=q0.charAt(f[o]);if(d){if(l>1)if(e==16||e==8){for(o=e==16?4:3,--l;l%o;l++)c+="0";for(f=Og(c,i,e),l=f.length;!f[l-1];--l);for(o=1,c="1.";o<l;o++)c+=q0.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>l)for(a-=l;a--;)c+="0";else a<l&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return t.s<0?"-"+c:c}function yP(t,e){if(t.length>e)return t.length=e,!0}function NZ(t){return new this(t).abs()}function FZ(t){return new this(t).acos()}function IZ(t){return new this(t).acosh()}function PZ(t,e){return new this(t).plus(e)}function BZ(t){return new this(t).asin()}function kZ(t){return new this(t).asinh()}function $Z(t){return new this(t).atan()}function OZ(t){return new this(t).atanh()}function RZ(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=zo(this,a,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?zo(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=zo(this,a,1).times(.5),r.s=t.s):e.s<0?(this.precision=a,this.rounding=1,r=this.atan(nn(t,e,a,1)),e=zo(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(nn(t,e,a,1)),r}function LZ(t){return new this(t).cbrt()}function VZ(t){return Ft(t=new this(t),t.e+1,2)}function UZ(t,e,r){return new this(t).clamp(e,r)}function qZ(t){if(!t||typeof t!="object")throw Error(Ug+"Object expected");var e,r,n,i=t.defaults===!0,a=["precision",1,Uu,"rounding",0,8,"toExpNeg",-hf,0,"toExpPos",0,hf,"maxE",0,hf,"minE",-hf,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=z0[r]),(n=t[r])!==void 0)if(ki(n)===n&&n>=a[e+1]&&n<=a[e+2])this[r]=n;else throw Error(Vu+r+": "+n);if(r="crypto",i&&(this[r]=z0[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(_P);else this[r]=!1;else throw Error(Vu+r+": "+n);return this}function zZ(t){return new this(t).cos()}function HZ(t){return new this(t).cosh()}function NP(t){var e,r,n;function i(a){var o,s,l,u=this;if(!(u instanceof i))return new i(a);if(u.constructor=i,xP(a)){u.s=a.s,ir?!a.d||a.e>i.maxE?(u.e=NaN,u.d=null):a.e<i.minE?(u.e=0,u.d=[0]):(u.e=a.e,u.d=a.d.slice()):(u.e=a.e,u.d=a.d?a.d.slice():a.d);return}if(l=typeof a,l==="number"){if(a===0){u.s=1/a<0?-1:1,u.e=0,u.d=[0];return}if(a<0?(a=-a,u.s=-1):u.s=1,a===~~a&&a<1e7){for(o=0,s=a;s>=10;s/=10)o++;ir?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[a]):(u.e=o,u.d=[a]);return}else if(a*0!==0){a||(u.s=NaN),u.e=NaN,u.d=null;return}return W0(u,a.toString())}else if(l!=="string")throw Error(Vu+a);return(s=a.charCodeAt(0))===45?(a=a.slice(1),u.s=-1):(s===43&&(a=a.slice(1)),u.s=1),SP.test(a)?W0(u,a):MZ(u,a)}if(i.prototype=Oe,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=qZ,i.clone=NP,i.isDecimal=xP,i.abs=NZ,i.acos=FZ,i.acosh=IZ,i.add=PZ,i.asin=BZ,i.asinh=kZ,i.atan=$Z,i.atanh=OZ,i.atan2=RZ,i.cbrt=LZ,i.ceil=VZ,i.clamp=UZ,i.cos=zZ,i.cosh=HZ,i.div=GZ,i.exp=WZ,i.floor=YZ,i.hypot=jZ,i.ln=ZZ,i.log=JZ,i.log10=QZ,i.log2=XZ,i.max=KZ,i.min=eJ,i.mod=tJ,i.mul=rJ,i.pow=nJ,i.random=iJ,i.round=aJ,i.sign=oJ,i.sin=sJ,i.sinh=uJ,i.sqrt=lJ,i.sub=cJ,i.sum=fJ,i.tan=pJ,i.tanh=mJ,i.trunc=dJ,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function GZ(t,e){return new this(t).div(e)}function WZ(t){return new this(t).exp()}function YZ(t){return Ft(t=new this(t),t.e+1,3)}function jZ(){var t,e,r=new this(0);for(ir=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return ir=!0,new this(1/0);r=e}return ir=!0,r.sqrt()}function xP(t){return t instanceof Zp||t&&t.toStringTag===AP||!1}function ZZ(t){return new this(t).ln()}function JZ(t,e){return new this(t).log(e)}function XZ(t){return new this(t).log(2)}function QZ(t){return new this(t).log(10)}function KZ(){return DP(this,arguments,"lt")}function eJ(){return DP(this,arguments,"gt")}function tJ(t,e){return new this(t).mod(e)}function rJ(t,e){return new this(t).mul(e)}function nJ(t,e){return new this(t).pow(e)}function iJ(t){var e,r,n,i,a=0,o=new this(1),s=[];if(t===void 0?t=this.precision:wa(t,1,Uu),n=Math.ceil(t/Ut),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);a<n;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(s.push(i%1e7),a+=4);a=n/4}else throw Error(_P);else for(;a<n;)s[a++]=Math.random()*1e7|0;for(n=s[--a],t%=Ut,n&&t&&(i=ti(10,Ut-t),s[a]=(n/i|0)*i);s[a]===0;a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;s[0]===0;r-=Ut)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<Ut&&(r-=Ut-n)}return o.e=r,o.d=s,o}function aJ(t){return Ft(t=new this(t),t.e+1,this.rounding)}function oJ(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function sJ(t){return new this(t).sin()}function uJ(t){return new this(t).sinh()}function lJ(t){return new this(t).sqrt()}function cJ(t,e){return new this(t).sub(e)}function fJ(){var t=0,e=arguments,r=new this(e[t]);for(ir=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return ir=!0,Ft(r,this.precision,this.rounding)}function pJ(t){return new this(t).tan()}function mJ(t){return new this(t).tanh()}function dJ(t){return Ft(t=new this(t),t.e+1,1)}Oe[Symbol.for("nodejs.util.inspect.custom")]=Oe.toString;Oe[Symbol.toStringTag]="Decimal";var Zp=Oe.constructor=NP(z0);Rg=new Zp(Rg);Lg=new Zp(Lg);var ql=Zp;var hJ="BigNumber",gJ=["?on","config"],j0=M(hJ,gJ,t=>{var{on:e,config:r}=t,n=ql.clone({precision:r.precision,modulo:ql.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(i){return new n(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&n.config({precision:i.precision})}),n},{isClass:!0});var $i=Math.cosh||function(t){return Math.abs(t)<1e-9?1-t:(Math.exp(t)+Math.exp(-t))*.5},yo=Math.sinh||function(t){return Math.abs(t)<1e-9?t:(Math.exp(t)-Math.exp(-t))*.5},vJ=function(t){let e=Math.PI/4;if(-e>t||t>e)return Math.cos(t)-1;let r=t*t;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},Z0=function(t,e){return t=Math.abs(t),e=Math.abs(e),t<e&&([t,e]=[e,t]),t<1e8?Math.sqrt(t*t+e*e):(e/=t,t*Math.sqrt(1+e*e))},vf=function(){throw SyntaxError("Invalid Param")};function J0(t,e){let r=Math.abs(t),n=Math.abs(e);return t===0?Math.log(n):e===0?Math.log(r):r<3e3&&n<3e3?Math.log(t*t+e*e)*.5:(t=t*.5,e=e*.5,.5*Math.log(t*t+e*e)+Math.LN2)}var yJ={re:0,im:0},zl=function(t,e){let r=yJ;if(t==null)r.re=r.im=0;else if(e!==void 0)r.re=t,r.im=e;else switch(typeof t){case"object":if("im"in t&&"re"in t)r.re=t.re,r.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return Pe.INFINITY;r.re=t.abs*Math.cos(t.arg),r.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return Pe.INFINITY;r.re=t.r*Math.cos(t.phi),r.im=t.r*Math.sin(t.phi)}else t.length===2?(r.re=t[0],r.im=t[1]):vf();break;case"string":r.im=r.re=0;let n=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;n===null&&vf();for(let o=0;o<n.length;o++){let s=n[o];s===" "||s==="	"||s===`
`||(s==="+"?i++:s==="-"?a++:s==="i"||s==="I"?(i+a===0&&vf(),n[o+1]!==" "&&!isNaN(n[o+1])?(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++):r.im+=parseFloat((a%2?"-":"")+"1"),i=a=0):((i+a===0||isNaN(s))&&vf(),n[o+1]==="i"||n[o+1]==="I"?(r.im+=parseFloat((a%2?"-":"")+s),o++):r.re+=parseFloat((a%2?"-":"")+s),i=a=0))}i+a>0&&vf();break;case"number":r.im=0,r.re=t;break;default:vf()}return isNaN(r.re)||isNaN(r.im),r};function Pe(t,e){if(!(this instanceof Pe))return new Pe(t,e);let r=zl(t,e);this.re=r.re,this.im=r.im}Pe.prototype={re:0,im:0,sign:function(){let t=Z0(this.re,this.im);return new Pe(this.re/t,this.im/t)},add:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re+r.re,this.im+r.im)},sub:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pe.NAN:Pe.INFINITY:new Pe(this.re-r.re,this.im-r.im)},mul:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;return n&&o||i&&a?Pe.NAN:n||i?Pe.INFINITY:r.im===0&&this.im===0?new Pe(this.re*r.re,0):new Pe(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(t,e){let r=zl(t,e),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),a=this.re===0&&this.im===0,o=r.re===0&&r.im===0;if(a&&o||n&&i)return Pe.NAN;if(o||n)return Pe.INFINITY;if(a||i)return Pe.ZERO;if(r.im===0)return new Pe(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let s=r.re/r.im,l=r.re*s+r.im;return new Pe((this.re*s+this.im)/l,(this.im*s-this.re)/l)}else{let s=r.im/r.re,l=r.im*s+r.re;return new Pe((this.re+this.im*s)/l,(this.im-this.re*s)/l)}},pow:function(t,e){let r=zl(t,e),n=this.re===0&&this.im===0;if(r.re===0&&r.im===0)return Pe.ONE;if(r.im===0){if(this.im===0&&this.re>0)return new Pe(Math.pow(this.re,r.re),0);if(this.re===0)switch((r.re%4+4)%4){case 0:return new Pe(Math.pow(this.im,r.re),0);case 1:return new Pe(0,Math.pow(this.im,r.re));case 2:return new Pe(-Math.pow(this.im,r.re),0);case 3:return new Pe(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Pe.ZERO;let a=Math.atan2(this.im,this.re),o=J0(this.re,this.im),s=Math.exp(r.re*o-r.im*a),l=r.im*o+r.re*a;return new Pe(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,e=this.im;if(e===0)return t>=0?new Pe(Math.sqrt(t),0):new Pe(0,Math.sqrt(-t));let r=Z0(t,e),n=Math.sqrt(.5*(r+Math.abs(t))),i=Math.abs(e)/(2*n);return t>=0?new Pe(n,e<0?-i:i):new Pe(i,e<0?-n:n)},exp:function(){let t=Math.exp(this.re);return this.im===0?new Pe(t,0):new Pe(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t=this.re,e=this.im;return new Pe(Math.expm1(t)*Math.cos(e)+vJ(e),Math.exp(t)*Math.sin(e))},log:function(){let t=this.re,e=this.im;return e===0&&t>0?new Pe(Math.log(t),0):new Pe(J0(t,e),Math.atan2(e,t))},abs:function(){return Z0(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,e=this.im;return new Pe(Math.sin(t)*$i(e),Math.cos(t)*yo(e))},cos:function(){let t=this.re,e=this.im;return new Pe(Math.cos(t)*$i(e),-Math.sin(t)*yo(e))},tan:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)+$i(e);return new Pe(Math.sin(t)/r,yo(e)/r)},cot:function(){let t=2*this.re,e=2*this.im,r=Math.cos(t)-$i(e);return new Pe(-Math.sin(t)/r,yo(e)/r)},sec:function(){let t=this.re,e=this.im,r=.5*$i(2*e)+.5*Math.cos(2*t);return new Pe(Math.cos(t)*$i(e)/r,Math.sin(t)*yo(e)/r)},csc:function(){let t=this.re,e=this.im,r=.5*$i(2*e)-.5*Math.cos(2*t);return new Pe(Math.sin(t)*$i(e)/r,-Math.cos(t)*yo(e)/r)},asin:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(n.im,-n.re)},acos:function(){let t=this.re,e=this.im,r=new Pe(e*e-t*t+1,-2*t*e).sqrt(),n=new Pe(r.re-e,r.im+t).log();return new Pe(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,e=this.im;if(t===0){if(e===1)return new Pe(0,1/0);if(e===-1)return new Pe(0,-1/0)}let r=t*t+(1-e)*(1-e),n=new Pe((1-e*e-t*t)/r,-2*t/r).log();return new Pe(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,e=this.im;if(e===0)return new Pe(Math.atan2(1,t),0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).atan():new Pe(t!==0?t/0:0,e!==0?-e/0:0).atan()},asec:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Pe(0,1/0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).acos():new Pe(t!==0?t/0:0,e!==0?-e/0:0).acos()},acsc:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Pe(Math.PI/2,1/0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).asin():new Pe(t!==0?t/0:0,e!==0?-e/0:0).asin()},sinh:function(){let t=this.re,e=this.im;return new Pe(yo(t)*Math.cos(e),$i(t)*Math.sin(e))},cosh:function(){let t=this.re,e=this.im;return new Pe($i(t)*Math.cos(e),yo(t)*Math.sin(e))},tanh:function(){let t=2*this.re,e=2*this.im,r=$i(t)+Math.cos(e);return new Pe(yo(t)/r,Math.sin(e)/r)},coth:function(){let t=2*this.re,e=2*this.im,r=$i(t)-Math.cos(e);return new Pe(yo(t)/r,-Math.sin(e)/r)},csch:function(){let t=this.re,e=this.im,r=Math.cos(2*e)-$i(2*t);return new Pe(-2*yo(t)*Math.cos(e)/r,2*$i(t)*Math.sin(e)/r)},sech:function(){let t=this.re,e=this.im,r=Math.cos(2*e)+$i(2*t);return new Pe(2*$i(t)*Math.cos(e)/r,-2*yo(t)*Math.sin(e)/r)},asinh:function(){let t=this.im;this.im=-this.re,this.re=t;let e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){let t=this.acos();if(t.im<=0){let e=t.re;t.re=-t.im,t.im=e}else{let e=t.im;t.im=-t.re,t.re=e}return t},atanh:function(){let t=this.re,e=this.im,r=t>1&&e===0,n=1-t,i=1+t,a=n*n+e*e,o=a!==0?new Pe((i*n-e*e)/a,(e*n+i*e)/a):new Pe(t!==-1?t/0:0,e!==0?e/0:0),s=o.re;return o.re=J0(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,r&&(o.im=-o.im),o},acoth:function(){let t=this.re,e=this.im;if(t===0&&e===0)return new Pe(0,Math.PI/2);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).atanh():new Pe(t!==0?t/0:0,e!==0?-e/0:0).atanh()},acsch:function(){let t=this.re,e=this.im;if(e===0)return new Pe(t!==0?Math.log(t+Math.sqrt(t*t+1)):1/0,0);let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).asinh():new Pe(t!==0?t/0:0,e!==0?-e/0:0).asinh()},asech:function(){let t=this.re,e=this.im;if(this.isZero())return Pe.INFINITY;let r=t*t+e*e;return r!==0?new Pe(t/r,-e/r).acosh():new Pe(t!==0?t/0:0,e!==0?-e/0:0).acosh()},inverse:function(){if(this.isZero())return Pe.INFINITY;if(this.isInfinite())return Pe.ZERO;let t=this.re,e=this.im,r=t*t+e*e;return new Pe(t/r,-e/r)},conjugate:function(){return new Pe(this.re,-this.im)},neg:function(){return new Pe(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new Pe(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new Pe(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new Pe(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){let r=zl(t,e);return Math.abs(r.re-this.re)<=Pe.EPSILON&&Math.abs(r.im-this.im)<=Pe.EPSILON},clone:function(){return new Pe(this.re,this.im)},toString:function(){let t=this.re,e=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<Pe.EPSILON&&(t=0),Math.abs(e)<Pe.EPSILON&&(e=0),e===0?r+t:(t!==0?(r+=t,r+=" ",e<0?(e=-e,r+="-"):r+="+",r+=" "):e<0&&(e=-e,r+="-"),e!==1&&(r+=e),r+"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.isFinite()}};Pe.ZERO=new Pe(0,0);Pe.ONE=new Pe(1,0);Pe.I=new Pe(0,1);Pe.PI=new Pe(Math.PI,0);Pe.E=new Pe(Math.E,0);Pe.INFINITY=new Pe(1/0,1/0);Pe.NAN=new Pe(NaN,NaN);Pe.EPSILON=1e-15;var xJ="Complex",bJ=[],X0=M(xJ,bJ,()=>(Object.defineProperty(Pe,"name",{value:"Complex"}),Pe.prototype.constructor=Pe,Pe.prototype.type="Complex",Pe.prototype.isComplex=!0,Pe.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Pe.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Pe.prototype.format=function(t){var e="",r=this.im,n=this.re,i=qo(this.re,t),a=qo(this.im,t),o=At(t)?t:t?t.precision:null;if(o!==null){var s=Math.pow(10,-o);Math.abs(n/r)<s&&(n=0),Math.abs(r/n)<s&&(r=0)}return r===0?e=i:n===0?r===1?e="i":r===-1?e="-i":e=a+"i":r<0?r===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":r===1?e=i+" + i":e=i+" + "+a+"i",e},Pe.fromPolar=function(t){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return Pe(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var r=arguments[0],n=arguments[1];if(At(r)){if(bi(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),At(n))return new Pe({r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Pe.prototype.valueOf=Pe.prototype.toString,Pe.fromJSON=function(t){return new Pe(t)},Pe.compare=function(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0},Pe),{isClass:!0});typeof BigInt>"u"&&(BigInt=function(t){if(isNaN(t))throw new Error("");return t});var It=BigInt(0),hr=BigInt(1),Jp=BigInt(2),Q0=BigInt(5),_a=BigInt(10),wJ=2e3,ut={s:hr,n:It,d:hr};function Qs(t,e){try{t=BigInt(t)}catch{throw qu()}return t*e}function Go(t){return typeof t=="bigint"?t:Math.floor(t)}function wn(t,e){if(e===It)throw K0();let r=Object.create(Ga.prototype);r.s=t<It?-hr:hr,t=t<It?-t:t;let n=Hl(t,e);return r.n=t/n,r.d=e/n,r}function yf(t){let e={},r=t,n=Jp,i=Q0-hr;for(;i<=r;){for(;r%n===It;)r/=n,e[n]=(e[n]||It)+hr;i+=hr+Jp*n++}return r!==t?r>1&&(e[r]=(e[r]||It)+hr):e[t]=(e[t]||It)+hr,e}var fi=function(t,e){let r=It,n=hr,i=hr;if(t!=null)if(e!==void 0){if(typeof t=="bigint")r=t;else{if(isNaN(t))throw qu();if(t%1!==0)throw FP();r=BigInt(t)}if(typeof e=="bigint")n=e;else{if(isNaN(e))throw qu();if(e%1!==0)throw FP();n=BigInt(e)}i=r*n}else if(typeof t=="object"){if("d"in t&&"n"in t)r=BigInt(t.n),n=BigInt(t.d),"s"in t&&(r*=BigInt(t.s));else if(0 in t)r=BigInt(t[0]),1 in t&&(n=BigInt(t[1]));else if(typeof t=="bigint")r=t;else throw qu();i=r*n}else if(typeof t=="number"){if(isNaN(t))throw qu();if(t<0&&(i=-hr,t=-t),t%1===0)r=BigInt(t);else if(t>0){let a=1,o=0,s=1,l=1,u=1,c=1e7;for(t>=1&&(a=10**Math.floor(1+Math.log10(t)),t/=a);s<=c&&u<=c;){let f=(o+l)/(s+u);if(t===f){s+u<=c?(r=o+l,n=s+u):u>s?(r=l,n=u):(r=o,n=s);break}else t>f?(o+=l,s+=u):(l+=o,u+=s),s>c?(r=l,n=u):(r=o,n=s)}r=BigInt(r)*BigInt(a),n=BigInt(n)}}else if(typeof t=="string"){let a=0,o=It,s=It,l=It,u=hr,c=hr,f=t.replace(/_/g,"").match(/\d+|./g);if(f===null)throw qu();if(f[a]==="-"?(i=-hr,a++):f[a]==="+"&&a++,f.length===a+1?s=Qs(f[a++],i):f[a+1]==="."||f[a]==="."?(f[a]!=="."&&(o=Qs(f[a++],i)),a++,(a+1===f.length||f[a+1]==="("&&f[a+3]===")"||f[a+1]==="'"&&f[a+3]==="'")&&(s=Qs(f[a],i),u=_a**BigInt(f[a].length),a++),(f[a]==="("&&f[a+2]===")"||f[a]==="'"&&f[a+2]==="'")&&(l=Qs(f[a+1],i),c=_a**BigInt(f[a+1].length)-hr,a+=3)):f[a+1]==="/"||f[a+1]===":"?(s=Qs(f[a],i),u=Qs(f[a+2],hr),a+=3):f[a+3]==="/"&&f[a+1]===" "&&(o=Qs(f[a],i),s=Qs(f[a+2],i),u=Qs(f[a+4],hr),a+=5),f.length<=a)n=u*c,i=r=l+n*o+c*s;else throw qu()}else if(typeof t=="bigint")r=t,i=t,n=hr;else throw qu();if(n===It)throw K0();ut.s=i<It?-hr:hr,ut.n=r<It?-r:r,ut.d=n<It?-n:n};function _J(t,e,r){let n=hr;for(;e>It;t=t*t%r,e>>=hr)e&hr&&(n=n*t%r);return n}function AJ(t,e){for(;e%Jp===It;e/=Jp);for(;e%Q0===It;e/=Q0);if(e===hr)return It;let r=_a%e,n=1;for(;r!==hr;n++)if(r=r*_a%e,n>wJ)return It;return BigInt(n)}function SJ(t,e,r){let n=hr,i=_J(_a,r,e);for(let a=0;a<300;a++){if(n===i)return BigInt(a);n=n*_a%e,i=i*_a%e}return 0}function Hl(t,e){if(!t)return e;if(!e)return t;for(;;){if(t%=e,!t)return e;if(e%=t,!e)return t}}function Ga(t,e){if(fi(t,e),this instanceof Ga)t=Hl(ut.d,ut.n),this.s=ut.s,this.n=ut.n/t,this.d=ut.d/t;else return wn(ut.s*ut.n,ut.d)}var K0=function(){return new Error("Division by Zero")},qu=function(){return new Error("Invalid argument")},FP=function(){return new Error("Parameters must be integer")};Ga.prototype={s:hr,n:It,d:hr,abs:function(){return wn(this.n,this.d)},neg:function(){return wn(-this.s*this.n,this.d)},add:function(t,e){return fi(t,e),wn(this.s*this.n*ut.d+ut.s*this.d*ut.n,this.d*ut.d)},sub:function(t,e){return fi(t,e),wn(this.s*this.n*ut.d-ut.s*this.d*ut.n,this.d*ut.d)},mul:function(t,e){return fi(t,e),wn(this.s*ut.s*this.n*ut.n,this.d*ut.d)},div:function(t,e){return fi(t,e),wn(this.s*ut.s*this.n*ut.d,this.d*ut.n)},clone:function(){return wn(this.s*this.n,this.d)},mod:function(t,e){if(t===void 0)return wn(this.s*this.n%this.d,hr);if(fi(t,e),It===ut.n*this.d)throw K0();return wn(this.s*(ut.d*this.n)%(ut.n*this.d),ut.d*this.d)},gcd:function(t,e){return fi(t,e),wn(Hl(ut.n,this.n)*Hl(ut.d,this.d),ut.d*this.d)},lcm:function(t,e){return fi(t,e),ut.n===It&&this.n===It?wn(It,hr):wn(ut.n*this.n,Hl(ut.n,this.n)*Hl(ut.d,this.d))},inverse:function(){return wn(this.s*this.d,this.n)},pow:function(t,e){if(fi(t,e),ut.d===hr)return ut.s<It?wn((this.s*this.d)**ut.n,this.n**ut.n):wn((this.s*this.n)**ut.n,this.d**ut.n);if(this.s<It)return null;let r=yf(this.n),n=yf(this.d),i=hr,a=hr;for(let o in r)if(o!=="1"){if(o==="0"){i=It;break}if(r[o]*=ut.n,r[o]%ut.d===It)r[o]/=ut.d;else return null;i*=BigInt(o)**r[o]}for(let o in n)if(o!=="1"){if(n[o]*=ut.n,n[o]%ut.d===It)n[o]/=ut.d;else return null;a*=BigInt(o)**n[o]}return ut.s<It?wn(a,i):wn(i,a)},log:function(t,e){if(fi(t,e),this.s<=It||ut.s<=It)return null;let r={},n=yf(ut.n),i=yf(ut.d),a=yf(this.n),o=yf(this.d);for(let u in i)n[u]=(n[u]||It)-i[u];for(let u in o)a[u]=(a[u]||It)-o[u];for(let u in n)u!=="1"&&(r[u]=!0);for(let u in a)u!=="1"&&(r[u]=!0);let s=null,l=null;for(let u in r){let c=n[u]||It,f=a[u]||It;if(c===It){if(f!==It)return null;continue}let m=f,p=c,d=Hl(m,p);if(m/=d,p/=d,s===null&&l===null)s=m,l=p;else if(m*l!==s*p)return null}return s!==null&&l!==null?wn(s,l):null},equals:function(t,e){return fi(t,e),this.s*this.n*ut.d===ut.s*ut.n*this.d},lt:function(t,e){return fi(t,e),this.s*this.n*ut.d<ut.s*ut.n*this.d},lte:function(t,e){return fi(t,e),this.s*this.n*ut.d<=ut.s*ut.n*this.d},gt:function(t,e){return fi(t,e),this.s*this.n*ut.d>ut.s*ut.n*this.d},gte:function(t,e){return fi(t,e),this.s*this.n*ut.d>=ut.s*ut.n*this.d},compare:function(t,e){fi(t,e);let r=this.s*this.n*ut.d-ut.s*ut.n*this.d;return(It<r)-(r<It)},ceil:function(t){return t=_a**BigInt(t||0),wn(Go(this.s*t*this.n/this.d)+(t*this.n%this.d>It&&this.s>=It?hr:It),t)},floor:function(t){return t=_a**BigInt(t||0),wn(Go(this.s*t*this.n/this.d)-(t*this.n%this.d>It&&this.s<It?hr:It),t)},round:function(t){return t=_a**BigInt(t||0),wn(Go(this.s*t*this.n/this.d)+this.s*((this.s>=It?hr:It)+Jp*(t*this.n%this.d)>this.d?hr:It),t)},roundTo:function(t,e){fi(t,e);let r=this.n*ut.d,n=this.d*ut.n,i=r%n,a=Go(r/n);return i+i>=n&&a++,wn(this.s*a*ut.n,ut.d)},divisible:function(t,e){return fi(t,e),!(!(ut.n*this.d)||this.n*ut.d%(ut.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(t){let e=this.n,r=this.d;t=t||15;let n=AJ(e,r),i=SJ(e,r,n),a=this.s<It?"-":"";if(a+=Go(e/r),e%=r,e*=_a,e&&(a+="."),n){for(let o=i;o--;)a+=Go(e/r),e%=r,e*=_a;a+="(";for(let o=n;o--;)a+=Go(e/r),e%=r,e*=_a;a+=")"}else for(let o=t;e&&o--;)a+=Go(e/r),e%=r,e*=_a;return a},toFraction:function(t){let e=this.n,r=this.d,n=this.s<It?"-":"";if(r===hr)n+=e;else{let i=Go(e/r);t&&i>It&&(n+=i,n+=" ",e%=r),n+=e,n+="/",n+=r}return n},toLatex:function(t){let e=this.n,r=this.d,n=this.s<It?"-":"";if(r===hr)n+=e;else{let i=Go(e/r);t&&i>It&&(n+=i,e%=r),n+="\\frac{",n+=e,n+="}{",n+=r,n+="}"}return n},toContinued:function(){let t=this.n,e=this.d,r=[];do{r.push(Go(t/e));let n=t%e;t=e,e=n}while(t!==hr);return r},simplify:function(t){let e=BigInt(1/(t||.001)|0),r=this.abs(),n=r.toContinued();for(let i=1;i<n.length;i++){let a=wn(n[i-1],hr);for(let s=i-2;s>=0;s--)a=a.inverse().add(n[s]);let o=a.sub(r);if(o.n*e<o.d)return a.mul(this.s)}return this}};var EJ="Fraction",TJ=[],ew=M(EJ,TJ,()=>(Object.defineProperty(Ga,"name",{value:"Fraction"}),Ga.prototype.constructor=Ga,Ga.prototype.type="Fraction",Ga.prototype.isFraction=!0,Ga.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},Ga.fromJSON=function(t){return new Ga(t)},Ga),{isClass:!0});var DJ="Range",MJ=[],tw=M(DJ,MJ,()=>{function t(e,r,n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=r!=null,o=n!=null;if(i){if(ft(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(ft(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter end must be a number")}if(o){if(ft(n))n=n.toNumber();else if(typeof n!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(r):0,this.step=o?parseFloat(n):1}return t.prototype.type="Range",t.prototype.isRange=!0,t.parse=function(e){if(typeof e!="string")return null;var r=e.split(":"),n=r.map(function(a){return parseFloat(a)}),i=n.some(function(a){return isNaN(a)});if(i)return null;switch(n.length){case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[2],n[1]);default:return null}},t.prototype.clone=function(){return new t(this.start,this.end,this.step)},t.prototype.size=function(){var e=0,r=this.start,n=this.step,i=this.end,a=i-r;return vo(n)===vo(a)?e=Math.ceil(a/n):a===0&&(e=0),isNaN(e)&&(e=0),[e]},t.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},t.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},t.prototype.forEach=function(e){var r=this.start,n=this.step,i=this.end,a=0;if(n>0)for(;r<i;)e(r,[a],this),r+=n,a++;else if(n<0)for(;r>i;)e(r,[a],this),r+=n,a++},t.prototype.map=function(e){var r=[];return this.forEach(function(n,i,a){r[i[0]]=e(n,i,a)}),r},t.prototype.toArray=function(){var e=[];return this.forEach(function(r,n){e[n[0]]=r}),e},t.prototype.valueOf=function(){return this.toArray()},t.prototype.format=function(e){var r=qo(this.start,e);return this.step!==1&&(r+=":"+qo(this.step,e)),r+=":"+qo(this.end,e),r},t.prototype.toString=function(){return this.format()},t.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},t.fromJSON=function(e){return new t(e.start,e.end,e.step)},t},{isClass:!0});var CJ="Matrix",NJ=[],rw=M(CJ,NJ,()=>{function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(e,r){throw new Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(e,r,n){throw new Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(e,r,n){throw new Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(e,r){throw new Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(e,r){throw new Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(e,r){throw new Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0});function nw(t,e,r){var n=t.constructor,i=new n(2),a="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!Qe(r))throw new Error("size must be an integer");if(t.greaterThan(i.pow(r-1).sub(1))||t.lessThan(i.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t.isInteger())throw new Error("Value must be an integer");t.lessThan(0)&&(t=t.add(i.pow(r))),a="i".concat(r)}switch(e){case 2:return"".concat(t.toBinary()).concat(a);case 8:return"".concat(t.toOctal()).concat(a);case 16:return"".concat(t.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function BP(t,e){if(typeof e=="function")return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var{notation:r,precision:n,wordSize:i}=O0(e);switch(r){case"fixed":return IJ(t,n);case"exponential":return IP(t,n);case"engineering":return FJ(t,n);case"bin":return nw(t,2,i);case"oct":return nw(t,8,i);case"hex":return nw(t,16,i);case"auto":{var a=PP(e?.lowerExp,-3),o=PP(e?.upperExp,5);if(t.isZero())return"0";var s,l=t.toSignificantDigits(n),u=l.e;return u>=a&&u<o?s=l.toFixed():s=IP(t,n),s.replace(/((\.\d*?)(0+))($|e)/,function(){var c=arguments[2],f=arguments[4];return c!=="."?c+f:f})}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function FJ(t,e){var r=t.e,n=r%3===0?r:r<0?r-3-r%3:r-r%3,i=t.mul(Math.pow(10,-n)),a=i.toPrecision(e);if(a.includes("e")){var o=t.constructor;a=new o(a).toFixed()}return a+"e"+(r>=0?"+":"")+n.toString()}function IP(t,e){return e!==void 0?t.toExponential(e-1):t.toExponential()}function IJ(t,e){return t.toFixed(e)}function PP(t,e){return At(t)?t:ft(t)?t.toNumber():e}function $P(t,e){var r=t.length-e.length,n=t.length;return t.substring(r,n)===e}function Dt(t,e){var r=PJ(t,e);return e&&typeof e=="object"&&"truncate"in e&&r.length>e.truncate?r.substring(0,e.truncate-3)+"...":r}function PJ(t,e){if(typeof t=="number")return qo(t,e);if(ft(t))return BP(t,e);if(BJ(t))return!e||e.fraction!=="decimal"?"".concat(t.s*t.n,"/").concat(t.d):t.toString();if(Array.isArray(t))return OP(t,e);if(bn(t))return Gl(t);if(typeof t=="function")return t.syntax?String(t.syntax):"function";if(t&&typeof t=="object"){if(typeof t.format=="function")return t.format(e);if(t&&t.toString(e)!=={}.toString())return t.toString(e);var r=Object.keys(t).map(n=>Gl(n)+": "+Dt(t[n],e));return"{"+r.join(", ")+"}"}return String(t)}function Gl(t){for(var e=String(t),r="",n=0;n<e.length;){var i=e.charAt(n);r+=i in kP?kP[i]:i,n++}return'"'+r+'"'}var kP={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t"};function ri(t){var e=String(t);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function OP(t,e){if(Array.isArray(t)){for(var r="[",n=t.length,i=0;i<n;i++)i!==0&&(r+=", "),r+=OP(t[i],e);return r+="]",r}else return Dt(t,e)}function BJ(t){return t&&typeof t=="object"&&typeof t.s=="bigint"&&typeof t.n=="bigint"&&typeof t.d=="bigint"||!1}function Hg(t,e){if(!bn(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+fr(t)+", index: 0)");if(!bn(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+fr(e)+", index: 1)");return t===e?0:t>e?1:-1}function Ct(t,e,r){if(!(this instanceof Ct))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Ct.prototype=new RangeError;Ct.prototype.constructor=RangeError;Ct.prototype.name="DimensionError";Ct.prototype.isDimensionError=!0;function Si(t,e,r){if(!(this instanceof Si))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=r),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}Si.prototype=new RangeError;Si.prototype.constructor=RangeError;Si.prototype.name="IndexError";Si.prototype.isIndexError=!0;function pt(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function RP(t,e,r){var n,i=t.length;if(i!==e[r])throw new Ct(i,e[r]);if(r<e.length-1){var a=r+1;for(n=0;n<i;n++){var o=t[n];if(!Array.isArray(o))throw new Ct(e.length-1,e.length,"<");RP(t[n],e,a)}}else for(n=0;n<i;n++)if(Array.isArray(t[n]))throw new Ct(e.length+1,e.length,">")}function aw(t,e){var r=e.length===0;if(r){if(Array.isArray(t))throw new Ct(t.length,0)}else RP(t,e,0)}function Xp(t,e){var r=t.isMatrix?t._size:pt(t),n=e._sourceSize;n.forEach((i,a)=>{if(i!==null&&i!==r[a])throw new Ct(i,r[a])})}function Br(t,e){if(t!==void 0){if(!At(t)||!Qe(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||typeof e=="number"&&t>=e)throw new Si(t,e)}}function Wl(t){for(var e=0;e<t._dimensions.length;++e){var r=t._dimensions[e];if(r._data&&vr(r._data)){if(r._size[0]===0)return!0}else if(r.isRange){if(r.start===r.end)return!0}else if(bn(r)&&r.length===0)return!0}return!1}function Wo(t,e,r){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)||!Qe(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(e)+")")}),(At(t)||ft(t))&&(t=[t]);var n=r!==void 0?r:0;return iw(t,e,0,n),t}function iw(t,e,r,n){var i,a,o=t.length,s=e[r],l=Math.min(o,s);if(t.length=s,r<e.length-1){var u=r+1;for(i=0;i<l;i++)a=t[i],Array.isArray(a)||(a=[a],t[i]=a),iw(a,e,u,n);for(i=l;i<s;i++)a=[],t[i]=a,iw(a,e,u,n)}else{for(i=0;i<l;i++)for(;Array.isArray(t[i]);)t[i]=t[i][0];for(i=l;i<s;i++)t[i]=n}}function Qp(t,e){var r=Rt(t),n=r.length;if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Ct(0,n,"!=");e=Kp(e,n);var i=LP(e);if(n!==i)throw new Ct(i,n,"!=");try{return kJ(r,e)}catch(a){throw a instanceof Ct?new Ct(i,n,"!="):a}}function Kp(t,e){var r=LP(t),n=t.slice(),i=-1,a=t.indexOf(i),o=t.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var s=a>=0,l=e%r===0;if(s)if(l)n[a]=-e/r;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-r);return n}function LP(t){return t.reduce((e,r)=>e*r,1)}function kJ(t,e){for(var r=t,n,i=e.length-1;i>0;i--){var a=e[i];n=[];for(var o=r.length/a,s=0;s<o;s++)n.push(r.slice(s*a,(s+1)*a));r=n}return r}function xf(t,e){for(var r=e||pt(t);Array.isArray(t)&&t.length===1;)t=t[0],r.shift();for(var n=r.length;r[n-1]===1;)n--;return n<r.length&&(t=VP(t,n,0),r.length=n),t}function VP(t,e,r){var n,i;if(r<e){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=VP(t[n],e,a)}else for(;Array.isArray(t);)t=t[0];return t}function Gg(t,e,r,n){var i=n||pt(t);if(r)for(var a=0;a<r;a++)t=[t],i.unshift(1);for(t=UP(t,e,0);i.length<e;)i.push(1);return t}function UP(t,e,r){var n,i;if(Array.isArray(t)){var a=r+1;for(n=0,i=t.length;n<i;n++)t[n]=UP(t[n],e,a)}else for(var o=r;o<e;o++)t=[t];return t}function Rt(t){if(!Array.isArray(t))return t;var e=[];return t.forEach(function r(n){Array.isArray(n)?n.forEach(r):e.push(n)}),e}function xo(t,e){return Array.prototype.map.call(t,e)}function Wg(t,e){Array.prototype.forEach.call(t,e)}function qP(t,e){if(pt(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,e)}function ow(t,e){if(pt(t).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,r=>e.test(r))}function sw(t,e){return Array.prototype.join.call(t,e)}function Ks(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;var e=[],r=0;e[0]={value:t[0],identifier:0};for(var n=1;n<t.length;n++)t[n]===t[n-1]?r++:r=0,e.push({value:t[n],identifier:r});return e}function bf(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(t.length===0)return t;for(var e=[],r=0;r<t.length;r++)e.push(t[r].value);return e}function Yl(t,e){for(var r,n=0,i=0;i<t.length;i++){var a=t[i],o=Array.isArray(a);if(i===0&&o&&(n=a.length),o&&a.length!==n)return;var s=o?Yl(a,e):e(a);if(r===void 0)r=s;else if(r!==s)return"mixed"}return r}function zP(t,e,r,n){if(n<r){if(t.length!==e.length)throw new Ct(t.length,e.length);for(var i=[],a=0;a<t.length;a++)i[a]=zP(t[a],e[a],r,n+1);return i}else return t.concat(e)}function uw(){var t=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(t.length===1)return t[0];if(t.length>1)return t.slice(1).reduce(function(r,n){return zP(r,n,e,0)},t[0]);throw new Error("Wrong number of arguments in function concat")}function em(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var n=e.map(m=>m.length),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var s=e[o],l=n[o],u=0;u<l;u++){var c=i-l+u;s[u]>a[c]&&(a[c]=s[u])}for(var f=0;f<e.length;f++)HP(e[f],a);return a}function HP(t,e){for(var r=e.length,n=t.length,i=0;i<n;i++){var a=r-n+i;if(t[i]<e[a]&&t[i]>1||t[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(t,") not possible to broadcast dimension ").concat(n," with size ").concat(t[i]," to size ").concat(e[a]))}}function hs(t,e){var r=pt(t);if(ba(r,e))return t;HP(r,e);var n=em(r,e),i=n.length,a=[...Array(i-r.length).fill(1),...r],o=OJ(t);r.length<i&&(o=Qp(o,a),r=pt(o));for(var s=0;s<i;s++)r[s]<n[s]&&(o=$J(o,n[s],s),r=pt(o));return o}function $J(t,e,r){return uw(...Array(e).fill(t),r)}function wf(t,e){if(!Array.isArray(t))throw new Error("Array expected");var r=pt(t);if(e.length!==r.length)throw new Ct(e.length,r.length);for(var n=0;n<e.length;n++)Br(e[n],r[n]);return e.reduce((i,a)=>i[a],t)}function tm(t,e,r,n){return Array.isArray(t)?t.map(function(i,a){return tm(i,e.concat(a),r,n)}):n(t,e,r)}function OJ(t){return sn([],t)}var lw=zr(k0(),1);function bo(t,e,r){if(lw.default.isTypedFunction(t)){var n=(e.isMatrix?e.size():pt(e)).map(()=>0),i=e.isMatrix?e.get(n):wf(e,n),a=Object.keys(t.signatures).length===1,o=RJ(t,i,n,e),s=a?Object.values(t.signatures)[0]:t;return o>=1&&o<=3?function(){for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];return GP(s,u.slice(0,o),r,t.name)}:function(){for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];return GP(s,u,r,t.name)}}return t}function RJ(t,e,r,n){for(var i=[e,r,n],a=3;a>0;a--){var o=i.slice(0,a);if(lw.default.resolve(t,o)!==null)return a}}function GP(t,e,r,n){try{return t(...e)}catch(i){LJ(i,e,r,n)}}function LJ(t,e,r,n){var i;if(t instanceof TypeError&&((i=t.data)===null||i===void 0?void 0:i.category)==="wrongType"){var a=[];throw a.push("value: ".concat(fr(e[0]))),e.length>=2&&a.push("index: ".concat(fr(e[1]))),e.length>=3&&a.push("array: ".concat(fr(e[2]))),new TypeError("Function ".concat(r," cannot apply callback arguments ")+"".concat(n,"(").concat(a.join(", "),") at index ").concat(JSON.stringify(e[1])))}else throw new TypeError("Function ".concat(r," cannot apply callback arguments ")+"to function ".concat(n,": ").concat(t.message))}var VJ="DenseMatrix",UJ=["Matrix"],cw=M(VJ,UJ,t=>{var{Matrix:e}=t;function r(c,f){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!bn(f))throw new Error("Invalid datatype: "+f);if(rt(c))c.type==="DenseMatrix"?(this._data=yt(c._data),this._size=yt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&vr(c.data)&&vr(c.size))this._data=c.data,this._size=c.size,aw(this._data,this._size),this._datatype=f||c.datatype;else if(vr(c))this._data=u(c),this._size=pt(this._data),aw(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+fr(c)+")");this._data=[],this._size=[0],this._datatype=f}}r.prototype=new e,r.prototype.createDenseMatrix=function(c,f){return new r(c,f)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Yl(this._data,fr)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(c,f){return new r(c,f)},r.prototype.subset=function(c,f,m){switch(arguments.length){case 1:return n(this,c);case 2:case 3:return a(this,c,f,m);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(c){return wf(this._data,c)},r.prototype.set=function(c,f,m){if(!vr(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Ct(c.length,this._size.length,"<");var p,d,h,x=c.map(function(T){return T+1});l(this,x,m);var b=this._data;for(p=0,d=c.length-1;p<d;p++)h=c[p],Br(h,b.length),b=b[h];return h=c[c.length-1],Br(h,b.length),b[h]=f,this};function n(c,f){if(!$u(f))throw new TypeError("Invalid index");var m=f.isScalar();if(m)return c.get(f.min());var p=f.size();if(p.length!==c._size.length)throw new Ct(p.length,c._size.length);for(var d=f.min(),h=f.max(),x=0,b=c._size.length;x<b;x++)Br(d[x],c._size[x]),Br(h[x],c._size[x]);return new r(i(c._data,f,p.length,0),c._datatype)}function i(c,f,m,p){var d=p===m-1,h=f.dimension(p);return d?h.map(function(x){return Br(x,c.length),c[x]}).valueOf():h.map(function(x){Br(x,c.length);var b=c[x];return i(b,f,m,p+1)}).valueOf()}function a(c,f,m,p){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var d=f.size(),h=f.isScalar(),x;if(rt(m)?(x=m.size(),m=m.valueOf()):x=pt(m),h){if(x.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),m,p)}else{if(!ba(x,d))try{x.length===0?m=hs([m],d):m=hs(m,d),x=pt(m)}catch{}if(d.length<c._size.length)throw new Ct(d.length,c._size.length,"<");if(x.length<d.length){for(var b=0,T=0;d[b]===1&&x[b]===1;)b++;for(;d[b]===1;)T++,b++;m=Gg(m,d.length,T,x)}if(!ba(d,x))throw new Ct(d,x,">");var v=f.max().map(function(y){return y+1});l(c,v,p);var A=d.length,w=0;o(c._data,f,m,A,w)}return c}function o(c,f,m,p,d){var h=d===p-1,x=f.dimension(d);h?x.forEach(function(b,T){Br(b),c[b]=m[T[0]]}):x.forEach(function(b,T){Br(b),o(c[b],f,m[T[0]],p,d+1)})}r.prototype.resize=function(c,f,m){if(!Tn(c))throw new TypeError("Array or Matrix expected");var p=c.valueOf().map(h=>Array.isArray(h)&&h.length===1?h[0]:h),d=m?this.clone():this;return s(d,p,f)};function s(c,f,m){if(f.length===0){for(var p=c._data;vr(p);)p=p[0];return p}return c._size=f.slice(0),c._data=Wo(c._data,c._size,m),c}r.prototype.reshape=function(c,f){var m=f?this.clone():this;m._data=Qp(m._data,c);var p=m._size.reduce((d,h)=>d*h);return m._size=Kp(c,p),m};function l(c,f,m){for(var p=c._size.slice(0),d=!1;p.length<f.length;)p.push(0),d=!0;for(var h=0,x=f.length;h<x;h++)f[h]>p[h]&&(p[h]=f[h],d=!0);d&&s(c,p,m)}r.prototype.clone=function(){var c=new r({data:yt(this._data),size:yt(this._size),datatype:this._datatype});return c},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(c){var f=this,m=f.size();if(m.length===1){for(var p=0;p<m[0];p++)c(f._data,p,[p]);return}var d=Array(m.length).fill(0),h=Array(m.length-1),x=h.length-1;h[0]=f._data[0];for(var b=0;b<x;b++)h[b+1]=h[b][0];for(d[x]=-1;;){var T=void 0;for(T=x;T>=0;T--){if(d[T]++,d[T]===m[T]){d[T]=0;continue}h[T]=T===0?f._data[d[T]]:h[T-1][d[T]];for(var v=T;v<x;v++)h[v+1]=h[v][0];for(var A=0;A<m[h.length];A++)d[h.length]=A,c(h[x],A,d.slice(0));break}if(T===-1)break}},r.prototype.map=function(c){var f=this,m=new r(f),p=bo(c,f._data,"map");return m._forEach(function(d,h,x){d[h]=p(d[h],x,f)}),m},r.prototype.forEach=function(c){var f=this,m=bo(c,f._data,"map");f._forEach(function(p,d,h){m(p[d],h,f)})},r.prototype[Symbol.iterator]=function*(){var c=function*(m,p){if(vr(m))for(var d=0;d<m.length;d++)yield*c(m[d],p.concat(d));else yield{value:m,index:p}};yield*c(this._data,[])},r.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 m=this._data;for(var p of m)c.push(new r([p],this._datatype));return c},r.prototype.columns=function(){var c=this,f=[],m=this.size();if(m.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var p=this._data,d=function(b){var T=p.map(v=>[v[b]]);f.push(new r(T,c._datatype))},h=0;h<m[1];h++)d(h);return f},r.prototype.toArray=function(){return yt(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(c){return Dt(this._data,c)},r.prototype.toString=function(){return Dt(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(c){if(c){if(ft(c)&&(c=c.toNumber()),!At(c)||!Qe(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var f=c>0?c:0,m=c<0?-c:0,p=this._size[0],d=this._size[1],h=Math.min(p-m,d-f),x=[],b=0;b<h;b++)x[b]=this._data[b+m][b+f];return new r({data:x,size:[h],datatype:this._datatype})},r.diagonal=function(c,f,m,p){if(!vr(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(E){if(ft(E)&&(E=E.toNumber()),!At(E)||!Qe(E)||E<1)throw new Error("Size values must be positive integers");return E}),m){if(ft(m)&&(m=m.toNumber()),!At(m)||!Qe(m))throw new TypeError("The parameter k must be an integer number")}else m=0;var d=m>0?m:0,h=m<0?-m:0,x=c[0],b=c[1],T=Math.min(x-h,b-d),v;if(vr(f)){if(f.length!==T)throw new Error("Invalid value array length");v=function(D){return f[D]}}else if(rt(f)){var A=f.size();if(A.length!==1||A[0]!==T)throw new Error("Invalid matrix length");v=function(D){return f.get([D])}}else v=function(){return f};p||(p=ft(v(0))?v(0).mul(0):0);var w=[];if(c.length>0){w=Wo(w,c,p);for(var y=0;y<T;y++)w[y+h][y+d]=v(y)}return new r({data:w,size:[x,b]})},r.fromJSON=function(c){return new r(c)},r.prototype.swapRows=function(c,f){if(!At(c)||!Qe(c)||!At(f)||!Qe(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]),r._swapRows(c,f,this._data),this},r._swapRows=function(c,f,m){var p=m[c];m[c]=m[f],m[f]=p};function u(c){return rt(c)?u(c.valueOf()):vr(c)?c.map(u):c}return r},{isClass:!0});var WP="clone",qJ=["typed"],fw=M(WP,qJ,t=>{var{typed:e}=t;return e(WP,{any:yt})});function Yg(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}function wo(t){for(var e=0;e<t.length;e++)if(Tn(t[e]))return!0;return!1}function Oi(t,e){rt(t)&&(t=t.valueOf());for(var r=0,n=t.length;r<n;r++){var i=t[r];Array.isArray(i)?Oi(i,e):e(i)}}function nt(t,e,r){return t&&typeof t.map=="function"?t.map(function(n){return nt(n,e,r)}):e(t)}function zu(t,e,r){var n=Array.isArray(t)?pt(t):t.size();if(e<0||e>=n.length)throw new Si(e,n.length);return rt(t)?t.create(jg(t.valueOf(),e,r),t.datatype()):jg(t,e,r)}function jg(t,e,r){var n,i,a,o;if(e<=0)if(Array.isArray(t[0])){for(o=Yg(t),i=[],n=0;n<o.length;n++)i[n]=jg(o[n],e-1,r);return i}else{for(a=t[0],n=1;n<t.length;n++)a=r(a,t[n]);return a}else{for(i=[],n=0;n<t.length;n++)i[n]=jg(t[n],e-1,r);return i}}function pw(t,e,r,n,i,a,o,s,l,u,c){var f=t._values,m=t._index,p=t._ptr,d,h,x,b;if(n)for(h=p[e],x=p[e+1],d=h;d<x;d++)b=m[d],r[b]!==a?(r[b]=a,o.push(b),u?(n[b]=l?s(f[d],c):s(c,f[d]),i[b]=a):n[b]=f[d]):(n[b]=l?s(f[d],n[b]):s(n[b],f[d]),i[b]=a);else for(h=p[e],x=p[e+1],d=h;d<x;d++)b=m[d],r[b]!==a?(r[b]=a,o.push(b)):i[b]=a}var YP="isInteger",zJ=["typed"],mw=M(YP,zJ,t=>{var{typed:e}=t;return e(YP,{number:Qe,BigNumber:function(n){return n.isInt()},bigint:function(n){return!0},Fraction:function(n){return n.d===1n},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var Aa="number",eu="number, number";function dw(t){return Math.abs(t)}dw.signature=Aa;function hw(t,e){return t+e}hw.signature=eu;function gw(t,e){return t-e}gw.signature=eu;function vw(t,e){return t*e}vw.signature=eu;function HJ(t,e){return t/e}HJ.signature=eu;function yw(t){return-t}yw.signature=Aa;function xw(t){return t}xw.signature=Aa;function _f(t){return sP(t)}_f.signature=Aa;function bw(t){return t*t*t}bw.signature=Aa;function ww(t){return Math.exp(t)}ww.signature=Aa;function _w(t){return uP(t)}_w.signature=Aa;function GJ(t,e){if(!Qe(t)||!Qe(e))throw new Error("Parameters in function gcd must be integer numbers");for(var r;e!==0;)r=t%e,t=e,e=r;return t<0?-t:t}GJ.signature=eu;function Aw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Parameters in function lcm must be integer numbers");if(t===0||e===0)return 0;for(var r,n=t*e;e!==0;)r=e,e=t%r,t=r;return Math.abs(n/t)}Aw.signature=eu;function jP(t,e){return e?Math.log(t)/Math.log(e):Math.log(t)}function Sw(t){return oP(t)}Sw.signature=Aa;function Ew(t){return aP(t)}Ew.signature=Aa;function WJ(t){return Ng(t)}WJ.signature=Aa;function YJ(t,e){return e===0?t:t-e*Math.floor(t/e)}YJ.signature=eu;function Tw(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=e<0;if(r&&(e=-e),e===0)throw new Error("Root must be non-zero");if(t<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(t===0)return r?1/0:0;if(!isFinite(t))return r?0:t;var n=Math.pow(Math.abs(t),1/e);return n=t<0?-n:n,r?1/n:n}function Zg(t){return vo(t)}Zg.signature=Aa;function jJ(t){return Math.sqrt(t)}jJ.signature=Aa;function Dw(t){return t*t}Dw.signature=Aa;function Mw(t,e){var r,n,i,a=0,o=1,s=1,l=0;if(!Qe(t)||!Qe(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(t/e),i=t-n*e,r=a,a=o-n*a,o=r,r=s,s=l-n*s,l=r,t=e,e=i;var u;return t<0?u=[-t,-o,-l]:u=[t,t?o:0,l],u}Mw.signature=eu;function Cw(t,e){return t*t<1&&e===1/0||t*t>1&&e===-1/0?0:Math.pow(t,e)}Cw.signature=eu;function Af(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!Qe(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(R0(t,e))}function ZJ(t){return Math.abs(t)}ZJ.signature=Aa;var JJ="number",Sf="number, number";function Nw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitAnd");return t&e}Nw.signature=Sf;function Fw(t){if(!Qe(t))throw new Error("Integer expected in function bitNot");return~t}Fw.signature=JJ;function Iw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitOr");return t|e}Iw.signature=Sf;function Pw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function bitXor");return t^e}Pw.signature=Sf;function Bw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function leftShift");return t<<e}Bw.signature=Sf;function kw(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function rightArithShift");return t>>e}kw.signature=Sf;function $w(t,e){if(!Qe(t)||!Qe(e))throw new Error("Integers expected in function rightLogShift");return t>>>e}$w.signature=Sf;function Wa(t,e){if(e<t)return 1;if(e===t)return e;var r=e+t>>1;return Wa(t,r)*Wa(r+1,e)}function Ow(t,e){if(!Qe(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(!Qe(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>t)throw new TypeError("k must be less than or equal to n");for(var r=t-e,n=1,i=e<r?r+1:e+1,a=2,o=e<r?e:r,s=i;s<=t;++s)for(n*=s;a<=o&&n%a===0;)n/=a,++a;return a<=o&&(n/=Wa(a,o)),n}Ow.signature="number, number";var ZP=Math.PI,JP=2*Math.PI,XP=Math.E,QP=1.618033988749895;var XJ="number",Rw="number, number";function Lw(t){return!t}Lw.signature=XJ;function Jg(t,e){return!!(t||e)}Jg.signature=Rw;function Xg(t,e){return!!t!=!!e}Xg.signature=Rw;function Qg(t,e){return!!(t&&e)}Qg.signature=Rw;function rm(t){var e;if(Qe(t))return t<=0?isFinite(t)?1/0:NaN:t>171?1/0:Wa(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*rm(1-t));if(t>=171.35)return 1/0;if(t>85){var r=t*t,n=r*t,i=n*t,a=i*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*t))}--t,e=jl[0];for(var o=1;o<jl.length;++o)e+=jl[o]/(t+o);var s=t+Vw+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,t+.5)*Math.exp(-s)*e}rm.signature="number";var Vw=4.7421875,jl=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Uw=.9189385332046728,QJ=5,KJ=7,KP=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function nm(t){if(t<0)return NaN;if(t===0)return 1/0;if(!isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-nm(1-t);t=t-1;for(var e=t+QJ+.5,r=KP[0],n=KJ-1;n>=1;n--)r+=KP[n]/(t+n);return Uw+(t+.5)*Math.log(e)-e+Math.log(r)}nm.signature="number";var _n="number",eX="number, number";function tX(t){return Math.acos(t)}tX.signature=_n;function qw(t){return fP(t)}qw.signature=_n;function zw(t){return Math.atan(1/t)}zw.signature=_n;function Hw(t){return isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}Hw.signature=_n;function Gw(t){return Math.asin(1/t)}Gw.signature=_n;function Ww(t){var e=1/t;return Math.log(e+Math.sqrt(e*e+1))}Ww.signature=_n;function Yw(t){return Math.acos(1/t)}Yw.signature=_n;function jw(t){var e=1/t,r=Math.sqrt(e*e-1);return Math.log(r+e)}jw.signature=_n;function rX(t){return Math.asin(t)}rX.signature=_n;function Zw(t){return pP(t)}Zw.signature=_n;function nX(t){return Math.atan(t)}nX.signature=_n;function iX(t,e){return Math.atan2(t,e)}iX.signature=eX;function Jw(t){return mP(t)}Jw.signature=_n;function aX(t){return Math.cos(t)}aX.signature=_n;function oX(t){return Ig(t)}oX.signature=_n;function Xw(t){return 1/Math.tan(t)}Xw.signature=_n;function Qw(t){var e=Math.exp(2*t);return(e+1)/(e-1)}Qw.signature=_n;function Kw(t){return 1/Math.sin(t)}Kw.signature=_n;function e_(t){return t===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*vo(t)}e_.signature=_n;function t_(t){return 1/Math.cos(t)}t_.signature=_n;function r_(t){return 2/(Math.exp(t)+Math.exp(-t))}r_.signature=_n;function sX(t){return Math.sin(t)}sX.signature=_n;function n_(t){return dP(t)}n_.signature=_n;function uX(t){return Math.tan(t)}uX.signature=_n;function lX(t){return Pg(t)}lX.signature=_n;var im="number";function cX(t){return Qe(t)}cX.signature=im;function i_(t){return t<0}i_.signature=im;function a_(t){return t>0}a_.signature=im;function fX(t){return t===0}fX.signature=im;function o_(t){return Number.isNaN(t)}o_.signature=im;function mn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e-9,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return t.isNaN()||e.isNaN()?!1:!t.isFinite()||!e.isFinite()?t.eq(e):t.eq(e)?!0:t.minus(e).abs().lte(t.constructor.max(t.constructor.max(t.abs(),e.abs()).mul(r),n))}var eB="isNegative",pX=["typed","config"],s_=M(eB,pX,t=>{var{typed:e,config:r}=t;return e(eB,{number:n=>Kr(n,0,r.relTol,r.absTol)?!1:i_(n),BigNumber:n=>mn(n,new n.constructor(0),r.relTol,r.absTol)?!1:n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n<0n,Fraction:n=>n.s<0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var tB="isNumeric",mX=["typed"],u_=M(tB,mX,t=>{var{typed:e}=t;return e(tB,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var rB="hasNumericValue",dX=["typed","isNumeric"],l_=M(rB,dX,t=>{var{typed:e,isNumeric:r}=t;return e(rB,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return r(i)}})});var nB="isPositive",hX=["typed","config"],c_=M(nB,hX,t=>{var{typed:e,config:r}=t;return e(nB,{number:n=>Kr(n,0,r.relTol,r.absTol)?!1:a_(n),BigNumber:n=>mn(n,new n.constructor(0),r.relTol,r.absTol)?!1:!n.isNeg()&&!n.isZero()&&!n.isNaN(),bigint:n=>n>0n,Fraction:n=>n.s>0n&&n.n>0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var iB="isZero",gX=["typed","equalScalar"],f_=M(iB,gX,t=>{var{typed:e,equalScalar:r}=t;return e(iB,{"number | BigNumber | Complex | Fraction":n=>r(n,0),bigint:n=>n===0n,Unit:e.referToSelf(n=>i=>e.find(n,i.valueType())(i.value)),"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var aB="isNaN",vX=["typed"],p_=M(aB,vX,t=>{var{typed:e}=t;return e(aB,{number:o_,BigNumber:function(n){return n.isNaN()},bigint:function(n){return!1},Fraction:function(n){return!1},Complex:function(n){return n.isNaN()},Unit:function(n){return Number.isNaN(n.value)},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var oB="typeOf",yX=["typed"],m_=M(oB,yX,t=>{var{typed:e}=t;return e(oB,{any:fr})});function sB(t,e,r,n){return Kr(t.re,e.re,r,n)&&Kr(t.im,e.im,r,n)}var _o=M("compareUnits",["typed"],t=>{var{typed:e}=t;return{"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(!n.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(r,[n.valueType(),i.valueType()])(n.value,i.value)})}});var Kg="equalScalar",xX=["typed","config"],d_=M(Kg,xX,t=>{var{typed:e,config:r}=t,n=_o({typed:e});return e(Kg,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Kr(a,o,r.relTol,r.absTol)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||mn(a,o,r.relTol,r.absTol)},"bigint, bigint":function(a,o){return a===o},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return sB(a,o,r.relTol,r.absTol)}},n)}),JCe=M(Kg,["typed","config"],t=>{var{typed:e,config:r}=t;return e(Kg,{"number, number":function(i,a){return Kr(i,a,r.relTol,r.absTol)}})});var bX="SparseMatrix",wX=["typed","equalScalar","Matrix"],h_=M(bX,wX,t=>{var{typed:e,equalScalar:r,Matrix:n}=t;function i(h,x){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(x&&!bn(x))throw new Error("Invalid datatype: "+x);if(rt(h))a(this,h,x);else if(h&&vr(h.index)&&vr(h.ptr)&&vr(h.size))this._values=h.values,this._index=h.index,this._ptr=h.ptr,this._size=h.size,this._datatype=x||h.datatype;else if(vr(h))o(this,h,x);else{if(h)throw new TypeError("Unsupported type of data ("+fr(h)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=x}}function a(h,x,b){x.type==="SparseMatrix"?(h._values=x._values?yt(x._values):void 0,h._index=yt(x._index),h._ptr=yt(x._ptr),h._size=yt(x._size),h._datatype=b||x._datatype):o(h,x.valueOf(),b||x._datatype)}function o(h,x,b){h._values=[],h._index=[],h._ptr=[],h._datatype=b;var T=x.length,v=0,A=r,w=0;if(bn(b)&&(A=e.find(r,[b,b])||r,w=e.convert(0,b)),T>0){var y=0;do{h._ptr.push(h._index.length);for(var E=0;E<T;E++){var D=x[E];if(vr(D)){if(y===0&&v<D.length&&(v=D.length),y<D.length){var _=D[y];A(_,w)||(h._values.push(_),h._index.push(E))}}else y===0&&v<1&&(v=1),A(D,w)||(h._values.push(D),h._index.push(E))}y++}while(y<v)}h._ptr.push(h._index.length),h._size=[T,v]}i.prototype=new n,i.prototype.createSparseMatrix=function(h,x){return new i(h,x)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Yl(this._values,fr)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(h,x){return new i(h,x)},i.prototype.density=function(){var h=this._size[0],x=this._size[1];return h!==0&&x!==0?this._index.length/(h*x):0},i.prototype.subset=function(h,x,b){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return s(this,h);case 2:case 3:return l(this,h,x,b);default:throw new SyntaxError("Wrong number of arguments")}};function s(h,x){if(!$u(x))throw new TypeError("Invalid index");var b=x.isScalar();if(b)return h.get(x.min());var T=x.size();if(T.length!==h._size.length)throw new Ct(T.length,h._size.length);var v,A,w,y,E=x.min(),D=x.max();for(v=0,A=h._size.length;v<A;v++)Br(E[v],h._size[v]),Br(D[v],h._size[v]);var _=h._values,N=h._index,C=h._ptr,B=x.dimension(0),R=x.dimension(1),V=[],L=[];B.forEach(function(O,X){L[O]=X[0],V[O]=!0});var P=_?[]:void 0,k=[],W=[];return R.forEach(function(O){for(W.push(k.length),w=C[O],y=C[O+1];w<y;w++)v=N[w],V[v]===!0&&(k.push(L[v]),P&&P.push(_[w]))}),W.push(k.length),new i({values:P,index:k,ptr:W,size:T,datatype:h._datatype})}function l(h,x,b,T){if(!x||x.isIndex!==!0)throw new TypeError("Invalid index");var v=x.size(),A=x.isScalar(),w;if(rt(b)?(w=b.size(),b=b.toArray()):w=pt(b),A){if(w.length!==0)throw new TypeError("Scalar expected");h.set(x.min(),b,T)}else{if(v.length!==1&&v.length!==2)throw new Ct(v.length,h._size.length,"<");if(w.length<v.length){for(var y=0,E=0;v[y]===1&&w[y]===1;)y++;for(;v[y]===1;)E++,y++;b=Gg(b,v.length,E,w)}if(!ba(v,w))throw new Ct(v,w,">");if(v.length===1){var D=x.dimension(0);D.forEach(function(C,B){Br(C),h.set([C,0],b[B[0]],T)})}else{var _=x.dimension(0),N=x.dimension(1);_.forEach(function(C,B){Br(C),N.forEach(function(R,V){Br(R),h.set([C,R],b[B[0]][V[0]],T)})})}}return h}i.prototype.get=function(h){if(!vr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Ct(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var x=h[0],b=h[1];Br(x,this._size[0]),Br(b,this._size[1]);var T=u(x,this._ptr[b],this._ptr[b+1],this._index);return T<this._ptr[b+1]&&this._index[T]===x?this._values[T]:0},i.prototype.set=function(h,x,b){if(!vr(h))throw new TypeError("Array expected");if(h.length!==this._size.length)throw new Ct(h.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var T=h[0],v=h[1],A=this._size[0],w=this._size[1],y=r,E=0;bn(this._datatype)&&(y=e.find(r,[this._datatype,this._datatype])||r,E=e.convert(0,this._datatype)),(T>A-1||v>w-1)&&(m(this,Math.max(T+1,A),Math.max(v+1,w),b),A=this._size[0],w=this._size[1]),Br(T,A),Br(v,w);var D=u(T,this._ptr[v],this._ptr[v+1],this._index);return D<this._ptr[v+1]&&this._index[D]===T?y(x,E)?c(D,v,this._values,this._index,this._ptr):this._values[D]=x:y(x,E)||f(D,T,v,x,this._values,this._index,this._ptr),this};function u(h,x,b,T){if(b-x===0)return b;for(var v=x;v<b;v++)if(T[v]===h)return v;return x}function c(h,x,b,T,v){b.splice(h,1),T.splice(h,1);for(var A=x+1;A<v.length;A++)v[A]--}function f(h,x,b,T,v,A,w){v.splice(h,0,T),A.splice(h,0,x);for(var y=b+1;y<w.length;y++)w[y]++}i.prototype.resize=function(h,x,b){if(!Tn(h))throw new TypeError("Array or Matrix expected");var T=h.valueOf().map(A=>Array.isArray(A)&&A.length===1?A[0]:A);if(T.length!==2)throw new Error("Only two dimensions matrix are supported");T.forEach(function(A){if(!At(A)||!Qe(A)||A<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(T)+")")});var v=b?this.clone():this;return m(v,T[0],T[1],x)};function m(h,x,b,T){var v=T||0,A=r,w=0;bn(h._datatype)&&(A=e.find(r,[h._datatype,h._datatype])||r,w=e.convert(0,h._datatype),v=e.convert(v,h._datatype));var y=!A(v,w),E=h._size[0],D=h._size[1],_,N,C;if(b>D){for(N=D;N<b;N++)if(h._ptr[N]=h._values.length,y)for(_=0;_<E;_++)h._values.push(v),h._index.push(_);h._ptr[b]=h._values.length}else b<D&&(h._ptr.splice(b+1,D-b),h._values.splice(h._ptr[b],h._values.length),h._index.splice(h._ptr[b],h._index.length));if(D=b,x>E){if(y){var B=0;for(N=0;N<D;N++){h._ptr[N]=h._ptr[N]+B,C=h._ptr[N+1]+B;var R=0;for(_=E;_<x;_++,R++)h._values.splice(C+R,0,v),h._index.splice(C+R,0,_),B++}h._ptr[D]=h._values.length}}else if(x<E){var V=0;for(N=0;N<D;N++){h._ptr[N]=h._ptr[N]-V;var L=h._ptr[N],P=h._ptr[N+1]-V;for(C=L;C<P;C++)_=h._index[C],_>x-1&&(h._values.splice(C,1),h._index.splice(C,1),V++)}h._ptr[N]=h._values.length}return h._size[0]=x,h._size[1]=b,h}i.prototype.reshape=function(h,x){if(!vr(h))throw new TypeError("Array expected");if(h.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");h.forEach(function(O){if(!At(O)||!Qe(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Dt(h)+")")});var b=this._size[0]*this._size[1];h=Kp(h,b);var T=h[0]*h[1];if(b!==T)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var v=x?this.clone():this;if(this._size[0]===h[0]&&this._size[1]===h[1])return v;for(var A=[],w=0;w<v._ptr.length;w++)for(var y=0;y<v._ptr[w+1]-v._ptr[w];y++)A.push(w);for(var E=v._values.slice(),D=v._index.slice(),_=0;_<v._index.length;_++){var N=D[_],C=A[_],B=N*v._size[1]+C;A[_]=B%h[1],D[_]=Math.floor(B/h[1])}v._values.length=0,v._index.length=0,v._ptr.length=h[1]+1,v._size=h.slice();for(var R=0;R<v._ptr.length;R++)v._ptr[R]=0;for(var V=0;V<E.length;V++){var L=D[V],P=A[V],k=E[V],W=u(L,v._ptr[P],v._ptr[P+1],v._index);f(W,L,P,k,v._values,v._index,v._ptr)}return v},i.prototype.clone=function(){var h=new i({values:this._values?yt(this._values):void 0,index:yt(this._index),ptr:yt(this._ptr),size:yt(this._size),datatype:this._datatype});return h},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(h,x){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var b=this,T=this._size[0],v=this._size[1],A=bo(h,b,"map"),w=function(E,D,_){return A(E,[D,_],b)};return p(this,0,T-1,0,v-1,w,x)};function p(h,x,b,T,v,A,w){var y=[],E=[],D=[],_=r,N=0;bn(h._datatype)&&(_=e.find(r,[h._datatype,h._datatype])||r,N=e.convert(0,h._datatype));for(var C=function(U,de,we){var se=A(U,de,we);_(se,N)||(y.push(se),E.push(de))},B=T;B<=v;B++){D.push(y.length);var R=h._ptr[B],V=h._ptr[B+1];if(w)for(var L=R;L<V;L++){var P=h._index[L];P>=x&&P<=b&&C(h._values[L],P-x,B-T)}else{for(var k={},W=R;W<V;W++){var O=h._index[W];k[O]=h._values[W]}for(var X=x;X<=b;X++){var ae=X in k?k[X]:0;C(ae,X-x,B-T)}}}return D.push(y.length),new i({values:y,index:E,ptr:D,size:[b-x+1,v-T+1]})}i.prototype.forEach=function(h,x){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var b=this,T=this._size[0],v=this._size[1],A=bo(h,b,"forEach"),w=0;w<v;w++){var y=this._ptr[w],E=this._ptr[w+1];if(x)for(var D=y;D<E;D++){var _=this._index[D];A(this._values[D],[_,w],b)}else{for(var N={},C=y;C<E;C++){var B=this._index[C];N[B]=this._values[C]}for(var R=0;R<T;R++){var V=R in N?N[R]:0;A(V,[R,w],b)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var h=this._size[1],x=0;x<h;x++)for(var b=this._ptr[x],T=this._ptr[x+1],v=b;v<T;v++){var A=this._index[v];yield{value:this._values[v],index:[A,x]}}},i.prototype.toArray=function(){return d(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return d(this._values,this._index,this._ptr,this._size,!1)};function d(h,x,b,T,v){var A=T[0],w=T[1],y=[],E,D;for(E=0;E<A;E++)for(y[E]=[],D=0;D<w;D++)y[E][D]=0;for(D=0;D<w;D++)for(var _=b[D],N=b[D+1],C=_;C<N;C++)E=x[C],y[E][D]=h?v?yt(h[C]):h[C]:1;return y}return i.prototype.format=function(h){for(var x=this._size[0],b=this._size[1],T=this.density(),v="Sparse Matrix ["+Dt(x,h)+" x "+Dt(b,h)+"] density: "+Dt(T,h)+`
`,A=0;A<b;A++)for(var w=this._ptr[A],y=this._ptr[A+1],E=w;E<y;E++){var D=this._index[E];v+=`
    (`+Dt(D,h)+", "+Dt(A,h)+") ==> "+(this._values?Dt(this._values[E],h):"X")}return v},i.prototype.toString=function(){return Dt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(h){if(h){if(ft(h)&&(h=h.toNumber()),!At(h)||!Qe(h))throw new TypeError("The parameter k must be an integer number")}else h=0;var x=h>0?h:0,b=h<0?-h:0,T=this._size[0],v=this._size[1],A=Math.min(T-b,v-x),w=[],y=[],E=[];E[0]=0;for(var D=x;D<v&&w.length<A;D++)for(var _=this._ptr[D],N=this._ptr[D+1],C=_;C<N;C++){var B=this._index[C];if(B===D-x+b){w.push(this._values[C]),y[w.length-1]=B-b;break}}return E.push(w.length),new i({values:w,index:y,ptr:E,size:[A,1]})},i.fromJSON=function(h){return new i(h)},i.diagonal=function(h,x,b,T,v){if(!vr(h))throw new TypeError("Array expected, size parameter");if(h.length!==2)throw new Error("Only two dimensions matrix are supported");if(h=h.map(function(O){if(ft(O)&&(O=O.toNumber()),!At(O)||!Qe(O)||O<1)throw new Error("Size values must be positive integers");return O}),b){if(ft(b)&&(b=b.toNumber()),!At(b)||!Qe(b))throw new TypeError("The parameter k must be an integer number")}else b=0;var A=r,w=0;bn(v)&&(A=e.find(r,[v,v])||r,w=e.convert(0,v));var y=b>0?b:0,E=b<0?-b:0,D=h[0],_=h[1],N=Math.min(D-E,_-y),C;if(vr(x)){if(x.length!==N)throw new Error("Invalid value array length");C=function(X){return x[X]}}else if(rt(x)){var B=x.size();if(B.length!==1||B[0]!==N)throw new Error("Invalid matrix length");C=function(X){return x.get([X])}}else C=function(){return x};for(var R=[],V=[],L=[],P=0;P<_;P++){L.push(R.length);var k=P-y;if(k>=0&&k<N){var W=C(k);A(W,w)||(V.push(k+E),R.push(W))}}return L.push(R.length),new i({values:R,index:V,ptr:L,size:[D,_]})},i.prototype.swapRows=function(h,x){if(!At(h)||!Qe(h)||!At(x)||!Qe(x))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(h,this._size[0]),Br(x,this._size[0]),i._swapRows(h,x,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(h,x,b,T,v){for(var A=T[h],w=T[h+1],y=A;y<w;y++)v(b[y],x[y])},i._swapRows=function(h,x,b,T,v,A){for(var w=0;w<b;w++){var y=A[w],E=A[w+1],D=u(h,y,E,v),_=u(x,y,E,v);if(D<E&&_<E&&v[D]===h&&v[_]===x){if(T){var N=T[D];T[D]=T[_],T[_]=N}continue}if(D<E&&v[D]===h&&(_>=E||v[_]!==x)){var C=T?T[D]:void 0;v.splice(_,0,x),T&&T.splice(_,0,C),v.splice(_<=D?D+1:D,1),T&&T.splice(_<=D?D+1:D,1);continue}if(_<E&&v[_]===x&&(D>=E||v[D]!==h)){var B=T?T[_]:void 0;v.splice(D,0,h),T&&T.splice(D,0,B),v.splice(D<=_?_+1:_,1),T&&T.splice(D<=_?_+1:_,1)}}},i},{isClass:!0});var _X="number",AX=["typed"];function SX(t){var e=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var r={"0b":2,"0o":8,"0x":16}[e[1]],n=e[2],i=e[3];return{input:t,radix:r,integerPart:n,fractionalPart:i}}else return null}function EX(t){for(var e=parseInt(t.integerPart,t.radix),r=0,n=0;n<t.fractionalPart.length;n++){var i=parseInt(t.fractionalPart[n],t.radix);r+=i/Math.pow(t.radix,n+1)}var a=e+r;if(isNaN(a))throw new SyntaxError('String "'+t.input+'" is not a valid number');return a}var g_=M(_X,AX,t=>{var{typed:e}=t,r=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=SX(i);if(a)return EX(a);var o=0,s=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),i=s[1]);var l=Number(i);if(isNaN(l))throw new SyntaxError('String "'+i+'" is not a valid number');if(s){if(l>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));l>=2**(o-1)&&(l=l-2**o)}return l},BigNumber:function(i){return i.toNumber()},bigint:function(i){return Number(i)},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))});return r.fromJSON=function(n){return parseFloat(n.value)},r});var TX="bigint",DX=["typed"],v_=M(TX,DX,t=>{var{typed:e}=t,r=e("bigint",{"":function(){return 0n},bigint:function(i){return i},number:function(i){return BigInt(i.toFixed())},BigNumber:function(i){return BigInt(i.round().toString())},Fraction:function(i){return BigInt(i.valueOf().toFixed())},"string | boolean":function(i){return BigInt(i)},null:function(i){return 0n},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))});return r.fromJSON=function(n){return BigInt(n.value)},r});var uB="string",MX=["typed"],y_=M(uB,MX,t=>{var{typed:e}=t;return e(uB,{"":function(){return""},number:qo,null:function(n){return"null"},boolean:function(n){return n+""},string:function(n){return n},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r)),any:function(n){return String(n)}})});var lB="boolean",CX=["typed"],x_=M(lB,CX,t=>{var{typed:e}=t;return e(lB,{"":function(){return!1},boolean:function(n){return n},number:function(n){return!!n},null:function(n){return!1},BigNumber:function(n){return!n.isZero()},string:function(n){var i=n.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(n);if(n!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+n+'" to a boolean')},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var NX="bignumber",FX=["typed","BigNumber"],b_=M(NX,FX,t=>{var{typed:e,BigNumber:r}=t;return e("bignumber",{"":function(){return new r(0)},number:function(i){return new r(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],s=r(a[1]),l=new r(2).pow(Number(o));if(s.gt(l.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var u=new r(2).pow(Number(o)-1);return s.gte(u)?s.sub(l):s}return new r(i)},BigNumber:function(i){return i},bigint:function(i){return new r(i.toString())},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Fraction:function(i){return new r(String(i.n)).div(String(i.d)).times(String(i.s))},null:function(i){return new r(0)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var IX="complex",PX=["typed","Complex"],w_=M(IX,PX,t=>{var{typed:e,Complex:r}=t;return e("complex",{"":function(){return r.ZERO},number:function(i){return new r(i,0)},"number, number":function(i,a){return new r(i,a)},"BigNumber, BigNumber":function(i,a){return new r(i.toNumber(),a.toNumber())},Fraction:function(i){return new r(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return r(i)},null:function(i){return r(0)},Object:function(i){if("re"in i&&"im"in i)return new r(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new r(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var BX="fraction",kX=["typed","Fraction"],__=M(BX,kX,t=>{var{typed:e,Fraction:r}=t;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new r(i)},string:function(i){return new r(i)},"number, number":function(i,a){return new r(i,a)},"bigint, bigint":function(i,a){return new r(i,a)},null:function(i){return new r(0)},BigNumber:function(i){return new r(i.toString())},bigint:function(i){return new r(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(n=>i=>{var a=i.clone();return a.value=n(i.value),a}),Object:function(i){return new r(i)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var cB="matrix",$X=["typed","Matrix","DenseMatrix","SparseMatrix"],A_=M(cB,$X,t=>{var{typed:e,Matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(cB,{"":function(){return a([])},string:function(s){return a([],s)},"string, string":function(s,l){return a([],s,l)},Array:function(s){return a(s)},Matrix:function(s){return a(s,s.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,s,l){if(s==="dense"||s==="default"||s===void 0)return new n(o,l);if(s==="sparse")return new i(o,l);throw new TypeError("Unknown matrix type "+JSON.stringify(s)+".")}});var fB="matrixFromFunction",OX=["typed","matrix","isZero"],S_=M(fB,OX,t=>{var{typed:e,matrix:r,isZero:n}=t;return e(fB,{"Array | Matrix, function, string, string":function(o,s,l,u){return i(o,s,l,u)},"Array | Matrix, function, string":function(o,s,l){return i(o,s,l)},"Matrix, function":function(o,s){return i(o,s,"dense")},"Array, function":function(o,s){return i(o,s,"dense").toArray()},"Array | Matrix, string, function":function(o,s,l){return i(o,l,s)},"Array | Matrix, string, string, function":function(o,s,l,u){return i(o,u,s,l)}});function i(a,o,s,l){var u;return l!==void 0?u=r(s,l):u=r(s),u.resize(a),u.forEach(function(c,f){var m=o(f);n(m)||u.set(f,m)}),u}});var pB="matrixFromRows",RX=["typed","matrix","flatten","size"],E_=M(pB,RX,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(pB,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var l=o(s[0]),u=[];for(var c of s){var f=o(c);if(f!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(f|0));u.push(n(c))}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[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 mB="matrixFromColumns",LX=["typed","matrix","flatten","size"],T_=M(mB,LX,t=>{var{typed:e,matrix:r,flatten:n,size:i}=t;return e(mB,{"...Array":function(l){return a(l)},"...Matrix":function(l){return r(a(l.map(u=>u.toArray())))}});function a(s){if(s.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var l=o(s[0]),u=[],c=0;c<l;c++)u[c]=[];for(var f of s){var m=o(f);if(m!==l)throw new TypeError("The vectors had different length: "+(l|0)+" \u2260 "+(m|0));for(var p=n(f),d=0;d<l;d++)u[d].push(p[d])}return u}function o(s){var l=i(s);if(l.length===1)return l[0];if(l.length===2){if(l[0]===1)return l[1];if(l[1]===1)return l[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 dB="splitUnit",VX=["typed"],D_=M(dB,VX,t=>{var{typed:e}=t;return e(dB,{"Unit, Array":function(n,i){return n.splitUnit(i)}})});var hB="unaryMinus",UX=["typed"],M_=M(hB,UX,t=>{var{typed:e}=t;return e(hB,{number:yw,"Complex | BigNumber | Fraction":r=>r.neg(),bigint:r=>-r,Unit:e.referToSelf(r=>n=>{var i=n.clone();return i.value=e.find(r,i.valueType())(n.value),i}),"Array | Matrix":e.referToSelf(r=>n=>nt(n,r,!0))})});var gB="unaryPlus",qX=["typed","config","numeric"],C_=M(gB,qX,t=>{var{typed:e,config:r,numeric:n}=t;return e(gB,{number:xw,Complex:function(a){return a},BigNumber:function(a){return a},bigint:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>nt(a,i,!0)),boolean:function(a){return n(a?1:0,r.number)},string:function(a){return n(a,Bi(a,r))}})});var vB="abs",zX=["typed"],N_=M(vB,zX,t=>{var{typed:e}=t;return e(vB,{number:dw,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),bigint:r=>r<0n?-r:r,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r,!0))})});var yB="apply",HX=["typed","isInteger"],Zl=M(yB,HX,t=>{var{typed:e,isInteger:r}=t;return e(yB,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!r(a))throw new TypeError("Integer number expected for dimension");var s=Array.isArray(i)?pt(i):i.size();if(a<0||a>=s.length)throw new Si(a,s.length);return rt(i)?i.create(ev(i.valueOf(),a,o),i.datatype()):ev(i,a,o)}})});function ev(t,e,r){var n,i,a;if(e<=0)if(Array.isArray(t[0])){for(a=GX(t),i=[],n=0;n<a.length;n++)i[n]=ev(a[n],e-1,r);return i}else return r(t);else{for(i=[],n=0;n<t.length;n++)i[n]=ev(t[n],e-1,r);return i}}function GX(t){var e=t.length,r=t[0].length,n,i,a=[];for(i=0;i<r;i++){var o=[];for(n=0;n<e;n++)o.push(t[n][i]);a.push(o)}return a}var xB="addScalar",WX=["typed"],F_=M(xB,WX,t=>{var{typed:e}=t;return e(xB,{"number, number":hw,"Complex, Complex":function(n,i){return n.add(i)},"BigNumber, BigNumber":function(n,i){return n.plus(i)},"bigint, bigint":function(n,i){return n+i},"Fraction, Fraction":function(n,i){return n.add(i)},"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var bB="subtractScalar",YX=["typed"],I_=M(bB,YX,t=>{var{typed:e}=t;return e(bB,{"number, number":gw,"Complex, Complex":function(n,i){return n.sub(i)},"BigNumber, BigNumber":function(n,i){return n.minus(i)},"bigint, bigint":function(n,i){return n-i},"Fraction, Fraction":function(n,i){return n.sub(i)},"Unit, Unit":e.referToSelf(r=>(n,i)=>{if(n.value===null||n.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(i))throw new Error("Units do not match");var a=n.clone();return a.value=e.find(r,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var wB="cbrt",jX=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],P_=M(wB,jX,t=>{var{config:e,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:l}=t;return r(wB,{number:_f,Complex:u,"Complex, boolean":u,BigNumber:function(m){return m.cbrt()},Unit:c});function u(f,m){var p=f.arg()/3,d=f.abs(),h=new o(_f(d),0).mul(new o(0,p).exp());if(m){var x=[h,new o(_f(d),0).mul(new o(0,p+Math.PI*2/3).exp()),new o(_f(d),0).mul(new o(0,p-Math.PI*2/3).exp())];return e.matrix==="Array"?x:a(x)}else return h}function c(f){if(f.value&&ra(f.value)){var m=f.clone();return m.value=1,m=m.pow(1/3),m.value=u(f.value),m}else{var p=n(f.value);p&&(f.value=i(f.value));var d;ft(f.value)?d=new s(1).div(3):Js(f.value)?d=new l(1,3):d=1/3;var h=f.pow(d);return p&&(h.value=i(h.value)),h}}});var ZX="matAlgo11xS0s",JX=["typed","equalScalar"],Pr=M(ZX,JX,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,x=r,b=0,T=o;typeof m=="string"&&(h=m,x=e.find(r,[h,h]),b=e.convert(0,h),a=e.convert(a,h),T=e.find(o,[h,h]));for(var v=[],A=[],w=[],y=0;y<d;y++){w[y]=A.length;for(var E=c[y],D=c[y+1],_=E;_<D;_++){var N=u[_],C=s?T(a,l[_]):T(l[_],a);x(C,b)||(A.push(N),v.push(C))}}return w[d]=A.length,i.createSparseMatrix({values:v,index:A,ptr:w,size:[p,d],datatype:h})}});var XX="matAlgo12xSfs",QX=["typed","DenseMatrix"],wr=M(XX,QX,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,x=o;typeof m=="string"&&(h=m,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],A=0;A<d;A++){for(var w=A+1,y=c[A],E=c[A+1],D=y;D<E;D++){var _=u[D];T[_]=l[D],v[_]=w}for(var N=0;N<p;N++)A===0&&(b[N]=[]),v[N]===w?b[N][A]=s?x(a,T[N]):x(T[N],a):b[N][A]=s?x(a,0):x(0,a)}return new r({data:b,size:[p,d],datatype:h})}});var KX="matAlgo14xDs",eQ=["typed"],Fn=M(KX,eQ,t=>{var{typed:e}=t;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype,f,m=o;typeof c=="string"&&(f=c,a=e.convert(a,f),m=e.find(o,[f,f]));var p=u.length>0?r(m,0,u,u[0],l,a,s):[];return i.createDenseMatrix({data:p,size:yt(u),datatype:f})};function r(n,i,a,o,s,l,u){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=u?n(l,s[f]):n(s[f],l);else for(var m=0;m<o;m++)c[m]=r(n,i+1,a,a[i+1],s[m],l,u);return c}});var B_="ceil",tQ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],rQ=M(B_,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(B_,{number:function(a){return Kr(a,n(a),r.relTol,r.absTol)?n(a):Math.ceil(a)},"number, number":function(a,o){if(Kr(a,n(a,o),r.relTol,r.absTol))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.ceil(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),k_=M(B_,tQ,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Pr({typed:e,equalScalar:a}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e}),f=rQ({typed:e,config:r,round:n});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.ceil()},"Complex, number":function(p,d){return p.ceil(d)},"Complex, BigNumber":function(p,d){return p.ceil(d.toNumber())},BigNumber:function(p){return mn(p,n(p),r.relTol,r.absTol)?n(p):p.ceil()},"BigNumber, BigNumber":function(p,d){return mn(p,n(p,d),r.relTol,r.absTol)?n(p,d):p.toDecimalPlaces(d.toNumber(),ql.ROUND_CEIL)},Fraction:function(p){return p.ceil()},"Fraction, number":function(p,d){return p.ceil(d)},"Fraction, BigNumber":function(p,d){return p.ceil(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(p,h=>m(h,d),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>l(p,d,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>c(p,d,m,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(i(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>a(p,0)?o(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var _B="cube",nQ=["typed"],$_=M(_B,nQ,t=>{var{typed:e}=t;return e(_B,{number:bw,Complex:function(n){return n.mul(n).mul(n)},BigNumber:function(n){return n.times(n).times(n)},bigint:function(n){return n*n*n},Fraction:function(n){return n.pow(3)},Unit:function(n){return n.pow(3)}})});var AB="exp",iQ=["typed"],O_=M(AB,iQ,t=>{var{typed:e}=t;return e(AB,{number:ww,Complex:function(n){return n.exp()},BigNumber:function(n){return n.exp()}})});var SB="expm1",aQ=["typed","Complex"],R_=M(SB,aQ,t=>{var{typed:e,Complex:r}=t;return e(SB,{number:_w,Complex:function(i){var a=Math.exp(i.re);return new r(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var L_="fix",oQ=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],sQ=M(L_,["typed","ceil","floor"],t=>{var{typed:e,ceil:r,floor:n}=t;return e(L_,{number:function(a){return a>0?n(a):r(a)},"number, number":function(a,o){return a>0?n(a,o):r(a,o)}})}),V_=M(L_,oQ,t=>{var{typed:e,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:l}=t,u=wr({typed:e,DenseMatrix:l}),c=Fn({typed:e}),f=sQ({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(p){return new r(p.re>0?Math.floor(p.re):Math.ceil(p.re),p.im>0?Math.floor(p.im):Math.ceil(p.im))},"Complex, number":function(p,d){return new r(p.re>0?a(p.re,d):i(p.re,d),p.im>0?a(p.im,d):i(p.im,d))},"Complex, BigNumber":function(p,d){var h=d.toNumber();return new r(p.re>0?a(p.re,h):i(p.re,h),p.im>0?a(p.im,h):i(p.im,h))},BigNumber:function(p){return p.isNegative()?i(p):a(p)},"BigNumber, number | BigNumber":function(p,d){return p.isNegative()?i(p,d):a(p,d)},Fraction:function(p){return p.s<0n?p.ceil():p.floor()},"Fraction, number | BigNumber":function(p,d){return p.s<0n?i(p,d):a(p,d)},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(p,h=>m(h,d),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(n(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>o(p,0)?s(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var U_="floor",uQ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],lQ=M(U_,["typed","config","round"],t=>{var{typed:e,config:r,round:n}=t;return e(U_,{number:function(a){return Kr(a,n(a),r.relTol,r.absTol)?n(a):Math.floor(a)},"number, number":function(a,o){if(Kr(a,n(a,o),r.relTol,r.absTol))return n(a,o);var[s,l]="".concat(a,"e").split("e"),u=Math.floor(Number("".concat(s,"e").concat(Number(l)+o)));return[s,l]="".concat(u,"e").split("e"),Number("".concat(s,"e").concat(Number(l)-o))}})}),am=M(U_,uQ,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=t,l=Pr({typed:e,equalScalar:a}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e}),f=lQ({typed:e,config:r,round:n});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(p){return p.floor()},"Complex, number":function(p,d){return p.floor(d)},"Complex, BigNumber":function(p,d){return p.floor(d.toNumber())},BigNumber:function(p){return mn(p,n(p),r.relTol,r.absTol)?n(p):p.floor()},"BigNumber, BigNumber":function(p,d){return mn(p,n(p,d),r.relTol,r.absTol)?n(p,d):p.toDecimalPlaces(d.toNumber(),ql.ROUND_FLOOR)},Fraction:function(p){return p.floor()},"Fraction, number":function(p,d){return p.floor(d)},"Fraction, BigNumber":function(p,d){return p.floor(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>nt(p,h=>m(h,d),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>l(p,d,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>c(p,d,m,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(m=>(p,d)=>c(i(d),p,m,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(m=>(p,d)=>a(p,0)?o(d.size(),d.storage()):d.storage()==="dense"?c(d,p,m,!0):u(d,p,m,!0))})});var cQ="matAlgo02xDS0",fQ=["typed","equalScalar"],In=M(cQ,fQ,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o,s){var l=i._data,u=i._size,c=i._datatype||i.getDataType(),f=a._values,m=a._index,p=a._ptr,d=a._size,h=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(u.length!==d.length)throw new Ct(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x=u[0],b=u[1],T,v=r,A=0,w=o;typeof c=="string"&&c===h&&c!=="mixed"&&(T=c,v=e.find(r,[T,T]),A=e.convert(0,T),w=e.find(o,[T,T]));for(var y=[],E=[],D=[],_=0;_<b;_++){D[_]=E.length;for(var N=p[_],C=p[_+1],B=N;B<C;B++){var R=m[B],V=s?w(f[B],l[R][_]):w(l[R][_],f[B]);v(V,A)||(E.push(R),y.push(V))}}return D[b]=E.length,a.createSparseMatrix({values:y,index:E,ptr:D,size:[x,b],datatype:c===i._datatype&&h===a._datatype?T:void 0})}});var pQ="matAlgo03xDSf",mQ=["typed"],jr=M(pQ,mQ,t=>{var{typed:e}=t;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,m=i._ptr,p=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new Ct(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=l[0],x=l[1],b,T=0,v=a;typeof u=="string"&&u===d&&u!=="mixed"&&(b=u,T=e.convert(0,b),v=e.find(a,[b,b]));for(var A=[],w=0;w<h;w++)A[w]=[];for(var y=[],E=[],D=0;D<x;D++){for(var _=D+1,N=m[D],C=m[D+1],B=N;B<C;B++){var R=f[B];y[R]=o?v(c[B],s[R][D]):v(s[R][D],c[B]),E[R]=_}for(var V=0;V<h;V++)E[V]===_?A[V][D]=y[V]:A[V][D]=o?v(T,s[V][D]):v(s[V][D],T)}return n.createDenseMatrix({data:A,size:[h,x],datatype:u===n._datatype&&d===i._datatype?b:void 0})}});var dQ="matAlgo05xSfSf",hQ=["typed","equalScalar"],Hu=M(dQ,hQ,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],N=E?[]:void 0,C=E?[]:void 0,B=[],R=[],V,L,P,k;for(L=0;L<T;L++){_[L]=D.length;var W=L+1;for(P=u[L],k=u[L+1];P<k;P++)V=l[P],D.push(V),B[V]=W,N&&(N[V]=s[P]);for(P=d[L],k=d[L+1];P<k;P++)V=p[P],B[V]!==W&&D.push(V),R[V]=W,C&&(C[V]=m[P]);if(E)for(P=_[L];P<D.length;){V=D[P];var O=B[V],X=R[V];if(O===W||X===W){var ae=O===W?N[V]:w,J=X===W?C[V]:w,U=y(ae,J);A(U,w)?D.splice(P,1):(E.push(U),P++)}}}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var gQ="matAlgo13xDD",vQ=["typed"],EB=M(gQ,vQ,t=>{var{typed:e}=t;return function(i,a,o){var s=i._data,l=i._size,u=i._datatype,c=a._data,f=a._size,m=a._datatype,p=[];if(l.length!==f.length)throw new Ct(l.length,f.length);for(var d=0;d<l.length;d++){if(l[d]!==f[d])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");p[d]=l[d]}var h,x=o;typeof u=="string"&&u===m&&(h=u,x=e.find(o,[h,h]));var b=p.length>0?r(x,0,p,p[0],s,c):[];return i.createDenseMatrix({data:b,size:p,datatype:h})};function r(n,i,a,o,s,l){var u=[];if(i===a.length-1)for(var c=0;c<o;c++)u[c]=n(s[c],l[c]);else for(var f=0;f<o;f++)u[f]=r(n,i+1,a,a[i+1],s[f],l[f]);return u}});function ni(t,e){if(ba(t.size(),e.size()))return[t,e];var r=em(t.size(),e.size());return[t,e].map(n=>yQ(n,r))}function yQ(t,e){return ba(t.size(),e)?t:t.create(hs(t.valueOf(),e),t.datatype())}var xQ="matrixAlgorithmSuite",bQ=["typed","matrix"],Pt=M(xQ,bQ,t=>{var{typed:e,matrix:r}=t,n=EB({typed:e}),i=Fn({typed:e});return function(o){var s=o.elop,l=o.SD||o.DS,u;s?(u={"DenseMatrix, DenseMatrix":(p,d)=>n(...ni(p,d),s),"Array, Array":(p,d)=>n(...ni(r(p),r(d)),s).valueOf(),"Array, DenseMatrix":(p,d)=>n(...ni(r(p),d),s),"DenseMatrix, Array":(p,d)=>n(...ni(p,r(d)),s)},o.SS&&(u["SparseMatrix, SparseMatrix"]=(p,d)=>o.SS(...ni(p,d),s,!1)),o.DS&&(u["DenseMatrix, SparseMatrix"]=(p,d)=>o.DS(...ni(p,d),s,!1),u["Array, SparseMatrix"]=(p,d)=>o.DS(...ni(r(p),d),s,!1)),l&&(u["SparseMatrix, DenseMatrix"]=(p,d)=>l(...ni(d,p),s,!0),u["SparseMatrix, Array"]=(p,d)=>l(...ni(r(d),p),s,!0))):(u={"DenseMatrix, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...ni(d,h),p)),"Array, Array":e.referToSelf(p=>(d,h)=>n(...ni(r(d),r(h)),p).valueOf()),"Array, DenseMatrix":e.referToSelf(p=>(d,h)=>n(...ni(r(d),h),p)),"DenseMatrix, Array":e.referToSelf(p=>(d,h)=>n(...ni(d,r(h)),p))},o.SS&&(u["SparseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.SS(...ni(d,h),p,!1))),o.DS&&(u["DenseMatrix, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...ni(d,h),p,!1)),u["Array, SparseMatrix"]=e.referToSelf(p=>(d,h)=>o.DS(...ni(r(d),h),p,!1))),l&&(u["SparseMatrix, DenseMatrix"]=e.referToSelf(p=>(d,h)=>l(...ni(h,d),p,!0)),u["SparseMatrix, Array"]=e.referToSelf(p=>(d,h)=>l(...ni(r(h),d),p,!0))));var c=o.scalar||"any",f=o.Ds||o.Ss;f&&(s?(u["DenseMatrix,"+c]=(p,d)=>i(p,d,s,!1),u[c+", DenseMatrix"]=(p,d)=>i(d,p,s,!0),u["Array,"+c]=(p,d)=>i(r(p),d,s,!1).valueOf(),u[c+", Array"]=(p,d)=>i(r(d),p,s,!0).valueOf()):(u["DenseMatrix,"+c]=e.referToSelf(p=>(d,h)=>i(d,h,p,!1)),u[c+", DenseMatrix"]=e.referToSelf(p=>(d,h)=>i(h,d,p,!0)),u["Array,"+c]=e.referToSelf(p=>(d,h)=>i(r(d),h,p,!1).valueOf()),u[c+", Array"]=e.referToSelf(p=>(d,h)=>i(r(h),d,p,!0).valueOf())));var m=o.sS!==void 0?o.sS:o.Ss;return s?(o.Ss&&(u["SparseMatrix,"+c]=(p,d)=>o.Ss(p,d,s,!1)),m&&(u[c+", SparseMatrix"]=(p,d)=>m(d,p,s,!0))):(o.Ss&&(u["SparseMatrix,"+c]=e.referToSelf(p=>(d,h)=>o.Ss(d,h,p,!1))),m&&(u[c+", SparseMatrix"]=e.referToSelf(p=>(d,h)=>m(h,d,p,!0)))),s&&s.signatures&&Cg(u,s.signatures),u}});var TB="mod",wQ=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],om=M(TB,wQ,t=>{var{typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}=t,u=am({typed:e,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=In({typed:e,equalScalar:a}),f=jr({typed:e}),m=Hu({typed:e,equalScalar:a}),p=Pr({typed:e,equalScalar:a}),d=wr({typed:e,DenseMatrix:s}),h=Pt({typed:e,matrix:i,concat:l});return e(TB,{"number, number":x,"BigNumber, BigNumber":function(T,v){return v.isZero()?T:T.sub(v.mul(u(T.div(v))))},"bigint, bigint":function(T,v){if(v===0n)return T;if(T<0){var A=T%v;return A===0n?A:A+v}return T%v},"Fraction, Fraction":function(T,v){return v.equals(0)?T:T.sub(v.mul(u(T.div(v))))}},h({SS:m,DS:f,SD:c,Ss:p,sS:d}));function x(b,T){return T===0?b:b-T*u(b/T)}});var _Q="matAlgo01xDSid",AQ=["typed"],Ri=M(_Q,AQ,t=>{var{typed:e}=t;return function(n,i,a,o){var s=n._data,l=n._size,u=n._datatype||n.getDataType(),c=i._values,f=i._index,m=i._ptr,p=i._size,d=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(l.length!==p.length)throw new Ct(l.length,p.length);if(l[0]!==p[0]||l[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=l[0],x=l[1],b=typeof u=="string"&&u!=="mixed"&&u===d?u:void 0,T=b?e.find(a,[b,b]):a,v,A,w=[];for(v=0;v<h;v++)w[v]=[];var y=[],E=[];for(A=0;A<x;A++){for(var D=A+1,_=m[A],N=m[A+1],C=_;C<N;C++)v=f[C],y[v]=o?T(c[C],s[v][A]):T(s[v][A],c[C]),E[v]=D;for(v=0;v<h;v++)E[v]===D?w[v][A]=y[v]:w[v][A]=s[v][A]}return n.createDenseMatrix({data:w,size:[h,x],datatype:u===n._datatype&&d===i._datatype?b:void 0})}});var SQ="matAlgo04xSidSid",EQ=["typed","equalScalar"],Ef=M(SQ,EQ,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],N=s&&m?[]:void 0,C=s&&m?[]:void 0,B=[],R=[],V,L,P,k,W;for(L=0;L<T;L++){_[L]=D.length;var O=L+1;for(k=u[L],W=u[L+1],P=k;P<W;P++)V=l[P],D.push(V),B[V]=O,N&&(N[V]=s[P]);for(k=d[L],W=d[L+1],P=k;P<W;P++)if(V=p[P],B[V]===O){if(N){var X=y(N[V],m[P]);A(X,w)?B[V]=null:N[V]=X}}else D.push(V),R[V]=O,C&&(C[V]=m[P]);if(N&&C)for(P=_[L];P<D.length;)V=D[P],B[V]===O?(E[P]=N[V],P++):R[V]===O?(E[P]=C[V],P++):D.splice(P,1)}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var TQ="matAlgo10xSids",DQ=["typed","DenseMatrix"],Sa=M(TQ,DQ,t=>{var{typed:e,DenseMatrix:r}=t;return function(i,a,o,s){var l=i._values,u=i._index,c=i._ptr,f=i._size,m=i._datatype;if(!l)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p=f[0],d=f[1],h,x=o;typeof m=="string"&&(h=m,a=e.convert(a,h),x=e.find(o,[h,h]));for(var b=[],T=[],v=[],A=0;A<d;A++){for(var w=A+1,y=c[A],E=c[A+1],D=y;D<E;D++){var _=u[D];T[_]=l[D],v[_]=w}for(var N=0;N<p;N++)A===0&&(b[N]=[]),v[N]===w?b[N][A]=s?x(a,T[N]):x(T[N],a):b[N][A]=a}return new r({data:b,size:[p,d],datatype:h})}});function tu(t,e,r,n){if(!(this instanceof tu))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+r+(n!=null?"-"+n:"")+" expected)",this.stack=new Error().stack}tu.prototype=new Error;tu.prototype.constructor=Error;tu.prototype.name="ArgumentsError";tu.prototype.isArgumentsError=!0;var DB="gcd",MQ=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],q_="number | BigNumber | Fraction | Matrix | Array",CQ="".concat(q_,", ").concat(q_,", ...").concat(q_);function MB(t){return!t.some(e=>Array.isArray(e))}var z_=M(DB,MQ,t=>{var{typed:e,matrix:r,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l,concat:u}=t,c=om({typed:e,config:n,round:i,matrix:r,equalScalar:a,zeros:o,DenseMatrix:l,concat:u}),f=Ri({typed:e}),m=Ef({typed:e,equalScalar:a}),p=Sa({typed:e,DenseMatrix:l}),d=Pt({typed:e,matrix:r,concat:u});return e(DB,{"number, number":h,"BigNumber, BigNumber":x,"Fraction, Fraction":(b,T)=>b.gcd(T)},d({SS:m,DS:f,Ss:p}),{[CQ]:e.referToSelf(b=>(T,v,A)=>{for(var w=b(T,v),y=0;y<A.length;y++)w=b(w,A[y]);return w}),Array:e.referToSelf(b=>T=>{if(T.length===1&&Array.isArray(T[0])&&MB(T[0]))return b(...T[0]);if(MB(T))return b(...T);throw new tu("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(b=>T=>b(T.toArray()))});function h(b,T){if(!Qe(b)||!Qe(T))throw new Error("Parameters in function gcd must be integer numbers");for(var v;T!==0;)v=c(b,T),b=T,T=v;return b<0?-b:b}function x(b,T){if(!b.isInt()||!T.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var v=new s(0);!T.isZero();){var A=c(b,T);b=T,T=A}return b.lt(v)?b.neg():b}});var NQ="matAlgo06xS0S0",FQ=["typed","equalScalar"],Gu=M(NQ,FQ,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._size,u=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,m=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==f.length)throw new Ct(l.length,f.length);if(l[0]!==f[0]||l[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+f+")");var p=l[0],d=l[1],h,x=r,b=0,T=o;typeof u=="string"&&u===m&&u!=="mixed"&&(h=u,x=e.find(r,[h,h]),b=e.convert(0,h),T=e.find(o,[h,h]));for(var v=s&&c?[]:void 0,A=[],w=[],y=v?[]:void 0,E=[],D=[],_=0;_<d;_++){w[_]=A.length;var N=_+1;if(pw(i,_,E,y,D,N,A,T),pw(a,_,E,y,D,N,A,T),y)for(var C=w[_];C<A.length;){var B=A[C];if(D[B]===N){var R=y[B];x(R,b)?A.splice(C,1):(v.push(R),C++)}else A.splice(C,1)}else for(var V=w[_];V<A.length;){var L=A[V];D[L]!==N?A.splice(V,1):V++}}return w[d]=A.length,i.createSparseMatrix({values:v,index:A,ptr:w,size:[p,d],datatype:u===i._datatype&&m===a._datatype?h:void 0})}});var CB="lcm",IQ=["typed","matrix","equalScalar","concat"],H_=M(CB,IQ,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=In({typed:e,equalScalar:n}),o=Gu({typed:e,equalScalar:n}),s=Pr({typed:e,equalScalar:n}),l=Pt({typed:e,matrix:r,concat:i}),u="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(u,", ").concat(u,", ...").concat(u)]=e.referToSelf(m=>(p,d,h)=>{for(var x=m(p,d),b=0;b<h.length;b++)x=m(x,h[b]);return x}),e(CB,{"number, number":Aw,"BigNumber, BigNumber":f,"Fraction, Fraction":(m,p)=>m.lcm(p)},l({SS:o,DS:a,Ss:s}),c);function f(m,p){if(!m.isInt()||!p.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(m.isZero())return m;if(p.isZero())return p;for(var d=m.times(p);!p.isZero();){var h=p;p=m.mod(h),m=h}return d.div(m).abs()}});var NB="log10",PQ=["typed","config","Complex"],G_=M(NB,PQ,t=>{var{typed:e,config:r,Complex:n}=t;return e(NB,{number:function(a){return a>=0||r.predictable?Sw(a):new n(a,0).log().div(Math.LN10)},Complex:function(a){return new n(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||r.predictable?a.log():new n(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>nt(a,i))})});var FB="log2",BQ=["typed","config","Complex"],W_=M(FB,BQ,t=>{var{typed:e,config:r,Complex:n}=t;return e(FB,{number:function(o){return o>=0||r.predictable?Ew(o):i(new n(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||r.predictable?o.log(2):i(new n(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>nt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new n(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var kQ="multiplyScalar",$Q=["typed"],Y_=M(kQ,$Q,t=>{var{typed:e}=t;return e("multiplyScalar",{"number, number":vw,"Complex, Complex":function(n,i){return n.mul(i)},"BigNumber, BigNumber":function(n,i){return n.times(i)},"bigint, bigint":function(n,i){return n*i},"Fraction, Fraction":function(n,i){return n.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(r,n)=>n.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,n)=>r.multiply(n)})});var IB="multiply",OQ=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],j_=M(IB,OQ,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=t,s=Pr({typed:e,equalScalar:a}),l=Fn({typed:e});function u(w,y){switch(w.length){case 1:switch(y.length){case 1:if(w[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(w[0]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+w[0]+") must match Matrix rows ("+y[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+y.length+" dimensions)")}break;case 2:switch(y.length){case 1:if(w[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+w[1]+") must match Vector length ("+y[0]+")");break;case 2:if(w[1]!==y[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+w[1]+") must match Matrix B rows ("+y[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+y.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+w.length+" dimensions)")}}function c(w,y,E){if(E===0)throw new Error("Cannot multiply two empty vectors");return o(w,y)}function f(w,y){if(y.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return m(w,y)}function m(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),N=y._data,C=y._size,B=y._datatype||y.getDataType(),R=D[0],V=C[1],L,P=n,k=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&(L=_,P=e.find(n,[L,L]),k=e.find(i,[L,L]));for(var W=[],O=0;O<V;O++){for(var X=k(E[0],N[0][O]),ae=1;ae<R;ae++)X=P(X,k(E[ae],N[ae][O]));W[O]=X}return w.createDenseMatrix({data:W,size:[V],datatype:_===w._datatype&&B===y._datatype?L:void 0})}var p=e("_multiplyMatrixVector",{"DenseMatrix, any":h,"SparseMatrix, any":T}),d=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":x,"DenseMatrix, SparseMatrix":b,"SparseMatrix, DenseMatrix":v,"SparseMatrix, SparseMatrix":A});function h(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),N=y._data,C=y._datatype||y.getDataType(),B=D[0],R=D[1],V,L=n,P=i;_&&C&&_===C&&typeof _=="string"&&_!=="mixed"&&(V=_,L=e.find(n,[V,V]),P=e.find(i,[V,V]));for(var k=[],W=0;W<B;W++){for(var O=E[W],X=P(O[0],N[0]),ae=1;ae<R;ae++)X=L(X,P(O[ae],N[ae]));k[W]=X}return w.createDenseMatrix({data:k,size:[B],datatype:_===w._datatype&&C===y._datatype?V:void 0})}function x(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),N=y._data,C=y._size,B=y._datatype||y.getDataType(),R=D[0],V=D[1],L=C[1],P,k=n,W=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&_!=="mixed"&&(P=_,k=e.find(n,[P,P]),W=e.find(i,[P,P]));for(var O=[],X=0;X<R;X++){var ae=E[X];O[X]=[];for(var J=0;J<L;J++){for(var U=W(ae[0],N[0][J]),de=1;de<V;de++)U=k(U,W(ae[de],N[de][J]));O[X][J]=U}}return w.createDenseMatrix({data:O,size:[R,L],datatype:_===w._datatype&&B===y._datatype?P:void 0})}function b(w,y){var E=w._data,D=w._size,_=w._datatype||w.getDataType(),N=y._values,C=y._index,B=y._ptr,R=y._size,V=y._datatype||y._data===void 0?y._datatype:y.getDataType();if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var L=D[0],P=R[1],k,W=n,O=i,X=a,ae=0;_&&V&&_===V&&typeof _=="string"&&_!=="mixed"&&(k=_,W=e.find(n,[k,k]),O=e.find(i,[k,k]),X=e.find(a,[k,k]),ae=e.convert(0,k));for(var J=[],U=[],de=[],we=y.createSparseMatrix({values:J,index:U,ptr:de,size:[L,P],datatype:_===w._datatype&&V===y._datatype?k:void 0}),se=0;se<P;se++){de[se]=U.length;var be=B[se],K=B[se+1];if(K>be)for(var j=0,ne=0;ne<L;ne++){for(var pe=ne+1,fe=void 0,Ae=be;Ae<K;Ae++){var _e=C[Ae];j!==pe?(fe=O(E[ne][_e],N[Ae]),j=pe):fe=W(fe,O(E[ne][_e],N[Ae]))}j===pe&&!X(fe,ae)&&(U.push(ne),J.push(fe))}}return de[P]=U.length,we}function T(w,y){var E=w._values,D=w._index,_=w._ptr,N=w._datatype||w._data===void 0?w._datatype:w.getDataType();if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var C=y._data,B=y._datatype||y.getDataType(),R=w._size[0],V=y._size[0],L=[],P=[],k=[],W,O=n,X=i,ae=a,J=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(n,[W,W]),X=e.find(i,[W,W]),ae=e.find(a,[W,W]),J=e.convert(0,W));var U=[],de=[];k[0]=0;for(var we=0;we<V;we++){var se=C[we];if(!ae(se,J))for(var be=_[we],K=_[we+1],j=be;j<K;j++){var ne=D[j];de[ne]?U[ne]=O(U[ne],X(se,E[j])):(de[ne]=!0,P.push(ne),U[ne]=X(se,E[j]))}}for(var pe=P.length,fe=0;fe<pe;fe++){var Ae=P[fe];L[fe]=U[Ae]}return k[1]=P.length,w.createSparseMatrix({values:L,index:P,ptr:k,size:[R,1],datatype:N===w._datatype&&B===y._datatype?W:void 0})}function v(w,y){var E=w._values,D=w._index,_=w._ptr,N=w._datatype||w._data===void 0?w._datatype:w.getDataType();if(!E)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var C=y._data,B=y._datatype||y.getDataType(),R=w._size[0],V=y._size[0],L=y._size[1],P,k=n,W=i,O=a,X=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(P=N,k=e.find(n,[P,P]),W=e.find(i,[P,P]),O=e.find(a,[P,P]),X=e.convert(0,P));for(var ae=[],J=[],U=[],de=w.createSparseMatrix({values:ae,index:J,ptr:U,size:[R,L],datatype:N===w._datatype&&B===y._datatype?P:void 0}),we=[],se=[],be=0;be<L;be++){U[be]=J.length;for(var K=be+1,j=0;j<V;j++){var ne=C[j][be];if(!O(ne,X))for(var pe=_[j],fe=_[j+1],Ae=pe;Ae<fe;Ae++){var _e=D[Ae];se[_e]!==K?(se[_e]=K,J.push(_e),we[_e]=W(ne,E[Ae])):we[_e]=k(we[_e],W(ne,E[Ae]))}}for(var G=U[be],Z=J.length,ge=G;ge<Z;ge++){var xe=J[ge];ae[ge]=we[xe]}}return U[L]=J.length,de}function A(w,y){var E=w._values,D=w._index,_=w._ptr,N=w._datatype||w._data===void 0?w._datatype:w.getDataType(),C=y._values,B=y._index,R=y._ptr,V=y._datatype||y._data===void 0?y._datatype:y.getDataType(),L=w._size[0],P=y._size[1],k=E&&C,W,O=n,X=i;N&&V&&N===V&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(n,[W,W]),X=e.find(i,[W,W]));for(var ae=k?[]:void 0,J=[],U=[],de=w.createSparseMatrix({values:ae,index:J,ptr:U,size:[L,P],datatype:N===w._datatype&&V===y._datatype?W:void 0}),we=k?[]:void 0,se=[],be,K,j,ne,pe,fe,Ae,_e,G=0;G<P;G++){U[G]=J.length;var Z=G+1;for(pe=R[G],fe=R[G+1],ne=pe;ne<fe;ne++)if(_e=B[ne],k)for(K=_[_e],j=_[_e+1],be=K;be<j;be++)Ae=D[be],se[Ae]!==Z?(se[Ae]=Z,J.push(Ae),we[Ae]=X(C[ne],E[be])):we[Ae]=O(we[Ae],X(C[ne],E[be]));else for(K=_[_e],j=_[_e+1],be=K;be<j;be++)Ae=D[be],se[Ae]!==Z&&(se[Ae]=Z,J.push(Ae));if(k)for(var ge=U[G],xe=J.length,Ee=ge;Ee<xe;Ee++){var Be=J[Ee];ae[Ee]=we[Be]}}return U[P]=J.length,de}return e(IB,i,{"Array, Array":e.referTo("Matrix, Matrix",w=>(y,E)=>{u(pt(y),pt(E));var D=w(r(y),r(E));return rt(D)?D.valueOf():D}),"Matrix, Matrix":function(y,E){var D=y.size(),_=E.size();return u(D,_),D.length===1?_.length===1?c(y,E,D[0]):f(y,E):_.length===1?p(y,E):d(y,E)},"Matrix, Array":e.referTo("Matrix,Matrix",w=>(y,E)=>w(y,r(E))),"Array, Matrix":e.referToSelf(w=>(y,E)=>w(r(y,E.storage()),E)),"SparseMatrix, any":function(y,E){return s(y,E,i,!1)},"DenseMatrix, any":function(y,E){return l(y,E,i,!1)},"any, SparseMatrix":function(y,E){return s(E,y,i,!0)},"any, DenseMatrix":function(y,E){return l(E,y,i,!0)},"Array, any":function(y,E){return l(r(y),E,i,!1).valueOf()},"any, Array":function(y,E){return l(r(E),y,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(w=>(y,E,D)=>{for(var _=w(y,E),N=0;N<D.length;N++)_=w(_,D[N]);return _})})});var PB="nthRoot",RQ=["typed","matrix","equalScalar","BigNumber","concat"],Z_=M(PB,RQ,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,concat:a}=t,o=Ri({typed:e}),s=In({typed:e,equalScalar:n}),l=Gu({typed:e,equalScalar:n}),u=Pr({typed:e,equalScalar:n}),c=Pt({typed:e,matrix:r,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(PB,{number:Tw,"number, number":Tw,BigNumber:p=>m(p,new i(2)),"BigNumber, BigNumber":m,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",p=>d=>p(r(d),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",p=>d=>p(d,2)),SparseMatrix:e.referTo("SparseMatrix,number",p=>d=>p(d,2)),"SparseMatrix, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return l(d,h,p);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return o(d,h,p,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",p=>(d,h)=>p(r(d),h)),"number | BigNumber, SparseMatrix":e.referToSelf(p=>(d,h)=>{if(h.density()===1)return u(h,d,p,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:u,sS:!1}));function m(p,d){var h=i.precision,x=i.clone({precision:h+2}),b=new i(0),T=new x(1),v=d.isNegative();if(v&&(d=d.neg()),d.isZero())throw new Error("Root must be non-zero");if(p.isNegative()&&!d.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(p.isZero())return v?new x(1/0):0;if(!p.isFinite())return v?b:p;var A=p.abs().pow(T.div(d));return A=p.isNeg()?A.neg():A,new i((v?T.div(A):A).toPrecision(h))}});var BB="sign",LQ=["typed","BigNumber","Fraction","complex"],J_=M(BB,LQ,t=>{var{typed:e,BigNumber:r,complex:n,Fraction:i}=t;return e(BB,{number:Zg,Complex:function(o){return o.im===0?n(Zg(o.re)):o.sign()},BigNumber:function(o){return new r(o.cmp(0))},bigint:function(o){return o>0n?1n:o<0n?-1n:0n},Fraction:function(o){return new i(o.s)},"Array | Matrix":e.referToSelf(a=>o=>nt(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 VQ="sqrt",UQ=["config","typed","Complex"],X_=M(VQ,UQ,t=>{var{config:e,typed:r,Complex:n}=t;return r("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new n(a,0).sqrt()}});var kB="square",qQ=["typed"],Q_=M(kB,qQ,t=>{var{typed:e}=t;return e(kB,{number:Dw,Complex:function(n){return n.mul(n)},BigNumber:function(n){return n.times(n)},bigint:function(n){return n*n},Fraction:function(n){return n.mul(n)},Unit:function(n){return n.pow(2)}})});var $B="subtract",zQ=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],K_=M($B,zQ,t=>{var{typed:e,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=t,l=Ri({typed:e}),u=jr({typed:e}),c=Hu({typed:e,equalScalar:n}),f=Sa({typed:e,DenseMatrix:o}),m=wr({typed:e,DenseMatrix:o}),p=Pt({typed:e,matrix:r,concat:s});return e($B,{"any, any":i},p({elop:i,SS:c,DS:l,SD:u,Ss:m,sS:f}))});var OB="xgcd",HQ=["typed","config","matrix","BigNumber"],e1=M(OB,HQ,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(OB,{"number, number":function(s,l){var u=Mw(s,l);return r.matrix==="Array"?u:n(u)},"BigNumber, BigNumber":a});function a(o,s){var l,u,c,f=new i(0),m=new i(1),p=f,d=m,h=m,x=f;if(!o.isInt()||!s.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!s.isZero();)u=o.div(s).floor(),c=o.mod(s),l=p,p=d.minus(u.times(p)),d=l,l=h,h=x.minus(u.times(h)),x=l,o=s,s=c;var b;return o.lt(f)?b=[o.neg(),d.neg(),x.neg()]:b=[o,o.isZero()?0:d,x],r.matrix==="Array"?b:n(b)}});var RB="invmod",GQ=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],t1=M(RB,GQ,t=>{var{typed:e,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:l,isInteger:u}=t;return e(RB,{"number, number":c,"BigNumber, BigNumber":c});function c(f,m){if(!u(f)||!u(m))throw new Error("Parameters in function invmod must be integer numbers");if(f=s(f,m),a(m,0))throw new Error("Divisor must be non zero");var p=i(f,m);p=p.valueOf();var[d,h]=p;return a(d,n(1))?(h=s(h,m),o(h,n(0))&&(h=l(h,m)),h):NaN}});var WQ="matAlgo09xS0Sf",YQ=["typed","equalScalar"],tv=M(WQ,YQ,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");var b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));var E=s&&m?[]:void 0,D=[],_=[],N=E?[]:void 0,C=[],B,R,V,L,P;for(R=0;R<T;R++){_[R]=D.length;var k=R+1;if(N)for(L=d[R],P=d[R+1],V=L;V<P;V++)B=p[V],C[B]=k,N[B]=m[V];for(L=u[R],P=u[R+1],V=L;V<P;V++)if(B=l[V],N){var W=C[B]===k?N[B]:w,O=y(s[V],W);A(O,w)||(D.push(B),E.push(O))}else D.push(B)}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var LB="dotMultiply",jQ=["typed","matrix","equalScalar","multiplyScalar","concat"],r1=M(LB,jQ,t=>{var{typed:e,matrix:r,equalScalar:n,multiplyScalar:i,concat:a}=t,o=In({typed:e,equalScalar:n}),s=tv({typed:e,equalScalar:n}),l=Pr({typed:e,equalScalar:n}),u=Pt({typed:e,matrix:r,concat:a});return e(LB,u({elop:i,SS:s,DS:o,Ss:l}))});function VB(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero()||e.eq(-1)||t.eq(e))return t;if(e.isZero()||t.eq(-1))return e;if(!t.isFinite()||!e.isFinite()){if(!t.isFinite()&&!e.isFinite())return t.isNegative()===e.isNegative()?t:new r(0);if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e;if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t}return n1(t,e,function(n,i){return n&i})}function Tf(t){if(t.isFinite()&&!t.isInteger())throw new Error("Integer expected in function bitNot");var e=t.constructor,r=e.precision;e.config({precision:1e9});var n=t.plus(new e(1));return n.s=-n.s||null,e.config({precision:r}),n}function UB(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);var n=new r(-1);return t.isZero()||e.eq(n)||t.eq(e)?e:e.isZero()||t.eq(n)?t:!t.isFinite()||!e.isFinite()?!t.isFinite()&&!t.isNegative()&&e.isNegative()||t.isNegative()&&!e.isNegative()&&!e.isFinite()?n:t.isNegative()&&e.isNegative()?t.isFinite()?t:e:t.isFinite()?e:t:n1(t,e,function(i,a){return i|a})}function n1(t,e,r){var n=t.constructor,i,a,o=+(t.s<0),s=+(e.s<0);if(o){i=rv(Tf(t));for(var l=0;l<i.length;++l)i[l]^=1}else i=rv(t);if(s){a=rv(Tf(e));for(var u=0;u<a.length;++u)a[u]^=1}else a=rv(e);var c,f,m;i.length<=a.length?(c=i,f=a,m=o):(c=a,f=i,m=s);var p=c.length,d=f.length,h=r(o,s)^1,x=new n(h^1),b=new n(1),T=new n(2),v=n.precision;for(n.config({precision:1e9});p>0;)r(c[--p],f[--d])===h&&(x=x.plus(b)),b=b.times(T);for(;d>0;)r(m,f[--d])===h&&(x=x.plus(b)),b=b.times(T);return n.config({precision:v}),h===0&&(x.s=-x.s),x}function rv(t){for(var e=t.d,r=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;r.charAt(o)==="0";)o--;var s=t.e,l=r.slice(0,o+1||1),u=l.length;if(s>0)if(++s>u)for(s-=u;s--;)l+="0";else s<u&&(l=l.slice(0,s)+"."+l.slice(s));for(var c=[0],f=0;f<l.length;){for(var m=c.length;m--;)c[m]*=10;c[0]+=parseInt(l.charAt(f++));for(var p=0;p<c.length;++p)c[p]>1&&((c[p+1]===null||c[p+1]===void 0)&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function qB(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var r=t.constructor;if(t.isNaN()||e.isNaN())return new r(NaN);if(t.isZero())return e;if(e.isZero())return t;if(t.eq(e))return new r(0);var n=new r(-1);return t.eq(n)?Tf(e):e.eq(n)?Tf(t):!t.isFinite()||!e.isFinite()?!t.isFinite()&&!e.isFinite()?n:new r(t.isNegative()===e.isNegative()?1/0:-1/0):n1(t,e,function(i,a){return i^a})}function zB(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:!t.isFinite()&&!e.isFinite()?new r(NaN):e.lt(55)?t.times(Math.pow(2,e.toNumber())+""):t.times(new r(2).pow(e))}function HB(t,e){if(t.isFinite()&&!t.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var r=t.constructor;return t.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new r(NaN):t.isZero()||e.isZero()?t:e.isFinite()?e.lt(55)?t.div(Math.pow(2,e.toNumber())+"").floor():t.div(new r(2).pow(e)).floor():t.isNegative()?new r(-1):t.isFinite()?new r(0):new r(NaN)}var GB="bitAnd",ZQ=["typed","matrix","equalScalar","concat"],sm=M(GB,ZQ,t=>{var{typed:e,matrix:r,equalScalar:n,concat:i}=t,a=In({typed:e,equalScalar:n}),o=Gu({typed:e,equalScalar:n}),s=Pr({typed:e,equalScalar:n}),l=Pt({typed:e,matrix:r,concat:i});return e(GB,{"number, number":Nw,"BigNumber, BigNumber":VB,"bigint, bigint":(u,c)=>u&c},l({SS:o,DS:a,Ss:s}))});var WB="bitNot",JQ=["typed"],i1=M(WB,JQ,t=>{var{typed:e}=t;return e(WB,{number:Fw,BigNumber:Tf,bigint:r=>~r,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var YB="bitOr",XQ=["typed","matrix","equalScalar","DenseMatrix","concat"],um=M(YB,XQ,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=Ri({typed:e}),s=Ef({typed:e,equalScalar:n}),l=Sa({typed:e,DenseMatrix:i}),u=Pt({typed:e,matrix:r,concat:a});return e(YB,{"number, number":Iw,"BigNumber, BigNumber":UB,"bigint, bigint":(c,f)=>c|f},u({SS:s,DS:o,Ss:l}))});var QQ="matAlgo07xSSf",KQ=["typed","SparseMatrix"],Gn=M(QQ,KQ,t=>{var{typed:e,SparseMatrix:r}=t;return function(a,o,s){var l=a._size,u=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(l.length!==c.length)throw new Ct(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var m=l[0],p=l[1],d,h=0,x=s;typeof u=="string"&&u===f&&u!=="mixed"&&(d=u,h=e.convert(0,d),x=e.find(s,[d,d]));for(var b=[],T=[],v=new Array(p+1).fill(0),A=[],w=[],y=[],E=[],D=0;D<p;D++){var _=D+1,N=0;n(a,D,y,A,_),n(o,D,E,w,_);for(var C=0;C<m;C++){var B=y[C]===_?A[C]:h,R=E[C]===_?w[C]:h,V=x(B,R);V!==0&&V!==!1&&(T.push(C),b.push(V),N++)}v[D+1]=v[D]+N}return new r({values:b,index:T,ptr:v,size:[m,p],datatype:u===a._datatype&&f===o._datatype?d:void 0})};function n(i,a,o,s,l){for(var u=i._values,c=i._index,f=i._ptr,m=f[a],p=f[a+1];m<p;m++){var d=c[m];o[d]=l,s[d]=u[m]}}});var jB="bitXor",eK=["typed","matrix","DenseMatrix","concat","SparseMatrix"],a1=M(jB,eK,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=jr({typed:e}),s=Gn({typed:e,SparseMatrix:a}),l=wr({typed:e,DenseMatrix:n}),u=Pt({typed:e,matrix:r,concat:i});return e(jB,{"number, number":Pw,"BigNumber, BigNumber":qB,"bigint, bigint":(c,f)=>c^f},u({SS:s,DS:o,Ss:l}))});var ZB="arg",tK=["typed"],o1=M(ZB,tK,t=>{var{typed:e}=t;return e(ZB,{number:function(n){return Math.atan2(0,n)},BigNumber:function(n){return n.constructor.atan2(0,n)},Complex:function(n){return n.arg()},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var JB="conj",rK=["typed"],s1=M(JB,rK,t=>{var{typed:e}=t;return e(JB,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var XB="im",nK=["typed"],u1=M(XB,nK,t=>{var{typed:e}=t;return e(XB,{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var QB="re",iK=["typed"],l1=M(QB,iK,t=>{var{typed:e}=t;return e(QB,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var KB="not",aK=["typed"],c1=M(KB,aK,t=>{var{typed:e}=t;return e(KB,{"null | undefined":()=>!0,number:Lw,Complex:function(n){return n.re===0&&n.im===0},BigNumber:function(n){return n.isZero()||n.isNaN()},bigint:r=>!r,Unit:e.referToSelf(r=>n=>e.find(r,n.valueType())(n.value)),"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var ek="or",oK=["typed","matrix","equalScalar","DenseMatrix","concat"],lm=M(ek,oK,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=jr({typed:e}),s=Hu({typed:e,equalScalar:n}),l=wr({typed:e,DenseMatrix:i}),u=Pt({typed:e,matrix:r,concat:a});return e(ek,{"number, number":Jg,"Complex, Complex":function(f,m){return f.re!==0||f.im!==0||m.re!==0||m.im!==0},"BigNumber, BigNumber":function(f,m){return!f.isZero()&&!f.isNaN()||!m.isZero()&&!m.isNaN()},"bigint, bigint":Jg,"Unit, Unit":e.referToSelf(c=>(f,m)=>c(f.value||0,m.value||0))},u({SS:s,DS:o,Ss:l}))});var tk="xor",sK=["typed","matrix","DenseMatrix","concat","SparseMatrix"],f1=M(tk,sK,t=>{var{typed:e,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:a}=t,o=jr({typed:e}),s=Gn({typed:e,SparseMatrix:a}),l=wr({typed:e,DenseMatrix:n}),u=Pt({typed:e,matrix:r,concat:i});return e(tk,{"number, number":Xg,"Complex, Complex":function(f,m){return(f.re!==0||f.im!==0)!=(m.re!==0||m.im!==0)},"bigint, bigint":Xg,"BigNumber, BigNumber":function(f,m){return(!f.isZero()&&!f.isNaN())!=(!m.isZero()&&!m.isNaN())},"Unit, Unit":e.referToSelf(c=>(f,m)=>c(f.value||0,m.value||0))},u({SS:s,DS:o,Ss:l}))});var rk="concat",uK=["typed","matrix","isInteger"],cm=M(rk,uK,t=>{var{typed:e,matrix:r,isInteger:n}=t;return e(rk,{"...Array | Matrix | number | BigNumber":function(a){var o,s=a.length,l=-1,u,c=!1,f=[];for(o=0;o<s;o++){var m=a[o];if(rt(m)&&(c=!0),At(m)||ft(m)){if(o!==s-1)throw new Error("Dimension must be specified as last argument");if(u=l,l=m.valueOf(),!n(l))throw new TypeError("Integer number expected for dimension");if(l<0||o>0&&l>u)throw new Si(l,u+1)}else{var p=yt(m).valueOf(),d=pt(p);if(f[o]=p,u=l,l=d.length-1,o>0&&l!==u)throw new Ct(u+1,l+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var h=f.shift();f.length;)h=uw(h,f.shift(),l);return c?r(h):h},"...string":function(a){return a.join("")}})});var nk="column",lK=["typed","Index","matrix","range"],fm=M(nk,lK,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(nk,{"Matrix, number":a,"Array, number":function(s,l){return a(n(yt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Br(s,o.size()[1]);var l=i(0,o.size()[0]),u=new r(l,s),c=o.subset(u);return rt(c)?c:n([[c]])}});var ik="count",cK=["typed","size","prod"],p1=M(ik,cK,t=>{var{typed:e,size:r,prod:n}=t;return e(ik,{string:function(a){return a.length},"Matrix | Array":function(a){return n(r(a))}})});var ak="cross",fK=["typed","matrix","subtract","multiply"],m1=M(ak,fK,t=>{var{typed:e,matrix:r,subtract:n,multiply:i}=t;return e(ak,{"Matrix, Matrix":function(s,l){return r(a(s.toArray(),l.toArray()))},"Matrix, Array":function(s,l){return r(a(s.toArray(),l))},"Array, Matrix":function(s,l){return r(a(s,l.toArray()))},"Array, Array":a});function a(o,s){var l=Math.max(pt(o).length,pt(s).length);o=xf(o),s=xf(s);var u=pt(o),c=pt(s);if(u.length!==1||c.length!==1||u[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+c.join(", ")+"])");var f=[n(i(o[1],s[2]),i(o[2],s[1])),n(i(o[2],s[0]),i(o[0],s[2])),n(i(o[0],s[1]),i(o[1],s[0]))];return l>1?[f]:f}});var ok="diag",pK=["typed","matrix","DenseMatrix","SparseMatrix"],d1=M(ok,pK,t=>{var{typed:e,matrix:r,DenseMatrix:n,SparseMatrix:i}=t;return e(ok,{Array:function(u){return a(u,0,pt(u),null)},"Array, number":function(u,c){return a(u,c,pt(u),null)},"Array, BigNumber":function(u,c){return a(u,c.toNumber(),pt(u),null)},"Array, string":function(u,c){return a(u,0,pt(u),c)},"Array, number, string":function(u,c,f){return a(u,c,pt(u),f)},"Array, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),pt(u),f)},Matrix:function(u){return a(u,0,u.size(),u.storage())},"Matrix, number":function(u,c){return a(u,c,u.size(),u.storage())},"Matrix, BigNumber":function(u,c){return a(u,c.toNumber(),u.size(),u.storage())},"Matrix, string":function(u,c){return a(u,0,u.size(),c)},"Matrix, number, string":function(u,c,f){return a(u,c,u.size(),f)},"Matrix, BigNumber, string":function(u,c,f){return a(u,c.toNumber(),u.size(),f)}});function a(l,u,c,f){if(!Qe(u))throw new TypeError("Second parameter in function diag must be an integer");var m=u>0?u:0,p=u<0?-u:0;switch(c.length){case 1:return o(l,u,f,c[0],p,m);case 2:return s(l,u,f,c,p,m)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(l,u,c,f,m,p){var d=[f+m,f+p];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var h=c==="sparse"?i.diagonal(d,l,u):n.diagonal(d,l,u);return c!==null?h:h.valueOf()}function s(l,u,c,f,m,p){if(rt(l)){var d=l.diagonal(u);return c!==null?c!==d.storage()?r(d,c):d:d.valueOf()}for(var h=Math.min(f[0]-m,f[1]-p),x=[],b=0;b<h;b++)x[b]=l[b+m][b+p];return c!==null?r(x):x}});var mK="filter",dK=["typed"],pm=M(mK,dK,t=>{var{typed:e}=t;return e("filter",{"Array, function":sk,"Matrix, function":function(n,i){return n.create(sk(n.valueOf(),i),n.datatype())},"Array, RegExp":ow,"Matrix, RegExp":function(n,i){return n.create(ow(n.valueOf(),i),n.datatype())}})});function sk(t,e){var r=bo(e,t,"filter");return qP(t,function(n,i,a){return r(n,[i],a)})}var uk="flatten",hK=["typed"],h1=M(uk,hK,t=>{var{typed:e}=t;return e(uk,{Array:function(n){return Rt(n)},Matrix:function(n){return n.create(Rt(n.toArray()),n.datatype())}})});var g1="forEach",gK=["typed"],mm=M(g1,gK,t=>{var{typed:e}=t;return e(g1,{"Array, function":vK,"Matrix, function":function(n,i){n.forEach(i)}})});function vK(t,e){tm(t,[],t,bo(e,t,g1))}var lk="getMatrixDataType",yK=["typed"],v1=M(lk,yK,t=>{var{typed:e}=t;return e(lk,{Array:function(n){return Yl(n,fr)},Matrix:function(n){return n.getDataType()}})});var ck="identity",xK=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],y1=M(ck,xK,t=>{var{typed:e,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=t;return e(ck,{"":function(){return r.matrix==="Matrix"?n([]):[]},string:function(c){return n(c)},"number | BigNumber":function(c){return l(c,c,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return l(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return l(c,f,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,m){return l(c,f,m)},Array:function(c){return s(c)},"Array, string":function(c,f){return s(c,f)},Matrix:function(c){return s(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return s(c.valueOf(),f)}});function s(u,c){switch(u.length){case 0:return c?n(c):[];case 1:return l(u[0],u[0],c);case 2:return l(u[0],u[1],c);default:throw new Error("Vector containing two values expected")}}function l(u,c,f){var m=ft(u)||ft(c)?i:null;if(ft(u)&&(u=u.toNumber()),ft(c)&&(c=c.toNumber()),!Qe(u)||u<1)throw new Error("Parameters in function identity must be positive integers");if(!Qe(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var p=m?new i(1):1,d=m?new m(0):0,h=[u,c];if(f){if(f==="sparse")return o.diagonal(h,p,0,d);if(f==="dense")return a.diagonal(h,p,0,d);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var x=Wo([],h,d),b=u<c?u:c,T=0;T<b;T++)x[T][T]=p;return x}});var fk="kron",bK=["typed","matrix","multiplyScalar"],x1=M(fk,bK,t=>{var{typed:e,matrix:r,multiplyScalar:n}=t;return e(fk,{"Matrix, Matrix":function(o,s){return r(i(o.toArray(),s.toArray()))},"Matrix, Array":function(o,s){return r(i(o.toArray(),s))},"Array, Matrix":function(o,s){return r(i(o,s.toArray()))},"Array, Array":i});function i(a,o){if(pt(a).length===1&&(a=[a]),pt(o).length===1&&(o=[o]),pt(a).length>2||pt(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 s=[],l=[];return a.map(function(u){return o.map(function(c){return l=[],s.push(l),u.map(function(f){return c.map(function(m){return l.push(n(f,m))})})})})&&s}});var b1="map",wK=["typed"],dm=M(b1,wK,t=>{var{typed:e}=t;return e(b1,{"Array, function":n,"Matrix, function":function(a,o){return a.map(o)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(i,a,o)=>r([i,a,...o.slice(0,o.length-1)],o[o.length-1])});function r(i,a){if(typeof a!="function")throw new Error("Last argument must be a callback function");var o=i[0].isMatrix,s=em(...i.map(A=>A.isMatrix?A.size():pt(A))),l=o?(A,w)=>A.get(w):wf,u=o?i.map(A=>A.isMatrix?A.create(hs(A.toArray(),s),A.datatype()):i[0].create(hs(A.valueOf(),s))):i.map(A=>A.isMatrix?hs(A.toArray(),s):hs(A,s)),c;if(e.isTypedFunction(a)){var f=s.map(()=>0),m=u.map(A=>l(A,f)),p=v(a,m,f,u);c=b(p)}else{var d=i.length,h=T(a,d);c=b(h)}var x=(A,w)=>c([A,...u.slice(1).map(y=>l(y,w))],w);if(o)return u[0].map(x);return n(u[0],x);function b(A){switch(A){case 0:return w=>a(...w);case 1:return(w,y)=>a(...w,y);case 2:return(w,y)=>a(...w,y,...u)}}function T(A,w){return A.length>w+1?2:A.length===w+1?1:0}function v(A,w,y,E){return e.resolve(A,[...w,y,...E])!==null?2:e.resolve(A,[...w,y])!==null?1:(e.resolve(A,w)!==null,0)}}function n(i,a){return tm(i,[],i,bo(a,i,b1))}});var pk="diff",_K=["typed","matrix","subtract","number"],hm=M(pk,_K,t=>{var{typed:e,matrix:r,subtract:n,number:i}=t;return e(pk,{"Array | Matrix":function(c){return rt(c)?r(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!Qe(f))throw new RangeError("Dimension must be a whole number");return rt(c)?r(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",u=>(c,f)=>u(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",u=>(c,f)=>u(c,i(f)))});function a(u,c){if(rt(u)&&(u=u.toArray()),!Array.isArray(u))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return u.forEach(m=>{f.push(a(m,c-1))}),f}else{if(c===0)return o(u);throw RangeError("Cannot have negative dimension")}}function o(u){for(var c=[],f=u.length,m=1;m<f;m++)c.push(s(u[m-1],u[m]));return c}function s(u,c){rt(u)&&(u=u.toArray()),rt(c)&&(c=c.toArray());var f=Array.isArray(u),m=Array.isArray(c);if(f&&m)return l(u,c);if(!f&&!m)return n(c,u);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function l(u,c){if(u.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],m=u.length,p=0;p<m;p++)f.push(s(u[p],c[p]));return f}});var AK="ones",SK=["typed","config","matrix","BigNumber"],w1=M(AK,SK,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e("ones",{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(1):1;if(s(l),u){var m=n(u);return l.length>0?m.resize(l,f):m}else{var p=[];return l.length>0?Wo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ft(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!Qe(u)||u<0)throw new Error("Parameters in function ones must be positive integers")})}});function Df(){throw new Error('No "bignumber" implementation available')}function nv(){throw new Error('No "fraction" implementation available')}function iv(){throw new Error('No "matrix" implementation available')}var mk="range",EK=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],gm=M(mk,EK,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=t;return e(mk,{string:m,"string, boolean":m,"number, number":function(x,b){return f(p(x,b,1,!1))},"number, number, number":function(x,b,T){return f(p(x,b,T,!1))},"number, number, boolean":function(x,b,T){return f(p(x,b,1,T))},"number, number, number, boolean":function(x,b,T,v){return f(p(x,b,T,v))},"BigNumber, BigNumber":function(x,b){var T=x.constructor;return f(p(x,b,new T(1),!1))},"BigNumber, BigNumber, BigNumber":function(x,b,T){return f(p(x,b,T,!1))},"BigNumber, BigNumber, boolean":function(x,b,T){var v=x.constructor;return f(p(x,b,new v(1),T))},"BigNumber, BigNumber, BigNumber, boolean":function(x,b,T,v){return f(p(x,b,T,v))},"Unit, Unit, Unit":function(x,b,T){return f(p(x,b,T,!1))},"Unit, Unit, Unit, boolean":function(x,b,T,v){return f(p(x,b,T,v))}});function f(h){return r.matrix==="Matrix"?n?n(h):iv():h}function m(h,x){var b=d(h);if(!b)throw new SyntaxError('String "'+h+'" is no valid range');return r.number==="BigNumber"?(i===void 0&&Df(),f(p(i(b.start),i(b.end),i(b.step)),x)):f(p(b.start,b.end,b.step,x))}function p(h,x,b,T){for(var v=[],A=c(b)?T?o:a:T?l:s,w=h;A(w,x);)v.push(w),w=u(w,b);return v}function d(h){var x=h.split(":"),b=x.map(function(v){return Number(v)}),T=b.some(function(v){return isNaN(v)});if(T)return null;switch(b.length){case 2:return{start:b[0],end:b[1],step:1};case 3:return{start:b[0],end:b[2],step:b[1]};default:return null}}});var dk="reshape",TK=["typed","isInteger","matrix"],_1=M(dk,TK,t=>{var{typed:e,isInteger:r}=t;return e(dk,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!r(o))throw new TypeError("Invalid size for dimension: "+o)}),Qp(i,a)}})});var DK="resize",MK=["config","matrix"],A1=M(DK,MK,t=>{var{config:e,matrix:r}=t;return function(a,o,s){if(arguments.length!==2&&arguments.length!==3)throw new tu("resize",arguments.length,2,3);if(rt(o)&&(o=o.valueOf()),ft(o[0])&&(o=o.map(function(c){return ft(c)?c.toNumber():c})),rt(a))return a.resize(o,s,!0);if(typeof a=="string")return n(a,o,s);var l=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return yt(a)}else{Array.isArray(a)||(a=[a]),a=yt(a);var u=Wo(a,o,s);return l?r(u):u}};function n(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new Ct(a.length,1);var s=a[0];if(typeof s!="number"||!Qe(s))throw new TypeError("Invalid size, must contain positive integers (size: "+Dt(a)+")");if(i.length>s)return i.substring(0,s);if(i.length<s){for(var l=i,u=0,c=s-i.length;u<c;u++)l+=o;return l}else return i}});var hk="rotate",CK=["typed","multiply","rotationMatrix"],S1=M(hk,CK,t=>{var{typed:e,multiply:r,rotationMatrix:n}=t;return e(hk,{"Array , number | BigNumber | Complex | Unit":function(o,s){i(o,2);var l=r(n(s),o);return l.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,s){return i(o,2),r(n(s),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){i(o,3);var u=r(n(s,l),o);return u},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,s,l){return i(o,3),r(n(s,l),o)}});function i(a,o){var s=Array.isArray(a)?pt(a):a.size();if(s.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s.length===2&&s[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(s[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var gk="rotationMatrix",NK=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],E1=M(gk,NK,t=>{var{typed:e,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:l,DenseMatrix:u,SparseMatrix:c,cos:f,sin:m}=t;return e(gk,{"":function(){return r.matrix==="Matrix"?l([]):[]},string:function(v){return l(v)},"number | BigNumber | Complex | Unit":function(v){return p(v,r.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(v,A){return p(v,A)},"number | BigNumber | Complex | Unit, Array":function(v,A){var w=l(A);return d(w),b(v,w,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(v,A){d(A);var w=A.storage()||(r.matrix==="Matrix"?"dense":void 0);return b(v,A,w)},"number | BigNumber | Complex | Unit, Array, string":function(v,A,w){var y=l(A);return d(y),b(v,y,w)},"number | BigNumber | Complex | Unit, Matrix, string":function(v,A,w){return d(A),b(v,A,w)}});function p(T,v){var A=ft(T),w=A?new s(-1):-1,y=f(T),E=m(T),D=[[y,n(w,E)],[E,y]];return x(D,v)}function d(T){var v=T.size();if(v.length<1||v[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function h(T){return T.reduce((v,A)=>n(v,A))}function x(T,v){if(v){if(v==="sparse")return new c(T);if(v==="dense")return new u(T);throw new TypeError('Unknown matrix type "'.concat(v,'"'))}return T}function b(T,v,A){var w=o(v);if(w===0)throw new RangeError("Rotation around zero vector");var y=ft(T)?s:null,E=y?new y(1):1,D=y?new y(-1):-1,_=y?new y(v.get([0])/w):v.get([0])/w,N=y?new y(v.get([1])/w):v.get([1])/w,C=y?new y(v.get([2])/w):v.get([2])/w,B=f(T),R=i(E,a(B)),V=m(T),L=i(B,h([_,_,R])),P=i(h([_,N,R]),h([D,C,V])),k=i(h([_,C,R]),h([N,V])),W=i(h([_,N,R]),h([C,V])),O=i(B,h([N,N,R])),X=i(h([N,C,R]),h([D,_,V])),ae=i(h([_,C,R]),h([D,N,V])),J=i(h([N,C,R]),h([_,V])),U=i(B,h([C,C,R])),de=[[L,P,k],[W,O,X],[ae,J,U]];return x(de,A)}});var vk="row",FK=["typed","Index","matrix","range"],vm=M(vk,FK,t=>{var{typed:e,Index:r,matrix:n,range:i}=t;return e(vk,{"Matrix, number":a,"Array, number":function(s,l){return a(n(yt(s)),l).valueOf()}});function a(o,s){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");Br(s,o.size()[0]);var l=i(0,o.size()[1]),u=new r(s,l),c=o.subset(u);return rt(c)?c:n([[c]])}});var yk="size",IK=["typed","config","?matrix"],T1=M(yk,IK,t=>{var{typed:e,config:r,matrix:n}=t;return e(yk,{Matrix:function(a){return a.create(a.size(),"number")},Array:pt,string:function(a){return r.matrix==="Array"?[a.length]:n([a.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(a){return r.matrix==="Array"?[]:n?n([],"dense","number"):iv()}})});var xk="squeeze",PK=["typed"],D1=M(xk,PK,t=>{var{typed:e}=t;return e(xk,{Array:function(n){return xf(yt(n))},Matrix:function(n){var i=xf(n.toArray());return Array.isArray(i)?n.create(i,n.datatype()):i},any:function(n){return yt(n)}})});var bk="subset",BK=["typed","matrix","zeros","add"],ym=M(bk,BK,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t;return e(bk,{"Matrix, Index":function(s,l){return Wl(l)?r():(Xp(s,l),s.subset(l))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(s,l){var u=o(r(s),l);return l.isScalar()?u:u.valueOf()}}),"Object, Index":$K,"string, Index":kK,"Matrix, Index, any, any":function(s,l,u,c){return Wl(l)?s:(Xp(s,l),s.clone().subset(l,a(u,l),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u,c){var f=o(r(s),l,u,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(r(s),l,u,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(s,l,u){return o(s,l,u,void 0)}}),"string, Index, string":wk,"string, Index, string, string":wk,"Object, Index, any":OK});function a(o,s){if(typeof o=="string")throw new Error("can't boradcast a string");if(s._isScalar)return o;var l=s.size();if(l.every(u=>u>0))try{return i(o,n(l))}catch{return o}else return o}});function kK(t,e){if(!$u(e))throw new TypeError("Index expected");if(Wl(e))return"";if(Xp(Array.from(t),e),e.size().length!==1)throw new Ct(e.size().length,1);var r=t.length;Br(e.min()[0],r),Br(e.max()[0],r);var n=e.dimension(0),i="";return n.forEach(function(a){i+=t.charAt(a)}),i}function wk(t,e,r,n){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Wl(e))return t;if(Xp(Array.from(t),e),e.size().length!==1)throw new Ct(e.size().length,1);if(n!==void 0){if(typeof n!="string"||n.length!==1)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0),a=i.size()[0];if(a!==r.length)throw new Ct(i.size()[0],r.length);var o=t.length;Br(e.min()[0]),Br(e.max()[0]);for(var s=[],l=0;l<o;l++)s[l]=t.charAt(l);if(i.forEach(function(f,m){s[f]=r.charAt(m[0])}),s.length>o)for(var u=o-1,c=s.length;u<c;u++)s[u]||(s[u]=n);return s.join("")}function $K(t,e){if(!Wl(e)){if(e.size().length!==1)throw new Ct(e.size(),1);var r=e.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");return rn(t,r)}}function OK(t,e,r){if(Wl(e))return t;if(e.size().length!==1)throw new Ct(e.size(),1);var n=e.dimension(0);if(typeof n!="string")throw new TypeError("String expected as index to retrieve an object property");var i=yt(t);return ps(i,n,r),i}var _k="transpose",RK=["typed","matrix"],M1=M(_k,RK,t=>{var{typed:e,matrix:r}=t;return e(_k,{Array:o=>n(r(o)).valueOf(),Matrix:n,any:yt});function n(o){var s=o.size(),l;switch(s.length){case 1:l=o.clone();break;case 2:{var u=s[0],c=s[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Dt(s)+")");switch(o.storage()){case"dense":l=i(o,u,c);break;case"sparse":l=a(o,u,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Dt(s)+")")}return l}function i(o,s,l){for(var u=o._data,c=[],f,m=0;m<l;m++){f=c[m]=[];for(var p=0;p<s;p++)f[p]=yt(u[p][m])}return o.createDenseMatrix({data:c,size:[l,s],datatype:o._datatype})}function a(o,s,l){for(var u=o._values,c=o._index,f=o._ptr,m=u?[]:void 0,p=[],d=[],h=[],x=0;x<s;x++)h[x]=0;var b,T,v;for(b=0,T=c.length;b<T;b++)h[c[b]]++;for(var A=0,w=0;w<s;w++)d.push(A),A+=h[w],h[w]=d[w];for(d.push(A),v=0;v<l;v++)for(var y=f[v],E=f[v+1],D=y;D<E;D++){var _=h[c[D]]++;p[_]=v,u&&(m[_]=yt(u[D]))}return o.createSparseMatrix({values:m,index:p,ptr:d,size:[l,s],datatype:o._datatype})}});var Ak="ctranspose",LK=["typed","transpose","conj"],C1=M(Ak,LK,t=>{var{typed:e,transpose:r,conj:n}=t;return e(Ak,{any:function(a){return n(r(a))}})});var Sk="zeros",VK=["typed","config","matrix","BigNumber"],N1=M(Sk,VK,t=>{var{typed:e,config:r,matrix:n,BigNumber:i}=t;return e(Sk,{"":function(){return r.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(u){var c=u[u.length-1];if(typeof c=="string"){var f=u.pop();return a(u,f)}else return r.matrix==="Array"?a(u):a(u,"default")},Array:a,Matrix:function(u){var c=u.storage();return a(u.valueOf(),c)},"Array | Matrix, string":function(u,c){return a(u.valueOf(),c)}});function a(l,u){var c=o(l),f=c?new i(0):0;if(s(l),u){var m=n(u);return l.length>0?m.resize(l,f):m}else{var p=[];return l.length>0?Wo(p,l,f):p}}function o(l){var u=!1;return l.forEach(function(c,f,m){ft(c)&&(u=!0,m[f]=c.toNumber())}),u}function s(l){l.forEach(function(u){if(typeof u!="number"||!Qe(u)||u<0)throw new Error("Parameters in function zeros must be positive integers")})}});var Ek="fft",UK=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],F1=M(Ek,UK,t=>{var{typed:e,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:l,dotDivide:u,conj:c,pow:f,ceil:m,log2:p}=t;return e(Ek,{Array:d,Matrix:function(v){return v.create(d(v.valueOf()),v.datatype())}});function d(T){var v=pt(T);return v.length===1?b(T,v[0]):h(T.map(A=>d(A,v.slice(1))),0)}function h(T,v){var A=pt(T);if(v!==0)return new Array(A[0]).fill(0).map((y,E)=>h(T[E],v-1));if(A.length===1)return b(T);function w(y){var E=pt(y);return new Array(E[1]).fill(0).map((D,_)=>new Array(E[0]).fill(0).map((N,C)=>y[C][_]))}return w(h(w(T),1))}function x(T){for(var v=T.length,A=o(a(i(-1,i(l,s)),v)),w=[],y=1-v;y<v;y++)w.push(f(A,a(f(y,2),2)));for(var E=f(2,m(p(v+v-1))),D=[...new Array(v).fill(0).map((P,k)=>i(T[k],w[v-1+k])),...new Array(E-v).fill(0)],_=[...new Array(v+v-1).fill(0).map((P,k)=>a(1,w[k])),...new Array(E-(v+v-1)).fill(0)],N=b(D),C=b(_),B=new Array(E).fill(0).map((P,k)=>i(N[k],C[k])),R=u(c(d(c(B))),E),V=[],L=v-1;L<v+v-1;L++)V.push(i(R[L],w[L]));return V}function b(T){var v=T.length;if(v===1)return[T[0]];if(v%2===0){for(var A=[...b(T.filter((D,_)=>_%2===0),v/2),...b(T.filter((D,_)=>_%2===1),v/2)],w=0;w<v/2;w++){var y=A[w],E=i(A[w+v/2],o(i(i(s,l),a(-w,v))));A[w]=n(y,E),A[w+v/2]=n(y,i(-1,E))}return A}else return x(T)}});var Tk="ifft",qK=["typed","fft","dotDivide","conj"],I1=M(Tk,qK,t=>{var{typed:e,fft:r,dotDivide:n,conj:i}=t;return e(Tk,{"Array | Matrix":function(o){var s=rt(o)?o.size():pt(o);return n(i(r(i(o))),s.reduce((l,u)=>l*u,1))}})});function Jl(t){"@babel/helpers - typeof";return Jl=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},Jl(t)}function Dk(t,e){if(Jl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mk(t){var e=Dk(t,"string");return Jl(e)=="symbol"?e:e+""}function Er(t,e,r){return(e=Mk(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ck(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zK(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ck(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ck(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var HK="solveODE",GK=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],P1=M(HK,GK,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,max:o,map:s,abs:l,isPositive:u,isNegative:c,larger:f,smaller:m,matrix:p,bignumber:d,unaryMinus:h}=t;function x(D){return function(_,N,C,B){var R=!(N.length===2&&(N.every(y)||N.every(bi)));if(R)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var V=N[0],L=N[1],P=f(L,V),k=B.firstStep;if(k!==void 0&&!u(k))throw new Error('"firstStep" must be positive');var W=B.maxStep;if(W!==void 0&&!u(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 X=[V,L,k,O,W].filter(St=>St!==void 0);if(!(X.every(y)||X.every(bi)))throw new Error('Inconsistent type of "t" dependant variables');for(var ae=1,J=B.tol?B.tol:1e-4,U=B.minDelta?B.minDelta:.2,de=B.maxDelta?B.maxDelta:5,we=B.maxIter?B.maxIter:1e4,se=[V,L,...C,W,O].some(ft),[be,K,j,ne]=se?[d(D.a),d(D.c),d(D.b),d(D.bp)]:[D.a,D.c,D.b,D.bp],pe=k?P?k:h(k):a(n(L,V),ae),fe=[V],Ae=[C],_e=n(j,ne),G=0,Z=0,ge=A(P),xe=w(P);ge(fe[G],L);){var Ee=[];pe=xe(fe[G],L,pe),Ee.push(_(fe[G],Ae[G]));for(var Be=1;Be<K.length;++Be)Ee.push(_(r(fe[G],i(K[Be],pe)),r(Ae[G],i(pe,be[Be],Ee))));var Ve=o(l(s(i(_e,Ee),St=>bi(St)?St.value:St)));Ve<J&&J/Ve>1/4&&(fe.push(r(fe[G],pe)),Ae.push(r(Ae[G],i(pe,j,Ee))),G++);var et=.84*(J/Ve)**(1/5);if(m(et,U)?et=U:f(et,de)&&(et=de),et=se?d(et):et,pe=i(pe,et),W&&f(l(pe),W)?pe=P?W:h(W):O&&m(l(pe),O)&&(pe=P?O:h(O)),Z++,Z>we)throw new Error("Maximum number of iterations reached, try changing options")}return{t:fe,y:Ae}}}function b(D,_,N,C){var B=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],R=[null,1/2,3/4,1],V=[2/9,1/3,4/9,0],L=[7/24,1/4,1/3,1/8],P={a:B,c:R,b:V,bp:L};return x(P)(D,_,N,C)}function T(D,_,N,C){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]],R=[null,1/5,3/10,4/5,8/9,1,1],V=[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],P={a:B,c:R,b:V,bp:L};return x(P)(D,_,N,C)}function v(D,_,N,C){var B=C.method?C.method:"RK45",R={RK23:b,RK45:T};if(B.toUpperCase()in R){var V=zK({},C);return delete V.method,R[B.toUpperCase()](D,_,N,V)}else{var L=Object.keys(R).map(k=>'"'.concat(k,'"')),P="".concat(L.slice(0,-1).join(", ")," and ").concat(L.slice(-1));throw new Error('Unavailable method "'.concat(B,'". Available methods are ').concat(P))}}function A(D){return D?m:f}function w(D){var _=D?f:m;return function(N,C,B){var R=r(N,B);return _(R,C)?n(C,N):B}}function y(D){return ft(D)||At(D)}function E(D,_,N,C){var B=v(D,_.toArray(),N.toArray(),C);return{t:p(B.t),y:p(B.y)}}return e("solveODE",{"function, Array, Array, Object":v,"function, Matrix, Matrix, Object":E,"function, Array, Array":(D,_,N)=>v(D,_,N,{}),"function, Matrix, Matrix":(D,_,N)=>E(D,_,N,{}),"function, Array, number | BigNumber | Unit":(D,_,N)=>{var C=v(D,_,[N],{});return{t:C.t,y:C.y.map(B=>B[0])}},"function, Matrix, number | BigNumber | Unit":(D,_,N)=>{var C=v(D,_.toArray(),[N],{});return{t:p(C.t),y:p(C.y.map(B=>B[0]))}},"function, Array, number | BigNumber | Unit, Object":(D,_,N,C)=>{var B=v(D,_,[N],C);return{t:B.t,y:B.y.map(R=>R[0])}},"function, Matrix, number | BigNumber | Unit, Object":(D,_,N,C)=>{var B=v(D,_.toArray(),[N],C);return{t:p(B.t),y:p(B.y.map(R=>R[0]))}}})});var WK="erf",YK=["typed"],B1=M(WK,YK,t=>{var{typed:e}=t;return e("name",{number:function(o){var s=Math.abs(o);return s>=JK?vo(o):s<=jK?vo(o)*r(s):s<=4?vo(o)*(1-n(s)):vo(o)*(1-i(s))},"Array | Matrix":e.referToSelf(a=>o=>nt(o,a))});function r(a){var o=a*a,s=ru[0][4]*o,l=o,u;for(u=0;u<3;u+=1)s=(s+ru[0][u])*o,l=(l+Mf[0][u])*o;return a*(s+ru[0][3])/(l+Mf[0][3])}function n(a){var o=ru[1][8]*a,s=a,l;for(l=0;l<7;l+=1)o=(o+ru[1][l])*a,s=(s+Mf[1][l])*a;var u=(o+ru[1][7])/(s+Mf[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*u}function i(a){var o=1/(a*a),s=ru[2][5]*o,l=o,u;for(u=0;u<4;u+=1)s=(s+ru[2][u])*o,l=(l+Mf[2][u])*o;var c=o*(s+ru[2][4])/(l+Mf[2][4]);c=(ZK-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),jK=.46875,ZK=.5641895835477563,ru=[[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]],Mf=[[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]],JK=Math.pow(2,53);var Nk="zeta",XK=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],k1=M(Nk,XK,t=>{var{typed:e,config:r,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:l,isNegative:u,gamma:c,sin:f,subtract:m,add:p,Complex:d,BigNumber:h,pi:x}=t;return e(Nk,{number:y=>b(y,E=>E,()=>20),BigNumber:y=>b(y,E=>new h(E),()=>Math.abs(Math.log10(r.relTol))),Complex:T});function b(y,E,D){return s(y,0)?E(-.5):s(y,1)?E(NaN):isFinite(y)?v(y,E,D,_=>_):u(y)?E(NaN):E(1)}function T(y){return y.re===0&&y.im===0?new d(-.5):y.re===1?new d(NaN,NaN):y.re===1/0&&y.im===0?new d(1):y.im===1/0||y.re===-1/0?new d(NaN,NaN):v(y,E=>E,E=>Math.round(1.3*15+.9*Math.abs(E.im)),E=>E.re)}function v(y,E,D,_){var N=D(y);if(_(y)>-(N-1)/2)return w(y,E(N),E);var C=n(i(2,y),i(E(x),m(y,1)));return C=n(C,f(n(a(E(x),2),y))),C=n(C,c(m(1,y))),n(C,v(m(1,y),E,D,_))}function A(y,E){for(var D=y,_=y;l(_,E);_=p(_,1)){var N=a(n(o(p(E,m(_,1))),i(4,_)),n(o(m(E,_)),o(n(2,_))));D=p(D,N)}return n(E,D)}function w(y,E,D){for(var _=a(1,n(A(D(0),E),m(1,i(2,m(1,y))))),N=D(0),C=D(1);l(C,E);C=p(C,1))N=p(N,a(n((-1)**(C-1),A(C,E)),i(C,y)));return n(_,N)}});var Fk="mode",QK=["typed","isNaN","isNumeric"],$1=M(Fk,QK,t=>{var{typed:e,isNaN:r,isNumeric:n}=t;return e(Fk,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=Rt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var s={},l=[],u=0,c=0;c<a.length;c++){var f=a[c];if(n(f)&&r(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in s||(s[f]=0),s[f]++,s[f]===u?l.push(f):s[f]>u&&(u=s[f],l=[f])}return l}});function An(t,e,r){var n;return String(t).includes("Unexpected type")?(n=arguments.length>2?" (type: "+fr(r)+", value: "+JSON.stringify(r)+")":" (type: "+t.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):String(t).includes("complex numbers")?(n=arguments.length>2?" (type: "+fr(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):t}var Ik="prod",KK=["typed","config","multiplyScalar","numeric"],O1=M(Ik,KK,t=>{var{typed:e,config:r,multiplyScalar:n,numeric:i}=t;return e(Ik,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(s,l){throw new Error("prod(A, dim) is not yet supported")},"...":function(s){return a(s)}});function a(o){var s;if(Oi(o,function(l){try{s=s===void 0?l:n(s,l)}catch(u){throw An(u,"prod",l)}}),typeof s=="string"&&(s=i(s,Bi(s,r))),s===void 0)throw new Error("Cannot calculate prod of an empty array");return s}});var Pk="format",eee=["typed"],R1=M(Pk,eee,t=>{var{typed:e}=t;return e(Pk,{any:Dt,"any, Object | function | number | BigNumber":Dt})});var Bk="bin",tee=["typed","format"],L1=M(Bk,tee,t=>{var{typed:e,format:r}=t;return e(Bk,{"number | BigNumber":function(i){return r(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"bin",wordSize:a})}})});var kk="oct",ree=["typed","format"],V1=M(kk,ree,t=>{var{typed:e,format:r}=t;return e(kk,{"number | BigNumber":function(i){return r(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"oct",wordSize:a})}})});var $k="hex",nee=["typed","format"],U1=M($k,nee,t=>{var{typed:e,format:r}=t;return e($k,{"number | BigNumber":function(i){return r(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return r(i,{notation:"hex",wordSize:a})}})});var av=/\$([\w.]+)/g;var Ok="print",iee=["typed"],xm=M(Ok,iee,t=>{var{typed:e}=t;return e(Ok,{"string, Object | Array":Rk,"string, Object | Array, number | Object":Rk})});function Rk(t,e,r){return t.replace(av,function(n,i){var a=i.split("."),o=e[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var s=a.shift();o=s?o[s]:o+"."}return o!==void 0?bn(o)?o:Dt(o,r):n})}var Lk="to",aee=["typed","matrix","concat"],q1=M(Lk,aee,t=>{var{typed:e,matrix:r,concat:n}=t,i=Pt({typed:e,matrix:r,concat:n});return e(Lk,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var Vk="isPrime",oee=["typed"],z1=M(Vk,oee,t=>{var{typed:e}=t;return e(Vk,{number:function(n){if(n<=3)return n>1;if(n%2===0||n%3===0)return!1;for(var i=5;i*i<=n;i+=6)if(n%i===0||n%(i+2)===0)return!1;return!0},bigint:function(n){if(n<=3n)return n>1n;if(n%2n===0n||n%3n===0n)return!1;for(var i=5n;i*i<=n;i+=6n)if(n%i===0n||n%(i+2n)===0n)return!1;return!0},BigNumber:function(n){if(n.lte(3))return n.gt(1);if(n.mod(2).eq(0)||n.mod(3).eq(0))return!1;if(n.lt(Math.pow(2,32))){for(var i=n.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(T,v,A){for(var w=1;!v.eq(0);)v.mod(2).eq(0)?(v=v.div(2),T=T.mul(T).mod(A)):(v=v.sub(1),w=T.mul(w).mod(A));return w}var s=n.constructor.clone({precision:n.toFixed(0).length*2});n=new s(n);for(var l=0,u=n.sub(1);u.mod(2).eq(0);)u=u.div(2),l+=1;var c=null;if(n.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(T=>T<n);else{var f=Math.min(n.toNumber()-2,Math.floor(2*Math.pow(n.toFixed(0).length*Math.log(10),2)));c=[];for(var m=2;m<=f;m+=1)c.push(f)}for(var p=0;p<c.length;p+=1){var d=c[p],h=o(n.sub(n).add(d),u,n);if(!h.eq(1)){for(var x=0,b=h;!b.eq(n.sub(1));x+=1,b=b.mul(b).mod(n))if(x===l-1)return!1}}return!0},"Array | Matrix":e.referToSelf(r=>n=>nt(n,r))})});var see="numeric",uee=["number","?bignumber","?fraction"],H1=M(see,uee,t=>{var{number:e,bignumber:r,fraction:n}=t,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:r?o=>r(o):Df,bigint:o=>BigInt(o),Fraction:n?o=>n(o):nv};return function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",u=arguments.length>2?arguments[2]:void 0;if(u!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=fr(s);if(!(c in i))throw new TypeError("Cannot convert "+s+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(l in a))throw new TypeError("Cannot convert "+s+' to type "'+l+'"; valid output types are '+Object.keys(a).join(", "));return l===c?s:a[l](s)}});var Uk="divideScalar",lee=["typed","numeric"],G1=M(Uk,lee,t=>{var{typed:e,numeric:r}=t;return e(Uk,{"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)},"bigint, bigint":function(i,a){return i/a},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(n,i)=>n.divide(i),"number | Fraction | Complex | BigNumber, Unit":(n,i)=>i.divideInto(n)})});var qk="pow",cee=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],W1=M(qk,cee,t=>{var{typed:e,config:r,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:l,Complex:u}=t;return e(qk,{"number, number":c,"Complex, Complex":function(d,h){return d.pow(h)},"BigNumber, BigNumber":function(d,h){return h.isInteger()||d>=0||r.predictable?d.pow(h):new u(d.toNumber(),0).pow(h.toNumber(),0)},"bigint, bigint":(p,d)=>p**d,"Fraction, Fraction":function(d,h){var x=d.pow(h);if(x!=null)return x;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(d.valueOf(),h.valueOf())},"Array, number":f,"Array, BigNumber":function(d,h){return f(d,h.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(d,h){return m(d,h.toNumber())},"Unit, number | BigNumber":function(d,h){return d.pow(h)}});function c(p,d){if(r.predictable&&!Qe(d)&&p<0)try{var h=l(d),x=s(h);if((d===x||Math.abs((d-x)/d)<1e-14)&&h.d%2n===1n)return(h.n%2n===0n?1:-1)*Math.pow(-p,d)}catch{}return r.predictable&&(p<-1&&d===1/0||p>-1&&p<0&&d===-1/0)?NaN:Qe(d)||p>=0||r.predictable?Cw(p,d):p*p<1&&d===1/0||p*p>1&&d===-1/0?0:new u(p,0).pow(d,0)}function f(p,d){if(!Qe(d))throw new TypeError("For A^b, b must be an integer (value is "+d+")");var h=pt(p);if(h.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+h.length+" dimensions)");if(h[0]!==h[1])throw new Error("For A^b, A must be square (size is "+h[0]+"x"+h[1]+")");if(d<0)try{return f(o(p),-d)}catch(T){throw T.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 "+d+")"):T}for(var x=n(h[0]).valueOf(),b=p;d>=1;)(d&1)===1&&(x=i(b,x)),d>>=1,b=i(b,b);return x}function m(p,d){return a(f(p.valueOf(),d))}});var Cf="Number of decimals in function round must be an integer",zk="round",fee=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Y1=M(zk,fee,t=>{var{typed:e,config:r,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=t,l=Pr({typed:e,equalScalar:i}),u=wr({typed:e,DenseMatrix:s}),c=Fn({typed:e});function f(m){return Math.abs(df(m).exponent)}return e(zk,{number:function(p){var d=Af(p,f(r.relTol)),h=Kr(p,d,r.relTol,r.absTol)?d:p;return Af(h)},"number, number":function(p,d){var h=f(r.relTol);if(d>=h)return Af(p,d);var x=Af(p,h),b=Kr(p,x,r.relTol,r.absTol)?x:p;return Af(b,d)},"number, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Cf);return new o(p).toDecimalPlaces(d.toNumber())},Complex:function(p){return p.round()},"Complex, number":function(p,d){if(d%1)throw new TypeError(Cf);return p.round(d)},"Complex, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Cf);var h=d.toNumber();return p.round(h)},BigNumber:function(p){var d=new o(p).toDecimalPlaces(f(r.relTol)),h=mn(p,d,r.relTol,r.absTol)?d:p;return h.toDecimalPlaces(0)},"BigNumber, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Cf);var h=f(r.relTol);if(d>=h)return p.toDecimalPlaces(d.toNumber());var x=p.toDecimalPlaces(h),b=mn(p,x,r.relTol,r.absTol)?x:p;return b.toDecimalPlaces(d.toNumber())},Fraction:function(p){return p.round()},"Fraction, number":function(p,d){if(d%1)throw new TypeError(Cf);return p.round(d)},"Fraction, BigNumber":function(p,d){if(!d.isInteger())throw new TypeError(Cf);return p.round(d.toNumber())},"Unit, number, Unit":e.referToSelf(m=>function(p,d,h){var x=p.toNumeric(h);return h.multiply(m(x,d))}),"Unit, BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>m(p,d.toNumber(),h)),"Array | Matrix, number | BigNumber, Unit":e.referToSelf(m=>(p,d,h)=>nt(p,x=>m(x,d,h),!0)),"Array | Matrix | Unit, Unit":e.referToSelf(m=>(p,d)=>m(p,0,d)),"Array | Matrix":e.referToSelf(m=>p=>nt(p,m,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>l(p,d,m,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(m=>(p,d)=>c(p,d,m,!1)),"Array, number | BigNumber":e.referToSelf(m=>(p,d)=>c(n(p),d,m,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(m=>(p,d)=>i(p,0)?a(d.size(),d.storage()):u(d,p,m,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(m=>(p,d)=>i(p,0)?a(d.size(),d.storage()):c(d,p,m,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(m=>(p,d)=>c(n(d),p,m,!0).valueOf())})});var Hk="log",pee=["config","typed","typeOf","divideScalar","Complex"],j1=M(Hk,pee,t=>{var{typed:e,typeOf:r,config:n,divideScalar:i,Complex:a}=t;return e(Hk,{number:function(s){return s>=0||n.predictable?jP(s):new a(s,0).log()},Complex:function(s){return s.log()},BigNumber:function(s){return!s.isNegative()||n.predictable?s.ln():new a(s.toNumber(),0).log()},"any, any":e.referToSelf(o=>(s,l)=>{if(r(s)==="Fraction"&&r(l)==="Fraction"){var u=s.log(l);if(u!==null)return u}return i(o(s),o(l))})})});var Gk="log1p",mee=["typed","config","divideScalar","log","Complex"],Z1=M(Gk,mee,t=>{var{typed:e,config:r,divideScalar:n,log:i,Complex:a}=t;return e(Gk,{number:function(l){return l>=-1||r.predictable?Ng(l):o(new a(l,0))},Complex:o,BigNumber:function(l){var u=l.plus(1);return!u.isNegative()||r.predictable?u.ln():o(new a(l.toNumber(),0))},"Array | Matrix":e.referToSelf(s=>l=>nt(l,s)),"any, any":e.referToSelf(s=>(l,u)=>n(s(l),i(u)))});function o(s){var l=s.re+1;return new a(Math.log(Math.sqrt(l*l+s.im*s.im)),Math.atan2(s.im,l))}});var Wk="nthRoots",dee=["config","typed","divideScalar","Complex"],J1=M(Wk,dee,t=>{var{typed:e,config:r,divideScalar:n,Complex:i}=t,a=[function(l){return new i(l,0)},function(l){return new i(0,l)},function(l){return new i(-l,0)},function(l){return new i(0,-l)}];function o(s,l){if(l<0)throw new Error("Root must be greater than zero");if(l===0)throw new Error("Root must be non-zero");if(l%1!==0)throw new Error("Root must be an integer");if(s===0||s.abs()===0)return[new i(0,0)];var u=typeof s=="number",c;(u||s.re===0||s.im===0)&&(u?c=2*+(s<0):s.im===0?c=2*+(s.re<0):c=2*+(s.im<0)+1);for(var f=s.arg(),m=s.abs(),p=[],d=Math.pow(m,1/l),h=0;h<l;h++){var x=(c+4*h)/l;if(x===Math.round(x)){p.push(a[x%4](d));continue}p.push(new i({r:d,phi:(f+2*Math.PI*h)/l}))}return p}return e(Wk,{Complex:function(l){return o(l,2)},"Complex, number":o})});var Yk="dotPow",hee=["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],X1=M(Yk,hee,t=>{var{typed:e,equalScalar:r,matrix:n,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=jr({typed:e}),u=Gn({typed:e,SparseMatrix:s}),c=Pr({typed:e,equalScalar:r}),f=wr({typed:e,DenseMatrix:a}),m=Pt({typed:e,matrix:n,concat:o}),p={};for(var d in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,d)&&!d.includes("Matrix")&&!d.includes("Array")&&(p[d]=i.signatures[d]);var h=e(p);return e(Yk,m({elop:h,SS:u,DS:l,Ss:c,sS:f}))});var jk="dotDivide",gee=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],Q1=M(jk,gee,t=>{var{typed:e,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=In({typed:e,equalScalar:n}),u=jr({typed:e}),c=Gn({typed:e,SparseMatrix:s}),f=Pr({typed:e,equalScalar:n}),m=wr({typed:e,DenseMatrix:a}),p=Pt({typed:e,matrix:r,concat:o});return e(jk,p({elop:i,SS:c,DS:u,SD:l,Ss:f,sS:m}))});function gs(t){var{DenseMatrix:e}=t;return function(n,i,a){var o=n.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Dt(o)+")");var s=o[0],l=o[1];if(s!==l)throw new RangeError("Matrix must be square (size: "+Dt(o)+")");var u=[];if(rt(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var m=0;m<s;m++)u[m]=[f[m]];return new e({data:u,size:[s,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==s||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Ul(i)){if(a){u=[];for(var p=0;p<s;p++)u[p]=[f[p][0]];return new e({data:u,size:[s,1],datatype:i._datatype})}return i}if(Uo(i)){for(var d=0;d<s;d++)u[d]=[0];for(var h=i._values,x=i._index,b=i._ptr,T=b[1],v=b[0];v<T;v++){var A=x[v];u[A][0]=h[v]}return new e({data:u,size:[s,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(vr(i)){var w=pt(i);if(w.length===1){if(w[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<s;y++)u[y]=[i[y]];return new e({data:u,size:[s,1]})}if(w.length===2){if(w[0]!==s||w[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var E=0;E<s;E++)u[E]=[i[E][0]];return new e({data:u,size:[s,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var Zk="lsolve",vee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],K1=M(Zk,vee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Zk,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.valueOf()}});function u(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],x=[],b=f._data,T=0;T<h;T++){var v=p[T][0]||0,A=void 0;if(o(v,0))A=0;else{var w=b[T][T];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var y=T+1;y<d;y++)p[y]=[a(p[y][0]||0,i(A,b[y][T]))]}x[T]=[A]}return new s({data:x,size:[d,1]})}function c(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=[],A=0;A<h;A++){var w=p[A][0]||0;if(o(w,0))v[A]=[0];else{for(var y=0,E=[],D=[],_=T[A],N=T[A+1],C=_;C<N;C++){var B=b[C];B===A?y=x[C]:B>A&&(E.push(x[C]),D.push(B))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,y),V=0,L=D.length;V<L;V++){var P=D[V];p[P]=[a(p[P][0]||0,i(R,E[V]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var Jk="usolve",yee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],eA=M(Jk,yee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Jk,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.valueOf()}});function u(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],x=[],b=f._data,T=h-1;T>=0;T--){var v=p[T][0]||0,A=void 0;if(o(v,0))A=0;else{var w=b[T][T];if(o(w,0))throw new Error("Linear system cannot be solved since matrix is singular");A=n(v,w);for(var y=T-1;y>=0;y--)p[y]=[a(p[y][0]||0,i(A,b[y][T]))]}x[T]=[A]}return new s({data:x,size:[d,1]})}function c(f,m){m=l(f,m,!0);for(var p=m._data,d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=[],A=h-1;A>=0;A--){var w=p[A][0]||0;if(o(w,0))v[A]=[0];else{for(var y=0,E=[],D=[],_=T[A],N=T[A+1],C=N-1;C>=_;C--){var B=b[C];B===A?y=x[C]:B<A&&(E.push(x[C]),D.push(B))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var R=n(w,y),V=0,L=D.length;V<L;V++){var P=D[V];p[P]=[a(p[P][0],i(R,E[V]))]}v[A]=[R]}}return new s({data:v,size:[d,1]})}});var Xk="lsolveAll",xee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],tA=M(Xk,xee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Xk,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.map(x=>x.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(D=>D[0])],d=f._data,h=f._size[0],x=f._size[1],b=0;b<x;b++)for(var T=p.length,v=0;v<T;v++){var A=p[v];if(o(d[b][b],0))if(o(A[b],0)){if(v===0){var y=[...A];y[b]=1;for(var E=b+1;E<x;E++)y[E]=a(y[E],d[E][b]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,T-=1}else{A[b]=n(A[b],d[b][b]);for(var w=b+1;w<x;w++)A[w]=a(A[w],i(A[b],d[w][b]))}}return p.map(D=>new s({data:D.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ae=>ae[0])],d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=0;v<h;v++)for(var A=p.length,w=0;w<A;w++){for(var y=p[w],E=[],D=[],_=T[v],N=T[v+1],C=0,B=_;B<N;B++){var R=b[B];R===v?C=x[B]:R>v&&(E.push(x[B]),D.push(R))}if(o(C,0))if(o(y[v],0)){if(w===0){var k=[...y];k[v]=1;for(var W=0,O=D.length;W<O;W++){var X=D[W];k[X]=a(k[X],E[W])}p.push(k)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{y[v]=n(y[v],C);for(var V=0,L=D.length;V<L;V++){var P=D[V];y[P]=a(y[P],i(y[v],E[V]))}}}return p.map(ae=>new s({data:ae.map(J=>[J]),size:[d,1]}))}});var Qk="usolveAll",bee=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],rA=M(Qk,bee,t=>{var{typed:e,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(Qk,{"SparseMatrix, Array | Matrix":function(m,p){return c(m,p)},"DenseMatrix, Array | Matrix":function(m,p){return u(m,p)},"Array, Array | Matrix":function(m,p){var d=r(m),h=u(d,p);return h.map(x=>x.valueOf())}});function u(f,m){for(var p=[l(f,m,!0)._data.map(D=>D[0])],d=f._data,h=f._size[0],x=f._size[1],b=x-1;b>=0;b--)for(var T=p.length,v=0;v<T;v++){var A=p[v];if(o(d[b][b],0))if(o(A[b],0)){if(v===0){var y=[...A];y[b]=1;for(var E=b-1;E>=0;E--)y[E]=a(y[E],d[E][b]);p.push(y)}}else{if(v===0)return[];p.splice(v,1),v-=1,T-=1}else{A[b]=n(A[b],d[b][b]);for(var w=b-1;w>=0;w--)A[w]=a(A[w],i(A[b],d[w][b]))}}return p.map(D=>new s({data:D.map(_=>[_]),size:[h,1]}))}function c(f,m){for(var p=[l(f,m,!0)._data.map(ae=>ae[0])],d=f._size[0],h=f._size[1],x=f._values,b=f._index,T=f._ptr,v=h-1;v>=0;v--)for(var A=p.length,w=0;w<A;w++){for(var y=p[w],E=[],D=[],_=T[v],N=T[v+1],C=0,B=N-1;B>=_;B--){var R=b[B];R===v?C=x[B]:R<v&&(E.push(x[B]),D.push(R))}if(o(C,0))if(o(y[v],0)){if(w===0){var k=[...y];k[v]=1;for(var W=0,O=D.length;W<O;W++){var X=D[W];k[X]=a(k[X],E[W])}p.push(k)}}else{if(w===0)return[];p.splice(w,1),w-=1,A-=1}else{y[v]=n(y[v],C);for(var V=0,L=D.length;V<L;V++){var P=D[V];y[P]=a(y[P],i(y[v],E[V]))}}}return p.map(ae=>new s({data:ae.map(J=>[J]),size:[d,1]}))}});var wee="matAlgo08xS0Sid",_ee=["typed","equalScalar"],Nf=M(wee,_ee,t=>{var{typed:e,equalScalar:r}=t;return function(i,a,o){var s=i._values,l=i._index,u=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),m=a._values,p=a._index,d=a._ptr,h=a._size,x=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==h.length)throw new Ct(c.length,h.length);if(c[0]!==h[0]||c[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+h+")");if(!s||!m)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var b=c[0],T=c[1],v,A=r,w=0,y=o;typeof f=="string"&&f===x&&f!=="mixed"&&(v=f,A=e.find(r,[v,v]),w=e.convert(0,v),y=e.find(o,[v,v]));for(var E=[],D=[],_=[],N=[],C=[],B,R,V,L,P=0;P<T;P++){_[P]=D.length;var k=P+1;for(R=u[P],V=u[P+1],B=R;B<V;B++)L=l[B],C[L]=k,N[L]=s[B],D.push(L);for(R=d[P],V=d[P+1],B=R;B<V;B++)L=p[B],C[L]===k&&(N[L]=y(N[L],m[B]));for(B=_[P];B<D.length;){L=D[B];var W=N[L];A(W,w)?D.splice(B,1):(E.push(W),B++)}}return _[T]=D.length,i.createSparseMatrix({values:E,index:D,ptr:_,size:[b,T],datatype:f===i._datatype&&x===a._datatype?v:void 0})}});var Ff=M("useMatrixForArrayScalar",["typed","matrix"],t=>{var{typed:e,matrix:r}=t;return{"Array, number":e.referTo("DenseMatrix, number",n=>(i,a)=>n(r(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",n=>(i,a)=>n(r(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",n=>(i,a)=>n(i,r(a)).valueOf())}});var Kk="leftShift",Aee=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],nA=M(Kk,Aee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Nf({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Pr({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=Ff({typed:e,matrix:r});return e(Kk,{"number, number":Bw,"BigNumber, BigNumber":zB,"bigint, bigint":(h,x)=>h<<x,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var e$="rightArithShift",See=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],iA=M(e$,See,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Nf({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Pr({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=Ff({typed:e,matrix:r});return e(e$,{"number, number":kw,"BigNumber, BigNumber":HB,"bigint, bigint":(h,x)=>h>>x,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var t$="rightLogShift",Eee=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],aA=M(t$,Eee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=t,s=Ri({typed:e}),l=In({typed:e,equalScalar:n}),u=Nf({typed:e,equalScalar:n}),c=Sa({typed:e,DenseMatrix:a}),f=Pr({typed:e,equalScalar:n}),m=Fn({typed:e}),p=Pt({typed:e,matrix:r,concat:o}),d=Ff({typed:e,matrix:r});return e(t$,{"number, number":$w,"SparseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():f(x,b,h,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(h=>(x,b)=>n(b,0)?x.clone():m(x,b,h,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):c(b,x,h,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(h=>(x,b)=>n(x,0)?i(b.size(),b.storage()):m(b,x,h,!0))},d,p({SS:u,DS:s,SD:l}))});var r$="and",Tee=["typed","matrix","equalScalar","zeros","not","concat"],bm=M(r$,Tee,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=In({typed:e,equalScalar:n}),l=Gu({typed:e,equalScalar:n}),u=Pr({typed:e,equalScalar:n}),c=Fn({typed:e}),f=Pt({typed:e,matrix:r,concat:o});return e(r$,{"number, number":Qg,"Complex, Complex":function(p,d){return(p.re!==0||p.im!==0)&&(d.re!==0||d.im!==0)},"BigNumber, BigNumber":function(p,d){return!p.isZero()&&!d.isZero()&&!p.isNaN()&&!d.isNaN()},"bigint, bigint":Qg,"Unit, Unit":e.referToSelf(m=>(p,d)=>m(p.value||0,d.value||0)),"SparseMatrix, any":e.referToSelf(m=>(p,d)=>a(d)?i(p.size(),p.storage()):u(p,d,m,!1)),"DenseMatrix, any":e.referToSelf(m=>(p,d)=>a(d)?i(p.size(),p.storage()):c(p,d,m,!1)),"any, SparseMatrix":e.referToSelf(m=>(p,d)=>a(p)?i(p.size(),p.storage()):u(d,p,m,!0)),"any, DenseMatrix":e.referToSelf(m=>(p,d)=>a(p)?i(p.size(),p.storage()):c(d,p,m,!0)),"Array, any":e.referToSelf(m=>(p,d)=>m(r(p),d).valueOf()),"any, Array":e.referToSelf(m=>(p,d)=>m(p,r(d)).valueOf())},f({SS:l,DS:s}))});var ov="compare",Dee=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],oA=M(ov,Dee,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:l}=t,u=jr({typed:e}),c=Hu({typed:e,equalScalar:n}),f=wr({typed:e,DenseMatrix:s}),m=Pt({typed:e,matrix:i,concat:l}),p=_o({typed:e});return e(ov,Mee({typed:e,config:r}),{"boolean, boolean":function(h,x){return h===x?0:h>x?1:-1},"BigNumber, BigNumber":function(h,x){return mn(h,x,r.relTol,r.absTol)?new a(0):new a(h.cmp(x))},"bigint, bigint":function(h,x){return h===x?0n:h>x?1n:-1n},"Fraction, Fraction":function(h,x){return new o(h.compare(x))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,m({SS:c,DS:u,Ss:f}))}),Mee=M(ov,["typed","config"],t=>{var{typed:e,config:r}=t;return e(ov,{"number, number":function(i,a){return Kr(i,a,r.relTol,r.absTol)?0:i>a?1:-1}})});var Xl=zr(i$(),1);var a$="compareNatural",Cee=["typed","compare"],sA=M(a$,Cee,t=>{var{typed:e,compare:r}=t,n=r.signatures["boolean,boolean"];return e(a$,{"any, any":i});function i(l,u){var c=fr(l),f=fr(u),m;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return m=r(l,u),m.toString()!=="0"?m>0?1:-1:(0,Xl.default)(c,f);var p=["Array","DenseMatrix","SparseMatrix"];if(p.includes(c)||p.includes(f))return m=a(i,l,u),m!==0?m:(0,Xl.default)(c,f);if(c!==f)return(0,Xl.default)(c,f);if(c==="Complex")return Nee(l,u);if(c==="Unit")return l.equalBase(u)?i(l.value,u.value):o(i,l.formatUnits(),u.formatUnits());if(c==="boolean")return n(l,u);if(c==="string")return(0,Xl.default)(l,u);if(c==="Object")return s(i,l,u);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(l,u,c){return Uo(u)&&Uo(c)?o(l,u.toJSON().values,c.toJSON().values):Uo(u)?a(l,u.toArray(),c):Uo(c)?a(l,u,c.toArray()):Ul(u)?a(l,u.toJSON().data,c):Ul(c)?a(l,u,c.toJSON().data):Array.isArray(u)?Array.isArray(c)?o(l,u,c):a(l,u,[c]):a(l,[u],c)}function o(l,u,c){for(var f=0,m=Math.min(u.length,c.length);f<m;f++){var p=l(u[f],c[f]);if(p!==0)return p}return u.length>c.length?1:u.length<c.length?-1:0}function s(l,u,c){var f=Object.keys(u),m=Object.keys(c);f.sort(Xl.default),m.sort(Xl.default);var p=o(l,f,m);if(p!==0)return p;for(var d=0;d<f.length;d++){var h=l(u[f[d]],c[m[d]]);if(h!==0)return h}return 0}});function Nee(t,e){return t.re>e.re?1:t.re<e.re?-1:t.im>e.im?1:t.im<e.im?-1:0}var o$="compareText",Fee=["typed","matrix","concat"];Hg.signature="any, any";var uA=M(o$,Fee,t=>{var{typed:e,matrix:r,concat:n}=t,i=Pt({typed:e,matrix:r,concat:n});return e(o$,Hg,i({elop:Hg,Ds:!0}))});var sv="equal",Iee=["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],lA=M(sv,Iee,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=jr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:r,concat:a});return e(sv,Pee({typed:e,equalScalar:n}),c({elop:n,SS:l,DS:s,Ss:u}))}),Pee=M(sv,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(sv,{"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:r(i,a)}})});var s$="equalText",Bee=["typed","compareText","isZero"],cA=M(s$,Bee,t=>{var{typed:e,compareText:r,isZero:n}=t;return e(s$,{"any, any":function(a,o){return n(r(a,o))}})});var uv="smaller",kee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],fA=M(uv,kee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=jr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=_o({typed:e});return e(uv,$ee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m<p,"BigNumber, BigNumber":function(p,d){return p.lt(d)&&!mn(p,d,r.relTol,r.absTol)},"bigint, bigint":(m,p)=>m<p,"Fraction, Fraction":(m,p)=>m.compare(p)===-1,"Complex, Complex":function(p,d){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),$ee=M(uv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(uv,{"number, number":function(i,a){return i<a&&!Kr(i,a,r.relTol,r.absTol)}})});var lv="smallerEq",Oee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],pA=M(lv,Oee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=jr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=_o({typed:e});return e(lv,Ree({typed:e,config:r}),{"boolean, boolean":(m,p)=>m<=p,"BigNumber, BigNumber":function(p,d){return p.lte(d)||mn(p,d,r.relTol,r.absTol)},"bigint, bigint":(m,p)=>m<=p,"Fraction, Fraction":(m,p)=>m.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),Ree=M(lv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(lv,{"number, number":function(i,a){return i<=a||Kr(i,a,r.relTol,r.absTol)}})});var cv="larger",Lee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],mA=M(cv,Lee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=jr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=_o({typed:e});return e(cv,Vee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m>p,"BigNumber, BigNumber":function(p,d){return p.gt(d)&&!mn(p,d,r.relTol,r.absTol)},"bigint, bigint":(m,p)=>m>p,"Fraction, Fraction":(m,p)=>m.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),Vee=M(cv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(cv,{"number, number":function(i,a){return i>a&&!Kr(i,a,r.relTol,r.absTol)}})});var fv="largerEq",Uee=["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],dA=M(fv,Uee,t=>{var{typed:e,config:r,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=t,s=jr({typed:e}),l=Gn({typed:e,SparseMatrix:o}),u=wr({typed:e,DenseMatrix:i}),c=Pt({typed:e,matrix:n,concat:a}),f=_o({typed:e});return e(fv,qee({typed:e,config:r}),{"boolean, boolean":(m,p)=>m>=p,"BigNumber, BigNumber":function(p,d){return p.gte(d)||mn(p,d,r.relTol,r.absTol)},"bigint, bigint":function(p,d){return p>=d},"Fraction, Fraction":(m,p)=>m.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:l,DS:s,Ss:u}))}),qee=M(fv,["typed","config"],t=>{var{typed:e,config:r}=t;return e(fv,{"number, number":function(i,a){return i>=a||Kr(i,a,r.relTol,r.absTol)}})});var u$="deepEqual",zee=["typed","equal"],hA=M(u$,zee,t=>{var{typed:e,equal:r}=t;return e(u$,{"any, any":function(a,o){return n(a.valueOf(),o.valueOf())}});function n(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++)if(!n(i[s],a[s]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:r(i,a)}});var pv="unequal",Hee=["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],gA=M(pv,Hee,t=>{var{typed:e,config:r,equalScalar:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=jr({typed:e}),u=Gn({typed:e,SparseMatrix:s}),c=wr({typed:e,DenseMatrix:a}),f=Pt({typed:e,matrix:i,concat:o});return e(pv,Gee({typed:e,equalScalar:n}),f({elop:m,SS:u,DS:l,Ss:c}));function m(p,d){return!n(p,d)}}),Gee=M(pv,["typed","equalScalar"],t=>{var{typed:e,equalScalar:r}=t;return e(pv,{"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:!r(i,a)}})});var l$="partitionSelect",Wee=["typed","isNumeric","isNaN","compare"],vA=M(l$,Wee,t=>{var{typed:e,isNumeric:r,isNaN:n,compare:i}=t,a=i,o=(u,c)=>-i(u,c);return e(l$,{"Array | Matrix, number":function(c,f){return s(c,f,a)},"Array | Matrix, number, string":function(c,f,m){if(m==="asc")return s(c,f,a);if(m==="desc")return s(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(u,c,f){if(!Qe(c)||c<0)throw new Error("k must be a non-negative integer");if(rt(u)){var m=u.size();if(m.length>1)throw new Error("Only one dimensional matrices supported");return l(u.valueOf(),c,f)}if(Array.isArray(u))return l(u,c,f)}function l(u,c,f){if(c>=u.length)throw new Error("k out of bounds");for(var m=0;m<u.length;m++)if(r(u[m])&&n(u[m]))return u[m];for(var p=0,d=u.length-1;p<d;){for(var h=p,x=d,b=u[Math.floor(Math.random()*(d-p+1))+p];h<x;)if(f(u[h],b)>=0){var T=u[x];u[x]=u[h],u[h]=T,--x}else++h;f(u[h],b)>0&&--h,c<=h?d=h:p=h+1}return u[c]}});var c$="sort",Yee=["typed","matrix","compare","compareNatural"],yA=M(c$,Yee,t=>{var{typed:e,matrix:r,compare:n,compareNatural:i}=t,a=n,o=(c,f)=>-n(c,f);return e(c$,{Array:function(f){return l(f),f.sort(a)},Matrix:function(f){return u(f),r(f.toArray().sort(a),f.storage())},"Array, function":function(f,m){return l(f),f.sort(m)},"Matrix, function":function(f,m){return u(f),r(f.toArray().sort(m),f.storage())},"Array, string":function(f,m){return l(f),f.sort(s(m))},"Matrix, string":function(f,m){return u(f),r(f.toArray().sort(s(m)),f.storage())}});function s(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 l(c){if(pt(c).length!==1)throw new Error("One dimensional array expected")}function u(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var f$="max",jee=["typed","config","numeric","larger"],wm=M(f$,jee,t=>{var{typed:e,config:r,numeric:n,larger:i}=t;return e(f$,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return zu(l,u.valueOf(),a)},"...":function(l){if(wo(l))throw new TypeError("Scalar values expected in function max");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw An(u,"max",l)}}function o(s){var l;if(Oi(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw An(c,"max",u)}}),l===void 0)throw new Error("Cannot calculate max of an empty array");return typeof l=="string"&&(l=n(l,Bi(l,r))),l}});var p$="min",Zee=["typed","config","numeric","smaller"],_m=M(p$,Zee,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t;return e(p$,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(l,u){return zu(l,u.valueOf(),a)},"...":function(l){if(wo(l))throw new TypeError("Scalar values expected in function min");return o(l)}});function a(s,l){try{return i(s,l)?s:l}catch(u){throw An(u,"min",l)}}function o(s){var l;if(Oi(s,function(u){try{isNaN(u)&&typeof u=="number"?l=NaN:(l===void 0||i(u,l))&&(l=u)}catch(c){throw An(c,"min",u)}}),l===void 0)throw new Error("Cannot calculate min of an empty array");return typeof l=="string"&&(l=n(l,Bi(l,r))),l}});var Jee="ImmutableDenseMatrix",Xee=["smaller","DenseMatrix"],xA=M(Jee,Xee,t=>{var{smaller:e,DenseMatrix:r}=t;function n(i,a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!bn(a))throw new Error("Invalid datatype: "+a);if(rt(i)||vr(i)){var o=new r(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&vr(i.data)&&vr(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 ("+fr(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(i){switch(arguments.length){case 1:{var a=r.prototype.subset.call(this,i);return rt(a)?new n({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:yt(this._data),size:yt(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(i){return new n(i)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||e(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},n.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||e(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},n},{isClass:!0});var Qee="Index",Kee=["ImmutableDenseMatrix","getMatrixDataType"],bA=M(Qee,Kee,t=>{var{ImmutableDenseMatrix:e,getMatrixDataType:r}=t;function n(a){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,s=arguments.length;o<s;o++){var l=arguments[o],u=vr(l),c=rt(l),f=null;if(pf(l))this._dimensions.push(l),this._isScalar=!1;else if(u||c){var m=void 0;r(l)==="boolean"?(u&&(m=i(m$(l).valueOf())),c&&(m=i(m$(l._data).valueOf())),f=l.valueOf().length):m=i(l.valueOf()),this._dimensions.push(m);var p=m.size();(p.length!==1||p[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof l=="number")this._dimensions.push(i([l]));else if(typeof l=="string")this._dimensions.push(l);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}n.prototype.type="Index",n.prototype.isIndex=!0;function i(a){for(var o=0,s=a.length;o<s;o++)if(typeof a[o]!="number"||!Qe(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new e(a)}return n.prototype.clone=function(){var a=new n;return a._dimensions=yt(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},n.create=function(a){var o=new n;return n.apply(o,a),o},n.prototype.size=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?1:l.size()[0]}return a},n.prototype.max=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?l:l.max()}return a},n.prototype.min=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a[o]=typeof l=="string"?l:l.min()}return a},n.prototype.forEach=function(a){for(var o=0,s=this._dimensions.length;o<s;o++)a(this._dimensions[o],o,this)},n.prototype.dimension=function(a){return typeof a!="number"?null:this._dimensions[a]||null},n.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];a.push(typeof l=="string"?l:l.toArray())}return a},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var a=[],o=0,s=this._dimensions.length;o<s;o++){var l=this._dimensions[o];typeof l=="string"?a.push(JSON.stringify(l)):a.push(l.toString())}return"["+a.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(a){return n.create(a.dimensions)},n},{isClass:!0});function m$(t){var e=[];return t.forEach((r,n)=>{r&&e.push(n)}),e}var ete="FibonacciHeap",tte=["smaller","larger"],wA=M(ete,tte,t=>{var{smaller:e,larger:r}=t,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var m={key:c,value:f,degree:0};if(this._minimum){var p=this._minimum;m.left=p,m.right=p.right,p.right=m,m.right.left=m,e(c,p.key)&&(this._minimum=m)}else m.left=m,m.right=m,this._minimum=m;return this._size++,m},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,m=c.degree,p=c.child;m>0;){var d=p.right;p.left.right=p.right,p.right.left=p.left,p.left=f,p.right=f.right,f.right=p,p.right.left=p,p.parent=null,p=d,m--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=u(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,m){f.key=m;var p=f.parent;return p&&e(f.key,p.key)&&(o(c,f,p),s(c,p)),e(f.key,c.key)&&(c=f),c}function o(c,f,m){f.left.right=f.right,f.right.left=f.left,m.degree--,m.child===f&&(m.child=f.right),m.degree===0&&(m.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function s(c,f){var m=f.parent;m&&(f.mark?(o(c,f,m),s(m)):f.mark=!0)}var l=function(f,m){f.left.right=f.right,f.right.left=f.left,f.parent=m,m.child?(f.left=m.child,f.right=m.child.right,m.child.right=f,f.right.left=f):(m.child=f,f.right=f,f.left=f),m.degree++,f.mark=!1};function u(c,f){var m=Math.floor(Math.log(f)*n)+1,p=new Array(m),d=0,h=c;if(h)for(d++,h=h.right;h!==c;)d++,h=h.right;for(var x;d>0;){for(var b=h.degree,T=h.right;x=p[b],!!x;){if(r(h.key,x.key)){var v=x;x=h,h=v}l(x,h),p[b]=null,b++}p[b]=h,h=T,d--}c=null;for(var A=0;A<m;A++)x=p[A],x&&(c?(x.left.right=x.right,x.right.left=x.left,x.left=c,x.right=c.right,c.right=x,x.right.left=x,e(x.key,c.key)&&(c=x)):c=x);return c}return i},{isClass:!0});var rte="Spa",nte=["addScalar","equalScalar","FibonacciHeap"],_A=M(rte,nte,t=>{var{addScalar:e,equalScalar:r,FibonacciHeap:n}=t;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var s=this._heap.insert(a,o);this._values[a]=s}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var s=this._values[a];s?s.value=e(s.value,o):(s=this._heap.insert(a,o),this._values[a]=s)},i.prototype.forEach=function(a,o,s){var l=this._heap,u=this._values,c=[],f=l.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(r(f.value,0)||s(f.key,f.value,this)),f=l.extractMinimum(),f&&c.push(f);for(var m=0;m<c.length;m++){var p=c[m];f=l.insert(p.key,p.value),u[f.key]=f}},i.prototype.swap=function(a,o){var s=this._values[a],l=this._values[o];if(!s&&l)s=this._heap.insert(a,l.value),this._heap.remove(l),this._values[a]=s,this._values[o]=void 0;else if(s&&!l)l=this._heap.insert(o,s.value),this._heap.remove(s),this._values[o]=l,this._values[a]=void 0;else if(s&&l){var u=s.value;s.value=l.value,l.value=u}},i},{isClass:!0});function d$(t){var e=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(l){var u=i[l];if(u&&(delete n[u],delete i[l],--e,r===u)){if(!e){a=0,r=1;return}for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return t=Math.abs(t),{hit:function(l){var u=i[l],c=++a;if(n[c]=l,i[l]=c,!u)return++e,e<=t?void 0:(l=n[r],o(l),l);if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:o,clear:function(){e=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Ql(t){var{hasher:e,limit:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return r=r??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function n(){typeof n.cache!="object"&&(n.cache={values:new Map,lru:d$(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var s=t.apply(t,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}var h$=Ql(function(t){return new t(1).exp()},{hasher:mv}),g$=Ql(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},{hasher:mv}),Am=Ql(function(t){return t.acos(-1)},{hasher:mv}),v$=Ql(function(t){return Am(t).times(2)},{hasher:mv});function mv(t){return t[0].precision}function y$(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function AA(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?y$(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y$(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ite="Unit",ate=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],SA=M(ite,ate,t=>{var{on:e,config:r,addScalar:n,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:s,abs:l,fix:u,round:c,equal:f,isNumeric:m,format:p,number:d,Complex:h,BigNumber:x,Fraction:b}=t,T=d;function v(G,Z){if(!(this instanceof v))throw new Error("Constructor must be called with the new operator");if(!(G==null||m(G)||ra(G)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,Z===void 0)this.units=[],this.dimensions=W.map(xe=>0);else if(typeof Z=="string"){var ge=v.parse(Z);this.units=ge.units,this.dimensions=ge.dimensions}else if(bi(Z)&&Z.value===null)this.fixPrefix=Z.fixPrefix,this.skipAutomaticSimplification=Z.skipAutomaticSimplification,this.dimensions=Z.dimensions.slice(0),this.units=Z.units.map(xe=>sn({},xe));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(G)}Object.defineProperty(v,"name",{value:"Unit"}),v.prototype.constructor=v,v.prototype.type="Unit",v.prototype.isUnit=!0;var A,w,y;function E(){for(;y===" "||y==="	";)N()}function D(G){return G>="0"&&G<="9"||G==="."}function _(G){return G>="0"&&G<="9"}function N(){w++,y=A.charAt(w)}function C(G){w=G,y=A.charAt(w)}function B(){var G="",Z=w;if(y==="+"?N():y==="-"&&(G+=y,N()),!D(y))return C(Z),null;if(y==="."){if(G+=y,N(),!_(y))return C(Z),null}else{for(;_(y);)G+=y,N();y==="."&&(G+=y,N())}for(;_(y);)G+=y,N();if(y==="E"||y==="e"){var ge="",xe=w;if(ge+=y,N(),(y==="+"||y==="-")&&(ge+=y,N()),!_(y))return C(xe),G;for(G=G+ge;_(y);)G+=y,N()}return G}function R(){for(var G="";_(y)||v.isValidAlpha(y);)G+=y,N();var Z=G.charAt(0);return v.isValidAlpha(Z)?G:null}function V(G){return y===G?(N(),G):null}v.parse=function(G,Z){if(Z=Z||{},A=G,w=-1,y="",typeof A!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var ge=new v;ge.units=[];var xe=1,Ee=!1;N(),E();var Be=B(),Ve=null;if(Be){if(r.number==="BigNumber")Ve=new x(Be);else if(r.number==="Fraction")try{Ve=new b(Be)}catch{Ve=parseFloat(Be)}else Ve=parseFloat(Be);E(),V("*")?(xe=1,Ee=!0):V("/")&&(xe=-1,Ee=!0)}for(var et=[],St=1;;){for(E();y==="(";)et.push(xe),St*=xe,xe=1,N(),E();var Ye=void 0;if(y){var ur=y;if(Ye=R(),Ye===null)throw new SyntaxError('Unexpected "'+ur+'" in "'+A+'" at index '+w.toString())}else break;var Jt=L(Ye);if(Jt===null)throw new SyntaxError('Unit "'+Ye+'" not found.');var He=xe*St;if(E(),V("^")){E();var at=B();if(at===null)throw new SyntaxError('In "'+G+'", "^" must be followed by a floating-point number');He*=at}ge.units.push({unit:Jt.unit,prefix:Jt.prefix,power:He});for(var Q=0;Q<W.length;Q++)ge.dimensions[Q]+=(Jt.unit.dimensions[Q]||0)*He;for(E();y===")";){if(et.length===0)throw new SyntaxError('Unmatched ")" in "'+A+'" at index '+w.toString());St/=et.pop(),N(),E()}if(Ee=!1,V("*")?(xe=1,Ee=!0):V("/")?(xe=-1,Ee=!0):xe=1,Jt.unit.base){var me=Jt.unit.base.key;se.auto[me]={unit:Jt.unit,prefix:Jt.prefix}}}if(E(),y)throw new SyntaxError('Could not parse: "'+G+'"');if(Ee)throw new SyntaxError('Trailing characters: "'+G+'"');if(et.length!==0)throw new SyntaxError('Unmatched "(" in "'+A+'"');if(ge.units.length===0&&!Z.allowNoUnits)throw new SyntaxError('"'+G+'" contains no units');return ge.value=Ve!==void 0?ge._normalize(Ve):null,ge},v.prototype.clone=function(){var G=new v;G.fixPrefix=this.fixPrefix,G.skipAutomaticSimplification=this.skipAutomaticSimplification,G.value=yt(this.value),G.dimensions=this.dimensions.slice(0),G.units=[];for(var Z=0;Z<this.units.length;Z++){G.units[Z]={};for(var ge in this.units[Z])st(this.units[Z],ge)&&(G.units[Z][ge]=this.units[Z][ge])}return G},v.prototype.valueType=function(){return fr(this.value)},v.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},v.prototype._normalize=function(G){if(G==null||this.units.length===0)return G;for(var Z=G,ge=v._getNumberConverter(fr(G)),xe=0;xe<this.units.length;xe++){var Ee=ge(this.units[xe].unit.value),Be=ge(this.units[xe].prefix.value),Ve=ge(this.units[xe].power);Z=a(Z,s(a(Ee,Be),Ve))}return Z},v.prototype._denormalize=function(G,Z){if(G==null||this.units.length===0)return G;for(var ge=G,xe=v._getNumberConverter(fr(G)),Ee=0;Ee<this.units.length;Ee++){var Be=xe(this.units[Ee].unit.value),Ve=xe(this.units[Ee].prefix.value),et=xe(this.units[Ee].power);ge=o(ge,s(a(Be,Ve),et))}return ge};var L=Ql(G=>{if(st(U,G)){var Z=U[G],ge=Z.prefixes[""];return{unit:Z,prefix:ge}}for(var xe in U)if(st(U,xe)&&$P(G,xe)){var Ee=U[xe],Be=G.length-xe.length,Ve=G.substring(0,Be),et=st(Ee.prefixes,Ve)?Ee.prefixes[Ve]:void 0;if(et!==void 0)return{unit:Ee,prefix:et}}return null},{hasher:G=>G[0],limit:100});v.isValuelessUnit=function(G){return L(G)!==null},v.prototype.hasBase=function(G){if(typeof G=="string"&&(G=O[G]),!G)return!1;for(var Z=0;Z<W.length;Z++)if(Math.abs((this.dimensions[Z]||0)-(G.dimensions[Z]||0))>1e-12)return!1;return!0},v.prototype.equalBase=function(G){for(var Z=0;Z<W.length;Z++)if(Math.abs((this.dimensions[Z]||0)-(G.dimensions[Z]||0))>1e-12)return!1;return!0},v.prototype.equals=function(G){return this.equalBase(G)&&f(this.value,G.value)},v.prototype.multiply=function(G){for(var Z=this.clone(),ge=bi(G)?G:new v(G),xe=0;xe<W.length;xe++)Z.dimensions[xe]=(this.dimensions[xe]||0)+(ge.dimensions[xe]||0);for(var Ee=0;Ee<ge.units.length;Ee++){var Be=AA({},ge.units[Ee]);Z.units.push(Be)}if(this.value!==null||ge.value!==null){var Ve=this.value===null?this._normalize(1):this.value,et=ge.value===null?ge._normalize(1):ge.value;Z.value=a(Ve,et)}else Z.value=null;return bi(G)&&(Z.skipAutomaticSimplification=!1),P(Z)},v.prototype.divideInto=function(G){return new v(G).divide(this)},v.prototype.divide=function(G){for(var Z=this.clone(),ge=bi(G)?G:new v(G),xe=0;xe<W.length;xe++)Z.dimensions[xe]=(this.dimensions[xe]||0)-(ge.dimensions[xe]||0);for(var Ee=0;Ee<ge.units.length;Ee++){var Be=AA(AA({},ge.units[Ee]),{},{power:-ge.units[Ee].power});Z.units.push(Be)}if(this.value!==null||ge.value!==null){var Ve=this.value===null?this._normalize(1):this.value,et=ge.value===null?ge._normalize(1):ge.value;Z.value=o(Ve,et)}else Z.value=null;return bi(G)&&(Z.skipAutomaticSimplification=!1),P(Z)},v.prototype.pow=function(G){for(var Z=this.clone(),ge=0;ge<W.length;ge++)Z.dimensions[ge]=(this.dimensions[ge]||0)*G;for(var xe=0;xe<Z.units.length;xe++)Z.units[xe].power*=G;return Z.value!==null?Z.value=s(Z.value,G):Z.value=null,Z.skipAutomaticSimplification=!1,P(Z)};function P(G){return G.equalBase(O.NONE)&&G.value!==null&&!r.predictable?G.value:G}v.prototype.abs=function(){var G=this.clone();if(G.value!==null)if(G._isDerived()||G.units.length===0||G.units[0].unit.offset===0)G.value=l(G.value);else{var Z=G._numberConverter(),ge=Z(G.units[0].unit.value),xe=Z(G.units[0].unit.offset),Ee=a(ge,xe);G.value=i(l(n(G.value,Ee)),Ee)}for(var Be in G.units)(G.units[Be].unit.name==="VA"||G.units[Be].unit.name==="VAR")&&(G.units[Be].unit=U.W);return G},v.prototype.to=function(G){var Z=this.value===null?this._normalize(1):this.value,ge;if(typeof G=="string")ge=v.parse(G);else if(bi(G))ge=G.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=yt(Z);else{var xe=v._getNumberConverter(fr(Z)),Ee=this.units[0].unit.value,Be=this.units[0].unit.offset,Ve=a(Ee,Be),et=ge.units[0].unit.value,St=ge.units[0].unit.offset,Ye=a(et,St);ge.value=n(Z,xe(i(Ve,Ye)))}return ge.fixPrefix=!0,ge.skipAutomaticSimplification=!0,ge},v.prototype.toNumber=function(G){return T(this.toNumeric(G))},v.prototype.toNumeric=function(G){var Z;return G?Z=this.to(G):Z=this.clone(),Z._isDerived()||Z.units.length===0?Z._denormalize(Z.value):Z._denormalize(Z.value,Z.units[0].prefix.value)},v.prototype.toString=function(){return this.format()},v.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},v.fromJSON=function(G){var Z,ge=new v(G.value,(Z=G.unit)!==null&&Z!==void 0?Z:void 0);return ge.fixPrefix=G.fixPrefix||!1,ge},v.prototype.valueOf=v.prototype.toString,v.prototype.simplify=function(){var G=this.clone(),Z=[],ge;for(var xe in be)if(st(be,xe)&&G.hasBase(O[xe])){ge=xe;break}if(ge==="NONE")G.units=[];else{var Ee;if(ge&&st(be,ge)&&(Ee=be[ge]),Ee)G.units=[{unit:Ee.unit,prefix:Ee.prefix,power:1}];else{for(var Be=!1,Ve=0;Ve<W.length;Ve++){var et=W[Ve];Math.abs(G.dimensions[Ve]||0)>1e-12&&(st(be,et)?Z.push({unit:be[et].unit,prefix:be[et].prefix,power:G.dimensions[Ve]||0}):Be=!0)}Z.length<G.units.length&&!Be&&(G.units=Z)}}return G},v.prototype.toSI=function(){for(var G=this.clone(),Z=[],ge=0;ge<W.length;ge++){var xe=W[ge];if(Math.abs(G.dimensions[ge]||0)>1e-12)if(st(se.si,xe))Z.push({unit:se.si[xe].unit,prefix:se.si[xe].prefix,power:G.dimensions[ge]||0});else throw new Error("Cannot express custom unit "+xe+" in SI units")}return G.units=Z,G.fixPrefix=!0,G.skipAutomaticSimplification=!0,this.value!==null?(G.value=null,this.to(G)):G},v.prototype.formatUnits=function(){for(var G="",Z="",ge=0,xe=0,Ee=0;Ee<this.units.length;Ee++)this.units[Ee].power>0?(ge++,G+=" "+this.units[Ee].prefix.name+this.units[Ee].unit.name,Math.abs(this.units[Ee].power-1)>1e-15&&(G+="^"+this.units[Ee].power)):this.units[Ee].power<0&&xe++;if(xe>0)for(var Be=0;Be<this.units.length;Be++)this.units[Be].power<0&&(ge>0?(Z+=" "+this.units[Be].prefix.name+this.units[Be].unit.name,Math.abs(this.units[Be].power+1)>1e-15&&(Z+="^"+-this.units[Be].power)):(Z+=" "+this.units[Be].prefix.name+this.units[Be].unit.name,Z+="^"+this.units[Be].power));G=G.substr(1),Z=Z.substr(1),ge>1&&xe>0&&(G="("+G+")"),xe>1&&ge>0&&(Z="("+Z+")");var Ve=G;return ge>0&&xe>0&&(Ve+=" / "),Ve+=Z,Ve},v.prototype.format=function(G){var Z=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),ge=!1;typeof Z.value<"u"&&Z.value!==null&&ra(Z.value)&&(ge=Math.abs(Z.value.re)<1e-14);for(var xe in Z.units)st(Z.units,xe)&&Z.units[xe].unit&&(Z.units[xe].unit.name==="VA"&&ge?Z.units[xe].unit=U.VAR:Z.units[xe].unit.name==="VAR"&&!ge&&(Z.units[xe].unit=U.VA));Z.units.length===1&&!Z.fixPrefix&&Math.abs(Z.units[0].power-Math.round(Z.units[0].power))<1e-14&&(Z.units[0].prefix=Z._bestPrefix());var Ee=Z._denormalize(Z.value),Be=Z.value!==null?p(Ee,G||{}):"",Ve=Z.formatUnits();return Z.value&&ra(Z.value)&&(Be="("+Be+")"),Ve.length>0&&Be.length>0&&(Be+=" "),Be+=Ve,Be},v.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 G=this.value!==null?l(this.value):0,Z=l(this.units[0].unit.value),ge=this.units[0].prefix;if(G===0)return ge;var xe=this.units[0].power,Ee=Math.log(G/Math.pow(ge.value*Z,xe))/Math.LN10-1.2;if(Ee>-2.200001&&Ee<1.800001)return ge;Ee=Math.abs(Ee);var Be=this.units[0].unit.prefixes;for(var Ve in Be)if(st(Be,Ve)){var et=Be[Ve];if(et.scientific){var St=Math.abs(Math.log(G/Math.pow(et.value*Z,xe))/Math.LN10-1.2);(St<Ee||St===Ee&&et.name.length<ge.name.length)&&(ge=et,Ee=St)}}return ge},v.prototype.splitUnit=function(G){for(var Z=this.clone(),ge=[],xe=0;xe<G.length&&(Z=Z.to(G[xe]),xe!==G.length-1);xe++){var Ee=Z.toNumeric(),Be=c(Ee),Ve=void 0,et=f(Be,Ee);et?Ve=Be:Ve=u(Z.toNumeric());var St=new v(Ve,G[xe].toString());ge.push(St),Z=i(Z,St)}for(var Ye=0,ur=0;ur<ge.length;ur++)Ye=n(Ye,ge[ur].value);return f(Ye,this.value)&&(Z.value=0),ge.push(Z),ge};var k={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}}};k.SHORTLONG=sn({},k.SHORT,k.LONG),k.BINARY_SHORT=sn({},k.BINARY_SHORT_SI,k.BINARY_SHORT_IEC),k.BINARY_LONG=sn({},k.BINARY_LONG_SI,k.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 X in O)st(O,X)&&(O[X].key=X);var ae={},J={name:"",base:ae,value:1,offset:0,dimensions:W.map(G=>0)},U={meter:{name:"meter",base:O.LENGTH,prefixes:k.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:k.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:k.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:k.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:k.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:k.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:k.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:k.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:k.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:k.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:k.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:k.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:k.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:k.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:k.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:k.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:k.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:k.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:k.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:k.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:k.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:k.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:k.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:k.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:k.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:k.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:k.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:k.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:k.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:k.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:k.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:k.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:k.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:k.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:k.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:k.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:k.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:k.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:k.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:k.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:k.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:k.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:k.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:k.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:k.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:k.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:k.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:k.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:k.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:k.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:k.NONE,value:.238480942392,offset:0},g:{name:"g",base:O.MASS,prefixes:k.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:k.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:k.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:k.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:k.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:k.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:k.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:k.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:k.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:k.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:k.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:k.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:k.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:k.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:k.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:k.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:k.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:k.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:k.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:k.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:k.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:k.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:k.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:k.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:k.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:k.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:k.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:k.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:k.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:k.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:k.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:k.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:k.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:k.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:k.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:k.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:k.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:k.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:k.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:k.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:k.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:k.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:k.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:k.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:k.SHORT,value:new b(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:k.SHORT,value:new b(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:k.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:k.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:k.LONG,value:new b(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:k.LONG,value:new b(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:k.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:k.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:k.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:k.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:k.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:k.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:k.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:k.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:k.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:k.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:k.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:k.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:k.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:k.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:k.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:k.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:k.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:k.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:k.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:k.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:k.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:k.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:k.SHORT,value:h.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:k.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:k.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:k.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:k.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:k.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:k.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:k.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:k.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:k.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:k.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:k.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:k.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:k.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:k.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:k.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:k.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:k.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:k.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:k.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:k.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:k.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:k.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:k.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:k.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:k.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:k.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:k.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:k.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",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",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 we(G){if(G.number==="BigNumber"){var Z=Am(x);U.rad.value=new x(1),U.deg.value=Z.div(180),U.grad.value=Z.div(200),U.cycle.value=Z.times(2),U.arcsec.value=Z.div(648e3),U.arcmin.value=Z.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}we(r),e&&e("config",function(G,Z){G.number!==Z.number&&we(G)});var se={si:{NONE:{unit:J,prefix:k.NONE[""]},LENGTH:{unit:U.m,prefix:k.SHORT[""]},MASS:{unit:U.g,prefix:k.SHORT.k},TIME:{unit:U.s,prefix:k.SHORT[""]},CURRENT:{unit:U.A,prefix:k.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:k.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:k.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:k.SHORT[""]},ANGLE:{unit:U.rad,prefix:k.SHORT[""]},BIT:{unit:U.bits,prefix:k.SHORT[""]},FORCE:{unit:U.N,prefix:k.SHORT[""]},ENERGY:{unit:U.J,prefix:k.SHORT[""]},POWER:{unit:U.W,prefix:k.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:k.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:k.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:k.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:k.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:k.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:k.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:k.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:k.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:k.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:k.SHORT[""]}}};se.cgs=JSON.parse(JSON.stringify(se.si)),se.cgs.LENGTH={unit:U.m,prefix:k.SHORT.c},se.cgs.MASS={unit:U.g,prefix:k.SHORT[""]},se.cgs.FORCE={unit:U.dyn,prefix:k.SHORT[""]},se.cgs.ENERGY={unit:U.erg,prefix:k.NONE[""]},se.us=JSON.parse(JSON.stringify(se.si)),se.us.LENGTH={unit:U.ft,prefix:k.NONE[""]},se.us.MASS={unit:U.lbm,prefix:k.NONE[""]},se.us.TEMPERATURE={unit:U.degF,prefix:k.NONE[""]},se.us.FORCE={unit:U.lbf,prefix:k.NONE[""]},se.us.ENERGY={unit:U.BTU,prefix:k.BTU[""]},se.us.POWER={unit:U.hp,prefix:k.NONE[""]},se.us.PRESSURE={unit:U.psi,prefix:k.NONE[""]},se.auto=JSON.parse(JSON.stringify(se.si));var be=se.auto;v.setUnitSystem=function(G){if(st(se,G))be=se[G];else throw new Error("Unit system "+G+" does not exist. Choices are: "+Object.keys(se).join(", "))},v.getUnitSystem=function(){for(var G in se)if(st(se,G)&&se[G]===be)return G},v.typeConverters={BigNumber:function(Z){return Z!=null&&Z.isFraction?new x(String(Z.n)).div(String(Z.d)).times(String(Z.s)):new x(Z+"")},Fraction:function(Z){return new b(Z)},Complex:function(Z){return Z},number:function(Z){return Z!=null&&Z.isFraction?d(Z):Z}},v.prototype._numberConverter=function(){var G=v.typeConverters[this.valueType()];if(G)return G;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},v._getNumberConverter=function(G){if(!v.typeConverters[G])throw new TypeError('Unsupported type "'+G+'"');return v.typeConverters[G]};for(var K in U)if(st(U,K)){var j=U[K];j.dimensions=j.base.dimensions}for(var ne in de)if(st(de,ne)){var pe=U[de[ne]],fe={};for(var Ae in pe)st(pe,Ae)&&(fe[Ae]=pe[Ae]);fe.name=ne,U[ne]=fe}v.isValidAlpha=function(Z){return/^[a-zA-Z]$/.test(Z)};function _e(G){for(var Z=0;Z<G.length;Z++){if(y=G.charAt(Z),Z===0&&!v.isValidAlpha(y))throw new Error('Invalid unit name (must begin with alpha character): "'+G+'"');if(Z>0&&!(v.isValidAlpha(y)||_(y)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+G+'"')}}return v.createUnit=function(G,Z){if(typeof G!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(Z&&Z.override){for(var ge in G)if(st(G,ge)&&v.deleteUnit(ge),G[ge].aliases)for(var xe=0;xe<G[ge].aliases.length;xe++)v.deleteUnit(G[ge].aliases[xe])}var Ee;for(var Be in G)st(G,Be)&&(Ee=v.createUnitSingle(Be,G[Be]));return Ee},v.createUnitSingle=function(G,Z){if((typeof Z>"u"||Z===null)&&(Z={}),typeof G!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(st(U,G))throw new Error('Cannot create unit "'+G+'": a unit with that name already exists');_e(G);var ge=null,xe=[],Ee=0,Be,Ve,et;if(Z&&Z.type==="Unit")ge=Z.clone();else if(typeof Z=="string")Z!==""&&(Be=Z);else if(typeof Z=="object")Be=Z.definition,Ve=Z.prefixes,Ee=Z.offset,et=Z.baseName,Z.aliases&&(xe=Z.aliases.valueOf());else throw new TypeError('Cannot create unit "'+G+'" from "'+Z.toString()+'": expecting "string" or "Unit" or "Object"');if(xe){for(var St=0;St<xe.length;St++)if(st(U,xe[St]))throw new Error('Cannot create alias "'+xe[St]+'": a unit with that name already exists')}if(Be&&typeof Be=="string"&&!ge)try{ge=v.parse(Be,{allowNoUnits:!0})}catch(Y){throw Y.message='Could not create unit "'+G+'" from "'+Be+'": '+Y.message,Y}else Be&&Be.type==="Unit"&&(ge=Be.clone());xe=xe||[],Ee=Ee||0,Ve&&Ve.toUpperCase?Ve=k[Ve.toUpperCase()]||k.NONE:Ve=k.NONE;var Ye={};if(ge){Ye={name:G,value:ge.value,dimensions:ge.dimensions.slice(0),prefixes:Ve,offset:Ee};var at=!1;for(var Q in O)if(st(O,Q)){for(var me=!0,he=0;he<W.length;he++)if(Math.abs((Ye.dimensions[he]||0)-(O[Q].dimensions[he]||0))>1e-12){me=!1;break}if(me){at=!0,Ye.base=O[Q];break}}if(!at){et=et||G+"_STUFF";var Fe={dimensions:ge.dimensions.slice(0)};Fe.key=et,O[et]=Fe,be[et]={unit:Ye,prefix:k.NONE[""]},Ye.base=O[et]}}else{if(et=et||G+"_STUFF",W.indexOf(et)>=0)throw new Error('Cannot create new base unit "'+G+'": a base unit with that name already exists (and cannot be overridden)');W.push(et);for(var ur in O)st(O,ur)&&(O[ur].dimensions[W.length-1]=0);for(var Jt={dimensions:[]},He=0;He<W.length;He++)Jt.dimensions[He]=0;Jt.dimensions[W.length-1]=1,Jt.key=et,O[et]=Jt,Ye={name:G,value:1,dimensions:O[et].dimensions.slice(0),prefixes:Ve,offset:Ee,base:O[et]},be[et]={unit:Ye,prefix:k.NONE[""]}}v.UNITS[G]=Ye;for(var ke=0;ke<xe.length;ke++){var Se=xe[ke],Xe={};for(var F in Ye)st(Ye,F)&&(Xe[F]=Ye[F]);Xe.name=Se,v.UNITS[Se]=Xe}return delete L.cache,new v(null,G)},v.deleteUnit=function(G){delete v.UNITS[G],delete L.cache},v.PREFIXES=k,v.BASE_DIMENSIONS=W,v.BASE_UNITS=O,v.UNIT_SYSTEMS=se,v.UNITS=U,v},{isClass:!0});var x$="unit",ote=["typed","Unit"],EA=M(x$,ote,t=>{var{typed:e,Unit:r}=t;return e(x$,{Unit:function(i){return i.clone()},string:function(i){return r.isValuelessUnit(i)?new r(null,i):r.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new r(i,a)},"number | BigNumber | Fraction":function(i){return new r(i)},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var b$="sparse",ste=["typed","SparseMatrix"],TA=M(b$,ste,t=>{var{typed:e,SparseMatrix:r}=t;return e(b$,{"":function(){return new r([])},string:function(i){return new r([],i)},"Array | Matrix":function(i){return new r(i)},"Array | Matrix, string":function(i,a){return new r(i,a)}})});var w$="createUnit",ute=["typed","Unit"],DA=M(w$,ute,t=>{var{typed:e,Unit:r}=t;return e(w$,{"Object, Object":function(i,a){return r.createUnit(i,a)},Object:function(i){return r.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var s={};return s[i]=a,r.createUnit(s,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,r.createUnit(o,{})},string:function(i){var a={};return a[i]={},r.createUnit(a,{})}})});var _$="acos",lte=["typed","config","Complex"],MA=M(_$,lte,t=>{var{typed:e,config:r,Complex:n}=t;return e(_$,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.acos(a):new n(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var A$="acosh",cte=["typed","config","Complex"],CA=M(A$,cte,t=>{var{typed:e,config:r,Complex:n}=t;return e(A$,{number:function(a){return a>=1||r.predictable?qw(a):a<=-1?new n(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new n(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var S$="acot",fte=["typed","BigNumber"],NA=M(S$,fte,t=>{var{typed:e,BigNumber:r}=t;return e(S$,{number:zw,Complex:function(i){return i.acot()},BigNumber:function(i){return new r(1).div(i).atan()}})});var E$="acoth",pte=["typed","config","Complex","BigNumber"],FA=M(E$,pte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(E$,{number:function(o){return o>=1||o<=-1||r.predictable?Hw(o):new n(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var T$="acsc",mte=["typed","config","Complex","BigNumber"],IA=M(T$,mte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(T$,{number:function(o){return o<=-1||o>=1||r.predictable?Gw(o):new n(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var D$="acsch",dte=["typed","BigNumber"],PA=M(D$,dte,t=>{var{typed:e,BigNumber:r}=t;return e(D$,{number:Ww,Complex:function(i){return i.acsch()},BigNumber:function(i){return new r(1).div(i).asinh()}})});var M$="asec",hte=["typed","config","Complex","BigNumber"],BA=M(M$,hte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(M$,{number:function(o){return o<=-1||o>=1||r.predictable?Yw(o):new n(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var C$="asech",gte=["typed","config","Complex","BigNumber"],kA=M(C$,gte,t=>{var{typed:e,config:r,Complex:n,BigNumber:i}=t;return e(C$,{number:function(o){if(o<=1&&o>=-1||r.predictable){var s=1/o;if(s>0||r.predictable)return jw(o);var l=Math.sqrt(s*s-1);return new n(Math.log(l-s),Math.PI)}return new n(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var N$="asin",vte=["typed","config","Complex"],$A=M(N$,vte,t=>{var{typed:e,config:r,Complex:n}=t;return e(N$,{number:function(a){return a>=-1&&a<=1||r.predictable?Math.asin(a):new n(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var yte="asinh",xte=["typed"],OA=M(yte,xte,t=>{var{typed:e}=t;return e("asinh",{number:Zw,Complex:function(n){return n.asinh()},BigNumber:function(n){return n.asinh()}})});var bte="atan",wte=["typed"],RA=M(bte,wte,t=>{var{typed:e}=t;return e("atan",{number:function(n){return Math.atan(n)},Complex:function(n){return n.atan()},BigNumber:function(n){return n.atan()}})});var F$="atan2",_te=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],LA=M(F$,_te,t=>{var{typed:e,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=t,s=In({typed:e,equalScalar:n}),l=jr({typed:e}),u=tv({typed:e,equalScalar:n}),c=Pr({typed:e,equalScalar:n}),f=wr({typed:e,DenseMatrix:a}),m=Pt({typed:e,matrix:r,concat:o});return e(F$,{"number, number":Math.atan2,"BigNumber, BigNumber":(p,d)=>i.atan2(p,d)},m({scalar:"number | BigNumber",SS:u,DS:l,SD:s,Ss:c,sS:f}))});var I$="atanh",Ate=["typed","config","Complex"],VA=M(I$,Ate,t=>{var{typed:e,config:r,Complex:n}=t;return e(I$,{number:function(a){return a<=1&&a>=-1||r.predictable?Jw(a):new n(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var Ao=M("trigUnit",["typed"],t=>{var{typed:e}=t;return{Unit:e.referToSelf(r=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(r,n.valueType())(n.value)})}});var P$="cos",Ste=["typed"],UA=M(P$,Ste,t=>{var{typed:e}=t,r=Ao({typed:e});return e(P$,{number:Math.cos,"Complex | BigNumber":n=>n.cos()},r)});var B$="cosh",Ete=["typed"],qA=M(B$,Ete,t=>{var{typed:e}=t;return e(B$,{number:Ig,"Complex | BigNumber":r=>r.cosh()})});var k$="cot",Tte=["typed","BigNumber"],zA=M(k$,Tte,t=>{var{typed:e,BigNumber:r}=t,n=Ao({typed:e});return e(k$,{number:Xw,Complex:i=>i.cot(),BigNumber:i=>new r(1).div(i.tan())},n)});var $$="coth",Dte=["typed","BigNumber"],HA=M($$,Dte,t=>{var{typed:e,BigNumber:r}=t;return e($$,{number:Qw,Complex:n=>n.coth(),BigNumber:n=>new r(1).div(n.tanh())})});var O$="csc",Mte=["typed","BigNumber"],GA=M(O$,Mte,t=>{var{typed:e,BigNumber:r}=t,n=Ao({typed:e});return e(O$,{number:Kw,Complex:i=>i.csc(),BigNumber:i=>new r(1).div(i.sin())},n)});var R$="csch",Cte=["typed","BigNumber"],WA=M(R$,Cte,t=>{var{typed:e,BigNumber:r}=t;return e(R$,{number:e_,Complex:n=>n.csch(),BigNumber:n=>new r(1).div(n.sinh())})});var L$="sec",Nte=["typed","BigNumber"],YA=M(L$,Nte,t=>{var{typed:e,BigNumber:r}=t,n=Ao({typed:e});return e(L$,{number:t_,Complex:i=>i.sec(),BigNumber:i=>new r(1).div(i.cos())},n)});var V$="sech",Fte=["typed","BigNumber"],jA=M(V$,Fte,t=>{var{typed:e,BigNumber:r}=t;return e(V$,{number:r_,Complex:n=>n.sech(),BigNumber:n=>new r(1).div(n.cosh())})});var U$="sin",Ite=["typed"],ZA=M(U$,Ite,t=>{var{typed:e}=t,r=Ao({typed:e});return e(U$,{number:Math.sin,"Complex | BigNumber":n=>n.sin()},r)});var q$="sinh",Pte=["typed"],JA=M(q$,Pte,t=>{var{typed:e}=t;return e(q$,{number:n_,"Complex | BigNumber":r=>r.sinh()})});var z$="tan",Bte=["typed"],XA=M(z$,Bte,t=>{var{typed:e}=t,r=Ao({typed:e});return e(z$,{number:Math.tan,"Complex | BigNumber":n=>n.tan()},r)});var kte="tanh",$te=["typed"],QA=M(kte,$te,t=>{var{typed:e}=t;return e("tanh",{number:Pg,"Complex | BigNumber":r=>r.tanh()})});var H$="setCartesian",Ote=["typed","size","subset","compareNatural","Index","DenseMatrix"],KA=M(H$,Ote,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(H$,{"Array | Matrix, Array | Matrix":function(l,u){var c=[];if(n(r(l),new a(0))!==0&&n(r(u),new a(0))!==0){var f=Rt(Array.isArray(l)?l:l.toArray()).sort(i),m=Rt(Array.isArray(u)?u:u.toArray()).sort(i);c=[];for(var p=0;p<f.length;p++)for(var d=0;d<m.length;d++)c.push([f[p],m[d]])}return Array.isArray(l)&&Array.isArray(u)?c:new o(c)}})});var G$="setDifference",Rte=["typed","size","subset","compareNatural","Index","DenseMatrix"],eS=M(G$,Rte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(G$,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0)c=[];else{if(n(r(u),new a(0))===0)return Rt(l.toArray());var f=Ks(Rt(Array.isArray(l)?l:l.toArray()).sort(i)),m=Ks(Rt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p,d=0;d<f.length;d++){p=!1;for(var h=0;h<m.length;h++)if(i(f[d].value,m[h].value)===0&&f[d].identifier===m[h].identifier){p=!0;break}p||c.push(f[d])}}return Array.isArray(l)&&Array.isArray(u)?bf(c):new o(bf(c))}})});var W$="setDistinct",Lte=["typed","size","subset","compareNatural","Index","DenseMatrix"],tS=M(W$,Lte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(W$,{"Array | Matrix":function(l){var u;if(n(r(l),new a(0))===0)u=[];else{var c=Rt(Array.isArray(l)?l:l.toArray()).sort(i);u=[],u.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&u.push(c[f])}return Array.isArray(l)?u:new o(u)}})});var Y$="setIntersect",Vte=["typed","size","subset","compareNatural","Index","DenseMatrix"],rS=M(Y$,Vte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=t;return e(Y$,{"Array | Matrix, Array | Matrix":function(l,u){var c;if(n(r(l),new a(0))===0||n(r(u),new a(0))===0)c=[];else{var f=Ks(Rt(Array.isArray(l)?l:l.toArray()).sort(i)),m=Ks(Rt(Array.isArray(u)?u:u.toArray()).sort(i));c=[];for(var p=0;p<f.length;p++)for(var d=0;d<m.length;d++)if(i(f[p].value,m[d].value)===0&&f[p].identifier===m[d].identifier){c.push(f[p]);break}}return Array.isArray(l)&&Array.isArray(u)?bf(c):new o(bf(c))}})});var j$="setIsSubset",Ute=["typed","size","subset","compareNatural","Index"],nS=M(j$,Ute,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(j$,{"Array | Matrix, Array | Matrix":function(s,l){if(n(r(s),new a(0))===0)return!0;if(n(r(l),new a(0))===0)return!1;for(var u=Ks(Rt(Array.isArray(s)?s:s.toArray()).sort(i)),c=Ks(Rt(Array.isArray(l)?l:l.toArray()).sort(i)),f,m=0;m<u.length;m++){f=!1;for(var p=0;p<c.length;p++)if(i(u[m].value,c[p].value)===0&&u[m].identifier===c[p].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var Z$="setMultiplicity",qte=["typed","size","subset","compareNatural","Index"],iS=M(Z$,qte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(Z$,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(s,l){if(n(r(l),new a(0))===0)return 0;for(var u=Rt(Array.isArray(l)?l:l.toArray()),c=0,f=0;f<u.length;f++)i(u[f],s)===0&&c++;return c}})});var J$="setPowerset",zte=["typed","size","subset","compareNatural","Index"],aS=M(J$,zte,t=>{var{typed:e,size:r,subset:n,compareNatural:i,Index:a}=t;return e(J$,{"Array | Matrix":function(u){if(n(r(u),new a(0))===0)return[];for(var c=Rt(Array.isArray(u)?u:u.toArray()).sort(i),f=[],m=0;m.toString(2).length<=c.length;)f.push(o(c,m.toString(2).split("").reverse())),m++;return s(f)}});function o(l,u){for(var c=[],f=0;f<u.length;f++)u[f]==="1"&&c.push(l[f]);return c}function s(l){for(var u=[],c=l.length-1;c>0;c--)for(var f=0;f<c;f++)l[f].length>l[f+1].length&&(u=l[f],l[f]=l[f+1],l[f+1]=u);return l}});var X$="setSize",Hte=["typed","compareNatural"],oS=M(X$,Hte,t=>{var{typed:e,compareNatural:r}=t;return e(X$,{"Array | Matrix":function(i){return Array.isArray(i)?Rt(i).length:Rt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?Rt(i).length:Rt(i.toArray()).length;for(var o=Rt(Array.isArray(i)?i:i.toArray()).sort(r),s=1,l=1;l<o.length;l++)r(o[l],o[l-1])!==0&&s++;return s}})});var Q$="setSymDifference",Gte=["typed","size","concat","subset","setDifference","Index"],sS=M(Q$,Gte,t=>{var{typed:e,size:r,concat:n,subset:i,setDifference:a,Index:o}=t;return e(Q$,{"Array | Matrix, Array | Matrix":function(l,u){if(i(r(l),new o(0))===0)return Rt(u);if(i(r(u),new o(0))===0)return Rt(l);var c=Rt(l),f=Rt(u);return n(a(c,f),a(f,c))}})});var K$="setUnion",Wte=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],uS=M(K$,Wte,t=>{var{typed:e,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=t;return e(K$,{"Array | Matrix, Array | Matrix":function(u,c){if(i(r(u),new s(0))===0)return Rt(c);if(i(r(c),new s(0))===0)return Rt(u);var f=Rt(u),m=Rt(c);return n(o(f,m),a(f,m))}})});var eO="add",Yte=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],lS=M(eO,Yte,t=>{var{typed:e,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=t,l=Ri({typed:e}),u=Ef({typed:e,equalScalar:i}),c=Sa({typed:e,DenseMatrix:a}),f=Pt({typed:e,matrix:r,concat:s});return e(eO,{"any, any":n,"any, any, ...any":e.referToSelf(m=>(p,d,h)=>{for(var x=m(p,d),b=0;b<h.length;b++)x=m(x,h[b]);return x})},f({elop:n,DS:l,SS:u,Ss:c}))});var tO="hypot",jte=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],cS=M(tO,jte,t=>{var{typed:e,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:l}=t;return e(tO,{"... number | BigNumber":u,Array:u,Matrix:c=>u(Rt(c.toArray()))});function u(c){for(var f=0,m=0,p=0;p<c.length;p++){if(ra(c[p]))throw new TypeError("Unexpected type of argument to hypot");var d=r(c[p]);s(m,d)?(f=a(f,a(i(m,d),i(m,d))),f=n(f,1),m=d):f=n(f,l(d)?a(i(d,m),i(d,m)):d)}return a(m,o(f))}});var rO="norm",Zte=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],fS=M(rO,Zte,t=>{var{typed:e,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:l,larger:u,smaller:c,matrix:f,ctranspose:m,eigs:p}=t;return e(rO,{number:Math.abs,Complex:function(D){return D.abs()},BigNumber:function(D){return D.abs()},boolean:function(D){return Math.abs(D)},Array:function(D){return y(f(D),2)},Matrix:function(D){return y(D,2)},"Array, number | BigNumber | string":function(D,_){return y(f(D),_)},"Matrix, number | BigNumber | string":function(D,_){return y(D,_)}});function d(E){var D=0;return E.forEach(function(_){var N=r(_);u(N,D)&&(D=N)},!0),D}function h(E){var D;return E.forEach(function(_){var N=r(_);(!D||c(N,D))&&(D=N)},!0),D||0}function x(E,D){if(D===Number.POSITIVE_INFINITY||D==="inf")return d(E);if(D===Number.NEGATIVE_INFINITY||D==="-inf")return h(E);if(D==="fro")return y(E,2);if(typeof D=="number"&&!isNaN(D)){if(!l(D,0)){var _=0;return E.forEach(function(N){_=n(i(r(N),D),_)},!0),i(_,1/D)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function b(E){var D=0;return E.forEach(function(_,N){D=n(D,s(_,a(_)))}),r(o(D))}function T(E){var D=[],_=0;return E.forEach(function(N,C){var B=C[1],R=n(D[B]||0,r(N));u(R,_)&&(_=R),D[B]=R},!0),_}function v(E){var D=E.size();if(D[0]!==D[1])throw new RangeError("Invalid matrix dimensions");var _=m(E),N=s(_,E),C=p(N).values.toArray(),B=C[C.length-1];return r(o(B))}function A(E){var D=[],_=0;return E.forEach(function(N,C){var B=C[0],R=n(D[B]||0,r(N));u(R,_)&&(_=R),D[B]=R},!0),_}function w(E,D){if(D===1)return T(E);if(D===Number.POSITIVE_INFINITY||D==="inf")return A(E);if(D==="fro")return b(E);if(D===2)return v(E);throw new Error("Unsupported parameter value "+D)}function y(E,D){var _=E.size();if(_.length===1)return x(E,D);if(_.length===2){if(_[0]&&_[1])return w(E,D);throw new RangeError("Invalid matrix dimensions")}}});var nO="dot",Jte=["typed","addScalar","multiplyScalar","conj","size"],pS=M(nO,Jte,t=>{var{typed:e,addScalar:r,multiplyScalar:n,conj:i,size:a}=t;return e(nO,{"Array | DenseMatrix, Array | DenseMatrix":s,"SparseMatrix, SparseMatrix":l});function o(c,f){var m=u(c),p=u(f),d,h;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(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(d!==h)throw new RangeError("Vectors must have equal length ("+d+" != "+h+")");if(d===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return d}function s(c,f){var m=o(c,f),p=rt(c)?c._data:c,d=rt(c)?c._datatype||c.getDataType():void 0,h=rt(f)?f._data:f,x=rt(f)?f._datatype||f.getDataType():void 0,b=u(c).length===2,T=u(f).length===2,v=r,A=n;if(d&&x&&d===x&&typeof d=="string"&&d!=="mixed"){var w=d;v=e.find(r,[w,w]),A=e.find(n,[w,w])}if(!b&&!T){for(var y=A(i(p[0]),h[0]),E=1;E<m;E++)y=v(y,A(i(p[E]),h[E]));return y}if(!b&&T){for(var D=A(i(p[0]),h[0][0]),_=1;_<m;_++)D=v(D,A(i(p[_]),h[_][0]));return D}if(b&&!T){for(var N=A(i(p[0][0]),h[0]),C=1;C<m;C++)N=v(N,A(i(p[C][0]),h[C]));return N}if(b&&T){for(var B=A(i(p[0][0]),h[0][0]),R=1;R<m;R++)B=v(B,A(i(p[R][0]),h[R][0]));return B}}function l(c,f){o(c,f);for(var m=c._index,p=c._values,d=f._index,h=f._values,x=0,b=r,T=n,v=0,A=0;v<m.length&&A<d.length;){var w=m[v],y=d[A];if(w<y){v++;continue}if(w>y){A++;continue}w===y&&(x=b(x,T(p[v],h[A])),v++,A++)}return x}function u(c){return rt(c)?c.size():a(c)}});var Xte="trace",Qte=["typed","matrix","add"],mS=M(Xte,Qte,t=>{var{typed:e,matrix:r,add:n}=t;return e("trace",{Array:function(s){return i(r(s))},SparseMatrix:a,DenseMatrix:i,any:yt});function i(o){var s=o._size,l=o._data;switch(s.length){case 1:if(s[0]===1)return yt(l[0]);throw new RangeError("Matrix must be square (size: "+Dt(s)+")");case 2:{var u=s[0],c=s[1];if(u===c){for(var f=0,m=0;m<u;m++)f=n(f,l[m][m]);return f}else throw new RangeError("Matrix must be square (size: "+Dt(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(s)+")")}}function a(o){var s=o._values,l=o._index,u=o._ptr,c=o._size,f=c[0],m=c[1];if(f===m){var p=0;if(s.length>0)for(var d=0;d<m;d++)for(var h=u[d],x=u[d+1],b=h;b<x;b++){var T=l[b];if(T===d){p=n(p,s[b]);break}if(T>d)break}return p}throw new RangeError("Matrix must be square (size: "+Dt(c)+")")}});var iO="index",Kte=["typed","Index"],dS=M(iO,Kte,t=>{var{typed:e,Index:r}=t;return e(iO,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(s){return ft(s)?s.toNumber():vr(s)||rt(s)?s.map(function(l){return ft(l)?l.toNumber():l}):s}),o=new r;return r.apply(o,a),o}})});var dv=new Set(["end"]);var ere="Node",tre=["mathWithTransform"],hS=M(ere,tre,t=>{var{mathWithTransform:e}=t;function r(i){for(var a of[...dv])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class n{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(e,{}),o={},s=null;function l(u){var c=Zs(u);return r(c),a(c,o,s)}return{evaluate:l}}_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(!nr(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(s,l){s.forEach(function(u,c,f){l(u,c,f),o(u,l)})}o(this,a)}transform(a){function o(s,l,u){var c=a(s,l,u);return c!==s?c:s.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(s,l,u){a(s,l,u)&&o.push(s)}),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&&ba(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 n},{isClass:!0,isNode:!0});function Zr(t){return t&&t.isIndexError?new Si(t.index+1,t.min+1,t.max!==void 0?t.max+1:void 0):t}function hv(t){var{subset:e}=t;return function(n,i){try{if(Array.isArray(n))return e(n,i);if(n&&typeof n.subset=="function")return n.subset(i);if(typeof n=="string")return e(n,i);if(typeof n=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return rn(n,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Zr(a)}}}var gv="AccessorNode",rre=["subset","Node"],gS=M(gv,rre,t=>{var{subset:e,Node:r}=t,n=hv({subset:e});function i(o){return!(Ha(o)||wi(o)||Ht(o)||na(o)||Ou(o)||_i(o)||Gr(o))}class a extends r{constructor(s,l){if(super(),!nr(s))throw new TypeError('Node expected for parameter "object"');if(!go(l))throw new TypeError('IndexNode expected for parameter "index"');this.object=s,this.index=l}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return gv}get isAccessorNode(){return!0}_compile(s,l){var u=this.object._compile(s,l),c=this.index._compile(s,l);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(p,d,h){return rn(u(p,d,h),f)}}else return function(p,d,h){var x=u(p,d,h),b=c(p,d,x);return n(x,b)}}forEach(s){s(this.object,"object",this),s(this.index,"index",this)}map(s){return new a(this._ifNode(s(this.object,"object",this)),this._ifNode(s(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(s){var l=this.object.toString(s);return i(this.object)&&(l="("+l+")"),l+this.index.toString(s)}_toHTML(s){var l=this.object.toHTML(s);return i(this.object)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+this.index.toHTML(s)}_toTex(s){var l=this.object.toTex(s);return i(this.object)&&(l="\\left(' + object + '\\right)"),l+this.index.toTex(s)}toJSON(){return{mathjs:gv,object:this.object,index:this.index}}static fromJSON(s){return new a(s.object,s.index)}}return Er(a,"name",gv),a},{isClass:!0,isNode:!0});var vv="ArrayNode",nre=["Node"],vS=M(vv,nre,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(nr))throw new TypeError("Array containing Nodes expected")}get type(){return vv}get isArrayNode(){return!0}_compile(i,a){var o=xo(this.items,function(u){return u._compile(i,a)}),s=i.config.matrix!=="Array";if(s){var l=i.matrix;return function(c,f,m){return l(xo(o,function(p){return p(c,f,m)}))}}else return function(c,f,m){return xo(o,function(p){return p(c,f,m)})}}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 r(a)}clone(){return new r(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:vv,items:this.items}}static fromJSON(i){return new r(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,s){var l=o.some(wi)&&!o.every(wi),u=s||l,c=u?"&":"\\\\",f=o.map(function(m){return m.items?a(m.items,!s):m.toTex(i)}).join(c);return l||!u||u&&!s?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return Er(r,"name",vv),r},{isClass:!0,isNode:!0});function aO(t){var{subset:e,matrix:r}=t;return function(i,a,o){try{if(Array.isArray(i)){var s=r(i).subset(a,o).valueOf();return s.forEach((l,u)=>{i[u]=l}),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 ps(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(l){throw Zr(l)}}}var So=[{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 yv(t,e){if(!e||e!=="auto")return t;for(var r=t;_i(r);)r=r.content;return r}function Mr(t,e,r,n){var i=t;e!=="keep"&&(i=t.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<So.length;s++)if(a in So[s]){o=s;break}if(a==="OperatorNode:multiply"&&i.implicit&&r!=="show"){var l=yv(i.args[0],e);!(Ht(l)&&n&&n.getIdentifier()==="OperatorNode:divide"&&Yp(yv(n.args[0],e)))&&!(l.getIdentifier()==="OperatorNode:divide"&&Yp(yv(l.args[0],e))&&Ht(yv(l.args[1])))&&(o+=1)}return o}function If(t,e){var r=t;e!=="keep"&&(r=t.getContent());var n=r.getIdentifier(),i=Mr(r,e);if(i===null)return null;var a=So[i][n];if(st(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function xv(t,e,r){var n=r!=="keep"?t.getContent():t,i=r!=="keep"?t.getContent():e,a=n.getIdentifier(),o=i.getIdentifier(),s=Mr(n,r);if(s===null)return null;var l=So[s][a];if(st(l,"associativeWith")&&l.associativeWith instanceof Array){for(var u=0;u<l.associativeWith.length;u++)if(l.associativeWith[u]===o)return!0;return!1}return null}function oO(t){var e="OperatorNode:"+t;for(var r of So)if(e in r)return r[e].op;return null}var bv="AssignmentNode",ire=["subset","?matrix","Node"],yS=M(bv,ire,t=>{var{subset:e,matrix:r,Node:n}=t,i=hv({subset:e}),a=aO({subset:e,matrix:r});function o(l,u,c){u||(u="keep");var f=Mr(l,u,c),m=Mr(l.value,u,c);return u==="all"||m!==null&&m<=f}class s extends n{constructor(u,c,f){if(super(),this.object=u,this.index=f?c:null,this.value=f||c,!Gr(u)&&!Ha(u))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Gr(u)&&u.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!go(this.index))throw new TypeError('IndexNode expected as "index"');if(!nr(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 bv}get isAssignmentNode(){return!0}_compile(u,c){var f=this.object._compile(u,c),m=this.index?this.index._compile(u,c):null,p=this.value._compile(u,c),d=this.object.name;if(this.index)if(this.index.isObjectProperty()){var h=this.index.getObjectProperty();return function(A,w,y){var E=f(A,w,y),D=p(A,w,y);return ps(E,h,D),D}}else{if(Gr(this.object))return function(A,w,y){var E=f(A,w,y),D=p(A,w,y),_=m(A,w,E);return A.set(d,a(E,_,D)),D};var x=this.object.object._compile(u,c);if(this.object.index.isObjectProperty()){var b=this.object.index.getObjectProperty();return function(A,w,y){var E=x(A,w,y),D=rn(E,b),_=m(A,w,D),N=p(A,w,y);return ps(E,b,a(D,_,N)),N}}else{var T=this.object.index._compile(u,c);return function(A,w,y){var E=x(A,w,y),D=T(A,w,E),_=i(E,D),N=m(A,w,_),C=p(A,w,y);return a(E,D,a(_,N,C)),C}}}else{if(!Gr(this.object))throw new TypeError("SymbolNode expected as object");return function(A,w,y){var E=p(A,w,y);return A.set(d,E),E}}}forEach(u){u(this.object,"object",this),this.index&&u(this.index,"index",this),u(this.value,"value",this)}map(u){var c=this._ifNode(u(this.object,"object",this)),f=this.index?this._ifNode(u(this.index,"index",this)):null,m=this._ifNode(u(this.value,"value",this));return new s(c,f,m)}clone(){return new s(this.object,this.index,this.value)}_toString(u){var c=this.object.toString(u),f=this.index?this.index.toString(u):"",m=this.value.toString(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m="("+m+")"),c+f+" = "+m}toJSON(){return{mathjs:bv,object:this.object,index:this.index,value:this.value}}static fromJSON(u){return new s(u.object,u.index,u.value)}_toHTML(u){var c=this.object.toHTML(u),f=this.index?this.index.toHTML(u):"",m=this.value.toHTML(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m='<span class="math-paranthesis math-round-parenthesis">(</span>'+m+'<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>'+m}_toTex(u){var c=this.object.toTex(u),f=this.index?this.index.toTex(u):"",m=this.value.toTex(u);return o(this,u&&u.parenthesis,u&&u.implicit)&&(m="\\left(".concat(m,"\\right)")),c+f+"="+m}}return Er(s,"name",bv),s},{isClass:!0,isNode:!0});var wv="BlockNode",are=["ResultSet","Node"],xS=M(wv,are,t=>{var{ResultSet:e,Node:r}=t;class n extends r{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var s=o&&o.node,l=o&&o.visible!==void 0?o.visible:!0;if(!nr(s))throw new TypeError('Property "node" must be a Node');if(typeof l!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:s,visible:l}})}get type(){return wv}get isBlockNode(){return!0}_compile(a,o){var s=xo(this.blocks,function(l){return{evaluate:l.node._compile(a,o),visible:l.visible}});return function(u,c,f){var m=[];return Wg(s,function(d){var h=d.evaluate(u,c,f);d.visible&&m.push(h)}),new e(m)}}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=[],s=0;s<this.blocks.length;s++){var l=this.blocks[s],u=this._ifNode(a(l.node,"blocks["+s+"].node",this));o[s]={node:u,visible:l.visible}}return new n(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new n(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:wv,blocks:this.blocks}}static fromJSON(a){return new n(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return Er(n,"name",wv),n},{isClass:!0,isNode:!0});var _v="ConditionalNode",ore=["Node"],bS=M(_v,ore,t=>{var{Node:e}=t;function r(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(ft(i))return!i.isZero();if(ra(i))return!!(i.re||i.im);if(bi(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+fr(i)+'"')}class n extends e{constructor(a,o,s){if(super(),!nr(a))throw new TypeError("Parameter condition must be a Node");if(!nr(o))throw new TypeError("Parameter trueExpr must be a Node");if(!nr(s))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=s}get type(){return _v}get isConditionalNode(){return!0}_compile(a,o){var s=this.condition._compile(a,o),l=this.trueExpr._compile(a,o),u=this.falseExpr._compile(a,o);return function(f,m,p){return r(s(f,m,p))?l(f,m,p):u(f,m,p)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new n(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toString(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l="("+l+")");var c=this.trueExpr.toString(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c="("+c+")");var m=this.falseExpr.toString(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m="("+m+")"),l+" ? "+c+" : "+m}toJSON(){return{mathjs:_v,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new n(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.condition.toHTML(a),u=Mr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||u!==null&&u<=s)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=Mr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=s)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var m=this.falseExpr.toHTML(a),p=Mr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||p!==null&&p<=s)&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+m}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return Er(n,"name",_v),n},{isClass:!0,isNode:!0});var cO=zr(uO(),1);var _S={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{?}"},Ar={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"},AS={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Ar.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(Ar.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Ar.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Ar.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Ar.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(Ar.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Ar.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(Ar.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(Ar.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Ar.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Ar.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Ar.bitAnd,"${args[1]}\\right)")},bitNot:{1:Ar.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Ar.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Ar.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Ar.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Ar.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Ar.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(Ar.and,"${args[1]}\\right)")},not:{1:Ar.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Ar.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Ar.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Ar.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(Ar.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Ar.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Ar.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Ar.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Ar.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Ar.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Ar.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Ar.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Ar.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(Ar.to,"${args[1]}\\right)")},numeric:function(e,r){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)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(_S.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)"}},fO="\\mathrm{${name}}\\left(${args}\\right)",lO={deg:"^\\circ"};function Av(t){return(0,cO.default)(t,{preserveFormatting:!0})}function Sv(t,e){return e=typeof e>"u"?!1:e,e?st(lO,t)?lO[t]:"\\mathrm{"+Av(t)+"}":st(_S,t)?_S[t]:Av(t)}var Ev="ConstantNode",cre=["Node"],SS=M(Ev,cre,t=>{var{Node:e}=t;class r extends e{constructor(i){super(),this.value=i}get type(){return Ev}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 r(this.value)}_toString(i){return Dt(this.value,i)}_toHTML(i){var a=this._toString(i);switch(fr(this.value)){case"number":case"bigint":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:Ev,value:this.value}}static fromJSON(i){return new r(i.value)}_toTex(i){var a=this._toString(i),o=fr(this.value);switch(o){case"string":return"\\mathtt{"+Av(a)+"}";case"number":case"BigNumber":{var s=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!s)return this.value.valueOf()<0?"-\\infty":"\\infty";var l=a.toLowerCase().indexOf("e");return l!==-1?a.substring(0,l)+"\\cdot10^{"+a.substring(l+1)+"}":a}case"bigint":return a.toString();case"Fraction":return this.value.toLatex();default:return a}}}return Er(r,"name",Ev),r},{isClass:!0,isNode:!0});var Tv="FunctionAssignmentNode",fre=["typed","Node"],ES=M(Tv,fre,t=>{var{typed:e,Node:r}=t;function n(a,o,s){var l=Mr(a,o,s),u=Mr(a.expr,o,s);return o==="all"||u!==null&&u<=l}class i extends r{constructor(o,s,l){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(s))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!nr(l))throw new TypeError('Node expected for parameter "expr"');if(dv.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var u=new Set;for(var c of s){var f=typeof c=="string"?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}this.name=o,this.params=s.map(function(m){return m&&m.name||m}),this.types=s.map(function(m){return m&&m.type||"any"}),this.expr=l}get type(){return Tv}get isFunctionAssignmentNode(){return!0}_compile(o,s){var l=Object.create(s);Wg(this.params,function(d){l[d]=!0});var u=this.expr._compile(o,l),c=this.name,f=this.params,m=sw(this.types,","),p=c+"("+sw(this.params,", ")+")";return function(h,x,b){var T={};T[m]=function(){for(var A=Object.create(x),w=0;w<f.length;w++)A[f[w]]=arguments[w];return u(h,A,b)};var v=e(c,T);return v.syntax=p,h.set(c,v),v}}forEach(o){o(this.expr,"expr",this)}map(o){var s=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),s)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toString(o);return n(this,s,o&&o.implicit)&&(l="("+l+")"),this.name+"("+this.params.join(", ")+") = "+l}toJSON(){var o=this.types;return{mathjs:Tv,name:this.name,params:this.params.map(function(s,l){return{name:s,type:o[l]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var s=o&&o.parenthesis?o.parenthesis:"keep",l=[],u=0;u<this.params.length;u++)l.push('<span class="math-symbol math-parameter">'+ri(this.params[u])+"</span>");var c=this.expr.toHTML(o);return n(this,s,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">'+ri(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+l.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 s=o&&o.parenthesis?o.parenthesis:"keep",l=this.expr.toTex(o);return n(this,s,o&&o.implicit)&&(l="\\left(".concat(l,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Sv).join(",")+"\\right)="+l}}return Er(i,"name",Tv),i},{isClass:!0,isNode:!0});var Dv="IndexNode",pre=["Node","size"],TS=M(Dv,pre,t=>{var{Node:e,size:r}=t;class n extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(nr))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 Dv}get isIndexNode(){return!0}_compile(a,o){var s=xo(this.dimensions,function(u,c){var f=u.filter(d=>d.isSymbolNode&&d.name==="end").length>0;if(f){var m=Object.create(o);m.end=!0;var p=u._compile(a,m);return function(h,x,b){if(!rt(b)&&!vr(b)&&!bn(b))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+fr(b));var T=r(b).valueOf(),v=Object.create(x);return v.end=T[c],p(h,v,b)}}else return u._compile(a,o)}),l=rn(a,"index");return function(c,f,m){var p=xo(s,function(d){return d(c,f,m)});return l(...p)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this._ifNode(a(this.dimensions[s],"dimensions["+s+"]",this));return new n(o,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&Ht(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:Dv,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new n(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],s=0;s<this.dimensions.length;s++)o[s]=this.dimensions[s].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+ri(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(s){return s.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return Er(n,"name",Dv),n},{isClass:!0,isNode:!0});var Mv="ObjectNode",mre=["Node"],DS=M(Mv,mre,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return nr(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return Mv}get isObjectNode(){return!0}_compile(i,a){var o={};for(var s in this.properties)if(st(this.properties,s)){var l=Gl(s),u=JSON.parse(l),c=rn(this.properties,s);o[u]=c._compile(i,a)}return function(m,p,d){var h={};for(var x in o)st(o,x)&&(h[x]=o[x](m,p,d));return h}}forEach(i){for(var a in this.properties)st(this.properties,a)&&i(this.properties[a],"properties["+Gl(a)+"]",this)}map(i){var a={};for(var o in this.properties)st(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Gl(o)+"]",this)));return new r(a)}clone(){var i={};for(var a in this.properties)st(this.properties,a)&&(i[a]=this.properties[a]);return new r(i)}_toString(i){var a=[];for(var o in this.properties)st(this.properties,o)&&a.push(Gl(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:Mv,properties:this.properties}}static fromJSON(i){return new r(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)st(this.properties,o)&&a.push('<span class="math-symbol math-property">'+ri(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)st(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var s="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return s}}return Er(r,"name",Mv),r},{isClass:!0,isNode:!0});function Kl(t,e){return new ff(t,new Pu(e),new Set(Object.keys(e)))}var Cv="OperatorNode",dre=["Node"],MS=M(Cv,dre,t=>{var{Node:e}=t;function r(a,o){var s=a;if(o==="auto")for(;_i(s);)s=s.content;return Ht(s)?!0:Qr(s)?r(s.args[0],o):!1}function n(a,o,s,l,u){var c=Mr(a,o,s),f=If(a,o);if(o==="all"||l.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return l.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var m;switch(l.length){case 0:m=[];break;case 1:{var p=Mr(l[0],o,s,a);if(u&&p!==null){var d,h;if(o==="keep"?(d=l[0].getIdentifier(),h=a.getIdentifier()):(d=l[0].getContent().getIdentifier(),h=a.getContent().getIdentifier()),So[c][h].latexLeftParens===!1){m=[!1];break}if(So[p][d].latexParens===!1){m=[!1];break}}if(p===null){m=[!1];break}if(p<=c){m=[!0];break}m=[!1]}break;case 2:{var x,b=Mr(l[0],o,s,a),T=xv(a,l[0],o);b===null?x=!1:b===c&&f==="right"&&!T||b<c?x=!0:x=!1;var v,A=Mr(l[1],o,s,a),w=xv(a,l[1],o);if(A===null?v=!1:A===c&&f==="left"&&!w||A<c?v=!0:v=!1,u){var y,E,D;o==="keep"?(y=a.getIdentifier(),E=a.args[0].getIdentifier(),D=a.args[1].getIdentifier()):(y=a.getContent().getIdentifier(),E=a.args[0].getContent().getIdentifier(),D=a.args[1].getContent().getIdentifier()),b!==null&&(So[c][y].latexLeftParens===!1&&(x=!1),So[b][E].latexParens===!1&&(x=!1)),A!==null&&(So[c][y].latexRightParens===!1&&(v=!1),So[A][D].latexParens===!1&&(v=!1))}m=[x,v]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(m=l.map(function(N){var C=Mr(N,o,s,a),B=xv(a,N,o),R=If(N,o);return C===null?!1:c===C&&f===R&&!B?!0:C<c}));break}if(l.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&s==="hide")for(var _=1;_<m.length;++_)r(l[_],o)&&!m[_-1]&&(o!=="keep"||!_i(l[_-1]))&&(m[_]=!0);return m}class i extends e{constructor(o,s,l,u,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof s!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(l)||!l.every(nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=u===!0,this.isPercentage=c===!0,this.op=o,this.fn=s,this.args=l||[]}get type(){return Cv}get isOperatorNode(){return!0}_compile(o,s){if(typeof this.fn!="string"||!Eg(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var l=rn(o,this.fn),u=xo(this.args,function(d){return d._compile(o,s)});if(typeof l=="function"&&l.rawArgs===!0){var c=this.args;return function(h,x,b){return l(c,o,Kl(h,x))}}else if(u.length===1){var f=u[0];return function(h,x,b){return l(f(h,x,b))}}else if(u.length===2){var m=u[0],p=u[1];return function(h,x,b){return l(m(h,x,b),p(h,x,b))}}else return function(h,x,b){return l.apply(null,xo(u,function(T){return T(h,x,b)}))}}forEach(o){for(var s=0;s<this.args.length;s++)o(this.args[s],"args["+s+"]",this)}map(o){for(var s=[],l=0;l<this.args.length;l++)s[l]=this._ifNode(o(this.args[l],"args["+l+"]",this));return new i(this.op,this.fn,s,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=If(this,s),m=u[0].toString(o);c[0]&&(m="("+m+")");var p=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(p?" ":"")+m:f==="left"?m+(p?" ":"")+this.op:m+this.op}else if(u.length===2){var d=u[0].toString(o),h=u[1].toString(o);return c[0]&&(d="("+d+")"),c[1]&&(h="("+h+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?d+" "+h:d+" "+this.op+" "+h}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var x=u.map(function(b,T){return b=b.toString(o),c[T]&&(b="("+b+")"),b});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?x.join(" "):x.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Cv,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 s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!1);if(u.length===1){var f=If(this,s),m=u[0].toHTML(o);return c[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+ri(this.op)+"</span>"+m:m+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+ri(this.op)+"</span>"}else if(u.length===2){var p=u[0].toHTML(o),d=u[1].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(d='<span class="math-parenthesis math-round-parenthesis">(</span>'+d+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?p+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+d:p+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+ri(this.op)+"</span>"+d}else{var h=u.map(function(x,b){return x=x.toHTML(o),c[b]&&(x='<span class="math-parenthesis math-round-parenthesis">(</span>'+x+'<span class="math-parenthesis math-round-parenthesis">)</span>'),x});return u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&l==="hide"?h.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):h.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+ri(this.op)+"</span>"):'<span class="math-function">'+ri(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+h.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var s=o&&o.parenthesis?o.parenthesis:"keep",l=o&&o.implicit?o.implicit:"hide",u=this.args,c=n(this,s,l,u,!0),f=Ar[this.fn];if(f=typeof f>"u"?this.op:f,u.length===1){var m=If(this,s),p=u[0].toTex(o);return c[0]&&(p="\\left(".concat(p,"\\right)")),m==="right"?f+p:p+f}else if(u.length===2){var d=u[0],h=d.toTex(o);c[0]&&(h="\\left(".concat(h,"\\right)"));var x=u[1],b=x.toTex(o);c[1]&&(b="\\left(".concat(b,"\\right)"));var T;switch(s==="keep"?T=d.getIdentifier():T=d.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+h+"}{"+b+"}";case"OperatorNode:pow":switch(h="{"+h+"}",b="{"+b+"}",T){case"ConditionalNode":case"OperatorNode:divide":h="\\left(".concat(h,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&l==="hide")return h+"~"+b}return h+f+b}else if(u.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var v=u.map(function(A,w){return A=A.toTex(o),c[w]&&(A="\\left(".concat(A,"\\right)")),A});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&l==="hide"?v.join("~"):v.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+u.map(function(A){return A.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Er(i,"name",Cv),i},{isClass:!0,isNode:!0});var Nv="ParenthesisNode",hre=["Node"],CS=M(Nv,hre,t=>{var{Node:e}=t;class r extends e{constructor(i){if(super(),!nr(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return Nv}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 r(a)}clone(){return new r(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:Nv,content:this.content}}static fromJSON(i){return new r(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 Er(r,"name",Nv),r},{isClass:!0,isNode:!0});var Fv="RangeNode",gre=["Node"],NS=M(Fv,gre,t=>{var{Node:e}=t;function r(i,a,o){var s=Mr(i,a,o),l={},u=Mr(i.start,a,o);if(l.start=u!==null&&u<=s||a==="all",i.step){var c=Mr(i.step,a,o);l.step=c!==null&&c<=s||a==="all"}var f=Mr(i.end,a,o);return l.end=f!==null&&f<=s||a==="all",l}class n extends e{constructor(a,o,s){if(super(),!nr(a))throw new TypeError("Node expected");if(!nr(o))throw new TypeError("Node expected");if(s&&!nr(s))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=s||null}get type(){return Fv}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Gr(o)&&o.name==="end"});return a.length>0}_compile(a,o){var s=a.range,l=this.start._compile(a,o),u=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(m,p,d){return s(l(m,p,d),u(m,p,d),c(m,p,d))}}else return function(m,p,d){return s(l(m,p,d),u(m,p,d))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new n(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toString(a);if(s.start&&(u="("+u+")"),l=u,this.step){var c=this.step.toString(a);s.step&&(c="("+c+")"),l+=":"+c}var f=this.end.toString(a);return s.end&&(f="("+f+")"),l+=":"+f,l}toJSON(){return{mathjs:Fv,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new n(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l,u=this.start.toHTML(a);if(s.start&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l=u,this.step){var c=this.step.toHTML(a);s.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return s.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),l+='<span class="math-operator math-range-operator">:</span>'+f,l}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",s=r(this,o,a&&a.implicit),l=this.start.toTex(a);if(s.start&&(l="\\left(".concat(l,"\\right)")),this.step){var u=this.step.toTex(a);s.step&&(u="\\left(".concat(u,"\\right)")),l+=":"+u}var c=this.end.toTex(a);return s.end&&(c="\\left(".concat(c,"\\right)")),l+=":"+c,l}}return Er(n,"name",Fv),n},{isClass:!0,isNode:!0});var Iv="RelationalNode",vre=["Node"],FS=M(Iv,vre,t=>{var{Node:e}=t,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return Iv}get isRelationalNode(){return!0}_compile(a,o){var s=this,l=this.params.map(u=>u._compile(a,o));return function(c,f,m){for(var p,d=l[0](c,f,m),h=0;h<s.conditionals.length;h++){p=d,d=l[h+1](c,f,m);var x=rn(a,s.conditionals[h]);if(!x(p,d))return!1}return!0}}forEach(a){this.params.forEach((o,s)=>a(o,"params["+s+"]",this),this)}map(a){return new n(this.conditionals.slice(),this.params.map((o,s)=>this._ifNode(a(o,"params["+s+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"("+f.toString(a)+")":f.toString(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=" "+r[this.conditionals[c]],u+=" "+l[c+1];return u}toJSON(){return{mathjs:Iv,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new n(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+ri(r[this.conditionals[c]])+"</span>"+l[c+1];return u}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",s=Mr(this,o,a&&a.implicit),l=this.params.map(function(f,m){var p=Mr(f,o,a&&a.implicit);return o==="all"||p!==null&&p<=s?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),u=l[0],c=0;c<this.conditionals.length;c++)u+=Ar[this.conditionals[c]]+l[c+1];return u}}return Er(n,"name",Iv),n},{isClass:!0,isNode:!0});var yre="SymbolNode",xre=["math","?Unit","Node"],IS=M(yre,xre,t=>{var{math:e,Unit:r,Node:n}=t;function i(o){return r?r.isValuelessUnit(o):!1}class a extends n{constructor(s){if(super(),typeof s!="string")throw new TypeError('String expected for parameter "name"');this.name=s}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(s,l){var u=this.name;if(l[u]===!0)return function(f,m,p){return rn(m,u)};if(u in s)return function(f,m,p){return f.has(u)?f.get(u):rn(s,u)};var c=i(u);return function(f,m,p){return f.has(u)?f.get(u):c?new r(null,u):a.onUndefinedSymbol(u)}}forEach(s){}map(s){return this.clone()}static onUndefinedSymbol(s){throw new Error("Undefined symbol "+s)}clone(){return new a(this.name)}_toString(s){return this.name}_toHTML(s){var l=ri(this.name);return l==="true"||l==="false"?'<span class="math-symbol math-boolean">'+l+"</span>":l==="i"?'<span class="math-symbol math-imaginary-symbol">'+l+"</span>":l==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+l+"</span>":l==="NaN"?'<span class="math-symbol math-nan-symbol">'+l+"</span>":l==="null"?'<span class="math-symbol math-null-symbol">'+l+"</span>":l==="undefined"?'<span class="math-symbol math-undefined-symbol">'+l+"</span>":'<span class="math-symbol">'+l+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(s){return new a(s.name)}_toTex(s){var l=!1;typeof e[this.name]>"u"&&i(this.name)&&(l=!0);var u=Sv(this.name,l);return u[0]==="\\"?u:" "+u}}return a},{isClass:!0,isNode:!0});var Pv="FunctionNode",bre=["math","Node","SymbolNode"],PS=M(Pv,bre,t=>{var e,{math:r,Node:n,SymbolNode:i}=t,a=l=>Dt(l,{truncate:78});function o(l,u,c){for(var f="",m=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,p=0,d;(d=m.exec(l))!==null;)if(f+=l.substring(p,d.index),p=d.index,d[0]==="$$")f+="$",p++;else{p+=d[0].length;var h=u[d[1]];if(!h)throw new ReferenceError("Template: Property "+d[1]+" does not exist.");if(d[2]===void 0)switch(typeof h){case"string":f+=h;break;case"object":if(nr(h))f+=h.toTex(c);else if(Array.isArray(h))f+=h.map(function(x,b){if(nr(x))return x.toTex(c);throw new TypeError("Template: "+d[1]+"["+b+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+d[1]+" has to be a Node, String or array of Nodes")}else if(nr(h[d[2]]&&h[d[2]]))f+=h[d[2]].toTex(c);else throw new TypeError("Template: "+d[1]+"["+d[2]+"] is not a Node.")}return f+=l.slice(p),f}class s extends n{constructor(u,c){if(super(),typeof u=="string"&&(u=new i(u)),!nr(u))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(nr))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=u,this.args=c||[]}get name(){return this.fn.name||""}get type(){return Pv}get isFunctionNode(){return!0}_compile(u,c){var f=this.args.map(D=>D._compile(u,c));if(Gr(this.fn)){var m=this.fn.name;if(c[m]){var b=this.args;return function(_,N,C){var B=rn(N,m);if(typeof B!="function")throw new TypeError("Argument '".concat(m,"' was not a function; received: ").concat(a(B)));if(B.rawArgs)return B(b,u,Kl(_,N));var R=f.map(V=>V(_,N,C));return B.apply(B,R)}}else{var p=m in u?rn(u,m):void 0,d=typeof p=="function"&&p.rawArgs===!0,h=D=>{var _;if(D.has(m))_=D.get(m);else if(m in u)_=rn(u,m);else return s.onUndefinedFunction(m);if(typeof _=="function")return _;throw new TypeError("'".concat(m,`' is not a function; its value is:
  `).concat(a(_)))};if(d){var x=this.args;return function(_,N,C){var B=h(_);if(B.rawArgs===!0)return B(x,u,Kl(_,N));var R=f.map(V=>V(_,N,C));return B(...R)}}else switch(f.length){case 0:return function(_,N,C){var B=h(_);return B()};case 1:return function(_,N,C){var B=h(_),R=f[0];return B(R(_,N,C))};case 2:return function(_,N,C){var B=h(_),R=f[0],V=f[1];return B(R(_,N,C),V(_,N,C))};default:return function(_,N,C){var B=h(_),R=f.map(V=>V(_,N,C));return B(...R)}}}}else if(Ha(this.fn)&&go(this.fn.index)&&this.fn.index.isObjectProperty()){var T=this.fn.object._compile(u,c),v=this.fn.index.getObjectProperty(),A=this.args;return function(_,N,C){var B=T(_,N,C),R=O2(B,v);if(R!=null&&R.rawArgs)return R(A,u,Kl(_,N));var V=f.map(L=>L(_,N,C));return R.apply(B,V)}}else{var w=this.fn.toString(),y=this.fn._compile(u,c),E=this.args;return function(_,N,C){var B=y(_,N,C);if(typeof B!="function")throw new TypeError("Expression '".concat(w,"' did not evaluate to a function; value is:")+`
  `.concat(a(B)));if(B.rawArgs)return B(E,u,Kl(_,N));var R=f.map(V=>V(_,N,C));return B.apply(B,R)}}}forEach(u){u(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)u(this.args[c],"args["+c+"]",this)}map(u){for(var c=this._ifNode(u(this.fn,"fn",this)),f=[],m=0;m<this.args.length;m++)f[m]=this._ifNode(u(this.args[m],"args["+m+"]",this));return new s(c,f)}clone(){return new s(this.fn,this.args.slice(0))}toString(u){var c,f=this.fn.toString(u);return u&&typeof u.handler=="object"&&st(u.handler,f)&&(c=u.handler[f](this,u)),typeof c<"u"?c:super.toString(u)}_toString(u){var c=this.args.map(function(m){return m.toString(u)}),f=ms(this.fn)?"("+this.fn.toString(u)+")":this.fn.toString(u);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:Pv,fn:this.fn,args:this.args}}_toHTML(u){var c=this.args.map(function(f){return f.toHTML(u)});return'<span class="math-function">'+ri(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(u){var c;return u&&typeof u.handler=="object"&&st(u.handler,this.name)&&(c=u.handler[this.name](this,u)),typeof c<"u"?c:super.toTex(u)}_toTex(u){var c=this.args.map(function(p){return p.toTex(u)}),f;AS[this.name]&&(f=AS[this.name]),r[this.name]&&(typeof r[this.name].toTex=="function"||typeof r[this.name].toTex=="object"||typeof r[this.name].toTex=="string")&&(f=r[this.name].toTex);var m;switch(typeof f){case"function":m=f(this,u);break;case"string":m=o(f,this,u);break;case"object":switch(typeof f[c.length]){case"function":m=f[c.length](this,u);break;case"string":m=o(f[c.length],this,u);break}}return typeof m<"u"?m:o(fO,this,u)}getIdentifier(){return this.type+":"+this.name}}return e=s,Er(s,"name",Pv),Er(s,"onUndefinedFunction",function(l){throw new Error("Undefined function "+l)}),Er(s,"fromJSON",function(l){return new e(l.fn,l.args)}),s},{isClass:!0,isNode:!0});var pO="parse",wre=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],BS=M(pO,wre,t=>{var{typed:e,numeric:r,config:n,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:s,ConditionalNode:l,ConstantNode:u,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:d,ParenthesisNode:h,RangeNode:x,RelationalNode:b,SymbolNode:T}=t,v=e(pO,{string:function(Y){return ae(Y,{})},"Array | Matrix":function(Y){return A(Y,{})},"string, Object":function(Y,ie){var Ce=ie.nodes!==void 0?ie.nodes:{};return ae(Y,Ce)},"Array | Matrix, Object":A});function A(F){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=Y.nodes!==void 0?Y.nodes:{};return nt(F,function(Ce){if(typeof Ce!="string")throw new TypeError("String expected");return ae(Ce,ie)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},y={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},D={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],N={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:"	"};function C(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,Y){return F.expression.substr(F.index,Y)}function R(F){return B(F,1)}function V(F){F.index++}function L(F){return F.expression.charAt(F.index-1)}function P(F){return F.expression.charAt(F.index+1)}function k(F){for(F.tokenType=w.NULL,F.token="",F.comment="";;){if(R(F)==="#")for(;R(F)!==`
`&&R(F)!=="";)F.comment+=R(F),V(F);if(v.isWhitespace(R(F),F.nestingLevel))V(F);else break}if(R(F)===""){F.tokenType=w.DELIMITER;return}if(R(F)===`
`&&!F.nestingLevel){F.tokenType=w.DELIMITER,F.token=R(F),V(F);return}var Y=R(F),ie=B(F,2),Ce=B(F,3);if(Ce.length===3&&y[Ce]){F.tokenType=w.DELIMITER,F.token=Ce,V(F),V(F),V(F);return}if(ie.length===2&&y[ie]){F.tokenType=w.DELIMITER,F.token=ie,V(F),V(F);return}if(y[Y]){F.tokenType=w.DELIMITER,F.token=Y,V(F);return}if(v.isDigitDot(Y)){F.tokenType=w.NUMBER;var tt=B(F,2);if(tt==="0b"||tt==="0o"||tt==="0x"){for(F.token+=R(F),V(F),F.token+=R(F),V(F);v.isHexDigit(R(F));)F.token+=R(F),V(F);if(R(F)===".")for(F.token+=".",V(F);v.isHexDigit(R(F));)F.token+=R(F),V(F);else if(R(F)==="i")for(F.token+="i",V(F);v.isDigit(R(F));)F.token+=R(F),V(F);return}if(R(F)==="."){if(F.token+=R(F),V(F),!v.isDigit(R(F))){F.tokenType=w.DELIMITER;return}}else{for(;v.isDigit(R(F));)F.token+=R(F),V(F);v.isDecimalMark(R(F),P(F))&&(F.token+=R(F),V(F))}for(;v.isDigit(R(F));)F.token+=R(F),V(F);if(R(F)==="E"||R(F)==="e"){if(v.isDigit(P(F))||P(F)==="-"||P(F)==="+"){if(F.token+=R(F),V(F),(R(F)==="+"||R(F)==="-")&&(F.token+=R(F),V(F)),!v.isDigit(R(F)))throw Se(F,'Digit expected, got "'+R(F)+'"');for(;v.isDigit(R(F));)F.token+=R(F),V(F);if(v.isDecimalMark(R(F),P(F)))throw Se(F,'Digit expected, got "'+R(F)+'"')}else if(P(F)===".")throw V(F),Se(F,'Digit expected, got "'+R(F)+'"')}return}if(v.isAlpha(R(F),L(F),P(F))){for(;v.isAlpha(R(F),L(F),P(F))||v.isDigit(R(F));)F.token+=R(F),V(F);st(E,F.token)?F.tokenType=w.DELIMITER:F.tokenType=w.SYMBOL;return}for(F.tokenType=w.UNKNOWN;R(F)!=="";)F.token+=R(F),V(F);throw Se(F,'Syntax error in part "'+F.token+'"')}function W(F){do k(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function X(F){F.nestingLevel--}v.isAlpha=function(Y,ie,Ce){return v.isValidLatinOrGreek(Y)||v.isValidMathSymbol(Y,Ce)||v.isValidMathSymbol(ie,Y)},v.isValidLatinOrGreek=function(Y){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y)},v.isValidMathSymbol=function(Y,ie){return/^[\uD835]$/.test(Y)&&/^[\uDC00-\uDFFF]$/.test(ie)&&/^[^\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(ie)},v.isWhitespace=function(Y,ie){return Y===" "||Y==="	"||Y===`
`&&ie>0},v.isDecimalMark=function(Y,ie){return Y==="."&&ie!=="/"&&ie!=="*"&&ie!=="^"},v.isDigitDot=function(Y){return Y>="0"&&Y<="9"||Y==="."},v.isDigit=function(Y){return Y>="0"&&Y<="9"},v.isHexDigit=function(Y){return Y>="0"&&Y<="9"||Y>="a"&&Y<="f"||Y>="A"&&Y<="F"};function ae(F,Y){var ie=C();sn(ie,{expression:F,extraNodes:Y}),k(ie);var Ce=J(ie);if(ie.token!=="")throw ie.tokenType===w.DELIMITER?Xe(ie,"Unexpected operator "+ie.token):Se(ie,'Unexpected part "'+ie.token+'"');return Ce}function J(F){var Y,ie=[],Ce;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(Y=U(F),F.comment&&(Y.comment=F.comment));F.token===`
`||F.token===";";)ie.length===0&&Y&&(Ce=F.token!==";",ie.push({node:Y,visible:Ce})),k(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(Y=U(F),F.comment&&(Y.comment=F.comment),Ce=F.token!==";",ie.push({node:Y,visible:Ce}));return ie.length>0?new s(ie):(Y||(Y=new u(void 0),F.comment&&(Y.comment=F.comment)),Y)}function U(F){var Y,ie,Ce,tt,xt=de(F);if(F.token==="="){if(Gr(xt))return Y=xt.name,W(F),Ce=U(F),new o(new T(Y),Ce);if(Ha(xt))return W(F),Ce=U(F),new o(xt.object,xt.index,Ce);if(na(xt)&&Gr(xt.fn)&&(tt=!0,ie=[],Y=xt.name,xt.args.forEach(function(_r,qe){Gr(_r)?ie[qe]=_r.name:tt=!1}),tt))return W(F),Ce=U(F),new c(Y,ie,Ce);throw Se(F,"Invalid left hand side of assignment operator =")}return xt}function de(F){for(var Y=we(F);F.token==="?";){var ie=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Ce=Y,tt=U(F);if(F.token!==":")throw Se(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var xt=U(F);Y=new l(Ce,tt,xt),F.conditionalLevel=ie}return Y}function we(F){for(var Y=se(F);F.token==="or";)W(F),Y=new d("or","or",[Y,se(F)]);return Y}function se(F){for(var Y=be(F);F.token==="xor";)W(F),Y=new d("xor","xor",[Y,be(F)]);return Y}function be(F){for(var Y=K(F);F.token==="and";)W(F),Y=new d("and","and",[Y,K(F)]);return Y}function K(F){for(var Y=j(F);F.token==="|";)W(F),Y=new d("|","bitOr",[Y,j(F)]);return Y}function j(F){for(var Y=ne(F);F.token==="^|";)W(F),Y=new d("^|","bitXor",[Y,ne(F)]);return Y}function ne(F){for(var Y=pe(F);F.token==="&";)W(F),Y=new d("&","bitAnd",[Y,pe(F)]);return Y}function pe(F){for(var Y=[fe(F)],ie=[],Ce={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};st(Ce,F.token);){var tt={name:F.token,fn:Ce[F.token]};ie.push(tt),W(F),Y.push(fe(F))}return Y.length===1?Y[0]:Y.length===2?new d(ie[0].name,ie[0].fn,Y):new b(ie.map(xt=>xt.fn),Y)}function fe(F){var Y,ie,Ce,tt;Y=Ae(F);for(var xt={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};st(xt,F.token);)ie=F.token,Ce=xt[ie],W(F),tt=[Y,Ae(F)],Y=new d(ie,Ce,tt);return Y}function Ae(F){var Y,ie,Ce,tt;Y=_e(F);for(var xt={to:"to",in:"to"};st(xt,F.token);)ie=F.token,Ce=xt[ie],W(F),ie==="in"&&F.token===""?Y=new d("*","multiply",[Y,new T("in")],!0):(tt=[Y,_e(F)],Y=new d(ie,Ce,tt));return Y}function _e(F){var Y,ie=[];if(F.token===":"?Y=new u(1):Y=G(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(ie.push(Y);F.token===":"&&ie.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?ie.push(new T("end")):ie.push(G(F));ie.length===3?Y=new x(ie[0],ie[2],ie[1]):Y=new x(ie[0],ie[1])}return Y}function G(F){var Y,ie,Ce,tt;Y=Z(F);for(var xt={"+":"add","-":"subtract"};st(xt,F.token);){ie=F.token,Ce=xt[ie],W(F);var _r=Z(F);_r.isPercentage?tt=[Y,new d("*","multiply",[Y,_r])]:tt=[Y,_r],Y=new d(ie,Ce,tt)}return Y}function Z(F){var Y,ie,Ce,tt;Y=ge(F),ie=Y;for(var xt={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};st(xt,F.token);)if(Ce=F.token,tt=xt[Ce],W(F),Ce==="%"&&F.tokenType===w.DELIMITER&&F.token!=="(")if(F.token!==""&&xt[F.token]){var _r=new d("/","divide",[Y,new u(100)],!1,!0);Ce=F.token,tt=xt[Ce],W(F),ie=ge(F),Y=new d(Ce,tt,[_r,ie])}else Y=new d("/","divide",[Y,new u(100)],!1,!0);else ie=ge(F),Y=new d(Ce,tt,[Y,ie]);return Y}function ge(F){var Y,ie;for(Y=xe(F),ie=Y;F.tokenType===w.SYMBOL||F.token==="in"&&Ht(Y)||F.token==="in"&&Qr(Y)&&Y.fn==="unaryMinus"&&Ht(Y.args[0])||F.tokenType===w.NUMBER&&!Ht(ie)&&(!Qr(ie)||ie.op==="!")||F.token==="(";)ie=xe(F),Y=new d("*","multiply",[Y,ie],!0);return Y}function xe(F){for(var Y=Ee(F),ie=Y,Ce=[];F.token==="/"&&Yp(ie);)if(Ce.push(sn({},F)),W(F),F.tokenType===w.NUMBER)if(Ce.push(sn({},F)),W(F),F.tokenType===w.SYMBOL||F.token==="("||F.token==="in")sn(F,Ce.pop()),Ce.pop(),ie=Ee(F),Y=new d("/","divide",[Y,ie]);else{Ce.pop(),sn(F,Ce.pop());break}else{sn(F,Ce.pop());break}return Y}function Ee(F){var Y,ie,Ce,tt={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return st(tt,F.token)?(Ce=tt[F.token],Y=F.token,W(F),ie=[Ee(F)],new d(Y,Ce,ie)):Be(F)}function Be(F){var Y,ie,Ce,tt;return Y=Ve(F),(F.token==="^"||F.token===".^")&&(ie=F.token,Ce=ie==="^"?"pow":"dotPow",W(F),tt=[Y,Ee(F)],Y=new d(ie,Ce,tt)),Y}function Ve(F){var Y,ie,Ce,tt;Y=et(F);for(var xt={"!":"factorial","'":"ctranspose"};st(xt,F.token);)ie=F.token,Ce=xt[ie],k(F),tt=[Y],Y=new d(ie,Ce,tt),Y=Ye(F,Y);return Y}function et(F){var Y=[];if(F.tokenType===w.SYMBOL&&st(F.extraNodes,F.token)){var ie=F.extraNodes[F.token];if(k(F),F.token==="("){if(Y=[],O(F),k(F),F.token!==")")for(Y.push(U(F));F.token===",";)k(F),Y.push(U(F));if(F.token!==")")throw Se(F,"Parenthesis ) expected");X(F),k(F)}return new ie(Y)}return St(F)}function St(F){var Y,ie;return F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E?(ie=F.token,k(F),st(D,ie)?Y=new u(D[ie]):_.includes(ie)?Y=new u(r(ie,"number")):Y=new T(ie),Y=Ye(F,Y),Y):ur(F)}function Ye(F,Y,ie){for(var Ce;(F.token==="("||F.token==="["||F.token===".")&&(!ie||ie.includes(F.token));)if(Ce=[],F.token==="(")if(Gr(Y)||Ha(Y)){if(O(F),k(F),F.token!==")")for(Ce.push(U(F));F.token===",";)k(F),Ce.push(U(F));if(F.token!==")")throw Se(F,"Parenthesis ) expected");X(F),k(F),Y=new f(Y,Ce)}else return Y;else if(F.token==="["){if(O(F),k(F),F.token!=="]")for(Ce.push(U(F));F.token===",";)k(F),Ce.push(U(F));if(F.token!=="]")throw Se(F,"Parenthesis ] expected");X(F),k(F),Y=new i(Y,new m(Ce))}else{k(F);var tt=F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E;if(!tt)throw Se(F,"Property name expected after dot");Ce.push(new u(F.token)),k(F);var xt=!0;Y=new i(Y,new m(Ce,xt))}return Y}function ur(F){var Y,ie;return F.token==='"'||F.token==="'"?(ie=Jt(F,F.token),Y=new u(ie),Y=Ye(F,Y),Y):He(F)}function Jt(F,Y){for(var ie="";R(F)!==""&&R(F)!==Y;)if(R(F)==="\\"){V(F);var Ce=R(F),tt=N[Ce];if(tt!==void 0)ie+=tt,F.index+=1;else if(Ce==="u"){var xt=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(xt))ie+=String.fromCharCode(parseInt(xt,16)),F.index+=5;else throw Se(F,"Invalid unicode character \\u".concat(xt))}else throw Se(F,"Bad escape character \\".concat(Ce))}else ie+=R(F),V(F);if(k(F),F.token!==Y)throw Se(F,"End of string ".concat(Y," expected"));return k(F),ie}function He(F){var Y,ie,Ce,tt;if(F.token==="["){if(O(F),k(F),F.token!=="]"){var xt=at(F);if(F.token===";"){for(Ce=1,ie=[xt];F.token===";";)k(F),F.token!=="]"&&(ie[Ce]=at(F),Ce++);if(F.token!=="]")throw Se(F,"End of matrix ] expected");X(F),k(F),tt=ie[0].items.length;for(var _r=1;_r<Ce;_r++)if(ie[_r].items.length!==tt)throw Xe(F,"Column dimensions mismatch ("+ie[_r].items.length+" !== "+tt+")");Y=new a(ie)}else{if(F.token!=="]")throw Se(F,"End of matrix ] expected");X(F),k(F),Y=xt}}else X(F),k(F),Y=new a([]);return Ye(F,Y)}return Q(F)}function at(F){for(var Y=[U(F)],ie=1;F.token===",";)k(F),F.token!=="]"&&F.token!==";"&&(Y[ie]=U(F),ie++);return new a(Y)}function Q(F){if(F.token==="{"){O(F);var Y,ie={};do if(k(F),F.token!=="}"){if(F.token==='"'||F.token==="'")Y=Jt(F,F.token);else if(F.tokenType===w.SYMBOL||F.tokenType===w.DELIMITER&&F.token in E)Y=F.token,k(F);else throw Se(F,"Symbol or string expected as object key");if(F.token!==":")throw Se(F,"Colon : expected after object key");k(F),ie[Y]=U(F)}while(F.token===",");if(F.token!=="}")throw Se(F,"Comma , or bracket } expected after object value");X(F),k(F);var Ce=new p(ie);return Ce=Ye(F,Ce),Ce}return me(F)}function me(F){var Y;if(F.tokenType===w.NUMBER){Y=F.token,k(F);var ie=Bi(Y,n),Ce=r(Y,ie);return new u(Ce)}return he(F)}function he(F){var Y;if(F.token==="("){if(O(F),k(F),Y=U(F),F.token!==")")throw Se(F,"Parenthesis ) expected");return X(F),k(F),Y=new h(Y),Y=Ye(F,Y),Y}return Fe(F)}function Fe(F){throw F.token===""?Se(F,"Unexpected end of expression"):Se(F,"Value expected")}function ke(F){return F.index-F.token.length+1}function Se(F,Y){var ie=ke(F),Ce=new SyntaxError(Y+" (char "+ie+")");return Ce.char=ie,Ce}function Xe(F,Y){var ie=ke(F),Ce=new SyntaxError(Y+" (char "+ie+")");return Ce.char=ie,Ce}return e.addConversion({from:"string",to:"Node",convert:v}),v});var mO="compile",_re=["typed","parse"],kS=M(mO,_re,t=>{var{typed:e,parse:r}=t;return e(mO,{string:function(i){return r(i).compile()},"Array | Matrix":function(i){return nt(i,function(a){return r(a).compile()})}})});var dO="evaluate",Are=["typed","parse"],$S=M(dO,Are,t=>{var{typed:e,parse:r}=t;return e(dO,{string:function(i){var a=Bu();return r(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return r(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=Bu();return nt(i,function(o){return r(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return nt(i,function(o){return r(o).compile().evaluate(a)})}})});var Sre="Parser",Ere=["evaluate","parse"],OS=M(Sre,Ere,t=>{var{evaluate:e,parse:r}=t;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Bu(),writable:!1})}n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(a){return e(a,this.scope)},n.prototype.get=function(a){if(this.scope.has(a))return this.scope.get(a)},n.prototype.getAll=function(){return L2(this.scope)},n.prototype.getAllAsMap=function(){return this.scope};function i(a){if(a.length===0)return!1;for(var o=0;o<a.length;o++){var s=a.charAt(o-1),l=a.charAt(o),u=a.charAt(o+1),c=r.isAlpha(l,s,u)||o>0&&r.isDigit(l);if(!c)return!1}return!0}return n.prototype.set=function(a,o){if(!i(a))throw new Error("Invalid variable name: '".concat(a,"'. Variable names must follow the specified rules."));return this.scope.set(a,o),o},n.prototype.remove=function(a){this.scope.delete(a)},n.prototype.clear=function(){this.scope.clear()},n},{isClass:!0});var hO="parser",Tre=["typed","Parser"],RS=M(hO,Tre,t=>{var{typed:e,Parser:r}=t;return e(hO,{"":function(){return new r}})});var gO="lup",Dre=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],LS=M(gO,Dre,t=>{var{typed:e,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:l,equalScalar:u,unaryMinus:c,DenseMatrix:f,SparseMatrix:m,Spa:p}=t;return e(gO,{DenseMatrix:function(b){return d(b)},SparseMatrix:function(b){return h(b)},Array:function(b){var T=r(b),v=d(T);return{L:v.L.valueOf(),U:v.U.valueOf(),p:v.p}}});function d(x){var b=x._size[0],T=x._size[1],v=Math.min(b,T),A=yt(x._data),w=[],y=[b,v],E=[],D=[v,T],_,N,C,B=[];for(_=0;_<b;_++)B[_]=_;for(N=0;N<T;N++){if(N>0)for(_=0;_<b;_++){var R=Math.min(_,N),V=0;for(C=0;C<R;C++)V=i(V,o(A[_][C],A[C][N]));A[_][N]=s(A[_][N],V)}var L=N,P=0,k=0;for(_=N;_<b;_++){var W=A[_][N],O=n(W);l(O,P)&&(L=_,P=O,k=W)}if(N!==L&&(B[N]=[B[L],B[L]=B[N]][0],f._swapRows(N,L,A)),N<b)for(_=N+1;_<b;_++){var X=A[_][N];u(X,0)||(A[_][N]=a(A[_][N],k))}}for(N=0;N<T;N++)for(_=0;_<b;_++){if(N===0&&(_<T&&(E[_]=[]),w[_]=[]),_<N){_<T&&(E[_][N]=A[_][N]),N<b&&(w[_][N]=0);continue}if(_===N){_<T&&(E[_][N]=A[_][N]),N<b&&(w[_][N]=1);continue}_<T&&(E[_][N]=0),N<b&&(w[_][N]=A[_][N])}var ae=new f({data:w,size:y}),J=new f({data:E,size:D}),U=[];for(_=0,v=B.length;_<v;_++)U[B[_]]=_;return{L:ae,U:J,p:U,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function h(x){var b=x._size[0],T=x._size[1],v=Math.min(b,T),A=x._values,w=x._index,y=x._ptr,E=[],D=[],_=[],N=[b,v],C=[],B=[],R=[],V=[v,T],L,P,k,W=[],O=[];for(L=0;L<b;L++)W[L]=L,O[L]=L;var X=function(U,de){var we=O[U],se=O[de];W[we]=de,W[se]=U,O[U]=se,O[de]=we},ae=function(){var U=new p;P<b&&(_.push(E.length),E.push(1),D.push(P)),R.push(C.length);var de=y[P],we=y[P+1];for(k=de;k<we;k++)L=w[k],U.set(W[L],A[k]);P>0&&U.forEach(0,P-1,function(j,ne){m._forEachRow(j,E,D,_,function(pe,fe){pe>j&&U.accumulate(pe,c(o(fe,ne)))})});var se=P,be=U.get(P),K=n(be);U.forEach(P+1,b-1,function(j,ne){var pe=n(ne);l(pe,K)&&(se=j,K=pe,be=ne)}),P!==se&&(m._swapRows(P,se,N[1],E,D,_),m._swapRows(P,se,V[1],C,B,R),U.swap(P,se),X(P,se)),U.forEach(0,b-1,function(j,ne){j<=P?(C.push(ne),B.push(j)):(ne=a(ne,be),u(ne,0)||(E.push(ne),D.push(j)))})};for(P=0;P<T;P++)ae();return R.push(C.length),_.push(E.length),{L:new m({values:E,index:D,ptr:_,size:N}),U:new m({values:C,index:B,ptr:R,size:V}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var vO="qr",Mre=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],VS=M(vO,Mre,t=>{var{typed:e,matrix:r,zeros:n,identity:i,isZero:a,equal:o,sign:s,sqrt:l,conj:u,unaryMinus:c,addScalar:f,divideScalar:m,multiplyScalar:p,subtractScalar:d,complex:h}=t;return sn(e(vO,{DenseMatrix:function(A){return b(A)},SparseMatrix:function(A){return T(A)},Array:function(A){var w=r(A),y=b(w);return{Q:y.Q.valueOf(),R:y.R.valueOf()}}}),{_denseQRimpl:x});function x(v){var A=v._size[0],w=v._size[1],y=i([A],"dense"),E=y._data,D=v.clone(),_=D._data,N,C,B,R=n([A],"");for(B=0;B<Math.min(w,A);++B){var V=_[B][B],L=c(o(V,0)?1:s(V)),P=u(L),k=0;for(N=B;N<A;N++)k=f(k,p(_[N][B],u(_[N][B])));var W=p(L,l(k));if(!a(W)){var O=d(V,W);for(R[B]=1,N=B+1;N<A;N++)R[N]=m(_[N][B],O);var X=c(u(m(O,W))),ae=void 0;for(C=B;C<w;C++){for(ae=0,N=B;N<A;N++)ae=f(ae,p(u(R[N]),_[N][C]));for(ae=p(ae,X),N=B;N<A;N++)_[N][C]=p(d(_[N][C],p(R[N],ae)),P)}for(N=0;N<A;N++){for(ae=0,C=B;C<A;C++)ae=f(ae,p(E[N][C],R[C]));for(ae=p(ae,X),C=B;C<A;++C)E[N][C]=m(d(E[N][C],p(ae,u(R[C]))),P)}}}return{Q:y,R:D,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function b(v){var A=x(v),w=A.R._data;if(v._data.length>0)for(var y=w[0][0].type==="Complex"?h(0):0,E=0;E<w.length;++E)for(var D=0;D<E&&D<(w[0]||[]).length;++D)w[E][D]=y;return A}function T(v){throw new Error("qr not implemented for sparse matrices yet")}});function yO(t,e,r,n){for(var i=t._values,a=t._index,o=t._ptr,s=t._size,l=t._datatype,u=s[0],c=s[1],f=n&&t._values?[]:null,m=[],p=[],d=0,h=0;h<c;h++){p[h]=d;for(var x=r?r[h]:h,b=o[x],T=o[x+1],v=b;v<T;v++){var A=e?e[a[v]]:a[v];m[d]=A,f&&(f[d]=i[v]),d++}}return p[c]=d,t.createSparseMatrix({values:f,index:m,ptr:p,size:[u,c],datatype:l})}function Bv(t,e,r,n,i,a,o){var s=0;for(r[o]=t;s>=0;){var l=r[o+s],u=r[n+l];u===-1?(s--,a[e++]=l):(r[n+l]=r[i+u],++s,r[o+s]=u)}return e}function xO(t,e){if(!t)return null;var r=0,n,i=[],a=[],o=0,s=e,l=2*e;for(n=0;n<e;n++)a[o+n]=-1;for(n=e-1;n>=0;n--)t[n]!==-1&&(a[s+n]=a[o+t[n]],a[o+t[n]]=n);for(n=0;n<e;n++)t[n]===-1&&(r=Bv(n,r,a,o,s,i,l));return i}function bO(t,e){if(!t)return null;var r=t._index,n=t._ptr,i=t._size,a=i[0],o=i[1],s=[],l=[],u=0,c=o,f,m;if(e)for(f=0;f<a;f++)l[c+f]=-1;for(var p=0;p<o;p++){s[p]=-1,l[u+p]=-1;for(var d=n[p],h=n[p+1],x=d;x<h;x++){var b=r[x];for(f=e?l[c+b]:b;f!==-1&&f<p;f=m)m=l[u+f],l[u+f]=p,m===-1&&(s[f]=p);e&&(l[c+b]=p)}}return s}function wO(t,e,r){for(var n=t._values,i=t._index,a=t._ptr,o=t._size,s=o[1],l=0,u=0;u<s;u++){var c=a[u];for(a[u]=l;c<a[u+1];c++)e(i[c],u,n?n[c]:1,r)&&(i[l]=i[c],n&&(n[l]=n[c]),l++)}return a[s]=l,i.splice(l,i.length-l),n&&n.splice(l,n.length-l),l}function Yo(t){return-t-2}var Cre="csAmd",Nre=["add","multiply","transpose"],_O=M(Cre,Nre,t=>{var{add:e,multiply:r,transpose:n}=t;return function(c,f){if(!f||c<=0||c>3)return null;var m=f._size,p=m[0],d=m[1],h=0,x=Math.max(16,10*Math.sqrt(d));x=Math.min(d-2,x);var b=i(c,f,p,d,x);wO(b,l,null);for(var T=b._index,v=b._ptr,A=v[d],w=[],y=[],E=0,D=d+1,_=2*(d+1),N=3*(d+1),C=4*(d+1),B=5*(d+1),R=6*(d+1),V=7*(d+1),L=w,P=a(d,v,y,E,N,L,_,V,D,R,C,B),k=o(d,v,y,B,C,R,x,D,N,L,_),W=0,O,X,ae,J,U,de,we,se,be,K,j,ne,pe,fe,Ae,_e;k<d;){for(ae=-1;W<d&&(ae=y[N+W])===-1;W++);y[_+ae]!==-1&&(L[y[_+ae]]=-1),y[N+W]=y[_+ae];var G=y[C+ae],Z=y[D+ae];k+=Z;var ge=0;y[D+ae]=-Z;var xe=v[ae],Ee=G===0?xe:A,Be=Ee;for(J=1;J<=G+1;J++){for(J>G?(de=ae,we=xe,se=y[E+ae]-G):(de=T[xe++],we=v[de],se=y[E+de]),U=1;U<=se;U++)O=T[we++],!((be=y[D+O])<=0)&&(ge+=be,y[D+O]=-be,T[Be++]=O,y[_+O]!==-1&&(L[y[_+O]]=L[O]),L[O]!==-1?y[_+L[O]]=y[_+O]:y[N+y[B+O]]=y[_+O]);de!==ae&&(v[de]=Yo(ae),y[R+de]=0)}for(G!==0&&(A=Be),y[B+ae]=ge,v[ae]=Ee,y[E+ae]=Be-Ee,y[C+ae]=-2,P=s(P,h,y,R,d),K=Ee;K<Be;K++)if(O=T[K],!((j=y[C+O])<=0)){be=-y[D+O];var Ve=P-be;for(xe=v[O],ne=v[O]+j-1;xe<=ne;xe++)de=T[xe],y[R+de]>=P?y[R+de]-=be:y[R+de]!==0&&(y[R+de]=y[B+de]+Ve)}for(K=Ee;K<Be;K++){for(O=T[K],ne=v[O],pe=ne+y[C+O]-1,fe=ne,Ae=0,_e=0,xe=ne;xe<=pe;xe++)if(de=T[xe],y[R+de]!==0){var et=y[R+de]-P;et>0?(_e+=et,T[fe++]=de,Ae+=de):(v[de]=Yo(ae),y[R+de]=0)}y[C+O]=fe-ne+1;var St=fe,Ye=ne+y[E+O];for(xe=pe+1;xe<Ye;xe++){X=T[xe];var ur=y[D+X];ur<=0||(_e+=ur,T[fe++]=X,Ae+=X)}_e===0?(v[O]=Yo(ae),be=-y[D+O],ge-=be,Z+=be,k+=be,y[D+O]=0,y[C+O]=-1):(y[B+O]=Math.min(y[B+O],_e),T[fe]=T[St],T[St]=T[ne],T[ne]=ae,y[E+O]=fe-ne+1,Ae=(Ae<0?-Ae:Ae)%d,y[_+O]=y[V+Ae],y[V+Ae]=O,L[O]=Ae)}for(y[B+ae]=ge,h=Math.max(h,ge),P=s(P+h,h,y,R,d),K=Ee;K<Be;K++)if(O=T[K],!(y[D+O]>=0))for(Ae=L[O],O=y[V+Ae],y[V+Ae]=-1;O!==-1&&y[_+O]!==-1;O=y[_+O],P++){for(se=y[E+O],j=y[C+O],xe=v[O]+1;xe<=v[O]+se-1;xe++)y[R+T[xe]]=P;var Jt=O;for(X=y[_+O];X!==-1;){var He=y[E+X]===se&&y[C+X]===j;for(xe=v[X]+1;He&&xe<=v[X]+se-1;xe++)y[R+T[xe]]!==P&&(He=0);He?(v[X]=Yo(O),y[D+O]+=y[D+X],y[D+X]=0,y[C+X]=-1,X=y[_+X],y[_+Jt]=X):(Jt=X,X=y[_+X])}}for(xe=Ee,K=Ee;K<Be;K++)O=T[K],!((be=-y[D+O])<=0)&&(y[D+O]=be,_e=y[B+O]+ge-be,_e=Math.min(_e,d-k-be),y[N+_e]!==-1&&(L[y[N+_e]]=O),y[_+O]=y[N+_e],L[O]=-1,y[N+_e]=O,W=Math.min(W,_e),y[B+O]=_e,T[xe++]=O);y[D+ae]=Z,(y[E+ae]=xe-Ee)===0&&(v[ae]=-1,y[R+ae]=0),G!==0&&(A=xe)}for(O=0;O<d;O++)v[O]=Yo(v[O]);for(X=0;X<=d;X++)y[N+X]=-1;for(X=d;X>=0;X--)y[D+X]>0||(y[_+X]=y[N+v[X]],y[N+v[X]]=X);for(de=d;de>=0;de--)y[D+de]<=0||v[de]!==-1&&(y[_+de]=y[N+v[de]],y[N+v[de]]=de);for(ae=0,O=0;O<=d;O++)v[O]===-1&&(ae=Bv(O,ae,y,N,_,w,R));return w.splice(w.length-1,1),w};function i(u,c,f,m,p){var d=n(c);if(u===1&&m===f)return e(c,d);if(u===2){for(var h=d._index,x=d._ptr,b=0,T=0;T<f;T++){var v=x[T];if(x[T]=b,!(x[T+1]-v>p))for(var A=x[T+1];v<A;v++)h[b++]=h[v]}return x[f]=b,c=n(d),r(d,c)}return r(d,c)}function a(u,c,f,m,p,d,h,x,b,T,v,A){for(var w=0;w<u;w++)f[m+w]=c[w+1]-c[w];f[m+u]=0;for(var y=0;y<=u;y++)f[p+y]=-1,d[y]=-1,f[h+y]=-1,f[x+y]=-1,f[b+y]=1,f[T+y]=1,f[v+y]=0,f[A+y]=f[m+y];var E=s(0,0,f,T,u);return f[v+u]=-2,c[u]=-1,f[T+u]=0,E}function o(u,c,f,m,p,d,h,x,b,T,v){for(var A=0,w=0;w<u;w++){var y=f[m+w];if(y===0)f[p+w]=-2,A++,c[w]=-1,f[d+w]=0;else if(y>h)f[x+w]=0,f[p+w]=-1,A++,c[w]=Yo(u),f[x+u]++;else{var E=f[b+y];E!==-1&&(T[E]=w),f[v+w]=f[b+y],f[b+y]=w}}return A}function s(u,c,f,m,p){if(u<2||u+c<0){for(var d=0;d<p;d++)f[m+d]!==0&&(f[m+d]=1);u=2}return u}function l(u,c){return u!==c}});function AO(t,e,r,n,i,a,o){var s,l,u=0,c;if(t<=e||r[n+e]<=r[i+t])return-1;r[i+t]=r[n+e];var f=r[a+t];if(r[a+t]=e,f===-1)u=1,c=t;else{for(u=2,c=f;c!==r[o+c];c=r[o+c]);for(s=f;s!==c;s=l)l=r[o+s],r[o+s]=c}return{jleaf:u,q:c}}var Fre="csCounts",Ire=["transpose"],SO=M(Fre,Ire,t=>{var{transpose:e}=t;return function(r,n,i,a){if(!r||!n||!i)return null;var o=r._size,s=o[0],l=o[1],u,c,f,m,p,d,h,x=4*l+(a?l+s+1:0),b=[],T=0,v=l,A=2*l,w=3*l,y=4*l,E=5*l+1;for(f=0;f<x;f++)b[f]=-1;var D=[],_=e(r),N=_._index,C=_._ptr;for(f=0;f<l;f++)for(c=i[f],D[c]=b[w+c]===-1?1:0;c!==-1&&b[w+c]===-1;c=n[c])b[w+c]=f;if(a){for(f=0;f<l;f++)b[i[f]]=f;for(u=0;u<s;u++){for(f=l,d=C[u],h=C[u+1],p=d;p<h;p++)f=Math.min(f,b[N[p]]);b[E+u]=b[y+f],b[y+f]=u}}for(u=0;u<l;u++)b[T+u]=u;for(f=0;f<l;f++){for(c=i[f],n[c]!==-1&&D[n[c]]--,m=a?b[y+f]:c;m!==-1;m=a?b[E+m]:-1)for(p=C[m];p<C[m+1];p++){u=N[p];var B=AO(u,c,b,w,v,A,T);B.jleaf>=1&&D[c]++,B.jleaf===2&&D[B.q]--}n[c]!==-1&&(b[T+c]=n[c])}for(c=0;c<l;c++)n[c]!==-1&&(D[n[c]]+=D[c]);return D}});var Pre="csSqr",Bre=["add","multiply","transpose"],EO=M(Pre,Bre,t=>{var{add:e,multiply:r,transpose:n}=t,i=_O({add:e,multiply:r,transpose:n}),a=SO({transpose:n});return function(l,u,c){var f=u._ptr,m=u._size,p=m[1],d,h={};if(h.q=i(l,u),l&&!h.q)return null;if(c){var x=l?yO(u,null,h.q,0):u;h.parent=bO(x,1);var b=xO(h.parent,p);if(h.cp=a(x,h.parent,b,1),x&&h.parent&&h.cp&&o(x,h))for(h.unz=0,d=0;d<p;d++)h.unz+=h.cp[d]}else h.unz=4*f[p]+p,h.lnz=h.unz;return h};function o(s,l){var u=s._ptr,c=s._index,f=s._size,m=f[0],p=f[1];l.pinv=[],l.leftmost=[];var d=l.parent,h=l.pinv,x=l.leftmost,b=[],T=0,v=m,A=m+p,w=m+2*p,y,E,D,_,N;for(E=0;E<p;E++)b[v+E]=-1,b[A+E]=-1,b[w+E]=0;for(y=0;y<m;y++)x[y]=-1;for(E=p-1;E>=0;E--)for(_=u[E],N=u[E+1],D=_;D<N;D++)x[c[D]]=E;for(y=m-1;y>=0;y--)h[y]=-1,E=x[y],E!==-1&&(b[w+E]++===0&&(b[A+E]=y),b[T+y]=b[v+E],b[v+E]=y);for(l.lnz=0,l.m2=m,E=0;E<p;E++)if(y=b[v+E],l.lnz++,y<0&&(y=l.m2++),h[y]=E,!(--w[E]<=0)){l.lnz+=b[w+E];var C=d[E];C!==-1&&(b[w+C]===0&&(b[A+C]=b[A+E]),b[T+b[A+E]]=b[v+C],b[v+C]=b[T+y],b[w+C]+=b[w+E])}for(y=0;y<m;y++)h[y]<0&&(h[y]=E++);return!0}});function Sm(t,e){return t[e]<0}function kv(t,e){t[e]=Yo(t[e])}function US(t){return t<0?Yo(t):t}function TO(t,e,r,n,i){var a=e._index,o=e._ptr,s=e._size,l=s[1],u,c,f,m=0;for(n[0]=t;m>=0;){t=n[m];var p=i?i[t]:t;Sm(o,t)||(kv(o,t),n[l+m]=p<0?0:US(o[p]));var d=1;for(c=n[l+m],f=p<0?0:US(o[p+1]);c<f;c++)if(u=a[c],!Sm(o,u)){n[l+m]=c,n[++m]=u,d=0;break}d&&(m--,n[--r]=t)}return r}function DO(t,e,r,n,i){var a=t._ptr,o=t._size,s=e._index,l=e._ptr,u=o[1],c,f,m,p=u;for(f=l[r],m=l[r+1],c=f;c<m;c++){var d=s[c];Sm(a,d)||(p=TO(d,t,p,n,i))}for(c=p;c<u;c++)kv(a,n[c]);return p}var kre="csSpsolve",$re=["divideScalar","multiply","subtract"],MO=M(kre,$re,t=>{var{divideScalar:e,multiply:r,subtract:n}=t;return function(a,o,s,l,u,c,f){var m=a._values,p=a._index,d=a._ptr,h=a._size,x=h[1],b=o._values,T=o._index,v=o._ptr,A,w,y,E,D=DO(a,o,s,l,c);for(A=D;A<x;A++)u[l[A]]=0;for(w=v[s],y=v[s+1],A=w;A<y;A++)u[T[A]]=b[A];for(var _=D;_<x;_++){var N=l[_],C=c?c[N]:N;if(!(C<0))for(w=d[C],y=d[C+1],u[N]=e(u[N],m[f?w:y-1]),A=f?w+1:w,E=f?y:y-1;A<E;A++){var B=p[A];u[B]=n(u[B],r(m[A],u[N]))}}return D}});var Ore="csLu",Rre=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],CO=M(Ore,Rre,t=>{var{abs:e,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=t,l=MO({divideScalar:r,multiply:n,subtract:i});return function(c,f,m){if(!c)return null;var p=c._size,d=p[1],h,x=100,b=100;f&&(h=f.q,x=f.lnz||x,b=f.unz||b);var T=[],v=[],A=[],w=new s({values:T,index:v,ptr:A,size:[d,d]}),y=[],E=[],D=[],_=new s({values:y,index:E,ptr:D,size:[d,d]}),N=[],C,B,R=[],V=[];for(C=0;C<d;C++)R[C]=0,N[C]=-1,A[C+1]=0;x=0,b=0;for(var L=0;L<d;L++){A[L]=x,D[L]=b;var P=h?h[L]:L,k=l(w,c,P,V,R,N,1),W=-1,O=-1;for(B=k;B<d;B++)if(C=V[B],N[C]<0){var X=e(R[C]);a(X,O)&&(O=X,W=C)}else E[b]=N[C],y[b++]=R[C];if(W===-1||O<=0)return null;N[P]<0&&o(e(R[P]),n(O,m))&&(W=P);var ae=R[W];for(E[b]=L,y[b++]=ae,N[W]=L,v[x]=W,T[x++]=1,B=k;B<d;B++)C=V[B],N[C]<0&&(v[x]=C,T[x++]=r(R[C],ae)),R[C]=0}for(A[d]=x,D[d]=b,B=0;B<x;B++)v[B]=N[v[B]];return T.splice(x,T.length-x),v.splice(x,v.length-x),y.splice(b,y.length-b),E.splice(b,E.length-b),{L:w,U:_,pinv:N}}});var NO="slu",Lre=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],qS=M(NO,Lre,t=>{var{typed:e,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:l,largerEq:u,SparseMatrix:c}=t,f=EO({add:n,multiply:i,transpose:a}),m=CO({abs:r,divideScalar:o,multiply:i,subtract:s,larger:l,largerEq:u,SparseMatrix:c});return e(NO,{"SparseMatrix, number, number":function(d,h,x){if(!Qe(h)||h<0||h>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(x<0||x>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var b=f(h,d,!1),T=m(d,b,x);return{L:T.L,U:T.U,p:T.pinv,q:b.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function zS(t,e){var r,n=e.length,i=[];if(t)for(r=0;r<n;r++)i[t[r]]=e[r];else for(r=0;r<n;r++)i[r]=e[r];return i}var FO="lusolve",Vre=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],HS=M(FO,Vre,t=>{var{typed:e,matrix:r,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=t,l=gs({DenseMatrix:s});return e(FO,{"Array, Array | Matrix":function(m,p){m=r(m);var d=n(m),h=c(d.L,d.U,d.p,null,p);return h.valueOf()},"DenseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix":function(m,p){var d=n(m);return c(d.L,d.U,d.p,null,p)},"SparseMatrix, Array | Matrix, number, number":function(m,p,d,h){var x=i(m,d,h);return c(x.L,x.U,x.p,x.q,p)},"Object, Array | Matrix":function(m,p){return c(m.L,m.U,m.p,m.q,p)}});function u(f){if(rt(f))return f;if(vr(f))return r(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,m,p,d,h){f=u(f),m=u(m),p&&(h=l(f,h,!0),h._data=zS(p,h._data));var x=o(f,h),b=a(m,x);return d&&(b._data=zS(d,b._data)),b}});var IO="polynomialRoot",Ure=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],GS=M(IO,Ure,t=>{var{typed:e,isZero:r,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:l,unaryMinus:u,cbrt:c,typeOf:f,im:m,re:p}=t;return e(IO,{"number|Complex, ...number|Complex":(d,h)=>{for(var x=[d,...h];x.length>0&&r(x[x.length-1]);)x.pop();if(x.length<2)throw new RangeError("Polynomial [".concat(d,", ").concat(h,"] must have a non-zero non-constant coefficient"));switch(x.length){case 2:return[u(s(x[0],x[1]))];case 3:{var[b,T,v]=x,A=o(2,v),w=o(T,T),y=o(4,v,b);if(n(w,y))return[s(u(T),A)];var E=l(a(w,y));return[s(a(E,T),A),s(a(u(E),T),A)]}case 4:{var[D,_,N,C]=x,B=u(o(3,C)),R=o(N,N),V=o(3,C,_),L=i(o(2,N,N,N),o(27,C,C,D)),P=o(9,C,N,_);if(n(R,V)&&n(L,P))return[s(N,B)];var k=a(R,V),W=a(L,P),O=i(o(18,C,N,_,D),o(N,N,_,_)),X=i(o(4,N,N,N,D),o(4,C,_,_,_),o(27,C,C,D,D));if(n(O,X))return[s(a(o(4,C,N,_),i(o(9,C,C,D),o(N,N,N))),o(C,k)),s(a(o(9,C,D),o(N,_)),o(2,k))];var ae;n(R,V)?ae=W:ae=s(i(W,l(a(o(W,W),o(4,k,k,k)))),2);var J=!0,U=c(ae,J).toArray().map(de=>s(i(N,de,s(k,de)),B));return U.map(de=>f(de)==="Complex"&&n(p(de),p(de)+m(de))?p(de):de)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(x))}}})});var qre="Help",zre=["evaluate"],WS=M(qre,zre,t=>{var{evaluate:e}=t;function r(n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!n)throw new Error('Argument "doc" missing');this.doc=n}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var n=this.doc||{},i=`
`;if(n.name&&(i+="Name: "+n.name+`

`),n.category&&(i+="Category: "+n.category+`

`),n.description&&(i+=`Description:
    `+n.description+`

`),n.syntax&&(i+=`Syntax:
    `+n.syntax.join(`
    `)+`

`),n.examples){i+=`Examples:
`;for(var a=!1,o=e("config()"),s={config:f=>(a=!0,e("config(newConfig)",{newConfig:f}))},l=0;l<n.examples.length;l++){var u=n.examples[l];i+="    "+u+`
`;var c=void 0;try{c=e(u,s)}catch(f){c=f}c!==void 0&&!Dg(c)&&(i+="        "+Dt(c,{precision:14})+`
`)}i+=`
`,a&&e("config(originalConfig)",{originalConfig:o})}return n.mayThrow&&n.mayThrow.length&&(i+="Throws: "+n.mayThrow.join(", ")+`

`),n.seealso&&n.seealso.length&&(i+="See also: "+n.seealso.join(", ")+`
`),i},r.prototype.toJSON=function(){var n=yt(this.doc);return n.mathjs="Help",n},r.fromJSON=function(n){var i={};return Object.keys(n).filter(a=>a!=="mathjs").forEach(a=>{i[a]=n[a]}),new r(i)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0});var Hre="Chain",Gre=["?on","math","typed"],YS=M(Hre,Gre,t=>{var{on:e,math:r,typed:n}=t;function i(u){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Mg(u)?this.value=u.value:this.value=u}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Dt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(u){return new i(u.value)};function a(u,c){typeof c=="function"&&(i.prototype[u]=s(c))}function o(u,c){K2(i.prototype,u,function(){var m=c();if(typeof m=="function")return s(m)})}function s(u){return function(){if(arguments.length===0)return new i(u(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(n.isTypedFunction(u)){var m=n.resolve(u,c);if(m.params.length===1)throw new Error("chain function "+u.name+" cannot match rest parameter between chain value and additional arguments.");return new i(m.implementation.apply(u,c))}return new i(u.apply(u,c))}}i.createProxy=function(u,c){if(typeof u=="string")a(u,c);else{var f=function(d){st(u,d)&&l[d]===void 0&&o(d,()=>u[d])};for(var m in u)f(m)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),e&&e("import",function(u,c,f){f||o(u,c)}),i},{isClass:!0});var jS={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 PO={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var BO={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 kO={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 $O={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var OO={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var RO={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 LO={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 VO={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var UO={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var qO={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 ZS={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 zO={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 HO={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var GO={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 WO={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var YO={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var jO={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","bigint","complex","fraction","index","matrix","string","unit"]};var ZO={name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]};var JO={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 XO={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 QO={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 KO={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 eR={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 tR={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 rR={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","bigint","boolean","complex","fraction","index","matrix","string","unit"]};var nR={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 iR={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 aR={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 oR={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 sR={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 uR={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 lR={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 cR={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 fR={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 pR={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 mR={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 dR={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 hR={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 gR={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 vR={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 yR={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 xR={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 bR={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 wR={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 _R={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 AR={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 SR={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 ER={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 TR={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 DR={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var MR={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 CR={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 NR={name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],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)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]};var FR={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 IR={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 PR={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 BR={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 kR={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 $R={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 OR={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 RR={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 LR={name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],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)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]};var VR={name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],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)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]};var UR={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 qR={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var zR={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 HR={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 GR={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 WR={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 YR={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 jR={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 ZR={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 JR={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 XR={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 QR={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 KR={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 eL={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 tL={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 rL={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 nL={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 iL={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 aL={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 oL={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 sL={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 uL={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 lL={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 cL={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 fL={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var pL={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 mL={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 dL={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 hL={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 gL={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 vL={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 yL={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 xL={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 bL={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 wL={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 _L={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 AL={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 SL={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 EL={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 TL={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 DL={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 ML={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 CL={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 NL={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 FL={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 IL={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 PL={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 BL={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 kL={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 $L={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 OL={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 RL={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 LL={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 VL={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 UL={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 qL={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 zL={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 indicate 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 HL={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 GL={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 WL={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 YL={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 jL={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 ZL={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 JL={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 XL={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 QL={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 KL={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 e3={name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]};var t3={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 r3={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 n3={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 i3={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 a3={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 o3={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 s3={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 u3={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 l3={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 c3={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 f3={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 p3={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 m3={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 d3={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 h3={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 g3={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 v3={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 y3={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 x3={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var b3={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var w3={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 _3={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 A3={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 S3={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 E3={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 T3={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 D3={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 M3={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 C3={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 N3={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 F3={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 I3={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 P3={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 B3={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 k3={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 $3={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 O3={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 R3={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 L3={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 V3={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 U3={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 q3={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 z3={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 H3={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 G3={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 W3={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 Y3={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 j3={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 Z3={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 J3={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 X3={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 Q3={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 K3={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 e4={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 t4={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 r4={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var n4={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 i4={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 a4={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 o4={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 s4={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 u4={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 l4={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 c4={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 probability 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 f4={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 p4={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 m4={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 d4={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 h4={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 g4={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 v4={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 y4={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 x4={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var b4={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 w4={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var _4={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 A4={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var S4={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 E4={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 T4={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 D4={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 M4={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 C4={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 N4={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 F4={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 I4={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 P4={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 B4={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 k4={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 $4={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 O4={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 R4={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var L4={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 V4={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 U4={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 q4={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var z4={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 H4={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 G4={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 W4={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var Y4={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 j4={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 Z4={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 J4={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 X4={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 Q4={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 K4={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 eV={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]};var tV={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var rV={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 nV={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 iV={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 aV={bignumber:jO,bigint:ZO,boolean:JO,complex:XO,createUnit:QO,fraction:KO,index:eR,matrix:tR,number:rR,sparse:nR,splitUnit:iR,string:aR,unit:oR,e:jS,E:jS,false:PO,i:BO,Infinity:kO,LN2:OO,LN10:$O,LOG2E:LO,LOG10E:RO,NaN:VO,null:UO,pi:ZS,PI:ZS,phi:qO,SQRT1_2:zO,SQRT2:HO,tau:GO,true:WO,version:YO,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:"Bohr 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:"Bohr 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:cR,lsolve:pR,lsolveAll:mR,lup:dR,lusolve:hR,leafCount:fR,polynomialRoot:gR,resolve:xR,simplify:bR,simplifyConstant:wR,simplifyCore:_R,symbolicEqual:SR,rationalize:yR,slu:AR,usolve:ER,usolveAll:TR,qr:vR,abs:DR,add:MR,cbrt:CR,ceil:NR,cube:FR,divide:IR,dotDivide:PR,dotMultiply:BR,dotPow:kR,exp:$R,expm:OR,expm1:RR,fix:LR,floor:VR,gcd:UR,hypot:qR,lcm:HR,log:GR,log2:jR,log1p:YR,log10:WR,mod:ZR,multiply:JR,norm:XR,nthRoot:QR,nthRoots:KR,pow:eL,round:tL,sign:rL,sqrt:nL,sqrtm:iL,square:uL,subtract:lL,unaryMinus:cL,unaryPlus:fL,xgcd:pL,invmod:zR,bitAnd:mL,bitNot:dL,bitOr:hL,bitXor:gL,leftShift:vL,rightArithShift:yL,rightLogShift:xL,bellNumbers:bL,catalan:wL,composition:_L,stirlingS2:AL,config:sR,import:uR,typed:lR,arg:SL,conj:EL,re:DL,im:TL,evaluate:ML,help:CL,distance:NL,intersect:FL,and:IL,not:PL,or:BL,xor:kL,concat:OL,count:RL,cross:LL,column:$L,ctranspose:VL,det:UL,diag:qL,diff:zL,dot:HL,getMatrixDataType:ZL,identity:JL,filter:WL,flatten:YL,forEach:jL,inv:XL,pinv:QL,eigs:GL,kron:KL,matrixFromFunction:r3,matrixFromRows:n3,matrixFromColumns:t3,map:e3,ones:i3,partitionSelect:a3,range:o3,resize:u3,reshape:s3,rotate:l3,rotationMatrix:c3,row:f3,size:p3,sort:m3,squeeze:d3,subset:h3,trace:g3,transpose:v3,zeros:y3,fft:x3,ifft:b3,sylvester:aL,schur:oL,lyap:sL,solveODE:iV,combinations:w3,combinationsWithRep:_3,factorial:A3,gamma:S3,kldivergence:T3,lgamma:E3,multinomial:D3,permutations:M3,pickRandom:C3,random:N3,randomInt:F3,compare:I3,compareNatural:P3,compareText:B3,deepEqual:k3,equal:$3,equalText:O3,larger:R3,largerEq:L3,smaller:V3,smallerEq:U3,unequal:q3,setCartesian:z3,setDifference:H3,setDistinct:G3,setIntersect:W3,setIsSubset:Y3,setMultiplicity:j3,setPowerset:Z3,setSize:J3,setSymDifference:X3,setUnion:Q3,zpk2tf:K3,freqz:e4,erf:t4,zeta:r4,cumsum:p4,mad:n4,max:i4,mean:a4,median:o4,min:s4,mode:u4,prod:l4,quantileSeq:c4,std:f4,sum:m4,variance:d4,corr:h4,acos:g4,acosh:v4,acot:y4,acoth:x4,acsc:b4,acsch:w4,asec:_4,asech:A4,asin:S4,asinh:E4,atan:T4,atanh:M4,atan2:D4,cos:C4,cosh:N4,cot:F4,coth:I4,csc:P4,csch:B4,sec:k4,sech:$4,sin:O4,sinh:R4,tan:L4,tanh:V4,to:U4,clone:z4,format:H4,bin:q4,oct:tV,hex:W4,isNaN:j4,isInteger:Y4,isNegative:Z4,isNumeric:J4,hasNumericValue:G4,isPositive:X4,isPrime:Q4,isZero:K4,print:rV,typeOf:nV,numeric:eV};var oV="help",Wre=["typed","mathWithTransform","Help"],JS=M(oV,Wre,t=>{var{typed:e,mathWithTransform:r,Help:n}=t;return e(oV,{any:function(a){var o,s=a;if(typeof a!="string"){for(o in r)if(st(r,o)&&a===r[o]){s=o;break}}var l=rn(aV,s);if(!l){var u=typeof s=="function"?s.name:s;throw new Error('No documentation found on "'+u+'"')}return new n(l)}})});var sV="chain",Yre=["typed","Chain"],XS=M(sV,Yre,t=>{var{typed:e,Chain:r}=t;return e(sV,{"":function(){return new r},any:function(i){return new r(i)}})});var uV="det",jre=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],QS=M(uV,jre,t=>{var{typed:e,matrix:r,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=t;return e(uV,{any:function(c){return yt(c)},"Array | Matrix":function(c){var f;switch(rt(c)?f=c.size():Array.isArray(c)?(c=r(c),f=c.size()):f=[],f.length){case 0:return yt(c);case 1:if(f[0]===1)return yt(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Dt(f)+")");case 2:{var m=f[0],p=f[1];if(m===p)return l(c.clone().valueOf(),m,p);if(p===0)return 1;throw new RangeError("Matrix must be square (size: "+Dt(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(f)+")")}}});function l(u,c,f){if(c===1)return yt(u[0][0]);if(c===2)return n(i(u[0][0],u[1][1]),i(u[1][0],u[0][1]));for(var m=!1,p=new Array(c).fill(0).map((E,D)=>D),d=0;d<c;d++){var h=p[d];if(o(u[h][d])){var x=void 0;for(x=d+1;x<c;x++)if(!o(u[p[x]][d])){h=p[x],p[x]=p[d],p[d]=h,m=!m;break}if(x===c)return u[h][d]}for(var b=u[h][d],T=d===0?1:u[p[d-1]][d-1],v=d+1;v<c;v++)for(var A=p[v],w=d+1;w<c;w++)u[A][w]=a(n(i(u[A][w],b),i(u[A][d],u[h][w])),T)}var y=u[p[c-1]][c-1];return m?s(y):y}});var lV="inv",Zre=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],KS=M(lV,Zre,t=>{var{typed:e,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:l,abs:u}=t;return e(lV,{"Array | Matrix":function(m){var p=rt(m)?m.size():pt(m);switch(p.length){case 1:if(p[0]===1)return rt(m)?r([n(1,m.valueOf()[0])]):[n(1,m[0])];throw new RangeError("Matrix must be square (size: "+Dt(p)+")");case 2:{var d=p[0],h=p[1];if(d===h)return rt(m)?r(c(m.valueOf(),d,h),m.storage()):c(m,d,h);throw new RangeError("Matrix must be square (size: "+Dt(p)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(p)+")")}},any:function(m){return n(1,m)}});function c(f,m,p){var d,h,x,b,T;if(m===1){if(b=f[0][0],b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,b)]]}else if(m===2){var v=s(f);if(v===0)throw Error("Cannot calculate inverse, determinant is zero");return[[n(f[1][1],v),n(o(f[0][1]),v)],[n(o(f[1][0]),v),n(f[0][0],v)]]}else{var A=f.concat();for(d=0;d<m;d++)A[d]=A[d].concat();for(var w=l(m).valueOf(),y=0;y<p;y++){var E=u(A[y][y]),D=y;for(d=y+1;d<m;)u(A[d][y])>E&&(E=u(A[d][y]),D=d),d++;if(E===0)throw Error("Cannot calculate inverse, determinant is zero");d=D,d!==y&&(T=A[y],A[y]=A[d],A[d]=T,T=w[y],w[y]=w[d],w[d]=T);var _=A[y],N=w[y];for(d=0;d<m;d++){var C=A[d],B=w[d];if(d!==y){if(C[y]!==0){for(x=n(o(C[y]),_[y]),h=y;h<p;h++)C[h]=i(C[h],a(x,_[h]));for(h=0;h<p;h++)B[h]=i(B[h],a(x,N[h]))}}else{for(x=_[y],h=y;h<p;h++)C[h]=n(C[h],x);for(h=0;h<p;h++)B[h]=n(B[h],x)}}}return w}}});var cV="pinv",Jre=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],eE=M(cV,Jre,t=>{var{typed:e,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:l,divideScalar:u,multiply:c,add:f,Complex:m}=t;return e(cV,{"Array | Matrix":function(v){var A=rt(v)?v.size():pt(v);switch(A.length){case 1:return b(v)?l(v):A[0]===1?n(v):o(l(v),s(v,v));case 2:{if(b(v))return l(v);var w=A[0],y=A[1];if(w===y)try{return n(v)}catch(E){if(!(E instanceof Error&&E.message.match(/Cannot calculate inverse, determinant is zero/)))throw E}return rt(v)?r(p(v.valueOf(),w,y),v.storage()):p(v,w,y)}default:throw new RangeError("Matrix must be two dimensional (size: "+Dt(A)+")")}},any:function(v){return a(v,0)?yt(v):u(1,v)}});function p(T,v,A){var{C:w,F:y}=h(T,v,A),E=c(n(c(l(w),w)),l(w)),D=c(l(y),n(c(y,l(y))));return c(D,E)}function d(T,v,A){for(var w=yt(T),y=0,E=0;E<v;E++){if(A<=y)return w;for(var D=E;x(w[D][y]);)if(D++,v===D&&(D=E,y++,A===y))return w;[w[D],w[E]]=[w[E],w[D]];for(var _=w[E][y],N=0;N<A;N++)w[E][N]=o(w[E][N],_);for(var C=0;C<v;C++)if(C!==E){_=w[C][y];for(var B=0;B<A;B++)w[C][B]=f(w[C][B],c(-1,c(_,w[E][B])))}y++}return w}function h(T,v,A){var w=d(T,v,A),y=T.map((D,_)=>D.filter((N,C)=>C<v&&!x(s(w[C],w[C])))),E=w.filter((D,_)=>!x(s(w[_],w[_])));return{C:y,F:E}}function x(T){return a(f(T,m(1,1)),f(0,m(1,1)))}function b(T){return i(f(T,m(1,1)),f(c(T,0),m(1,1)))}});function fV(t){var{addScalar:e,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:l,bignumber:u,diag:c,size:f,reshape:m,inv:p,qr:d,usolve:h,usolveAll:x,equal:b,complex:T,larger:v,smaller:A,matrixFromColumns:w,dot:y}=t;function E(J,U,de,we){var se=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,be=D(J,U,de,we,se);_(J,U,de,we,se,be);var{values:K,C:j}=N(J,U,de,we,se);if(se){var ne=C(J,U,j,be,K,de,we);return{values:K,eigenvectors:ne}}return{values:K}}function D(J,U,de,we,se){var be=we==="BigNumber",K=we==="Complex",j=be?u(0):0,ne=be?u(1):K?T(1):1,pe=be?u(1):1,fe=be?u(10):2,Ae=a(fe,fe),_e;se&&(_e=Array(U).fill(ne));for(var G=!1;!G;){G=!0;for(var Z=0;Z<U;Z++){for(var ge=j,xe=j,Ee=0;Ee<U;Ee++)Z!==Ee&&(ge=e(ge,l(J[Ee][Z])),xe=e(xe,l(J[Z][Ee])));if(!b(ge,0)&&!b(xe,0)){for(var Be=pe,Ve=ge,et=o(xe,fe),St=a(xe,fe);A(Ve,et);)Ve=a(Ve,Ae),Be=a(Be,fe);for(;v(Ve,St);)Ve=o(Ve,Ae),Be=o(Be,fe);var Ye=A(o(e(Ve,xe),Be),a(e(ge,xe),.95));if(Ye){G=!1;for(var ur=o(1,Be),Jt=0;Jt<U;Jt++)Z!==Jt&&(J[Z][Jt]=a(J[Z][Jt],ur),J[Jt][Z]=a(J[Jt][Z],Be));se&&(_e[Z]=a(_e[Z],ur))}}}}return se?c(_e):null}function _(J,U,de,we,se,be){var K=we==="BigNumber",j=we==="Complex",ne=K?u(0):j?T(0):0;K&&(de=u(de));for(var pe=0;pe<U-2;pe++){for(var fe=0,Ae=ne,_e=pe+1;_e<U;_e++){var G=J[_e][pe];A(l(Ae),l(G))&&(Ae=G,fe=_e)}if(!A(l(Ae),de)){if(fe!==pe+1){var Z=J[fe];J[fe]=J[pe+1],J[pe+1]=Z;for(var ge=0;ge<U;ge++){var xe=J[ge][fe];J[ge][fe]=J[ge][pe+1],J[ge][pe+1]=xe}if(se){var Ee=be[fe];be[fe]=be[pe+1],be[pe+1]=Ee}}for(var Be=pe+2;Be<U;Be++){var Ve=o(J[Be][pe],Ae);if(Ve!==0){for(var et=0;et<U;et++)J[Be][et]=r(J[Be][et],a(Ve,J[pe+1][et]));for(var St=0;St<U;St++)J[St][pe+1]=e(J[St][pe+1],a(Ve,J[St][Be]));if(se)for(var Ye=0;Ye<U;Ye++)be[Be][Ye]=r(be[Be][Ye],a(Ve,be[pe+1][Ye]))}}}}return be}function N(J,U,de,we,se){var be=we==="BigNumber",K=we==="Complex",j=be?u(1):K?T(1):1;be&&(de=u(de));for(var ne=yt(J),pe=[],fe=U,Ae=[],_e=se?c(Array(U).fill(j)):void 0,G=se?c(Array(fe).fill(j)):void 0,Z=0;Z<=100;){Z+=1;for(var ge=ne[fe-1][fe-1],xe=0;xe<fe;xe++)ne[xe][xe]=r(ne[xe][xe],ge);var{Q:Ee,R:Be}=d(ne);ne=i(Be,Ee);for(var Ve=0;Ve<fe;Ve++)ne[Ve][Ve]=e(ne[Ve][Ve],ge);if(se&&(G=i(G,Ee)),fe===1||A(l(ne[fe-1][fe-2]),de)){Z=0,pe.push(ne[fe-1][fe-1]),se&&(Ae.unshift([[1]]),V(G,U),_e=i(_e,G),fe>1&&(G=c(Array(fe-1).fill(j)))),fe-=1,ne.pop();for(var et=0;et<fe;et++)ne[et].pop()}else if(fe===2||A(l(ne[fe-2][fe-3]),de)){Z=0;var St=B(ne[fe-2][fe-2],ne[fe-2][fe-1],ne[fe-1][fe-2],ne[fe-1][fe-1]);pe.push(...St),se&&(Ae.unshift(R(ne[fe-2][fe-2],ne[fe-2][fe-1],ne[fe-1][fe-2],ne[fe-1][fe-1],St[0],St[1],de,we)),V(G,U),_e=i(_e,G),fe>2&&(G=c(Array(fe-2).fill(j)))),fe-=2,ne.pop(),ne.pop();for(var Ye=0;Ye<fe;Ye++)ne[Ye].pop(),ne[Ye].pop()}if(fe===0)break}if(pe.sort((He,at)=>+r(l(He),l(at))),Z>100){var ur=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+pe.join(", "));throw ur.values=pe,ur.vectors=[],ur}var Jt=se?i(_e,L(Ae,U)):void 0;return{values:pe,C:Jt}}function C(J,U,de,we,se,be,K){var j=p(de),ne=i(j,J,de),pe=K==="BigNumber",fe=K==="Complex",Ae=pe?u(0):fe?T(0):0,_e=pe?u(1):fe?T(1):1,G=[],Z=[];for(var ge of se){var xe=P(G,ge,b);xe===-1?(G.push(ge),Z.push(1)):Z[xe]+=1}for(var Ee=[],Be=G.length,Ve=Array(U).fill(Ae),et=c(Array(U).fill(_e)),St=function(){var Jt=G[Ye],He=r(ne,i(Jt,et)),at=x(He,Ve);for(at.shift();at.length<Z[Ye];){var Q=k(He,U,at,be,K);if(Q===null)break;at.push(Q)}var me=i(p(we),de);at=at.map(he=>i(me,he)),Ee.push(...at.map(he=>({value:Jt,vector:n(he)})))},Ye=0;Ye<Be;Ye++)St();return Ee}function B(J,U,de,we){var se=e(J,we),be=r(a(J,we),a(U,de)),K=a(se,.5),j=a(s(r(a(se,se),a(4,be))),.5);return[e(K,j),r(K,j)]}function R(J,U,de,we,se,be,K,j){var ne=j==="BigNumber",pe=j==="Complex",fe=ne?u(0):pe?T(0):0,Ae=ne?u(1):pe?T(1):1;if(A(l(de),K))return[[Ae,fe],[fe,Ae]];if(v(l(r(se,be)),K))return[[r(se,we),r(be,we)],[de,de]];var _e=r(J,se),G=r(we,se);return A(l(U),K)&&A(l(G),K)?[[_e,Ae],[de,fe]]:[[U,fe],[G,Ae]]}function V(J,U){for(var de=0;de<J.length;de++)J[de].push(...Array(U-J[de].length).fill(0));for(var we=J.length;we<U;we++)J.push(Array(U).fill(0)),J[we][we]=1;return J}function L(J,U){for(var de=[],we=0;we<U;we++)de[we]=Array(U).fill(0);var se=0;for(var be of J){for(var K=be.length,j=0;j<K;j++)for(var ne=0;ne<K;ne++)de[se+j][se+ne]=be[j][ne];se+=K}return de}function P(J,U,de){for(var we=0;we<J.length;we++)if(de(J[we],U))return we;return-1}function k(J,U,de,we,se){for(var be=se==="BigNumber"?u(1e3):1e3,K,j=0;j<5;++j){K=W(U,de,se);try{K=h(J,K)}catch{continue}if(v(X(K),be))break}if(j>=5)return null;for(j=0;;){var ne=h(J,K);if(A(X(O(K,[ne])),we))break;if(++j>=10)return null;K=ae(ne)}return K}function W(J,U,de){var we=de==="BigNumber",se=de==="Complex",be=Array(J).fill(0).map(K=>2*Math.random()-1);return we&&(be=be.map(K=>u(K))),se&&(be=be.map(K=>T(K))),be=O(be,U),ae(be,de)}function O(J,U){var de=f(J);for(var we of U)we=m(we,de),J=r(J,i(o(y(we,J),y(we,we)),we));return J}function X(J){return l(s(y(J,J)))}function ae(J,U){var de=U==="BigNumber",we=U==="Complex",se=de?u(1):we?T(1):1;return i(o(se,X(J)),J)}return E}function pV(t){var{config:e,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:l,inv:u,bignumber:c,multiply:f,add:m}=t;function p(_,N){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.relTol,B=arguments.length>3?arguments[3]:void 0,R=arguments.length>4?arguments[4]:void 0;if(B==="number")return d(_,C,R);if(B==="BigNumber")return h(_,C,R);throw TypeError("Unsupported data type: "+B)}function d(_,N,C){var B=_.length,R=Math.abs(N/B),V,L;if(C){L=new Array(B);for(var P=0;P<B;P++)L[P]=Array(B).fill(0),L[P][P]=1}for(var k=y(_);Math.abs(k[1])>=Math.abs(R);){var W=k[0][0],O=k[0][1];V=x(_[W][W],_[O][O],_[W][O]),_=w(_,V,W,O),C&&(L=T(L,V,W,O)),k=y(_)}for(var X=Array(B).fill(0),ae=0;ae<B;ae++)X[ae]=_[ae][ae];return D(yt(X),L,C)}function h(_,N,C){var B=_.length,R=i(N/B),V,L;if(C){L=new Array(B);for(var P=0;P<B;P++)L[P]=Array(B).fill(0),L[P][P]=1}for(var k=E(_);i(k[1])>=i(R);){var W=k[0][0],O=k[0][1];V=b(_[W][W],_[O][O],_[W][O]),_=A(_,V,W,O),C&&(L=v(L,V,W,O)),k=E(_)}for(var X=Array(B).fill(0),ae=0;ae<B;ae++)X[ae]=_[ae][ae];return D(yt(X),L,C)}function x(_,N,C){var B=N-_;return Math.abs(B)<=e.relTol?Math.PI/4:.5*Math.atan(2*C/(N-_))}function b(_,N,C){var B=n(N,_);return i(B)<=e.relTol?c(-1).acos().div(4):l(.5,a(f(2,C,u(B))))}function T(_,N,C,B){for(var R=_.length,V=Math.cos(N),L=Math.sin(N),P=Array(R).fill(0),k=Array(R).fill(0),W=0;W<R;W++)P[W]=V*_[W][C]-L*_[W][B],k[W]=L*_[W][C]+V*_[W][B];for(var O=0;O<R;O++)_[O][C]=P[O],_[O][B]=k[O];return _}function v(_,N,C,B){for(var R=_.length,V=o(N),L=s(N),P=Array(R).fill(c(0)),k=Array(R).fill(c(0)),W=0;W<R;W++)P[W]=n(l(V,_[W][C]),l(L,_[W][B])),k[W]=r(l(L,_[W][C]),l(V,_[W][B]));for(var O=0;O<R;O++)_[O][C]=P[O],_[O][B]=k[O];return _}function A(_,N,C,B){for(var R=_.length,V=c(o(N)),L=c(s(N)),P=l(V,V),k=l(L,L),W=Array(R).fill(c(0)),O=Array(R).fill(c(0)),X=f(c(2),V,L,_[C][B]),ae=r(n(l(P,_[C][C]),X),l(k,_[B][B])),J=m(l(k,_[C][C]),X,l(P,_[B][B])),U=0;U<R;U++)W[U]=n(l(V,_[C][U]),l(L,_[B][U])),O[U]=r(l(L,_[C][U]),l(V,_[B][U]));_[C][C]=ae,_[B][B]=J,_[C][B]=c(0),_[B][C]=c(0);for(var de=0;de<R;de++)de!==C&&de!==B&&(_[C][de]=W[de],_[de][C]=W[de],_[B][de]=O[de],_[de][B]=O[de]);return _}function w(_,N,C,B){for(var R=_.length,V=Math.cos(N),L=Math.sin(N),P=V*V,k=L*L,W=Array(R).fill(0),O=Array(R).fill(0),X=P*_[C][C]-2*V*L*_[C][B]+k*_[B][B],ae=k*_[C][C]+2*V*L*_[C][B]+P*_[B][B],J=0;J<R;J++)W[J]=V*_[C][J]-L*_[B][J],O[J]=L*_[C][J]+V*_[B][J];_[C][C]=X,_[B][B]=ae,_[C][B]=0,_[B][C]=0;for(var U=0;U<R;U++)U!==C&&U!==B&&(_[C][U]=W[U],_[U][C]=W[U],_[B][U]=O[U],_[U][B]=O[U]);return _}function y(_){for(var N=_.length,C=0,B=[0,1],R=0;R<N;R++)for(var V=R+1;V<N;V++)Math.abs(C)<Math.abs(_[R][V])&&(C=Math.abs(_[R][V]),B=[R,V]);return[B,C]}function E(_){for(var N=_.length,C=0,B=[0,1],R=0;R<N;R++)for(var V=R+1;V<N;V++)i(C)<i(_[R][V])&&(C=i(_[R][V]),B=[R,V]);return[B,C]}function D(_,N,C){var B=_.length,R=Array(B),V;if(C){V=Array(B);for(var L=0;L<B;L++)V[L]=Array(B)}for(var P=0;P<B;P++){for(var k=0,W=_[0],O=0;O<_.length;O++)i(_[O])<i(W)&&(k=O,W=_[k]);if(R[P]=_.splice(k,1)[0],C)for(var X=0;X<B;X++)V[P][X]=N[X][k],N[X].splice(k,1)}if(!C)return{values:R};var ae=V.map((J,U)=>({value:R[U],vector:J}));return{values:R,eigenvectors:ae}}return p}var Xre="eigs",Qre=["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"],tE=M(Xre,Qre,t=>{var{config:e,typed:r,matrix:n,addScalar:i,subtract:a,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,divideScalar:m,inv:p,bignumber:d,multiply:h,add:x,larger:b,column:T,flatten:v,number:A,complex:w,sqrt:y,diag:E,size:D,reshape:_,qr:N,usolve:C,usolveAll:B,im:R,re:V,smaller:L,matrixFromColumns:P,dot:k}=t,W=pV({config:e,addScalar:i,subtract:a,column:T,flatten:v,equal:o,abs:s,atan:l,cos:u,sin:c,multiplyScalar:f,inv:p,bignumber:d,complex:w,multiply:h,add:x}),O=fV({config:e,addScalar:i,subtract:a,multiply:h,multiplyScalar:f,flatten:v,divideScalar:m,sqrt:y,abs:s,bignumber:d,diag:E,size:D,reshape:_,qr:N,inv:p,usolve:C,usolveAll:B,equal:o,complex:w,larger:b,smaller:L,matrixFromColumns:P,dot:k});return r("eigs",{Array:function(be){return X(n(be))},"Array, number|BigNumber":function(be,K){return X(n(be),{precision:K})},"Array, Object"(se,be){return X(n(se),be)},Matrix:function(be){return X(be,{matricize:!0})},"Matrix, number|BigNumber":function(be,K){return X(be,{precision:K,matricize:!0})},"Matrix, Object":function(be,K){var j={matricize:!0};return sn(j,K),X(be,j)}});function X(se){var be,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j="eigenvectors"in K?K.eigenvectors:!0,ne=(be=K.precision)!==null&&be!==void 0?be:e.relTol,pe=ae(se,ne,j);return K.matricize&&(pe.values=n(pe.values),j&&(pe.eigenvectors=pe.eigenvectors.map(fe=>{var{value:Ae,vector:_e}=fe;return{value:Ae,vector:n(_e)}}))),j&&Object.defineProperty(pe,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),pe}function ae(se,be,K){var j=se.toArray(),ne=se.size();if(ne.length!==2||ne[0]!==ne[1])throw new RangeError("Matrix must be square (size: ".concat(Dt(ne),")"));var pe=ne[0];if(U(j,pe,be)&&(de(j,pe),J(j,pe,be))){var fe=we(se,j,pe);return W(j,pe,be,fe,K)}var Ae=we(se,j,pe);return O(j,pe,be,Ae,K)}function J(se,be,K){for(var j=0;j<be;j++)for(var ne=j;ne<be;ne++)if(b(d(s(a(se[j][ne],se[ne][j]))),K))return!1;return!0}function U(se,be,K){for(var j=0;j<be;j++)for(var ne=0;ne<be;ne++)if(b(d(s(R(se[j][ne]))),K))return!1;return!0}function de(se,be){for(var K=0;K<be;K++)for(var j=0;j<be;j++)se[K][j]=V(se[K][j])}function we(se,be,K){var j=se.datatype();if(j==="number"||j==="BigNumber"||j==="Complex")return j;for(var ne=!1,pe=!1,fe=!1,Ae=0;Ae<K;Ae++)for(var _e=0;_e<K;_e++){var G=be[Ae][_e];if(At(G)||Js(G))ne=!0;else if(ft(G))pe=!0;else if(ra(G))fe=!0;else throw TypeError("Unsupported type in Matrix: "+fr(G))}if(pe&&fe&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),fe){for(var Z=0;Z<K;Z++)for(var ge=0;ge<K;ge++)be[Z][ge]=w(be[Z][ge]);return"Complex"}if(pe){for(var xe=0;xe<K;xe++)for(var Ee=0;Ee<K;Ee++)be[xe][Ee]=d(be[xe][Ee]);return"BigNumber"}if(ne){for(var Be=0;Be<K;Be++)for(var Ve=0;Ve<K;Ve++)be[Be][Ve]=A(be[Be][Ve]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var mV="expm",Kre=["typed","abs","add","identity","inv","multiply"],rE=M(mV,Kre,t=>{var{typed:e,abs:r,add:n,identity:i,inv:a,multiply:o}=t;return e(mV,{Matrix:function(f){var m=f.size();if(m.length!==2||m[0]!==m[1])throw new RangeError("Matrix must be square (size: "+Dt(m)+")");for(var p=m[0],d=1e-15,h=s(f),x=l(h,d),b=x.q,T=x.j,v=o(f,Math.pow(2,-T)),A=i(p),w=i(p),y=1,E=v,D=-1,_=1;_<=b;_++)_>1&&(E=o(E,v),D=-D),y=y*(b-_+1)/((2*b-_+1)*_),A=n(A,o(y,E)),w=n(w,o(y*D,E));for(var N=o(a(w),A),C=0;C<T;C++)N=o(N,N);return Uo(f)?f.createSparseMatrix(N):N}});function s(c){for(var f=c.size()[0],m=0,p=0;p<f;p++){for(var d=0,h=0;h<f;h++)d+=r(c.get([p,h]));m=Math.max(d,m)}return m}function l(c,f){for(var m=30,p=0;p<m;p++)for(var d=0;d<=p;d++){var h=p-d;if(u(c,d,h)<f)return{q:d,j:h}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function u(c,f,m){for(var p=1,d=2;d<=f;d++)p*=d;for(var h=p,x=f+1;x<=2*f;x++)h*=x;var b=h*(2*f+1);return 8*Math.pow(c/Math.pow(2,m),2*f)*p*p/(h*b)}});var dV="sqrtm",ene=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],nE=M(dV,ene,t=>{var{typed:e,abs:r,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:l,size:u,max:c,identity:f}=t,m=1e3,p=1e-6;function d(h){var x,b=0,T=h,v=f(u(h));do{var A=T;if(T=i(.5,n(A,l(v))),v=i(.5,n(v,l(A))),x=c(r(s(T,A))),x>p&&++b>m)throw new Error("computing square root of matrix: iterative method could not converge")}while(x>p);return T}return e(dV,{"Array | Matrix":function(x){var b=rt(x)?x.size():pt(x);switch(b.length){case 1:if(b[0]===1)return a(x,o);throw new RangeError("Matrix must be square (size: "+Dt(b)+")");case 2:{var T=b[0],v=b[1];if(T===v)return d(x);throw new RangeError("Matrix must be square (size: "+Dt(b)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Dt(b)+")")}}})});var hV="sylvester",tne=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],iE=M(hV,tne,t=>{var{typed:e,schur:r,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:l,index:u,subset:c,add:f,subtract:m,identity:p,lusolve:d,abs:h}=t;return e(hV,{"Matrix, Matrix, Matrix":x,"Array, Matrix, Matrix":function(T,v,A){return x(i(T),v,A)},"Array, Array, Matrix":function(T,v,A){return x(i(T),i(v),A)},"Array, Matrix, Array":function(T,v,A){return x(i(T),v,i(A))},"Matrix, Array, Matrix":function(T,v,A){return x(T,i(v),A)},"Matrix, Array, Array":function(T,v,A){return x(T,i(v),i(A))},"Matrix, Matrix, Array":function(T,v,A){return x(T,v,i(A))},"Array, Array, Array":function(T,v,A){return x(i(T),i(v),i(A)).toArray()}});function x(b,T,v){for(var A=T.size()[0],w=b.size()[0],y=r(b),E=y.T,D=y.U,_=r(a(-1,T)),N=_.T,C=_.U,B=a(a(l(D),v),C),R=o(0,w),V=[],L=(fe,Ae)=>s(fe,Ae,1),P=(fe,Ae)=>s(fe,Ae,0),k=0;k<A;k++)if(k<A-1&&h(c(N,u(k+1,k)))>1e-5){for(var W=P(c(B,u(R,k)),c(B,u(R,k+1))),O=0;O<k;O++)W=f(W,P(a(V[O],c(N,u(O,k))),a(V[O],c(N,u(O,k+1)))));var X=a(p(w),a(-1,c(N,u(k,k)))),ae=a(p(w),a(-1,c(N,u(k+1,k)))),J=a(p(w),a(-1,c(N,u(k,k+1)))),U=a(p(w),a(-1,c(N,u(k+1,k+1)))),de=P(L(f(E,X),ae),L(J,f(E,U))),we=d(de,W);V[k]=we.subset(u(o(0,w),0)),V[k+1]=we.subset(u(o(w,2*w),0)),k++}else{for(var se=c(B,u(R,k)),be=0;be<k;be++)se=f(se,a(V[be],c(N,u(be,k))));var K=c(N,u(k,k)),j=m(E,a(K,p(w)));V[k]=d(j,se)}var ne=i(n(...V)),pe=a(D,a(ne,l(C)));return pe}});var gV="schur",rne=["typed","matrix","identity","multiply","qr","norm","subtract"],aE=M(gV,rne,t=>{var{typed:e,matrix:r,identity:n,multiply:i,qr:a,norm:o,subtract:s}=t;return e(gV,{Array:function(c){var f=l(r(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return l(c)}});function l(u){var c=u.size()[0],f=u,m=n(c),p=0,d;do{d=f;var h=a(f),x=h.Q,b=h.R;if(f=i(b,x),m=i(m,x),p++>100)break}while(o(s(f,d))>1e-4);return{U:m,T:f}}});var vV="lyap",nne=["typed","matrix","sylvester","multiply","transpose"],oE=M(vV,nne,t=>{var{typed:e,matrix:r,sylvester:n,multiply:i,transpose:a}=t;return e(vV,{"Matrix, Matrix":function(s,l){return n(s,a(s),i(-1,l))},"Array, Matrix":function(s,l){return n(r(s),a(r(s)),i(-1,l))},"Matrix, Array":function(s,l){return n(s,a(r(s)),r(i(-1,l)))},"Array, Array":function(s,l){return n(r(s),a(r(s)),r(i(-1,l))).toArray()}})});var ine="divide",ane=["typed","matrix","multiply","equalScalar","divideScalar","inv"],sE=M(ine,ane,t=>{var{typed:e,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=t,s=Pr({typed:e,equalScalar:i}),l=Fn({typed:e});return e("divide",Cg({"Array | Matrix, Array | Matrix":function(c,f){return n(c,o(f))},"DenseMatrix, any":function(c,f){return l(c,f,a,!1)},"SparseMatrix, any":function(c,f){return s(c,f,a,!1)},"Array, any":function(c,f){return l(r(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return n(c,o(f))}},a.signatures))});var yV="distance",one=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],uE=M(yV,one,t=>{var{typed:e,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:l}=t;return e(yV,{"Array, Array, Array":function(w,y,E){if(w.length===2&&y.length===2&&E.length===2){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(y))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(E))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(y,E))throw new TypeError("LinePoint1 should not be same with LinePoint2");var D=n(E[1],y[1]),_=n(y[0],E[0]),N=n(i(E[0],y[1]),i(y[0],E[1]));return x(w[0],w[1],D,_,N)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(w,y,E){if(Object.keys(w).length===2&&Object.keys(y).length===2&&Object.keys(E).length===2){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(y))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(E))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(d(y),d(E)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in w&&"pointY"in w&&"lineOnePtX"in y&&"lineOnePtY"in y&&"lineTwoPtX"in E&&"lineTwoPtY"in E){var D=n(E.lineTwoPtY,y.lineOnePtY),_=n(y.lineOnePtX,E.lineTwoPtX),N=n(i(E.lineTwoPtX,y.lineOnePtY),i(y.lineOnePtX,E.lineTwoPtY));return x(w.pointX,w.pointY,D,_,N)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(w,y){if(w.length===2&&y.length===3){if(!c(w))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(y))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return x(w[0],w[1],y[0],y[1],y[2])}else if(w.length===3&&y.length===6){if(!f(w))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(y))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return b(w[0],w[1],w[2],y[0],y[1],y[2],y[3],y[4],y[5])}else if(w.length===y.length&&w.length>0){if(!m(w))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(y))throw new TypeError("All values of an array should be numbers or BigNumbers");return T(w,y)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(w,y){if(Object.keys(w).length===2&&Object.keys(y).length===3){if(!c(w))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(y))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"xCoeffLine"in y&&"yCoeffLine"in y&&"constant"in y)return x(w.pointX,w.pointY,y.xCoeffLine,y.yCoeffLine,y.constant);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(y).length===6){if(!f(w))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(y))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in w&&"pointY"in w&&"x0"in y&&"y0"in y&&"z0"in y&&"a"in y&&"b"in y&&"c"in y)return b(w.pointX,w.pointY,w.pointZ,y.x0,y.y0,y.z0,y.a,y.b,y.c);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===2&&Object.keys(y).length===2){if(!c(w))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(y))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointTwoX"in y&&"pointTwoY"in y)return T([w.pointOneX,w.pointOneY],[y.pointTwoX,y.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(w).length===3&&Object.keys(y).length===3){if(!f(w))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(y))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in w&&"pointOneY"in w&&"pointOneZ"in w&&"pointTwoX"in y&&"pointTwoY"in y&&"pointTwoZ"in y)return T([w.pointOneX,w.pointOneY,w.pointOneZ],[y.pointTwoX,y.pointTwoY,y.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(w){if(!h(w))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return v(w)}});function u(A){return typeof A=="number"||ft(A)}function c(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])}function f(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])&&u(A[2])}function m(A){return Array.isArray(A)||(A=d(A)),A.every(u)}function p(A){return A.constructor!==Array&&(A=d(A)),u(A[0])&&u(A[1])&&u(A[2])&&u(A[3])&&u(A[4])&&u(A[5])}function d(A){for(var w=Object.keys(A),y=[],E=0;E<w.length;E++)y.push(A[w[E]]);return y}function h(A){if(A[0].length===2&&u(A[0][0])&&u(A[0][1])){if(A.some(w=>w.length!==2||!u(w[0])||!u(w[1])))return!1}else if(A[0].length===3&&u(A[0][0])&&u(A[0][1])&&u(A[0][2])){if(A.some(w=>w.length!==3||!u(w[0])||!u(w[1])||!u(w[2])))return!1}else return!1;return!0}function x(A,w,y,E,D){var _=l(r(r(i(y,A),i(E,w)),D)),N=s(r(i(y,y),i(E,E)));return a(_,N)}function b(A,w,y,E,D,_,N,C,B){var R=[n(i(n(D,w),B),i(n(_,y),C)),n(i(n(_,y),N),i(n(E,A),B)),n(i(n(E,A),C),i(n(D,w),N))];R=s(r(r(i(R[0],R[0]),i(R[1],R[1])),i(R[2],R[2])));var V=s(r(r(i(N,N),i(C,C)),i(B,B)));return a(R,V)}function T(A,w){for(var y=A.length,E=0,D=0,_=0;_<y;_++)D=n(A[_],w[_]),E=r(i(D,D),E);return s(E)}function v(A){for(var w=[],y=[],E=[],D=0;D<A.length-1;D++)for(var _=D+1;_<A.length;_++)A[0].length===2?(y=[A[D][0],A[D][1]],E=[A[_][0],A[_][1]]):A[0].length===3&&(y=[A[D][0],A[D][1],A[D][2]],E=[A[_][0],A[_][1],A[_][2]]),w.push(T(y,E));return w}});var sne="intersect",une=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],lE=M(sne,une,t=>{var{typed:e,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:l,divideScalar:u,subtract:c,smaller:f,equalScalar:m,flatten:p,isZero:d,isNumeric:h}=t;return e("intersect",{"Array, Array, Array":x,"Array, Array, Array, Array":b,"Matrix, Matrix, Matrix":function(C,B,R){var V=x(C.valueOf(),B.valueOf(),R.valueOf());return V===null?null:o(V)},"Matrix, Matrix, Matrix, Matrix":function(C,B,R,V){var L=b(C.valueOf(),B.valueOf(),R.valueOf(),V.valueOf());return L===null?null:o(L)}});function x(N,C,B){if(N=T(N),C=T(C),B=T(B),!A(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!A(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(B))throw new TypeError("Array with 4 numbers expected as third argument");return _(N[0],N[1],N[2],C[0],C[1],C[2],B[0],B[1],B[2],B[3])}function b(N,C,B,R){if(N=T(N),C=T(C),B=T(B),R=T(R),N.length===2){if(!v(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(C))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(R))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return y(N,C,B,R)}else if(N.length===3){if(!A(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!A(C))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!A(R))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return D(N[0],N[1],N[2],C[0],C[1],C[2],B[0],B[1],B[2],R[0],R[1],R[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function T(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(C=>Array.isArray(C)&&C.length===1)?p(N):N}function v(N){return N.length===2&&h(N[0])&&h(N[1])}function A(N){return N.length===3&&h(N[0])&&h(N[1])&&h(N[2])}function w(N){return N.length===4&&h(N[0])&&h(N[1])&&h(N[2])&&h(N[3])}function y(N,C,B,R){var V=N,L=B,P=c(V,C),k=c(L,R),W=c(l(P[0],k[1]),l(k[0],P[1]));if(d(W)||f(n(W),r.relTol))return null;var O=l(k[0],V[1]),X=l(k[1],V[0]),ae=l(k[0],L[1]),J=l(k[1],L[0]),U=u(a(c(c(O,X),ae),J),W);return i(s(P,U),V)}function E(N,C,B,R,V,L,P,k,W,O,X,ae){var J=l(c(N,C),c(B,R)),U=l(c(V,L),c(P,k)),de=l(c(W,O),c(X,ae));return a(a(J,U),de)}function D(N,C,B,R,V,L,P,k,W,O,X,ae){var J=E(N,P,O,P,C,k,X,k,B,W,ae,W),U=E(O,P,R,N,X,k,V,C,ae,W,L,B),de=E(N,P,R,N,C,k,V,C,B,W,L,B),we=E(O,P,O,P,X,k,X,k,ae,W,ae,W),se=E(R,N,R,N,V,C,V,C,L,B,L,B),be=c(l(J,U),l(de,we)),K=c(l(se,we),l(U,U));if(d(K))return null;var j=u(be,K),ne=u(a(J,l(j,U)),we),pe=a(N,l(j,c(R,N))),fe=a(C,l(j,c(V,C))),Ae=a(B,l(j,c(L,B))),_e=a(P,l(ne,c(O,P))),G=a(k,l(ne,c(X,k))),Z=a(W,l(ne,c(ae,W)));return m(pe,_e)&&m(fe,G)&&m(Ae,Z)?[pe,fe,Ae]:null}function _(N,C,B,R,V,L,P,k,W,O){var X=l(N,P),ae=l(R,P),J=l(C,k),U=l(V,k),de=l(B,W),we=l(L,W),se=c(c(c(O,X),J),de),be=c(c(c(a(a(ae,U),we),X),J),de),K=u(se,be),j=a(N,l(K,c(R,N))),ne=a(C,l(K,c(V,C))),pe=a(B,l(K,c(L,B)));return[j,ne,pe]}});var xV="sum",lne=["typed","config","add","numeric"],Em=M(xV,lne,t=>{var{typed:e,config:r,add:n,numeric:i}=t;return e(xV,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(l){if(wo(l))throw new TypeError("Scalar values expected in function sum");return a(l)}});function a(s){var l;return Oi(s,function(u){try{l=l===void 0?u:n(l,u)}catch(c){throw An(c,"sum",u)}}),l===void 0&&(l=i(0,r.number)),typeof l=="string"&&(l=i(l,Bi(l,r))),l}function o(s,l){try{var u=zu(s,l,n);return u}catch(c){throw An(c,"sum")}}});var $v="cumsum",cne=["typed","add","unaryPlus"],Tm=M($v,cne,t=>{var{typed:e,add:r,unaryPlus:n}=t;return e($v,{Array:i,Matrix:function(u){return u.create(i(u.valueOf(),u.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(u,c){return u.create(o(u.valueOf(),c),u.datatype())},"...":function(u){if(wo(u))throw new TypeError("All values expected to be scalar in function cumsum");return i(u)}});function i(l){try{return a(l)}catch(u){throw An(u,$v)}}function a(l){if(l.length===0)return[];for(var u=[n(l[0])],c=1;c<l.length;++c)u.push(r(u[c-1],l[c]));return u}function o(l,u){var c=pt(l);if(u<0||u>=c.length)throw new Si(u,c.length);try{return s(l,u)}catch(f){throw An(f,$v)}}function s(l,u){var c,f,m;if(u<=0){var p=l[0][0];if(Array.isArray(p)){for(m=Yg(l),f=[],c=0;c<m.length;c++)f[c]=s(m[c],u-1);return f}else return a(l)}else{for(f=[],c=0;c<l.length;c++)f[c]=s(l[c],u-1);return f}}});var bV="mean",fne=["typed","add","divide"],Dm=M(bV,fne,t=>{var{typed:e,add:r,divide:n}=t;return e(bV,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(s){if(wo(s))throw new TypeError("Scalar values expected in function mean");return a(s)}});function i(o,s){try{var l=zu(o,s,r),u=Array.isArray(o)?pt(o):o.size();return n(l,u[s])}catch(c){throw An(c,"mean")}}function a(o){var s,l=0;if(Oi(o,function(u){try{s=s===void 0?u:r(s,u),l++}catch(c){throw An(c,"mean",u)}}),l===0)throw new Error("Cannot calculate the mean of an empty array");return n(s,l)}});var wV="median",pne=["typed","add","divide","compare","partitionSelect"],cE=M(wV,pne,t=>{var{typed:e,add:r,divide:n,compare:i,partitionSelect:a}=t;function o(u){try{u=Rt(u.valueOf());var c=u.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,m=a(u,f+1),p=u[f],d=0;d<f;++d)i(u[d],p)>0&&(p=u[d]);return l(p,m)}else{var h=a(u,(c-1)/2);return s(h)}}catch(x){throw An(x,"median")}}var s=e({"number | BigNumber | Complex | Unit":function(c){return c}}),l=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return n(r(c,f),2)}});return e(wV,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(wo(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var _V="mad",mne=["typed","abs","map","median","subtract"],fE=M(_V,mne,t=>{var{typed:e,abs:r,map:n,median:i,subtract:a}=t;return e(_V,{"Array | Matrix":o,"...":function(l){return o(l)}});function o(s){if(s=Rt(s.valueOf()),s.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var l=i(s);return i(n(s,function(u){return r(a(u,l))}))}catch(u){throw u instanceof TypeError&&u.message.includes("median")?new TypeError(u.message.replace("median","mad")):An(u,"mad")}}});var pE="unbiased",AV="variance",dne=["typed","add","subtract","multiply","divide","apply","isNaN"],Mm=M(AV,dne,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=t;return e(AV,{"Array | Matrix":function(f){return l(f,pE)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(f,m){return u(f,m,pE)},"Array | Matrix, number | BigNumber, string":u,"...":function(f){return l(f,pE)}});function l(c,f){var m,p=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Oi(c,function(x){try{m=m===void 0?x:r(m,x),p++}catch(b){throw An(b,"variance",x)}}),p===0)throw new Error("Cannot calculate variance of an empty array");var d=a(m,p);if(m=void 0,Oi(c,function(x){var b=n(x,d);m=m===void 0?i(b,b):r(m,i(b,b))}),s(m))return m;switch(f){case"uncorrected":return a(m,p);case"biased":return a(m,p+1);case"unbiased":{var h=ft(m)?m.mul(0):0;return p===1?h:a(m,p-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(c,f,m){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,p=>l(p,m))}catch(p){throw An(p,"variance")}}});var SV="quantileSeq",hne=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Cm=M(SV,hne,t=>{var{typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m}=t,p=Zl({typed:e,isInteger:u});return e(SV,{"Array | Matrix, number | BigNumber":(T,v)=>h(T,v,!1),"Array | Matrix, number | BigNumber, number":(T,v,A)=>d(T,v,!1,A,h),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(T,v,A,w)=>d(T,v,A,w,h),"Array | Matrix, Array | Matrix":(T,v)=>x(T,v,!1),"Array | Matrix, Array | Matrix, number":(T,v,A)=>d(T,v,!1,A,x),"Array | Matrix, Array | Matrix, boolean":x,"Array | Matrix, Array | Matrix, boolean, number":(T,v,A,w)=>d(T,v,A,w,x)});function d(T,v,A,w,y){return p(T,w,E=>y(E,v,A))}function h(T,v,A){var w,y=T.valueOf();if(c(v,0))throw new Error("N/prob must be non-negative");if(f(v,1))return At(v)?b(y,v,A):r(b(y,v,A));if(m(v,1)){if(!u(v))throw new Error("N must be a positive integer");if(m(v,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var E=n(v,1);w=[];for(var D=0;c(D,v);D++){var _=a(D+1,E);w.push(b(y,_,A))}return At(v)?w:r(w)}}function x(T,v,A){for(var w=T.valueOf(),y=v.valueOf(),E=[],D=0;D<y.length;++D)E.push(b(w,y[D],A));return E}function b(T,v,A){var w=Rt(T),y=w.length;if(y===0)throw new Error("Cannot calculate quantile of an empty sequence");var E=At(v)?v*(y-1):v.times(y-1),D=At(v)?Math.floor(E):E.floor().toNumber(),_=At(v)?E%1:E.minus(D);if(u(E))return A?w[E]:s(w,At(v)?E:E.valueOf());var N,C;if(A)N=w[D],C=w[D+1];else{C=s(w,D+1),N=w[D];for(var B=0;B<D;++B)l(w[B],N)>0&&(N=w[B])}return n(o(N,i(1,_)),o(C,_))}});var EV="std",gne=["typed","map","sqrt","variance"],Nm=M(EV,gne,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t;return e(EV,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(s){return a(s)}});function a(o,s){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var l=i.apply(null,arguments);return Tn(l)?r(l,n):n(l)}catch(u){throw u instanceof TypeError&&u.message.includes(" variance")?new TypeError(u.message.replace(" variance"," std")):u}}});var TV="corr",vne=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],mE=M(TV,vne,t=>{var{typed:e,matrix:r,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:l,divide:u}=t;return e(TV,{"Array, Array":function(p,d){return c(p,d)},"Matrix, Matrix":function(p,d){var h=c(p.toArray(),d.toArray());return Array.isArray(h)?r(h):h}});function c(m,p){var d=[];if(Array.isArray(m[0])&&Array.isArray(p[0])){if(m.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var h=0;h<m.length;h++){if(m[h].length!==p[h].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");d.push(f(m[h],p[h]))}return d}else{if(m.length!==p.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(m,p)}}function f(m,p){var d=m.length,h=i(m),x=i(p),b=m.reduce((y,E,D)=>a(y,s(E,p[D])),0),T=i(m.map(y=>l(y,2))),v=i(p.map(y=>l(y,2))),A=o(s(d,b),s(h,x)),w=n(s(o(s(d,T),l(h,2)),o(s(d,v),l(x,2))));return u(A,w)}});var DV="combinations",yne=["typed"],dE=M(DV,yne,t=>{var{typed:e}=t;return e(DV,{"number, number":Ow,"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=n.minus(i),u=new a(1);if(!MV(n)||!MV(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(n))throw new TypeError("k must be less than n in function combinations");if(o=u,i.lt(l))for(s=u;s.lte(l);s=s.plus(u))o=o.times(i.plus(s)).dividedBy(s);else for(s=u;s.lte(i);s=s.plus(u))o=o.times(l.plus(s)).dividedBy(s);return o}})});function MV(t){return t.isInteger()&&t.gte(0)}var CV="combinationsWithRep",xne=["typed"],hE=M(CV,xne,t=>{var{typed:e}=t;return e(CV,{"number, number":function(n,i){if(!Qe(n)||n<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Qe(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<n-1){var a=Wa(n,n+i-1);return a/Wa(1,i)}var o=Wa(i+1,n+i-1);return o/Wa(1,n-1)},"BigNumber, BigNumber":function(n,i){var a=n.constructor,o,s,l=new a(1),u=n.minus(l);if(!NV(n)||!NV(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(n.lt(l))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=l,i.lt(u))for(s=l;s.lte(u);s=s.plus(l))o=o.times(i.plus(s)).dividedBy(s);else for(s=l;s.lte(i);s=s.plus(l))o=o.times(u.plus(s)).dividedBy(s);return o}})});function NV(t){return t.isInteger()&&t.gte(0)}var FV="gamma",bne=["typed","config","multiplyScalar","pow","BigNumber","Complex"],gE=M(FV,bne,t=>{var{typed:e,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=t;function s(u){if(u.im===0)return rm(u.re);if(u.re<.5){var c=new o(1-u.re,-u.im),f=new o(Math.PI*u.re,Math.PI*u.im);return new o(Math.PI).div(f.sin()).div(s(c))}u=new o(u.re-1,u.im);for(var m=new o(jl[0],0),p=1;p<jl.length;++p){var d=new o(jl[p],0);m=m.add(d.div(u.add(p)))}var h=new o(u.re+Vw+.5,u.im),x=Math.sqrt(2*Math.PI),b=h.pow(u.add(.5)),T=h.neg().exp();return m.mul(x).mul(b).mul(T)}return e(FV,{number:rm,Complex:s,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):l(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function l(u){if(u<8)return new a([1,1,2,6,24,120,720,5040][u]);var c=r.precision+(Math.log(u.toNumber())|0),f=a.clone({precision:c});if(u%2===1)return u.times(l(new a(u-1)));for(var m=u,p=new f(u),d=u.toNumber();m>2;)m-=2,d+=m,p=p.times(d);return new a(p.toPrecision(a.precision))}});var IV="lgamma",wne=["Complex","typed"],vE=M(IV,wne,t=>{var{Complex:e,typed:r}=t,n=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(IV,{number:nm,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(u){var c=6.283185307179586,f=1.1447298858494002,m=.1;if(u.isNaN())return new e(NaN,NaN);if(u.im===0)return new e(nm(u.re),0);if(u.re>=n||Math.abs(u.im)>=i)return s(u);if(u.re<=m){var p=hP(c,u.im)*Math.floor(.5*u.re+.25),d=u.mul(Math.PI).sin().log(),h=o(new e(1-u.re,-u.im));return new e(f,p).sub(d).sub(h)}else return u.im>=0?l(u):l(u.conjugate()).conjugate()}function s(u){for(var c=u.sub(.5).mul(u.log()).sub(u).add(Uw),f=new e(1,0).div(u),m=f.div(u),p=a[0],d=a[1],h=2*m.re,x=m.re*m.re+m.im*m.im,b=2;b<8;b++){var T=d;d=-x*p+a[b],p=h*p+T}var v=f.mul(m.mul(p).add(d));return c.add(v)}function l(u){var c=0,f=0,m=u;for(u=u.add(1);u.re<=n;){m=m.mul(u);var p=m.im<0?1:0;p!==0&&f===0&&c++,f=p,u=u.add(1)}return s(u).sub(m.log()).sub(new e(0,c*2*Math.PI*1))}});var PV="factorial",_ne=["typed","gamma"],yE=M(PV,_ne,t=>{var{typed:e,gamma:r}=t;return e(PV,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return r(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return r(i.plus(1))},"Array | Matrix":e.referToSelf(n=>i=>nt(i,n))})});var BV="kldivergence",Ane=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],xE=M(BV,Ane,t=>{var{typed:e,matrix:r,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:l,isNumeric:u}=t;return e(BV,{"Array, Array":function(m,p){return c(r(m),r(p))},"Matrix, Array":function(m,p){return c(m,r(p))},"Array, Matrix":function(m,p){return c(r(m),p)},"Matrix, Matrix":function(m,p){return c(m,p)}});function c(f,m){var p=m.size().length,d=f.size().length;if(p>1)throw new Error("first object must be one dimensional");if(d>1)throw new Error("second object must be one dimensional");if(p!==d)throw new Error("Length of two vectors must be equal");var h=i(f);if(h===0)throw new Error("Sum of elements in first object must be non zero");var x=i(m);if(x===0)throw new Error("Sum of elements in second object must be non zero");var b=n(f,i(f)),T=n(m,i(m)),v=i(a(b,o(s(b,T),A=>l(A))));return u(v)?v:Number.NaN}});var kV="multinomial",Sne=["typed","add","divide","multiply","factorial","isInteger","isPositive"],bE=M(kV,Sne,t=>{var{typed:e,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=t;return e(kV,{"Array | Matrix":function(u){var c=0,f=1;return Oi(u,function(m){if(!o(m)||!s(m))throw new TypeError("Positive integer value expected in function multinomial");c=r(c,m),f=i(f,a(m))}),n(a(c),f)}})});var $V="permutations",Ene=["typed","factorial"],wE=M($V,Ene,t=>{var{typed:e,factorial:r}=t;return e($V,{"number | BigNumber":r,"number, number":function(i,a){if(!Qe(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!Qe(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 Wa(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,s;if(!OV(i)||!OV(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 l=i.mul(0).add(1);for(o=l,s=i.minus(a).plus(1);s.lte(i);s=s.plus(1))o=o.times(s);return o}})});function OV(t){return t.isInteger()&&t.gte(0)}var ME=zr(KV(),1),Ine=(0,ME.default)(Date.now());function nu(t){var e;function r(i){e=i===null?Ine:(0,ME.default)(String(i))}r(t);function n(){return e()}return n}var eU="pickRandom",Pne=["typed","config","?on"],CE=M(eU,Pne,t=>{var{typed:e,config:r,on:n}=t,i=nu(r.randomSeed);return n&&n("config",function(o,s){o.randomSeed!==s.randomSeed&&(i=nu(o.randomSeed))}),e(eU,{"Array | Matrix":function(s){return a(s,{})},"Array | Matrix, Object":function(s,l){return a(s,l)},"Array | Matrix, number":function(s,l){return a(s,{number:l})},"Array | Matrix, Array | Matrix":function(s,l){return a(s,{weights:l})},"Array | Matrix, Array | Matrix, number":function(s,l,u){return a(s,{number:u,weights:l})},"Array | Matrix, number, Array | Matrix":function(s,l,u){return a(s,{number:l,weights:u})}});function a(o,s){var{number:l,weights:u,elementWise:c=!0}=s,f=typeof l>"u";f&&(l=1);var m=rt(o)?o.create:rt(u)?u.create:null;o=o.valueOf(),u&&(u=u.valueOf()),c===!0&&(o=Rt(o),u=Rt(u));var p=0;if(typeof u<"u"){if(u.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var d=0,h=u.length;d<h;d++){if(!At(u[d])||u[d]<0)throw new Error("Weights must be an array of positive numbers");p+=u[d]}}for(var x=o.length,b=[],T;b.length<l;){if(typeof u>"u")T=o[Math.floor(i()*x)];else for(var v=i()*p,A=0,w=o.length;A<w;A++)if(v-=u[A],v<0){T=o[A];break}b.push(T)}return f?b[0]:m?m(b):b}});function Fm(t,e){var r=[];if(t=t.slice(0),t.length>1)for(var n=0,i=t.shift();n<i;n++)r.push(Fm(t,e));else for(var a=0,o=t.shift();a<o;a++)r.push(e());return r}var tU="random",Bne=["typed","config","?on"],NE=M(tU,Bne,t=>{var{typed:e,config:r,on:n}=t,i=nu(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=nu(s.randomSeed))}),e(tU,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=Fm(s.valueOf(),()=>o(l,u));return rt(s)?s.create(c,"number"):c}function o(s,l){return s+i()*(l-s)}});var rU="randomInt",kne=["typed","config","?on"],FE=M(rU,kne,t=>{var{typed:e,config:r,on:n}=t,i=nu(r.randomSeed);return n&&n("config",function(s,l){s.randomSeed!==l.randomSeed&&(i=nu(s.randomSeed))}),e(rU,{"":()=>o(0,1),number:s=>o(0,s),"number, number":(s,l)=>o(s,l),"Array | Matrix":s=>a(s,0,1),"Array | Matrix, number":(s,l)=>a(s,0,l),"Array | Matrix, number, number":(s,l,u)=>a(s,l,u)});function a(s,l,u){var c=Fm(s.valueOf(),()=>o(l,u));return rt(s)?s.create(c,"number"):c}function o(s,l){return Math.floor(s+i()*(l-s))}});var nU="stirlingS2",$ne=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],IE=M(nU,$ne,t=>{var{typed:e,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:l,isNegative:u,isInteger:c,number:f,bignumber:m,larger:p}=t,d=[],h=[];return e(nU,{"number | BigNumber, number | BigNumber":function(b,T){if(!c(b)||u(b)||!c(T)||u(T))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(p(T,b))throw new TypeError("k must be less than or equal to n in function stirlingS2");var v=!(At(b)&&At(T)),A=v?h:d,w=v?m:f,y=f(b),E=f(T);if(A[y]&&A[y].length>E)return A[y][E];for(var D=0;D<=y;++D)if(A[D]||(A[D]=[w(D===0?1:0)]),D!==0)for(var _=A[D],N=A[D-1],C=_.length;C<=D&&C<=E;++C)C===D?_[C]=1:_[C]=r(i(w(C),N[C]),N[C-1]);return A[y][E]}})});var iU="bellNumbers",One=["typed","addScalar","isNegative","isInteger","stirlingS2"],PE=M(iU,One,t=>{var{typed:e,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=t;return e(iU,{"number | BigNumber":function(s){if(!i(s)||n(s))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var l=0,u=0;u<=s;u++)l=r(l,a(s,u));return l}})});var aU="catalan",Rne=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],BE=M(aU,Rne,t=>{var{typed:e,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=t;return e(aU,{"number | BigNumber":function(u){if(!s(u)||o(u))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(u,2),u),r(u,1))}})});var oU="composition",Lne=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],kE=M(oU,Lne,t=>{var{typed:e,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=t;return e(oU,{"number | BigNumber, number | BigNumber":function(u,c){if(!o(u)||!i(u)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(s(c,u))throw new TypeError("k must be less than or equal to n in function composition");return n(r(u,-1),r(c,-1))}})});var sU="leafCount",Vne=["parse","typed"],$E=M(sU,Vne,t=>{var{parse:e,typed:r}=t;function n(i){var a=0;return i.forEach(o=>{a+=n(o)}),a||1}return r(sU,{Node:function(a){return n(a)}})});function OE(t){return Ht(t)||Qr(t)&&t.isUnary()&&Ht(t.args[0])}function Im(t){return!!(Ht(t)||(na(t)||Qr(t))&&t.args.every(Im)||_i(t)&&Im(t.content))}function uU(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function RE(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?uU(Object(r),!0).forEach(function(n){Er(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):uU(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Une="simplifyUtil",qne=["FunctionNode","OperatorNode","SymbolNode"],Pf=M(Une,qne,t=>{var{FunctionNode:e,OperatorNode:r,SymbolNode:n}=t,i=!0,a=!1,o="defaultF",s={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}},l={divide:{total:a},log:{total:a}},u={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(v,A){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:s,y=o;if(typeof v=="string"?y=v:Qr(v)?y=v.fn.toString():na(v)?y=v.name:_i(v)&&(y="paren"),st(w,y)){var E=w[y];if(st(E,A))return E[A];if(st(s,y))return s[y][A]}if(st(w,o)){var D=w[o];return st(D,A)?D[A]:s[o][A]}if(st(s,y)){var _=s[y];if(st(_,A))return _[A]}return s[o][A]}function f(v){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"commutative",A)}function m(v){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s;return c(v,"associative",A)}function p(v,A){var w=RE({},v);for(var y in A)st(v,y)?w[y]=RE(RE({},A[y]),v[y]):w[y]=A[y];return w}function d(v,A){if(!v.args||v.args.length===0)return v;v.args=h(v,A);for(var w=0;w<v.args.length;w++)d(v.args[w],A)}function h(v,A){var w,y=[],E=function(_){for(var N=0;N<_.args.length;N++){var C=_.args[N];Qr(C)&&w===C.op?E(C):y.push(C)}};return m(v,A)?(w=v.op,E(v),y):v.args}function x(v,A){if(!(!v.args||v.args.length===0)){for(var w=T(v),y=v.args.length,E=0;E<y;E++)x(v.args[E],A);if(y>2&&m(v,A)){for(var D=v.args.pop();v.args.length>0;)D=w([v.args.pop(),D]);v.args=D.args}}}function b(v,A){if(!(!v.args||v.args.length===0)){for(var w=T(v),y=v.args.length,E=0;E<y;E++)b(v.args[E],A);if(y>2&&m(v,A)){for(var D=v.args.shift();v.args.length>0;)D=w([D,v.args.shift()]);v.args=D.args}}}function T(v){return Qr(v)?function(A){try{return new r(v.op,v.fn,A,v.implicit)}catch(w){return console.error(w),[]}}:function(A){return new e(new n(v.name),A)}}return{createMakeNodeFunction:T,hasProperty:c,isCommutative:f,isAssociative:m,mergeContext:p,flatten:d,allChildren:h,unflattenr:x,unflattenl:b,defaultContext:s,realContext:l,positiveContext:u}});var zne="simplify",Hne=["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],LE=M(zne,Hne,t=>{var{typed:e,parse:r,equal:n,resolve:i,simplifyConstant:a,simplifyCore:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:m,OperatorNode:p,ParenthesisNode:d,SymbolNode:h,replacer:x}=t,{hasProperty:b,isCommutative:T,isAssociative:v,mergeContext:A,flatten:w,unflattenr:y,unflattenl:E,createMakeNodeFunction:D,defaultContext:_,realContext:N,positiveContext:C}=Pf({FunctionNode:c,OperatorNode:p,SymbolNode:h});e.addConversion({from:"Object",to:"Map",convert:Zs});var B=e("simplify",{Node:O,"Node, Map":(K,j)=>O(K,!1,j),"Node, Map, Object":(K,j,ne)=>O(K,!1,j,ne),"Node, Array":O,"Node, Array, Map":O,"Node, Array, Map, Object":O});e.removeConversion({from:"Object",to:"Map",convert:Zs}),B.defaultContext=_,B.realContext=N,B.positiveContext=C;function R(K){return K.transform(function(j){return _i(j)?R(j.content):j})}var V={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};B.rules=[o,{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}}},a,{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}}},a,{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 L(K,j){var ne={};if(K.s){var pe=K.s.split("->");if(pe.length===2)ne.l=pe[0],ne.r=pe[1];else throw SyntaxError("Could not parse rule: "+K.s)}else ne.l=K.l,ne.r=K.r;ne.l=R(r(ne.l)),ne.r=R(r(ne.r));for(var fe of["imposeContext","repeat","assuming"])fe in K&&(ne[fe]=K[fe]);if(K.evaluate&&(ne.evaluate=r(K.evaluate)),v(ne.l,j)){var Ae=!T(ne.l,j),_e;Ae&&(_e=W());var G=D(ne.l),Z=W();ne.expanded={},ne.expanded.l=G([ne.l,Z]),w(ne.expanded.l,j),y(ne.expanded.l,j),ne.expanded.r=G([ne.r,Z]),Ae&&(ne.expandedNC1={},ne.expandedNC1.l=G([_e,ne.l]),ne.expandedNC1.r=G([_e,ne.r]),ne.expandedNC2={},ne.expandedNC2.l=G([_e,ne.expanded.l]),ne.expandedNC2.r=G([_e,ne.expanded.r]))}return ne}function P(K,j){for(var ne=[],pe=0;pe<K.length;pe++){var fe=K[pe],Ae=void 0,_e=typeof fe;switch(_e){case"string":fe={s:fe};case"object":Ae=L(fe,j);break;case"function":Ae=fe;break;default:throw TypeError("Unsupported type of rule: "+_e)}ne.push(Ae)}return ne}var k=0;function W(){return new h("_p"+k++)}function O(K,j){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bu(),pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},fe=pe.consoleDebug;j=P(j||B.rules,pe.context);var Ae=i(K,ne);Ae=R(Ae);for(var _e={},G=Ae.toString({parenthesis:"all"});!_e[G];){_e[G]=!0,k=0;var Z=G;fe&&console.log("Working on: ",G);for(var ge=0;ge<j.length;ge++){var xe="";if(typeof j[ge]=="function"?(Ae=j[ge](Ae,pe),fe&&(xe=j[ge].name)):(w(Ae,pe.context),Ae=ae(Ae,j[ge],pe.context),fe&&(xe="".concat(j[ge].l.toString()," -> ").concat(j[ge].r.toString()))),fe){var Ee=Ae.toString({parenthesis:"all"});Ee!==Z&&(console.log("Applying",xe,"produced",Ee),Z=Ee)}E(Ae,pe.context)}G=Ae.toString({parenthesis:"all"})}return Ae}function X(K,j,ne){var pe=K;if(K)for(var fe=0;fe<K.length;++fe){var Ae=ae(K[fe],j,ne);Ae!==K[fe]&&(pe===K&&(pe=K.slice()),pe[fe]=Ae)}return pe}function ae(K,j,ne){if(j.assuming){for(var pe in j.assuming)for(var fe in j.assuming[pe])if(b(pe,fe,ne)!==j.assuming[pe][fe])return K}var Ae=A(j.imposeContext,ne),_e=K;if(_e instanceof p||_e instanceof c){var G=X(_e.args,j,ne);G!==_e.args&&(_e=_e.clone(),_e.args=G)}else if(_e instanceof d){if(_e.content){var Z=ae(_e.content,j,ne);Z!==_e.content&&(_e=new d(Z))}}else if(_e instanceof l){var ge=X(_e.items,j,ne);ge!==_e.items&&(_e=new l(ge))}else if(_e instanceof s){var xe=_e.object;_e.object&&(xe=ae(_e.object,j,ne));var Ee=_e.index;_e.index&&(Ee=ae(_e.index,j,ne)),(xe!==_e.object||Ee!==_e.index)&&(_e=new s(xe,Ee))}else if(_e instanceof f){var Be=X(_e.dimensions,j,ne);Be!==_e.dimensions&&(_e=new f(Be))}else if(_e instanceof m){var Ve=!1,et={};for(var St in _e.properties)et[St]=ae(_e.properties[St],j,ne),et[St]!==_e.properties[St]&&(Ve=!0);Ve&&(_e=new m(et))}var Ye=j.r,ur=se(j.l,_e,Ae)[0];if(!ur&&j.expanded&&(Ye=j.expanded.r,ur=se(j.expanded.l,_e,Ae)[0]),!ur&&j.expandedNC1&&(Ye=j.expandedNC1.r,ur=se(j.expandedNC1.l,_e,Ae)[0],ur||(Ye=j.expandedNC2.r,ur=se(j.expandedNC2.l,_e,Ae)[0])),ur){var Jt=_e.implicit;_e=Ye.clone(),Jt&&"implicit"in Ye&&(_e.implicit=!0),_e=_e.transform(function(He){return He.isSymbolNode&&st(ur.placeholders,He.name)?ur.placeholders[He.name].clone():He})}return j.repeat&&_e!==K&&(_e=ae(_e,j,ne)),_e}function J(K,j){var ne=[],pe,fe,Ae=D(K);if(T(K,j))for(var _e=0;_e<K.args.length;_e++)fe=K.args.slice(0),fe.splice(_e,1),pe=fe.length===1?fe[0]:Ae(fe),ne.push(Ae([K.args[_e],pe]));else for(var G=1;G<K.args.length;G++){var Z=K.args[0];G>1&&(Z=Ae(K.args.slice(0,G))),fe=K.args.slice(G),pe=fe.length===1?fe[0]:Ae(fe),ne.push(Ae([Z,pe]))}return ne}function U(K,j){var ne={placeholders:{}};if(!K.placeholders&&!j.placeholders)return ne;if(K.placeholders){if(!j.placeholders)return K}else return j;for(var pe in K.placeholders)if(st(K.placeholders,pe)&&(ne.placeholders[pe]=K.placeholders[pe],st(j.placeholders,pe)&&!be(K.placeholders[pe],j.placeholders[pe])))return null;for(var fe in j.placeholders)st(j.placeholders,fe)&&(ne.placeholders[fe]=j.placeholders[fe]);return ne}function de(K,j){var ne=[];if(K.length===0||j.length===0)return ne;for(var pe,fe=0;fe<K.length;fe++)for(var Ae=0;Ae<j.length;Ae++)pe=U(K[fe],j[Ae]),pe&&ne.push(pe);return ne}function we(K){if(K.length===0)return K;for(var j=K.reduce(de),ne=[],pe={},fe=0;fe<j.length;fe++){var Ae=JSON.stringify(j[fe],x);pe[Ae]||(pe[Ae]=!0,ne.push(j[fe]))}return ne}function se(K,j,ne,pe){var fe=[{placeholders:{}}];if(K instanceof p&&j instanceof p||K instanceof c&&j instanceof c){if(K instanceof p){if(K.op!==j.op||K.fn!==j.fn)return[]}else if(K instanceof c&&K.name!==j.name)return[];if(j.args.length===1&&K.args.length===1||!v(j,ne)&&j.args.length===K.args.length||pe){for(var Ae=[],_e=0;_e<K.args.length;_e++){var G=se(K.args[_e],j.args[_e],ne);if(G.length===0)break;Ae.push(G)}if(Ae.length!==K.args.length){if(!T(j,ne)||K.args.length===1)return[];if(K.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Z=se(K.args[0],j.args[1],ne);if(Z.length===0)return[];var ge=se(K.args[1],j.args[0],ne);if(ge.length===0)return[];Ae=[Z,ge]}fe=we(Ae)}else if(j.args.length>=2&&K.args.length===2){for(var xe=J(j,ne),Ee=[],Be=0;Be<xe.length;Be++){var Ve=se(K,xe[Be],ne,!0);Ee=Ee.concat(Ve)}return Ee}else{if(K.args.length>2)throw Error("Unexpected non-binary associative function: "+K.toString());return[]}}else if(K instanceof h){if(K.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(V[K.name]){if(K.name!==j.name)return[]}else switch(K.name[1]>="a"&&K.name[1]<="z"?K.name.substring(0,2):K.name[0]){case"n":case"_p":fe[0].placeholders[K.name]=j;break;case"c":case"cl":if(Ht(j))fe[0].placeholders[K.name]=j;else return[];break;case"v":if(!Ht(j))fe[0].placeholders[K.name]=j;else return[];break;case"vl":if(Gr(j))fe[0].placeholders[K.name]=j;else return[];break;case"cd":if(OE(j))fe[0].placeholders[K.name]=j;else return[];break;case"vd":if(!OE(j))fe[0].placeholders[K.name]=j;else return[];break;case"ce":if(Im(j))fe[0].placeholders[K.name]=j;else return[];break;case"ve":if(!Im(j))fe[0].placeholders[K.name]=j;else return[];break;default:throw new Error("Invalid symbol in rule: "+K.name)}}else if(K instanceof u){if(!n(K.value,j.value))return[]}else return[];return fe}function be(K,j){if(K instanceof u&&j instanceof u){if(!n(K.value,j.value))return!1}else if(K instanceof h&&j instanceof h){if(K.name!==j.name)return!1}else if(K instanceof p&&j instanceof p||K instanceof c&&j instanceof c){if(K instanceof p){if(K.op!==j.op||K.fn!==j.fn)return!1}else if(K instanceof c&&K.name!==j.name)return!1;if(K.args.length!==j.args.length)return!1;for(var ne=0;ne<K.args.length;ne++)if(!be(K.args[ne],j.args[ne]))return!1}else return!1;return!0}return B});var Gne="simplifyConstant",Wne=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],VE=M(Gne,Wne,t=>{var{typed:e,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:f,ObjectNode:m,OperatorNode:p,SymbolNode:d}=t,{isCommutative:h,isAssociative:x,allChildren:b,createMakeNodeFunction:T}=Pf({FunctionNode:c,OperatorNode:p,SymbolNode:d}),v=e("simplifyConstant",{Node:L=>E(V(L,{})),"Node, Object":function(P,k){return E(V(P,k))}});function A(L){return Js(L)?L.valueOf():L instanceof Array?L.map(A):rt(L)?i(A(L.valueOf())):L}function w(L,P,k){try{return n[L].apply(null,P)}catch{return P=P.map(A),_(n[L].apply(null,P),k)}}var y=e({Fraction:C,number:function(P){return P<0?N(new u(-P)):new u(P)},BigNumber:function(P){return P<0?N(new u(-P)):new u(P)},bigint:function(P){return P<0n?N(new u(-P)):new u(P)},Complex:function(P){throw new Error("Cannot convert Complex number to Node")},string:function(P){return new u(P)},Matrix:function(P){return new l(P.valueOf().map(k=>y(k)))}});function E(L){return nr(L)?L:y(L)}function D(L,P){var k=P&&P.exactFractions!==!1;if(k&&isFinite(L)&&a){var W=a(L),O=P&&typeof P.fractionsLimit=="number"?P.fractionsLimit:1/0;if(W.valueOf()===L&&W.n<O&&W.d<O)return W}return L}var _=e({"string, Object":function(P,k){var W=Bi(P,r);if(W==="BigNumber")return o===void 0&&Df(),o(P);if(W==="bigint")return BigInt(P);if(W==="Fraction")return a===void 0&&nv(),a(P);var O=parseFloat(P);return D(O,k)},"Fraction, Object":function(P,k){return P},"BigNumber, Object":function(P,k){return P},"number, Object":function(P,k){return D(P,k)},"bigint, Object":function(P,k){return P},"Complex, Object":function(P,k){return P.im!==0?P:D(P.re,k)},"Matrix, Object":function(P,k){return i(D(P.valueOf()))},"Array, Object":function(P,k){return P.map(D)}});function N(L){return new p("-","unaryMinus",[L])}function C(L){var P=O=>r.number==="BigNumber"&&o?o(O):Number(O),k=L.s*L.n,W=k<0n?new p("-","unaryMinus",[new u(-P(k))]):new u(P(k));return L.d===1n?W:new p("/","divide",[W,new u(P(L.d))])}function B(L,P,k){if(!go(P))return new s(E(L),E(P));if(wi(L)||rt(L)){for(var W=Array.from(P.dimensions);W.length>0;)if(Ht(W[0])&&typeof W[0].value!="string"){var O=_(W.shift().value,k);wi(L)?L=L.items[O-1]:(L=L.valueOf()[O-1],L instanceof Array&&(L=i(L)))}else if(W.length>1&&Ht(W[1])&&typeof W[1].value!="string"){var X=_(W[1].value,k),ae=[],J=wi(L)?L.items:L.valueOf();for(var U of J)if(wi(U))ae.push(U.items[X-1]);else if(rt(L))ae.push(U[X-1]);else break;if(ae.length===J.length)wi(L)?L=new l(ae):L=i(ae),W.splice(1,1);else break}else break;return W.length===P.dimensions.length?new s(E(L),P):W.length>0?(P=new f(W),new s(E(L),P)):L}if(Ou(L)&&P.dimensions.length===1&&Ht(P.dimensions[0])){var de=P.dimensions[0].value;return de in L.properties?L.properties[de]:new u}return new s(E(L),P)}function R(L,P,k,W){var O=P.shift(),X=P.reduce((ae,J)=>{if(!nr(J)){var U=ae.pop();if(nr(U))return[U,J];try{return ae.push(w(L,[U,J],W)),ae}catch{ae.push(U)}}ae.push(E(ae.pop()));var de=ae.length===1?ae[0]:k(ae);return[k([de,E(J)])]},[O]);return X.length===1?X[0]:k([X[0],y(X[1])])}function V(L,P){switch(L.type){case"SymbolNode":return L;case"ConstantNode":switch(typeof L.value){case"number":return _(L.value,P);case"bigint":return _(L.value,P);case"string":return L.value;default:if(!isNaN(L.value))return _(L.value,P)}return L;case"FunctionNode":if(n[L.name]&&n[L.name].rawArgs)return L;{var k=["add","multiply"];if(!k.includes(L.name)){var W=L.args.map(pe=>V(pe,P));if(!W.some(nr))try{return w(L.name,W,P)}catch{}if(L.name==="size"&&W.length===1&&wi(W[0])){for(var O=[],X=W[0];wi(X);)O.push(X.items.length),X=X.items[0];return i(O)}return new c(L.name,W.map(E))}}case"OperatorNode":{var ae=L.fn.toString(),J,U,de=T(L);if(Qr(L)&&L.isUnary())J=[V(L.args[0],P)],nr(J[0])?U=de(J):U=w(ae,J,P);else if(x(L,P.context))if(J=b(L,P.context),J=J.map(pe=>V(pe,P)),h(ae,P.context)){for(var we=[],se=[],be=0;be<J.length;be++)nr(J[be])?se.push(J[be]):we.push(J[be]);we.length>1?(U=R(ae,we,de,P),se.unshift(U),U=R(ae,se,de,P)):U=R(ae,J,de,P)}else U=R(ae,J,de,P);else J=L.args.map(pe=>V(pe,P)),U=R(ae,J,de,P);return U}case"ParenthesisNode":return V(L.content,P);case"AccessorNode":return B(V(L.object,P),V(L.index,P),P);case"ArrayNode":{var K=L.items.map(pe=>V(pe,P));return K.some(nr)?new l(K.map(E)):i(K)}case"IndexNode":return new f(L.dimensions.map(pe=>v(pe,P)));case"ObjectNode":{var j={};for(var ne in L.properties)j[ne]=v(L.properties[ne],P);return new m(j)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(L.type))}}return v});var lU="simplifyCore",Yne=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],UE=M(lU,Yne,t=>{var{typed:e,parse:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,AccessorNode:c,ArrayNode:f,ConstantNode:m,FunctionNode:p,IndexNode:d,ObjectNode:h,OperatorNode:x,ParenthesisNode:b,SymbolNode:T}=t,v=new m(0),A=new m(1),w=new m(!0),y=new m(!1);function E(C){return Qr(C)&&["and","not","or"].includes(C.op)}var{hasProperty:D,isCommutative:_}=Pf({FunctionNode:p,OperatorNode:x,SymbolNode:T});function N(C){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=B?B.context:void 0;if(D(C,"trivial",R)){if(na(C)&&C.args.length===1)return N(C.args[0],B);var V=!1,L=0;if(C.forEach(se=>{++L,L===1&&(V=N(se,B))}),L===1)return V}var P=C;if(na(P)){var k=oO(P.name);if(k){if(P.args.length>2&&D(P,"associative",R))for(;P.args.length>2;){var W=P.args.pop(),O=P.args.pop();P.args.push(new x(k,P.name,[W,O]))}P=new x(k,P.name,P.args)}else return new p(N(P.fn),P.args.map(se=>N(se,B)))}if(Qr(P)&&P.isUnary()){var X=N(P.args[0],B);if(P.op==="~"&&Qr(X)&&X.isUnary()&&X.op==="~"||P.op==="not"&&Qr(X)&&X.isUnary()&&X.op==="not"&&E(X.args[0]))return X.args[0];var ae=!0;if(P.op==="-"&&Qr(X)&&(X.isBinary()&&X.fn==="subtract"&&(P=new x("-","subtract",[X.args[1],X.args[0]]),ae=!1),X.isUnary()&&X.op==="-"))return X.args[0];if(ae)return new x(P.op,P.fn,[X])}if(Qr(P)&&P.isBinary()){var J=N(P.args[0],B),U=N(P.args[1],B);if(P.op==="+"){if(Ht(J)&&i(J.value))return U;if(Ht(U)&&i(U.value))return J;Qr(U)&&U.isUnary()&&U.op==="-"&&(U=U.args[0],P=new x("-","subtract",[J,U]))}if(P.op==="-")return Qr(U)&&U.isUnary()&&U.op==="-"?N(new x("+","add",[J,U.args[0]]),B):Ht(J)&&i(J.value)?N(new x("-","unaryMinus",[U])):Ht(U)&&i(U.value)?J:new x(P.op,P.fn,[J,U]);if(P.op==="*"){if(Ht(J)){if(i(J.value))return v;if(n(J.value,1))return U}if(Ht(U)){if(i(U.value))return v;if(n(U.value,1))return J;if(_(P,R))return new x(P.op,P.fn,[U,J],P.implicit)}return new x(P.op,P.fn,[J,U],P.implicit)}if(P.op==="/")return Ht(J)&&i(J.value)?v:Ht(U)&&n(U.value,1)?J:new x(P.op,P.fn,[J,U]);if(P.op==="^"&&Ht(U)){if(i(U.value))return A;if(n(U.value,1))return J}if(P.op==="and"){if(Ht(J))if(J.value){if(E(U))return U;if(Ht(U))return U.value?w:y}else return y;if(Ht(U))if(U.value){if(E(J))return J}else return y}if(P.op==="or"){if(Ht(J)){if(J.value)return w;if(E(U))return U}if(Ht(U)){if(U.value)return w;if(E(J))return J}}return new x(P.op,P.fn,[J,U])}if(Qr(P))return new x(P.op,P.fn,P.args.map(se=>N(se,B)));if(wi(P))return new f(P.items.map(se=>N(se,B)));if(Ha(P))return new c(N(P.object,B),N(P.index,B));if(go(P))return new d(P.dimensions.map(se=>N(se,B)));if(Ou(P)){var de={};for(var we in P.properties)de[we]=N(P.properties[we],B);return new h(de)}return P}return e(lU,{Node:N,"Node,Object":N})});var jne="resolve",Zne=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],qE=M(jne,Zne,t=>{var{typed:e,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=t;function s(l,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!u)return l;if(Gr(l)){if(c.has(l.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var m=u.get(l.name);if(nr(m)){var p=new Set(c);return p.add(l.name),s(m,u,p)}else return typeof m=="number"?r(String(m)):m!==void 0?new n(m):l}else if(Qr(l)){var d=l.args.map(function(x){return s(x,u,c)});return new a(l.op,l.fn,d,l.implicit)}else{if(_i(l))return new o(s(l.content,u,c));if(na(l)){var h=l.args.map(function(x){return s(x,u,c)});return new i(l.name,h)}}return l.map(x=>s(x,u,c))}return e("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(l,u)=>s(l,Zs(u)),"Array | Matrix":e.referToSelf(l=>u=>u.map(c=>l(c))),"Array | Matrix, null | undefined":e.referToSelf(l=>u=>u.map(c=>l(c))),"Array, Object":e.referTo("Array,Map",l=>(u,c)=>l(u,Zs(c))),"Matrix, Object":e.referTo("Matrix,Map",l=>(u,c)=>l(u,Zs(c))),"Array | Matrix, Map":e.referToSelf(l=>(u,c)=>u.map(f=>l(f,c)))})});var cU="symbolicEqual",Jne=["parse","simplify","typed","OperatorNode"],zE=M(cU,Jne,t=>{var{parse:e,simplify:r,typed:n,OperatorNode:i}=t;function a(o,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=new i("-","subtract",[o,s]),c=r(u,{},l);return Ht(c)&&!c.value}return n(cU,{"Node, Node":a,"Node, Node, Object":a})});var fU="derivative",Xne=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],HE=M(fU,Xne,t=>{var{typed:e,config:r,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:f,SymbolNode:m}=t;function p(A,w){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},E=new Map,D=w.name;function _(C){var B=E.get(C);if(B!==void 0)return B;var R=b(_,C,D);return E.set(C,R),R}var N=T(A,_);return y.simplify?i(N):N}function d(A){var w=n(A);if(!w.isSymbolNode)throw new TypeError("Invalid variable. "+"Cannot parse ".concat(JSON.stringify(A)," into a variable in function derivative"));return w}var h=e(fU,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(A,w)=>p(A,d(w)),"Node, string, Object":(A,w,y)=>p(A,d(w),y)});h._simplify=!0,h.toTex=function(A){return x.apply(null,A.args)};var x=e("_derivTex",{"Node, SymbolNode":function(w,y){return Ht(w)&&fr(w.value)==="string"?x(n(w.value).toString(),y.toString(),1):x(w.toTex(),y.toString(),1)},"Node, ConstantNode":function(w,y){if(fr(y.value)==="string")return x(w,n(y.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,y,E){return x(w.toString(),y.name,E.value)},"string, string, number":function(w,y,E){var D;return E===1?D="{d\\over d"+y+"}":D="{d^{"+E+"}\\over d"+y+"^{"+E+"}}",D+"\\left[".concat(w,"\\right]")}}),b=e("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(w,y,E){return y.name!==E},"function, ParenthesisNode, string":function(w,y,E){return w(y.content,E)},"function, FunctionAssignmentNode, string":function(w,y,E){return y.params.includes(E)?w(y.expr,E):!0},"function, FunctionNode | OperatorNode, string":function(w,y,E){return y.args.every(D=>w(D,E))}}),T=e("_derivative",{"ConstantNode, function":function(){return v(0)},"SymbolNode, function":function(w,y){return y(w)?v(0):v(1)},"ParenthesisNode, function":function(w,y){return new f(T(w.content,y))},"FunctionAssignmentNode, function":function(w,y){return y(w)?v(0):T(w.expr,y)},"FunctionNode, function":function(w,y){if(y(w))return v(0);var E=w.args[0],D,_=!1,N=!1,C;switch(w.name){case"cbrt":_=!0,C=new c("*","multiply",[v(3),new c("^","pow",[E,new c("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)_=!0,C=new c("*","multiply",[v(2),new u("sqrt",[E])]);else if(w.args.length===2)return D=new c("/","divide",[v(1),w.args[1]]),T(new c("^","pow",[E,D]),y);break;case"log10":D=v(10);case"log":if(!D&&w.args.length===1)C=E.clone(),_=!0;else if(w.args.length===1&&D||w.args.length===2&&y(w.args[1]))C=new c("*","multiply",[E.clone(),new u("log",[D||w.args[1]])]),_=!0;else if(w.args.length===2)return T(new c("/","divide",[new u("log",[E]),new u("log",[w.args[1]])]),y);break;case"pow":if(w.args.length===2)return T(new c("^","pow",[E,w.args[1]]),y);break;case"exp":C=new u("exp",[E.clone()]);break;case"sin":C=new u("cos",[E.clone()]);break;case"cos":C=new c("-","unaryMinus",[new u("sin",[E.clone()])]);break;case"tan":C=new c("^","pow",[new u("sec",[E.clone()]),v(2)]);break;case"sec":C=new c("*","multiply",[w,new u("tan",[E.clone()])]);break;case"csc":N=!0,C=new c("*","multiply",[w,new u("cot",[E.clone()])]);break;case"cot":N=!0,C=new c("^","pow",[new u("csc",[E.clone()]),v(2)]);break;case"asin":_=!0,C=new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])]);break;case"acos":_=!0,N=!0,C=new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])]);break;case"atan":_=!0,C=new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)]);break;case"asec":_=!0,C=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acsc":_=!0,N=!0,C=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acot":_=!0,N=!0,C=new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)]);break;case"sinh":C=new u("cosh",[E.clone()]);break;case"cosh":C=new u("sinh",[E.clone()]);break;case"tanh":C=new c("^","pow",[new u("sech",[E.clone()]),v(2)]);break;case"sech":N=!0,C=new c("*","multiply",[w,new u("tanh",[E.clone()])]);break;case"csch":N=!0,C=new c("*","multiply",[w,new u("coth",[E.clone()])]);break;case"coth":N=!0,C=new c("^","pow",[new u("csch",[E.clone()]),v(2)]);break;case"asinh":_=!0,C=new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"acosh":_=!0,C=new u("sqrt",[new c("-","subtract",[new c("^","pow",[E.clone(),v(2)]),v(1)])]);break;case"atanh":_=!0,C=new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])]);break;case"asech":_=!0,N=!0,C=new c("*","multiply",[E.clone(),new u("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])])])]);break;case"acsch":_=!0,N=!0,C=new c("*","multiply",[new u("abs",[E.clone()]),new u("sqrt",[new c("+","add",[new c("^","pow",[E.clone(),v(2)]),v(1)])])]);break;case"acoth":_=!0,N=!0,C=new c("-","subtract",[v(1),new c("^","pow",[E.clone(),v(2)])]);break;case"abs":C=new c("/","divide",[new u(new m("abs"),[E.clone()]),E.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 B,R;_?(B="/",R="divide"):(B="*",R="multiply");var V=T(E,y);return N&&(V=new c("-","unaryMinus",[V])),new c(B,R,[V,C])},"OperatorNode, function":function(w,y){if(y(w))return v(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(P){return T(P,y)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[T(w.args[0],y)]);if(w.isBinary())return new c(w.op,w.fn,[T(w.args[0],y),T(w.args[1],y)])}if(w.op==="*"){var E=w.args.filter(function(P){return y(P)});if(E.length>0){var D=w.args.filter(function(P){return!y(P)}),_=D.length===1?D[0]:new c("*","multiply",D),N=E.concat(T(_,y));return new c("*","multiply",N)}return new c("+","add",w.args.map(function(P){return new c("*","multiply",w.args.map(function(k){return k===P?T(k,y):k.clone()}))}))}if(w.op==="/"&&w.isBinary()){var C=w.args[0],B=w.args[1];return y(B)?new c("/","divide",[T(C,y),B]):y(C)?new c("*","multiply",[new c("-","unaryMinus",[C]),new c("/","divide",[T(B,y),new c("^","pow",[B.clone(),v(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[T(C,y),B.clone()]),new c("*","multiply",[C.clone(),T(B,y)])]),new c("^","pow",[B.clone(),v(2)])])}if(w.op==="^"&&w.isBinary()){var R=w.args[0],V=w.args[1];if(y(R))return Ht(R)&&(o(R.value)||a(R.value,1))?v(0):new c("*","multiply",[w,new c("*","multiply",[new u("log",[R.clone()]),T(V.clone(),y)])]);if(y(V)){if(Ht(V)){if(o(V.value))return v(0);if(a(V.value,1))return T(R,y)}var L=new c("^","pow",[R.clone(),new c("-","subtract",[V,v(1)])]);return new c("*","multiply",[V.clone(),new c("*","multiply",[T(R,y),L])])}return new c("*","multiply",[new c("^","pow",[R.clone(),V.clone()]),new c("+","add",[new c("*","multiply",[T(R,y),new c("/","divide",[V.clone(),R.clone()])]),new c("*","multiply",[T(V,y),new u("log",[R.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 v(A,w){return new l(s(A,w||Bi(String(A),r)))}return h});var pU="rationalize",Qne=["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"],GE=M(pU,Qne,t=>{var{config:e,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:l,pow:u,parse:c,simplifyConstant:f,simplifyCore:m,simplify:p,fraction:d,bignumber:h,mathWithTransform:x,matrix:b,AccessorNode:T,ArrayNode:v,ConstantNode:A,FunctionNode:w,IndexNode:y,ObjectNode:E,OperatorNode:D,SymbolNode:_,ParenthesisNode:N}=t;function C(P){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=R(),X=B(P,k,!0,O.firstRules),ae=X.variables.length,J={exactFractions:!1},U={exactFractions:!0};if(P=X.expression,ae>=1){P=V(P);var de,we,se=!0,be=!1;P=p(P,O.firstRules,{},J);for(var K;we=se?O.distrDivRules:O.sucDivRules,P=p(P,we,{},U),se=!se,K=P.toString(),K!==de;)be=!0,de=K;be&&(P=p(P,O.firstRulesAgain,{},J)),P=p(P,O.finalRules,{},J)}var j=[],ne={};return P.type==="OperatorNode"&&P.isBinary()&&P.op==="/"?(ae===1&&(P.args[0]=L(P.args[0],j),P.args[1]=L(P.args[1])),W&&(ne.numerator=P.args[0],ne.denominator=P.args[1])):(ae===1&&(P=L(P,j)),W&&(ne.numerator=P,ne.denominator=null)),W?(ne.coefficients=j,ne.variables=X.variables,ne.expression=P,ne):P}return r(pU,{Node:C,"Node, boolean":(P,k)=>C(P,{},k),"Node, Object":C,"Node, Object, boolean":C});function B(P,k,W,O){var X=[],ae=p(P,O,k,{exactFractions:!1});W=!!W;var J="+-*"+(W?"/":"");de(ae);var U={};return U.expression=ae,U.variables=X,U;function de(we){var se=we.type;if(se==="FunctionNode")throw new Error("There is an unsolved function call");if(se==="OperatorNode")if(we.op==="^"){if(we.args[1].type!=="ConstantNode"||!Qe(parseFloat(we.args[1].value)))throw new Error("There is a non-integer exponent");de(we.args[0])}else{if(!J.includes(we.op))throw new Error("Operator "+we.op+" invalid in polynomial expression");for(var be=0;be<we.args.length;be++)de(we.args[be])}else if(se==="SymbolNode"){var K=we.name,j=X.indexOf(K);j===-1&&X.push(K)}else if(se==="ParenthesisNode")de(we.content);else if(se!=="ConstantNode")throw new Error("type "+se+" is not allowed in polynomial expression")}}function R(){var P=[m,{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"}],k=[{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))"}],X={};return X.firstRules=P.concat(k,O),X.distrDivRules=W,X.sucDivRules=O,X.firstRulesAgain=P.concat(k),X.finalRules=[m,{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))"}],X}function V(P,k,W){var O=P.type,X=arguments.length>1;if(O==="OperatorNode"&&P.isBinary()){var ae=!1,J;if(P.op==="^"&&(P.args[0].type==="ParenthesisNode"||P.args[0].type==="OperatorNode")&&P.args[1].type==="ConstantNode"&&(J=parseFloat(P.args[1].value),ae=J>=2&&Qe(J)),ae){if(J>2){var U=P.args[0],de=new D("^","pow",[P.args[0].cloneDeep(),new A(J-1)]);P=new D("*","multiply",[U,de])}else P=new D("*","multiply",[P.args[0],P.args[0].cloneDeep()]);X&&(W==="content"?k.content=P:k.args[W]=P)}}if(O==="ParenthesisNode")V(P.content,P,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var we=0;we<P.args.length;we++)V(P.args[we],P,we);if(!X)return P}function L(P,k){k===void 0&&(k=[]),k[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,X="";K(P,null,W),O=k.length-1;for(var ae=!0,J,U=O;U>=0;U--)if(k[U]!==0){var de=new A(ae?k[U]:Math.abs(k[U])),we=k[U]<0?"-":"+";if(U>0){var se=new _(X);if(U>1){var be=new A(U);se=new D("^","pow",[se,be])}k[U]===-1&&ae?de=new D("-","unaryMinus",[se]):Math.abs(k[U])===1?de=se:de=new D("*","multiply",[de,se])}ae?J=de:we==="+"?J=new D("+","add",[J,de]):J=new D("-","subtract",[J,de]),ae=!1}if(ae)return new A(0);return J;function K(j,ne,pe){var fe=j.type;if(fe==="FunctionNode")throw new Error("There is an unsolved function call");if(fe==="OperatorNode"){if(!"+-*^".includes(j.op))throw new Error("Operator "+j.op+" invalid");if(ne!==null){if((j.fn==="unaryMinus"||j.fn==="pow")&&ne.fn!=="add"&&ne.fn!=="subtract"&&ne.fn!=="multiply")throw new Error("Invalid "+j.op+" placing");if((j.fn==="subtract"||j.fn==="add"||j.fn==="multiply")&&ne.fn!=="add"&&ne.fn!=="subtract")throw new Error("Invalid "+j.op+" placing");if((j.fn==="subtract"||j.fn==="add"||j.fn==="unaryMinus")&&pe.noFil!==0)throw new Error("Invalid "+j.op+" placing")}(j.op==="^"||j.op==="*")&&(pe.fire=j.op);for(var Ae=0;Ae<j.args.length;Ae++)j.fn==="unaryMinus"&&(pe.oper="-"),(j.op==="+"||j.fn==="subtract")&&(pe.fire="",pe.cte=1,pe.oper=Ae===0?"+":j.op),pe.noFil=Ae,K(j.args[Ae],j,pe)}else if(fe==="SymbolNode"){if(j.name!==X&&X!=="")throw new Error("There is more than one variable");if(X=j.name,ne===null){k[1]=1;return}if(ne.op==="^"&&pe.noFil!==0)throw new Error("In power the variable should be the first parameter");if(ne.op==="*"&&pe.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(pe.fire===""||pe.fire==="*")&&(O<1&&(k[1]=0),k[1]+=pe.cte*(pe.oper==="+"?1:-1),O=Math.max(1,O))}else if(fe==="ConstantNode"){var _e=parseFloat(j.value);if(ne===null){k[0]=_e;return}if(ne.op==="^"){if(pe.noFil!==1)throw new Error("Constant cannot be powered");if(!Qe(_e)||_e<=0)throw new Error("Non-integer exponent is not allowed");for(var G=O+1;G<_e;G++)k[G]=0;_e>O&&(k[_e]=0),k[_e]+=pe.cte*(pe.oper==="+"?1:-1),O=Math.max(_e,O);return}pe.cte=_e,pe.fire===""&&(k[0]+=pe.cte*(pe.oper==="+"?1:-1))}else throw new Error("Type "+fe+" is not allowed")}}});var mU="zpk2tf",Kne=["typed","add","multiply","Complex","number"],WE=M(mU,Kne,t=>{var{typed:e,add:r,multiply:n,Complex:i,number:a}=t;return e(mU,{"Array,Array,number":function(u,c,f){return o(u,c,f)},"Array,Array":function(u,c){return o(u,c,1)},"Matrix,Matrix,number":function(u,c,f){return o(u.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(u,c){return o(u.valueOf(),c.valueOf(),1)}});function o(l,u,c){l.some(T=>T.type==="BigNumber")&&(l=l.map(T=>a(T))),u.some(T=>T.type==="BigNumber")&&(u=u.map(T=>a(T)));for(var f=[i(1,0)],m=[i(1,0)],p=0;p<l.length;p++){var d=l[p];typeof d=="number"&&(d=i(d,0)),f=s(f,[i(1,0),i(-d.re,-d.im)])}for(var h=0;h<u.length;h++){var x=u[h];typeof x=="number"&&(x=i(x,0)),m=s(m,[i(1,0),i(-x.re,-x.im)])}for(var b=0;b<f.length;b++)f[b]=n(f[b],c);return[f,m]}function s(l,u){for(var c=[],f=0;f<l.length+u.length-1;f++){c[f]=i(0,0);for(var m=0;m<l.length;m++)f-m>=0&&f-m<u.length&&(c[f]=r(c[f],n(l[m],u[f-m])))}return c}});var dU="freqz",eie=["typed","add","multiply","Complex","divide","matrix"],YE=M(dU,eie,t=>{var{typed:e,add:r,multiply:n,Complex:i,divide:a,matrix:o}=t;return e(dU,{"Array, Array":function(c,f){var m=l(512);return s(c,f,m)},"Array, Array, Array":function(c,f,m){return s(c,f,m)},"Array, Array, number":function(c,f,m){if(m<0)throw new Error("w must be a positive number");var p=l(m);return s(c,f,p)},"Matrix, Matrix":function(c,f){var m=l(512),{w:p,h:d}=s(c.valueOf(),f.valueOf(),m);return{w:o(p),h:o(d)}},"Matrix, Matrix, Matrix":function(c,f,m){var{h:p}=s(c.valueOf(),f.valueOf(),m.valueOf());return{h:o(p),w:o(m)}},"Matrix, Matrix, number":function(c,f,m){if(m<0)throw new Error("w must be a positive number");var p=l(m),{h:d}=s(c.valueOf(),f.valueOf(),p);return{h:o(d),w:o(p)}}});function s(u,c,f){for(var m=[],p=[],d=0;d<f.length;d++){for(var h=i(0,0),x=i(0,0),b=0;b<u.length;b++)h=r(h,n(u[b],i(Math.cos(-b*f[d]),Math.sin(-b*f[d]))));for(var T=0;T<c.length;T++)x=r(x,n(c[T],i(Math.cos(-T*f[d]),Math.sin(-T*f[d]))));m.push(h),p.push(x)}for(var v=[],A=0;A<m.length;A++)v.push(a(m[A],p[A]));return{h:v,w:f}}function l(u){for(var c=[],f=0;f<u;f++)c.push(f/u*Math.PI);return c}});var tie="reviver",rie=["classes"],jE=M(tie,rie,t=>{var{classes:e}=t;return function(n,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var nie="replacer",iie=[],ZE=M(nie,iie,()=>function(e,r){return typeof r=="number"&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:typeof r=="bigint"?{mathjs:"bigint",value:String(r)}:r});var hU="14.0.1";var JE=M("true",[],()=>!0),XE=M("false",[],()=>!1),QE=M("null",[],()=>null),KE=Ya("Infinity",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1/0):1/0}),eT=Ya("NaN",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(NaN):NaN}),tT=Ya("pi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?Am(r):ZP}),rT=Ya("tau",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?v$(r):JP}),nT=Ya("e",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?h$(r):XP}),iT=Ya("phi",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?g$(r):QP}),aT=Ya("LN2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).ln():Math.LN2}),oT=Ya("LN10",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(10).ln():Math.LN10}),sT=Ya("LOG2E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(2).ln()):Math.LOG2E}),uT=Ya("LOG10E",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(1).div(new r(10).ln()):Math.LOG10E}),lT=Ya("SQRT1_2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r("0.5").sqrt():Math.SQRT1_2}),cT=Ya("SQRT2",["config","?BigNumber"],t=>{var{config:e,BigNumber:r}=t;return e.number==="BigNumber"?new r(2).sqrt():Math.SQRT2}),fT=Ya("i",["Complex"],t=>{var{Complex:e}=t;return e.I});var pT=M("version",[],()=>hU);function Ya(t,e,r){return M(t,e,r,{recreateOnConfigChange:!0})}var mT=ar("speedOfLight","299792458","m s^-1"),dT=ar("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),hT=ar("planckConstant","6.62607015e-34","J s"),gT=ar("reducedPlanckConstant","1.0545718176461565e-34","J s"),vT=ar("magneticConstant","1.25663706212e-6","N A^-2"),yT=ar("electricConstant","8.8541878128e-12","F m^-1"),xT=ar("vacuumImpedance","376.730313667","ohm"),bT=ar("coulomb","8.987551792261171e9","N m^2 C^-2"),wT=ar("elementaryCharge","1.602176634e-19","C"),_T=ar("bohrMagneton","9.2740100783e-24","J T^-1"),AT=ar("conductanceQuantum","7.748091729863649e-5","S"),ST=ar("inverseConductanceQuantum","12906.403729652257","ohm"),ET=ar("magneticFluxQuantum","2.0678338484619295e-15","Wb"),TT=ar("nuclearMagneton","5.0507837461e-27","J T^-1"),DT=ar("klitzing","25812.807459304513","ohm");var MT=ar("bohrRadius","5.29177210903e-11","m"),CT=ar("classicalElectronRadius","2.8179403262e-15","m"),NT=ar("electronMass","9.1093837015e-31","kg"),FT=ar("fermiCoupling","1.1663787e-5","GeV^-2"),IT=Rv("fineStructure",.0072973525693),PT=ar("hartreeEnergy","4.3597447222071e-18","J"),BT=ar("protonMass","1.67262192369e-27","kg"),kT=ar("deuteronMass","3.3435830926e-27","kg"),$T=ar("neutronMass","1.6749271613e-27","kg"),OT=ar("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),RT=ar("rydberg","10973731.568160","m^-1"),LT=ar("thomsonCrossSection","6.6524587321e-29","m^2"),VT=Rv("weakMixingAngle",.2229),UT=Rv("efimovFactor",22.7),qT=ar("atomicMass","1.66053906660e-27","kg"),zT=ar("avogadro","6.02214076e23","mol^-1"),HT=ar("boltzmann","1.380649e-23","J K^-1"),GT=ar("faraday","96485.33212331001","C mol^-1"),WT=ar("firstRadiation","3.7417718521927573e-16","W m^2"),YT=ar("loschmidt","2.686780111798444e25","m^-3"),jT=ar("gasConstant","8.31446261815324","J K^-1 mol^-1"),ZT=ar("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),JT=ar("molarVolume","0.022413969545014137","m^3 mol^-1"),XT=Rv("sackurTetrode",-1.16487052358),QT=ar("secondRadiation","0.014387768775039337","m K"),KT=ar("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),eD=ar("wienDisplacement","2.897771955e-3","m K"),tD=ar("molarMass","0.99999999965e-3","kg mol^-1"),rD=ar("molarMassC12","11.9999999958e-3","kg mol^-1"),nD=ar("gravity","9.80665","m s^-2"),iD=ar("planckLength","1.616255e-35","m"),aD=ar("planckMass","2.176435e-8","kg"),oD=ar("planckTime","5.391245e-44","s"),sD=ar("planckCharge","1.87554603778e-18","C"),uD=ar("planckTemperature","1.416785e+32","K");function ar(t,e,r){var n=["config","Unit","BigNumber"];return M(t,n,i=>{var{config:a,Unit:o,BigNumber:s}=i,l=a.number==="BigNumber"?new s(e):parseFloat(e),u=new o(l,r);return u.fixPrefix=!0,u})}function Rv(t,e){var r=["config","BigNumber"];return M(t,r,n=>{var{config:i,BigNumber:a}=n;return i.number==="BigNumber"?new a(e):e})}var aie="apply",oie=["typed","isInteger"],lD=M(aie,oie,t=>{var{typed:e,isInteger:r}=t,n=Zl({typed:e,isInteger:r});return e("apply",{"...any":function(a){var o=a[1];At(o)?a[1]=o-1:ft(o)&&(a[1]=o.minus(1));try{return n.apply(null,a)}catch(s){throw Zr(s)}}})},{isTransformFunction:!0});var sie="column",uie=["typed","Index","matrix","range"],cD=M(sie,uie,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=fm({typed:e,Index:r,matrix:n,range:i});return e("column",{"...any":function(s){var l=s.length-1,u=s[l];At(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Zr(c)}}})},{isTransformFunction:!0});function Bf(t,e,r){var n=t.filter(function(l){return Gr(l)&&!(l.name in e)&&!r.has(l.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+t+'"');var i=n.name,a=new Map,o=new ff(r,a,new Set([i])),s=t.compile();return function(u){return a.set(i,u),s.evaluate(o)}}var lie="transformCallback",cie=["typed"],kf=M(lie,cie,t=>{var{typed:e}=t;return function(n,i){return e.isTypedFunction(n)?r(n,i):gU(n,n.length,i)};function r(n,i){var a=Object.fromEntries(Object.entries(n.signatures).map(o=>{var[s,l]=o,u=s.split(",").length;return e.isTypedFunction(l)?[s,r(l,i)]:[s,gU(l,u,i)]}));return typeof n.name=="string"?e(n.name,a):e(a)}});function gU(t,e,r){return e===r?t:e===r+1?function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.slice(0,r),s=vU(i[r]);return t(...o,s)}:e>r+1?function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.slice(0,r),s=vU(i[r]),l=i.slice(r+1);return t(...o,s,...l)}:t}function vU(t){return t.map(e=>e+1)}var fie="filter",pie=["typed"],fD=M(fie,pie,t=>{var{typed:e}=t;function r(i,a,o){var s=pm({typed:e}),l=kf({typed:e});if(i.length===0)return s();var u=i[0];if(i.length===1)return s(u);var c=i.length-1,f=i[c];return u&&(u=n(u,o)),f&&(Gr(f)||ms(f)?f=n(f,o):f=Bf(f,a,o)),s(u,l(f,c))}r.rawArgs=!0;function n(i,a){return i.compile().evaluate(a)}return r},{isTransformFunction:!0});var mie="forEach",die=["typed"],pD=M(mie,die,t=>{var{typed:e}=t,r=mm({typed:e}),n=kf({typed:e});function i(o,s,l){if(o.length===0)return r();var u=o[0];if(o.length===1)return r(u);var c=o.length-1,f=o[c];return u&&(u=a(u,l)),f&&(Gr(f)||ms(f)?f=a(f,l):f=Bf(f,s,l)),r(u,n(f,c))}i.rawArgs=!0;function a(o,s){return o.compile().evaluate(s)}return i},{isTransformFunction:!0});var hie="index",gie=["Index","getMatrixDataType"],mD=M(hie,gie,t=>{var{Index:e,getMatrixDataType:r}=t;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var s=arguments[a];if(pf(s))s.start--,s.end-=s.step>0?0:2;else if(s&&s.isSet===!0)s=s.map(function(u){return u-1});else if(vr(s)||rt(s))r(s)!=="boolean"&&(s=s.map(function(u){return u-1}));else if(At(s))s--;else if(ft(s))s=s.toNumber()-1;else if(typeof s!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=s}var l=new e;return e.apply(l,i),l}},{isTransformFunction:!0});var vie="map",yie=["typed"],dD=M(vie,yie,t=>{var{typed:e}=t,r=dm({typed:e}),n=kf({typed:e});function i(a,o,s){if(a.length===0)return r();if(a.length===1)return r(a[0]);var l=a.length-1,u=a.slice(0,l),c=a[l];return u=u.map(m=>f(m,s)),c&&(Gr(c)||ms(c)?c=f(c,s):c=Bf(c,o,s)),r(...u,n(c,l));function f(m,p){return m.compile().evaluate(p)}}return i.rawArgs=!0,i},{isTransformFunction:!0});function yU(t){return At(t)?t-1:ft(t)?t.minus(1):t}function xU(t){return At(t)||ft(t)}function Li(t){if(t.length===2&&Tn(t[0])){t=t.slice();var e=t[1];xU(e)&&(t[1]=yU(e))}return t}var xie="max",bie=["typed","config","numeric","larger"],hD=M(xie,bie,t=>{var{typed:e,config:r,numeric:n,larger:i}=t,a=wm({typed:e,config:r,numeric:n,larger:i});return e("max",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var wie="mean",_ie=["typed","add","divide"],gD=M(wie,_ie,t=>{var{typed:e,add:r,divide:n}=t,i=Dm({typed:e,add:r,divide:n});return e("mean",{"...any":function(o){o=Li(o);try{return i.apply(null,o)}catch(s){throw Zr(s)}}})},{isTransformFunction:!0});var Aie="min",Sie=["typed","config","numeric","smaller"],vD=M(Aie,Sie,t=>{var{typed:e,config:r,numeric:n,smaller:i}=t,a=_m({typed:e,config:r,numeric:n,smaller:i});return e("min",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var Eie="range",Tie=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],yD=M(Eie,Tie,t=>{var{typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c}=t,f=gm({typed:e,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:l,add:u,isPositive:c});return e("range",{"...any":function(p){var d=p.length-1,h=p[d];return typeof h!="boolean"&&p.push(!0),f.apply(null,p)}})},{isTransformFunction:!0});var Die="row",Mie=["typed","Index","matrix","range"],xD=M(Die,Mie,t=>{var{typed:e,Index:r,matrix:n,range:i}=t,a=vm({typed:e,Index:r,matrix:n,range:i});return e("row",{"...any":function(s){var l=s.length-1,u=s[l];At(u)&&(s[l]=u-1);try{return a.apply(null,s)}catch(c){throw Zr(c)}}})},{isTransformFunction:!0});var Cie="subset",Nie=["typed","matrix","zeros","add"],bD=M(Cie,Nie,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=ym({typed:e,matrix:r,zeros:n,add:i});return e("subset",{"...any":function(s){try{return a.apply(null,s)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var Fie="concat",Iie=["typed","matrix","isInteger"],wD=M(Fie,Iie,t=>{var{typed:e,matrix:r,isInteger:n}=t,i=cm({typed:e,matrix:r,isInteger:n});return e("concat",{"...any":function(o){var s=o.length-1,l=o[s];At(l)?o[s]=l-1:ft(l)&&(o[s]=l.minus(1));try{return i.apply(null,o)}catch(u){throw Zr(u)}}})},{isTransformFunction:!0});var bU="diff",Pie=["typed","matrix","subtract","number","bignumber"],_D=M(bU,Pie,t=>{var{typed:e,matrix:r,subtract:n,number:i,bignumber:a}=t,o=hm({typed:e,matrix:r,subtract:n,number:i,bignumber:a});return e(bU,{"...any":function(l){l=Li(l);try{return o.apply(null,l)}catch(u){throw Zr(u)}}})},{isTransformFunction:!0});var Bie="std",kie=["typed","map","sqrt","variance"],AD=M(Bie,kie,t=>{var{typed:e,map:r,sqrt:n,variance:i}=t,a=Nm({typed:e,map:r,sqrt:n,variance:i});return e("std",{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var wU="sum",$ie=["typed","config","add","numeric"],SD=M(wU,$ie,t=>{var{typed:e,config:r,add:n,numeric:i}=t,a=Em({typed:e,config:r,add:n,numeric:i});return e(wU,{"...any":function(s){s=Li(s);try{return a.apply(null,s)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var Oie="quantileSeq",Rie=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],ED=M(Oie,Rie,t=>{var{typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m}=t,p=Cm({typed:e,bignumber:r,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:l,isInteger:u,smaller:c,smallerEq:f,larger:m});return e("quantileSeq",{"Array | Matrix, number | BigNumber":p,"Array | Matrix, number | BigNumber, number":(h,x,b)=>p(h,x,d(b)),"Array | Matrix, number | BigNumber, boolean":p,"Array | Matrix, number | BigNumber, boolean, number":(h,x,b,T)=>p(h,x,b,d(T)),"Array | Matrix, Array | Matrix":p,"Array | Matrix, Array | Matrix, number":(h,x,b)=>p(h,x,d(b)),"Array | Matrix, Array | Matrix, boolean":p,"Array | Matrix, Array | Matrix, boolean, number":(h,x,b,T)=>p(h,x,b,d(T))});function d(h){return Li([[],h])[1]}},{isTransformFunction:!0});var _U="cumsum",Lie=["typed","add","unaryPlus"],TD=M(_U,Lie,t=>{var{typed:e,add:r,unaryPlus:n}=t,i=Tm({typed:e,add:r,unaryPlus:n});return e(_U,{"...any":function(o){if(o.length===2&&Tn(o[0])){var s=o[1];At(s)?o[1]=s-1:ft(s)&&(o[1]=s.minus(1))}try{return i.apply(null,o)}catch(l){throw Zr(l)}}})},{isTransformFunction:!0});var AU="variance",Vie=["typed","add","subtract","multiply","divide","apply","isNaN"],DD=M(AU,Vie,t=>{var{typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=t,l=Mm({typed:e,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return e(AU,{"...any":function(c){c=Li(c);try{return l.apply(null,c)}catch(f){throw Zr(f)}}})},{isTransformFunction:!0});var SU="print",Uie=["typed","matrix","zeros","add"],MD=M(SU,Uie,t=>{var{typed:e,matrix:r,zeros:n,add:i}=t,a=xm({typed:e,matrix:r,zeros:n,add:i});return e(SU,{"string, Object | Array":function(l,u){return a(o(l),u)},"string, Object | Array, number | Object":function(l,u,c){return a(o(l),u,c)}});function o(s){return s.replace(av,l=>{var u=l.slice(1).split("."),c=u.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var qie="and",zie=["typed","matrix","zeros","add","equalScalar","not","concat"],CD=M(qie,zie,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=bm({typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var m=u[0].compile().evaluate(f);if(!Tn(m)&&!s(m,!0))return!1;var p=u[1].compile().evaluate(f);return s(m,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var Hie="or",Gie=["typed","matrix","equalScalar","DenseMatrix","concat"],ND=M(Hie,Gie,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=lm({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Tn(f)&&o(f,!1))return!0;var m=l[1].compile().evaluate(c);return o(f,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var Wie="bitAnd",Yie=["typed","matrix","zeros","add","equalScalar","not","concat"],FD=M(Wie,Yie,t=>{var{typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o}=t,s=sm({typed:e,matrix:r,equalScalar:n,zeros:i,not:a,concat:o});function l(u,c,f){var m=u[0].compile().evaluate(f);if(!Tn(m)){if(isNaN(m))return NaN;if(m===0||m===!1)return 0}var p=u[1].compile().evaluate(f);return s(m,p)}return l.rawArgs=!0,l},{isTransformFunction:!0});var jie="bitOr",Zie=["typed","matrix","equalScalar","DenseMatrix","concat"],ID=M(jie,Zie,t=>{var{typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a}=t,o=um({typed:e,matrix:r,equalScalar:n,DenseMatrix:i,concat:a});function s(l,u,c){var f=l[0].compile().evaluate(c);if(!Tn(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var m=l[1].compile().evaluate(c);return o(f,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var We=j0({config:Ie}),Jr=X0({}),PD=nT({BigNumber:We,config:Ie}),EU=XE({}),TU=IT({BigNumber:We,config:Ie}),Wu=ew({}),BD=fT({Complex:Jr}),DU=KE({BigNumber:We,config:Ie}),MU=oT({BigNumber:We,config:Ie}),CU=uT({BigNumber:We,config:Ie}),Pm=rw({}),NU=eT({BigNumber:We,config:Ie}),FU=QE({}),IU=iT({BigNumber:We,config:Ie}),PU=tw({}),kD=U0({}),BU=lT({BigNumber:We,config:Ie}),kU=XT({BigNumber:We,config:Ie}),$D=rT({BigNumber:We,config:Ie}),$U=JE({}),OU=pT({}),sr=cw({Matrix:Pm}),RU=UT({BigNumber:We,config:Ie}),LU=aT({BigNumber:We,config:Ie}),Lv=tT({BigNumber:We,config:Ie}),OD=ZE({}),VU=cT({BigNumber:We,config:Ie}),te=V0({BigNumber:We,Complex:Jr,DenseMatrix:sr,Fraction:Wu}),UU=VT({BigNumber:We,config:Ie}),Vi=N_({typed:te}),qU=MA({Complex:Jr,config:Ie,typed:te}),zU=NA({BigNumber:We,typed:te}),HU=IA({BigNumber:We,Complex:Jr,config:Ie,typed:te}),Wn=F_({typed:te}),GU=o1({typed:te}),WU=kA({BigNumber:We,Complex:Jr,config:Ie,typed:te}),YU=OA({typed:te}),RD=RA({typed:te}),jU=VA({Complex:Jr,config:Ie,typed:te}),ZU=v_({typed:te}),JU=i1({typed:te}),XU=x_({typed:te}),QU=fw({typed:te}),Bm=dE({typed:te}),km=w_({Complex:Jr,typed:te}),Yu=s1({typed:te}),Vv=UA({typed:te}),KU=zA({BigNumber:We,typed:te}),e5=GA({BigNumber:We,typed:te}),t5=$_({typed:te}),pr=d_({config:Ie,typed:te}),r5=B1({typed:te}),LD=O_({typed:te}),n5=R_({Complex:Jr,typed:te}),i5=pm({typed:te}),$f=h1({typed:te}),a5=mm({typed:te}),Of=R1({typed:te}),Uv=v1({typed:te}),o5=U1({format:Of,typed:te}),qv=u1({typed:te}),ia=mw({typed:te}),iu=s_({config:Ie,typed:te}),ju=c_({config:Ie,typed:te}),jo=f_({equalScalar:pr,typed:te}),s5=sT({BigNumber:We,config:Ie}),u5=vE({Complex:Jr,typed:te}),l5=G_({Complex:Jr,config:Ie,typed:te}),VD=W_({Complex:Jr,config:Ie,typed:te}),Zu=dm({typed:te}),Dn=Y_({typed:te}),$m=c1({typed:te}),vs=g_({typed:te}),c5=V1({format:Of,typed:te}),f5=CE({config:Ie,typed:te}),p5=xm({typed:te}),m5=NE({config:Ie,typed:te}),zv=l1({typed:te}),d5=YA({BigNumber:We,typed:te}),UD=J_({BigNumber:We,Fraction:Wu,complex:km,typed:te}),Om=ZA({typed:te}),Yn=h_({Matrix:Pm,equalScalar:pr,typed:te}),h5=D_({typed:te}),g5=Q_({typed:te}),v5=y_({typed:te}),ja=I_({typed:te}),y5=XA({typed:te}),Hv=m_({typed:te}),x5=CA({Complex:Jr,config:Ie,typed:te}),b5=PA({BigNumber:We,typed:te}),Gv=Zl({isInteger:ia,typed:te}),w5=BA({BigNumber:We,Complex:Jr,config:Ie,typed:te}),Za=b_({BigNumber:We,typed:te}),_5=hE({typed:te}),A5=qA({typed:te}),S5=WA({BigNumber:We,typed:te}),Rf=p_({typed:te}),E5=z1({typed:te}),T5=FE({config:Ie,typed:te}),D5=jA({BigNumber:We,typed:te}),M5=JA({typed:te}),C5=TA({SparseMatrix:Yn,typed:te}),Eo=X_({Complex:Jr,config:Ie,typed:te}),N5=D1({typed:te}),F5=QA({typed:te}),Zo=M_({typed:te}),I5=FA({BigNumber:We,Complex:Jr,config:Ie,typed:te}),P5=L1({format:Of,typed:te}),B5=HA({BigNumber:We,typed:te}),Lf=__({Fraction:Wu,typed:te}),Ju=u_({typed:te}),ze=A_({DenseMatrix:sr,Matrix:Pm,SparseMatrix:Yn,typed:te}),k5=S_({isZero:jo,matrix:ze,typed:te}),$5=$1({isNaN:Rf,isNumeric:Ju,typed:te}),Ja=H1({bignumber:Za,fraction:Lf,number:vs}),qD=O1({config:Ie,multiplyScalar:Dn,numeric:Ja,typed:te}),zD=_1({isInteger:ia,matrix:ze,typed:te}),pi=T1({matrix:ze,config:Ie,typed:te}),Vf=M1({matrix:ze,typed:te}),HD=e1({BigNumber:We,config:Ie,matrix:ze,typed:te}),mi=N1({BigNumber:We,config:Ie,matrix:ze,typed:te}),O5=$A({Complex:Jr,config:Ie,typed:te}),GD=P_({BigNumber:We,Complex:Jr,Fraction:Wu,config:Ie,isNegative:iu,matrix:ze,typed:te,unaryMinus:Zo}),Sr=cm({isInteger:ia,matrix:ze,typed:te}),R5=p1({prod:qD,size:pi,typed:te}),Wv=C1({conj:Yu,transpose:Vf,typed:te}),WD=d1({DenseMatrix:sr,SparseMatrix:Yn,matrix:ze,typed:te}),dn=G1({numeric:Ja,typed:te}),Uf=Q1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,divideScalar:dn,equalScalar:pr,matrix:ze,typed:te}),Xa=lA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),L5=l_({isNumeric:Ju,typed:te}),au=y1({BigNumber:We,DenseMatrix:sr,SparseMatrix:Yn,config:Ie,matrix:ze,typed:te}),V5=x1({matrix:ze,multiplyScalar:Dn,typed:te}),Rm=dA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:ze,typed:te}),U5=nA({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te,zeros:mi}),YD=K1({DenseMatrix:sr,divideScalar:dn,equalScalar:pr,matrix:ze,multiplyScalar:Dn,subtractScalar:ja,typed:te}),Yv=T_({flatten:$f,matrix:ze,size:pi,typed:te}),q5=Z_({BigNumber:We,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),z5=w1({BigNumber:We,config:Ie,matrix:ze,typed:te}),jv=VS({addScalar:Wn,complex:km,conj:Yu,divideScalar:dn,equal:Xa,identity:au,isZero:jo,matrix:ze,multiplyScalar:Dn,sign:UD,sqrt:Eo,subtractScalar:ja,typed:te,unaryMinus:Zo,zeros:mi}),H5=A1({config:Ie,matrix:ze}),G5=iA({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te,zeros:mi}),tc=Y1({BigNumber:We,DenseMatrix:sr,config:Ie,equalScalar:pr,matrix:ze,typed:te,zeros:mi}),Ui=fA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:ze,typed:te}),Pn=K_({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,subtractScalar:ja,typed:te,unaryMinus:Zo}),W5=q1({concat:Sr,matrix:ze,typed:te}),Zv=C_({config:Ie,numeric:Ja,typed:te}),Jv=eA({DenseMatrix:sr,divideScalar:dn,equalScalar:pr,matrix:ze,multiplyScalar:Dn,subtractScalar:ja,typed:te}),Y5=f1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,matrix:ze,typed:te}),br=lS({DenseMatrix:sr,SparseMatrix:Yn,addScalar:Wn,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),j5=LA({BigNumber:We,DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),Z5=sm({concat:Sr,equalScalar:pr,matrix:ze,typed:te}),J5=um({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),X5=a1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,matrix:ze,typed:te}),Q5=BE({addScalar:Wn,combinations:Bm,divideScalar:dn,isInteger:ia,isNegative:iu,multiplyScalar:Dn,typed:te}),Xu=oA({BigNumber:We,DenseMatrix:sr,Fraction:Wu,concat:Sr,config:Ie,equalScalar:pr,matrix:ze,typed:te}),jD=uA({concat:Sr,matrix:ze,typed:te}),K5=Tm({add:br,typed:te,unaryPlus:Zv}),Xv=hA({equal:Xa,typed:te}),e8=hm({matrix:ze,number:vs,subtract:Pn,typed:te}),t8=uE({abs:Vi,addScalar:Wn,deepEqual:Xv,divideScalar:dn,multiplyScalar:Dn,sqrt:Eo,subtractScalar:ja,typed:te}),Lm=pS({addScalar:Wn,conj:Yu,multiplyScalar:Dn,size:pi,typed:te}),r8=cA({compareText:jD,isZero:jo,typed:te}),ZD=am({DenseMatrix:sr,config:Ie,equalScalar:pr,matrix:ze,round:tc,typed:te,zeros:mi}),n8=z_({BigNumber:We,DenseMatrix:sr,concat:Sr,config:Ie,equalScalar:pr,matrix:ze,round:tc,typed:te,zeros:mi}),i8=cS({abs:Vi,addScalar:Wn,divideScalar:dn,isPositive:ju,multiplyScalar:Dn,smaller:Ui,sqrt:Eo,typed:te}),JD=xA({DenseMatrix:sr,smaller:Ui}),Ei=bA({ImmutableDenseMatrix:JD,getMatrixDataType:Uv}),qi=mA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:ze,typed:te}),Qv=j1({Complex:Jr,config:Ie,divideScalar:dn,typeOf:Hv,typed:te}),a8=tA({DenseMatrix:sr,divideScalar:dn,equalScalar:pr,matrix:ze,multiplyScalar:Dn,subtractScalar:ja,typed:te}),o8=E_({flatten:$f,matrix:ze,size:pi,typed:te}),s8=_m({config:Ie,numeric:Ja,smaller:Ui,typed:te}),XD=om({DenseMatrix:sr,concat:Sr,config:Ie,equalScalar:pr,matrix:ze,round:tc,typed:te,zeros:mi}),qr=j_({addScalar:Wn,dot:Lm,equalScalar:pr,matrix:ze,multiplyScalar:Dn,typed:te}),u8=J1({Complex:Jr,config:Ie,divideScalar:dn,typed:te}),l8=lm({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),Vm=vA({compare:Xu,isNaN:Rf,isNumeric:Ju,typed:te}),c8=aA({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te,zeros:mi}),QD=qS({SparseMatrix:Yn,abs:Vi,add:br,divideScalar:dn,larger:qi,largerEq:Rm,multiply:qr,subtract:Pn,transpose:Vf,typed:te}),Ea=ym({add:br,matrix:ze,typed:te,zeros:mi}),Kv=Em({add:br,config:Ie,numeric:Ja,typed:te}),f8=mS({add:br,matrix:ze,typed:te}),KD=rA({DenseMatrix:sr,divideScalar:dn,equalScalar:pr,matrix:ze,multiplyScalar:Dn,subtractScalar:ja,typed:te}),p8=WE({Complex:Jr,add:br,multiply:qr,number:vs,typed:te}),ey=k_({DenseMatrix:sr,config:Ie,equalScalar:pr,matrix:ze,round:tc,typed:te,zeros:mi}),Jo=sA({compare:Xu,typed:te}),m8=kE({addScalar:Wn,combinations:Bm,isInteger:ia,isNegative:iu,isPositive:ju,larger:qi,typed:te}),d8=m1({matrix:ze,multiply:qr,subtract:Pn,typed:te}),eM=QS({divideScalar:dn,isZero:jo,matrix:ze,multiply:qr,subtractScalar:ja,typed:te,unaryMinus:Zo}),h8=r1({concat:Sr,equalScalar:pr,matrix:ze,multiplyScalar:Dn,typed:te}),tM=wA({larger:qi,smaller:Ui}),rM=V_({Complex:Jr,DenseMatrix:sr,ceil:ey,equalScalar:pr,floor:ZD,matrix:ze,typed:te,zeros:mi}),nM=dS({Index:Ei,typed:te}),g8=lE({abs:Vi,add:br,addScalar:Wn,config:Ie,divideScalar:dn,equalScalar:pr,flatten:$f,isNumeric:Ju,isZero:jo,matrix:ze,multiply:qr,multiplyScalar:Dn,smaller:Ui,subtract:Pn,typed:te}),v8=t1({BigNumber:We,add:br,config:Ie,equal:Xa,isInteger:ia,mod:XD,smaller:Ui,typed:te,xgcd:HD}),y8=H_({concat:Sr,equalScalar:pr,matrix:ze,typed:te}),x8=Z1({Complex:Jr,config:Ie,divideScalar:dn,log:Qv,typed:te}),ty=wm({config:Ie,larger:qi,numeric:Ja,typed:te}),b8=KA({DenseMatrix:sr,Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),w8=tS({DenseMatrix:sr,Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),_8=nS({Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),A8=aS({Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),rc=pA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,matrix:ze,typed:te}),S8=yA({compare:Xu,compareNatural:Jo,matrix:ze,typed:te}),E8=gA({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,config:Ie,equalScalar:pr,matrix:ze,typed:te}),T8=bm({concat:Sr,equalScalar:pr,matrix:ze,not:$m,typed:te,zeros:mi}),nc=gm({bignumber:Za,matrix:ze,add:br,config:Ie,isPositive:ju,larger:qi,largerEq:Rm,smaller:Ui,smallerEq:rc,typed:te}),D8=vm({Index:Ei,matrix:ze,range:nc,typed:te}),iM=eS({DenseMatrix:sr,Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),M8=iS({Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),aM=sS({Index:Ei,concat:Sr,setDifference:iM,size:pi,subset:Ea,typed:te}),oM=_A({FibonacciHeap:tM,addScalar:Wn,equalScalar:pr}),sM=fm({Index:Ei,matrix:ze,range:nc,typed:te}),Qu=KS({abs:Vi,addScalar:Wn,det:eM,divideScalar:dn,identity:au,matrix:ze,multiply:qr,typed:te,unaryMinus:Zo}),uM=LS({DenseMatrix:sr,Spa:oM,SparseMatrix:Yn,abs:Vi,addScalar:Wn,divideScalar:dn,equalScalar:pr,larger:qi,matrix:ze,multiplyScalar:Dn,subtractScalar:ja,typed:te,unaryMinus:Zo}),C8=eE({Complex:Jr,add:br,ctranspose:Wv,deepEqual:Xv,divideScalar:dn,dot:Lm,dotDivide:Uf,equal:Xa,inv:Qu,matrix:ze,multiply:qr,typed:te}),To=W1({Complex:Jr,config:Ie,fraction:Lf,identity:au,inv:Qu,matrix:ze,multiply:qr,number:vs,typed:te}),lM=rS({DenseMatrix:sr,Index:Ei,compareNatural:Jo,size:pi,subset:Ea,typed:te}),N8=uS({Index:Ei,concat:Sr,setIntersect:lM,setSymDifference:aM,size:pi,subset:Ea,typed:te}),F8=nE({abs:Vi,add:br,identity:au,inv:Qu,map:Zu,max:ty,multiply:qr,size:pi,sqrt:Eo,subtract:Pn,typed:te}),qt=SA({BigNumber:We,Complex:Jr,Fraction:Wu,abs:Vi,addScalar:Wn,config:Ie,divideScalar:dn,equal:Xa,fix:rM,format:Of,isNumeric:Ju,multiplyScalar:Dn,number:vs,pow:To,round:tc,subtractScalar:ja}),I8=xT({BigNumber:We,Unit:qt,config:Ie}),P8=eD({BigNumber:We,Unit:qt,config:Ie}),B8=qT({BigNumber:We,Unit:qt,config:Ie}),k8=_T({BigNumber:We,Unit:qt,config:Ie}),$8=HT({BigNumber:We,Unit:qt,config:Ie}),O8=AT({BigNumber:We,Unit:qt,config:Ie}),R8=bT({BigNumber:We,Unit:qt,config:Ie}),L8=kT({BigNumber:We,Unit:qt,config:Ie}),V8=X1({DenseMatrix:sr,SparseMatrix:Yn,concat:Sr,equalScalar:pr,matrix:ze,pow:To,typed:te}),U8=yT({BigNumber:We,Unit:qt,config:Ie}),q8=wT({BigNumber:We,Unit:qt,config:Ie}),z8=rE({abs:Vi,add:br,identity:au,inv:Qu,multiply:qr,typed:te}),H8=GT({BigNumber:We,Unit:qt,config:Ie}),cM=F1({addScalar:Wn,ceil:ey,conj:Yu,divideScalar:dn,dotDivide:Uf,exp:LD,i:BD,log2:VD,matrix:ze,multiplyScalar:Dn,pow:To,tau:$D,typed:te}),ry=gE({BigNumber:We,Complex:Jr,config:Ie,multiplyScalar:Dn,pow:To,typed:te}),G8=dT({BigNumber:We,Unit:qt,config:Ie}),W8=PT({BigNumber:We,Unit:qt,config:Ie}),Y8=I1({conj:Yu,dotDivide:Uf,fft:cM,typed:te}),j8=DT({BigNumber:We,Unit:qt,config:Ie}),Z8=YT({BigNumber:We,Unit:qt,config:Ie}),J8=vT({BigNumber:We,Unit:qt,config:Ie}),X8=tD({BigNumber:We,Unit:qt,config:Ie}),Q8=ZT({BigNumber:We,Unit:qt,config:Ie}),K8=$T({BigNumber:We,Unit:qt,config:Ie}),e6=TT({BigNumber:We,Unit:qt,config:Ie}),t6=sD({BigNumber:We,Unit:qt,config:Ie}),r6=iD({BigNumber:We,Unit:qt,config:Ie}),n6=uD({BigNumber:We,Unit:qt,config:Ie}),i6=BT({BigNumber:We,Unit:qt,config:Ie}),a6=OT({BigNumber:We,Unit:qt,config:Ie}),o6=gT({BigNumber:We,Unit:qt,config:Ie}),s6=RT({BigNumber:We,Unit:qt,config:Ie}),u6=QT({BigNumber:We,Unit:qt,config:Ie}),l6=mT({BigNumber:We,Unit:qt,config:Ie}),c6=KT({BigNumber:We,Unit:qt,config:Ie}),f6=LT({BigNumber:We,Unit:qt,config:Ie}),p6=zT({BigNumber:We,Unit:qt,config:Ie}),m6=MT({BigNumber:We,Unit:qt,config:Ie}),d6=DA({Unit:qt,typed:te}),di=sE({divideScalar:dn,equalScalar:pr,inv:Qu,matrix:ze,multiply:qr,typed:te}),h6=NT({BigNumber:We,Unit:qt,config:Ie}),qf=yE({gamma:ry,typed:te}),g6=WT({BigNumber:We,Unit:qt,config:Ie}),v6=nD({BigNumber:We,Unit:qt,config:Ie}),y6=ST({BigNumber:We,Unit:qt,config:Ie}),fM=HS({DenseMatrix:sr,lsolve:YD,lup:uM,matrix:ze,slu:QD,typed:te,usolve:Jv}),x6=ET({BigNumber:We,Unit:qt,config:Ie}),b6=rD({BigNumber:We,Unit:qt,config:Ie}),w6=bE({add:br,divide:di,factorial:qf,isInteger:ia,isPositive:ju,multiply:qr,typed:te}),_6=wE({factorial:qf,typed:te}),A6=aD({BigNumber:We,Unit:qt,config:Ie}),S6=GS({add:br,cbrt:GD,divide:di,equalScalar:pr,im:qv,isZero:jo,multiply:qr,re:zv,sqrt:Eo,subtract:Pn,typeOf:Hv,typed:te,unaryMinus:Zo}),E6=oS({compareNatural:Jo,typed:te}),T6=P1({abs:Vi,add:br,bignumber:Za,divide:di,isNegative:iu,isPositive:ju,larger:qi,map:Zu,matrix:ze,max:ty,multiply:qr,smaller:Ui,subtract:Pn,typed:te,unaryMinus:Zo}),pM=IE({bignumber:Za,addScalar:Wn,combinations:Bm,divideScalar:dn,factorial:qf,isInteger:ia,isNegative:iu,larger:qi,multiplyScalar:Dn,number:vs,pow:To,subtractScalar:ja,typed:te}),D6=EA({Unit:qt,typed:te}),M6=PE({addScalar:Wn,isInteger:ia,isNegative:iu,stirlingS2:pM,typed:te}),mM=tE({abs:Vi,add:br,addScalar:Wn,atan:RD,bignumber:Za,column:sM,complex:km,config:Ie,cos:Vv,diag:WD,divideScalar:dn,dot:Lm,equal:Xa,flatten:$f,im:qv,inv:Qu,larger:qi,matrix:ze,matrixFromColumns:Yv,multiply:qr,multiplyScalar:Dn,number:vs,qr:jv,re:zv,reshape:zD,sin:Om,size:pi,smaller:Ui,sqrt:Eo,subtract:Pn,typed:te,usolve:Jv,usolveAll:KD}),C6=FT({BigNumber:We,Unit:qt,config:Ie}),N6=jT({BigNumber:We,Unit:qt,config:Ie}),F6=xE({divide:di,dotDivide:Uf,isNumeric:Ju,log:Qv,map:Zu,matrix:ze,multiply:qr,sum:Kv,typed:te}),dM=Dm({add:br,divide:di,typed:te}),I6=JT({BigNumber:We,Unit:qt,config:Ie}),P6=hT({BigNumber:We,Unit:qt,config:Ie}),B6=Cm({bignumber:Za,add:br,compare:Xu,divide:di,isInteger:ia,larger:qi,multiply:qr,partitionSelect:Vm,smaller:Ui,smallerEq:rc,subtract:Pn,typed:te}),ny=Mm({add:br,apply:Gv,divide:di,isNaN:Rf,multiply:qr,subtract:Pn,typed:te}),k6=CT({BigNumber:We,Unit:qt,config:Ie}),hM=cE({add:br,compare:Xu,divide:di,partitionSelect:Vm,typed:te}),$6=mE({add:br,divide:di,matrix:ze,mean:dM,multiply:qr,pow:To,sqrt:Eo,subtract:Pn,sum:Kv,typed:te}),O6=YE({Complex:Jr,add:br,divide:di,matrix:ze,multiply:qr,typed:te}),R6=fE({abs:Vi,map:Zu,median:hM,subtract:Pn,typed:te}),L6=Nm({map:Zu,sqrt:Eo,typed:te,variance:ny}),V6=k1({BigNumber:We,Complex:Jr,add:br,config:Ie,divide:di,equal:Xa,factorial:qf,gamma:ry,isNegative:iu,multiply:qr,pi:Lv,pow:To,sin:Om,smallerEq:rc,subtract:Pn,typed:te}),iy=fS({abs:Vi,add:br,conj:Yu,ctranspose:Wv,eigs:mM,equalScalar:pr,larger:qi,matrix:ze,multiply:qr,pow:To,smaller:Ui,sqrt:Eo,typed:te}),gM=E1({BigNumber:We,DenseMatrix:sr,SparseMatrix:Yn,addScalar:Wn,config:Ie,cos:Vv,matrix:ze,multiplyScalar:Dn,norm:iy,sin:Om,typed:te,unaryMinus:Zo}),U6=oD({BigNumber:We,Unit:qt,config:Ie}),vM=aE({identity:au,matrix:ze,multiply:qr,norm:iy,qr:jv,subtract:Pn,typed:te}),q6=S1({multiply:qr,rotationMatrix:gM,typed:te}),yM=iE({abs:Vi,add:br,concat:Sr,identity:au,index:nM,lusolve:fM,matrix:ze,matrixFromColumns:Yv,multiply:qr,range:nc,schur:vM,subset:Ea,subtract:Pn,transpose:Vf,typed:te}),z6=oE({matrix:ze,multiply:qr,sylvester:yM,transpose:Vf,typed:te});var zf={},Um={},H6={},zi=hS({mathWithTransform:Um}),Hf=DS({Node:zi}),ou=MS({Node:zi}),ic=CS({Node:zi}),G6=FS({Node:zi}),Gf=vS({Node:zi}),W6=xS({Node:zi,ResultSet:kD}),Y6=bS({Node:zi}),Ku=SS({Node:zi}),j6=NS({Node:zi}),Jie=jE({classes:H6}),xM=YS({math:zf,typed:te}),Z6=ES({Node:zi,typed:te}),Xie=XS({Chain:xM,typed:te}),Wf=TS({Node:zi,size:pi}),Yf=gS({Node:zi,subset:Ea}),J6=yS({matrix:ze,Node:zi,subset:Ea}),el=IS({Unit:qt,Node:zi,math:zf}),tl=PS({Node:zi,SymbolNode:el,math:zf}),Xo=BS({AccessorNode:Yf,ArrayNode:Gf,AssignmentNode:J6,BlockNode:W6,ConditionalNode:Y6,ConstantNode:Ku,FunctionAssignmentNode:Z6,FunctionNode:tl,IndexNode:Wf,ObjectNode:Hf,OperatorNode:ou,ParenthesisNode:ic,RangeNode:j6,RelationalNode:G6,SymbolNode:el,config:Ie,numeric:Ja,typed:te}),X6=qE({ConstantNode:Ku,FunctionNode:tl,OperatorNode:ou,ParenthesisNode:ic,parse:Xo,typed:te}),bM=VE({bignumber:Za,fraction:Lf,AccessorNode:Yf,ArrayNode:Gf,ConstantNode:Ku,FunctionNode:tl,IndexNode:Wf,ObjectNode:Hf,OperatorNode:ou,SymbolNode:el,config:Ie,mathWithTransform:Um,matrix:ze,typed:te}),wM=kS({parse:Xo,typed:te}),_M=UE({AccessorNode:Yf,ArrayNode:Gf,ConstantNode:Ku,FunctionNode:tl,IndexNode:Wf,ObjectNode:Hf,OperatorNode:ou,ParenthesisNode:ic,SymbolNode:el,add:br,divide:di,equal:Xa,isZero:jo,multiply:qr,parse:Xo,pow:To,subtract:Pn,typed:te}),AM=$S({parse:Xo,typed:te}),Q6=WS({evaluate:AM}),K6=OS({evaluate:AM,parse:Xo}),ay=LE({AccessorNode:Yf,ArrayNode:Gf,ConstantNode:Ku,FunctionNode:tl,IndexNode:Wf,ObjectNode:Hf,OperatorNode:ou,ParenthesisNode:ic,SymbolNode:el,equal:Xa,parse:Xo,replacer:OD,resolve:X6,simplifyConstant:bM,simplifyCore:_M,typed:te}),Qie=zE({OperatorNode:ou,parse:Xo,simplify:ay,typed:te}),Kie=$E({parse:Xo,typed:te}),eae=RS({Parser:K6,typed:te}),tae=GE({bignumber:Za,fraction:Lf,AccessorNode:Yf,ArrayNode:Gf,ConstantNode:Ku,FunctionNode:tl,IndexNode:Wf,ObjectNode:Hf,OperatorNode:ou,ParenthesisNode:ic,SymbolNode:el,add:br,config:Ie,divide:di,equal:Xa,isZero:jo,mathWithTransform:Um,matrix:ze,multiply:qr,parse:Xo,pow:To,simplify:ay,simplifyConstant:bM,simplifyCore:_M,subtract:Pn,typed:te}),rae=HE({ConstantNode:Ku,FunctionNode:tl,OperatorNode:ou,ParenthesisNode:ic,SymbolNode:el,config:Ie,equal:Xa,isZero:jo,numeric:Ja,parse:Xo,simplify:ay,typed:te}),nae=JS({Help:Q6,mathWithTransform:Um,typed:te});sn(zf,{e:PD,false:EU,fineStructure:TU,i:BD,Infinity:DU,LN10:MU,LOG10E:CU,NaN:NU,null:FU,phi:IU,SQRT1_2:BU,sackurTetrode:kU,tau:$D,true:$U,E:PD,version:OU,efimovFactor:RU,LN2:LU,pi:Lv,replacer:OD,reviver:Jie,SQRT2:VU,typed:te,PI:Lv,weakMixingAngle:UU,abs:Vi,acos:qU,acot:zU,acsc:HU,addScalar:Wn,arg:GU,asech:WU,asinh:YU,atan:RD,atanh:jU,bigint:ZU,bitNot:JU,boolean:XU,clone:QU,combinations:Bm,complex:km,conj:Yu,cos:Vv,cot:KU,csc:e5,cube:t5,equalScalar:pr,erf:r5,exp:LD,expm1:n5,filter:i5,flatten:$f,forEach:a5,format:Of,getMatrixDataType:Uv,hex:o5,im:qv,isInteger:ia,isNegative:iu,isPositive:ju,isZero:jo,LOG2E:s5,lgamma:u5,log10:l5,log2:VD,map:Zu,multiplyScalar:Dn,not:$m,number:vs,oct:c5,pickRandom:f5,print:p5,random:m5,re:zv,sec:d5,sign:UD,sin:Om,splitUnit:h5,square:g5,string:v5,subtractScalar:ja,tan:y5,typeOf:Hv,acosh:x5,acsch:b5,apply:Gv,asec:w5,bignumber:Za,chain:Xie,combinationsWithRep:_5,cosh:A5,csch:S5,isNaN:Rf,isPrime:E5,randomInt:T5,sech:D5,sinh:M5,sparse:C5,sqrt:Eo,squeeze:N5,tanh:F5,unaryMinus:Zo,acoth:I5,bin:P5,coth:B5,fraction:Lf,isNumeric:Ju,matrix:ze,matrixFromFunction:k5,mode:$5,numeric:Ja,prod:qD,reshape:zD,size:pi,transpose:Vf,xgcd:HD,zeros:mi,asin:O5,cbrt:GD,concat:Sr,count:R5,ctranspose:Wv,diag:WD,divideScalar:dn,dotDivide:Uf,equal:Xa,hasNumericValue:L5,identity:au,kron:V5,largerEq:Rm,leftShift:U5,lsolve:YD,matrixFromColumns:Yv,nthRoot:q5,ones:z5,qr:jv,resize:H5,rightArithShift:G5,round:tc,smaller:Ui,subtract:Pn,to:W5,unaryPlus:Zv,usolve:Jv,xor:Y5,add:br,atan2:j5,bitAnd:Z5,bitOr:J5,bitXor:X5,catalan:Q5,compare:Xu,compareText:jD,cumsum:K5,deepEqual:Xv,diff:e8,distance:t8,dot:Lm,equalText:r8,floor:ZD,gcd:n8,hypot:i8,larger:qi,log:Qv,lsolveAll:a8,matrixFromRows:o8,min:s8,mod:XD,multiply:qr,nthRoots:u8,or:l8,partitionSelect:Vm,rightLogShift:c8,slu:QD,subset:Ea,sum:Kv,trace:f8,usolveAll:KD,zpk2tf:p8,ceil:ey,compareNatural:Jo,composition:m8,cross:d8,det:eM,dotMultiply:h8,fix:rM,index:nM,intersect:g8,invmod:v8,lcm:y8,log1p:x8,max:ty,setCartesian:b8,setDistinct:w8,setIsSubset:_8,setPowerset:A8,smallerEq:rc,sort:S8,unequal:E8,and:T8,range:nc,row:D8,setDifference:iM,setMultiplicity:M8,setSymDifference:aM,column:sM,inv:Qu,lup:uM,pinv:C8,pow:To,setIntersect:lM,setUnion:N8,sqrtm:F8,vacuumImpedance:I8,wienDisplacement:P8,atomicMass:B8,bohrMagneton:k8,boltzmann:$8,conductanceQuantum:O8,coulomb:R8,deuteronMass:L8,dotPow:V8,electricConstant:U8,elementaryCharge:q8,expm:z8,faraday:H8,fft:cM,gamma:ry,gravitationConstant:G8,hartreeEnergy:W8,ifft:Y8,klitzing:j8,loschmidt:Z8,magneticConstant:J8,molarMass:X8,molarPlanckConstant:Q8,neutronMass:K8,nuclearMagneton:e6,planckCharge:t6,planckLength:r6,planckTemperature:n6,protonMass:i6,quantumOfCirculation:a6,reducedPlanckConstant:o6,rydberg:s6,secondRadiation:u6,speedOfLight:l6,stefanBoltzmann:c6,thomsonCrossSection:f6,avogadro:p6,bohrRadius:m6,createUnit:d6,divide:di,electronMass:h6,factorial:qf,firstRadiation:g6,gravity:v6,inverseConductanceQuantum:y6,lusolve:fM,magneticFluxQuantum:x6,molarMassC12:b6,multinomial:w6,parse:Xo,permutations:_6,planckMass:A6,polynomialRoot:S6,resolve:X6,setSize:E6,simplifyConstant:bM,solveODE:T6,stirlingS2:pM,unit:D6,bellNumbers:M6,compile:wM,eigs:mM,fermiCoupling:C6,gasConstant:N6,kldivergence:F6,mean:dM,molarVolume:I6,planckConstant:P6,quantileSeq:B6,simplifyCore:_M,variance:ny,classicalElectronRadius:k6,evaluate:AM,median:hM,simplify:ay,symbolicEqual:Qie,corr:$6,freqz:O6,leafCount:Kie,mad:R6,parser:eae,rationalize:tae,std:L6,zeta:V6,derivative:rae,norm:iy,rotationMatrix:gM,help:nae,planckTime:U6,schur:vM,rotate:q6,sylvester:yM,lyap:z6,config:Ie});sn(Um,zf,{filter:fD({typed:te}),forEach:pD({typed:te}),map:dD({typed:te}),apply:lD({isInteger:ia,typed:te}),or:ND({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),and:CD({add:br,concat:Sr,equalScalar:pr,matrix:ze,not:$m,typed:te,zeros:mi}),concat:wD({isInteger:ia,matrix:ze,typed:te}),max:hD({config:Ie,larger:qi,numeric:Ja,typed:te}),print:MD({add:br,matrix:ze,typed:te,zeros:mi}),bitAnd:FD({add:br,concat:Sr,equalScalar:pr,matrix:ze,not:$m,typed:te,zeros:mi}),diff:_D({bignumber:Za,matrix:ze,number:vs,subtract:Pn,typed:te}),min:vD({config:Ie,numeric:Ja,smaller:Ui,typed:te}),subset:bD({add:br,matrix:ze,typed:te,zeros:mi}),bitOr:ID({DenseMatrix:sr,concat:Sr,equalScalar:pr,matrix:ze,typed:te}),cumsum:TD({add:br,typed:te,unaryPlus:Zv}),index:mD({Index:Ei,getMatrixDataType:Uv}),sum:SD({add:br,config:Ie,numeric:Ja,typed:te}),range:yD({bignumber:Za,matrix:ze,add:br,config:Ie,isPositive:ju,larger:qi,largerEq:Rm,smaller:Ui,smallerEq:rc,typed:te}),row:xD({Index:Ei,matrix:ze,range:nc,typed:te}),column:cD({Index:Ei,matrix:ze,range:nc,typed:te}),mean:gD({add:br,divide:di,typed:te}),quantileSeq:ED({add:br,bignumber:Za,compare:Xu,divide:di,isInteger:ia,larger:qi,multiply:qr,partitionSelect:Vm,smaller:Ui,smallerEq:rc,subtract:Pn,typed:te}),variance:DD({add:br,apply:Gv,divide:di,isNaN:Rf,multiply:qr,subtract:Pn,typed:te}),std:AD({map:Zu,sqrt:Eo,typed:te,variance:ny})});sn(H6,{BigNumber:We,Complex:Jr,Fraction:Wu,Matrix:Pm,Node:zi,ObjectNode:Hf,OperatorNode:ou,ParenthesisNode:ic,Range:PU,RelationalNode:G6,ResultSet:kD,ArrayNode:Gf,BlockNode:W6,ConditionalNode:Y6,ConstantNode:Ku,DenseMatrix:sr,RangeNode:j6,Chain:xM,FunctionAssignmentNode:Z6,SparseMatrix:Yn,IndexNode:Wf,ImmutableDenseMatrix:JD,Index:Ei,AccessorNode:Yf,AssignmentNode:J6,FibonacciHeap:tM,Spa:oM,Unit:qt,SymbolNode:el,FunctionNode:tl,Help:Q6,Parser:K6});xM.createProxy(zf);var oy=class extends fs{constructor(e){super(e),this.hidden=!1}buildVariables(){let e=0;this.expressionStr="",this.variables=[];for(let r of this.mountable.getDeclaration().templateDeclaration??[])if(typeof r!="string"){let n={bindTargetDeclaration:r,metadataSignal:new yn(void 0),uuid:Fr(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.expressionStr+=n.contextName,e+=1}else this.expressionStr+=r;this.expression=wM(this.expressionStr)}buildMathJSContext(){let e={};for(let r of this.variables??[])!r.contextName||!r.metadataSignal||(e[r.contextName]=r.metadataSignal.get()??"");return e}computeValue(){if(!this.expression)return this.handleComputeError(new ul({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{let r=`${this.expression.evaluate(e)}`;return{value:Oa(r),error:!1}}catch(r){return r instanceof Error?this.handleComputeError(new ul({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:r,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of unexpected thrown value"))}}mapValue(e){return e.value}onInitialRender(e){}onRerender(e,r){let n=Il(r?.value,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";r?.error?mt.addClass(e,"mb-error"):mt.removeClass(e,"mb-error"),e.innerText=n}handleComputeError(e){return console.warn(e),{error:!0,value:e.message}}};var sy=class extends fs{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let r of this.mountable.getDeclaration().templateDeclaration??[])if(typeof r!="string"){let n={bindTargetDeclaration:r,metadataSignal:new yn(void 0),uuid:Fr(),contextName:`MB_VAR_${e}`};this.variables.push(n),this.textParts.push(n),e+=1}else this.textParts.push(r)}computeValue(){if(!this.textParts)throw new ul({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="string"?e:Il(e.metadataSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)).join("")}mapValue(e){return e}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&mt.addClass(e,"mb-view-markdown")}async onRerender(e,r){let n=Il(r,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";this.renderMarkdown?(this.markdownUnloadCallback?.(),this.markdownUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(n,e,this.mountable.getFilePath())):e.innerText=n}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};var uy=class{constructor(e){this.plugin=e}createViewField(e){let r=e.declaration.viewFieldType;if(r==="math")return new oy(e);if(r==="text")return new sy(e);if(r==="link")return new Sg(e);if(r==="image")return new Ag(e);}};var ly=class extends qn{constructor(e,r,n,i,a){super(e,r,n),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Qt(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 Gt({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 Gt({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(super.onMount(e),mt.empty(e),mt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let r=document.createElement("div");mt.addClass(r,"mb-view-wrapper");try{this.viewField?.mount(r)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(r);let n=this.getArguments("class");for(let i of n)mt.addClasses(r,i.value);mt.addClass(r,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-view-block"):mt.addClass(e,"mb-view-inline")}onUnmount(e){super.onUnmount(e),this.viewField?.unmount(),Di(e,"view field")}};var cy=class{constructor(e){this.plugin=e}fromString(e){return Xn(rs,e)}fromStringAndValidate(e,r,n){return this.validate(e,this.fromString(e),r,n)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:Ia(e.storageType),storagePath:Ia(e.storagePath),storageProp:e.storageProp.path.map(r=>({type:r.type,prop:Ia(r.prop)})),listenToChildren:e.listenToChildren}}validate(e,r,n,i){let a={};a.listenToChildren=r.listenToChildren,a.storageProp=new xu(r.storageProp.map(u=>new ml(u.type,u.prop.value))),r.storageType===void 0?a.storageType=this.plugin.metadataManager.defaultSource:a.storageType=this.validateStorageType(r.storageType,e);let o=r.storagePath!==void 0,s=r.storagePath??{value:n},l=this.plugin.metadataManager.getSource(a.storageType);if(l===void 0)throw new Gt({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=l.validateStoragePath(s,o,e,this),l.id==="scope"?this.resolveScope(a,i):a}resolveScope(e,r){if(r===void 0)throw new Vn("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return e.storageType=r.scope.storageType,e.storagePath=r.scope.storagePath,e.storageProp=r.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,r){for(let n of this.plugin.metadataManager.iterateSources())if(n===e.value)return n;throw new Vn("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,r,e?.position)}validateStoragePathAsFilePath(e,r){let n=e?.value;if(n===void 0)throw new Vn("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",r,e?.position);let i=this.plugin.internal.file.getPathByName(n);if(i===void 0)throw new Vn("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${n}' not found.`,r,e?.position);return i}};var n9=zr(Ma()),qm=zr(ca());function EM(t){return t instanceof Error&&t.name==="ZodError"&&"issues"in t&&Array.isArray(t.issues)}var SM=class extends Error{name;details;constructor(t,e){super(t,e),this.name="ZodValidationError",this.details=aae(e)}toString(){return this.message}};function aae(t){if(t){let e=t.cause;if(EM(e))return e.issues}return[]}function e9(t){return t.length!==0}var oae=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function sae(t){return t.length===1?t[0].toString():t.reduce((e,r)=>{if(typeof r=="number")return e+"["+r.toString()+"]";if(r.includes('"'))return e+'["'+uae(r)+'"]';if(!oae.test(r))return e+'["'+r+'"]';let n=e.length===0?"":".";return e+n+r},"")}function uae(t){return t.replace(/"/g,'\\"')}var lae="; ",cae=99,t9="Validation error",fae=": ",pae=", or ";function mae(t={}){let{issueSeparator:e=lae,unionSeparator:r=pae,prefixSeparator:n=fae,prefix:i=t9,includePath:a=!0,maxIssuesInMessage:o=cae}=t;return s=>{let l=s.slice(0,o).map(u=>fy({issue:u,issueSeparator:e,unionSeparator:r,includePath:a})).join(e);return dae(l,i,n)}}function fy(t){let{issue:e,issueSeparator:r,unionSeparator:n,includePath:i}=t;if(e.code===Ue.invalid_union)return e.unionErrors.reduce((a,o)=>{let s=o.issues.map(l=>fy({issue:l,issueSeparator:r,unionSeparator:n,includePath:i})).join(r);return a.includes(s)||a.push(s),a},[]).join(n);if(e.code===Ue.invalid_arguments)return[e.message,...e.argumentsError.issues.map(a=>fy({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(e.code===Ue.invalid_return_type)return[e.message,...e.returnTypeError.issues.map(a=>fy({issue:a,issueSeparator:r,unionSeparator:n,includePath:i}))].join(r);if(i&&e9(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 "${sae(e.path)}"`}return e.message}function dae(t,e,r){return e!==null?t.length>0?[e,t].join(r):e:t.length>0?t:t9}function py(t,e={}){if(!EM(t))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${vae.name}" method instead?`);return r9(t,e)}function r9(t,e={}){let r=t.errors,n;return e9(r)?n=hae(e)(r):n=t.message,new SM(n,{cause:t})}function hae(t){return"messageBuilder"in t?t.messageBuilder:mae(t)}var gae=(t={})=>e=>EM(e)?r9(e,t):e instanceof Error?new SM(e.message,{cause:e}):new SM("Unknown error");function vae(t,e={}){return gae(e)(t)}var yae=qm.P.sequenceMap((t,e)=>e,qm.P.string("BUTTON"),qm.P.manyNotOf("[],^").separateBy(qm.P.string(",").trim(n9.P_UTILS.optionalWhitespace())).wrapString("[","]")),my=class{constructor(e){this.plugin=e}fromGroupString(e){let r=new Qt("ButtonGroup"),n=[];try{n=Xn(yae,e)}catch(i){r.add(i)}return{declarationString:e,referencedButtonIds:n,errorCollection:r}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Qt("ButtonGroup")}}fromString(e){let r=new Qt("Button"),n;try{let i=this.plugin.internal.parseYaml(e);n=this.validateConfig(i)}catch(i){r.add(i)}return{declarationString:e,config:n,errorCollection:r}}validateConfig(e){let r=WF(Lc,e);if(!r.success){let n=py(r.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new Cs({errorLevel:"ERROR",effect:"The validation for the button config failed.",cause:"Your button syntax seems to be invalid. Check that your button config follows what is described in the docs.",positionContext:n.message,docs:[jt.linkToButtonConfig()]})}return r.data}validate(e){let r=new Qt("Button"),n;try{n=this.validateConfig(e)}catch(i){r.add(i)}return{declarationString:void 0,config:n,errorCollection:r}}};var jf=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let r of Object.values(fn))e[r]=0;for(let r of this.arguments){let n=r.getConfig();if(e[n.type]+=1,e[n.type]>1&&!n.allowMultiple)throw new Hr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${n.type}' does not allow duplicates`,docs:[jt.linkToSearch(n.type)]})}}mergeByOverride(e){for(let r of e.arguments){let n=r.getConfig();n.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==n.type)),this.arguments.push(r)}return this.validate(),this}mergeByThrow(e){for(let r of e.arguments){let n=r.getConfig();if(!n.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===n.type).length>0)throw new Hr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(r)}return this.validate(),this}getAll(e){return this.arguments.filter(r=>r.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var dy=class extends jf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Zf=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,r){if(r.find(n=>n.length===e.length)===void 0)throw new Hr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${r.map(n=>n.length===0?"none":n.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[jt.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 Tr=class extends Zf{};var hy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.addLabels}};var gy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.allowOther}};var vy=class extends Tr{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return Nr.class}};var yy=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.defaultValue}};var xy=class extends Tr{constructor(){super(...arguments);this.value=void 0}_parseValue(r){if(this.value=Number.parseInt(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.limit}};var by=class extends Tr{constructor(){super(...arguments);this.value=100}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.maxValue}};var wy=class extends Tr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.minValue}};var _y=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.multiLine}};var Ay=class extends Tr{constructor(){super(...arguments);this.value=!1}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.offValue}};var Sy=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=Oa(r[0].value)}getConfig(){return Nr.onValue}};var Ey=class extends Tr{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(r){r.length===1?(this.value=Oa(r[0].value),this.name=r[0].value):r.length===2&&(this.value=Oa(r[0].value),this.name=r[1].value)}getConfig(){return Nr.option}};var Ty=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.optionQuery}};var Dy=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.placeholder}};var My=class extends Tr{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return Nr.showcase}};var Cy=class extends Tr{constructor(){super(...arguments);this.value=0}_parseValue(r){if(this.value=Number.parseFloat(r[0].value),Number.isNaN(this.value))throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.stepSize}};var Ny=class extends Tr{constructor(){super(...arguments);this.value=""}_parseValue(r){this.value=r[0].value}getConfig(){return Nr.title}};function i9(t,e,r){return r==="true"?`[[${t}|${e}]]`:r==="partial"?`[[${e}]]`:`${e}`}var Fy=class extends Tr{constructor(){super(...arguments);this.value="true"}_parseValue(r){let n=r[0]?.value.toLowerCase();if(n===void 0){this.value="true";return}if(n==="true"||n==="partial"||n==="false"){this.value=n;return}throw new Hr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${XN(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[jt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return Nr.useLinks}};var a9={class:vy,addLabels:hy,minValue:wy,maxValue:by,stepSize:Cy,option:Ey,title:Ny,optionQuery:Ty,showcase:My,offValue:Ay,onValue:Sy,defaultValue:yy,placeholder:Dy,useLinks:Fy,limit:xy,allowOther:gy,multiLine:_y},Iy=class{static createInputFieldArgument(e){if(e in a9){let r=a9[e];if(r)return new r}throw new Co({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var Py=class{constructor(e,r,n){this.plugin=e,this.unvalidatedDeclaration=r,this.filePath=n,this.errorCollection=new Qt("input field declaration")}validate(e){let r=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(r),a={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:r,bindTarget:n,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let r of Object.entries(du))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Vn("ERROR","Declaration Validator",`Encountered invalid identifier. Expected 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(r){this.errorCollection.add(r)}}validateArguments(e){let r=new dy;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Iy.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Vn("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}r.add(a)}try{r.validate()}catch(n){this.errorCollection.add(n)}return r}validateArgumentType(e){for(let r of Object.entries(fn))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Vn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var Hi=zr(Ma()),an=zr(ca());var bae=an.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Mi.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).describe("input field type"),xp.trim(Hi.P_UTILS.optionalWhitespace()).wrap(an.P.string("(").describe('arguments paren "("'),an.P.string(")").describe('arguments paren ")"')).trim(Hi.P_UTILS.optionalWhitespace()).optional([]),an.P.sequence(an.P.string(":").trim(Hi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),rs).trim(Hi.P_UTILS.optionalWhitespace()).optional()),o9=an.P.sequenceMap((t,e,r)=>{let n=r===void 0?void 0:r[1];return{inputFieldType:t,arguments:e,bindTarget:n}},Mi.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),xp.trim(Hi.P_UTILS.optionalWhitespace()).wrap(an.P.string("(").describe('arguments paren "("'),an.P.string(")").describe('arguments paren ")"')).trim(Hi.P_UTILS.optionalWhitespace()).optional([]),an.P.sequence(an.P.string(":").trim(Hi.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),rs).trim(Hi.P_UTILS.optionalWhitespace()).optional()),s9=an.P.or(an.P.sequenceMap((t,e,r)=>(r.templateName=e,r),an.P.string("INPUT"),an.P.sequenceMap((t,e,r)=>e,an.P.string("["),yF.node(ji).trim(Hi.P_UTILS.optionalWhitespace()).describe("template name"),an.P.string("]").skip(Hi.P_UTILS.optionalWhitespace())),o9.wrap(an.P.string("["),an.P.string("]")),Hi.P_UTILS.eof()),an.P.sequenceMap((t,e)=>e,an.P.string("INPUT"),bae.wrap(an.P.string("["),an.P.string("]")),Hi.P_UTILS.eof())),u9=an.P.sequenceMap((t,e)=>e,an.P.string("INPUT"),o9.wrap(an.P.string("["),an.P.string("]")),Hi.P_UTILS.eof());var By=class{constructor(e){this.plugin=e,this.templates=[]}fromString(e){let r=new Qt("InputField");try{let n=Xn(s9,e),i=this.partialToFullDeclaration(n,e,r);return i=this.applyTemplate(i),i}catch(n){r.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:r}}fromStringAndValidate(e,r,n){return this.validate(this.fromString(e),r,n)}fromSimpleDeclaration(e){let r=new Qt("InputField");return{declarationString:void 0,inputFieldType:Ia(e.inputFieldType),bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(n=>({name:Ia(n.name),value:n.value.map(i=>Ia(i))})),errorCollection:r}}fromSimpleDeclarationAndValidate(e,r,n){return this.validate(this.fromSimpleDeclaration(e),r,n)}partialToFullDeclaration(e,r,n){return{...structuredClone(e),declarationString:r,errorCollection:n}}validate(e,r,n){return new Py(this.plugin,e,r).validate(n)}merge(e,r){let n;return e.bindTarget===void 0?n=r.bindTarget:(n=e.bindTarget,r.bindTarget?.storagePath!==void 0&&(n.storagePath=r.bindTarget.storagePath),r.bindTarget?.storageProp!==void 0&&(n.storageProp=r.bindTarget.storageProp)),{declarationString:r.declarationString,inputFieldType:r.inputFieldType??e.inputFieldType,bindTarget:n,arguments:r.arguments.concat(e.arguments).reduce((i,a)=>(i.find(o=>o.name===a.name)===void 0&&i.push(a),i),[]),errorCollection:new Qt("input field declaration").merge(e.errorCollection).merge(r.errorCollection)}}parseTemplateString(e){let r=new Qt("InputFieldParser");try{let n=Xn(u9,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:r}}parseTemplates(e){this.templates=[];let r=new Qt("input field template parser");for(let n of e){let i=this.parseTemplateString(n.declaration);r.merge(i.errorCollection);let a={name:n.name,template:i};this.templates.push(Hx(a))}return r}getTemplate(e){return this.templates.find(r=>r.name===e)?.template}applyTemplate(e){if(e.templateName===void 0)return e;let r=this.getTemplate(e.templateName.value);return r===void 0?(e.errorCollection.add(new Vn("WARNING","Input Field Parser",`Invalid template name. Could not find a template with the name '${e.templateName.value}'.`,e.declarationString,e.templateName.position,["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/templates/"])),e):this.merge(r,e)}};var ky=class{constructor(e){this.plugin=e}fromString(e){let r=new Qt("JsViewFieldDeclaration");try{let n=Xn(EF,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,errorCollection:r,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}fromStringAndValidate(e,r){return this.validate(this.fromString(e),r)}fromSimpleDeclaration(e){let r=new Qt("JsViewFieldDeclaration");return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(n=>({bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(n.bindTarget),name:n.name})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),hidden:e.hidden??!1,errorCollection:r}}fromSimpleDeclarationAndValidate(e,r){return this.validate(this.fromSimpleDeclaration(e),r)}partialToFullDeclaration(e,r,n){let i=e;return i.declarationString=r,i.errorCollection=n,i.bindTargetMappings=[...i.bindTargetMappings],i}validate(e,r){let n={};n.declarationString=e.declarationString,n.errorCollection=e.errorCollection;try{return n.bindTargetMappings=e.bindTargetMappings.map(i=>({bindTarget:this.plugin.api.bindTargetParser.validate(e.declarationString,i.bindTarget,r),name:i.name})),e.writeToBindTarget!==void 0&&(n.writeToBindTarget=this.plugin.api.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,r)),n.code=e.code,n.hidden=e.hidden,n}catch(i){n.errorCollection.add(i)}return{declarationString:e.declarationString,errorCollection:n.errorCollection,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}};var $y=class extends jf{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var rl=class extends Zf{};var Oy=class extends rl{constructor(){super(...arguments);this.value=[]}_parseValue(r){this.value=r[0].value.split(" ")}getConfig(){return yc.class}};var Ry=class extends rl{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return yc.hidden}};var Ly=class extends rl{constructor(){super(...arguments);this.value=!0}_parseValue(r){this.value=r[0]===void 0||r[0]?.value.toLowerCase()==="true"}getConfig(){return yc.renderMarkdown}};var l9={renderMarkdown:Ly,hidden:Ry,class:Oy},Vy=class{static createViewFieldArgument(e){if(e in l9){let r=l9[e];if(r)return new r}throw new Co({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var Uy=class{constructor(e,r,n){this.unvalidatedDeclaration=e,this.plugin=n,this.filePath=r,this.errorCollection=new Qt("view field declaration")}validate(e){let r=this.validateInputFieldType(),n=this.validateBindTarget(e),i=this.validateArguments(r),a=this.validateTemplateDeclaration(e),o={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:r,writeToBindTarget:n,argumentContainer:i,templateDeclaration:a,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(o),o}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return"math";for(let r of Object.entries(op))if(r[1]===e?.value)return r[1];return this.errorCollection.add(new Vn("ERROR","Declaration Validator",`Encountered invalid identifier. Expected 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 r=new $y;for(let n of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(n.name);if(i==="invalid")continue;let a=Vy.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new Vn("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${n.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.declarationString,n.name.position));continue}try{a.parseValue(n.value)}catch(o){this.errorCollection.add(o);continue}r.add(a)}try{r.validate()}catch(n){this.errorCollection.add(n)}return r}validateArgumentType(e){for(let r of Object.entries(sl))if(r[1]===e.value)return r[1];return this.errorCollection.add(new Vn("WARNING","Declaration Validator",`Encountered invalid identifier. Expected a view field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}validateTemplateDeclaration(e){try{return this.unvalidatedDeclaration.templateDeclaration?.map(r=>typeof r=="string"?r:this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,r,this.filePath,e))??[]}catch(r){return this.errorCollection.add(r),[]}}};var qy=class{constructor(e){this.plugin=e}fromString(e){let r=new Qt("ViewFieldDeclaration");try{let n=Xn(SF,e);return this.partialToFullDeclaration(n,e,r)}catch(n){r.add(n)}return{declarationString:e,errorCollection:r,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,r,n){return this.validate(this.fromString(e),r,n)}fromSimpleDeclaration(e){let r=new Qt("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(n=>typeof n=="string"?n:this.plugin.api.bindTargetParser.fromExistingDeclaration(n)),viewFieldType:Ia(e.viewFieldType),arguments:(e.arguments??[]).map(n=>({name:Ia(n.name),value:n.value.map(i=>Ia(i))})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:r}}fromSimpleDeclarationAndValidate(e,r,n){return this.validate(this.fromSimpleDeclaration(e),r,n)}partialToFullDeclaration(e,r,n){return{...structuredClone(e),declarationString:r,errorCollection:n}}validate(e,r,n){return new Uy(e,r,this.plugin).validate(n)}};var zy=class{constructor(e,r){this.plugin=e,this.inputFieldParser=r?.inputFieldParser??new By(e),this.viewFieldParser=r?.viewFieldParser??new qy(e),this.jsViewFieldParser=r?.jsViewFieldParser??new ky(e),this.buttonParser=r?.buttonParser??new my(e),this.bindTargetParser=r?.bindTargetParser??new cy(e),this.inputFieldFactory=r?.inputFieldFactory??new xg(e),this.viewFieldFactory=r?.viewFieldFactory??new uy(e),this.buttonActionRunner=r?.buttonActionRunner??new xh(e),this.buttonManager=r?.buttonManager??new Yh(e),this.syntaxHighlighting=r?.syntaxHighlighting??new jd(e)}createField(e,r,n,i=!0){if(pn(ve.object({type:Ep,filePath:$a,options:ve.any(),honorExcludedSetting:ve.boolean()}),{type:e,filePath:r,options:n,honorExcludedSetting:i}),this.plugin.internal.file.isExcludedFromRendering(r)&&i)return this.createExcludedMountable(r);if(e==="INPUT")return this.createInputFieldMountable(r,n);if(e==="VIEW")return this.createViewFieldMountable(r,n);if(e==="JS_VIEW")return this.createJsViewFieldMountable(r,n);if(e==="TABLE")return this.createTableMountable(r,n);if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(r,n);if(e==="BUTTON")return this.createButtonMountable(r,n);if(e==="EMBED")return this.createEmbedMountable(r,n);if(e==="EXCLUDED")return this.createExcludedMountable(r);throw new Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,r,n,i="inline",a,o=!0){pn(ve.object({fieldString:ve.string(),filePath:$a,scope:qc.optional(),renderChildType:Uc,honorExcludedSetting:ve.boolean()}),{fieldString:e,filePath:r,scope:n,renderChildType:i,honorExcludedSetting:o});let s=this.isInlineFieldDeclarationAndGetType(e);if(s===void 0)throw new Gt({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${s}"`});return this.createInlineFieldOfTypeFromString(s,e,r,n,i,a,o)}createInlineFieldOfTypeFromString(e,r,n,i,a="inline",o,s=!0){if(pn(ve.object({type:Ep,declaration:ve.string(),filePath:$a,scope:qc.optional(),renderChildType:Uc,honorExcludedSetting:ve.boolean()}),{type:e,declaration:r,filePath:n,scope:i,renderChildType:a,honorExcludedSetting:s}),this.plugin.internal.file.isExcludedFromRendering(n)&&s)return this.createExcludedMountable(n);if(e==="INPUT")return this.createInputFieldMountable(n,{renderChildType:a,declaration:r,scope:i});if(e==="VIEW")return this.createViewFieldMountable(n,{renderChildType:a,declaration:r,scope:i});if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(n,{renderChildType:a,declaration:r,position:o});throw new Gt({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,r){pn(ve.object({filePath:$a,options:nI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.inputFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.inputFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new cf(this.plugin,n,e,r.renderChildType,i)}createViewFieldMountable(e,r){pn(ve.object({filePath:$a,options:iI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.viewFieldParser.fromStringAndValidate(r.declaration,e,r.scope):i=this.viewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e,r.scope),new ly(this.plugin,n,e,r.renderChildType,i)}createJsViewFieldMountable(e,r){pn(ve.object({filePath:$a,options:aI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.jsViewFieldParser.fromStringAndValidate(r.declaration,e):i=this.jsViewFieldParser.fromSimpleDeclarationAndValidate(r.declaration,e),new _g(this.plugin,n,e,i)}createTableMountable(e,r){pn(ve.object({filePath:$a,options:oI}),{filePath:e,options:r});let n=Fr();return new wg(this.plugin,n,e,r.bindTarget,r.tableHead,r.columns)}createButtonGroupMountable(e,r){pn(ve.object({filePath:$a,options:sI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.buttonParser.fromGroupString(r.declaration):i=this.buttonParser.validateGroup(r.declaration),new Gh(this.plugin,n,e,i,r.renderChildType,r.position)}createButtonMountable(e,r){pn(ve.object({filePath:$a,options:uI}),{filePath:e,options:r});let n=Fr(),i;return typeof r.declaration=="string"?i=this.buttonParser.fromString(r.declaration):i=this.buttonParser.validate(r.declaration),new jh(this.plugin,n,e,i,r.position,r.isPreview)}createEmbedMountable(e,r){pn(ve.object({filePath:$a,options:lI}),{filePath:e,options:r});let n=Fr();return new Zh(this.plugin,n,e,r.depth,r.content)}createExcludedMountable(e){pn(ve.object({filePath:$a}),{filePath:e});let r=Fr();return new Jh(this.plugin,r,e)}getInlineFieldDeclarationPrefix(e){if(pn(ve.object({fieldType:Ep}),{fieldType:e}),e==="INPUT")return"INPUT";if(e==="VIEW")return"VIEW";if(e==="BUTTON_GROUP")return"BUTTON";throw new Gt({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,r){pn(ve.object({fieldType:Ep,str:ve.string()}),{fieldType:e,str:r});let n=this.getInlineFieldDeclarationPrefix(e)+"[";return r.startsWith(n)&&r.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(pn(ve.object({str:ve.string()}),{str:e}),!!e.endsWith("]"))for(let r of Object.values(vc)){if(!sd(r))continue;let n=this.getInlineFieldDeclarationPrefix(r)+"[";if(e.startsWith(n))return r}}createSignal(e){return new yn(e)}createBindTarget(e,r,n,i=!1){return pn(ve.object({storageType:ve.string(),storagePath:ve.string(),property:ve.string().array(),listenToChildren:ve.boolean()}),{storageType:e,storagePath:r,property:n,listenToChildren:i}),{storageType:e,storagePath:r,storageProp:bg(n),listenToChildren:i}}parseBindTarget(e,r,n){return pn(ve.object({declarationString:ve.string(),filePath:$a,scope:qc.optional()}),{declarationString:e,filePath:r,scope:n}),this.bindTargetParser.fromStringAndValidate(e,r,n)}setMetadata(e,r){pn(ve.object({bindTarget:ka}),{bindTarget:e}),this.plugin.metadataManager.write(r,e)}getMetadata(e){return pn(ve.object({bindTarget:ka}),{bindTarget:e}),this.plugin.metadataManager.read(e)}updateMetadata(e,r){pn(ve.object({bindTarget:ka,updateFn:ve.function().args(ve.any()).returns(ve.any())}),{bindTarget:e,updateFn:r});let n=this.plugin.metadataManager.read(e),i=r(n);this.plugin.metadataManager.write(i,e)}subscribeToMetadata(e,r,n){pn(ve.object({bindTarget:ka,lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:ve.function().args(ve.any()).returns(ve.void())}),{bindTarget:e,lifecycleHook:r,callback:n});let i=Fr(),a=new yn(void 0);a.registerListener({callback:n});let o=this.plugin.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});r.register(()=>{o.unsubscribe()})}createNotePosition(e,r){return pn(ve.object({lineStart:ve.number(),lineEnd:ve.number()}),{lineStart:e,lineEnd:r}),new mu({lineStart:e,lineEnd:r})}};var c9=require("@codemirror/view"),Hy=class extends c9.WidgetType{constructor(e,r,n,i,a){super(),this.type=e,this.content=r,this.filePath=n,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let r=document.createElement("span");r.addClass("cm-inline-code");let n=this.plugin.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.plugin.api.wrapInMDRC(n,r,this.parentComponent),r}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var f9=require("obsidian"),Gy=class extends f9.MarkdownRenderChild{constructor(e,r,n){super(n),this.plugin=e,this.mountable=r,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function p9(t){return t.dependencyManager.checkDependency("dataview").api}function nl(t){return t.dependencyManager.checkDependency("js-engine").api}function TM(t){return t.dependencyManager.checkDependency("templater-obsidian").templater}var wae=ve.object({addChild:ve.function().args(ve.instanceof(m9.Component)).returns(ve.void())}),Wy=class extends zy{constructor(e){super(e)}wrapInMDRC(e,r,n){pn(ve.object({field:XF,containerEl:JF,component:wae}),{field:e,containerEl:r,component:n});let i=new Gy(this.plugin,e,r);return n.addChild(i),i}constructMDRCWidget(e,r,n,i){if(sd(e))return new Hy(e,r,n,i,this.plugin);throw new Gt({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,r,n){pn(ve.object({bindTargets:ka.array(),lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:ve.function()}),{bindTargets:e,lifecycleHook:r,callback:n});let i=nl(this.plugin),a=Fr(),o=e.map(()=>new yn(void 0)),s=()=>Promise.resolve(),l=this.plugin.metadataManager.subscribeEffect(a,e,o,()=>s(),()=>{});r.register(()=>l.unsubscribe());let u=i.reactive(n,...o.map(c=>c.get()));return s=()=>u.refresh(...o.map(c=>c.get())),u}};var Mn=require("obsidian");var Yy=zr(mp());var d9=zr(mp());var _ae=ue('<div class="mb-calendar-cell mb-calendar-header-cell"><span class="mb-calendar-cell-text"> </span></div>'),Aae=(t,e,r)=>e(z(r)),Sae=(t,e,r)=>e(t,z(r)),Eae=ue('<div class="mb-calendar-cell" role="button" tabindex="0"><span class="mb-calendar-cell-text"> </span></div>'),Tae=ue('<div class="mb-calendar"><div class="mb-calendar-header"></div> <div class="mb-calendar-content"></div></div>');function DM(t,e){Te(e,!0);let r=Vt(()=>nF(e.month,e.year));function n(l){l&&e.dateChange((0,d9.default)(new Date(e.year,e.month,l)))}function i(l,u){l.key===" "&&n(u)}var a=Tae(),o=ye(a);Yt(o,21,iF,er,(l,u)=>{var c=_ae(),f=ye(c),m=ye(f,!0);ce(f),ce(c),Re(()=>ht(m,z(u))),ee(l,c)}),ce(o);var s=le(o,2);Yt(s,21,()=>z(r),l=>aF(),(l,u)=>{var c=Eae();c.__click=[Aae,n,u],c.__keydown=[Sae,i,u];let f=Vt(()=>e.selectedDate?.year()===e.year&&e.selectedDate?.month()===e.month&&e.selectedDate?.date()===z(u));Re(()=>tn(c,"mb-calendar-selected",z(f)));var m=ye(c),p=ye(m,!0);ce(m),ce(c),Re(()=>{tn(c,"mb-calendar-highlight",z(u)),tn(c,"mb-calendar-content-cell",z(u)),ht(p,z(u)||"")}),ee(l,c)}),ce(s),ce(a),ee(t,a),De()}kt(["click","keydown"]);function Dae(t,e,r){if(z(e)===11){$e(e,0),$e(r,z(r)+1);return}$e(e,z(e)+1)}function Mae(t,e,r){if(z(e)===0){$e(e,11),$e(r,z(r)-1);return}$e(e,z(e)-1)}function Cae(t,e){let r=t.target.value,n=Number.parseInt(r);Number.isNaN(n)||$e(e,Le(n))}function Nae(t,e,r){e(null),r.dateChangeCallback(null)}function Fae(t,e,r){e((0,Yy.default)()),r.dateChangeCallback(e())}var Iae=ue('<div class="mb-date-picker"><div class="mb-date-picker-header"><button class="mb-date-picker-month-switch-button">Prev</button> <div class="mb-date-picker-header-text"><span class="mb-date-picker-header-text-month"> </span> <input class="mb-date-picker-header-text-year" type="number"></div> <button class="mb-date-picker-month-switch-button">Next</button></div> <!> <div class="mb-date-picker-footer"><button class="mb-date-picker-util-button">Set no Date</button> <button class="mb-date-picker-util-button">Set to Now</button></div></div>');function MM(t,e){Te(e,!0);let r=lt(e,"selectedDate",23,Yy.default),n=bt(0),i=bt(0);ga(()=>{if(r())$e(n,Le(r().month())),$e(i,Le(r().year()));else{let T=(0,Yy.default)();$e(n,Le(T.month())),$e(i,Le(T.year()))}});function a(T){r(T),e.dateChangeCallback(T)}var o=Iae(),s=ye(o),l=ye(s);l.__click=[Mae,n,i];var u=le(l,2),c=ye(u),f=ye(c,!0);Re(()=>ht(f,rF(z(n)))),ce(c);var m=le(c,2);Tt(m),Re(()=>Xb(m,z(i).toString())),m.__input=[Cae,i],ce(u);var p=le(u,2);p.__click=[Dae,n,i],ce(s);var d=le(s,2);DM(d,{dateChange:a,get month(){return z(n)},get year(){return z(i)},get selectedDate(){return r()}});var h=le(d,2),x=ye(h);x.__click=[Nae,r,e];var b=le(x,2);b.__click=[Fae,r,e],ce(h),ce(o),ee(t,o),De()}kt(["click","input"]);var Jf=class extends Ni{setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new Gt({errorLevel:"CRITICAL",effect:"Failed to close modal",cause:"Modal reference in ModalContent is undefined"})}};var Pae=ue('<div class="setting-item"><div class="setting-item-info"><div class="setting-item-name"> </div> <div class="setting-item-description"> </div></div> <div class="setting-item-control"><!></div></div>');function $t(t,e){Te(e,!0);let r=lt(e,"name",3,""),n=lt(e,"description",3,""),i=lt(e,"heading",3,!1),a=lt(e,"vertical",3,!1);var o=Pae(),s=ye(o),l=ye(s),u=ye(l,!0);ce(l);var c=le(l,2),f=ye(c,!0);ce(c),ce(s);var m=le(s,2),p=ye(m);{var d=h=>{var x=Xr(),b=Je(x);ho(b,()=>e.children),ee(h,x)};ot(p,h=>{e.children&&h(d)})}ce(m),ce(o),Re(()=>{tn(o,"setting-item-heading",i()),tn(o,"mb-vertical",a()),ht(u,r()),ht(f,n()),tn(m,"mb-vertical-control",a())}),ee(t,o),De()}function CM(t,e){Te(e,!0);let r=lt(e,"action",15);function n(){e.plugin.internal.openCommandSelectModal(a=>{r(r().command=a.id,!0)})}var i=Vt(()=>`Command: ${(r().command||"none")??""}`);$t(t,{get name(){return z(i)},description:"The command to execute when this action runs.",children:(a,o)=>{Et(a,{get variant(){return"primary"},onclick:()=>n(),children:(s,l)=>{Nt();var u=lr("Change");ee(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var Bae=(t,e,r)=>e(!z(r)),kae=(t,e,r)=>{t.key===" "&&e(!z(r))},$ae=ue('<div class="checkbox-container" role="switch" tabindex="0"><input type="checkbox" tabindex="-1"></div>');function Qa(t,e){let r=lt(e,"checked",15),n=Vt(()=>r()??!1);var i=$ae();i.__click=[Bae,r,n],i.__keydown=[kae,r,n];var a=ye(i);Tt(a),ce(i),Re(()=>{wt(i,"aria-checked",z(n)),tn(i,"is-enabled",z(n)),Ys(a,z(n))}),ee(t,i)}kt(["click","keydown"]);var Oae=ue('<input type="text" placeholder="some name">'),Rae=ue("<!> <!> <!> <!>",1);function NM(t,e){Te(e,!0);let r=lt(e,"action",15);function n(){e.plugin.internal.openFolderSelectModal(f=>{r(r().folderPath=f,!0)})}var i=Rae(),a=Je(i),o=Vt(()=>`Folder: ${(r().folderPath||"none")??""}`);$t(a,{get name(){return z(o)},description:"The folder to create a new note in.",children:(f,m)=>{Et(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(p,d)=>{Nt();var h=lr("Change");ee(p,h)},$$slots:{default:!0}})},$$slots:{default:!0}});var s=le(a,2),l=Vt(()=>`File name: ${(r().fileName||"default")??""}`);$t(s,{get name(){return z(l)},description:"The file name of the new note.",children:(f,m)=>{var p=Oae();Tt(p),_t(p,()=>r().fileName,d=>r(r().fileName=d,!0)),ee(f,p)},$$slots:{default:!0}});var u=le(s,2);$t(u,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(f,m)=>{Qa(f,{get checked(){return r().openNote},set checked(p){r(r().openNote=p,!0)}})},$$slots:{default:!0}});var c=le(u,2);$t(c,{name:"Open if note already exists",description:"Whether to open the note instead of creating a new one if the note already exists.",children:(f,m)=>{Qa(f,{get checked(){return r().openIfAlreadyExists},set checked(p){r(r().openIfAlreadyExists=p,!0)}})},$$slots:{default:!0}}),ee(t,i),De()}function FM(t,e){Te(e,!0);let r=lt(e,"action",15);function n(){e.plugin.internal.openMarkdownFileSelectModal(a=>{r(r().templateFile=a,!0)})}var i=Vt(()=>`File path: ${(r().templateFile||"default")??""}`);$t(t,{get name(){return z(i)},description:"The path to the templater file, relative to the vault root.",children:(a,o)=>{Et(a,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(s,l)=>{Nt();var u=lr("Change");ee(s,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var Lae=ue('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function IM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=Lae(),i=Je(n);$t(i,{name:"JS code",description:"The JavaScript code to run."});var a=le(i,2),o=ye(a);On(o),ce(a),_t(o,()=>r().code,s=>r(r().code=s,!0)),ee(t,n),De()}var Vae=ue('<input type="text" placeholder="some text">');function PM(t,e){Te(e,!0);let r=lt(e,"action",15);$t(t,{name:"Text",description:"The text to input at the cursor.",children:(n,i)=>{var a=Vae();Tt(a),_t(a,()=>r().str,o=>r(r().str=o,!0)),ee(n,a)},$$slots:{default:!0}}),De()}var Uae=ue('<input type="number" placeholder="0">'),qae=ue('<!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function BM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=qae(),i=Je(n);$t(i,{name:"Line",description:"The line number to insert at.",children:(l,u)=>{var c=Uae();Tt(c),_t(c,()=>r().line,f=>r(r().line=f,!0)),ee(l,c)},$$slots:{default:!0}});var a=le(i,2);$t(a,{name:"Text to insert",description:"The text to insert into the note."});var o=le(a,2),s=ye(o);On(s),ce(o),_t(s,()=>r().value,l=>r(r().value=l,!0)),ee(t,n),De()}function kM(t,e){Te(e,!0);let r=lt(e,"action",15);function n(){e.plugin.internal.openFilteredFileSelectModal(i=>{r(r().file=i,!0)},i=>i.endsWith(".js"))}$t(t,{name:"JS file",description:"The JavaScript file to run.",children:(i,a)=>{Et(i,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(o,s)=>{Nt();var l=lr("Change");ee(o,l)},$$slots:{default:!0}})},$$slots:{default:!0}}),De()}var zae=ue('<input type="text" placeholder="[[Some Note]] or https://www.example.com"> <!>',1),Hae=ue("<!> <!>",1);function $M(t,e){Te(e,!0);let r=lt(e,"action",15);function n(){e.plugin.internal.openMarkdownFileSelectModal(s=>{r(r().link=s,!0)})}var i=Hae(),a=Je(i);$t(a,{name:"Link",description:"The link to open.",children:(s,l)=>{var u=zae(),c=Je(u);Tt(c);var f=le(c,2);Et(f,{get variant(){return"primary"},onclick:()=>n(),tooltip:"Select from vault",children:(m,p)=>{Yr(m,{iconName:"list",get plugin(){return e.plugin}})},$$slots:{default:!0}}),_t(c,()=>r().link,m=>r(r().link=m,!0)),ee(s,u)},$$slots:{default:!0}});var o=le(a,2);$t(o,{name:"New tab",description:"Whether to open the link in a new tab.",children:(s,l)=>{Qa(s,{get checked(){return r().newTab},set checked(u){r(r().newTab=u,!0)}})},$$slots:{default:!0}}),ee(t,i),De()}var Gae=ue('<input type="text">'),Wae=ue('<input type="text" placeholder="g">'),Yae=ue('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function OM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=Yae(),i=Je(n);$t(i,{name:"Regexp",description:"The regexp to find replacements.",children:(u,c)=>{var f=Gae();Tt(f),_t(f,()=>r().regexp,m=>r(r().regexp=m,!0)),ee(u,f)},$$slots:{default:!0}});var a=le(i,2);$t(a,{name:"Regexp flags",description:"The regexp flags for this regexp.",children:(u,c)=>{var f=Wae();Tt(f),_t(f,()=>r().regexpFlags,m=>r(r().regexpFlags=m,!0)),ee(u,f)},$$slots:{default:!0}});var o=le(a,2);$t(o,{name:"Replacement text",description:"The text to replace the button with."});var s=le(o,2),l=ye(s);On(l),ce(s),_t(l,()=>r().replacement,u=>r(r().replacement=u,!0)),ee(t,n),De()}var jae=ue('<input type="number" placeholder="0">'),Zae=ue('<input type="number" placeholder="0">'),Jae=ue('<!> <!> <!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function RM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=Jae(),i=Je(n);$t(i,{name:"Line from",description:"The line that marks the start of the area to replace.",children:(u,c)=>{var f=jae();Tt(f),_t(f,()=>r().fromLine,m=>r(r().fromLine=m,!0)),ee(u,f)},$$slots:{default:!0}});var a=le(i,2);$t(a,{name:"Line to",description:"The line that marks the end of the area to replace.",children:(u,c)=>{var f=Zae();Tt(f),_t(f,()=>r().toLine,m=>r(r().toLine=m,!0)),ee(u,f)},$$slots:{default:!0}});var o=le(a,2);$t(o,{name:"Replacement text",description:"The text to replace the note section."});var s=le(o,2),l=ye(s);On(l),ce(s),_t(l,()=>r().replacement,u=>r(r().replacement=u,!0)),ee(t,n),De()}var Xae=ue('<!> <div class="meta-bind-full-width meta-bind-high"><textarea></textarea></div>',1);function LM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=Xae(),i=Je(n);$t(i,{name:"Replacement text",description:"The text to replace the match with."});var a=le(i,2),o=ye(a);On(o),ce(a),_t(o,()=>r().replacement,s=>r(r().replacement=s,!0)),ee(t,n),De()}var Qae=ue('<input type="number" placeholder="100 ms">');function VM(t,e){Te(e,!0);let r=lt(e,"action",15);$t(t,{name:"Sleep time",description:"The time to sleep in milliseconds.",children:(n,i)=>{var a=Qae();Tt(a),_t(a,()=>r().ms,o=>r(r().ms=o,!0)),ee(n,a)},$$slots:{default:!0}}),De()}var Kae=ue('<input type="text" placeholder="some name">'),eoe=ue("<!> <!> <!> <!> <!>",1);function UM(t,e){Te(e,!0);let r=lt(e,"action",15);function n(d){e.plugin.internal.openFileSelectModal(h=>{d.templateFile=h})}function i(d){e.plugin.internal.openFolderSelectModal(h=>{d.folderPath=h})}var a=eoe(),o=Je(a),s=Vt(()=>`Template file: ${(r().templateFile||"none")??""}`);$t(o,{get name(){return z(s)},description:"The template file to create a new note of.",children:(d,h)=>{Et(d,{get variant(){return"primary"},onclick:()=>n(r()),tooltip:"Select from vault",children:(x,b)=>{Nt();var T=lr("Change");ee(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var l=le(o,2),u=Vt(()=>`Folder: ${(r().folderPath||"none")??""}`);$t(l,{get name(){return z(u)},description:"The folder to create a new note in.",children:(d,h)=>{Et(d,{get variant(){return"primary"},onclick:()=>i(r()),tooltip:"Select from vault",children:(x,b)=>{Nt();var T=lr("Change");ee(x,T)},$$slots:{default:!0}})},$$slots:{default:!0}});var c=le(l,2),f=Vt(()=>`File name: ${(r().fileName||"default")??""}`);$t(c,{get name(){return z(f)},description:"The file name of the new note.",children:(d,h)=>{var x=Kae();Tt(x),_t(x,()=>r().fileName,b=>r(r().fileName=b,!0)),ee(d,x)},$$slots:{default:!0}});var m=le(c,2);$t(m,{name:"Open note",description:"Whether to open the new note after this action ran.",children:(d,h)=>{Qa(d,{get checked(){return r().openNote},set checked(x){r(r().openNote=x,!0)}})},$$slots:{default:!0}});var p=le(m,2);$t(p,{name:"Open if note already exists",description:"Whether to open the note instead of creating a new one if the note already exists.",children:(d,h)=>{Qa(d,{get checked(){return r().openIfAlreadyExists},set checked(x){r(r().openIfAlreadyExists=x,!0)}})},$$slots:{default:!0}}),ee(t,a),De()}var toe=ue('<input type="text" placeholder="some value">'),roe=ue('<input type="text" placeholder="some value">'),noe=ue("<!> <!> <!>",1);function qM(t,e){Te(e,!0);let r=lt(e,"action",15);var n=noe(),i=Je(n);$t(i,{name:"Metadata property",description:"The metadata property in form of a bind target.",children:(s,l)=>{var u=toe();Tt(u),_t(u,()=>r().bindTarget,c=>r(r().bindTarget=c,!0)),ee(s,u)},$$slots:{default:!0}});var a=le(i,2);$t(a,{name:"Value",description:"The new value.",children:(s,l)=>{var u=roe();Tt(u),_t(u,()=>r().value,c=>r(r().value=c,!0)),ee(s,u)},$$slots:{default:!0}});var o=le(a,2);$t(o,{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",children:(s,l)=>{Qa(s,{get checked(){return r().evaluate},set checked(u){r(r().evaluate=u,!0)}})},$$slots:{default:!0}}),ee(t,n),De()}var ioe=ue("<div><!></div>");function su(t,e){Te(e,!0);let r=lt(e,"reverse",3,!1),n=lt(e,"stretchChildren",3,!1),i=Vt(()=>[r()?"mb-flex-row-reverse":"mb-flex-row",n()?"mb-flex-row-stretch":""].join(" "));var a=ioe(),o=ye(a);ho(o,()=>e.children),ce(a),Re(()=>xa(a,Ws(z(i)))),ee(t,a),De()}var aoe=ue('<div class="modal-button-container"><!></div>');function Qo(t,e){Te(e,!0);var r=aoe(),n=ye(r);ho(n,()=>e.children),ce(r),ee(t,r),De()}var ooe=ue('<input type="text">'),soe=ue('<input type="text">'),uoe=ue("<option> </option>"),loe=ue('<select class="dropdown"></select>'),coe=ue('<input type="text">'),foe=ue('<input type="text">'),poe=ue('<span style="word-break: break-word"> </span> <!>',1),moe=ue('<input type="text">'),doe=ue('<input type="text">'),hoe=ue("<option> </option>"),goe=ue("<h5> </h5> <!>",1),voe=ue("<!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!>",1),yoe=ue("<!> <!>",1),xoe=ue('<!> <!> <!> <!> <!> <!> <!> <!> <!> <h4>Actions</h4> Add action of type <select class="dropdown"></select> <!> <!> <h4>Preview</h4> <div></div> <!>',1);function zM(t,e){Te(e,!0);let r=Le(e.buttonConfig),n,i,a=bt(Le("command"));lf(()=>{i?.unmount()}),ga(()=>{i?.unmount(),n&&(mt.empty(n),i=new Fu(e.plugin,li(r),"","block",void 0,!1,!0),i.mount(n))});function o(){r.actions?.push(e.plugin.api.buttonActionRunner.createDefaultAction(z(a)))}function s(C){r.actions?.splice(C,1)}function l(C){return e.plugin.api.buttonActionRunner.getActionLabel(C)}function u(C,B){if(r.actions===void 0)return;let R=[];C>0&&R.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[C-1];r.actions[C-1]=r.actions[C],r.actions[C]=V}}),C<r.actions.length-1&&R.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(r.actions===void 0)return;let V=r.actions[C+1];r.actions[C+1]=r.actions[C],r.actions[C]=V}}),R.push({name:"Remove",icon:"x",warning:!0,onclick:()=>s(C)}),e.plugin.internal.createContextMenu(R).showWithEvent(B)}function c(){e.plugin.internal.openImageFileSelectModal(C=>{r.backgroundImage=C})}var f=xoe(),m=Je(f);$t(m,{name:"Label",description:"The label shown on the button.",children:(C,B)=>{var R=ooe();Tt(R),_t(R,()=>r.label,V=>r.label=V),ee(C,R)},$$slots:{default:!0}});var p=le(m,2);$t(p,{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",children:(C,B)=>{var R=soe();Tt(R),_t(R,()=>r.icon,V=>r.icon=V),ee(C,R)},$$slots:{default:!0}});var d=le(p,2);$t(d,{name:"Style",description:"The style variant of the button",children:(C,B)=>{var R=loe();Yt(R,21,()=>Object.values(on),er,(V,L)=>{var P=uoe(),k={},W=ye(P,!0);ce(P),Re(()=>{k!==(k=z(L))&&(P.value=(P.__value=z(L))==null?"":z(L)),ht(W,z(L))}),ee(V,P)}),ce(R),uf(R,()=>r.style,V=>r.style=V),ee(C,R)},$$slots:{default:!0}});var h=le(d,2);$t(h,{name:"CSS classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",children:(C,B)=>{var R=coe();Tt(R),_t(R,()=>r.class,V=>r.class=V),ee(C,R)},$$slots:{default:!0}});var x=le(h,2);$t(x,{name:"CSS styles",description:"CSS styles to directly apply to the button.",children:(C,B)=>{var R=foe();Tt(R),_t(R,()=>r.cssStyle,V=>r.cssStyle=V),ee(C,R)},$$slots:{default:!0}});var b=le(x,2);$t(b,{name:"Background image",description:"A background image to use in the button.",children:(C,B)=>{var R=poe(),V=Je(R),L=ye(V,!0);ce(V);var P=le(V,2);Et(P,{get variant(){return"primary"},onclick:()=>c(),tooltip:"Select from vault",children:(k,W)=>{Nt();var O=lr("Change");ee(k,O)},$$slots:{default:!0}}),Re(()=>ht(L,r.backgroundImage??"none")),ee(C,R)},$$slots:{default:!0}});var T=le(b,2);$t(T,{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",children:(C,B)=>{var R=moe();Tt(R),_t(R,()=>r.tooltip,V=>r.tooltip=V),ee(C,R)},$$slots:{default:!0}});var v=le(T,2);$t(v,{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",children:(C,B)=>{var R=doe();Tt(R),_t(R,()=>r.id,V=>r.id=V),ee(C,R)},$$slots:{default:!0}});var A=le(v,2);$t(A,{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",children:(C,B)=>{Qa(C,{get checked(){return r.hidden},set checked(R){r.hidden=R}})},$$slots:{default:!0}});var w=le(A,4);Yt(w,21,()=>Object.values(Kn),er,(C,B)=>{var R=hoe(),V={},L=ye(R,!0);ce(R),Re(()=>{V!==(V=z(B))&&(R.value=(R.__value=z(B))==null?"":z(B)),ht(L,z(B))}),ee(C,R)}),ce(w);var y=le(w,2);Et(y,{get variant(){return"primary"},onclick:()=>o(),children:(C,B)=>{Nt();var R=lr("Add Action");ee(C,R)},$$slots:{default:!0}});var E=le(y,2);{var D=C=>{var B=Xr(),R=Je(B);Yt(R,17,()=>r.actions??[],er,(V,L,P)=>{var k=voe(),W=Je(k);su(W,{children:(He,at)=>{var Q=goe(),me=Je(Q),he=ye(me,!0);Re(()=>ht(he,l(z(L).type))),ce(me);var Fe=le(me,2);Et(Fe,{get variant(){return"plain"},onclick:ke=>u(P,ke),children:(ke,Se)=>{Yr(ke,{iconName:"more-vertical",get plugin(){return e.plugin}})},$$slots:{default:!0}}),ee(He,Q)},$$slots:{default:!0}});var O=le(W,2);{var X=He=>{CM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(O,He=>{z(L).type==="command"&&He(X)})}var ae=le(O,2);{var J=He=>{$M(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(ae,He=>{z(L).type==="open"&&He(J)})}var U=le(ae,2);{var de=He=>{kM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(U,He=>{z(L).type==="js"&&He(de)})}var we=le(U,2);{var se=He=>{PM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(we,He=>{z(L).type==="input"&&He(se)})}var be=le(we,2);{var K=He=>{VM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(be,He=>{z(L).type==="sleep"&&He(K)})}var j=le(be,2);{var ne=He=>{UM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(j,He=>{z(L).type==="templaterCreateNote"&&He(ne)})}var pe=le(j,2);{var fe=He=>{qM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(pe,He=>{z(L).type==="updateMetadata"&&He(fe)})}var Ae=le(pe,2);{var _e=He=>{NM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(Ae,He=>{z(L).type==="createNote"&&He(_e)})}var G=le(Ae,2);{var Z=He=>{FM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(G,He=>{z(L).type==="runTemplaterFile"&&He(Z)})}var ge=le(G,2);{var xe=He=>{RM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(ge,He=>{z(L).type==="replaceInNote"&&He(xe)})}var Ee=le(ge,2);{var Be=He=>{OM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(Ee,He=>{z(L).type==="regexpReplaceInNote"&&He(Be)})}var Ve=le(Ee,2);{var et=He=>{LM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(Ve,He=>{z(L).type==="replaceSelf"&&He(et)})}var St=le(Ve,2);{var Ye=He=>{BM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(St,He=>{z(L).type==="insertIntoNote"&&He(Ye)})}var ur=le(St,2);{var Jt=He=>{IM(He,{get plugin(){return e.plugin},get action(){return r.actions[P]},set action(at){r.actions[P]=at}})};ot(ur,He=>{z(L).type==="inlineJS"&&He(Jt)})}ee(V,k)}),ee(C,B)};ot(E,C=>{r.actions&&C(D)})}var _=le(E,4);Vo(_,C=>n=C,()=>n);var N=le(_,2);Qo(N,{children:(C,B)=>{var R=yoe(),V=Je(R);Et(V,{get variant(){return"primary"},onclick:()=>e.modal.okay(li(r)),children:(P,k)=>{Nt();var W=lr();Re(()=>ht(W,e.modal.options.submitText)),ee(P,W)},$$slots:{default:!0}});var L=le(V,2);Et(L,{get variant(){return"default"},onclick:()=>e.modal.cancel(),children:(P,k)=>{Nt();var W=lr("Cancel");ee(P,W)},$$slots:{default:!0}}),ee(C,R)},$$slots:{default:!0}}),uf(w,()=>z(a),C=>$e(a,C)),ee(t,f),De()}var jy=class extends Jf{constructor(e,r){super(),this.plugin=e,this.options=r}onMount(e){mt.empty(e),this.component&&Ur(this.component),this.component=Vr(zM,{target:e,props:{plugin:this.plugin,modal:this,buttonConfig:this.options.config??this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){mt.empty(e),this.component&&Ur(this.component)}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var boe=(t,e,r)=>r.onSelect(r.image),woe=(t,e,r,n)=>e(t,n.image),_oe=ue('<div class="mb-image-card" role="button" tabindex="0"><img class="mb-image-card-image"> <div class="mb-image-card-footer"><span> </span></div></div>');function HM(t,e){Te(e,!0);let r=or(e,["$$slots","$$events","$$legacy"]);function n(u,c){u.key===" "&&e.onSelect(c)}var i=_oe();i.__click=[boe,r,e],i.__keydown=[woe,n,r,e];var a=ye(i);Re(()=>wt(a,"src",e.plugin.internal.imagePathToUri(e.image)));var o=le(a,2),s=ye(o),l=ye(s,!0);ce(s),ce(o),ce(i),Re(()=>{wt(a,"alt",e.image),ht(l,e.image)}),ee(t,i),De()}kt(["click","keydown"]);var Aoe=ue('<div class="mb-image-search-container"><input type="text" placeholder="Search images..."></div> <div class="mb-image-card-grid"></div>',1);function GM(t,e){Te(e,!0);let r=bt(""),n=e.plugin.internal.createFuzzySearch(),i=Vt(()=>z(r)?(n.setSearch(z(r)),n.filterItems(e.options,u=>u.value)):e.options);var a=Aoe(),o=Je(a),s=ye(o);Tt(s),ce(o);var l=le(o,2);Yt(l,21,()=>z(i),er,(u,c)=>{HM(u,{get plugin(){return e.plugin},get image(){return z(c).value},get onSelect(){return e.onSelect}})}),ce(l),_t(s,()=>z(r),u=>$e(r,u)),ee(t,a),De()}var ac=class extends Jf{constructor(e){super(),this.createComponent=e}onMount(e){mt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component&&Ur(this.component),mt.empty(e)}};var Soe=ue("<textarea></textarea>"),Eoe=ue('<input type="text">'),Toe=ue("<!> <!>",1),Doe=ue('<p> </p> <div class="mb-full-width-text-input"><!></div> <!>',1);function WM(t,e){Te(e,!0);let r=bt(Le(e.options.value));var n=Doe(),i=Je(n),a=ye(i,!0);ce(i);var o=le(i,2),s=ye(o);{var l=f=>{var m=Soe();On(m),_t(m,()=>z(r),p=>$e(r,p)),ee(f,m)},u=f=>{var m=Eoe();Tt(m),_t(m,()=>z(r),p=>$e(r,p)),ee(f,m)};ot(s,f=>{e.options.multiline?f(l):f(u,!1)})}ce(o);var c=le(o,2);Qo(c,{children:(f,m)=>{var p=Toe(),d=Je(p);Et(d,{get variant(){return"primary"},onclick:()=>e.options.onSubmit(li(z(r))),children:(x,b)=>{Nt();var T=lr("OK");ee(x,T)},$$slots:{default:!0}});var h=le(d,2);Et(h,{onclick:()=>e.options.onCancel(),children:(x,b)=>{Nt();var T=lr("Cancel");ee(x,T)},$$slots:{default:!0}}),ee(f,p)},$$slots:{default:!0}}),Re(()=>ht(a,e.options.subTitle)),ee(t,n),De()}var ys=class{constructor(e,r){this.plugin=e,this.selectCallback=r}onSelected(e){this.selectCallback(e)}};var Zy=class extends ys{getItemText(e){return e.name}getItemDescription(e){}getItems(){return this.plugin.internal.getAllCommands()}};var zm=class extends ys{constructor(e,r,n){super(e,r),this.filterFunction=n}getItemText(e){return e}getItemDescription(e){}getItems(){return this.filterFunction!==void 0?this.plugin.internal.file.getAllFiles().filter(e=>this.filterFunction(e)):this.plugin.internal.file.getAllFiles()}};var Jy=class extends ys{getItemText(e){return e}getItemDescription(e){}getItems(){return this.plugin.internal.file.getAllFolders()}};var Xy=class extends ys{constructor(e,r,n){super(e,r),this.ipf=n}getItemText(e){return e.displayValue}getItemDescription(e){return e.displayDescription}getItems(){return this.plugin.internal.getSuggesterOptions(this.ipf)}};var Moe=ue('<pre class="mb-pre"><code class="language-none mb-none"> </code></pre>'),Coe=ue("<tr><td>Tip</td><td> </td></tr>"),Noe=ue("<a> </a><br>",1),Foe=ue("<tr><td>Docs</td><td></td></tr>"),Ioe=ue('<tr><td>Context</td><td><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></td></tr>'),Poe=ue('<div class="mb-card mb-card-full-width markdown-rendered"><h6><span> </span> </h6> <!> <table><tbody><tr><td>Cause</td><td> </td></tr><tr><td>Effect</td><td> </td></tr><!><!><!></tbody></table></div>'),Boe=ue('<div class="mb-card"><pre class="mb-pre"><code class="language-none mb-none"> </code></pre></div>');function Qy(t,e){Te(e,!0);var r=Xr(),n=Je(r);{var i=o=>{var s=Poe(),l=ye(s),u=ye(l),c=ye(u);Re(()=>ht(c,`${e.error.errorLevel??""}
				[${e.error.getErrorType()??""}]`)),ce(u);var f=le(u);ce(l);var m=le(l,2);{var p=B=>{var R=Moe(),V=ye(R),L=ye(V,!0);ce(V),ce(R),Re(()=>ht(L,e.error.positionContext)),ee(B,R)};ot(m,B=>{e.error.positionContext&&B(p)})}var d=le(m,2),h=ye(d),x=ye(h),b=le(ye(x)),T=ye(b,!0);ce(b),ce(x);var v=le(x),A=le(ye(v)),w=ye(A,!0);ce(A),ce(v);var y=le(v);{var E=B=>{var R=Coe(),V=le(ye(R)),L=ye(V,!0);ce(V),ce(R),Re(()=>ht(L,e.error.tip)),ee(B,R)};ot(y,B=>{e.error.tip&&B(E)})}var D=le(y);{var _=B=>{var R=Foe(),V=le(ye(R));Yt(V,21,()=>e.error.docs,er,(L,P)=>{var k=Noe(),W=Je(k),O=ye(W,!0);ce(W),Nt(),Re(()=>{wt(W,"href",z(P)),ht(O,z(P))}),ee(L,k)}),ce(V),ce(R),ee(B,R)};ot(D,B=>{e.error.docs&&B(_)})}var N=le(D);{var C=B=>{var R=Ioe(),V=le(ye(R)),L=ye(V),P=ye(L),k=ye(P,!0);Re(()=>ht(k,JSON.stringify(e.error.context,null,4))),ce(P),ce(L),ce(V),ce(R),ee(B,R)};ot(N,B=>{e.error.context&&B(C)})}ce(h),ce(d),ce(s),Re(()=>{xa(u,Ws(e.error.errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")),ht(f,` - ${e.error.effect??""}`),ht(T,e.error.cause),ht(w,e.error.effect)}),ee(o,s)},a=o=>{var s=Boe(),l=ye(s),u=ye(l),c=ye(u,!0);ce(u),ce(l),ce(s),Re(()=>ht(c,e.error.stack)),ee(o,s)};ot(n,o=>{e.error instanceof Jn?o(i):o(a,!1)})}ee(t,r),De()}var koe=ue("<p> </p>"),$oe=ue('<pre class="mb-pre"><code class="language-none meta-bind-none"> </code></pre>'),Ooe=ue("<p> </p>"),Roe=ue("<h6>Errors</h6> <!> <!>",1),Loe=ue("<p> </p>"),Voe=ue("<h6>Warnings</h6> <!> <!>",1),Uoe=ue("<!> <!> <!> <!>",1);function uu(t,e){Te(e,!0);var r=Uoe(),n=Je(r);{var i=f=>{var m=koe(),p=ye(m,!0);ce(m),Re(()=>ht(p,e.settings.text)),ee(f,m)};ot(n,f=>{e.settings.text&&f(i)})}var a=le(n,2);{var o=f=>{var m=$oe(),p=ye(m),d=ye(p,!0);ce(p),ce(m),Re(()=>ht(d,e.settings.code)),ee(f,m)};ot(a,f=>{e.settings.code&&f(o)})}var s=le(a,2);{var l=f=>{var m=Roe(),p=le(Je(m),2);{var d=x=>{var b=Ooe(),T=ye(b,!0);ce(b),Re(()=>ht(T,e.settings.errorText)),ee(x,b)};ot(p,x=>{e.settings.errorText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getErrors(),er,(x,b)=>{Qy(x,{get error(){return z(b)}})}),ee(f,m)};ot(s,f=>{e.settings.errorCollection.hasErrors()&&f(l)})}var u=le(s,2);{var c=f=>{var m=Voe(),p=le(Je(m),2);{var d=x=>{var b=Loe(),T=ye(b,!0);ce(b),Re(()=>ht(T,e.settings.warningText)),ee(x,b)};ot(p,x=>{e.settings.warningText&&x(d)})}var h=le(p,2);Yt(h,17,()=>e.settings.errorCollection.getWarnings(),er,(x,b)=>{Qy(x,{get error(){return z(b)}})}),ee(f,m)};ot(u,f=>{e.settings.errorCollection.hasWarnings()&&f(c)})}ee(t,r),De()}var qoe=(t,e)=>e(),zoe=(t,e)=>{t.key===" "&&e()},Hoe=ue('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" x2="12" y1="8" y2="12"></line><line x1="12" x2="12.01" y1="16" y2="16"></line></svg> <span class="mb-error">[META_BIND_ERROR]</span>',1),Goe=Vh('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-alert-triangle"><path 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"></path><line x1="12" x2="12" y1="9" y2="13"></line><line x1="12" x2="12.01" y1="17" y2="17"></line></svg>'),Woe=Vh('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>'),Yoe=ue('<div class="mb-error-collection" role="button" tabindex="0" aria-label="Click to view errors and warnings"><!></div>');function Xf(t,e){Te(e,!0);function r(){e.plugin.internal.openErrorCollectionViewModal(e.settings)}var n=Xr(),i=Je(n);{var a=o=>{var s=Yoe();s.__click=[qoe,r],s.__keydown=[zoe,r];var l=ye(s);{var u=f=>{var m=Hoe();Nt(2),ee(f,m)},c=f=>{var m=Xr(),p=Je(m);{var d=x=>{var b=Goe();ee(x,b)},h=x=>{var b=Woe();ee(x,b)};ot(p,x=>{e.settings.errorCollection.hasWarnings()?x(d):x(h,!1)},!0)}ee(f,m)};ot(l,f=>{e.settings.errorCollection.hasErrors()?f(u):f(c,!1)})}ce(s),ee(o,s)};ot(i,o=>{e.settings.errorCollection.isEmpty()||o(a)})}ee(t,n),De()}kt(["click","keydown"]);var YM=["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"],joe=YM.map(t=>`.${t}`),Ky=class{constructor(e,r){this.plugin=e,this.file=r}openCommandSelectModal(e){this.createSearchModal(new Zy(this.plugin,e)).open()}openFileSelectModal(e){this.createSearchModal(new zm(this.plugin,e)).open()}openFilteredFileSelectModal(e,r){this.createSearchModal(new zm(this.plugin,e,r)).open()}openMarkdownFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>r.endsWith(".md"))}openImageFileSelectModal(e){this.openFilteredFileSelectModal(e,r=>joe.some(n=>r.endsWith(n)))}openFolderSelectModal(e){this.createSearchModal(new Jy(this.plugin,e)).open()}openButtonBuilderModal(e){this.createModal(new jy(this.plugin,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,r){this.createSearchModal(new Xy(this.plugin,r,e)).open()}openImageSuggesterModal(e,r){this.createModal(new ac((n,i)=>Vr(GM,{target:i,props:{plugin:this.plugin,options:this.getImageSuggesterOptions(e),onSelect:a=>{r(a),n.closeModal()}}})),{title:"Meta Bind image suggester",classes:["mb-image-suggester-modal"]}).open()}openDatePickerModal(e){this.createModal(new ac((r,n)=>Vr(MM,{target:n,props:{selectedDate:e.getInternalValue(),dateChangeCallback:i=>{e.setInternalValue(i),r.closeModal()}}})),{title:"Meta Bind date picker"}).open()}openTextPromptModal(e){this.createModal(new ac((r,n)=>Vr(WM,{target:n,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),r.closeModal()},onCancel:()=>{e.onCancel(),r.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new ac((r,n)=>Vr(uu,{target:n,props:{settings:e}})),{title:"Meta Bind error overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,r){Vr(Xf,{target:e,props:{plugin:this.plugin,settings:r}})}};var h9=require("obsidian"),ex=class{constructor(){}setSearch(e){this.preparedSearch=(0,h9.prepareFuzzySearch)(e)}filterItems(e,r){return this.preparedSearch?e.filter(n=>this.preparedSearch?.(r(n))?.score!=null):e}};var Ta=require("obsidian");var il=class{constructor(e,r,n){this.value=e,this.displayValue=r,this.displayDescription=n}valueAsString(){return this.value?.toString()??"null"}};function g9(t){let e=[];for(let r of t.children)r instanceof Ta.TFile&&v9(r.extension)&&e.push(new il(r.path,r.name)),r instanceof Ta.TFolder&&e.push(...g9(r));return e}function Zoe(t,e,r){let n=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let s=new Hr({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 Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o;if(a===""||a==="."?o=r.app.vault.getRoot():o=r.app.vault.getAbstractFileByPath(a),o==null){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof Ta.TFolder)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(...g9(o))}for(let i of t){let a=ko(i.value);if(!a){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}let o=r.app.vault.getAbstractFileByPath(a);if(!o){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!(o instanceof Ta.TFile)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}if(!v9(o.extension)){let s=new Hr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Ta.Notice(`meta-bind | ${s.message}`),console.warn(s);continue}n.push(new il(o.path,o.name))}return n}function v9(t){return YM.contains(t)}function y9(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery");return Zoe(r,n,t)}var x9=require("obsidian");var tx=class extends x9.Modal{constructor(e,r,n){super(e.app),this.content=r,r.setModal(this),this.options=n}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 Hm=require("obsidian"),rx=class extends Hm.FuzzySuggestModal{constructor(e,r){super(e.app),this.content=r}renderSuggestion(e,r){(0,Hm.renderResults)(r.createDiv(),this.content.getItemText(e.item),e.match);let n=this.content.getItemDescription(e.item);n&&(0,Hm.renderResults)(r.createEl("small",{cls:"mb-search-modal-element-description"}),n,{score:0,matches:[]})}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,r){this.content.onSelected(e)}};var b9=require("obsidian");function Joe(t,e,r,n,i){let a=[];for(let o of r)a.push(new il(o.value,o.name,"option"));if(n.length>0){let o;try{o=p9(t)}catch(l){return new b9.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",l),a}let s=ve.object({name:ve.string().min(1),path:ve.string().min(1)});for(let l of n)o.pages(l.value,e).forEach(c=>{try{let f=c.file;if(!s.safeParse(f).success)return;let m=i9(f.path,f.name,i);a.push(new il(m,f.name,`file: ${f.path}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function w9(t,e){let r=e.mountable.getArguments("option"),n=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return Joe(t,e.mountable.getFilePath(),r,n,i===void 0?"true":i.value)}var _9=require("obsidian"),nx=class{constructor(){this.menu=new _9.Menu}setItems(e){for(let r of e)this.menu.addItem(n=>{n.setTitle(r.name),r.icon&&n.setIcon(r.icon),r.warning&&n.setWarning(r.warning),n.onClick(r.onclick)})}show(e,r){this.menu.showAtPosition({x:e,y:r},document)}showWithEvent(e){this.menu.showAtMouseEvent(e)}};var oc=require("obsidian");var ix=class{constructor(e){this.plugin=e}isExcludedFromRendering(e){for(let r of this.plugin.settings.excludedFolders)if(e.startsWith(r))return!0;return!1}};var ax=class extends ix{constructor(e){super(e),this.app=e.app}async read(e){let r=this.app.vault.getAbstractFileByPath(e);if(!r||!(r instanceof oc.TFile))throw new Error(`file not found: ${e}`);return this.app.vault.cachedRead(r)}async write(e,r){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.modify(n,r)}async exists(e){return this.app.vault.getFileByPath(e)!==null}async atomicModify(e,r){let n=this.app.vault.getFileByPath(e);if(!n)throw new Error(`file not found: ${e}`);await this.app.vault.process(n,i=>r(i))}async create(e,r,n,i){let a=this.app.vault.getAvailablePath((0,oc.normalizePath)(e+"/"+r),n),o=await this.app.vault.create(a,"");if(i){let s=this.app.workspace.getLeaf(!1);s&&await s.openFile(o,{state:{mode:"source"}})}return o.path}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof oc.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof oc.TFolder).map(e=>e.path)}open(e,r,n){this.app.workspace.openLinkText(e,r,n)}getPathByName(e,r=""){return this.app.metadataCache.getFirstLinkpathDest(e,r)?.path}};var Gm=require("obsidian");var ox=class{constructor(e,r,n,i,a){this.plugin=e,this.containerEl=r,this.code=i,this.hidden=a;let o=e.app.vault.getAbstractFileByPath(n);if(!(o instanceof Gm.TFile))throw new Error(`File not found: ${n}`);this.file=o,this.jsEngine=nl(this.plugin),this.renderComponent=new Gm.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 Gm.Component,this.renderComponent.load();let r=await this.evaluateCode(e),n=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);return this.hidden||await n.render(r.result),n.convertToSimpleObject(r.result)}catch(r){r instanceof Error&&(this.containerEl.innerText=r.message,mt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var sx=class extends Ky{constructor(e){super(e,new ax(e)),this.app=e.app}getLifecycleHookValidator(){return ve.instanceof(Mn.Component)}getImageSuggesterOptions(e){return y9(this.plugin,e)}getSuggesterOptions(e){return w9(this.plugin,e)}async renderMarkdown(e,r,n){let i=new Mn.Component;return i.load(),await Mn.MarkdownRenderer.render(this.app,e,r,n,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return nl(this.plugin),!0}catch{return!1}}async jsEngineRunFile(e,r,n,i){let a=nl(this.plugin),o=this.app.vault.getAbstractFileByPath(r);if(!o||!(o instanceof Mn.TFile))throw new Error(`calling file not found: ${r}`);let s=this.app.metadataCache.getFileCache(o),l=new Mn.Component;return await a.internal.executeFile(e,{component:l,container:i,context:{metadata:s,file:o,line:0},contextOverrides:n}),()=>l.unload()}async jsEngineRunCode(e,r,n,i){let a=nl(this.plugin),o=this.app.vault.getAbstractFileByPath(r);if(!o||!(o instanceof Mn.TFile))throw new Error(`calling file not found: ${r}`);let s=this.app.metadataCache.getFileCache(o),l=new Mn.Component;return await a.internal.execute({code:e,component:l,container:i,context:{metadata:s,file:o,line:0},contextOverrides:n}),()=>l.unload()}createJsRenderer(e,r,n,i){return new ox(this.plugin,e,r,n,i)}showNotice(e){new Mn.Notice(e)}parseYaml(e){return(0,Mn.parseYaml)(e)}stringifyYaml(e){return(0,Mn.stringifyYaml)(e)}setIcon(e,r){(0,Mn.setIcon)(e,r)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,r){return new tx(this.plugin,e,r)}createSearchModal(e){return new rx(this.plugin,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}createFuzzySearch(){return new ex}createContextMenu(e){let r=new nx;return r.setItems(e),r}async evaluateTemplaterTemplate(e,r){let n=TM(this.plugin),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof Mn.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(r);if(!a||!(a instanceof Mn.TFile))throw new Error(`Target file not found: ${r}`);let o=n.create_running_config(i,a,4);return await n.read_and_parse_template(o)}async createNoteWithTemplater(e,r,n,i){let a=TM(this.plugin),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof Mn.TFile))throw new Error(`Template file not found: ${e}`);let s;if(r!==void 0){let u=this.app.vault.getAbstractFileByPath(r);if(!u||!(u instanceof Mn.TFolder))throw new Error(`Folder not found: ${r}`);s=u}return(await a.create_new_note_from_template(o,s,n,i??!0))?.path}};var jM=require("obsidian");var ux=class extends xc{constructor(e,r,n){super(r,n),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 r=this.plugin.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof jM.TFile))throw new Gt({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let n=this.plugin.app.metadataCache.getFileCache(r)?.frontmatter;return structuredClone(n)??{}}getDefaultCacheItem(e){let r=this.plugin.app.vault.getAbstractFileByPath(e);if(r==null||!(r instanceof jM.TFile))throw new Gt({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let n=this.plugin.app.metadataCache.getFileCache(r)?.frontmatter;return{data:structuredClone(n)??{},storagePath:e,file:r,...this.manager.getDefaultCacheItem()}}syncExternal(e){this.plugin.app.fileManager.processFrontMatter(e.file,r=>{Object.assign(r,e.data)})}};var Wm=class extends mu{constructor(e,r){super(void 0),this.ctx=e,this.element=r}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};var A9=require("obsidian");function ZM(t,e){Te(e,!0);let r=new cf(e.plugin,Fr(),"","block",e.declaration);Iu(t,{mountable:r}),De()}var Xoe=ue('<div class="mb-card"><h3> </h3> <!> <!> <code> </code></div>');function JM(t,e){Te(e,!0);let r=e.plugin.api.createInlineFieldFromString(e.declaration.inputField,"",void 0,"block"),n=e.plugin.api.createInlineFieldFromString(e.declaration.declaration,"",void 0,"block");var i=Xoe(),a=ye(i),o=ye(a,!0);ce(a);var s=le(a,2);Iu(s,{mountable:r});var l=le(s,2);Iu(l,{mountable:n});var u=le(l,2),c=ye(u,!0);ce(u),ce(i),Re(()=>{ht(o,e.declaration.title),ht(c,e.declaration.display)}),ee(t,i),De()}var Qoe=ue("<h1>Meta Bind Playground</h1> <span><!> <!> <!></span>",1),Koe=ue(`<div class="mb-faq-view markdown-rendered"><!> <h2>Quick Reference</h2> <h3>Error Messages</h3> <p>When creating <a>Input Fields</a> or <a>View Fields</a> <strong>warnings</strong> ( <!> ) and <strong>errors</strong> ( <!> ) can occur. These are <strong>clickable</strong> and will show a modal with detailed information about the error
		when clicked.</p> <h3>Unloaded Message</h3> <p>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.</p> <p>Usually reopening the note or restarting Obsidian causes the field to display normally again.</p> <h3>Bind Targets</h3> <p><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>Input Fields</a> and <a>View Fields</a> to.</p> <h2>Playground</h2> <h3>Input Fields</h3> <p><a>Input Fields</a> let you change the frontmatter of your notes from inside
		of notes.</p> <!> <h3>View Fields</h3> <p><a>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.</p> <!></div>`);function XM(t,e){Te(e,!0);let r="INPUT[someInputFieldDeclaration]",n=Le(new Qt("exampleWarningErrorCollection")),i="INPUT[someInputFieldDeclaration]",a=Le(new Qt("exampleErrorErrorCollection"));t0(()=>{n.add(new sp({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),a.add(new sp({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"}))});var o=Koe(),s=ye(o);su(s,{children:(D,_)=>{var N=Qoe(),C=le(Je(N),2),B=ye(C);Et(B,{get variant(){return"primary"},onclick:()=>{jt.open(jt.linkToHome())},children:(L,P)=>{Nt();var k=lr("Docs");ee(L,k)},$$slots:{default:!0}});var R=le(B,2);Et(R,{onclick:()=>{jt.open(jt.linkToGithub())},children:(L,P)=>{Nt();var k=lr("GitHub");ee(L,k)},$$slots:{default:!0}});var V=le(R,2);Et(V,{onclick:()=>{jt.open(jt.linkToIssues())},children:(L,P)=>{Nt();var k=lr("Report Issue");ee(L,k)},$$slots:{default:!0}}),ce(C),ee(D,N)},$$slots:{default:!0}});var l=le(s,6),u=le(ye(l));Re(()=>wt(u,"href",jt.linkToInputFields()));var c=le(u,2);Re(()=>wt(c,"href",jt.linkToViewFields()));var f=le(c,4),m=Vt(()=>({errorCollection:n,code:r}));Xf(f,{get plugin(){return e.plugin},get settings(){return z(m)}});var p=le(f,4),d=Vt(()=>({errorCollection:a,code:i}));Xf(p,{get plugin(){return e.plugin},get settings(){return z(d)}}),Nt(3),ce(l);var h=le(l,10),x=le(ye(h),2);Re(()=>wt(x,"href",jt.linkToInputFields()));var b=le(x,2);Re(()=>wt(b,"href",jt.linkToViewFields())),Nt(),ce(h);var T=le(h,6),v=ye(T);Re(()=>wt(v,"href",jt.linkToInputFields())),Nt(),ce(T);var A=le(T,2);Yt(A,17,()=>mF(e.plugin),er,(D,_)=>{ZM(D,{get declaration(){return z(_)[1]},get plugin(){return e.plugin}})});var w=le(A,4),y=ye(w);Re(()=>wt(y,"href",jt.linkToViewFields())),Nt(),ce(w);var E=le(w,2);Yt(E,17,()=>Object.values(ab),er,(D,_)=>{var N=Xr(),C=Je(N);Yt(C,17,()=>z(_),er,(B,R)=>{JM(B,{get declaration(){return z(R)},get plugin(){return e.plugin}})}),ee(D,N)}),ce(o),ee(t,o),De()}var sc="mb-playground-view-type",lx=class extends A9.ItemView{constructor(e,r){super(e),this.plugin=r}getViewType(){return sc}getDisplayText(){return"Meta Bind playground"}async onOpen(){this.contentEl.empty(),this.component=Vr(XM,{target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component&&Ur(this.component)}};var hi=require("obsidian");var S9=require("obsidian");var jm=require("obsidian");var Ym=require("obsidian");var ese=ue("<span> </span> <!> <!> <!>",1),tse=ue('<div class="mb-card markdown-rendered"><!> <pre class="mb-pre"><code class="mb-none"> </code></pre></div>');function QM(t,e){Te(e,!0);let r=lt(e,"template",15);function n(){e.plugin.internal.openButtonBuilderModal({submitText:"Submit",config:li(r()),onOkay:c=>{r(c)}})}function i(){let c=(0,Ym.stringifyYaml)(li(r()));navigator.clipboard.writeText(c),new Ym.Notice("meta-bind | Copied to clipboard")}var a=tse(),o=ye(a);su(o,{stretchChildren:!0,children:(c,f)=>{var m=ese(),p=Je(m),d=ye(p,!0);ce(p);var h=le(p,2);Et(h,{onclick:()=>n(),get variant(){return"primary"},tooltip:"Edit",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"pen-line"})},$$slots:{default:!0}});var x=le(h,2);Et(x,{onclick:()=>i(),get variant(){return"default"},tooltip:"Copy",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"copy"})},$$slots:{default:!0}});var b=le(x,2);Et(b,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete",children:(T,v)=>{Yr(T,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),Re(()=>ht(d,r().id)),ee(c,m)},$$slots:{default:!0}});var s=le(o,2),l=ye(s),u=ye(l,!0);Re(()=>ht(u,(0,Ym.stringifyYaml)(r()))),ce(l),ce(s),ce(a),ee(t,a),De()}var rse=ue('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),nse=ue("<!> <!>",1),ise=ue("<div><h2>Meta Bind Button Templates</h2> <!> <!> <!> <!> <!></div>");function KM(t,e){Te(e,!0);let r=bt(void 0),n=bt(Le(e.buttonConfigs));function i(x){$e(n,Le(z(n).filter(b=>b!==x)))}function a(){z(n).push(e.modal.plugin.api.buttonActionRunner.createDefaultButtonConfig())}async function o(){let x;try{x=(0,jm.parseYaml)(await navigator.clipboard.readText())}catch(T){console.warn(T),new jm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let b=Lc.safeParse(x);if(!b.success){let T=py(b.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new Cs({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:T.message,docs:[jt.linkToButtonConfig()]})),console.warn(T),new jm.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}z(n).push(x)}function s(){$e(r,Le(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function l(){e.modal.close()}var u=ise(),c=le(ye(u),2);Yt(c,17,()=>z(n),er,(x,b,T)=>{QM(x,{get plugin(){return e.modal.plugin},onDelete:i,get template(){return z(n)[T]},set template(v){z(n)[T]=v}})});var f=le(c,2);Et(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create new template",children:(x,b)=>{Nt();var T=lr("Add Template");ee(x,T)},$$slots:{default:!0}});var m=le(f,2);Et(m,{onclick:()=>o(),get variant(){return"default"},tooltip:"Create new template from YAML in clipboard",children:(x,b)=>{Nt();var T=lr("Add Template from Clipboard");ee(x,T)},$$slots:{default:!0}});var p=le(m,2);{var d=x=>{var b=rse(),T=le(ye(b),2),v=Vt(()=>({errorCollection:z(r)}));uu(T,{get settings(){return z(v)}}),ce(b),ee(x,b)};ot(p,x=>{z(r)&&x(d)})}var h=le(p,2);Qo(h,{children:(x,b)=>{var T=nse(),v=Je(T);Et(v,{onclick:()=>s(),get variant(){return"primary"},tooltip:"Save changes",children:(w,y)=>{Nt();var E=lr("Save");ee(w,E)},$$slots:{default:!0}});var A=le(v,2);Et(A,{onclick:()=>l(),tooltip:"Revert changes",children:(w,y)=>{Nt();var E=lr("Cancel");ee(w,E)},$$slots:{default:!0}}),ee(x,T)},$$slots:{default:!0}}),ce(u),ee(t,u),De()}var cx=class extends S9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Ur(this.component),this.component=Vr(KM,{target:this.contentEl,props:{buttonConfigs:JN(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Ur(this.component)}save(e){let r=this.plugin.api.buttonManager.setButtonTemplates(e);if(r.hasErrors())return r;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var E9=require("obsidian");var ase=ue('<tr><td class="mb-excluded-folders-table-input-cell"><input type="text" placeholder="path/to/folder"></td><td><!></td></tr>'),ose=ue('<div><h3 class="mod-error">Some folder paths are invalid</h3> <!></div>'),sse=ue("<!> <!>",1),use=ue('<div><table class="mb-excluded-folders-table"><thead><tr><th>Folder Path</th><th></th></tr></thead><tbody></tbody></table> <!> <!> <!></div>');function eC(t,e){Te(e,!0);let r=bt(void 0),n=bt(Le(e.excludedFolders));function i(h){$e(n,Le(z(n).filter(x=>x!==h)))}function a(){z(n).push("")}function o(){$e(r,Le(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=use(),u=ye(l),c=le(ye(u));Yt(c,21,()=>z(n),er,(h,x,b)=>{var T=ase(),v=ye(T),A=ye(v);Tt(A),ce(v);var w=le(v),y=ye(w);Et(y,{onclick:()=>i(z(x)),tooltip:"Delete",children:(E,D)=>{Yr(E,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),ce(w),ce(T),_t(A,()=>z(n)[b],E=>z(n)[b]=E),ee(h,T)}),ce(c),ce(u);var f=le(u,2);Et(f,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Add new excluded folder",children:(h,x)=>{Nt();var b=lr("Add folder");ee(h,b)},$$slots:{default:!0}});var m=le(f,2);{var p=h=>{var x=ose(),b=le(ye(x),2),T=Vt(()=>({errorCollection:z(r)}));uu(b,{get settings(){return z(T)}}),ce(x),ee(h,x)};ot(m,h=>{z(r)&&h(p)})}var d=le(m,2);Qo(d,{children:(h,x)=>{var b=sse(),T=Je(b);Et(T,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save changes",children:(A,w)=>{Nt();var y=lr("Save");ee(A,y)},$$slots:{default:!0}});var v=le(T,2);Et(v,{onclick:()=>s(),tooltip:"Revert changes",children:(A,w)=>{Nt();var y=lr("Cancel");ee(A,y)},$$slots:{default:!0}}),ee(h,b)},$$slots:{default:!0}}),ce(l),ee(t,l),De()}var fx=class extends E9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Ur(this.component),this.component=Vr(eC,{target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this,plugin:this.plugin}})}onClose(){this.contentEl.empty(),this.component&&Ur(this.component)}save(e){for(let r of e)if(r===""){let n=new Qt("Excluded folders");return n.add(new Error(`Invalid Folder Path '${r}'. Folder path may not be empty.`)),n}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var T9=require("obsidian");var lse=ue('<input type="text" placeholder="template-name"> <!>',1),cse=ue('<div class="mb-card"><!> <textarea placeholder="INPUT[slider(addLabels)]" class="mb-textarea"></textarea></div>');function tC(t,e){Te(e,!0);let r=lt(e,"template",15);var n=cse(),i=ye(n);su(i,{children:(o,s)=>{var l=lse(),u=Je(l);Tt(u);var c=le(u,2);Et(c,{onclick:()=>e.onDelete(r()),get variant(){return"destructive"},tooltip:"Delete Template",children:(f,m)=>{Yr(f,{get plugin(){return e.plugin},iconName:"x"})},$$slots:{default:!0}}),_t(u,()=>r().name,f=>r(r().name=f,!0)),ee(o,l)},$$slots:{default:!0}});var a=le(i,2);On(a),ce(n),_t(a,()=>r().declaration,o=>r(r().declaration=o,!0)),ee(t,n),De()}var fse=ue('<div><h3 class="mod-error">Some Templates Failed to Parse</h3> <!></div>'),pse=ue("<!> <!>",1),mse=ue("<div><h2>Meta Bind Input Field Templates</h2> <!> <!> <!> <!></div>");function rC(t,e){Te(e,!0);let r=bt(void 0),n=bt(Le(e.inputFieldTemplates));function i(d){$e(n,Le(z(n).filter(h=>h!==d)))}function a(){z(n).push({name:"",declaration:""})}function o(){$e(r,Le(e.modal.save(li(z(n))))),z(r)===void 0&&e.modal.close()}function s(){e.modal.close()}var l=mse(),u=le(ye(l),2);Yt(u,17,()=>z(n),er,(d,h)=>{tC(d,{get plugin(){return e.modal.plugin},get template(){return z(h)},onDelete:i})});var c=le(u,2);Et(c,{onclick:()=>a(),get variant(){return"primary"},tooltip:"Create New Template",children:(d,h)=>{Nt();var x=lr("Add Template");ee(d,x)},$$slots:{default:!0}});var f=le(c,2);{var m=d=>{var h=fse(),x=le(ye(h),2),b=Vt(()=>({errorCollection:z(r)}));uu(x,{get settings(){return z(b)}}),ce(h),ee(d,h)};ot(f,d=>{z(r)&&d(m)})}var p=le(f,2);Qo(p,{children:(d,h)=>{var x=pse(),b=Je(x);Et(b,{onclick:()=>o(),get variant(){return"primary"},tooltip:"Save Changes",children:(v,A)=>{Nt();var w=lr("Save");ee(v,w)},$$slots:{default:!0}});var T=le(b,2);Et(T,{onclick:()=>s(),tooltip:"Revert Changes",children:(v,A)=>{Nt();var w=lr("Cancel");ee(v,w)},$$slots:{default:!0}}),ee(d,x)},$$slots:{default:!0}}),ce(l),ee(t,l),De()}var px=class extends T9.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){this.contentEl.empty(),this.component&&Ur(this.component),this.component=Vr(rC,{target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&Ur(this.component)}save(e){let r=this.plugin.api.inputFieldParser.parseTemplates(e);if(r.hasErrors())return r;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};var mx=class extends hi.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}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 r=new hi.ButtonComponent(e);r.setButtonText("Learn About Canary Builds"),r.setCta(),r.onClick(()=>{jt.open(jt.linkToCanaryBuilds())})}new hi.Setting(e).setName("Quick access").addButton(r=>{r.setCta(),r.setButtonText("Docs"),r.onClick(()=>{jt.open(jt.linkToHome())})}).addButton(r=>{r.setButtonText("Open FAQ"),r.onClick(()=>{this.plugin.activateView(sc)})}).addButton(r=>{r.setButtonText("GitHub"),r.onClick(()=>{jt.open(jt.linkToGithub())})}).addButton(r=>{r.setButtonText("Report issue"),r.onClick(()=>{jt.open(jt.linkToIssues())})}),new hi.Setting(e).setName("Enable syntax highlighting").setDesc("Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableSyntaxHighlighting),r.onChange(n=>{this.plugin.settings.enableSyntaxHighlighting=n,this.plugin.saveSettings()})}),new hi.Setting(e).setName("Enable editor right-click menu").setDesc("Enable a meta bind menu section in the editor right-click menu. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableEditorRightClickMenu),r.onChange(n=>{this.plugin.settings.enableEditorRightClickMenu=n,this.plugin.saveSettings()})}),new hi.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(r=>{r.setButtonText("Edit templates"),r.onClick(()=>{new px(this.app,this.plugin).open()})}),new hi.Setting(e).setName("Button templates").setDesc("You can specify button field templates here, and access them in inline buttons.").addButton(r=>{r.setButtonText("Edit templates"),r.onClick(()=>{new cx(this.app,this.plugin).open()})}),new hi.Setting(e).setName("Excluded folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(r=>{r.setButtonText("Edit excluded folders"),r.onClick(()=>{new fx(this.app,this.plugin).open()})}),new hi.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(r=>{r.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),r.onChange(n=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=n,this.plugin.saveSettings()})}),new hi.Setting(e).setName("Enable JavaScript").setDesc("Enable features that run user written JavaScript. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(r=>{r.setValue(this.plugin.settings.enableJs),r.onChange(n=>{this.plugin.settings.enableJs=n,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and time settings"}),new hi.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(r=>{r.setValue(this.plugin.settings.preferredDateFormat),r.onChange(n=>{this.plugin.settings.preferredDateFormat=n,this.plugin.saveSettings()})}),new hi.Setting(e).setName("First weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(r=>{for(let n of fl)r.addOption(n.name,n.name);r.setValue(this.plugin.settings.firstWeekday.name),r.onChange(n=>{this.plugin.settings.firstWeekday=fl.find(i=>i.name===n),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced settings"}),new hi.Setting(e).setName("Dev mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(r=>{r.setValue(this.plugin.settings.devMode),r.onChange(n=>{this.plugin.settings.devMode=n,this.plugin.saveSettings()})}),new hi.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(r=>{r.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),r.onChange(n=>{this.plugin.settings.ignoreCodeBlockRestrictions=n,this.plugin.saveSettings()})}),new hi.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: ${Po.syncInterval}; Minimum: ${Po.minSyncInterval}; Maximum: ${Po.maxSyncInterval}`).addText(r=>{r.setValue(this.plugin.settings.syncInterval.toString()),r.onChange(n=>{this.plugin.settings.syncInterval=Number.parseInt(n),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=Po.syncInterval),this.plugin.settings.syncInterval<Po.minSyncInterval&&(this.plugin.settings.syncInterval=Po.minSyncInterval),this.plugin.settings.syncInterval>Po.maxSyncInterval&&(this.plugin.settings.syncInterval=Po.maxSyncInterval),this.plugin.saveSettings()})})}};var nC=(n=>(n.DEV="dev",n.CANARY="canary",n.RELEASE="release",n))(nC||{}),dx=class extends hx.Plugin{async onload(){console.log("meta-bind | Main >> loading"),console.time("meta-bind | Main >> load-time"),this.build=this.determineBuild(),await this.loadSettings(),this.addSettingTab(new mx(this.app,this)),this.dependencyManager=new Ld(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Na(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Na(0,1,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new Na(2,2,3)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new Wy(this),this.internal=new sx(this),this.mountableManager=new Dd,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(fF(this)),this.addCommands(),lF(this),this.registerView(sc,e=>new lx(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,r)=>{vF(e,r,this)})),console.timeEnd("meta-bind | Main >> load-time"))}onunload(){console.log("meta-bind | Main >> unload"),this.mountableManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}setUpMetadataManager(){this.metadataManager=new Td,this.metadataManager.registerSource(new ux(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new fd("memory",this.metadataManager)),this.metadataManager.registerSource(new pd("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new md("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,r)=>{this.mountableManager.unloadFile(r),this.metadataManager.onStoragePathRenamed(r,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,r)=>{let n=e.querySelectorAll("code"),i=r.sourcePath;for(let a=0;a<n.length;a++){let o=n.item(a);if(o.hasClass("mb-none"))continue;let s=o.innerText,l=this.api.isInlineFieldDeclarationAndGetType(s);if(l===void 0)continue;let u=this.api.createInlineFieldOfTypeFromString(l,s,i,void 0);this.api.wrapInMDRC(u,o,r)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,r,n)=>{let i=r,a=e.trim(),o=n.sourcePath,s=this.api.isInlineFieldDeclarationAndGetType(a);if(s===void 0)return;let l=this.api.createInlineFieldOfTypeFromString(s,a,o,void 0,"block",new Wm(n,r));this.api.wrapInMDRC(l,i,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,r,n)=>{let i=this.api.createJsViewFieldMountable(n.sourcePath,{declaration:e});this.api.wrapInMDRC(i,r,n)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,r,n)=>{let i=this.api.createEmbedMountable(n.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,r,n)});for(let e=1;e<=ld;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(r,n,i)=>{let a=this.api.createEmbedMountable(i.sourcePath,{content:r,depth:e});this.api.wrapInMDRC(a,n,i)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,r,n)=>{let i=this.api.createButtonMountable(n.sourcePath,{declaration:e,isPreview:!1,position:new Wm(n,r)});this.api.wrapInMDRC(i,r,n)})}addCommands(){this.addCommand({id:"open-docs",name:"Open docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.addCommand({id:"open-playground",name:"Open playground",callback:()=>{this.activateView(sc)}}),this.addCommand({id:"open-help",name:"Open Help",callback:()=>{this.activateView(sc)}}),this.addCommand({id:"open-button-builder",name:"Open button builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,hx.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 r=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);r.hasErrors()&&console.warn("meta-bind | failed to parse button templates",r)}async loadSettings(){console.log("meta-bind | Main >> loading settings");let e=await this.loadData()??{};typeof e=="object"&&e!=null&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},Po,e),this.updateInternalSettings(),vd(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){oi.dateFormat=this.settings.preferredDateFormat,tF(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:r}=this.app,n,i=r.getLeavesOfType(e);i.length>0?n=i[0]:(n=r.getLeaf("tab"),await n.setViewState({type:e,active:!0})),r.revealLeaf(n)}};
/*! Bundled license information:

moment/moment.js:
  (*! moment.js *)
  (*! version : 2.30.1 *)
  (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
  (*! license : MIT *)
  (*! momentjs.com *)

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
   *)
*/

/* nosourcemap */