/*
-------------------------------------------
Meta Bind - Release Build
-------------------------------------------
By: Moritz Jung (https://www.moritzjung.dev/)
Time: Sat, 06 Jul 2024 18:45:27 GMT
Version: 1.1.3
-------------------------------------------
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
-------------------------------------------
Copyright (C) 2024 Moritz Jung
-------------------------------------------
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

"use strict";var nz=Object.create;var qf=Object.defineProperty;var iz=Object.getOwnPropertyDescriptor;var az=Object.getOwnPropertyNames;var oz=Object.getPrototypeOf,sz=Object.prototype.hasOwnProperty;var xn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),uz=(n,e)=>{for(var t in e)qf(n,t,{get:e[t],enumerable:!0})},xE=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of az(e))!sz.call(n,i)&&i!==t&&qf(n,i,{get:()=>e[i],enumerable:!(r=iz(e,i))||r.enumerable});return n};var wr=(n,e,t)=>(t=n!=null?nz(oz(n)):{},xE(e||!n||!n.__esModule?qf(t,"default",{value:n,enumerable:!0}):t,n)),lz=n=>xE(qf({},"__esModule",{value:!0}),n);var dc=xn((Pg,$u)=>{(function(n,e){typeof Pg=="object"&&typeof $u<"u"?$u.exports=e():typeof define=="function"&&define.amd?define(e):n.moment=e()})(Pg,function(){"use strict";var n;function e(){return n.apply(null,arguments)}function t(v){n=v}function r(v){return v instanceof Array||Object.prototype.toString.call(v)==="[object Array]"}function i(v){return v!=null&&Object.prototype.toString.call(v)==="[object Object]"}function a(v,M){return Object.prototype.hasOwnProperty.call(v,M)}function o(v){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(v).length===0;var M;for(M in v)if(a(v,M))return!1;return!0}function u(v){return v===void 0}function s(v){return typeof v=="number"||Object.prototype.toString.call(v)==="[object Number]"}function l(v){return v instanceof Date||Object.prototype.toString.call(v)==="[object Date]"}function c(v,M){var I=[],R,G=v.length;for(R=0;R<G;++R)I.push(M(v[R],R));return I}function f(v,M){for(var I in M)a(M,I)&&(v[I]=M[I]);return a(M,"toString")&&(v.toString=M.toString),a(M,"valueOf")&&(v.valueOf=M.valueOf),v}function p(v,M,I,R){return XM(v,M,I,R,!0).utc()}function m(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function h(v){return v._pf==null&&(v._pf=m()),v._pf}var d;Array.prototype.some?d=Array.prototype.some:d=function(v){var M=Object(this),I=M.length>>>0,R;for(R=0;R<I;R++)if(R in M&&v.call(this,M[R],R,M))return!0;return!1};function g(v){var M=null,I=!1,R=v._d&&!isNaN(v._d.getTime());if(R&&(M=h(v),I=d.call(M.parsedDateParts,function(G){return G!=null}),R=M.overflow<0&&!M.empty&&!M.invalidEra&&!M.invalidMonth&&!M.invalidWeekday&&!M.weekdayMismatch&&!M.nullInput&&!M.invalidFormat&&!M.userInvalidated&&(!M.meridiem||M.meridiem&&I),v._strict&&(R=R&&M.charsLeftOver===0&&M.unusedTokens.length===0&&M.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(v))v._isValid=R;else return R;return v._isValid}function y(v){var M=p(NaN);return v!=null?f(h(M),v):h(M).userInvalidated=!0,M}var S=e.momentProperties=[],b=!1;function w(v,M){var I,R,G,ce=S.length;if(u(M._isAMomentObject)||(v._isAMomentObject=M._isAMomentObject),u(M._i)||(v._i=M._i),u(M._f)||(v._f=M._f),u(M._l)||(v._l=M._l),u(M._strict)||(v._strict=M._strict),u(M._tzm)||(v._tzm=M._tzm),u(M._isUTC)||(v._isUTC=M._isUTC),u(M._offset)||(v._offset=M._offset),u(M._pf)||(v._pf=h(M)),u(M._locale)||(v._locale=M._locale),ce>0)for(I=0;I<ce;I++)R=S[I],G=M[R],u(G)||(v[R]=G);return v}function A(v){w(this,v),this._d=new Date(v._d!=null?v._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),b===!1&&(b=!0,e.updateOffset(this),b=!1)}function x(v){return v instanceof A||v!=null&&v._isAMomentObject!=null}function D(v){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+v)}function E(v,M){var I=!0;return f(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,v),I){var R=[],G,ce,Oe,gt=arguments.length;for(ce=0;ce<gt;ce++){if(G="",typeof arguments[ce]=="object"){G+=`
[`+ce+"] ";for(Oe in arguments[0])a(arguments[0],Oe)&&(G+=Oe+": "+arguments[0][Oe]+", ");G=G.slice(0,-2)}else G=arguments[ce];R.push(G)}D(v+`
Arguments: `+Array.prototype.slice.call(R).join("")+`
`+new Error().stack),I=!1}return M.apply(this,arguments)},M)}var _={};function N(v,M){e.deprecationHandler!=null&&e.deprecationHandler(v,M),_[v]||(D(M),_[v]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function P(v){return typeof Function<"u"&&v instanceof Function||Object.prototype.toString.call(v)==="[object Function]"}function B(v){var M,I;for(I in v)a(v,I)&&(M=v[I],P(M)?this[I]=M:this["_"+I]=M);this._config=v,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function V(v,M){var I=f({},v),R;for(R in M)a(M,R)&&(i(v[R])&&i(M[R])?(I[R]={},f(I[R],v[R]),f(I[R],M[R])):M[R]!=null?I[R]=M[R]:delete I[R]);for(R in v)a(v,R)&&!a(M,R)&&i(v[R])&&(I[R]=f({},I[R]));return I}function z(v){v!=null&&this.set(v)}var L;Object.keys?L=Object.keys:L=function(v){var M,I=[];for(M in v)a(v,M)&&I.push(M);return I};var k={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function C(v,M,I){var R=this._calendar[v]||this._calendar.sameElse;return P(R)?R.call(M,I):R}function W(v,M,I){var R=""+Math.abs(v),G=M-R.length,ce=v>=0;return(ce?I?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+R}var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,H=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Z={},Q={};function U(v,M,I,R){var G=R;typeof R=="string"&&(G=function(){return this[R]()}),v&&(Q[v]=G),M&&(Q[M[0]]=function(){return W(G.apply(this,arguments),M[1],M[2])}),I&&(Q[I]=function(){return this.localeData().ordinal(G.apply(this,arguments),v)})}function me(v){return v.match(/\[[\s\S]/)?v.replace(/^\[|\]$/g,""):v.replace(/\\/g,"")}function De(v){var M=v.match(O),I,R;for(I=0,R=M.length;I<R;I++)Q[M[I]]?M[I]=Q[M[I]]:M[I]=me(M[I]);return function(G){var ce="",Oe;for(Oe=0;Oe<R;Oe++)ce+=P(M[Oe])?M[Oe].call(G,v):M[Oe];return ce}}function pe(v,M){return v.isValid()?(M=_e(M,v.localeData()),Z[M]=Z[M]||De(M),Z[M](v)):v.localeData().invalidDate()}function _e(v,M){var I=5;function R(G){return M.longDateFormat(G)||G}for(H.lastIndex=0;I>=0&&H.test(v);)v=v.replace(H,R),H.lastIndex=0,I-=1;return v}var Ne={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Se(v){var M=this._longDateFormat[v],I=this._longDateFormat[v.toUpperCase()];return M||!I?M:(this._longDateFormat[v]=I.match(O).map(function(R){return R==="MMMM"||R==="MM"||R==="DD"||R==="dddd"?R.slice(1):R}).join(""),this._longDateFormat[v])}var Me="Invalid date";function Ee(){return this._invalidDate}var Ce="%d",Ge=/\d{1,2}/;function We(v){return this._ordinal.replace("%d",v)}var te={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function oe(v,M,I,R){var G=this._relativeTime[I];return P(G)?G(v,M,I,R):G.replace(/%d/i,v)}function he(v,M){var I=this._relativeTime[v>0?"future":"past"];return P(I)?I(M):I.replace(/%s/i,M)}var ie={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function re(v){return typeof v=="string"?ie[v]||ie[v.toLowerCase()]:void 0}function le(v){var M={},I,R;for(R in v)a(v,R)&&(I=re(R),I&&(M[I]=v[R]));return M}var Te={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Ie(v){var M=[],I;for(I in v)a(v,I)&&M.push({unit:I,priority:Te[I]});return M.sort(function(R,G){return R.priority-G.priority}),M}var Ze=/\d/,xe=/\d\d/,ht=/\d{3}/,Nt=/\d{4}/,Ht=/[+-]?\d{6}/,Et=/\d\d?/,ae=/\d\d\d\d?/,de=/\d\d\d\d\d\d?/,ge=/\d{1,3}/,qe=/\d{1,4}/,$e=/[+-]?\d{1,6}/,Re=/\d+/,ze=/[+-]?\d+/,Xe=/Z|[+-]\d\d:?\d\d/gi,F=/Z|[+-]\d\d(?::?\d\d)?/gi,X=/[+-]?\d+(\.\d{1,3})?/,Ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Le=/^[1-9]\d?/,ft=/^([1-9]\d|\d)/,St;St={};function Ye(v,M,I){St[v]=P(M)?M:function(R,G){return R&&I?I:M}}function kn(v,M){return a(St,v)?St[v](M._strict,M._locale):new RegExp(ci(v))}function ci(v){return Wr(v.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(M,I,R,G,ce){return I||R||G||ce}))}function Wr(v){return v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Dn(v){return v<0?Math.ceil(v)||0:Math.floor(v)}function ur(v){var M=+v,I=0;return M!==0&&isFinite(M)&&(I=Dn(M)),I}var zo={};function Sr(v,M){var I,R=M,G;for(typeof v=="string"&&(v=[v]),s(M)&&(R=function(ce,Oe){Oe[M]=ur(ce)}),G=v.length,I=0;I<G;I++)zo[v[I]]=R}function xi(v,M){Sr(v,function(I,R,G,ce){G._w=G._w||{},M(I,G._w,G,ce)})}function ea(v,M,I){M!=null&&a(zo,v)&&zo[v](M,I._a,I,v)}function Bi(v){return v%4===0&&v%100!==0||v%400===0}var dn=0,Nn=1,wi=2,Kr=3,Bn=4,hn=5,_i=6,rc=7,Fu=8;U("Y",0,0,function(){var v=this.year();return v<=9999?W(v,4):"+"+v}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),Ye("Y",ze),Ye("YY",Et,xe),Ye("YYYY",qe,Nt),Ye("YYYYY",$e,Ht),Ye("YYYYYY",$e,Ht),Sr(["YYYYY","YYYYYY"],dn),Sr("YYYY",function(v,M){M[dn]=v.length===2?e.parseTwoDigitYear(v):ur(v)}),Sr("YY",function(v,M){M[dn]=e.parseTwoDigitYear(v)}),Sr("Y",function(v,M){M[dn]=parseInt(v,10)});function uo(v){return Bi(v)?366:365}e.parseTwoDigitYear=function(v){return ur(v)+(ur(v)>68?1900:2e3)};var lo=za("FullYear",!0);function Iu(){return Bi(this.year())}function za(v,M){return function(I){return I!=null?(Pu(this,v,I),e.updateOffset(this,M),this):ba(this,v)}}function ba(v,M){if(!v.isValid())return NaN;var I=v._d,R=v._isUTC;switch(M){case"Milliseconds":return R?I.getUTCMilliseconds():I.getMilliseconds();case"Seconds":return R?I.getUTCSeconds():I.getSeconds();case"Minutes":return R?I.getUTCMinutes():I.getMinutes();case"Hours":return R?I.getUTCHours():I.getHours();case"Date":return R?I.getUTCDate():I.getDate();case"Day":return R?I.getUTCDay():I.getDay();case"Month":return R?I.getUTCMonth():I.getMonth();case"FullYear":return R?I.getUTCFullYear():I.getFullYear();default:return NaN}}function Pu(v,M,I){var R,G,ce,Oe,gt;if(!(!v.isValid()||isNaN(I))){switch(R=v._d,G=v._isUTC,M){case"Milliseconds":return void(G?R.setUTCMilliseconds(I):R.setMilliseconds(I));case"Seconds":return void(G?R.setUTCSeconds(I):R.setSeconds(I));case"Minutes":return void(G?R.setUTCMinutes(I):R.setMinutes(I));case"Hours":return void(G?R.setUTCHours(I):R.setHours(I));case"Date":return void(G?R.setUTCDate(I):R.setDate(I));case"FullYear":break;default:return}ce=I,Oe=v.month(),gt=v.date(),gt=gt===29&&Oe===1&&!Bi(ce)?28:gt,G?R.setUTCFullYear(ce,Oe,gt):R.setFullYear(ce,Oe,gt)}}function ku(v){return v=re(v),P(this[v])?this[v]():this}function nc(v,M){if(typeof v=="object"){v=le(v);var I=Ie(v),R,G=I.length;for(R=0;R<G;R++)this[I[R].unit](v[I[R].unit])}else if(v=re(v),P(this[v]))return this[v](M);return this}function ic(v,M){return(v%M+M)%M}var Yr;Array.prototype.indexOf?Yr=Array.prototype.indexOf:Yr=function(v){var M;for(M=0;M<this.length;++M)if(this[M]===v)return M;return-1};function $(v,M){if(isNaN(v)||isNaN(M))return NaN;var I=ic(M,12);return v+=(M-I)/12,I===1?Bi(v)?29:28:31-I%7%2}U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(v){return this.localeData().monthsShort(this,v)}),U("MMMM",0,0,function(v){return this.localeData().months(this,v)}),Ye("M",Et,Le),Ye("MM",Et,xe),Ye("MMM",function(v,M){return M.monthsShortRegex(v)}),Ye("MMMM",function(v,M){return M.monthsRegex(v)}),Sr(["M","MM"],function(v,M){M[Nn]=ur(v)-1}),Sr(["MMM","MMMM"],function(v,M,I,R){var G=I._locale.monthsParse(v,R,I._strict);G!=null?M[Nn]=G:h(I).invalidMonth=v});var ue="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ve="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),at=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,et=Ae,Vt=Ae;function Ar(v,M){return v?r(this._months)?this._months[v.month()]:this._months[(this._months.isFormat||at).test(M)?"format":"standalone"][v.month()]:r(this._months)?this._months:this._months.standalone}function yn(v,M){return v?r(this._monthsShort)?this._monthsShort[v.month()]:this._monthsShort[at.test(M)?"format":"standalone"][v.month()]:r(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function bn(v,M,I){var R,G,ce,Oe=v.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],R=0;R<12;++R)ce=p([2e3,R]),this._shortMonthsParse[R]=this.monthsShort(ce,"").toLocaleLowerCase(),this._longMonthsParse[R]=this.months(ce,"").toLocaleLowerCase();return I?M==="MMM"?(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:null):(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:null):M==="MMM"?(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:null)):(G=Yr.call(this._longMonthsParse,Oe),G!==-1?G:(G=Yr.call(this._shortMonthsParse,Oe),G!==-1?G:null))}function co(v,M,I){var R,G,ce;if(this._monthsParseExact)return bn.call(this,v,M,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),R=0;R<12;R++){if(G=p([2e3,R]),I&&!this._longMonthsParse[R]&&(this._longMonthsParse[R]=new RegExp("^"+this.months(G,"").replace(".","")+"$","i"),this._shortMonthsParse[R]=new RegExp("^"+this.monthsShort(G,"").replace(".","")+"$","i")),!I&&!this._monthsParse[R]&&(ce="^"+this.months(G,"")+"|^"+this.monthsShort(G,""),this._monthsParse[R]=new RegExp(ce.replace(".",""),"i")),I&&M==="MMMM"&&this._longMonthsParse[R].test(v))return R;if(I&&M==="MMM"&&this._shortMonthsParse[R].test(v))return R;if(!I&&this._monthsParse[R].test(v))return R}}function VM(v,M){if(!v.isValid())return v;if(typeof M=="string"){if(/^\d+$/.test(M))M=ur(M);else if(M=v.localeData().monthsParse(M),!s(M))return v}var I=M,R=v.date();return R=R<29?R:Math.min(R,$(v.year(),I)),v._isUTC?v._d.setUTCMonth(I,R):v._d.setMonth(I,R),v}function UM(v){return v!=null?(VM(this,v),e.updateOffset(this,!0),this):ba(this,"Month")}function U6(){return $(this.year(),this.month())}function q6(v){return this._monthsParseExact?(a(this,"_monthsRegex")||qM.call(this),v?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=et),this._monthsShortStrictRegex&&v?this._monthsShortStrictRegex:this._monthsShortRegex)}function z6(v){return this._monthsParseExact?(a(this,"_monthsRegex")||qM.call(this),v?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Vt),this._monthsStrictRegex&&v?this._monthsStrictRegex:this._monthsRegex)}function qM(){function v(Wt,hr){return hr.length-Wt.length}var M=[],I=[],R=[],G,ce,Oe,gt;for(G=0;G<12;G++)ce=p([2e3,G]),Oe=Wr(this.monthsShort(ce,"")),gt=Wr(this.months(ce,"")),M.push(Oe),I.push(gt),R.push(gt),R.push(Oe);M.sort(v),I.sort(v),R.sort(v),this._monthsRegex=new RegExp("^("+R.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+M.join("|")+")","i")}function $6(v,M,I,R,G,ce,Oe){var gt;return v<100&&v>=0?(gt=new Date(v+400,M,I,R,G,ce,Oe),isFinite(gt.getFullYear())&&gt.setFullYear(v)):gt=new Date(v,M,I,R,G,ce,Oe),gt}function ac(v){var M,I;return v<100&&v>=0?(I=Array.prototype.slice.call(arguments),I[0]=v+400,M=new Date(Date.UTC.apply(null,I)),isFinite(M.getUTCFullYear())&&M.setUTCFullYear(v)):M=new Date(Date.UTC.apply(null,arguments)),M}function Cf(v,M,I){var R=7+M-I,G=(7+ac(v,0,R).getUTCDay()-M)%7;return-G+R-1}function zM(v,M,I,R,G){var ce=(7+I-R)%7,Oe=Cf(v,R,G),gt=1+7*(M-1)+ce+Oe,Wt,hr;return gt<=0?(Wt=v-1,hr=uo(Wt)+gt):gt>uo(v)?(Wt=v+1,hr=gt-uo(v)):(Wt=v,hr=gt),{year:Wt,dayOfYear:hr}}function oc(v,M,I){var R=Cf(v.year(),M,I),G=Math.floor((v.dayOfYear()-R-1)/7)+1,ce,Oe;return G<1?(Oe=v.year()-1,ce=G+fo(Oe,M,I)):G>fo(v.year(),M,I)?(ce=G-fo(v.year(),M,I),Oe=v.year()+1):(Oe=v.year(),ce=G),{week:ce,year:Oe}}function fo(v,M,I){var R=Cf(v,M,I),G=Cf(v+1,M,I);return(uo(v)-R+G)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),Ye("w",Et,Le),Ye("ww",Et,xe),Ye("W",Et,Le),Ye("WW",Et,xe),xi(["w","ww","W","WW"],function(v,M,I,R){M[R.substr(0,1)]=ur(v)});function H6(v){return oc(v,this._week.dow,this._week.doy).week}var G6={dow:0,doy:6};function W6(){return this._week.dow}function Y6(){return this._week.doy}function j6(v){var M=this.localeData().week(this);return v==null?M:this.add((v-M)*7,"d")}function Z6(v){var M=oc(this,1,4).week;return v==null?M:this.add((v-M)*7,"d")}U("d",0,"do","day"),U("dd",0,0,function(v){return this.localeData().weekdaysMin(this,v)}),U("ddd",0,0,function(v){return this.localeData().weekdaysShort(this,v)}),U("dddd",0,0,function(v){return this.localeData().weekdays(this,v)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),Ye("d",Et),Ye("e",Et),Ye("E",Et),Ye("dd",function(v,M){return M.weekdaysMinRegex(v)}),Ye("ddd",function(v,M){return M.weekdaysShortRegex(v)}),Ye("dddd",function(v,M){return M.weekdaysRegex(v)}),xi(["dd","ddd","dddd"],function(v,M,I,R){var G=I._locale.weekdaysParse(v,R,I._strict);G!=null?M.d=G:h(I).invalidWeekday=v}),xi(["d","e","E"],function(v,M,I,R){M[R]=ur(v)});function J6(v,M){return typeof v!="string"?v:isNaN(v)?(v=M.weekdaysParse(v),typeof v=="number"?v:null):parseInt(v,10)}function X6(v,M){return typeof v=="string"?M.weekdaysParse(v)%7||7:isNaN(v)?null:v}function pg(v,M){return v.slice(M,7).concat(v.slice(0,M))}var Q6="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),$M="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),K6="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),eq=Ae,tq=Ae,rq=Ae;function nq(v,M){var I=r(this._weekdays)?this._weekdays:this._weekdays[v&&v!==!0&&this._weekdays.isFormat.test(M)?"format":"standalone"];return v===!0?pg(I,this._week.dow):v?I[v.day()]:I}function iq(v){return v===!0?pg(this._weekdaysShort,this._week.dow):v?this._weekdaysShort[v.day()]:this._weekdaysShort}function aq(v){return v===!0?pg(this._weekdaysMin,this._week.dow):v?this._weekdaysMin[v.day()]:this._weekdaysMin}function oq(v,M,I){var R,G,ce,Oe=v.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],R=0;R<7;++R)ce=p([2e3,1]).day(R),this._minWeekdaysParse[R]=this.weekdaysMin(ce,"").toLocaleLowerCase(),this._shortWeekdaysParse[R]=this.weekdaysShort(ce,"").toLocaleLowerCase(),this._weekdaysParse[R]=this.weekdays(ce,"").toLocaleLowerCase();return I?M==="dddd"?(G=Yr.call(this._weekdaysParse,Oe),G!==-1?G:null):M==="ddd"?(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1?G:null):(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null):M==="dddd"?(G=Yr.call(this._weekdaysParse,Oe),G!==-1||(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null)):M==="ddd"?(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1||(G=Yr.call(this._weekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1?G:null)):(G=Yr.call(this._minWeekdaysParse,Oe),G!==-1||(G=Yr.call(this._weekdaysParse,Oe),G!==-1)?G:(G=Yr.call(this._shortWeekdaysParse,Oe),G!==-1?G:null))}function sq(v,M,I){var R,G,ce;if(this._weekdaysParseExact)return oq.call(this,v,M,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),R=0;R<7;R++){if(G=p([2e3,1]).day(R),I&&!this._fullWeekdaysParse[R]&&(this._fullWeekdaysParse[R]=new RegExp("^"+this.weekdays(G,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[R]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[R]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[R]||(ce="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[R]=new RegExp(ce.replace(".",""),"i")),I&&M==="dddd"&&this._fullWeekdaysParse[R].test(v))return R;if(I&&M==="ddd"&&this._shortWeekdaysParse[R].test(v))return R;if(I&&M==="dd"&&this._minWeekdaysParse[R].test(v))return R;if(!I&&this._weekdaysParse[R].test(v))return R}}function uq(v){if(!this.isValid())return v!=null?this:NaN;var M=ba(this,"Day");return v!=null?(v=J6(v,this.localeData()),this.add(v-M,"d")):M}function lq(v){if(!this.isValid())return v!=null?this:NaN;var M=(this.day()+7-this.localeData()._week.dow)%7;return v==null?M:this.add(v-M,"d")}function cq(v){if(!this.isValid())return v!=null?this:NaN;if(v!=null){var M=X6(v,this.localeData());return this.day(this.day()%7?M:M-7)}else return this.day()||7}function fq(v){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||mg.call(this),v?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=eq),this._weekdaysStrictRegex&&v?this._weekdaysStrictRegex:this._weekdaysRegex)}function pq(v){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||mg.call(this),v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=tq),this._weekdaysShortStrictRegex&&v?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function mq(v){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||mg.call(this),v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=rq),this._weekdaysMinStrictRegex&&v?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function mg(){function v(fi,vo){return vo.length-fi.length}var M=[],I=[],R=[],G=[],ce,Oe,gt,Wt,hr;for(ce=0;ce<7;ce++)Oe=p([2e3,1]).day(ce),gt=Wr(this.weekdaysMin(Oe,"")),Wt=Wr(this.weekdaysShort(Oe,"")),hr=Wr(this.weekdays(Oe,"")),M.push(gt),I.push(Wt),R.push(hr),G.push(gt),G.push(Wt),G.push(hr);M.sort(v),I.sort(v),R.sort(v),G.sort(v),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+R.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+M.join("|")+")","i")}function dg(){return this.hours()%12||12}function dq(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,dg),U("k",["kk",2],0,dq),U("hmm",0,0,function(){return""+dg.apply(this)+W(this.minutes(),2)}),U("hmmss",0,0,function(){return""+dg.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 HM(v,M){U(v,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),M)})}HM("a",!0),HM("A",!1);function GM(v,M){return M._meridiemParse}Ye("a",GM),Ye("A",GM),Ye("H",Et,ft),Ye("h",Et,Le),Ye("k",Et,Le),Ye("HH",Et,xe),Ye("hh",Et,xe),Ye("kk",Et,xe),Ye("hmm",ae),Ye("hmmss",de),Ye("Hmm",ae),Ye("Hmmss",de),Sr(["H","HH"],Kr),Sr(["k","kk"],function(v,M,I){var R=ur(v);M[Kr]=R===24?0:R}),Sr(["a","A"],function(v,M,I){I._isPm=I._locale.isPM(v),I._meridiem=v}),Sr(["h","hh"],function(v,M,I){M[Kr]=ur(v),h(I).bigHour=!0}),Sr("hmm",function(v,M,I){var R=v.length-2;M[Kr]=ur(v.substr(0,R)),M[Bn]=ur(v.substr(R)),h(I).bigHour=!0}),Sr("hmmss",function(v,M,I){var R=v.length-4,G=v.length-2;M[Kr]=ur(v.substr(0,R)),M[Bn]=ur(v.substr(R,2)),M[hn]=ur(v.substr(G)),h(I).bigHour=!0}),Sr("Hmm",function(v,M,I){var R=v.length-2;M[Kr]=ur(v.substr(0,R)),M[Bn]=ur(v.substr(R))}),Sr("Hmmss",function(v,M,I){var R=v.length-4,G=v.length-2;M[Kr]=ur(v.substr(0,R)),M[Bn]=ur(v.substr(R,2)),M[hn]=ur(v.substr(G))});function hq(v){return(v+"").toLowerCase().charAt(0)==="p"}var gq=/[ap]\.?m?\.?/i,vq=za("Hours",!0);function yq(v,M,I){return v>11?I?"pm":"PM":I?"am":"AM"}var WM={calendar:k,longDateFormat:Ne,invalidDate:Me,ordinal:Ce,dayOfMonthOrdinalParse:Ge,relativeTime:te,months:ue,monthsShort:Ve,week:G6,weekdays:Q6,weekdaysMin:K6,weekdaysShort:$M,meridiemParse:gq},en={},sc={},uc;function bq(v,M){var I,R=Math.min(v.length,M.length);for(I=0;I<R;I+=1)if(v[I]!==M[I])return I;return R}function YM(v){return v&&v.toLowerCase().replace("_","-")}function xq(v){for(var M=0,I,R,G,ce;M<v.length;){for(ce=YM(v[M]).split("-"),I=ce.length,R=YM(v[M+1]),R=R?R.split("-"):null;I>0;){if(G=Ff(ce.slice(0,I).join("-")),G)return G;if(R&&R.length>=I&&bq(ce,R)>=I-1)break;I--}M++}return uc}function wq(v){return!!(v&&v.match("^[^/\\\\]*$"))}function Ff(v){var M=null,I;if(en[v]===void 0&&typeof $u<"u"&&$u&&$u.exports&&wq(v))try{M=uc._abbr,I=require,I("./locale/"+v),$o(M)}catch{en[v]=null}return en[v]}function $o(v,M){var I;return v&&(u(M)?I=po(v):I=hg(v,M),I?uc=I:typeof console<"u"&&console.warn&&console.warn("Locale "+v+" not found. Did you forget to load it?")),uc._abbr}function hg(v,M){if(M!==null){var I,R=WM;if(M.abbr=v,en[v]!=null)N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),R=en[v]._config;else if(M.parentLocale!=null)if(en[M.parentLocale]!=null)R=en[M.parentLocale]._config;else if(I=Ff(M.parentLocale),I!=null)R=I._config;else return sc[M.parentLocale]||(sc[M.parentLocale]=[]),sc[M.parentLocale].push({name:v,config:M}),null;return en[v]=new z(V(R,M)),sc[v]&&sc[v].forEach(function(G){hg(G.name,G.config)}),$o(v),en[v]}else return delete en[v],null}function _q(v,M){if(M!=null){var I,R,G=WM;en[v]!=null&&en[v].parentLocale!=null?en[v].set(V(en[v]._config,M)):(R=Ff(v),R!=null&&(G=R._config),M=V(G,M),R==null&&(M.abbr=v),I=new z(M),I.parentLocale=en[v],en[v]=I),$o(v)}else en[v]!=null&&(en[v].parentLocale!=null?(en[v]=en[v].parentLocale,v===$o()&&$o(v)):en[v]!=null&&delete en[v]);return en[v]}function po(v){var M;if(v&&v._locale&&v._locale._abbr&&(v=v._locale._abbr),!v)return uc;if(!r(v)){if(M=Ff(v),M)return M;v=[v]}return xq(v)}function Sq(){return L(en)}function gg(v){var M,I=v._a;return I&&h(v).overflow===-2&&(M=I[Nn]<0||I[Nn]>11?Nn:I[wi]<1||I[wi]>$(I[dn],I[Nn])?wi:I[Kr]<0||I[Kr]>24||I[Kr]===24&&(I[Bn]!==0||I[hn]!==0||I[_i]!==0)?Kr:I[Bn]<0||I[Bn]>59?Bn:I[hn]<0||I[hn]>59?hn:I[_i]<0||I[_i]>999?_i:-1,h(v)._overflowDayOfYear&&(M<dn||M>wi)&&(M=wi),h(v)._overflowWeeks&&M===-1&&(M=rc),h(v)._overflowWeekday&&M===-1&&(M=Fu),h(v).overflow=M),v}var Aq=/^\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=/^\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)?)?$/,Eq=/Z|[+-]\d\d(?::?\d\d)?/,If=[["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]],vg=[["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,Nq=/^(?:(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}))$/,Tq={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 jM(v){var M,I,R=v._i,G=Aq.exec(R)||Mq.exec(R),ce,Oe,gt,Wt,hr=If.length,fi=vg.length;if(G){for(h(v).iso=!0,M=0,I=hr;M<I;M++)if(If[M][1].exec(G[1])){Oe=If[M][0],ce=If[M][2]!==!1;break}if(Oe==null){v._isValid=!1;return}if(G[3]){for(M=0,I=fi;M<I;M++)if(vg[M][1].exec(G[3])){gt=(G[2]||" ")+vg[M][0];break}if(gt==null){v._isValid=!1;return}}if(!ce&&gt!=null){v._isValid=!1;return}if(G[4])if(Eq.exec(G[4]))Wt="Z";else{v._isValid=!1;return}v._f=Oe+(gt||"")+(Wt||""),bg(v)}else v._isValid=!1}function Cq(v,M,I,R,G,ce){var Oe=[Fq(v),Ve.indexOf(M),parseInt(I,10),parseInt(R,10),parseInt(G,10)];return ce&&Oe.push(parseInt(ce,10)),Oe}function Fq(v){var M=parseInt(v,10);return M<=49?2e3+M:M<=999?1900+M:M}function Iq(v){return v.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Pq(v,M,I){if(v){var R=$M.indexOf(v),G=new Date(M[0],M[1],M[2]).getDay();if(R!==G)return h(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function kq(v,M,I){if(v)return Tq[v];if(M)return 0;var R=parseInt(I,10),G=R%100,ce=(R-G)/100;return ce*60+G}function ZM(v){var M=Nq.exec(Iq(v._i)),I;if(M){if(I=Cq(M[4],M[3],M[2],M[5],M[6],M[7]),!Pq(M[1],I,v))return;v._a=I,v._tzm=kq(M[8],M[9],M[10]),v._d=ac.apply(null,v._a),v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),h(v).rfc2822=!0}else v._isValid=!1}function Bq(v){var M=Dq.exec(v._i);if(M!==null){v._d=new Date(+M[1]);return}if(jM(v),v._isValid===!1)delete v._isValid;else return;if(ZM(v),v._isValid===!1)delete v._isValid;else return;v._strict?v._isValid=!1:e.createFromInputFallback(v)}e.createFromInputFallback=E("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(v){v._d=new Date(v._i+(v._useUTC?" UTC":""))});function Bu(v,M,I){return v??M??I}function Oq(v){var M=new Date(e.now());return v._useUTC?[M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()]:[M.getFullYear(),M.getMonth(),M.getDate()]}function yg(v){var M,I,R=[],G,ce,Oe;if(!v._d){for(G=Oq(v),v._w&&v._a[wi]==null&&v._a[Nn]==null&&Rq(v),v._dayOfYear!=null&&(Oe=Bu(v._a[dn],G[dn]),(v._dayOfYear>uo(Oe)||v._dayOfYear===0)&&(h(v)._overflowDayOfYear=!0),I=ac(Oe,0,v._dayOfYear),v._a[Nn]=I.getUTCMonth(),v._a[wi]=I.getUTCDate()),M=0;M<3&&v._a[M]==null;++M)v._a[M]=R[M]=G[M];for(;M<7;M++)v._a[M]=R[M]=v._a[M]==null?M===2?1:0:v._a[M];v._a[Kr]===24&&v._a[Bn]===0&&v._a[hn]===0&&v._a[_i]===0&&(v._nextDay=!0,v._a[Kr]=0),v._d=(v._useUTC?ac:$6).apply(null,R),ce=v._useUTC?v._d.getUTCDay():v._d.getDay(),v._tzm!=null&&v._d.setUTCMinutes(v._d.getUTCMinutes()-v._tzm),v._nextDay&&(v._a[Kr]=24),v._w&&typeof v._w.d<"u"&&v._w.d!==ce&&(h(v).weekdayMismatch=!0)}}function Rq(v){var M,I,R,G,ce,Oe,gt,Wt,hr;M=v._w,M.GG!=null||M.W!=null||M.E!=null?(ce=1,Oe=4,I=Bu(M.GG,v._a[dn],oc(jr(),1,4).year),R=Bu(M.W,1),G=Bu(M.E,1),(G<1||G>7)&&(Wt=!0)):(ce=v._locale._week.dow,Oe=v._locale._week.doy,hr=oc(jr(),ce,Oe),I=Bu(M.gg,v._a[dn],hr.year),R=Bu(M.w,hr.week),M.d!=null?(G=M.d,(G<0||G>6)&&(Wt=!0)):M.e!=null?(G=M.e+ce,(M.e<0||M.e>6)&&(Wt=!0)):G=ce),R<1||R>fo(I,ce,Oe)?h(v)._overflowWeeks=!0:Wt!=null?h(v)._overflowWeekday=!0:(gt=zM(I,R,G,ce,Oe),v._a[dn]=gt.year,v._dayOfYear=gt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function bg(v){if(v._f===e.ISO_8601){jM(v);return}if(v._f===e.RFC_2822){ZM(v);return}v._a=[],h(v).empty=!0;var M=""+v._i,I,R,G,ce,Oe,gt=M.length,Wt=0,hr,fi;for(G=_e(v._f,v._locale).match(O)||[],fi=G.length,I=0;I<fi;I++)ce=G[I],R=(M.match(kn(ce,v))||[])[0],R&&(Oe=M.substr(0,M.indexOf(R)),Oe.length>0&&h(v).unusedInput.push(Oe),M=M.slice(M.indexOf(R)+R.length),Wt+=R.length),Q[ce]?(R?h(v).empty=!1:h(v).unusedTokens.push(ce),ea(ce,R,v)):v._strict&&!R&&h(v).unusedTokens.push(ce);h(v).charsLeftOver=gt-Wt,M.length>0&&h(v).unusedInput.push(M),v._a[Kr]<=12&&h(v).bigHour===!0&&v._a[Kr]>0&&(h(v).bigHour=void 0),h(v).parsedDateParts=v._a.slice(0),h(v).meridiem=v._meridiem,v._a[Kr]=Lq(v._locale,v._a[Kr],v._meridiem),hr=h(v).era,hr!==null&&(v._a[dn]=v._locale.erasConvertYear(hr,v._a[dn])),yg(v),gg(v)}function Lq(v,M,I){var R;return I==null?M:v.meridiemHour!=null?v.meridiemHour(M,I):(v.isPM!=null&&(R=v.isPM(I),R&&M<12&&(M+=12),!R&&M===12&&(M=0)),M)}function Vq(v){var M,I,R,G,ce,Oe,gt=!1,Wt=v._f.length;if(Wt===0){h(v).invalidFormat=!0,v._d=new Date(NaN);return}for(G=0;G<Wt;G++)ce=0,Oe=!1,M=w({},v),v._useUTC!=null&&(M._useUTC=v._useUTC),M._f=v._f[G],bg(M),g(M)&&(Oe=!0),ce+=h(M).charsLeftOver,ce+=h(M).unusedTokens.length*10,h(M).score=ce,gt?ce<R&&(R=ce,I=M):(R==null||ce<R||Oe)&&(R=ce,I=M,Oe&&(gt=!0));f(v,I||M)}function Uq(v){if(!v._d){var M=le(v._i),I=M.day===void 0?M.date:M.day;v._a=c([M.year,M.month,I,M.hour,M.minute,M.second,M.millisecond],function(R){return R&&parseInt(R,10)}),yg(v)}}function qq(v){var M=new A(gg(JM(v)));return M._nextDay&&(M.add(1,"d"),M._nextDay=void 0),M}function JM(v){var M=v._i,I=v._f;return v._locale=v._locale||po(v._l),M===null||I===void 0&&M===""?y({nullInput:!0}):(typeof M=="string"&&(v._i=M=v._locale.preparse(M)),x(M)?new A(gg(M)):(l(M)?v._d=M:r(I)?Vq(v):I?bg(v):zq(v),g(v)||(v._d=null),v))}function zq(v){var M=v._i;u(M)?v._d=new Date(e.now()):l(M)?v._d=new Date(M.valueOf()):typeof M=="string"?Bq(v):r(M)?(v._a=c(M.slice(0),function(I){return parseInt(I,10)}),yg(v)):i(M)?Uq(v):s(M)?v._d=new Date(M):e.createFromInputFallback(v)}function XM(v,M,I,R,G){var ce={};return(M===!0||M===!1)&&(R=M,M=void 0),(I===!0||I===!1)&&(R=I,I=void 0),(i(v)&&o(v)||r(v)&&v.length===0)&&(v=void 0),ce._isAMomentObject=!0,ce._useUTC=ce._isUTC=G,ce._l=I,ce._i=v,ce._f=M,ce._strict=R,qq(ce)}function jr(v,M,I,R){return XM(v,M,I,R,!1)}var $q=E("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=jr.apply(null,arguments);return this.isValid()&&v.isValid()?v<this?this:v:y()}),Hq=E("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var v=jr.apply(null,arguments);return this.isValid()&&v.isValid()?v>this?this:v:y()});function QM(v,M){var I,R;if(M.length===1&&r(M[0])&&(M=M[0]),!M.length)return jr();for(I=M[0],R=1;R<M.length;++R)(!M[R].isValid()||M[R][v](I))&&(I=M[R]);return I}function Gq(){var v=[].slice.call(arguments,0);return QM("isBefore",v)}function Wq(){var v=[].slice.call(arguments,0);return QM("isAfter",v)}var Yq=function(){return Date.now?Date.now():+new Date},lc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function jq(v){var M,I=!1,R,G=lc.length;for(M in v)if(a(v,M)&&!(Yr.call(lc,M)!==-1&&(v[M]==null||!isNaN(v[M]))))return!1;for(R=0;R<G;++R)if(v[lc[R]]){if(I)return!1;parseFloat(v[lc[R]])!==ur(v[lc[R]])&&(I=!0)}return!0}function Zq(){return this._isValid}function Jq(){return xa(NaN)}function Pf(v){var M=le(v),I=M.year||0,R=M.quarter||0,G=M.month||0,ce=M.week||M.isoWeek||0,Oe=M.day||0,gt=M.hour||0,Wt=M.minute||0,hr=M.second||0,fi=M.millisecond||0;this._isValid=jq(M),this._milliseconds=+fi+hr*1e3+Wt*6e4+gt*1e3*60*60,this._days=+Oe+ce*7,this._months=+G+R*3+I*12,this._data={},this._locale=po(),this._bubble()}function kf(v){return v instanceof Pf}function xg(v){return v<0?Math.round(-1*v)*-1:Math.round(v)}function Xq(v,M,I){var R=Math.min(v.length,M.length),G=Math.abs(v.length-M.length),ce=0,Oe;for(Oe=0;Oe<R;Oe++)(I&&v[Oe]!==M[Oe]||!I&&ur(v[Oe])!==ur(M[Oe]))&&ce++;return ce+G}function KM(v,M){U(v,0,0,function(){var I=this.utcOffset(),R="+";return I<0&&(I=-I,R="-"),R+W(~~(I/60),2)+M+W(~~I%60,2)})}KM("Z",":"),KM("ZZ",""),Ye("Z",F),Ye("ZZ",F),Sr(["Z","ZZ"],function(v,M,I){I._useUTC=!0,I._tzm=wg(F,v)});var Qq=/([\+\-]|\d\d)/gi;function wg(v,M){var I=(M||"").match(v),R,G,ce;return I===null?null:(R=I[I.length-1]||[],G=(R+"").match(Qq)||["-",0,0],ce=+(G[1]*60)+ur(G[2]),ce===0?0:G[0]==="+"?ce:-ce)}function _g(v,M){var I,R;return M._isUTC?(I=M.clone(),R=(x(v)||l(v)?v.valueOf():jr(v).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+R),e.updateOffset(I,!1),I):jr(v).local()}function Sg(v){return-Math.round(v._d.getTimezoneOffset())}e.updateOffset=function(){};function Kq(v,M,I){var R=this._offset||0,G;if(!this.isValid())return v!=null?this:NaN;if(v!=null){if(typeof v=="string"){if(v=wg(F,v),v===null)return this}else Math.abs(v)<16&&!I&&(v=v*60);return!this._isUTC&&M&&(G=Sg(this)),this._offset=v,this._isUTC=!0,G!=null&&this.add(G,"m"),R!==v&&(!M||this._changeInProgress?nE(this,xa(v-R,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?R:Sg(this)}function e9(v,M){return v!=null?(typeof v!="string"&&(v=-v),this.utcOffset(v,M),this):-this.utcOffset()}function t9(v){return this.utcOffset(0,v)}function r9(v){return this._isUTC&&(this.utcOffset(0,v),this._isUTC=!1,v&&this.subtract(Sg(this),"m")),this}function n9(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var v=wg(Xe,this._i);v!=null?this.utcOffset(v):this.utcOffset(0,!0)}return this}function i9(v){return this.isValid()?(v=v?jr(v).utcOffset():0,(this.utcOffset()-v)%60===0):!1}function a9(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function o9(){if(!u(this._isDSTShifted))return this._isDSTShifted;var v={},M;return w(v,this),v=JM(v),v._a?(M=v._isUTC?p(v._a):jr(v._a),this._isDSTShifted=this.isValid()&&Xq(v._a,M.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function s9(){return this.isValid()?!this._isUTC:!1}function u9(){return this.isValid()?this._isUTC:!1}function eE(){return this.isValid()?this._isUTC&&this._offset===0:!1}var l9=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,c9=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function xa(v,M){var I=v,R=null,G,ce,Oe;return kf(v)?I={ms:v._milliseconds,d:v._days,M:v._months}:s(v)||!isNaN(+v)?(I={},M?I[M]=+v:I.milliseconds=+v):(R=l9.exec(v))?(G=R[1]==="-"?-1:1,I={y:0,d:ur(R[wi])*G,h:ur(R[Kr])*G,m:ur(R[Bn])*G,s:ur(R[hn])*G,ms:ur(xg(R[_i]*1e3))*G}):(R=c9.exec(v))?(G=R[1]==="-"?-1:1,I={y:Ls(R[2],G),M:Ls(R[3],G),w:Ls(R[4],G),d:Ls(R[5],G),h:Ls(R[6],G),m:Ls(R[7],G),s:Ls(R[8],G)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(Oe=f9(jr(I.from),jr(I.to)),I={},I.ms=Oe.milliseconds,I.M=Oe.months),ce=new Pf(I),kf(v)&&a(v,"_locale")&&(ce._locale=v._locale),kf(v)&&a(v,"_isValid")&&(ce._isValid=v._isValid),ce}xa.fn=Pf.prototype,xa.invalid=Jq;function Ls(v,M){var I=v&&parseFloat(v.replace(",","."));return(isNaN(I)?0:I)*M}function tE(v,M){var I={};return I.months=M.month()-v.month()+(M.year()-v.year())*12,v.clone().add(I.months,"M").isAfter(M)&&--I.months,I.milliseconds=+M-+v.clone().add(I.months,"M"),I}function f9(v,M){var I;return v.isValid()&&M.isValid()?(M=_g(M,v),v.isBefore(M)?I=tE(v,M):(I=tE(M,v),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function rE(v,M){return function(I,R){var G,ce;return R!==null&&!isNaN(+R)&&(N(M,"moment()."+M+"(period, number) is deprecated. Please use moment()."+M+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),ce=I,I=R,R=ce),G=xa(I,R),nE(this,G,v),this}}function nE(v,M,I,R){var G=M._milliseconds,ce=xg(M._days),Oe=xg(M._months);v.isValid()&&(R=R??!0,Oe&&VM(v,ba(v,"Month")+Oe*I),ce&&Pu(v,"Date",ba(v,"Date")+ce*I),G&&v._d.setTime(v._d.valueOf()+G*I),R&&e.updateOffset(v,ce||Oe))}var p9=rE(1,"add"),m9=rE(-1,"subtract");function iE(v){return typeof v=="string"||v instanceof String}function d9(v){return x(v)||l(v)||iE(v)||s(v)||g9(v)||h9(v)||v===null||v===void 0}function h9(v){var M=i(v)&&!o(v),I=!1,R=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,ce,Oe=R.length;for(G=0;G<Oe;G+=1)ce=R[G],I=I||a(v,ce);return M&&I}function g9(v){var M=r(v),I=!1;return M&&(I=v.filter(function(R){return!s(R)&&iE(v)}).length===0),M&&I}function v9(v){var M=i(v)&&!o(v),I=!1,R=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],G,ce;for(G=0;G<R.length;G+=1)ce=R[G],I=I||a(v,ce);return M&&I}function y9(v,M){var I=v.diff(M,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function b9(v,M){arguments.length===1&&(arguments[0]?d9(arguments[0])?(v=arguments[0],M=void 0):v9(arguments[0])&&(M=arguments[0],v=void 0):(v=void 0,M=void 0));var I=v||jr(),R=_g(I,this).startOf("day"),G=e.calendarFormat(this,R)||"sameElse",ce=M&&(P(M[G])?M[G].call(this,I):M[G]);return this.format(ce||this.localeData().calendar(G,this,jr(I)))}function x9(){return new A(this)}function w9(v,M){var I=x(v)?v:jr(v);return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(M).valueOf()):!1}function _9(v,M){var I=x(v)?v:jr(v);return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(M).valueOf()<I.valueOf()):!1}function S9(v,M,I,R){var G=x(v)?v:jr(v),ce=x(M)?M:jr(M);return this.isValid()&&G.isValid()&&ce.isValid()?(R=R||"()",(R[0]==="("?this.isAfter(G,I):!this.isBefore(G,I))&&(R[1]===")"?this.isBefore(ce,I):!this.isAfter(ce,I))):!1}function A9(v,M){var I=x(v)?v:jr(v),R;return this.isValid()&&I.isValid()?(M=re(M)||"millisecond",M==="millisecond"?this.valueOf()===I.valueOf():(R=I.valueOf(),this.clone().startOf(M).valueOf()<=R&&R<=this.clone().endOf(M).valueOf())):!1}function M9(v,M){return this.isSame(v,M)||this.isAfter(v,M)}function E9(v,M){return this.isSame(v,M)||this.isBefore(v,M)}function D9(v,M,I){var R,G,ce;if(!this.isValid())return NaN;if(R=_g(v,this),!R.isValid())return NaN;switch(G=(R.utcOffset()-this.utcOffset())*6e4,M=re(M),M){case"year":ce=Bf(this,R)/12;break;case"month":ce=Bf(this,R);break;case"quarter":ce=Bf(this,R)/3;break;case"second":ce=(this-R)/1e3;break;case"minute":ce=(this-R)/6e4;break;case"hour":ce=(this-R)/36e5;break;case"day":ce=(this-R-G)/864e5;break;case"week":ce=(this-R-G)/6048e5;break;default:ce=this-R}return I?ce:Dn(ce)}function Bf(v,M){if(v.date()<M.date())return-Bf(M,v);var I=(M.year()-v.year())*12+(M.month()-v.month()),R=v.clone().add(I,"months"),G,ce;return M-R<0?(G=v.clone().add(I-1,"months"),ce=(M-R)/(R-G)):(G=v.clone().add(I+1,"months"),ce=(M-R)/(G-R)),-(I+ce)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function N9(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function T9(v){if(!this.isValid())return null;var M=v!==!0,I=M?this.clone().utc():this;return I.year()<0||I.year()>9999?pe(I,M?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):P(Date.prototype.toISOString)?M?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",pe(I,"Z")):pe(I,M?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function C9(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var v="moment",M="",I,R,G,ce;return this.isLocal()||(v=this.utcOffset()===0?"moment.utc":"moment.parseZone",M="Z"),I="["+v+'("]',R=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",ce=M+'[")]',this.format(I+R+G+ce)}function F9(v){v||(v=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var M=pe(this,v);return this.localeData().postformat(M)}function I9(v,M){return this.isValid()&&(x(v)&&v.isValid()||jr(v).isValid())?xa({to:this,from:v}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function P9(v){return this.from(jr(),v)}function k9(v,M){return this.isValid()&&(x(v)&&v.isValid()||jr(v).isValid())?xa({from:this,to:v}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function B9(v){return this.to(jr(),v)}function aE(v){var M;return v===void 0?this._locale._abbr:(M=po(v),M!=null&&(this._locale=M),this)}var oE=E("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(v){return v===void 0?this.localeData():this.locale(v)});function sE(){return this._locale}var Of=1e3,Ou=60*Of,Rf=60*Ou,uE=(365*400+97)*24*Rf;function Ru(v,M){return(v%M+M)%M}function lE(v,M,I){return v<100&&v>=0?new Date(v+400,M,I)-uE:new Date(v,M,I).valueOf()}function cE(v,M,I){return v<100&&v>=0?Date.UTC(v+400,M,I)-uE:Date.UTC(v,M,I)}function O9(v){var M,I;if(v=re(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?cE:lE,v){case"year":M=I(this.year(),0,1);break;case"quarter":M=I(this.year(),this.month()-this.month()%3,1);break;case"month":M=I(this.year(),this.month(),1);break;case"week":M=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":M=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":M=I(this.year(),this.month(),this.date());break;case"hour":M=this._d.valueOf(),M-=Ru(M+(this._isUTC?0:this.utcOffset()*Ou),Rf);break;case"minute":M=this._d.valueOf(),M-=Ru(M,Ou);break;case"second":M=this._d.valueOf(),M-=Ru(M,Of);break}return this._d.setTime(M),e.updateOffset(this,!0),this}function R9(v){var M,I;if(v=re(v),v===void 0||v==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?cE:lE,v){case"year":M=I(this.year()+1,0,1)-1;break;case"quarter":M=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":M=I(this.year(),this.month()+1,1)-1;break;case"week":M=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":M=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":M=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":M=this._d.valueOf(),M+=Rf-Ru(M+(this._isUTC?0:this.utcOffset()*Ou),Rf)-1;break;case"minute":M=this._d.valueOf(),M+=Ou-Ru(M,Ou)-1;break;case"second":M=this._d.valueOf(),M+=Of-Ru(M,Of)-1;break}return this._d.setTime(M),e.updateOffset(this,!0),this}function L9(){return this._d.valueOf()-(this._offset||0)*6e4}function V9(){return Math.floor(this.valueOf()/1e3)}function U9(){return new Date(this.valueOf())}function q9(){var v=this;return[v.year(),v.month(),v.date(),v.hour(),v.minute(),v.second(),v.millisecond()]}function z9(){var v=this;return{years:v.year(),months:v.month(),date:v.date(),hours:v.hours(),minutes:v.minutes(),seconds:v.seconds(),milliseconds:v.milliseconds()}}function $9(){return this.isValid()?this.toISOString():null}function H9(){return g(this)}function G9(){return f({},h(this))}function W9(){return h(this).overflow}function Y9(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),Ye("N",Ag),Ye("NN",Ag),Ye("NNN",Ag),Ye("NNNN",i7),Ye("NNNNN",a7),Sr(["N","NN","NNN","NNNN","NNNNN"],function(v,M,I,R){var G=I._locale.erasParse(v,R,I._strict);G?h(I).era=G:h(I).invalidEra=v}),Ye("y",Re),Ye("yy",Re),Ye("yyy",Re),Ye("yyyy",Re),Ye("yo",o7),Sr(["y","yy","yyy","yyyy"],dn),Sr(["yo"],function(v,M,I,R){var G;I._locale._eraYearOrdinalRegex&&(G=v.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?M[dn]=I._locale.eraYearOrdinalParse(v,G):M[dn]=parseInt(v,10)});function j9(v,M){var I,R,G,ce=this._eras||po("en")._eras;for(I=0,R=ce.length;I<R;++I){switch(typeof ce[I].since){case"string":G=e(ce[I].since).startOf("day"),ce[I].since=G.valueOf();break}switch(typeof ce[I].until){case"undefined":ce[I].until=1/0;break;case"string":G=e(ce[I].until).startOf("day").valueOf(),ce[I].until=G.valueOf();break}}return ce}function Z9(v,M,I){var R,G,ce=this.eras(),Oe,gt,Wt;for(v=v.toUpperCase(),R=0,G=ce.length;R<G;++R)if(Oe=ce[R].name.toUpperCase(),gt=ce[R].abbr.toUpperCase(),Wt=ce[R].narrow.toUpperCase(),I)switch(M){case"N":case"NN":case"NNN":if(gt===v)return ce[R];break;case"NNNN":if(Oe===v)return ce[R];break;case"NNNNN":if(Wt===v)return ce[R];break}else if([Oe,gt,Wt].indexOf(v)>=0)return ce[R]}function J9(v,M){var I=v.since<=v.until?1:-1;return M===void 0?e(v.since).year():e(v.since).year()+(M-v.offset)*I}function X9(){var v,M,I,R=this.localeData().eras();for(v=0,M=R.length;v<M;++v)if(I=this.clone().startOf("day").valueOf(),R[v].since<=I&&I<=R[v].until||R[v].until<=I&&I<=R[v].since)return R[v].name;return""}function Q9(){var v,M,I,R=this.localeData().eras();for(v=0,M=R.length;v<M;++v)if(I=this.clone().startOf("day").valueOf(),R[v].since<=I&&I<=R[v].until||R[v].until<=I&&I<=R[v].since)return R[v].narrow;return""}function K9(){var v,M,I,R=this.localeData().eras();for(v=0,M=R.length;v<M;++v)if(I=this.clone().startOf("day").valueOf(),R[v].since<=I&&I<=R[v].until||R[v].until<=I&&I<=R[v].since)return R[v].abbr;return""}function e7(){var v,M,I,R,G=this.localeData().eras();for(v=0,M=G.length;v<M;++v)if(I=G[v].since<=G[v].until?1:-1,R=this.clone().startOf("day").valueOf(),G[v].since<=R&&R<=G[v].until||G[v].until<=R&&R<=G[v].since)return(this.year()-e(G[v].since).year())*I+G[v].offset;return this.year()}function t7(v){return a(this,"_erasNameRegex")||Mg.call(this),v?this._erasNameRegex:this._erasRegex}function r7(v){return a(this,"_erasAbbrRegex")||Mg.call(this),v?this._erasAbbrRegex:this._erasRegex}function n7(v){return a(this,"_erasNarrowRegex")||Mg.call(this),v?this._erasNarrowRegex:this._erasRegex}function Ag(v,M){return M.erasAbbrRegex(v)}function i7(v,M){return M.erasNameRegex(v)}function a7(v,M){return M.erasNarrowRegex(v)}function o7(v,M){return M._eraYearOrdinalRegex||Re}function Mg(){var v=[],M=[],I=[],R=[],G,ce,Oe,gt,Wt,hr=this.eras();for(G=0,ce=hr.length;G<ce;++G)Oe=Wr(hr[G].name),gt=Wr(hr[G].abbr),Wt=Wr(hr[G].narrow),M.push(Oe),v.push(gt),I.push(Wt),R.push(Oe),R.push(gt),R.push(Wt);this._erasRegex=new RegExp("^("+R.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+M.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+v.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 Lf(v,M){U(0,[v,v.length],0,M)}Lf("gggg","weekYear"),Lf("ggggg","weekYear"),Lf("GGGG","isoWeekYear"),Lf("GGGGG","isoWeekYear"),Ye("G",ze),Ye("g",ze),Ye("GG",Et,xe),Ye("gg",Et,xe),Ye("GGGG",qe,Nt),Ye("gggg",qe,Nt),Ye("GGGGG",$e,Ht),Ye("ggggg",$e,Ht),xi(["gggg","ggggg","GGGG","GGGGG"],function(v,M,I,R){M[R.substr(0,2)]=ur(v)}),xi(["gg","GG"],function(v,M,I,R){M[R]=e.parseTwoDigitYear(v)});function s7(v){return fE.call(this,v,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function u7(v){return fE.call(this,v,this.isoWeek(),this.isoWeekday(),1,4)}function l7(){return fo(this.year(),1,4)}function c7(){return fo(this.isoWeekYear(),1,4)}function f7(){var v=this.localeData()._week;return fo(this.year(),v.dow,v.doy)}function p7(){var v=this.localeData()._week;return fo(this.weekYear(),v.dow,v.doy)}function fE(v,M,I,R,G){var ce;return v==null?oc(this,R,G).year:(ce=fo(v,R,G),M>ce&&(M=ce),m7.call(this,v,M,I,R,G))}function m7(v,M,I,R,G){var ce=zM(v,M,I,R,G),Oe=ac(ce.year,0,ce.dayOfYear);return this.year(Oe.getUTCFullYear()),this.month(Oe.getUTCMonth()),this.date(Oe.getUTCDate()),this}U("Q",0,"Qo","quarter"),Ye("Q",Ze),Sr("Q",function(v,M){M[Nn]=(ur(v)-1)*3});function d7(v){return v==null?Math.ceil((this.month()+1)/3):this.month((v-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),Ye("D",Et,Le),Ye("DD",Et,xe),Ye("Do",function(v,M){return v?M._dayOfMonthOrdinalParse||M._ordinalParse:M._dayOfMonthOrdinalParseLenient}),Sr(["D","DD"],wi),Sr("Do",function(v,M){M[wi]=ur(v.match(Et)[0])});var pE=za("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),Ye("DDD",ge),Ye("DDDD",ht),Sr(["DDD","DDDD"],function(v,M,I){I._dayOfYear=ur(v)});function h7(v){var M=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return v==null?M:this.add(v-M,"d")}U("m",["mm",2],0,"minute"),Ye("m",Et,ft),Ye("mm",Et,xe),Sr(["m","mm"],Bn);var g7=za("Minutes",!1);U("s",["ss",2],0,"second"),Ye("s",Et,ft),Ye("ss",Et,xe),Sr(["s","ss"],hn);var v7=za("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return this.millisecond()*10}),U(0,["SSSSS",5],0,function(){return this.millisecond()*100}),U(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),U(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),U(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),U(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ye("S",ge,Ze),Ye("SS",ge,xe),Ye("SSS",ge,ht);var Ho,mE;for(Ho="SSSS";Ho.length<=9;Ho+="S")Ye(Ho,Re);function y7(v,M){M[_i]=ur(("0."+v)*1e3)}for(Ho="S";Ho.length<=9;Ho+="S")Sr(Ho,y7);mE=za("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function b7(){return this._isUTC?"UTC":""}function x7(){return this._isUTC?"Coordinated Universal Time":""}var rt=A.prototype;rt.add=p9,rt.calendar=b9,rt.clone=x9,rt.diff=D9,rt.endOf=R9,rt.format=F9,rt.from=I9,rt.fromNow=P9,rt.to=k9,rt.toNow=B9,rt.get=ku,rt.invalidAt=W9,rt.isAfter=w9,rt.isBefore=_9,rt.isBetween=S9,rt.isSame=A9,rt.isSameOrAfter=M9,rt.isSameOrBefore=E9,rt.isValid=H9,rt.lang=oE,rt.locale=aE,rt.localeData=sE,rt.max=Hq,rt.min=$q,rt.parsingFlags=G9,rt.set=nc,rt.startOf=O9,rt.subtract=m9,rt.toArray=q9,rt.toObject=z9,rt.toDate=U9,rt.toISOString=T9,rt.inspect=C9,typeof Symbol<"u"&&Symbol.for!=null&&(rt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),rt.toJSON=$9,rt.toString=N9,rt.unix=V9,rt.valueOf=L9,rt.creationData=Y9,rt.eraName=X9,rt.eraNarrow=Q9,rt.eraAbbr=K9,rt.eraYear=e7,rt.year=lo,rt.isLeapYear=Iu,rt.weekYear=s7,rt.isoWeekYear=u7,rt.quarter=rt.quarters=d7,rt.month=UM,rt.daysInMonth=U6,rt.week=rt.weeks=j6,rt.isoWeek=rt.isoWeeks=Z6,rt.weeksInYear=f7,rt.weeksInWeekYear=p7,rt.isoWeeksInYear=l7,rt.isoWeeksInISOWeekYear=c7,rt.date=pE,rt.day=rt.days=uq,rt.weekday=lq,rt.isoWeekday=cq,rt.dayOfYear=h7,rt.hour=rt.hours=vq,rt.minute=rt.minutes=g7,rt.second=rt.seconds=v7,rt.millisecond=rt.milliseconds=mE,rt.utcOffset=Kq,rt.utc=t9,rt.local=r9,rt.parseZone=n9,rt.hasAlignedHourOffset=i9,rt.isDST=a9,rt.isLocal=s9,rt.isUtcOffset=u9,rt.isUtc=eE,rt.isUTC=eE,rt.zoneAbbr=b7,rt.zoneName=x7,rt.dates=E("dates accessor is deprecated. Use date instead.",pE),rt.months=E("months accessor is deprecated. Use month instead",UM),rt.years=E("years accessor is deprecated. Use year instead",lo),rt.zone=E("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",e9),rt.isDSTShifted=E("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",o9);function w7(v){return jr(v*1e3)}function _7(){return jr.apply(null,arguments).parseZone()}function dE(v){return v}var Mr=z.prototype;Mr.calendar=C,Mr.longDateFormat=Se,Mr.invalidDate=Ee,Mr.ordinal=We,Mr.preparse=dE,Mr.postformat=dE,Mr.relativeTime=oe,Mr.pastFuture=he,Mr.set=B,Mr.eras=j9,Mr.erasParse=Z9,Mr.erasConvertYear=J9,Mr.erasAbbrRegex=r7,Mr.erasNameRegex=t7,Mr.erasNarrowRegex=n7,Mr.months=Ar,Mr.monthsShort=yn,Mr.monthsParse=co,Mr.monthsRegex=z6,Mr.monthsShortRegex=q6,Mr.week=H6,Mr.firstDayOfYear=Y6,Mr.firstDayOfWeek=W6,Mr.weekdays=nq,Mr.weekdaysMin=aq,Mr.weekdaysShort=iq,Mr.weekdaysParse=sq,Mr.weekdaysRegex=fq,Mr.weekdaysShortRegex=pq,Mr.weekdaysMinRegex=mq,Mr.isPM=hq,Mr.meridiem=yq;function Vf(v,M,I,R){var G=po(),ce=p().set(R,M);return G[I](ce,v)}function hE(v,M,I){if(s(v)&&(M=v,v=void 0),v=v||"",M!=null)return Vf(v,M,I,"month");var R,G=[];for(R=0;R<12;R++)G[R]=Vf(v,R,I,"month");return G}function Eg(v,M,I,R){typeof v=="boolean"?(s(M)&&(I=M,M=void 0),M=M||""):(M=v,I=M,v=!1,s(M)&&(I=M,M=void 0),M=M||"");var G=po(),ce=v?G._week.dow:0,Oe,gt=[];if(I!=null)return Vf(M,(I+ce)%7,R,"day");for(Oe=0;Oe<7;Oe++)gt[Oe]=Vf(M,(Oe+ce)%7,R,"day");return gt}function S7(v,M){return hE(v,M,"months")}function A7(v,M){return hE(v,M,"monthsShort")}function M7(v,M,I){return Eg(v,M,I,"weekdays")}function E7(v,M,I){return Eg(v,M,I,"weekdaysShort")}function D7(v,M,I){return Eg(v,M,I,"weekdaysMin")}$o("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(v){var M=v%10,I=ur(v%100/10)===1?"th":M===1?"st":M===2?"nd":M===3?"rd":"th";return v+I}}),e.lang=E("moment.lang is deprecated. Use moment.locale instead.",$o),e.langData=E("moment.langData is deprecated. Use moment.localeData instead.",po);var mo=Math.abs;function N7(){var v=this._data;return this._milliseconds=mo(this._milliseconds),this._days=mo(this._days),this._months=mo(this._months),v.milliseconds=mo(v.milliseconds),v.seconds=mo(v.seconds),v.minutes=mo(v.minutes),v.hours=mo(v.hours),v.months=mo(v.months),v.years=mo(v.years),this}function gE(v,M,I,R){var G=xa(M,I);return v._milliseconds+=R*G._milliseconds,v._days+=R*G._days,v._months+=R*G._months,v._bubble()}function T7(v,M){return gE(this,v,M,1)}function C7(v,M){return gE(this,v,M,-1)}function vE(v){return v<0?Math.floor(v):Math.ceil(v)}function F7(){var v=this._milliseconds,M=this._days,I=this._months,R=this._data,G,ce,Oe,gt,Wt;return v>=0&&M>=0&&I>=0||v<=0&&M<=0&&I<=0||(v+=vE(Dg(I)+M)*864e5,M=0,I=0),R.milliseconds=v%1e3,G=Dn(v/1e3),R.seconds=G%60,ce=Dn(G/60),R.minutes=ce%60,Oe=Dn(ce/60),R.hours=Oe%24,M+=Dn(Oe/24),Wt=Dn(yE(M)),I+=Wt,M-=vE(Dg(Wt)),gt=Dn(I/12),I%=12,R.days=M,R.months=I,R.years=gt,this}function yE(v){return v*4800/146097}function Dg(v){return v*146097/4800}function I7(v){if(!this.isValid())return NaN;var M,I,R=this._milliseconds;if(v=re(v),v==="month"||v==="quarter"||v==="year")switch(M=this._days+R/864e5,I=this._months+yE(M),v){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(M=this._days+Math.round(Dg(this._months)),v){case"week":return M/7+R/6048e5;case"day":return M+R/864e5;case"hour":return M*24+R/36e5;case"minute":return M*1440+R/6e4;case"second":return M*86400+R/1e3;case"millisecond":return Math.floor(M*864e5)+R;default:throw new Error("Unknown unit "+v)}}function ho(v){return function(){return this.as(v)}}var bE=ho("ms"),P7=ho("s"),k7=ho("m"),B7=ho("h"),O7=ho("d"),R7=ho("w"),L7=ho("M"),V7=ho("Q"),U7=ho("y"),q7=bE;function z7(){return xa(this)}function $7(v){return v=re(v),this.isValid()?this[v+"s"]():NaN}function Vs(v){return function(){return this.isValid()?this._data[v]:NaN}}var H7=Vs("milliseconds"),G7=Vs("seconds"),W7=Vs("minutes"),Y7=Vs("hours"),j7=Vs("days"),Z7=Vs("months"),J7=Vs("years");function X7(){return Dn(this.days()/7)}var go=Math.round,Lu={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Q7(v,M,I,R,G){return G.relativeTime(M||1,!!I,v,R)}function K7(v,M,I,R){var G=xa(v).abs(),ce=go(G.as("s")),Oe=go(G.as("m")),gt=go(G.as("h")),Wt=go(G.as("d")),hr=go(G.as("M")),fi=go(G.as("w")),vo=go(G.as("y")),Go=ce<=I.ss&&["s",ce]||ce<I.s&&["ss",ce]||Oe<=1&&["m"]||Oe<I.m&&["mm",Oe]||gt<=1&&["h"]||gt<I.h&&["hh",gt]||Wt<=1&&["d"]||Wt<I.d&&["dd",Wt];return I.w!=null&&(Go=Go||fi<=1&&["w"]||fi<I.w&&["ww",fi]),Go=Go||hr<=1&&["M"]||hr<I.M&&["MM",hr]||vo<=1&&["y"]||["yy",vo],Go[2]=M,Go[3]=+v>0,Go[4]=R,Q7.apply(null,Go)}function ez(v){return v===void 0?go:typeof v=="function"?(go=v,!0):!1}function tz(v,M){return Lu[v]===void 0?!1:M===void 0?Lu[v]:(Lu[v]=M,v==="s"&&(Lu.ss=M-1),!0)}function rz(v,M){if(!this.isValid())return this.localeData().invalidDate();var I=!1,R=Lu,G,ce;return typeof v=="object"&&(M=v,v=!1),typeof v=="boolean"&&(I=v),typeof M=="object"&&(R=Object.assign({},Lu,M),M.s!=null&&M.ss==null&&(R.ss=M.s-1)),G=this.localeData(),ce=K7(this,!I,R,G),I&&(ce=G.pastFuture(+this,ce)),G.postformat(ce)}var Ng=Math.abs;function Vu(v){return(v>0)-(v<0)||+v}function Uf(){if(!this.isValid())return this.localeData().invalidDate();var v=Ng(this._milliseconds)/1e3,M=Ng(this._days),I=Ng(this._months),R,G,ce,Oe,gt=this.asSeconds(),Wt,hr,fi,vo;return gt?(R=Dn(v/60),G=Dn(R/60),v%=60,R%=60,ce=Dn(I/12),I%=12,Oe=v?v.toFixed(3).replace(/\.?0+$/,""):"",Wt=gt<0?"-":"",hr=Vu(this._months)!==Vu(gt)?"-":"",fi=Vu(this._days)!==Vu(gt)?"-":"",vo=Vu(this._milliseconds)!==Vu(gt)?"-":"",Wt+"P"+(ce?hr+ce+"Y":"")+(I?hr+I+"M":"")+(M?fi+M+"D":"")+(G||R||v?"T":"")+(G?vo+G+"H":"")+(R?vo+R+"M":"")+(v?vo+Oe+"S":"")):"P0D"}var vr=Pf.prototype;vr.isValid=Zq,vr.abs=N7,vr.add=T7,vr.subtract=C7,vr.as=I7,vr.asMilliseconds=bE,vr.asSeconds=P7,vr.asMinutes=k7,vr.asHours=B7,vr.asDays=O7,vr.asWeeks=R7,vr.asMonths=L7,vr.asQuarters=V7,vr.asYears=U7,vr.valueOf=q7,vr._bubble=F7,vr.clone=z7,vr.get=$7,vr.milliseconds=H7,vr.seconds=G7,vr.minutes=W7,vr.hours=Y7,vr.days=j7,vr.weeks=X7,vr.months=Z7,vr.years=J7,vr.humanize=rz,vr.toISOString=Uf,vr.toString=Uf,vr.toJSON=Uf,vr.locale=aE,vr.localeData=sE,vr.toIsoString=E("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Uf),vr.lang=oE,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Ye("x",ze),Ye("X",X),Sr("X",function(v,M,I){I._d=new Date(parseFloat(v)*1e3)}),Sr("x",function(v,M,I){I._d=new Date(ur(v))});return e.version="2.30.1",t(jr),e.fn=rt,e.min=Gq,e.max=Wq,e.now=Yq,e.utc=p,e.unix=w7,e.months=S7,e.isDate=l,e.locale=$o,e.invalid=y,e.duration=xa,e.isMoment=x,e.weekdays=M7,e.parseZone=_7,e.localeData=po,e.isDuration=kf,e.monthsShort=A7,e.weekdaysMin=D7,e.defineLocale=hg,e.updateLocale=_q,e.locales=Sq,e.weekdaysShort=E7,e.normalizeUnits=re,e.relativeTimeRounding=ez,e.relativeTimeThreshold=tz,e.calendarFormat=y9,e.prototype=rt,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var ip=xn(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.P_HELPERS=Si.ParserHelpers=Si.validateRegexFlags=Si.validateRange=Si.getIndex=Si.arrayUnion=void 0;var Lg=ap();function mz(n,e){if(n===void 0&&e===void 0)return;if(n===void 0)return e;if(e===void 0)return n;let t=[...n];for(let r of e)t.includes(r)||t.push(r);return t}Si.arrayUnion=mz;function dz(n){return n===void 0?-1:n.index}Si.getIndex=dz;function hz(n,e){if(e<n)throw new Error(`Invalid Range: max might not be smaller than min. Received [${n}, ${e}].`);if(n<0||e<0)throw new Error(`Invalid Range: max and min might not be smaller than 0. Received [${n}, ${e}].`);if(n===1/0||e===1/0)throw new Error(`Invalid Range: max and min might not be infinity. Received [${n}, ${e}].`);if(!Number.isInteger(n)||!Number.isInteger(e))throw new Error(`Invalid Range: max and min must be integers. Received [${n}, ${e}].`)}Si.validateRange=hz;function gz(n){for(let e of n)if(e!=="i"&&e!=="m"&&e!=="s"&&e!=="u")throw new Error(`RegExp flag '${e}' is not allowed. The only allowed flags are 'i', 'm', 's' and 'u'.`)}Si.validateRegexFlags=gz;var np=class{followedBy(e){return new Lg.Parser(function(r){return e.p(r.copy())})}notFollowedBy(e){return new Lg.Parser(function(r){let i=r.copy(),a=e.p(i),o=r.sliceTo(i.position.index);return a.success?r.fail("not '"+o+"'"):r.succeed(void 0)})}test(e){return new Lg.Parser(function(r){let i=r.input[r.position.index];return!r.atEOF()&&e(i)?r.succeedOffset(1,i):r.fail(`a character matching ${e}`)})}};Si.ParserHelpers=np;Si.P_HELPERS=new np});var RE=xn(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.ParserContext=void 0;var Vg=ip(),Ug=class n{constructor(e,t){this.input=e,this.position=t}moveToPosition(e){return this.position=e,this}copy(){return new n(this.input,{index:this.position.index,column:this.position.column,line:this.position.line})}getPosition(){return{index:this.position.index,column:this.position.column,line:this.position.line}}atEOF(){return this.position.index>=this.input.length}advanceTo(e){if(e<this.position.index)throw new Error(`Can not advance backwards. Current pos ${this.position.index}. Advance target index ${e}.`);if(e!==this.position.index){for(let t=this.position.index;t<e;t++)this.input[t]===`
`?(this.position.line+=1,this.position.column=1):this.position.column+=1;this.position.index=e}}sliceTo(e){return this.input.slice(this.position.index,e)}succeedOffset(e,t){return this.succeedAt(this.position.index+e,t)}failOffset(e,t){return this.failAt(this.position.index+e,t)}succeed(e){return this.succeedAt(this.position.index,e)}fail(e){return this.failAt(this.position.index,e)}succeedAt(e,t){return this.advanceTo(e),{success:!0,value:t,furthest:void 0,expected:void 0}}failAt(e,t){return this.advanceTo(e),{success:!1,value:void 0,furthest:this.position,expected:Array.isArray(t)?t:[t]}}merge(e,t){if(e===void 0)return t;let r=(0,Vg.getIndex)(e.furthest),i=(0,Vg.getIndex)(t.furthest);if(i>r)return t;let a=i===r?(0,Vg.arrayUnion)(e.expected,t.expected):e.expected;return t.furthest=e.furthest,t.expected=a,t}};op.ParserContext=Ug});var Ai=xn(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.P=void 0;var Oi=ap(),sp=ip(),qg=class n{static sequence(...e){if(e.length===0)throw new Error("sequence must have at least one parser argument");return new Oi.Parser(function(r){let i,a=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o].p(r);if(i=r.merge(i,s),!i.success)return i;a[o]=i.value}return i.value=a,i})}static sequenceMap(e,...t){if(t.length===0)throw new Error("sequenceMap must have at least one parser argument");return new Oi.Parser(function(i){let a,o=new Array(t.length);for(let u=0;u<t.length;u++){let l=t[u].p(i);if(a=i.merge(a,l),!a.success)return a;o[u]=a.value}return a.value=e(...o),a})}static createLanguage(e){let t={},r={},i={};for(let a in e)i[a]=n.reference(()=>e[a](t,i)),Object.defineProperty(r,a,{get:()=>{if(t[a]!==void 0)return t[a];throw new Error(`Can not access rule '${a}' in language. Rule is not yet defined. Try to access it via 'ref'.`)}});for(let a in e)t[a]=e[a](r,i);return t}static or(...e){if(e.length===0)throw new Error("or must have at least one alternative");return new Oi.Parser(function(r){let i;for(let a of e){let o=a,u=r.copy(),s=o.p(u);if(i=r.merge(i,s),i.success)return r.moveToPosition(u.position),i}return i})}static separateBy(e,t){return this.separateByNotEmpty(e,t).or(n.succeed([]))}static separateByNotEmpty(e,t){return this.sequenceMap(function(i,a){return a.unshift(i),a},e,t.then(e).many())}static string(e){let t="'"+e+"'";return new Oi.Parser(function(i){for(let a=0;a<e.length;a++)if(i.input[i.position.index+a]!==e[a])return i.fail(t);return i.succeedAt(i.position.index+e.length,e)})}static regexp(e,t){(0,sp.validateRegexFlags)(e.flags);let r=e.source;return t!==void 0?new Oi.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let s=t??0;if(s>=0&&s<=u.length){let c=u[0],f=u[s];return a.succeedOffset(c.length,f)}let l="expected valid match group (0 to "+u.length+") in "+r;return a.fail(l)}else return a.fail(r)}):new Oi.Parser(function(a){let o=a.input.slice(a.position.index),u=e.exec(o);if(u!==null){let s=u[0];return a.succeedOffset(s.length,s)}else return a.fail(r)})}static succeed(e){return new Oi.Parser(function(r){return r.succeed(e)})}static fail(e){return new Oi.Parser(function(r){return r.fail(e)})}static oneOf(e){return sp.P_HELPERS.test(function(r){return e.includes(r)}).describe(`one character of '${e}'`)}static noneOf(e){return sp.P_HELPERS.test(function(r){return!e.includes(r)}).describe(`no character of '${e}'`)}static oneStringOf(e){return this.or(...e.map(t=>this.string(t))).describe(e.map(t=>`'${t}'`).join(" or "))}static manyOf(e){return new Oi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static manyNotOf(e){return new Oi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&!e.includes(r.input[i]);i++);return r.succeedAt(i,r.sliceTo(i))})}static custom(e){return new Oi.Parser(e)}static range(e,t){let r=e.charCodeAt(0),i=t.charCodeAt(0);return sp.P_HELPERS.test(function(o){let u=o.charCodeAt(0);return r<=u&&u<=i}).describe(`${e}-${t}`)}static takeWhile(e){return new Oi.Parser(function(r){let i=r.position.index;for(;i<r.input.length&&e(r.input[i]);)i++;return r.succeedAt(i,r.input.slice(r.position.index,i))})}static reference(e){return new Oi.Parser(function(r){return e().p(r)})}};up.P=qg});var VE=xn(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ParsingError=Hu.createParsingErrorMessage=void 0;function LE(n,e,t){let r=`Expected ${e.expected.sort().join(" or ")}`,i=`Parse Failure: ${r} at index ${e.furthest.index}, line ${e.furthest.line}, column ${e.furthest.column}.`;if(t){let o=n.split(`
`)[e.furthest.line-1],u=`${e.furthest.line} |   `;i+=`

${u}${o}`,i+=`
${" ".repeat(e.furthest.column-1+u.length)}^ (${r})`}return i}Hu.createParsingErrorMessage=LE;var zg=class extends Error{constructor(e,t){super(LE(e,t,!0))}};Hu.ParsingError=zg});var ap=xn(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});lp.Parser=void 0;var vz=RE(),ra=Ai(),$g=ip(),Gu=Ri(),yz=VE(),Hg=class n{constructor(e){this.p=e}tryParse(e){return this.p(new vz.ParserContext(e,{index:0,line:1,column:1}))}parse(e){let t=this.tryParse(e);if(t.success)return t.value;throw new yz.ParsingError(e,t)}or(e){return ra.P.or(this,e)}trim(e){return this.wrap(e,e)}trimString(e){return this.trim(ra.P.string(e))}wrap(e,t){let r=this;return new n(function(a){let o=e.p(a);if(!o.success)return o;let u=a.merge(o,r.p(a));if(!u.success)return u;let s=a.merge(u,t.p(a));return s.success?a.merge(s,a.succeed(u.value)):s})}wrapString(e,t){return this.wrap(ra.P.string(e),ra.P.string(t))}then(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success,o})}skip(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let o=i.merge(a,e.p(i));return o.success?i.merge(o,i.succeed(a.value)):o})}and(e){return ra.P.sequence(this,e)}many(){let e=this;return new n(function(r){let i,a=r.position.index,o=[];for(;;){let u=r.copy(),s=e.p(u);if(i=r.merge(i,s),i.success){if(u.position.index===a)throw new Error("infinite loop in many() parser detected");r.moveToPosition(u.position),o.push(i.value)}else return r.merge(i,r.succeed(o))}})}repeat(e,t){(0,$g.validateRange)(e,t);let r=this;return new n(function(a){let o,u,s=[],l=0;for(;l<e;l++)if(o=r.p(a),u=a.merge(u,o),o.success)s.push(o.value);else return u;for(;l<t;l++){let c=a.copy();if(o=r.p(c),u=a.merge(u,o),o.success)a.moveToPosition(c.position),s.push(o.value);else break}return a.merge(u,a.succeed(s))})}atMost(e){return this.repeat(0,e)}atLeast(e){return ra.P.sequenceMap((t,r)=>t.concat(r),this.repeat(e,e),this.many())}separateBy(e){return ra.P.separateBy(this,e)}separateByNotEmpty(e){return ra.P.separateByNotEmpty(this,e)}result(e){return this.map(()=>e)}map(e){let t=this;return new n(function(i){let a=t.p(i);return a.success&&(a.value=e(a.value)),a})}marker(){return ra.P.sequenceMap(function(t,r,i){return{value:r,range:{from:t,to:i}}},Gu.P_UTILS.position(),this,Gu.P_UTILS.position())}namedMarker(e){return ra.P.sequenceMap(function(r,i,a){return{value:i,name:e,range:{from:r,to:a}}},Gu.P_UTILS.position(),this,Gu.P_UTILS.position())}node(e){return ra.P.sequenceMap(function(r,i,a){return e(i,{from:r,to:a})},Gu.P_UTILS.position(),this,Gu.P_UTILS.position())}followedBy(e){return this.skip($g.P_HELPERS.followedBy(e))}notFollowedBy(e){return this.skip($g.P_HELPERS.notFollowedBy(e))}describe(e){typeof e=="string"&&(e=[e]);let t=this;return new n(function(i){let a=t.p(i);return a.expected!==void 0&&a.expected.length!==0&&(a.expected=e),a})}box(e){let t=this;return new n(function(i){var a;let o=t.p(i);return o.expected!==void 0&&o.expected.length!==0&&(o.expected=[`(${(a=o.expected)===null||a===void 0?void 0:a.join(" or ")} as part of ${e})`]),o})}optional(e){return this.or(ra.P.succeed(e))}chain(e){let t=this;return new n(function(i){let a=t.p(i);if(!a.success)return a;let u=e(a.value).p(i);return i.merge(a,u)})}thenEof(){let e=this;return new n(function(r){let i=e.p(r);return i.success?r.atEOF()?i:r.merge(i,r.fail("eof")):i})}memorize(){let e=this,t="",r=new Map,i=new Map;return new n(function(o){let u=o.position.index;if(o.input!==t)t=o.input,r.clear(),i.clear();else{let l=r.get(u),c=i.get(u);if(l!==void 0&&c!==void 0)return o.moveToPosition(Object.assign({},c)),Object.assign({},l)}let s=e.p(o);return r.set(u,Object.assign({},s)),i.set(u,o.getPosition()),s})}};lp.Parser=Hg});var Ri=xn(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.P_UTILS=void 0;var cp=ap(),Rr=Ai(),Gg=class n{static position(){return new cp.Parser(e=>e.succeed(e.getPosition()))}static any(){return new cp.Parser(e=>e.atEOF()?e.fail("any character"):e.succeedOffset(1,e.input[e.position.index]))}static remaining(){return new cp.Parser(e=>e.succeedAt(e.input.length,e.input.slice(e.position.index)))}static eof(){return new cp.Parser(e=>e.atEOF()?e.succeed(void 0):e.fail("eof"))}static digit(){return Rr.P.regexp(/^[0-9]/).describe("a digit")}static digits(){return Rr.P.regexp(/^[0-9]+/).describe("multiple digits")}static letter(){return Rr.P.regexp(/^[a-z]/i).describe("a letter")}static letters(){return Rr.P.regexp(/^[a-z]+/i).describe("multiple letters")}static unicodeLetter(){return Rr.P.regexp(/^\p{L}/iu).describe("a unicode letter")}static unicodeLetters(){return Rr.P.regexp(/^\p{L}+/iu).describe("multiple unicode letters")}static unicodeAlphanumeric(){return Rr.P.regexp(/^[\p{L}\p{N}]/iu).describe("a unicode alphanumeric character")}static unicodeAlphanumerics(){return Rr.P.regexp(/^[\p{L}\p{N}]+/iu).describe("multiple unicode alphanumeric characters")}static optionalWhitespace(){return Rr.P.regexp(/^\s*/).describe("optional whitespace")}static whitespace(){return Rr.P.regexp(/^\s+/).describe("whitespace")}static cr(){return Rr.P.string("\r")}static lf(){return Rr.P.string(`
`)}static crlf(){return Rr.P.string(`\r
`)}static newline(){return Rr.P.or(this.crlf(),this.lf(),this.cr()).describe("newline")}static prefix(e,t,r){return Rr.P.sequenceMap((i,a)=>i.reduce((o,u)=>r(u,o),a),e.many(),t)}static postfix(e,t,r){return Rr.P.sequenceMap((i,a)=>a.reduce((o,u)=>r(u,o),i),t,e.many())}static binaryRight(e,t,r){return Rr.P.sequenceMap((i,a)=>i.reverse().reduce((o,u)=>{let[s,l]=u;return r(s,l,o)},a),Rr.P.sequence(t,e.trim(this.optionalWhitespace())).many(),t)}static binaryLeft(e,t,r){return Rr.P.sequenceMap((i,a)=>a.reduce((o,u)=>{let[s,l]=u;return r(o,s,l)},i),t,Rr.P.sequence(e.trim(this.optionalWhitespace()),t).many())}static binaryRightRange(e,t,r){return Rr.P.sequenceMap((i,a,o)=>i.reverse().reduce((u,s)=>{let[l,c,f]=s;return r({from:l,to:o},c,f,u)},a),Rr.P.sequence(n.position(),t,e.trim(this.optionalWhitespace())).many(),t,n.position())}static binaryLeftRange(e,t,r){return Rr.P.sequenceMap((i,a,o)=>o.reduce((u,s)=>{let[l,c,f]=s;return r({from:i,to:f},u,l,c)},a),n.position(),t,Rr.P.sequence(e.trim(this.optionalWhitespace()),t,n.position()).many())}static func(e,t,r){let i=typeof e=="string"?Rr.P.string(e):e;return Rr.P.sequenceMap((a,o,u,s,l,c)=>r(a,s),i,Rr.P.string("("),this.optionalWhitespace(),t,this.optionalWhitespace(),Rr.P.string(")"))}};fp.P_UTILS=Gg});var Vv=xn((Rv,Lv)=>{(function(n,e){typeof Rv=="object"&&typeof Lv<"u"?Lv.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n["'typed'"]=e())})(Rv,function(){"use strict";function n(){return!0}function e(){return!1}function t(){}let r="Argument is not a typed-function.";function i(){function o(ae){return typeof ae=="object"&&ae!==null&&ae.constructor===Object}let u=[{name:"number",test:function(ae){return typeof ae=="number"}},{name:"string",test:function(ae){return typeof ae=="string"}},{name:"boolean",test:function(ae){return typeof ae=="boolean"}},{name:"Function",test:function(ae){return typeof ae=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(ae){return ae instanceof Date}},{name:"RegExp",test:function(ae){return ae instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(ae){return ae===null}},{name:"undefined",test:function(ae){return ae===void 0}}],s={name:"any",test:n,isAny:!0},l,c,f=0,p={createCount:0};function m(ae){let de=l.get(ae);if(de)return de;let ge='Unknown type "'+ae+'"',qe=ae.toLowerCase(),$e;for($e of c)if($e.toLowerCase()===qe){ge+='. Did you mean "'+$e+'" ?';break}throw new TypeError(ge)}function h(ae){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",ge=de?m(de).index:c.length,qe=[];for(let Re=0;Re<ae.length;++Re){if(!ae[Re]||typeof ae[Re].name!="string"||typeof ae[Re].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let ze=ae[Re].name;if(l.has(ze))throw new TypeError('Duplicate type name "'+ze+'"');qe.push(ze),l.set(ze,{name:ze,test:ae[Re].test,isAny:ae[Re].isAny,index:ge+Re,conversionsTo:[]})}let $e=c.slice(ge);c=c.slice(0,ge).concat(qe).concat($e);for(let Re=ge+qe.length;Re<c.length;++Re)l.get(c[Re]).index=Re}function d(){l=new Map,c=[],f=0,h([s],!1)}d(),h(u);function g(){let ae;for(ae of c)l.get(ae).conversionsTo=[];f=0}function y(ae){let de=c.filter(ge=>{let qe=l.get(ge);return!qe.isAny&&qe.test(ae)});return de.length?de:["any"]}function S(ae){return ae&&typeof ae=="function"&&"_typedFunctionData"in ae}function b(ae,de,ge){if(!S(ae))throw new TypeError(r);let qe=ge&&ge.exact,$e=Array.isArray(de)?de.join(","):de,Re=N($e),ze=x(Re);if(!qe||ze in ae.signatures){let Ae=ae._typedFunctionData.signatureMap.get(ze);if(Ae)return Ae}let Xe=Re.length,F;if(qe){F=[];let Ae;for(Ae in ae.signatures)F.push(ae._typedFunctionData.signatureMap.get(Ae))}else F=ae._typedFunctionData.signatures;for(let Ae=0;Ae<Xe;++Ae){let Le=Re[Ae],ft=[],St;for(St of F){let Ye=z(St.params,Ae);if(!(!Ye||Le.restParam&&!Ye.restParam)){if(!Ye.hasAny){let kn=_(Ye);if(Le.types.some(ci=>!kn.has(ci.name)))continue}ft.push(St)}}if(F=ft,F.length===0)break}let X;for(X of F)if(X.params.length<=Xe)return X;throw new TypeError("Signature not found (signature: "+(ae.name||"unnamed")+"("+x(Re,", ")+"))")}function w(ae,de,ge){return b(ae,de,ge).implementation}function A(ae,de){let ge=m(de);if(ge.test(ae))return ae;let qe=ge.conversionsTo;if(qe.length===0)throw new Error("There are no conversions to "+de+" defined.");for(let $e=0;$e<qe.length;$e++)if(m(qe[$e].from).test(ae))return qe[$e].convert(ae);throw new Error("Cannot convert "+ae+" to "+de)}function x(ae){let de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return ae.map(ge=>ge.name).join(de)}function D(ae){let de=ae.indexOf("...")===0,qe=(de?ae.length>3?ae.slice(3):"any":ae).split("|").map(Xe=>m(Xe.trim())),$e=!1,Re=de?"...":"";return{types:qe.map(function(Xe){return $e=Xe.isAny||$e,Re+=Xe.name+"|",{name:Xe.name,typeIndex:Xe.index,test:Xe.test,isAny:Xe.isAny,conversion:null,conversionIndex:-1}}),name:Re.slice(0,-1),hasAny:$e,hasConversion:!1,restParam:de}}function E(ae){let de=ae.types.map(ze=>ze.name),ge=U(de),qe=ae.hasAny,$e=ae.name,Re=ge.map(function(ze){let Xe=m(ze.from);return qe=Xe.isAny||qe,$e+="|"+ze.from,{name:ze.from,typeIndex:Xe.index,test:Xe.test,isAny:Xe.isAny,conversion:ze,conversionIndex:ze.index}});return{types:ae.types.concat(Re),name:$e,hasAny:qe,hasConversion:Re.length>0,restParam:ae.restParam}}function _(ae){return ae.typeSet||(ae.typeSet=new Set,ae.types.forEach(de=>ae.typeSet.add(de.name))),ae.typeSet}function N(ae){let de=[];if(typeof ae!="string")throw new TypeError("Signatures must be strings");let ge=ae.trim();if(ge==="")return de;let qe=ge.split(",");for(let $e=0;$e<qe.length;++$e){let Re=D(qe[$e].trim());if(Re.restParam&&$e!==qe.length-1)throw new SyntaxError('Unexpected rest parameter "'+qe[$e]+'": only allowed for the last parameter');if(Re.types.length===0)return null;de.push(Re)}return de}function P(ae){let de=te(ae);return de?de.restParam:!1}function B(ae){if(!ae||ae.types.length===0)return n;if(ae.types.length===1)return m(ae.types[0].name).test;if(ae.types.length===2){let de=m(ae.types[0].name).test,ge=m(ae.types[1].name).test;return function($e){return de($e)||ge($e)}}else{let de=ae.types.map(function(ge){return m(ge.name).test});return function(qe){for(let $e=0;$e<de.length;$e++)if(de[$e](qe))return!0;return!1}}}function V(ae){let de,ge,qe;if(P(ae)){de=We(ae).map(B);let $e=de.length,Re=B(te(ae)),ze=function(Xe){for(let F=$e;F<Xe.length;F++)if(!Re(Xe[F]))return!1;return!0};return function(F){for(let X=0;X<de.length;X++)if(!de[X](F[X]))return!1;return ze(F)&&F.length>=$e+1}}else return ae.length===0?function(Re){return Re.length===0}:ae.length===1?(ge=B(ae[0]),function(Re){return ge(Re[0])&&Re.length===1}):ae.length===2?(ge=B(ae[0]),qe=B(ae[1]),function(Re){return ge(Re[0])&&qe(Re[1])&&Re.length===2}):(de=ae.map(B),function(Re){for(let ze=0;ze<de.length;ze++)if(!de[ze](Re[ze]))return!1;return Re.length===de.length})}function z(ae,de){return de<ae.length?ae[de]:P(ae)?te(ae):null}function L(ae,de){let ge=z(ae,de);return ge?_(ge):new Set}function k(ae){return ae.conversion===null||ae.conversion===void 0}function C(ae,de){let ge=new Set;return ae.forEach(qe=>{let $e=L(qe.params,de),Re;for(Re of $e)ge.add(Re)}),ge.has("any")?["any"]:Array.from(ge)}function W(ae,de,ge){let qe,$e,Re=ae||"unnamed",ze=ge,Xe;for(Xe=0;Xe<de.length;Xe++){let Le=[];if(ze.forEach(ft=>{let St=z(ft.params,Xe),Ye=B(St);(Xe<ft.params.length||P(ft.params))&&Ye(de[Xe])&&Le.push(ft)}),Le.length===0){if($e=C(ze,Xe),$e.length>0){let ft=y(de[Xe]);return qe=new TypeError("Unexpected type of argument in function "+Re+" (expected: "+$e.join(" or ")+", actual: "+ft.join(" | ")+", index: "+Xe+")"),qe.data={category:"wrongType",fn:Re,index:Xe,actual:ft,expected:$e},qe}}else ze=Le}let F=ze.map(function(Le){return P(Le.params)?1/0:Le.params.length});if(de.length<Math.min.apply(null,F))return $e=C(ze,Xe),qe=new TypeError("Too few arguments in function "+Re+" (expected: "+$e.join(" or ")+", index: "+de.length+")"),qe.data={category:"tooFewArgs",fn:Re,index:de.length,expected:$e},qe;let X=Math.max.apply(null,F);if(de.length>X)return qe=new TypeError("Too many arguments in function "+Re+" (expected: "+X+", actual: "+de.length+")"),qe.data={category:"tooManyArgs",fn:Re,index:de.length,expectedLength:X},qe;let Ae=[];for(let Le=0;Le<de.length;++Le)Ae.push(y(de[Le]).join("|"));return qe=new TypeError('Arguments of type "'+Ae.join(", ")+'" do not match any of the defined signatures of function '+Re+"."),qe.data={category:"mismatch",actual:Ae},qe}function O(ae){let de=c.length+1;for(let ge=0;ge<ae.types.length;ge++)k(ae.types[ge])&&(de=Math.min(de,ae.types[ge].typeIndex));return de}function H(ae){let de=f+1;for(let ge=0;ge<ae.types.length;ge++)k(ae.types[ge])||(de=Math.min(de,ae.types[ge].conversionIndex));return de}function Z(ae,de){if(ae.hasAny){if(!de.hasAny)return 1}else if(de.hasAny)return-1;if(ae.restParam){if(!de.restParam)return 1}else if(de.restParam)return-1;if(ae.hasConversion){if(!de.hasConversion)return 1}else if(de.hasConversion)return-1;let ge=O(ae)-O(de);if(ge<0)return-1;if(ge>0)return 1;let qe=H(ae)-H(de);return qe<0?-1:qe>0?1:0}function Q(ae,de){let ge=ae.params,qe=de.params,$e=te(ge),Re=te(qe),ze=P(ge),Xe=P(qe);if(ze&&$e.hasAny){if(!Xe||!Re.hasAny)return 1}else if(Xe&&Re.hasAny)return-1;let F=0,X=0,Ae;for(Ae of ge)Ae.hasAny&&++F,Ae.hasConversion&&++X;let Le=0,ft=0;for(Ae of qe)Ae.hasAny&&++Le,Ae.hasConversion&&++ft;if(F!==Le)return F-Le;if(ze&&$e.hasConversion){if(!Xe||!Re.hasConversion)return 1}else if(Xe&&Re.hasConversion)return-1;if(X!==ft)return X-ft;if(ze){if(!Xe)return 1}else if(Xe)return-1;let St=(ge.length-qe.length)*(ze?-1:1);if(St!==0)return St;let Ye=[],kn=0;for(let Wr=0;Wr<ge.length;++Wr){let Dn=Z(ge[Wr],qe[Wr]);Ye.push(Dn),kn+=Dn}if(kn!==0)return kn;let ci;for(ci of Ye)if(ci!==0)return ci;return 0}function U(ae){if(ae.length===0)return[];let de=ae.map(m);ae.length>1&&de.sort(($e,Re)=>$e.index-Re.index);let ge=de[0].conversionsTo;if(ae.length===1)return ge;ge=ge.concat([]);let qe=new Set(ae);for(let $e=1;$e<de.length;++$e){let Re;for(Re of de[$e].conversionsTo)qe.has(Re.from)||(ge.push(Re),qe.add(Re.from))}return ge}function me(ae,de){let ge=de;if(ae.some($e=>$e.hasConversion)){let $e=P(ae),Re=ae.map(De);ge=function(){let Xe=[],F=$e?arguments.length-1:arguments.length;for(let X=0;X<F;X++)Xe[X]=Re[X](arguments[X]);return $e&&(Xe[F]=arguments[F].map(Re[F])),de.apply(this,Xe)}}let qe=ge;if(P(ae)){let $e=ae.length-1;qe=function(){return ge.apply(this,oe(arguments,0,$e).concat([oe(arguments,$e)]))}}return qe}function De(ae){let de,ge,qe,$e,Re=[],ze=[];switch(ae.types.forEach(function(Xe){Xe.conversion&&(Re.push(m(Xe.conversion.from).test),ze.push(Xe.conversion.convert))}),ze.length){case 0:return function(F){return F};case 1:return de=Re[0],qe=ze[0],function(F){return de(F)?qe(F):F};case 2:return de=Re[0],ge=Re[1],qe=ze[0],$e=ze[1],function(F){return de(F)?qe(F):ge(F)?$e(F):F};default:return function(F){for(let X=0;X<ze.length;X++)if(Re[X](F))return ze[X](F);return F}}}function pe(ae){function de(ge,qe,$e){if(qe<ge.length){let Re=ge[qe],ze=[];if(Re.restParam){let Xe=Re.types.filter(k);Xe.length<Re.types.length&&ze.push({types:Xe,name:"..."+Xe.map(F=>F.name).join("|"),hasAny:Xe.some(F=>F.isAny),hasConversion:!1,restParam:!0}),ze.push(Re)}else ze=Re.types.map(function(Xe){return{types:[Xe],name:Xe.name,hasAny:Xe.isAny,hasConversion:Xe.conversion,restParam:!1}});return ie(ze,function(Xe){return de(ge,qe+1,$e.concat([Xe]))})}else return[$e]}return de(ae,0,[])}function _e(ae,de){let ge=Math.max(ae.length,de.length);for(let Xe=0;Xe<ge;Xe++){let F=L(ae,Xe),X=L(de,Xe),Ae=!1,Le;for(Le of X)if(F.has(Le)){Ae=!0;break}if(!Ae)return!1}let qe=ae.length,$e=de.length,Re=P(ae),ze=P(de);return Re?ze?qe===$e:$e>=qe:ze?qe>=$e:qe===$e}function Ne(ae){return ae.map(de=>Ze(de)?Te(de.referToSelf.callback):Ie(de)?le(de.referTo.references,de.referTo.callback):de)}function Se(ae,de,ge){let qe=[],$e;for($e of ae){let Re=ge[$e];if(typeof Re!="number")throw new TypeError('No definition for referenced signature "'+$e+'"');if(Re=de[Re],typeof Re!="function")return!1;qe.push(Re)}return qe}function Me(ae,de,ge){let qe=Ne(ae),$e=new Array(qe.length).fill(!1),Re=!0;for(;Re;){Re=!1;let ze=!0;for(let Xe=0;Xe<qe.length;++Xe){if($e[Xe])continue;let F=qe[Xe];if(Ze(F))qe[Xe]=F.referToSelf.callback(ge),qe[Xe].referToSelf=F.referToSelf,$e[Xe]=!0,ze=!1;else if(Ie(F)){let X=Se(F.referTo.references,qe,de);X?(qe[Xe]=F.referTo.callback.apply(this,X),qe[Xe].referTo=F.referTo,$e[Xe]=!0,ze=!1):Re=!0}}if(ze&&Re)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return qe}function Ee(ae){let de=/\bthis(\(|\.signatures\b)/;Object.keys(ae).forEach(ge=>{let qe=ae[ge];if(de.test(qe.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Ce(ae,de){if(p.createCount++,Object.keys(de).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&Ee(de);let ge=[],qe=[],$e={},Re=[],ze;for(ze in de){if(!Object.prototype.hasOwnProperty.call(de,ze))continue;let et=N(ze);if(!et)continue;ge.forEach(function(bn){if(_e(bn,et))throw new TypeError('Conflicting signatures "'+x(bn)+'" and "'+x(et)+'".')}),ge.push(et);let Vt=qe.length;qe.push(de[ze]);let Ar=et.map(E),yn;for(yn of pe(Ar)){let bn=x(yn);Re.push({params:yn,name:bn,fn:Vt}),yn.every(co=>!co.hasConversion)&&($e[bn]=Vt)}}Re.sort(Q);let Xe=Me(qe,$e,at),F;for(F in $e)Object.prototype.hasOwnProperty.call($e,F)&&($e[F]=Xe[$e[F]]);let X=[],Ae=new Map;for(F of Re)Ae.has(F.name)||(F.fn=Xe[F.fn],X.push(F),Ae.set(F.name,F));let Le=X[0]&&X[0].params.length<=2&&!P(X[0].params),ft=X[1]&&X[1].params.length<=2&&!P(X[1].params),St=X[2]&&X[2].params.length<=2&&!P(X[2].params),Ye=X[3]&&X[3].params.length<=2&&!P(X[3].params),kn=X[4]&&X[4].params.length<=2&&!P(X[4].params),ci=X[5]&&X[5].params.length<=2&&!P(X[5].params),Wr=Le&&ft&&St&&Ye&&kn&&ci;for(let et=0;et<X.length;++et)X[et].test=V(X[et].params);let Dn=Le?B(X[0].params[0]):e,ur=ft?B(X[1].params[0]):e,zo=St?B(X[2].params[0]):e,Sr=Ye?B(X[3].params[0]):e,xi=kn?B(X[4].params[0]):e,ea=ci?B(X[5].params[0]):e,Bi=Le?B(X[0].params[1]):e,dn=ft?B(X[1].params[1]):e,Nn=St?B(X[2].params[1]):e,wi=Ye?B(X[3].params[1]):e,Kr=kn?B(X[4].params[1]):e,Bn=ci?B(X[5].params[1]):e;for(let et=0;et<X.length;++et)X[et].implementation=me(X[et].params,X[et].fn);let hn=Le?X[0].implementation:t,_i=ft?X[1].implementation:t,rc=St?X[2].implementation:t,Fu=Ye?X[3].implementation:t,uo=kn?X[4].implementation:t,lo=ci?X[5].implementation:t,Iu=Le?X[0].params.length:-1,za=ft?X[1].params.length:-1,ba=St?X[2].params.length:-1,Pu=Ye?X[3].params.length:-1,ku=kn?X[4].params.length:-1,nc=ci?X[5].params.length:-1,ic=Wr?6:0,Yr=X.length,$=X.map(et=>et.test),ue=X.map(et=>et.implementation),Ve=function(){for(let Vt=ic;Vt<Yr;Vt++)if($[Vt](arguments))return ue[Vt].apply(this,arguments);return p.onMismatch(ae,arguments,X)};function at(et,Vt){return arguments.length===Iu&&Dn(et)&&Bi(Vt)?hn.apply(this,arguments):arguments.length===za&&ur(et)&&dn(Vt)?_i.apply(this,arguments):arguments.length===ba&&zo(et)&&Nn(Vt)?rc.apply(this,arguments):arguments.length===Pu&&Sr(et)&&wi(Vt)?Fu.apply(this,arguments):arguments.length===ku&&xi(et)&&Kr(Vt)?uo.apply(this,arguments):arguments.length===nc&&ea(et)&&Bn(Vt)?lo.apply(this,arguments):Ve.apply(this,arguments)}try{Object.defineProperty(at,"name",{value:ae})}catch{}return at.signatures=$e,at._typedFunctionData={signatures:X,signatureMap:Ae},at}function Ge(ae,de,ge){throw W(ae,de,ge)}function We(ae){return oe(ae,0,ae.length-1)}function te(ae){return ae[ae.length-1]}function oe(ae,de,ge){return Array.prototype.slice.call(ae,de,ge)}function he(ae,de){for(let ge=0;ge<ae.length;ge++)if(de(ae[ge]))return ae[ge]}function ie(ae,de){return Array.prototype.concat.apply([],ae.map(de))}function re(){let ae=We(arguments).map(ge=>x(N(ge))),de=te(arguments);if(typeof de!="function")throw new TypeError("Callback function expected as last argument");return le(ae,de)}function le(ae,de){return{referTo:{references:ae,callback:de}}}function Te(ae){if(typeof ae!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:ae}}}function Ie(ae){return ae&&typeof ae.referTo=="object"&&Array.isArray(ae.referTo.references)&&typeof ae.referTo.callback=="function"}function Ze(ae){return ae&&typeof ae.referToSelf=="object"&&typeof ae.referToSelf.callback=="function"}function xe(ae,de){if(!ae)return de;if(de&&de!==ae){let ge=new Error("Function names do not match (expected: "+ae+", actual: "+de+")");throw ge.data={actual:de,expected:ae},ge}return ae}function ht(ae){let de;for(let ge in ae)Object.prototype.hasOwnProperty.call(ae,ge)&&(S(ae[ge])||typeof ae[ge].signature=="string")&&(de=xe(de,ae[ge].name));return de}function Nt(ae,de){let ge;for(ge in de)if(Object.prototype.hasOwnProperty.call(de,ge)){if(ge in ae&&de[ge]!==ae[ge]){let qe=new Error('Signature "'+ge+'" is defined twice');throw qe.data={signature:ge,sourceFunction:de[ge],destFunction:ae[ge]},qe}ae[ge]=de[ge]}}let Ht=p;p=function(ae){let de=typeof ae=="string",ge=de?1:0,qe=de?ae:"",$e={};for(let Re=ge;Re<arguments.length;++Re){let ze=arguments[Re],Xe={},F;if(typeof ze=="function"?(F=ze.name,typeof ze.signature=="string"?Xe[ze.signature]=ze:S(ze)&&(Xe=ze.signatures)):o(ze)&&(Xe=ze,de||(F=ht(ze))),Object.keys(Xe).length===0){let X=new TypeError("Argument to 'typed' at index "+Re+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw X.data={index:Re,argument:ze},X}de||(qe=xe(qe,F)),Nt($e,Xe)}return Ce(qe||"",$e)},p.create=i,p.createCount=Ht.createCount,p.onMismatch=Ge,p.throwMismatchError=Ge,p.createError=W,p.clear=d,p.clearConversions=g,p.addTypes=h,p._findType=m,p.referTo=re,p.referToSelf=Te,p.convert=A,p.findSignature=b,p.find=w,p.isTypedFunction=S,p.warnAgainstDeprecatedThis=!0,p.addType=function(ae,de){let ge="any";de!==!1&&l.has("Object")&&(ge="Object"),p.addTypes([ae],ge)};function Et(ae){if(!ae||typeof ae.from!="string"||typeof ae.to!="string"||typeof ae.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(ae.to===ae.from)throw new SyntaxError('Illegal to define conversion from "'+ae.from+'" to itself.')}return p.addConversion=function(ae){Et(ae);let de=m(ae.to);if(de.conversionsTo.every(function(ge){return ge.from!==ae.from}))de.conversionsTo.push({from:ae.from,convert:ae.convert,index:f++});else throw new Error('There is already a conversion from "'+ae.from+'" to "'+de.name+'"')},p.addConversions=function(ae){ae.forEach(p.addConversion)},p.removeConversion=function(ae){Et(ae);let de=m(ae.to),ge=he(de.conversionsTo,$e=>$e.from===ae.from);if(!ge)throw new Error("Attempt to remove nonexistent conversion from "+ae.from+" to "+ae.to);if(ge.convert!==ae.convert)throw new Error("Conversion to remove does not match existing conversion");let qe=de.conversionsTo.indexOf(ge);de.conversionsTo.splice(qe,1)},p.resolve=function(ae,de){if(!S(ae))throw new TypeError(r);let ge=ae._typedFunctionData.signatures;for(let qe=0;qe<ge.length;++qe)if(ge[qe].test(de))return ge[qe];return null},p}var a=i();return a})});var MT=xn((uy,AT)=>{(function(n){"use strict";var e=Math.cosh||function(l){return Math.abs(l)<1e-9?1-l:(Math.exp(l)+Math.exp(-l))*.5},t=Math.sinh||function(l){return Math.abs(l)<1e-9?l:(Math.exp(l)-Math.exp(-l))*.5},r=function(l){var c=Math.PI/4;if(-c>l||l>c)return Math.cos(l)-1;var f=l*l;return f*(f*(f*(f*(f*(f*(f*(f/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-1/2)},i=function(l,c){var f=Math.abs(l),p=Math.abs(c);return f<3e3&&p<3e3?Math.sqrt(f*f+p*p):(f<p?(f=p,p=l/c):p=c/l,f*Math.sqrt(1+p*p))},a=function(){throw SyntaxError("Invalid Param")};function o(l,c){var f=Math.abs(l),p=Math.abs(c);return l===0?Math.log(p):c===0?Math.log(f):f<3e3&&p<3e3?Math.log(l*l+c*c)*.5:(l=l/2,c=c/2,.5*Math.log(l*l+c*c)+Math.LN2)}var u=function(l,c){var f={re:0,im:0};if(l==null)f.re=f.im=0;else if(c!==void 0)f.re=l,f.im=c;else switch(typeof l){case"object":if("im"in l&&"re"in l)f.re=l.re,f.im=l.im;else if("abs"in l&&"arg"in l){if(!Number.isFinite(l.abs)&&Number.isFinite(l.arg))return s.INFINITY;f.re=l.abs*Math.cos(l.arg),f.im=l.abs*Math.sin(l.arg)}else if("r"in l&&"phi"in l){if(!Number.isFinite(l.r)&&Number.isFinite(l.phi))return s.INFINITY;f.re=l.r*Math.cos(l.phi),f.im=l.r*Math.sin(l.phi)}else l.length===2?(f.re=l[0],f.im=l[1]):a();break;case"string":f.im=f.re=0;var p=l.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),m=1,h=0;p===null&&a();for(var d=0;d<p.length;d++){var g=p[d];g===" "||g==="	"||g===`
`||(g==="+"?m++:g==="-"?h++:g==="i"||g==="I"?(m+h===0&&a(),p[d+1]!==" "&&!isNaN(p[d+1])?(f.im+=parseFloat((h%2?"-":"")+p[d+1]),d++):f.im+=parseFloat((h%2?"-":"")+"1"),m=h=0):((m+h===0||isNaN(g))&&a(),p[d+1]==="i"||p[d+1]==="I"?(f.im+=parseFloat((h%2?"-":"")+g),d++):f.re+=parseFloat((h%2?"-":"")+g),m=h=0))}m+h>0&&a();break;case"number":f.im=0,f.re=l;break;default:a()}return isNaN(f.re)||isNaN(f.im),f};function s(l,c){if(!(this instanceof s))return new s(l,c);var f=u(l,c);this.re=f.re,this.im=f.im}s.prototype={re:0,im:0,sign:function(){var l=this.abs();return new s(this.re/l,this.im/l)},add:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:new s(this.re+f.re,this.im+f.im)},sub:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:new s(this.re-f.re,this.im-f.im)},mul:function(l,c){var f=new s(l,c);return this.isInfinite()&&f.isZero()||this.isZero()&&f.isInfinite()?s.NAN:this.isInfinite()||f.isInfinite()?s.INFINITY:f.im===0&&this.im===0?new s(this.re*f.re,0):new s(this.re*f.re-this.im*f.im,this.re*f.im+this.im*f.re)},div:function(l,c){var f=new s(l,c);if(this.isZero()&&f.isZero()||this.isInfinite()&&f.isInfinite())return s.NAN;if(this.isInfinite()||f.isZero())return s.INFINITY;if(this.isZero()||f.isInfinite())return s.ZERO;l=this.re,c=this.im;var p=f.re,m=f.im,h,d;return m===0?new s(l/p,c/p):Math.abs(p)<Math.abs(m)?(d=p/m,h=p*d+m,new s((l*d+c)/h,(c*d-l)/h)):(d=m/p,h=m*d+p,new s((l+c*d)/h,(c-l*d)/h))},pow:function(l,c){var f=new s(l,c);if(l=this.re,c=this.im,f.isZero())return s.ONE;if(f.im===0){if(c===0&&l>0)return new s(Math.pow(l,f.re),0);if(l===0)switch((f.re%4+4)%4){case 0:return new s(Math.pow(c,f.re),0);case 1:return new s(0,Math.pow(c,f.re));case 2:return new s(-Math.pow(c,f.re),0);case 3:return new s(0,-Math.pow(c,f.re))}}if(l===0&&c===0&&f.re>0&&f.im>=0)return s.ZERO;var p=Math.atan2(c,l),m=o(l,c);return l=Math.exp(f.re*m-f.im*p),c=f.im*m+f.re*p,new s(l*Math.cos(c),l*Math.sin(c))},sqrt:function(){var l=this.re,c=this.im,f=this.abs(),p,m;if(l>=0){if(c===0)return new s(Math.sqrt(l),0);p=.5*Math.sqrt(2*(f+l))}else p=Math.abs(c)/Math.sqrt(2*(f-l));return l<=0?m=.5*Math.sqrt(2*(f-l)):m=Math.abs(c)/Math.sqrt(2*(f+l)),new s(p,c<0?-m:m)},exp:function(){var l=Math.exp(this.re);return this.im,new s(l*Math.cos(this.im),l*Math.sin(this.im))},expm1:function(){var l=this.re,c=this.im;return new s(Math.expm1(l)*Math.cos(c)+r(c),Math.exp(l)*Math.sin(c))},log:function(){var l=this.re,c=this.im;return c===0&&l>0,new s(o(l,c),Math.atan2(c,l))},abs:function(){return i(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var l=this.re,c=this.im;return new s(Math.sin(l)*e(c),Math.cos(l)*t(c))},cos:function(){var l=this.re,c=this.im;return new s(Math.cos(l)*e(c),-Math.sin(l)*t(c))},tan:function(){var l=2*this.re,c=2*this.im,f=Math.cos(l)+e(c);return new s(Math.sin(l)/f,t(c)/f)},cot:function(){var l=2*this.re,c=2*this.im,f=Math.cos(l)-e(c);return new s(-Math.sin(l)/f,t(c)/f)},sec:function(){var l=this.re,c=this.im,f=.5*e(2*c)+.5*Math.cos(2*l);return new s(Math.cos(l)*e(c)/f,Math.sin(l)*t(c)/f)},csc:function(){var l=this.re,c=this.im,f=.5*e(2*c)-.5*Math.cos(2*l);return new s(Math.sin(l)*e(c)/f,-Math.cos(l)*t(c)/f)},asin:function(){var l=this.re,c=this.im,f=new s(c*c-l*l+1,-2*l*c).sqrt(),p=new s(f.re-c,f.im+l).log();return new s(p.im,-p.re)},acos:function(){var l=this.re,c=this.im,f=new s(c*c-l*l+1,-2*l*c).sqrt(),p=new s(f.re-c,f.im+l).log();return new s(Math.PI/2-p.im,p.re)},atan:function(){var l=this.re,c=this.im;if(l===0){if(c===1)return new s(0,1/0);if(c===-1)return new s(0,-1/0)}var f=l*l+(1-c)*(1-c),p=new s((1-c*c-l*l)/f,-2*l/f).log();return new s(-.5*p.im,.5*p.re)},acot:function(){var l=this.re,c=this.im;if(c===0)return new s(Math.atan2(1,l),0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).atan():new s(l!==0?l/0:0,c!==0?-c/0:0).atan()},asec:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(0,1/0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).acos():new s(l!==0?l/0:0,c!==0?-c/0:0).acos()},acsc:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(Math.PI/2,1/0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).asin():new s(l!==0?l/0:0,c!==0?-c/0:0).asin()},sinh:function(){var l=this.re,c=this.im;return new s(t(l)*Math.cos(c),e(l)*Math.sin(c))},cosh:function(){var l=this.re,c=this.im;return new s(e(l)*Math.cos(c),t(l)*Math.sin(c))},tanh:function(){var l=2*this.re,c=2*this.im,f=e(l)+Math.cos(c);return new s(t(l)/f,Math.sin(c)/f)},coth:function(){var l=2*this.re,c=2*this.im,f=e(l)-Math.cos(c);return new s(t(l)/f,-Math.sin(c)/f)},csch:function(){var l=this.re,c=this.im,f=Math.cos(2*c)-e(2*l);return new s(-2*t(l)*Math.cos(c)/f,2*e(l)*Math.sin(c)/f)},sech:function(){var l=this.re,c=this.im,f=Math.cos(2*c)+e(2*l);return new s(2*e(l)*Math.cos(c)/f,-2*t(l)*Math.sin(c)/f)},asinh:function(){var l=this.im;this.im=-this.re,this.re=l;var c=this.asin();return this.re=-this.im,this.im=l,l=c.re,c.re=-c.im,c.im=l,c},acosh:function(){var l=this.acos();if(l.im<=0){var c=l.re;l.re=-l.im,l.im=c}else{var c=l.im;l.im=-l.re,l.re=c}return l},atanh:function(){var l=this.re,c=this.im,f=l>1&&c===0,p=1-l,m=1+l,h=p*p+c*c,d=h!==0?new s((m*p-c*c)/h,(c*p+m*c)/h):new s(l!==-1?l/0:0,c!==0?c/0:0),g=d.re;return d.re=o(d.re,d.im)/2,d.im=Math.atan2(d.im,g)/2,f&&(d.im=-d.im),d},acoth:function(){var l=this.re,c=this.im;if(l===0&&c===0)return new s(0,Math.PI/2);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).atanh():new s(l!==0?l/0:0,c!==0?-c/0:0).atanh()},acsch:function(){var l=this.re,c=this.im;if(c===0)return new s(l!==0?Math.log(l+Math.sqrt(l*l+1)):1/0,0);var f=l*l+c*c;return f!==0?new s(l/f,-c/f).asinh():new s(l!==0?l/0:0,c!==0?-c/0:0).asinh()},asech:function(){var l=this.re,c=this.im;if(this.isZero())return s.INFINITY;var f=l*l+c*c;return f!==0?new s(l/f,-c/f).acosh():new s(l!==0?l/0:0,c!==0?-c/0:0).acosh()},inverse:function(){if(this.isZero())return s.INFINITY;if(this.isInfinite())return s.ZERO;var l=this.re,c=this.im,f=l*l+c*c;return new s(l/f,-c/f)},conjugate:function(){return new s(this.re,-this.im)},neg:function(){return new s(-this.re,-this.im)},ceil:function(l){return l=Math.pow(10,l||0),new s(Math.ceil(this.re*l)/l,Math.ceil(this.im*l)/l)},floor:function(l){return l=Math.pow(10,l||0),new s(Math.floor(this.re*l)/l,Math.floor(this.im*l)/l)},round:function(l){return l=Math.pow(10,l||0),new s(Math.round(this.re*l)/l,Math.round(this.im*l)/l)},equals:function(l,c){var f=new s(l,c);return Math.abs(f.re-this.re)<=s.EPSILON&&Math.abs(f.im-this.im)<=s.EPSILON},clone:function(){return new s(this.re,this.im)},toString:function(){var l=this.re,c=this.im,f="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(l)<s.EPSILON&&(l=0),Math.abs(c)<s.EPSILON&&(c=0),c===0?f+l:(l!==0?(f+=l,f+=" ",c<0?(c=-c,f+="-"):f+="+",f+=" "):c<0&&(c=-c,f+="-"),c!==1&&(f+=c),f+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return this.im===0?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return this.im===0&&this.re===0},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},s.ZERO=new s(0,0),s.ONE=new s(1,0),s.I=new s(0,1),s.PI=new s(Math.PI,0),s.E=new s(Math.E,0),s.INFINITY=new s(1/0,1/0),s.NAN=new s(NaN,NaN),s.EPSILON=1e-15,typeof define=="function"&&define.amd?define([],function(){return s}):typeof uy=="object"?(Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Complex=s,AT.exports=s):n.Complex=s})(uy)});var DT=xn((cy,ET)=>{(function(n){"use strict";var e=2e3,t={s:1,n:0,d:1};function r(d,g){if(isNaN(d=parseInt(d,10)))throw m();return d*g}function i(d,g){if(g===0)throw p();var y=Object.create(f.prototype);y.s=d<0?-1:1,d=d<0?-d:d;var S=c(d,g);return y.n=d/S,y.d=g/S,y}function a(d){for(var g={},y=d,S=2,b=4;b<=y;){for(;y%S===0;)y/=S,g[S]=(g[S]||0)+1;b+=1+2*S++}return y!==d?y>1&&(g[y]=(g[y]||0)+1):g[d]=(g[d]||0)+1,g}var o=function(d,g){var y=0,S=1,b=1,w=0,A=0,x=0,D=1,E=1,_=0,N=1,P=1,B=1,V=1e7,z;if(d!=null)if(g!==void 0){if(y=d,S=g,b=y*S,y%1!==0||S%1!==0)throw h()}else switch(typeof d){case"object":{if("d"in d&&"n"in d)y=d.n,S=d.d,"s"in d&&(y*=d.s);else if(0 in d)y=d[0],1 in d&&(S=d[1]);else throw m();b=y*S;break}case"number":{if(d<0&&(b=d,d=-d),d%1===0)y=d;else if(d>0){for(d>=1&&(E=Math.pow(10,Math.floor(1+Math.log(d)/Math.LN10)),d/=E);N<=V&&B<=V;)if(z=(_+P)/(N+B),d===z){N+B<=V?(y=_+P,S=N+B):B>N?(y=P,S=B):(y=_,S=N);break}else d>z?(_+=P,N+=B):(P+=_,B+=N),N>V?(y=P,S=B):(y=_,S=N);y*=E}else(isNaN(d)||isNaN(g))&&(S=y=NaN);break}case"string":{if(N=d.match(/\d+|./g),N===null)throw m();if(N[_]==="-"?(b=-1,_++):N[_]==="+"&&_++,N.length===_+1?A=r(N[_++],b):N[_+1]==="."||N[_]==="."?(N[_]!=="."&&(w=r(N[_++],b)),_++,(_+1===N.length||N[_+1]==="("&&N[_+3]===")"||N[_+1]==="'"&&N[_+3]==="'")&&(A=r(N[_],b),D=Math.pow(10,N[_].length),_++),(N[_]==="("&&N[_+2]===")"||N[_]==="'"&&N[_+2]==="'")&&(x=r(N[_+1],b),E=Math.pow(10,N[_+1].length)-1,_+=3)):N[_+1]==="/"||N[_+1]===":"?(A=r(N[_],b),D=r(N[_+2],1),_+=3):N[_+3]==="/"&&N[_+1]===" "&&(w=r(N[_],b),A=r(N[_+2],b),D=r(N[_+4],1),_+=5),N.length<=_){S=D*E,b=y=x+S*w+E*A;break}}default:throw m()}if(S===0)throw p();t.s=b<0?-1:1,t.n=Math.abs(y),t.d=Math.abs(S)};function u(d,g,y){for(var S=1;g>0;d=d*d%y,g>>=1)g&1&&(S=S*d%y);return S}function s(d,g){for(;g%2===0;g/=2);for(;g%5===0;g/=5);if(g===1)return 0;for(var y=10%g,S=1;y!==1;S++)if(y=y*10%g,S>e)return 0;return S}function l(d,g,y){for(var S=1,b=u(10,y,g),w=0;w<300;w++){if(S===b)return w;S=S*10%g,b=b*10%g}return 0}function c(d,g){if(!d)return g;if(!g)return d;for(;;){if(d%=g,!d)return g;if(g%=d,!g)return d}}function f(d,g){if(o(d,g),this instanceof f)d=c(t.d,t.n),this.s=t.s,this.n=t.n/d,this.d=t.d/d;else return i(t.s*t.n,t.d)}var p=function(){return new Error("Division by Zero")},m=function(){return new Error("Invalid argument")},h=function(){return new Error("Parameters must be integer")};f.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(d,g){return o(d,g),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(d,g){return o(d,g),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(d,g){return o(d,g),i(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(d,g){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(d===void 0)return i(this.s*this.n%this.d,1);if(o(d,g),t.n===0&&this.d===0)throw p();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(d,g){return o(d,g),i(c(t.n,this.n)*c(t.d,this.d),t.d*this.d)},lcm:function(d,g){return o(d,g),t.n===0&&this.n===0?i(0,1):i(t.n*this.n,c(t.n,this.n)*c(t.d,this.d))},ceil:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.ceil(d*this.s*this.n/this.d),d)},floor:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.floor(d*this.s*this.n/this.d),d)},round:function(d){return d=Math.pow(10,d||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):i(Math.round(d*this.s*this.n/this.d),d)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(d,g){if(o(d,g),t.d===1)return t.s<0?i(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):i(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var y=a(this.n),S=a(this.d),b=1,w=1;for(var A in y)if(A!=="1"){if(A==="0"){b=0;break}if(y[A]*=t.n,y[A]%t.d===0)y[A]/=t.d;else return null;b*=Math.pow(A,y[A])}for(var A in S)if(A!=="1"){if(S[A]*=t.n,S[A]%t.d===0)S[A]/=t.d;else return null;w*=Math.pow(A,S[A])}return t.s<0?i(w,b):i(b,w)},equals:function(d,g){return o(d,g),this.s*this.n*t.d===t.s*t.n*this.d},compare:function(d,g){o(d,g);var y=this.s*this.n*t.d-t.s*t.n*this.d;return(0<y)-(y<0)},simplify:function(d){if(isNaN(this.n)||isNaN(this.d))return this;d=d||.001;for(var g=this.abs(),y=g.toContinued(),S=1;S<y.length;S++){for(var b=i(y[S-1],1),w=S-2;w>=0;w--)b=b.inverse().add(y[w]);if(Math.abs(b.sub(g).valueOf())<d)return b.mul(this.s)}return this},divisible:function(d,g){return o(d,g),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(d){var g,y="",S=this.n,b=this.d;return this.s<0&&(y+="-"),b===1?y+=S:(d&&(g=Math.floor(S/b))>0&&(y+=g,y+=" ",S%=b),y+=S,y+="/",y+=b),y},toLatex:function(d){var g,y="",S=this.n,b=this.d;return this.s<0&&(y+="-"),b===1?y+=S:(d&&(g=Math.floor(S/b))>0&&(y+=g,S%=b),y+="\\frac{",y+=S,y+="}{",y+=b,y+="}"),y},toContinued:function(){var d,g=this.n,y=this.d,S=[];if(isNaN(g)||isNaN(y))return S;do S.push(Math.floor(g/y)),d=g%y,g=y,y=d;while(g!==1);return S},toString:function(d){var g=this.n,y=this.d;if(isNaN(g)||isNaN(y))return"NaN";d=d||15;var S=s(g,y),b=l(g,y,S),w=this.s<0?"-":"";if(w+=g/y|0,g%=y,g*=10,g&&(w+="."),S){for(var A=b;A--;)w+=g/y|0,g%=y,g*=10;w+="(";for(var A=S;A--;)w+=g/y|0,g%=y,g*=10;w+=")"}else for(var A=d;g&&A--;)w+=g/y|0,g%=y,g*=10;return w}},typeof cy=="object"?(Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,ET.exports=f):n.Fraction=f})(cy)});var zF=xn((OMe,qF)=>{qF.exports=function n(e,t){"use strict";var r=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,i=/(^[ ]*|[ ]*$)/g,a=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,u=/^0/,s=function(b){return n.insensitive&&(""+b).toLowerCase()||""+b},l=s(e).replace(i,"")||"",c=s(t).replace(i,"")||"",f=l.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=c.replace(r,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(l.match(o),16)||f.length!==1&&l.match(a)&&Date.parse(l),h=parseInt(c.match(o),16)||m&&c.match(a)&&Date.parse(c)||null,d,g;if(h){if(m<h)return-1;if(m>h)return 1}for(var y=0,S=Math.max(f.length,p.length);y<S;y++){if(d=!(f[y]||"").match(u)&&parseFloat(f[y])||f[y]||0,g=!(p[y]||"").match(u)&&parseFloat(p[y])||p[y]||0,isNaN(d)!==isNaN(g))return isNaN(d)?1:-1;if(typeof d!=typeof g&&(d+="",g+=""),d<g)return-1;if(d>g)return 1}return 0}});var G2=xn((KCe,H2)=>{"use strict";var F1=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},EX={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},DX={"\u2013":"\\--","\u2014":"\\---"," ":"~","	":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},NX=function(e,t){return F1({},e,t)};H2.exports=function(n){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.preserveFormatting,r=t===void 0?!1:t,i=e.escapeMapFn,a=i===void 0?NX:i,o=String(n),u="",s=a(F1({},EX),r?F1({},DX):{}),l=Object.keys(s),c=function(){var p=!1;l.forEach(function(m,h){p||o.length>=m.length&&o.slice(0,m.length)===m&&(u+=s[l[h]],o=o.slice(m.length,o.length),p=!0)}),p||(u+=o.slice(0,1),o=o.slice(1,o.length))};o;)c();return u}});var wR=xn((xR,Iw)=>{(function(n,e,t){function r(u){var s=this,l=o();s.next=function(){var c=2091639*s.s0+s.c*23283064365386963e-26;return s.s0=s.s1,s.s1=s.s2,s.s2=c-(s.c=c|0)},s.c=1,s.s0=l(" "),s.s1=l(" "),s.s2=l(" "),s.s0-=l(u),s.s0<0&&(s.s0+=1),s.s1-=l(u),s.s1<0&&(s.s1+=1),s.s2-=l(u),s.s2<0&&(s.s2+=1),l=null}function i(u,s){return s.c=u.c,s.s0=u.s0,s.s1=u.s1,s.s2=u.s2,s}function a(u,s){var l=new r(u),c=s&&s.state,f=l.next;return f.int32=function(){return l.next()*4294967296|0},f.double=function(){return f()+(f()*2097152|0)*11102230246251565e-32},f.quick=f,c&&(typeof c=="object"&&i(c,l),f.state=function(){return i(l,{})}),f}function o(){var u=4022871197,s=function(l){l=String(l);for(var c=0;c<l.length;c++){u+=l.charCodeAt(c);var f=.02519603282416938*u;u=f>>>0,f-=u,f*=u,u=f>>>0,f-=u,u+=f*4294967296}return(u>>>0)*23283064365386963e-26};return s}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.alea=a})(xR,typeof Iw=="object"&&Iw,typeof define=="function"&&define)});var SR=xn((_R,Pw)=>{(function(n,e,t){function r(o){var u=this,s="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var c=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^c^c>>>8},o===(o|0)?u.x=o:s+=o;for(var l=0;l<s.length+64;l++)u.x^=s.charCodeAt(l)|0,u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor128=a})(_R,typeof Pw=="object"&&Pw,typeof define=="function"&&define)});var MR=xn((AR,kw)=>{(function(n,e,t){function r(o){var u=this,s="";u.next=function(){var c=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(c^c<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,o===(o|0)?u.x=o:s+=o;for(var l=0;l<s.length+64;l++)u.x^=s.charCodeAt(l)|0,l==s.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function i(o,u){return u.x=o.x,u.y=o.y,u.z=o.z,u.w=o.w,u.v=o.v,u.d=o.d,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorwow=a})(AR,typeof kw=="object"&&kw,typeof define=="function"&&define)});var DR=xn((ER,Bw)=>{(function(n,e,t){function r(o){var u=this;u.next=function(){var l=u.x,c=u.i,f,p,m;return f=l[c],f^=f>>>7,p=f^f<<24,f=l[c+1&7],p^=f^f>>>10,f=l[c+3&7],p^=f^f>>>3,f=l[c+4&7],p^=f^f<<7,f=l[c+7&7],f=f^f<<13,p^=f^f<<9,l[c]=p,u.i=c+1&7,p};function s(l,c){var f,p,m=[];if(c===(c|0))p=m[0]=c;else for(c=""+c,f=0;f<c.length;++f)m[f&7]=m[f&7]<<15^c.charCodeAt(f)+m[f+1&7]<<13;for(;m.length<8;)m.push(0);for(f=0;f<8&&m[f]===0;++f);for(f==8?p=m[7]=-1:p=m[f],l.x=m,l.i=0,f=256;f>0;--f)l.next()}s(u,o)}function i(o,u){return u.x=o.x.slice(),u.i=o.i,u}function a(o,u){o==null&&(o=+new Date);var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(l.x&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xorshift7=a})(ER,typeof Bw=="object"&&Bw,typeof define=="function"&&define)});var TR=xn((NR,Ow)=>{(function(n,e,t){function r(o){var u=this;u.next=function(){var l=u.w,c=u.X,f=u.i,p,m;return u.w=l=l+1640531527|0,m=c[f+34&127],p=c[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=c[f]=m^p,u.i=f,m+(l^l>>>16)|0};function s(l,c){var f,p,m,h,d,g=[],y=128;for(c===(c|0)?(p=c,c=null):(c=c+"\0",p=0,y=Math.max(y,c.length)),m=0,h=-32;h<y;++h)c&&(p^=c.charCodeAt((h+32)%c.length)),h===0&&(d=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,h>=0&&(d=d+1640531527|0,f=g[h&127]^=p+d,m=f==0?m+1:0);for(m>=128&&(g[(c&&c.length||0)&127]=-1),m=127,h=4*128;h>0;--h)p=g[m+34&127],f=g[m=m+1&127],p^=p<<13,f^=f<<17,p^=p>>>15,f^=f>>>12,g[m]=p^f;l.w=d,l.X=g,l.i=m}s(u,o)}function i(o,u){return u.i=o.i,u.w=o.w,u.X=o.X.slice(),u}function a(o,u){o==null&&(o=+new Date);var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(l.X&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.xor4096=a})(NR,typeof Ow=="object"&&Ow,typeof define=="function"&&define)});var FR=xn((CR,Rw)=>{(function(n,e,t){function r(o){var u=this,s="";u.next=function(){var c=u.b,f=u.c,p=u.d,m=u.a;return c=c<<25^c>>>7^f,f=f-p|0,p=p<<24^p>>>8^m,m=m-c|0,u.b=c=c<<20^c>>>12^f,u.c=f=f-p|0,u.d=p<<16^f>>>16^m,u.a=m-c|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,o===Math.floor(o)?(u.a=o/4294967296|0,u.b=o|0):s+=o;for(var l=0;l<s.length+20;l++)u.b^=s.charCodeAt(l)|0,u.next()}function i(o,u){return u.a=o.a,u.b=o.b,u.c=o.c,u.d=o.d,u}function a(o,u){var s=new r(o),l=u&&u.state,c=function(){return(s.next()>>>0)/4294967296};return c.double=function(){do var f=s.next()>>>11,p=(s.next()>>>0)/4294967296,m=(f+p)/(1<<21);while(m===0);return m},c.int32=s.next,c.quick=c,l&&(typeof l=="object"&&i(l,s),c.state=function(){return i(s,{})}),c}e&&e.exports?e.exports=a:t&&t.amd?t(function(){return a}):this.tychei=a})(CR,typeof Rw=="object"&&Rw,typeof define=="function"&&define)});var PR=xn((IR,bd)=>{(function(n,e,t){var r=256,i=6,a=52,o="random",u=t.pow(r,i),s=t.pow(2,a),l=s*2,c=r-1,f;function p(b,w,A){var x=[];w=w==!0?{entropy:!0}:w||{};var D=g(d(w.entropy?[b,S(e)]:b??y(),3),x),E=new m(x),_=function(){for(var N=E.g(i),P=u,B=0;N<s;)N=(N+B)*r,P*=r,B=E.g(1);for(;N>=l;)N/=2,P/=2,B>>>=1;return(N+B)/P};return _.int32=function(){return E.g(4)|0},_.quick=function(){return E.g(4)/4294967296},_.double=_,g(S(E.S),e),(w.pass||A||function(N,P,B,V){return V&&(V.S&&h(V,E),N.state=function(){return h(E,{})}),B?(t[o]=N,P):N})(_,D,"global"in w?w.global:this==t,w.state)}function m(b){var w,A=b.length,x=this,D=0,E=x.i=x.j=0,_=x.S=[];for(A||(b=[A++]);D<r;)_[D]=D++;for(D=0;D<r;D++)_[D]=_[E=c&E+b[D%A]+(w=_[D])],_[E]=w;(x.g=function(N){for(var P,B=0,V=x.i,z=x.j,L=x.S;N--;)P=L[V=c&V+1],B=B*r+L[c&(L[V]=L[z=c&z+P])+(L[z]=P)];return x.i=V,x.j=z,B})(r)}function h(b,w){return w.i=b.i,w.j=b.j,w.S=b.S.slice(),w}function d(b,w){var A=[],x=typeof b,D;if(w&&x=="object")for(D in b)try{A.push(d(b[D],w-1))}catch{}return A.length?A:x=="string"?b:b+"\0"}function g(b,w){for(var A=b+"",x,D=0;D<A.length;)w[c&D]=c&(x^=w[c&D]*19)+A.charCodeAt(D++);return S(w)}function y(){try{var b;return f&&(b=f.randomBytes)?b=b(r):(b=new Uint8Array(r),(n.crypto||n.msCrypto).getRandomValues(b)),S(b)}catch{var w=n.navigator,A=w&&w.plugins;return[+new Date,n,A,n.screen,S(e)]}}function S(b){return String.fromCharCode.apply(0,b)}if(g(t.random(),e),typeof bd=="object"&&bd.exports){bd.exports=p;try{f=require("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return p}):t["seed"+o]=p})(typeof self<"u"?self:IR,[],Math)});var BR=xn((y8e,kR)=>{var GQ=wR(),WQ=SR(),YQ=MR(),jQ=DR(),ZQ=TR(),JQ=FR(),su=PR();su.alea=GQ;su.xor128=WQ;su.xorwow=YQ;su.xorshift7=jQ;su.xor4096=ZQ;su.tychei=JQ;kR.exports=su});var aae={};uz(aae,{MetaBindBuild:()=>LM,default:()=>fg});module.exports=lz(aae);var tc=require("obsidian");var wE=["January","February","March","April","May","June","July","August","September","October","November","December"],Us=[{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"}],wa={devMode:!1,ignoreCodeBlockRestrictions:!1,preferredDateFormat:"YYYY-MM-DD",firstWeekday:Us[1],syncInterval:200,minSyncInterval:50,maxSyncInterval:1e3,enableJs:!1,viewFieldDisplayNullAsEmpty:!1,enableSyntaxHighlighting:!0,enableEditorRightClickMenu:!0,inputFieldTemplates:[],buttonTemplates:[],excludedFolders:["templates"]};var Wo=(x=>(x.TOGGLE="toggle",x.SLIDER="slider",x.TEXT="text",x.TEXT_AREA="textArea",x.SELECT="select",x.MULTI_SELECT="multiSelect",x.DATE="date",x.TIME="time",x.DATE_PICKER="datePicker",x.NUMBER="number",x.SUGGESTER="suggester",x.EDITOR="editor",x.IMAGE_SUGGESTER="imageSuggester",x.PROGRESS_BAR="progressBar",x.INLINE_SELECT="inlineSelect",x.LIST="list",x.LIST_SUGGESTER="listSuggester",x.INLINE_LIST_SUGGESTER="inlineListSuggester",x.INLINE_LIST="inlineList",x.IMAGE_LIST_SUGGESTER="imageListSuggester",x.DATE_TIME="dateTime",x.INVALID="invalid",x))(Wo||{}),Zr=(S=>(S.CLASS="class",S.ADD_LABELS="addLabels",S.MIN_VALUE="minValue",S.MAX_VALUE="maxValue",S.STEP_SIZE="stepSize",S.OPTION="option",S.TITLE="title",S.OPTION_QUERY="optionQuery",S.SHOWCASE="showcase",S.ON_VALUE="onValue",S.OFF_VALUE="offValue",S.DEFAULT_VALUE="defaultValue",S.PLACEHOLDER="placeholder",S.USE_LINKS="useLinks",S.LIMIT="limit",S.MULTI_LINE="multiLine",S.ALLOW_OTHER="allowOther",S.INVALID="invalid",S))(Zr||{}),zf={toggle:{type:"toggle",allowInBlock:!0,allowInline:!0},slider:{type:"slider",allowInBlock:!0,allowInline:!0},text:{type:"text",allowInBlock:!0,allowInline:!0},textArea:{type:"textArea",allowInBlock:!0,allowInline:!0},select:{type:"select",allowInBlock:!0,allowInline:!1},multiSelect:{type:"multiSelect",allowInBlock:!0,allowInline:!1},date:{type:"date",allowInBlock:!0,allowInline:!0},time:{type:"time",allowInBlock:!0,allowInline:!0},datePicker:{type:"datePicker",allowInBlock:!0,allowInline:!0},number:{type:"number",allowInBlock:!0,allowInline:!0},suggester:{type:"suggester",allowInBlock:!0,allowInline:!0},editor:{type:"editor",allowInBlock:!0,allowInline:!1},imageSuggester:{type:"imageSuggester",allowInBlock:!0,allowInline:!1},progressBar:{type:"progressBar",allowInBlock:!0,allowInline:!1},inlineSelect:{type:"inlineSelect",allowInBlock:!0,allowInline:!0},list:{type:"list",allowInBlock:!0,allowInline:!1},listSuggester:{type:"listSuggester",allowInBlock:!0,allowInline:!1},inlineListSuggester:{type:"inlineListSuggester",allowInBlock:!0,allowInline:!0},inlineList:{type:"inlineList",allowInBlock:!0,allowInline:!0},imageListSuggester:{type:"imageListSuggester",allowInBlock:!0,allowInline:!1},dateTime:{type:"dateTime",allowInBlock:!0,allowInline:!0},invalid:{type:"invalid",allowInBlock:!1,allowInline:!1}};var yr={addLabels:{type:"addLabels",allowedFieldTypes:["slider","progressBar"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},class:{type:"class",allowedFieldTypes:[],values:[[{name:"className",allowed:[],description:"the name of the css class to add"}]],allowMultiple:!0},defaultValue:{type:"defaultValue",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},maxValue:{type:"maxValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the maximally allowed value"}]],allowMultiple:!1},minValue:{type:"minValue",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the minimally allowed value"}]],allowMultiple:!1},stepSize:{type:"stepSize",allowedFieldTypes:["slider","progressBar"],values:[[{name:"value",allowed:["number"],description:"the step size for sliders"}]],allowMultiple:!1},offValue:{type:"offValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},onValue:{type:"onValue",allowedFieldTypes:["toggle"],values:[[{name:"value",allowed:[],description:"the value for the off state"}]],allowMultiple:!1},option:{type:"option",allowedFieldTypes:["select","multiSelect","suggester","imageSuggester","inlineSelect","listSuggester","inlineListSuggester","imageListSuggester"],values:[[{name:"value",allowed:[],description:"the value and display name of the option"}],[{name:"value",allowed:[],description:"the value of the option"},{name:"name",allowed:[],description:"the display name of the option"}]],allowMultiple:!0},optionQuery:{type:"optionQuery",allowedFieldTypes:["suggester","imageSuggester","listSuggester","inlineListSuggester","imageListSuggester"],values:[[{name:"value",allowed:[],description:"the query for options"}]],allowMultiple:!0},placeholder:{type:"placeholder",allowedFieldTypes:["text","textArea","number","list","inlineList"],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},showcase:{type:"showcase",allowedFieldTypes:[],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},title:{type:"title",allowedFieldTypes:[],values:[[{name:"value",allowed:[],description:""}]],allowMultiple:!1},useLinks:{type:"useLinks",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","partial","false"],description:""}]],allowMultiple:!1},limit:{type:"limit",allowedFieldTypes:["text","textArea","list","inlineList"],values:[[{name:"value",allowed:["number"],description:"a character limit for text fields"}]],allowMultiple:!1},multiLine:{type:"multiLine",allowedFieldTypes:["list"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},allowOther:{type:"allowOther",allowedFieldTypes:["suggester","listSuggester","inlineListSuggester"],values:[[],[{name:"value",allowed:["true","false"],description:""}]],allowMultiple:!1},invalid:{type:"invalid",allowedFieldTypes:[],values:[[]],allowMultiple:!0}},cc=(a=>(a.MATH="math",a.TEXT="text",a.LINK="link",a.IMAGE="image",a.INVALID="invalid",a))(cc||{}),qs=(i=>(i.RENDER_MARKDOWN="renderMarkdown",i.HIDDEN="hidden",i.CLASS="class",i.INVALID="invalid",i))(qs||{}),Uu={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}},$f=8;var wn=class extends Error{constructor(e){super(""),this.errorLevel=e.errorLevel,this.effect=e.effect,this.cause=e.cause,this.tip=e.tip,this.docs=e.docs,this.context=e.context,this.positionContext=e.positionContext,this.updateMessage()}updateMessage(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"`}log(){console.log(this.message,this.stack,this.context)}},Ut=class extends wn{getErrorType(){return"MB_INTERNAL"}},_a=class extends wn{getErrorType(){return"MB_PARSING"}},Yo=class extends wn{getErrorType(){return"MB_VALIDATION"}},Hf=class extends wn{getErrorType(){return"MB_BIND_TARGET"}};var Cr=class extends wn{getErrorType(){return"MB_ARGUMENT"}},yo=class extends wn{getErrorType(){return"MB_JS"}},Sa=class extends wn{getErrorType(){return"MB_EXPRESSION"}};var fc=class extends wn{getErrorType(){return"MB_EXAMPLE"}},zs=class extends wn{getErrorType(){return"MB_EMBED"}},bo=class extends wn{getErrorType(){return"MB_BUTTON"}},$s=class extends wn{getErrorType(){return"MB_DEPENDENCY"}};var ta=class{static get(e,t){return t.get(e).child}static tryGet(e,t){return t.tryGet(e)?.child}static fullGet(e,t){return t.get(e)}static set(e,t,r){t.set(e,r)}static setAndCreate(e,t,r){t.setAndCreate(e,r)}};var qu=class{constructor(e,t){this.id=e,this.manager=t,this.cache=new Map}validateStoragePath(e,t,r,i){return i.validateStoragePathAsFilePath(e,r)}resolveBindTargetScope(e,t,r){return e}createCacheItem(e){let t=this.cache.get(e);if(t!==void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not create cache item",cause:"cache item already exists"});return t=this.getDefaultCacheItem(e),this.cache.set(e,t),t}getOrCreateCacheItem(e){let t=this.getCacheItemForStoragePath(e);return t===void 0&&(t=this.getDefaultCacheItem(e),this.cache.set(e,t)),t}subscribe(e){if(e.bindTarget===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not subscribe",cause:"subscription bind target undefined"});let t=this.getOrCreateCacheItem(e.bindTarget.storagePath);return t.subscriptions.push(e),t}unsubscribe(e){if(e.bindTarget===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"subscription bind target undefined"});let t=this.cache.get(e.bindTarget.storagePath);if(t===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not unsubscribe",cause:"cache item does not exist"});return t.subscriptions=t.subscriptions.filter(r=>r.uuid!==e.uuid),t}getCacheItemForStoragePath(e){return this.cache.get(e)}onCycle(e){}iterateCacheItems(){return this.cache.values()}shouldDelete(e){return!0}deleteCache(e){this.cache.delete(e.storagePath)}writeCache(e,t){let r=this.getOrCreateCacheItem(t.storagePath);return ta.setAndCreate(r.data,t.storageProp,e),r}writeEntireCache(e,t){t.data=e}readCache(e){if(e.storageType!==this.id)throw new Ut({errorLevel:"ERROR",effect:"can not read cache",cause:`Source "${e.storageType}" does not match`});let t=this.getCacheItemForStoragePath(e.storagePath);return t===void 0?ta.tryGet(this.readExternal(e.storagePath),e.storageProp):this.readCacheItem(t,e.storageProp)}readCacheItem(e,t){return ta.tryGet(e.data,t)}readEntireCacheItem(e){return e.data}};function Tn(n,e){let t=n.tryParse(e);if(t.success)return t.value;throw new pc("ERROR","parsiNOM parser",e,t)}var pc=class extends wn{constructor(e,t,r,i){super({errorLevel:e,effect:"Failed to parse. Check that your syntax is correct.",cause:`expected ${i.expected.sort().join(" or ")}`}),this.str=r,this.parseFailure=i,this.source=t,this.updateMessage2()}getErrorType(){return"MB_PARSINOM"}updateMessage2(){this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`;let t=this.str.split(`
`)[this.parseFailure.furthest.line-1],r=`${this.parseFailure.furthest.line} |   `;this.positionContext=`${r}${t}`,this.positionContext+=`
${this.getUnderline(r.length)}
`,this.message+=`
`+this.positionContext}getUnderline(e){let t=" ".repeat(this.parseFailure.furthest.column+e-1),r=`^ (${this.cause})`;return t+r}},_n=class extends wn{constructor(e,t,r,i,a,o){super({errorLevel:e,effect:"Failed to validate the result of the parser.",cause:r,docs:o}),this.str=i,this.position=a,this.source=t,this.updateMessage2()}getErrorType(){return"MB_VALIDATION"}updateMessage2(){if(this.cause instanceof Error?this.message=`[${this.getErrorType()}] "${this.effect}" caused by error "${this.cause.message}"
`:this.message=`[${this.getErrorType()}] "${this.effect}" caused by "${this.cause}"
`,this.str&&this.position){let t=this.str.split(`
`)[this.position.from.line-1],r=`${this.position.from.line} |   `;this.positionContext=`${r}${t}`,this.positionContext+=`
${this.getUnderline(r.length,t.length)}
`,this.message+=`
`+this.positionContext}}getUnderline(e,t){if(this.position===void 0)return"";let r=" ".repeat(this.position.from.column+e-1),i=this.position.to.line===this.position.from.line?this.position.to.column:t,a="^".repeat(i-this.position.from.column);return r+a}};var Gf=class extends qu{readExternal(e){return{}}getDefaultCacheItem(e){return{data:{},storagePath:e,...this.manager.getDefaultCacheItem()}}async syncExternal(e){}},Wf=class{constructor(e,t){this.id=e,this.manager=t,this.cache={data:{},...this.manager.getDefaultCacheItem()}}createCacheItem(e){return this.cache}getOrCreateCacheItem(e){return this.cache}validateStoragePath(e,t,r,i){if(t)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'global_memory' does not support a storage path.",r,e.position);return""}resolveBindTargetScope(e,t,r){return e}deleteCache(e){}getCacheItemForStoragePath(e){return this.cache}iterateCacheItems(){return[this.cache][Symbol.iterator]()}onCycle(e){}readCache(e){return this.readCacheItem(this.cache,e.storageProp)}readCacheItem(e,t){return ta.tryGet(e.data,t)}shouldDelete(e){return!1}subscribe(e){return this.cache.subscriptions.push(e),this.cache}syncExternal(e){}unsubscribe(e){return this.cache.subscriptions=this.cache.subscriptions.filter(t=>t.uuid!==e.uuid),this.cache}writeCache(e,t){return ta.setAndCreate(this.cache.data,t.storageProp,e),this.cache}writeEntireCache(e,t){t.data=e}readEntireCacheItem(e){return e.data}},Yf=class{constructor(e,t){this.id=e,this.manager=t}createCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}getOrCreateCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}validateStoragePath(e,t,r,i){if(t)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage type 'scope' does not support a storage path.",r,e.position);return""}resolveBindTargetScope(e,t,r){return r.resolveScope(e,t)}deleteCache(e){}getCacheItemForStoragePath(e){}iterateCacheItems(){return[][Symbol.iterator]()}onCycle(e){}readCache(e){}readCacheItem(e,t){}shouldDelete(e){return!0}subscribe(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}syncExternal(e){}unsubscribe(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeCache(e,t){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}writeEntireCache(e,t){}readEntireCacheItem(e){throw new Ut({errorLevel:"CRITICAL",effect:"action not permitted",cause:"source 'scope' should have no cache items or subscriptions"})}};function mc(n,e,t){return Math.min(Math.max(n,e),t)}function Zf(n,e,t){return n!==void 0?Math.min(Math.max(n,e),t):void 0}function Tg(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}function Cg(n,e){return(n%e+e)%e}function jf(n,e){if(n==null&&e==null)return!0;if(n==null||e==null||typeof n!=typeof e)return!1;if(typeof n=="object"&&typeof e=="object"){if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!jf(n[i],e[i]))return!1;return!0}let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(let i of t)if(!jf(n[i],e[i]))return!1;return!0}return n===e}function _E(n){return!!n}function Fg(n){let e=Reflect.ownKeys(n);for(let t of e){let r=n[t];(r&&typeof r=="object"||typeof r=="function")&&Fg(r)}return Object.freeze(n)}function SE(n){return structuredClone(n)}function Ir(){return window.crypto.randomUUID()}function zu(n){try{return new URL(n),!0}catch{return!1}}function Jf(n){window.open(n,"_blank")}function AE(n,e,t=", ",r="and"){return n.length===0?"":(n=n.map(e),n.length===1?n[0]:n.length===2?`${n[0]} ${r} ${n[1]}`:`${n.slice(0,-1).join(t)} ${r} ${n.slice(-1)}`)}function Yn(n,e){n.innerHTML="",n.className="";let t=document.createElement("span");t.className="mb-warning mb-unloaded",t.innerText=`[MB_UNLOADED] ${e}`,n.appendChild(t)}var mt=class{static createElement(e,t,r){let i=document.createElement(t);return r?.text&&(i.innerText=r.text),r?.class&&(i.className=r.class),e.appendChild(i),i}static addClass(e,t){e.classList.add(...t.split(" "))}static addClasses(e,t){e.classList.add(...t)}static removeClass(e,t){e.classList.remove(...t.split(" "))}static hasClass(e,t){return e.classList.contains(t)}static removeAllClasses(e){e.className=""}static empty(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};var Xf=class{constructor(e,t,r,i,a,o,u){this.uuid=e,this.callbackSignal=t,this.metadataManager=r,this.bindTarget=i,this.dependencies=a,this.dependencySubscriptions=[],this.computeFunction=o,this.onDelete=u,this.deleted=!1}init(){for(let e of this.dependencies){let t=this.uuid+"/"+Ir();this.dependencySubscriptions.push(this.metadataManager.subscribe(t,e.callbackSignal,e.bindTarget,()=>this.delete())),e.callbackSignal.registerListener({callback:()=>void this.computeValue()})}this.computeValue()}async computeValue(){try{let e=this.dependencySubscriptions.map(r=>r.callbackSignal.get()),t=await this.computeFunction(e);this.callbackSignal.set(t),this.bindTarget!==void 0&&this.metadataManager.write(t,this.bindTarget,this.uuid)}catch(e){let t=e instanceof Error?e:String(e);console.warn(new Ut({errorLevel:"ERROR",effect:"Failed to compute value of computed subscription",cause:t}))}}unsubscribe(){for(let e of this.dependencySubscriptions)e.unsubscribe();this.metadataManager.unsubscribe(this)}notify(e){}getDependencies(){return this.dependencies}delete(){this.deleted=!0;for(let e of this.dependencySubscriptions)e.deleted||e.delete();this.onDelete(),this.unsubscribe()}};var Qf=class{constructor(e,t,r,i,a){this.uuid=e,this.callbackSignal=t,this.metadataManager=r,this.bindTarget=i,this.onDelete=a,this.deleted=!1}unsubscribe(){this.metadataManager.unsubscribe(this)}update(e){this.metadataManager.write(e,this.bindTarget,this.uuid)}notify(e){try{this.callbackSignal.set(e)}catch(t){let r=t instanceof Error?t:String(t);console.warn(new Ut({errorLevel:"ERROR",effect:"Failed to notify subscription of updated value in the cache",cause:r}))}}getDependencies(){return[]}delete(){this.deleted=!0,this.onDelete()}};var ME=5,cz=5*60;function Ig(n,e){return n===void 0||e===void 0||n.storageType!==e.storageType||n.storagePath!==e.storagePath?!1:EE(n.storageProp,e.storageProp,e.listenToChildren)}function EE(n,e,t){let r=n.path,i=e.path;for(let a=0;a<Math.min(r.length,i.length);a++)if(r[a].type!==i[a].type||r[a].prop!==i[a].prop)return!1;return r.length>i.length?t:!0}function fz(n){return n===void 0?"undefined":`${n.storagePath}#${n.storageProp.toString()}`}var Kf=class{constructor(){this.sources=new Map,this.defaultSource="CHANGE_THE_DEFAULT_SOURCE"}registerSource(e){this.sources.set(e.id,e)}setDefaultSource(e){if(this.sources.has(e))this.defaultSource=e;else throw new Ut({errorLevel:"CRITICAL",effect:"can not set default source",cause:`Source "${e}" does not exist`})}unregisterSource(e){this.sources.delete(e.id)}getSource(e){return this.sources.get(e)}iterateSources(){return this.sources.keys()}subscribe(e,t,r,i){let a=new Qf(e,t,this,r,i);return this.subscribeSubscription(a),a}subscribeComputed(e,t,r,i,a,o){let u=new Xf(e,t,this,r,i,a,o);return this.checkForLoops(u),u.init(),this.subscribeSubscription(u),u}unsubscribe(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not unsubscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let r=t.unsubscribe(e);r.subscriptions.length===0&&(r.inactive=!0)}subscribeSubscription(e){if(e.bindTarget===void 0)return;let t=this.getSource(e.bindTarget.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not subscribe subscription",cause:`Source "${e.bindTarget.storageType}" does not exist`});let r=t.subscribe(e);r.inactive=!1,r.cyclesSinceInactive=0,e.notify(t.readCacheItem(r,e.bindTarget.storageProp))}checkForLoops(e){for(let t of this.getAllSubscriptionsToDependencies(e))this.recCheckForLoops([e,t])}recCheckForLoops(e){let t=e.at(0),r=e.at(-1);if(!(r===void 0||t===void 0)){if(Ig(t.bindTarget,r.bindTarget))throw new Hf({errorLevel:"ERROR",effect:"bind target dependency loop detected",cause:`the loop is as follows: ${e.map(i=>`"${fz(i.bindTarget)}"`).join(" -> ")}`,docs:["https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/viewfields/#circular-dependencies"]});for(let i of this.getAllSubscriptionsToDependencies(r))this.recCheckForLoops([...e,i])}}getAllSubscriptionsToDependencies(e){return e.getDependencies().map(t=>this.getAllSubscriptionsToBindTarget(t.bindTarget)).flat()}getAllSubscriptionsToBindTarget(e){if(e===void 0)return[];let t=this.getCacheItemForBindTarget(e);if(!t)return[];let r=[];for(let i of t.subscriptions)Ig(i.bindTarget,e)&&r.push(i);return t.subscriptions.filter(i=>Ig(i.bindTarget,e))}getCacheItemForBindTarget(e){return this.getSource(e.storageType)?.getCacheItemForStoragePath(e.storagePath)}cycle(){for(let e of this.sources.values()){let t=[];for(let r of e.iterateCacheItems()){if(e.onCycle(r),r.pendingInternalChange){try{e.syncExternal(r)}catch(i){console.warn("failed to update frontmatter",i)}r.pendingInternalChange=!1}r.cyclesSinceInternalChange+=1,r.inactive&&(r.cyclesSinceInactive+=1),r.cyclesSinceInactive>cz&&e.shouldDelete(r)&&t.push(r)}for(let r of t)e.deleteCache(r)}}write(e,t,r){let i=this.getSource(t.storageType);if(i===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not write to cache",cause:`Source "${t.storageType}" does not exist`});let a=i.writeCache(e,t);a.pendingInternalChange=!0,a.cyclesSinceInternalChange=0,this.notifyListeners(t,r)}read(e){let t=this.getSource(e.storageType);if(t===void 0)throw new Ut({errorLevel:"ERROR",effect:"can not read metadata",cause:`Source "${e.storageType}" does not exist`});return t.readCache(e)}isCacheExternalWriteLocked(e){return e.cyclesSinceInternalChange<ME}notifyListeners(e,t){let r=this.getSource(e.storageType);if(r===void 0)throw new Ut({errorLevel:"ERROR",effect:"can notify listeners metadata",cause:`Source "${e.storageType}" does not exist`});let i=r.getCacheItemForStoragePath(e.storagePath);if(i!==void 0){for(let a of i.subscriptions)if(!(t!==void 0&&t===a.uuid||a.bindTarget===void 0)&&EE(e.storageProp,a.bindTarget.storageProp,a.bindTarget.listenToChildren)){let o=r.readCache(a.bindTarget);a.notify(o)}}}notifyAllListeners(e,t){for(let r of t.subscriptions){if(r.bindTarget===void 0)continue;let i=e.readCache(r.bindTarget);r.notify(i)}}deleteCachesForStoragePath(e){for(let t of this.sources.values()){let r=t.getCacheItemForStoragePath(e);r!==void 0&&(r.subscriptions.forEach(i=>i.delete()),t.deleteCache(r))}}getDefaultCacheItem(){return{subscriptions:[],cyclesSinceInternalChange:ME+1,pendingInternalChange:!1,cyclesSinceInactive:0,inactive:!0}}onExternalUpdate(e,t,r){let i=e.getCacheItemForStoragePath(t);if(i===void 0||this.isCacheExternalWriteLocked(i))return;let a=e.readEntireCacheItem(i);e.writeEntireCache(r,i);for(let o of i.subscriptions){if(o.bindTarget===void 0)continue;let u=o.bindTarget.storageProp,s=ta.tryGet(r,u),l=ta.tryGet(a,u);s!==l&&o.notify(s)}}onStoragePathDeleted(e){this.deleteCachesForStoragePath(e)}onStoragePathRenamed(e,t){this.deleteCachesForStoragePath(e)}};var kg=wr(dc()),jn=class n{static stringify(e){return e.format(this.dateFormat)}static parse(e){return(0,kg.default)(e,n.dateFormat)}static getDefaultDate(){return(0,kg.default)(new Date)}static getDefaultDay(){return new Date().getDate()}static getDefaultMonth(){return 1}static getDefaultYear(){return new Date().getFullYear()}};var DE=wr(dc());var Bg=Us[1];function NE(n){Bg=n}function Og(n){return wE[n]}function TE(n,e){let t=(0,DE.default)(new Date(e,n)).daysInMonth(),r=new Array(42).fill(0),i=pz(new Date(e,n,1));for(let a=0;a<t;a++)r[a+i]=a+1;return r=r[r.length-7]?r:r.slice(0,-7),r=r[r.length-7]?r:r.slice(0,-7),r}function pz(n){return Cg(n.getDay()-Bg.index,7)}function CE(){return Us.map(e=>({index:Cg(e.index-Bg.index,7),name:e.name,shortName:e.shortName})).sort((e,t)=>e.index-t.index).map(e=>e.shortName)}function FE(){let n=0;return()=>++n}var BE=require("obsidian");var IE={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:""},ep={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 Rg(n){let e=[];for(let[t,r]of Object.entries(IE)){if(r==="")continue;let i=n.api.inputFieldParser.fromString(`INPUT[${r}]`),a=n.api.inputFieldParser.fromSimpleDeclaration({inputFieldType:void 0,templateName:void 0,bindTarget:void 0,arguments:[{name:"showcase",value:["true"]},{name:"title",value:[t]}]});i=n.api.inputFieldParser.merge(i,a),i.declarationString=`INPUT[${r}]`;let o=n.api.inputFieldParser.validate(i,"",void 0);e.push([t,o])}return e}function PE(n){let e=[];for(let[t,r]of Object.entries(IE)){if(r==="")continue;let i=t,a="";zf[i].allowInline?a=`\`INPUT[${r}:exampleProperty]\``:a=`
\`\`\`meta-bind
INPUT[${r}:exampleProperty]
\`\`\`
`,e.push([i,a])}return e.sort((t,r)=>t[0].localeCompare(r[0])),e}function kE(n){let e=[];for(let t of Object.values(ep))for(let r of t)e.push([r.title,`\`${r.display}\``]);return e.sort((t,r)=>t[0].localeCompare(r[0])),e}function OE(n,e,t){let r=PE(t),i=kE(t);n.addItem(a=>{a.setTitle("Meta Bind"),a.setIcon("blocks");let o=a.setSubmenu();o.addItem(u=>{u.setTitle("Input Field");let s=u.setSubmenu();for(let[l,c]of r)s.addItem(f=>{f.setTitle(l),f.onClick(()=>tp(e,c))})}),o.addItem(u=>{u.setTitle("View Field");let s=u.setSubmenu();for(let[l,c]of i)s.addItem(f=>{f.setTitle(l),f.onClick(()=>tp(e,c))})}),o.addItem(u=>{u.setTitle("Inline Button"),u.onClick(()=>{tp(e,"`BUTTON[example-id]`")})}),o.addItem(u=>{u.setTitle("Button"),u.onClick(()=>{t.internal.openButtonBuilderModal({onOkay:s=>{tp(e,`\`\`\`meta-bind-button
${(0,BE.stringifyYaml)(s)}
\`\`\``)},submitText:"Insert"})})})})}function tp(n,e){n.replaceSelection(e)}var rp=class{constructor(){this.activeMountables=new Map}unloadFile(e){for(let t of this.activeMountables.values())t.getFilePath()===e&&(console.debug(`meta-bind | MountableManager >> unregistered Mountable ${t.getUuid()}`),t.unmount())}unload(){for(let e of this.activeMountables.values())console.debug(`meta-bind | MountableManager >> unregistered Mountable ${e.getUuid()}`),e.unmount()}registerMountable(e){console.debug(`meta-bind | MountableManager >> registered Mountable ${e.getUuid()}`),this.activeMountables.set(e.getUuid(),e)}unregisterMountable(e){console.debug(`meta-bind | MountableManager >> unregistered Mountable ${e.getUuid()}`),this.activeMountables.delete(e.getUuid())}};var B5=require("obsidian");var QE=wr(Ri());var sn=wr(Ri()),Jg=wr(Ai());var HE=wr(Ri()),mi=wr(Ai());var hc=wr(Ri()),Li=wr(Ai()),Zn=Li.P.sequence(Li.P.or(hc.P_UTILS.unicodeLetter(),Li.P.oneOf("_$")),Li.P.or(hc.P_UTILS.unicodeAlphanumeric(),Li.P.oneOf("-_$")).many()).map(n=>n[0]+n[1].join("")).describe("identifier"),UE=Li.P.sequenceMap((n,e)=>n+e.map(t=>t[0]+t[1]).join(""),Zn,Li.P.sequence(hc.P_UTILS.optionalWhitespace(),Zn).many()).describe("identifier with spaces"),bz=Li.P.string("\\").then(hc.P_UTILS.any()).map(n=>n==="'"?"'":n==="\\"?"\\":"\\"+n);function qE(n){return Li.P.or(bz,Li.P.noneOf(n+"\\")).many().map(e=>e.join("")).trim(Li.P.string(n))}var pp=qE("'"),zE=qE('"'),Wu=Li.P.manyNotOf("{}[]#^|:?").box("file path");function pi(n,e){return{value:n,position:e}}function Vi(n){if(n!==void 0)return typeof n=="string"?{value:n}:n}var Gs=(t=>(t.OBJECT="object",t.ARRAY="array",t))(Gs||{}),mp=class{constructor(e,t,r){this.parent=e,this.access=t,this.child=r}};function xz(n,e){return n[e]}function $E(n,e,t){n[e]=t}var Hs=class{constructor(e,t){if(this.type=e,this.prop=e==="object"?t:"",this.index=e==="array"?Number(t):0,Number.isNaN(this.index))throw new Error("can not access array with non number index")}get(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");return new mp(e,this,xz(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 mp(e,this,e[this.index])}}set(e,t){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");$E(e,this.prop,t)}else{if(typeof e!="object"||e==null||!Array.isArray(e))throw new Error("can not access property of non-array");e[this.index]=t}}create(e){if(this.type==="object"){if(typeof e!="object"||e==null)throw new Error("can not access property of non-object");$E(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 GE=Zn.node((n,e)=>({type:"object",prop:pi(n,e)})),Wg=mi.P.or(HE.P_UTILS.digits().wrap(mi.P.string("["),mi.P.string("]")).node((n,e)=>({type:"array",prop:pi(n,e)})),zE.wrap(mi.P.string("["),mi.P.string("]")).node((n,e)=>({type:"object",prop:pi(n,e)}))),wz=mi.P.or(mi.P.sequenceMap(n=>({storagePath:void 0,listenToChildren:!1,storageProp:n}),Wg.atLeast(1)),mi.P.sequenceMap((n,e)=>({storagePath:void 0,listenToChildren:!1,storageProp:[n,...e]}),GE,Wg.many())),_z=mi.P.sequenceMap((n,e)=>[n,...e],GE,Wg.many()),Yg=mi.P.sequenceMap((n,e)=>(n.storageProp=n.storageProp.concat(e.flat()),n),wz,mi.P.string(".").then(_z).many()),$a=mi.P.sequenceMap((n,e,t)=>(t.storageType=n,t.storagePath=e,t),Zn.describe("storage type").node(pi).skip(mi.P.string("^").describe('storage type separator "^"')).optional(),Wu.describe("storage path").node(pi).skip(mi.P.string("#").describe('storage/file path separator "#"')).optional(),Yg.describe("property path")).box("bind target");var Mi=wr(Ri()),Sn=wr(Ai());var Ha=wr(Ai()),dp=wr(Ri());var jg=Ha.P.regexp(/^[^()',]+/).describe("any character except parentheses, single quotation marks and commas"),Sz=Ha.P.or(pp,jg).node(pi),Az=Ha.P.separateBy(Sz,Ha.P.string(",").describe('argument value separator ","').trim(dp.P_UTILS.optionalWhitespace())),Mz=Ha.P.sequenceMap((n,e)=>({name:n,value:e}),Zn.node(pi),Az.trim(dp.P_UTILS.optionalWhitespace()).wrap(Ha.P.string("(").describe('argument value paren "("'),Ha.P.string(")").describe('argument value paren ")"')).optional([])),gc=Ha.P.separateBy(Mz,Ha.P.string(",").describe('argument separator ","').trim(dp.P_UTILS.optionalWhitespace()));var Ez=Sn.P.string("\\").then(Mi.P_UTILS.any()).map(n=>n==="["?"[":n==="]"?"]":n==="{"?"{":n==="}"?"}":n==="\\"?"\\":"\\"+n),hp=Sn.P.sequenceMap((n,e)=>n+e.flat().join(""),Sn.P.manyNotOf("{}[]\\"),Sn.P.sequence(Ez,Sn.P.manyNotOf("{}[]\\")).many()).box("View Field Content"),Dz=Sn.P.sequenceMap((n,e)=>[n,...e.flat()],hp,Sn.P.sequence($a.wrapString("{","}"),hp).many()),Nz=Sn.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{viewFieldType:n,writeToBindTarget:r,arguments:e,templateDeclaration:void 0}},Zn.node(pi).trim(Mi.P_UTILS.optionalWhitespace()).optional().describe("input field type"),gc.trim(Mi.P_UTILS.optionalWhitespace()).wrapString("(",")").trim(Mi.P_UTILS.optionalWhitespace()).optional([]),Sn.P.sequence(Sn.P.string(":").trim(Mi.P_UTILS.optionalWhitespace()),$a).trim(Mi.P_UTILS.optionalWhitespace()).optional()),WE=Sn.P.sequenceMap((n,e,t,r)=>r===void 0?{viewFieldType:void 0,writeToBindTarget:void 0,arguments:[],templateDeclaration:e}:(r.templateDeclaration=e,r),Sn.P.string("VIEW"),Dz.wrapString("[","]"),Mi.P_UTILS.optionalWhitespace(),Nz.wrapString("[","]").optional(),Mi.P_UTILS.eof()),Tz=Sn.P.sequenceMap((n,e,t,r)=>(e!==void 0&&(n.listenToChildren=!0),{bindTarget:n,name:r}),$a.wrapString("{","}"),Sn.P.string(" and children").optional(),Sn.P.string(" as "),Zn),YE=Sn.P.sequenceMap((n,e,t,r)=>({bindTargetMappings:n,writeToBindTarget:e,hidden:t!==void 0,code:r}),Tz.separateBy(Mi.P_UTILS.whitespace()).skip(Mi.P_UTILS.whitespace()),Sn.P.string("save to ").then($a.wrapString("{","}")).skip(Mi.P_UTILS.whitespace()).optional(),Sn.P.string("hidden").skip(Mi.P_UTILS.whitespace()).optional(),Sn.P.string("---").then(Mi.P_UTILS.remaining()));var Zg=wr(Ai());var Yu=class{constructor(e,t){this.range=e,this.tokenClass=t}};var Bt=class n{static sequence(...e){return Zg.P.sequenceMap((...t)=>t.flat(2).filter(r=>r!==void 0),...e)}static separateBy(e,t){return n.sequence(e,n.sequence(t,e).many()).optional([])}static highlight(e,t){return e.node((r,i)=>[new Yu(i,t)])}static highlightStr(e,t){return n.highlight(Zg.P.string(e),t)}};var Xg=Bt.highlight(Zn,"ident"),gp=Bt.highlight(Zn,"keyword"),Qg=Bt.highlightStr(",","control"),vp=Bt.highlightStr("(","control"),yp=Bt.highlightStr(")","control"),ju=Bt.highlightStr("[","control"),Zu=Bt.highlightStr("]","control"),Fz=Bt.highlight(pp,"string"),Iz=Bt.highlight(jg,"ident"),Pz=Jg.P.or(Iz,Fz),kz=Bt.separateBy(Pz,Qg.trim(sn.P_UTILS.optionalWhitespace())),Bz=Bt.sequence(gp,Bt.sequence(vp,kz.trim(sn.P_UTILS.optionalWhitespace()),yp).optional()),Kg=Bt.separateBy(Bz,Qg.trim(sn.P_UTILS.optionalWhitespace())),Ju=Bt.sequence(Bt.sequence(Xg,Bt.highlightStr("^","control")).optional(),Bt.sequence(Bt.highlight(Wu,"ident"),Bt.highlightStr("#","control")).optional(),Bt.highlight(Yg,"ident")),Oz=Bt.sequence(gp.trim(sn.P_UTILS.optionalWhitespace()),Bt.sequence(vp,Kg.trim(sn.P_UTILS.optionalWhitespace()),yp).trim(sn.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(sn.P_UTILS.optionalWhitespace()),Ju).trim(sn.P_UTILS.optionalWhitespace()).optional()),Rz=Bt.sequence(gp.trim(sn.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(vp,Kg.trim(sn.P_UTILS.optionalWhitespace()),yp).trim(sn.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(sn.P_UTILS.optionalWhitespace()),Ju).trim(sn.P_UTILS.optionalWhitespace()).optional()),ZE=Jg.P.or(Bt.sequence(Bt.highlightStr("INPUT","control"),ju,Xg.trim(sn.P_UTILS.optionalWhitespace()),Zu.skip(sn.P_UTILS.optionalWhitespace()),ju,Rz,Zu),Bt.sequence(Bt.highlightStr("INPUT","control"),ju,Oz,Zu)),jE=Bt.highlight(hp,"ident"),Lz=Bt.sequence(Bt.highlightStr("{","string"),Ju,Bt.highlightStr("}","string")),Vz=Bt.sequence(jE,Bt.sequence(Lz,jE).many()),Uz=Bt.sequence(gp.trim(sn.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(vp,Kg.trim(sn.P_UTILS.optionalWhitespace()).optional(),yp).trim(sn.P_UTILS.optionalWhitespace()).optional(),Bt.sequence(Bt.highlightStr(":","control").trim(sn.P_UTILS.optionalWhitespace()),Ju).trim(sn.P_UTILS.optionalWhitespace()).optional()),JE=Bt.sequence(Bt.highlightStr("VIEW","control"),ju,Vz,Zu,Bt.sequence(ju.skip(sn.P_UTILS.optionalWhitespace()),Uz,Zu).optional()),XE=Bt.sequence(Bt.highlightStr("BUTTON","control"),ju,Bt.separateBy(Xg,Qg.trim(sn.P_UTILS.optionalWhitespace())),Zu);var xo=class{constructor(e,t,r){this.str=e,this.highlights=t.filter(i=>i.range.from.index!==i.range.to.index),this.parsingError=r}getHighlights(){if(this.parsingError===void 0)return this.highlights;let e;return this.str[this.parsingError.parseFailure.furthest.index]===`
`?e={index:this.parsingError.parseFailure.furthest.index+1,column:1,line:this.parsingError.parseFailure.furthest.line+1}:e={index:this.parsingError.parseFailure.furthest.index+1,column:this.parsingError.parseFailure.furthest.column+1,line:this.parsingError.parseFailure.furthest.line},[new Yu({from:this.parsingError.parseFailure.furthest,to:e},"error")]}};var di=(t=>(t.INLINE="inline",t.BLOCK="block",t))(di||{}),Xu=(s=>(s.INPUT="INPUT",s.VIEW="VIEW",s.JS_VIEW="JS_VIEW",s.TABLE="TABLE",s.BUTTON_GROUP="BUTTON_GROUP",s.BUTTON="BUTTON",s.EMBED="EMBED",s.EXCLUDED="EXCLUDED",s))(Xu||{}),jo=class{constructor(e){this.linePosition=e}getPosition(){return this.linePosition}};function bp(n){return n==="INPUT"||n==="VIEW"||n==="BUTTON_GROUP"}var xp=class{constructor(e){this.plugin=e}highlightInputFieldDeclaration(e,t){return this.highlightWithParser(e,t,ZE)}highlightViewFieldDeclaration(e,t){return this.highlightWithParser(e,t,JE)}highlightInlineButtonDeclaration(e,t){return this.highlightWithParser(e,t,XE)}highlight(e,t,r){if(t==="INPUT")return this.highlightInputFieldDeclaration(e,r);if(t==="VIEW")return this.highlightViewFieldDeclaration(e,r);if(t==="BUTTON_GROUP")return this.highlightInlineButtonDeclaration(e,r);throw new Error(`Unknown MDRCType ${t}`)}highlightBindTarget(e,t){return this.highlightWithParser(e,t,Ju)}highlightWithParser(e,t,r){try{return t?new xo(e,Tn(r.trim(QE.P_UTILS.optionalWhitespace()).thenEof(),e)):new xo(e,Tn(r.thenEof(),e))}catch(i){return i instanceof pc?new xo(e,[],i):(console.error(i),new xo(e,[]))}}};var tn=(i=>(i.DEFAULT="default",i.PRIMARY="primary",i.DESTRUCTIVE="destructive",i.PLAIN="plain",i))(tn||{}),wo=(m=>(m.COMMAND="command",m.JS="js",m.OPEN="open",m.INPUT="input",m.SLEEP="sleep",m.TEMPLATER_CREATE_NOTE="templaterCreateNote",m.UPDATE_METADATA="updateMetadata",m.CREATE_NOTE="createNote",m.REPLACE_IN_NOTE="replaceInNote",m.REGEXP_REPLACE_IN_NOTE="regexpReplaceInNote",m.REPLACE_SELF="replaceSelf",m.INSERT_INTO_NOTE="insertIntoNote",m.INLINE_JS="inlineJS",m))(wo||{});var KE=wr(Ri()),hi=wr(Ai());var qz=hi.P.sequence(Wu,hi.P.string("#").then(hi.P.manyNotOf("[]#|^:")).optional(),hi.P.string("|").then(hi.P.manyNotOf("[]")).optional()),ev=hi.P.or(hi.P.sequenceMap((n,e)=>({isEmbed:n!==void 0,target:e[0],block:e[1],alias:e[2],internal:!0}),hi.P.string("!").optional(),qz.wrapString("[[","]]")),hi.P.sequenceMap((n,e,t)=>{let r=!zu(t);return{isEmbed:n!==void 0,target:t,block:void 0,alias:e,internal:r}},hi.P.string("!").optional(),hi.P.manyNotOf("[]").wrapString("[","]"),hi.P.manyNotOf("()").wrapString("(",")"))),zz=hi.P.separateBy(ev,hi.P.string(",").trim(KE.P_UTILS.optionalWhitespace())),un=class n{static parseLink(e){return Tn(ev.thenEof(),e)}static parseLinkList(e){return Tn(zz.thenEof(),e)}static isLink(e){return ev.thenEof().tryParse(e).success}static urlToLink(e){return{isEmbed:!1,target:e.href,block:void 0,alias:e.hostname,internal:!1}}static parseLinkOrUrl(e){return zu(e)?n.urlToLink(new URL(e)):n.parseLink(e)}static convertToLinkString(e){return n.isLink(e)?e:zu(e)?`[${new URL(e).hostname}](${e})`:n.isLink(`[[${e}]]`)?`[[${e}]]`:""}};var vc=wr(Ri()),Zo=wr(Ai());var tD=Zo.P.sequenceMap((n,e)=>n===void 0?e:-e,Zo.P.string("-").optional(),Zo.P.or(Zo.P.sequenceMap((n,e,t)=>Number(n+e+t),vc.P_UTILS.digits(),Zo.P.string("."),vc.P_UTILS.digits()),vc.P_UTILS.digits().map(n=>Number(n)))).thenEof(),rD=Zo.P.sequenceMap((n,e)=>n===void 0?e:-e,Zo.P.string("-").optional(),vc.P_UTILS.digits().map(n=>Number(n))).thenEof();function Ui(n){if(n.toLowerCase()==="null")return null;if(n==="true")return!0;if(n==="false")return!1;{let e=tD.tryParse(n);return e.success?e.value:n}}function Aa(n){return n===void 0||n===null?"":typeof n=="string"?n:typeof n=="boolean"?n?"true":"false":n.toString()}function Jo(n){return n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"}function na(n){if(n!=null){if(Jo(n))return[n];if(typeof n=="object"&&Array.isArray(n))return n.filter(e=>Jo(e))}}function Qu(n){if(typeof n=="number")return n;if(typeof n=="string"){let e=tD.tryParse(n);if(e.success)return e.value}}function Ga(n){return Jo(n)?Aa(n):void 0}function Xo(n){return Jo(n)?n:void 0}function wp(n,e){return Array.isArray(n)?n.map(t=>tv(t,e)).filter(t=>t!=="").join(", "):tv(n,e)}function tv(n,e){return n==null?e?"":"null":typeof n=="function"?"<function>":typeof n=="object"||Array.isArray(n)?JSON.stringify(n):n.toString()}function nD(n,e){return Array.isArray(n)?n.map(t=>eD(t,e)).filter(t=>t!==""):eD(n,e)}function eD(n,e){return typeof n=="string"?un.isLink(n)?un.parseLink(n):zu(n)?un.urlToLink(new URL(n)):n:tv(n,e)}var _p=class{constructor(e){this.plugin=e}resolveFilePath(e,t){let r=un.isLink(e)?un.parseLink(e).target:e,i=this.plugin.internal.getFilePathByName(r,t);if(i===void 0)throw new _a({errorLevel:"ERROR",cause:'Could not find a file that matches "${filePath}".',effect:`Could not resolve path or link "${e}" relative to "${t}".`});return i}createDefaultButtonConfig(){return{label:"This is a button",icon:"",hidden:!1,class:"",tooltip:"",id:"",style:"default",actions:[]}}async runButtonAction(e,t,r,i){try{if(e.action)await this.plugin.api.buttonActionRunner.runAction(e,e.action,t,r,i);else if(e.actions)for(let a of e.actions)await this.plugin.api.buttonActionRunner.runAction(e,a,t,r,i);else console.warn("meta-bind | ButtonMDRC >> no action defined")}catch(a){console.warn("meta-bind | ButtonMDRC >> error while running action",a),this.plugin.internal.showNotice("meta-bind | Error while running button action. Check the console for details.")}}createDefaultAction(e){if(e==="command")return{type:"command",command:""};if(e==="open")return{type:"open",link:""};if(e==="js")return{type:"js",file:"",args:{}};if(e==="input")return{type:"input",str:""};if(e==="sleep")return{type:"sleep",ms:0};if(e==="templaterCreateNote")return{type:"templaterCreateNote",templateFile:"",folderPath:"/",fileName:"",openNote:!0};if(e==="updateMetadata")return{type:"updateMetadata",bindTarget:"",evaluate:!1,value:""};if(e==="createNote")return{type:"createNote",folderPath:"/",fileName:"Untitled",openNote:!0};if(e==="replaceInNote")return{type:"replaceInNote",fromLine:0,toLine:0,replacement:"Replacement text"};if(e==="replaceSelf")return{type:"replaceSelf",replacement:"Replacement text"};if(e==="regexpReplaceInNote")return{type:"regexpReplaceInNote",regexp:"([A-Z])\\w+",replacement:"Replacement text"};if(e==="insertIntoNote")return{type:"insertIntoNote",line:0,value:"Some text"};if(e==="inlineJS")return{type:"inlineJS",code:'console.log("Hello world")'};throw new Error(`Unknown button action type: ${e}`)}async runAction(e,t,r,i,a){if(t.type==="command"){await this.runCommandAction(t);return}else if(t.type==="js"){await this.runJSAction(e,t,r);return}else if(t.type==="open"){await this.runOpenAction(t,r);return}else if(t.type==="input"){await this.runInputAction(t);return}else if(t.type==="sleep"){await this.runSleepAction(t);return}else if(t.type==="templaterCreateNote"){await this.runTemplaterCreateNoteAction(t);return}else if(t.type==="updateMetadata"){await this.runUpdateMetadataAction(t,r);return}else if(t.type==="createNote"){await this.runCreateNoteAction(t);return}else if(t.type==="replaceInNote"){await this.runReplaceInNoteAction(t,r);return}else if(t.type==="replaceSelf"){await this.runReplaceSelfAction(t,r,i,a);return}else if(t.type==="regexpReplaceInNote"){await this.runRegexpReplaceInNotAction(t,r);return}else if(t.type==="insertIntoNote"){await this.runInsertIntoNoteAction(t,r);return}else if(t.type==="inlineJS"){await this.runInlineJsAction(e,t,r);return}throw new Error("Unknown button action type")}async runCommandAction(e){this.plugin.internal.executeCommandById(e.command)}async runJSAction(e,t,r){if(!this.plugin.settings.enableJs)throw new yo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let i={buttonConfig:structuredClone(e),args:structuredClone(t.args)};(await this.plugin.internal.jsEngineRunFile(t.file,r,i))()}async runOpenAction(e,t){let r=un.parseLinkOrUrl(e.link);r.internal?this.plugin.internal.openFile(r.target,t,e.newTab??!1):Jf(r.target)}async runInputAction(e){let t=document.activeElement;t&&t instanceof HTMLInputElement&&(t.setRangeText(e.str,t.selectionStart,t.selectionEnd,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})))}async runSleepAction(e){await new Promise(t=>setTimeout(t,e.ms))}async runTemplaterCreateNoteAction(e){await this.plugin.internal.createNoteWithTemplater(e.templateFile,e.folderPath,e.fileName,e.openNote)}async runUpdateMetadataAction(e,t){let r=this.plugin.api.bindTargetParser.fromStringAndValidate(e.bindTarget,t);if(e.evaluate){if(!this.plugin.settings.enableJs)throw new yo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let i=new Function("x","getMetadata",`return ${e.value};`);this.plugin.api.updateMetadata(r,a=>i(a,o=>this.plugin.api.getMetadata(this.plugin.api.parseBindTarget(o,t))))}else this.plugin.api.setMetadata(r,Ui(e.value))}async runCreateNoteAction(e){await this.plugin.internal.createFile(e.folderPath??"",e.fileName,"md",e.openNote??!1)}async runReplaceInNoteAction(e,t){if(e.fromLine>e.toLine)throw new Error("From line cannot be greater than to line");let i=(await this.plugin.internal.readFilePath(t)).split(`
`);if(e.fromLine<0||e.toLine>i.length+1)throw new Error("Line numbers out of bounds");let a=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;i=[...i.slice(0,e.fromLine-1),a,...i.slice(e.toLine)],await this.plugin.internal.writeFilePath(t,i.join(`
`))}async runReplaceSelfAction(e,t,r,i){if(r)throw new Error("Replace self action not supported for inline buttons");let a=i?.getPosition();if(a===void 0)throw new Error("Position of the button in the note is unknown");if(a.lineStart>a.lineEnd)throw new Error("Position of the button in the note is invalid");let u=(await this.plugin.internal.readFilePath(t)).split(`
`);if(a.lineStart<0||a.lineEnd>u.length+1)throw new Error("Position of the button in the note is out of bounds");let s=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.replacement),t):e.replacement;u=[...u.slice(0,a.lineStart),s,...u.slice(a.lineEnd+1)],await this.plugin.internal.writeFilePath(t,u.join(`
`))}async runRegexpReplaceInNotAction(e,t){if(e.regexp==="")throw new Error("Regexp cannot be empty");let r=await this.plugin.internal.readFilePath(t);r=r.replace(new RegExp(e.regexp,e.regexpFlags??"g"),e.replacement),await this.plugin.internal.writeFilePath(t,r)}async runInsertIntoNoteAction(e,t){let i=(await this.plugin.internal.readFilePath(t)).split(`
`);if(e.line<1||e.line>i.length+1)throw new Error("Line number out of bounds");let a=e.templater?await this.plugin.internal.evaluateTemplaterTemplate(this.resolveFilePath(e.value),t):e.value;i=[...i.slice(0,e.line-1),a,...i.slice(e.line-1)],await this.plugin.internal.writeFilePath(t,i.join(`
`))}async runInlineJsAction(e,t,r){if(!this.plugin.settings.enableJs)throw new yo({errorLevel:"CRITICAL",effect:"Can't run button action that requires JS evaluation.",cause:"JS evaluation is disabled in the plugin settings."});let i={buttonConfig:structuredClone(e)};(await this.plugin.internal.jsEngineRunCode(t.code,r,i))()}};var Jn=class{constructor(){this.mounted=!1,this.targetEl=void 0,this.onUnmountCbs=[]}isMounted(){return this.mounted}getTargetEl(){return this.targetEl}mount(e){if(this.mounted||this.targetEl)throw new Error("Mountable is already mounted");this.mounted=!0,this.targetEl=e,this.onMount(e)}unmount(){if(!this.mounted||!this.targetEl)throw new Error("Mountable is not mounted");this.mounted=!1,this.onUnmount(this.targetEl);for(let e of this.onUnmountCbs)e();this.targetEl=void 0}registerUnmountCb(e){this.onUnmountCbs.push(e)}};var An=class extends Jn{constructor(e,t,r){super(),this.plugin=e,this.filePath=r,this.uuid=t}getUuid(){return this.uuid}getFilePath(){return this.filePath}onMount(e){this.plugin.mountableManager.registerMountable(this)}onUnmount(e){this.plugin.mountableManager.unregisterMountable(this)}};function Ke(){}function $z(n,e){for(let t in e)n[t]=e[t];return n}function rv(n){return n()}function Mp(){return Object.create(null)}function Ft(n){n.forEach(rv)}function Ws(n){return typeof n=="function"}function ke(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}var Ap;function ia(n,e){return n===e?!0:(Ap||(Ap=document.createElement("a")),Ap.href=e,n===Ap.href)}function iD(n){return Object.keys(n).length===0}function Ma(n,e,t,r){if(n){let i=aD(n,e,t,r);return n[0](i)}}function aD(n,e,t,r){return n[1]&&r?$z(t.ctx.slice(),n[1](r(e))):t.ctx}function Ea(n,e,t,r){if(n[2]&&r){let i=n[2](r(t));if(e.dirty===void 0)return i;if(typeof i=="object"){let a=[],o=Math.max(e.dirty.length,i.length);for(let u=0;u<o;u+=1)a[u]=e.dirty[u]|i[u];return a}return e.dirty|i}return e.dirty}function Da(n,e,t,r,i,a){if(i){let o=aD(e,t,r,a);n.p(o,i)}}function Na(n){if(n.ctx.length>32){let e=[],t=n.ctx.length/32;for(let r=0;r<t;r++)e[r]=-1;return e}return-1}var yc=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;var Ep=class n{_listeners="WeakMap"in yc?new WeakMap:void 0;_observer=void 0;options;constructor(e){this.options=e}observe(e,t){return this._listeners.set(e,t),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver(e=>{for(let t of e)n.entries.set(t.target,t),this._listeners.get(t.target)?.(t)}))}};Ep.entries="WeakMap"in yc?new WeakMap:void 0;var oD=!1;function sD(){oD=!0}function uD(){oD=!1}function K(n,e){n.appendChild(e)}function aa(n,e,t){let r=lD(n);if(!r.getElementById(e)){let i=ee("style");i.id=e,i.textContent=t,Wz(r,i)}}function lD(n){if(!n)return document;let e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function Wz(n,e){return K(n.head||n,e),e.sheet}function J(n,e,t){n.insertBefore(e,t||null)}function Y(n){n.parentNode&&n.parentNode.removeChild(n)}function Qt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function ee(n){return document.createElement(n)}function qi(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function He(n){return document.createTextNode(n)}function fe(){return He(" ")}function Er(){return He("")}function Fe(n,e,t,r){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}function q(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Xn(n){return n===""?null:+n}function cD(n){return Array.from(n.childNodes)}function yt(n,e){e=""+e,n.data!==e&&(n.data=e)}function je(n,e){n.value=e??""}function _o(n,e,t,r){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,r?"important":"")}function Qo(n,e,t){for(let r=0;r<n.options.length;r+=1){let i=n.options[r];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(n.selectedIndex=-1)}function bc(n){let e=n.querySelector(":checked");return e&&e.__value}function Yt(n,e,t){n.classList.toggle(e,!!t)}function Dp(n,e,{bubbles:t=!1,cancelable:r=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:r})}function fD(n){let e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}var Ko;function So(n){Ko=n}function Np(){if(!Ko)throw new Error("Function called outside component initialization");return Ko}function zi(n){Np().$$.on_mount.push(n)}function Ys(n){Np().$$.on_destroy.push(n)}function js(){let n=Np();return(e,t,{cancelable:r=!1}={})=>{let i=n.$$.callbacks[e];if(i){let a=Dp(e,t,{cancelable:r});return i.slice().forEach(o=>{o.call(n,a)}),!a.defaultPrevented}return!0}}function pD(n,e){let t=n.$$.callbacks[e.type];t&&t.slice().forEach(r=>r.call(this,e))}var Zs=[];var Pr=[],el=[],iv=[],Qz=Promise.resolve(),av=!1;function mD(){av||(av=!0,Qz.then(Tp))}function Wa(n){el.push(n)}function Qn(n){iv.push(n)}var nv=new Set,Ku=0;function Tp(){if(Ku!==0)return;let n=Ko;do{try{for(;Ku<Zs.length;){let e=Zs[Ku];Ku++,So(e),Kz(e.$$)}}catch(e){throw Zs.length=0,Ku=0,e}for(So(null),Zs.length=0,Ku=0;Pr.length;)Pr.pop()();for(let e=0;e<el.length;e+=1){let t=el[e];nv.has(t)||(nv.add(t),t())}el.length=0}while(Zs.length);for(;iv.length;)iv.pop()();av=!1,nv.clear(),So(n)}function Kz(n){if(n.fragment!==null){n.update(),Ft(n.before_update);let e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Wa)}}function dD(n){let e=[],t=[];el.forEach(r=>n.indexOf(r)===-1?e.push(r):t.push(r)),t.forEach(r=>r()),el=e}var Cp=new Set,Js;function bt(){Js={r:0,c:[],p:Js}}function xt(){Js.r||Ft(Js.c),Js=Js.p}function j(n,e){n&&n.i&&(Cp.delete(n),n.i(e))}function ne(n,e,t,r){if(n&&n.o){if(Cp.has(n))return;Cp.add(n),Js.c.push(()=>{Cp.delete(n),r&&(t&&n.d(1),r())}),n.o(e)}else r&&r()}function ct(n){return n?.length!==void 0?n:Array.from(n)}function hD(n,e){n.d(1),e.delete(n.key)}function Fp(n,e){ne(n,1,1,()=>{e.delete(n.key)})}function tl(n,e,t,r,i,a,o,u,s,l,c,f){let p=n.length,m=a.length,h=p,d={};for(;h--;)d[n[h].key]=h;let g=[],y=new Map,S=new Map,b=[];for(h=m;h--;){let D=f(i,a,h),E=t(D),_=o.get(E);_?r&&b.push(()=>_.p(D,e)):(_=l(E,D),_.c()),y.set(E,g[h]=_),E in d&&S.set(E,Math.abs(h-d[E]))}let w=new Set,A=new Set;function x(D){j(D,1),D.m(u,c),o.set(D.key,D),c=D.first,m--}for(;p&&m;){let D=g[m-1],E=n[p-1],_=D.key,N=E.key;D===E?(c=D.first,p--,m--):y.has(N)?!o.has(_)||w.has(_)?x(D):A.has(N)?p--:S.get(_)>S.get(N)?(A.add(_),x(D)):(w.add(N),p--):(s(E,o),p--)}for(;p--;){let D=n[p];y.has(D.key)||s(D,o)}for(;m;)x(g[m-1]);return Ft(b),g}var e$=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],t$=new Set([...e$]);function Kn(n,e,t){let r=n.$$.props[e];r!==void 0&&(n.$$.bound[r]=t,t(n.$$.ctx[r]))}function be(n){n&&n.c()}function ve(n,e,t){let{fragment:r,after_update:i}=n.$$;r&&r.m(e,t),Wa(()=>{let a=n.$$.on_mount.map(rv).filter(Ws);n.$$.on_destroy?n.$$.on_destroy.push(...a):Ft(a),n.$$.on_mount=[]}),i.forEach(Wa)}function ye(n,e){let t=n.$$;t.fragment!==null&&(dD(t.after_update),Ft(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function n$(n,e){n.$$.dirty[0]===-1&&(Zs.push(n),mD(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Be(n,e,t,r,i,a,o=null,u=[-1]){let s=Ko;So(n);let l=n.$$={fragment:null,ctx:[],props:a,update:Ke,not_equal:i,bound:Mp(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(s?s.$$.context:[])),callbacks:Mp(),dirty:u,skip_bound:!1,root:e.target||s.$$.root};o&&o(l.root);let c=!1;if(l.ctx=t?t(n,e.props||{},(f,p,...m)=>{let h=m.length?m[0]:p;return l.ctx&&i(l.ctx[f],l.ctx[f]=h)&&(!l.skip_bound&&l.bound[f]&&l.bound[f](h),c&&n$(n,f)),p}):[],l.update(),c=!0,Ft(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){sD();let f=cD(e.target);l.fragment&&l.fragment.l(f),f.forEach(Y)}else l.fragment&&l.fragment.c();e.intro&&j(n.$$.fragment),ve(n,e.target,e.anchor),uD(),Tp()}So(s)}var i$;typeof HTMLElement=="function"&&(i$=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(n,e,t){super(),this.$$ctor=n,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(n,e,t){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(e),this.$$c){let r=this.$$c.$on(n,e);this.$$l_u.set(e,r)}super.addEventListener(n,e,t)}removeEventListener(n,e,t){if(super.removeEventListener(n,e,t),this.$$c){let r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(i){return()=>{let a;return{c:function(){a=ee("slot"),i!=="default"&&q(a,"name",i)},m:function(s,l){J(s,a,l)},d:function(s){s&&Y(a)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},t=fD(this);for(let i of this.$$s)i in t&&(e[i]=[n(i)]);for(let i of this.attributes){let a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=ov(a,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){let a=ov(i,this.$$d[i],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,a)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let i in this.$$l)for(let a of this.$$l[i]){let o=this.$$c.$on(i,a);this.$$l_u.set(a,o)}this.$$l={}}}attributeChangedCallback(n,e,t){this.$$r||(n=this.$$g_p(n),this.$$d[n]=ov(n,t,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(n){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===n||!this.$$p_d[e].attribute&&e.toLowerCase()===n)||n}});function ov(n,e,t,r){let i=t[n]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!t[n])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Pe=class{$$=void 0;$$set=void 0;$destroy(){ye(this,1),this.$destroy=Ke}$on(e,t){if(!Ws(t))return Ke;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(t),()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!iD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var gD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gD);function vD(n){let e;return{c(){e=ee("div"),q(e,"class","mb-icon-wrapper")},m(t,r){J(t,e,r),n[3](e)},p:Ke,d(t){t&&Y(e),n[3](null)}}}function a$(n){let e,t=n[0].length>0&&vD(n);return{c(){t&&t.c(),e=Er()},m(r,i){t&&t.m(r,i),J(r,e,i)},p(r,[i]){r[0].length>0?t?t.p(r,i):(t=vD(r),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:Ke,o:Ke,d(r){r&&Y(e),t&&t.d(r)}}}function o$(n,e,t){let{iconName:r=""}=e,{plugin:i}=e,a;zi(()=>{i.internal.setIcon(a,r)});function o(u){Pr[u?"unshift":"push"](()=>{a=u,t(1,a)})}return n.$$set=u=>{"iconName"in u&&t(0,r=u.iconName),"plugin"in u&&t(2,i=u.plugin)},[r,a,i,o]}var sv=class extends Pe{constructor(e){super(),Be(this,e,o$,a$,ke,{iconName:0,plugin:2})}},qr=sv;function s$(n){aa(n,"svelte-i3s6h2","button.svelte-i3s6h2{gap:var(--size-4-2)}.mod-plain.svelte-i3s6h2{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-i3s6h2:hover{color:var(--text-normal)}.disabled.svelte-i3s6h2{opacity:0.6}")}function yD(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:n[5]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),i&32&&(a.iconName=r[5]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function u$(n){let e,t,r,i,a,o,u=n[5]&&yD(n);return{c(){e=ee("button"),u&&u.c(),t=fe(),r=He(n[4]),q(e,"class","mb-button-inner svelte-i3s6h2"),q(e,"aria-label",n[3]),e.disabled=n[0],Yt(e,"mod-cta",n[2]==="primary"),Yt(e,"mod-warning",n[2]==="destructive"),Yt(e,"mod-plain",n[2]==="plain"),Yt(e,"disabled",n[0]),Yt(e,"mb-error",n[6])},m(s,l){J(s,e,l),u&&u.m(e,null),K(e,t),K(e,r),i=!0,a||(o=Fe(e,"click",n[9]),a=!0)},p(s,[l]){s[5]?u?(u.p(s,l),l&32&&j(u,1)):(u=yD(s),u.c(),j(u,1),u.m(e,t)):u&&(bt(),ne(u,1,1,()=>{u=null}),xt()),(!i||l&16)&&yt(r,s[4]),(!i||l&8)&&q(e,"aria-label",s[3]),(!i||l&1)&&(e.disabled=s[0]),(!i||l&4)&&Yt(e,"mod-cta",s[2]==="primary"),(!i||l&4)&&Yt(e,"mod-warning",s[2]==="destructive"),(!i||l&4)&&Yt(e,"mod-plain",s[2]==="plain"),(!i||l&1)&&Yt(e,"disabled",s[0]),(!i||l&64)&&Yt(e,"mb-error",s[6])},i(s){i||(j(u),i=!0)},o(s){ne(u),i=!1},d(s){s&&Y(e),u&&u.d(),a=!1,o()}}}function l$(n,e,t){let{plugin:r}=e,{variant:i="default"}=e,{disabled:a=!1}=e,{tooltip:o=""}=e,{label:u=""}=e,{icon:s=""}=e,{error:l=!1}=e,{onClick:c=async()=>{}}=e;async function f(){if(!a){t(0,a=!0);try{await c()}catch(m){console.warn("failed to run button component on click",m)}finally{t(0,a=!1)}}}let p=()=>f();return n.$$set=m=>{"plugin"in m&&t(1,r=m.plugin),"variant"in m&&t(2,i=m.variant),"disabled"in m&&t(0,a=m.disabled),"tooltip"in m&&t(3,o=m.tooltip),"label"in m&&t(4,u=m.label),"icon"in m&&t(5,s=m.icon),"error"in m&&t(6,l=m.error),"onClick"in m&&t(8,c=m.onClick)},[a,r,i,o,u,s,l,f,c,p]}var uv=class extends Pe{constructor(e){super(),Be(this,e,l$,u$,ke,{plugin:1,variant:2,disabled:0,tooltip:3,label:4,icon:5,error:6,onClick:8},s$)}},Ip=uv;var es=class extends Jn{constructor(e,t,r,i,a,o,u){super(),this.plugin=e,this.config=t,this.filePath=r,this.inline=i==="inline",this.position=a,this.isInGroup=o,this.isPreview=u}onMount(e){mt.empty(e),mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.inline?"mb-button-inline":"mb-button-block"]),!(!this.inline&&!this.isPreview&&!this.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(t=>t!=="")),this.buttonComponent=new Ip({target:e,props:{plugin:this.plugin,icon:this.config.icon,variant:this.config.style,label:this.config.label,tooltip:_E(this.config.tooltip)?this.config.tooltip:this.config.label,onClick:async()=>{await this.plugin.api.buttonActionRunner.runButtonAction(this.config,this.filePath,this.inline,this.position)}}}))}onUnmount(){this.buttonComponent?.$destroy(),!this.inline&&!this.isPreview&&this.config?.id&&this.plugin.api.buttonManager.removeButton(this.filePath,this.config.id)}};var Gt=class{constructor(e){this.subject=e,this.errors=[]}add(e){e instanceof Error?(e instanceof wn?this.errors.push(e):this.otherError=e,console.warn(e)):console.warn("[MB_ERROR_CONTAINER] received invalid error type",e)}merge(e){return this.errors=this.errors.concat(e.errors),e.otherError&&(this.otherError=e.otherError),this}hasErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="ERROR"||e.errorLevel==="CRITICAL")return!0;return!1}hasCriticalErrors(){if(this.otherError)return!0;for(let e of this.errors)if(e.errorLevel==="CRITICAL")return!0;return!1}hasWarnings(){for(let e of this.errors)if(e.errorLevel==="WARNING")return!0;return!1}isEmpty(){return this.errors.length===0&&!this.otherError}getErrors(){let e=this.errors.filter(t=>t.errorLevel==="ERROR"||t.errorLevel==="CRITICAL");return this.otherError?e.concat([this.otherError]):e}getWarnings(){return this.errors.filter(e=>e.errorLevel==="WARNING")}};var Pp=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.declaration=i,this.position=a,this.isPreview=o,this.errorCollection=new Gt(this.getUuid())}onMount(e){if(console.debug("meta-bind | ButtonMountable >> mount",this.declaration.declarationString),super.onMount(e),mt.removeAllClasses(e),!this.declaration.config||!this.declaration.errorCollection.isEmpty()){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.declaration.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declaration.declarationString});return}this.buttonField=new es(this.plugin,this.declaration.config,this.getFilePath(),"block",this.position,!1,this.isPreview),this.buttonField.mount(e)}onUnmount(e){console.debug("meta-bind | ButtonMountable >> destroy",this.declaration.declarationString),super.onUnmount(e),this.buttonField?.unmount(),Yn(e,"button")}};var kp=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 Bp=class{constructor(e){this.plugin=e,this.buttons=new Map,this.buttonLoadListeners=new Map,this.buttonTemplates=new Map}setButtonTemplates(e){let t=new Set,r=new Gt("ButtonManager");this.buttonTemplates.clear();for(let i of e)i.id===void 0||i.id===""?r.add(new bo({errorLevel:"ERROR",cause:`Button with label "${i.label}" has no id, but button templates must have an id.`,effect:"Button templates could not be saved."})):t.has(i.id)?r.add(new bo({errorLevel:"ERROR",cause:`Button id "${i.id}" is not unique. The same id is used by multiple buttons.`,effect:"Button templates could not be saved."})):(t.add(i.id),this.buttonTemplates.set(i.id,i));return r.hasErrors()&&this.buttonTemplates.clear(),r}registerButtonLoadListener(e,t,r){let i=this.getButton(e,t);i&&r(i),this.buttonLoadListeners.has(e)||this.buttonLoadListeners.set(e,new Map);let a=this.buttonLoadListeners.get(e);a.has(t)||a.set(t,new Map);let o=a.get(t),u=Ir();return o.set(u,r),()=>this.removeButtonLoadListener(e,t,u)}notifyButtonLoadListeners(e,t){let r=this.getButton(e,t);if(!r)throw new Error(`ButtonManager | button with id ${t} does not exist`);let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);if(a)for(let[o,u]of a)u(r)}removeButtonLoadListener(e,t,r){let i=this.buttonLoadListeners.get(e);if(!i)return;let a=i.get(t);a&&(a.delete(r),a.size===0&&i.delete(t),i.size===0&&this.buttonLoadListeners.delete(e))}addButton(e,t){if(t.id===void 0||t.id==="")throw new Error("ButtonManager | button id is undefined");if(this.buttonTemplates.has(t.id))throw new Error(`ButtonManager | button with id "${t.id}" already exists in the button templates`);this.buttons.has(e)||this.buttons.set(e,new Map),this.buttons.get(e).set(t.id,new kp(t)),this.notifyButtonLoadListeners(e,t.id)}getButton(e,t){if(this.buttonTemplates.has(t))return this.buttonTemplates.get(t);let r=this.buttons.get(e);if(r)return r.get(t)?.getValue()}removeButton(e,t){let r=this.buttons.get(e);r&&(r.get(t)?.decrement(),r.get(t)?.isEmpty()&&r.delete(t),r.size===0&&this.buttons.delete(e))}};var Op=class extends Jn{constructor(e,t,r,i,a){super(),this.plugin=e,this.referencedIds=t,this.filePath=r,this.renderChildType=i,this.notePosition=a}renderInitialButton(e,t){return mt.removeAllClasses(e),mt.addClasses(e,["mb-button",this.renderChildType==="inline"?"mb-button-inline":"mb-button-block"]),new Ip({target:e,props:{plugin:this.plugin,variant:"default",label:"Button ID not Found",tooltip:`No button with id '${t}' found`,error:!0,onClick:async()=>{}}})}onMount(e){mt.empty(e),mt.addClasses(e,["mb-button-group",this.renderChildType==="inline"?"mb-button-group-inline":"mb-button-group-block"]);for(let t of this.referencedIds){let r=mt.createElement(e,"span"),i=this.renderInitialButton(r,t),a,o=this.plugin.api.buttonManager.registerButtonLoadListener(this.filePath,t,u=>{i?.$destroy(),i=void 0,a=new es(this.plugin,u,this.filePath,this.renderChildType,this.notePosition,!0,!1),a.mount(r)});this.registerUnmountCb(()=>{i?.$destroy(),i=void 0,a?.unmount(),o()})}}onUnmount(e){mt.empty(e)}};var Rp=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.declaration=i,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.renderChildType=a,this.position=o}onMount(e){if(console.debug("meta-bind | ButtonGroupMountable >> mount",this.declaration),super.onMount(e),mt.removeAllClasses(e),!this.declaration.errorCollection.isEmpty()){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.declaration.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declaration.declarationString});return}this.buttonField=new Op(this.plugin,this.declaration.referencedButtonIds,this.getFilePath(),this.renderChildType,this.position),this.buttonField.mount(e)}onUnmount(e){console.debug("meta-bind | ButtonGroupMountable >> destroy",this.declaration),super.onUnmount(e),this.buttonField?.unmount(),Yn(e,"inline button")}};var qt=class{static linkToInputField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfields/${e.toLowerCase()}/`}static linkToInputFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/inputfieldarguments/${e.toLowerCase()}/`}static linkToViewField(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/${e.toLowerCase()}/`}static linkToViewFieldArgument(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfieldarguments/${e.toLowerCase()}/`}static linkToInputFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/inputfields/"}static linkToViewFields(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/viewfields/"}static linkToButtons(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToButtonConfig(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/buttons/#button-configuration"}static linkToSearch(e){return`https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/?s=${encodeURIComponent(e)}`}static linkToHome(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/"}static linkToGithub(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin"}static linkToIssues(){return"https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues"}static linkToCanaryBuilds(){return"https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/guides/installation/#canary-builds"}static open(e){Jf(e)}};var rl=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new Ut({errorLevel:"CRITICAL",effect:"can not retrieve arguments",cause:"inputFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getBindTarget(){return this.declaration.bindTarget}shouldAddCardContainer(){let e=this.declaration.inputFieldType==="select"||this.declaration.inputFieldType==="multiSelect"||this.declaration.inputFieldType==="list",t=this.hasArgument("showcase")||this.hasArgument("title");return this.renderChildType==="block"&&(e||t)}createContainer(e){if(this.shouldAddCardContainer()){let t=mt.createElement(e,"div");mt.addClass(t,"mb-card");let r=this.getArgument("title");return r&&mt.createElement(t,"h3",{text:r.value}),t}return e}addShowcase(e){if(this.getArgument("showcase")&&this.shouldAddCardContainer()){let r=mt.createElement(e,"code",{class:"mb-none"}),i=mt.createElement(r,"a",{text:this.declarationString,class:"mb-no-link"});i.href=qt.linkToInputField(this.declaration.inputFieldType)}}createInputField(){if(!this.errorCollection.hasErrors())try{this.inputField=this.plugin.api.inputFieldFactory.createInputField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.inputField&&this.errorCollection.add(new Ut({errorLevel:"CRITICAL",effect:"can't render input field",cause:"input field is undefined"}))}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){if(console.debug("meta-bind | InputFieldMountable >> mount",this.declaration),super.onMount(e),mt.empty(e),mt.addClass(e,"mb-input"),this.createInputField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=this.createContainer(e);this.createErrorIndicator(t);let r=mt.createElement(t,"div",{class:"mb-input-wrapper"});this.inputField?.mount(r);let i=this.getArguments("class");for(let a of i)mt.addClasses(r,a.value);mt.addClass(r,`mb-input-type-${this.declaration.inputFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-input-block"):mt.addClass(e,"mb-input-inline"),this.addShowcase(t)}onUnmount(e){console.debug("meta-bind | InputFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.inputField?.destroy(),Yn(e,"input field")}};var nl=class{constructor(){this.listeners=[]}registerListener(e){let t=e;return t.uuid=Ir(),this.listeners.push(t),t}unregisterListener(e){this.unregisterListenerById(e.uuid)}unregisterListenerById(e){this.listeners=this.listeners.filter(t=>t.uuid!==e)}unregisterAllListeners(){this.listeners=[]}notifyListeners(e){for(let t of this.listeners)try{t.callback(e)}catch(r){let i=r instanceof Error?r:String(r);console.error(new Ut({errorLevel:"ERROR",effect:"error while calling listener callback",cause:i}))}}},Lr=class extends nl{constructor(e){super(),this.value=e}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}},Lp=class extends nl{constructor(e,t){super(),this.dependency=e,this.value=t(e.get()),this.dependencyListener=e.registerListener({callback:r=>this.set(t(r))})}get(){return this.value}set(e){this.value=e,this.notifyListeners(e)}destroy(){this.dependency.unregisterListener(this.dependencyListener)}};var Vp=class extends nl{constructor(e,t){super(),this.plugin=e,this.mounted=!1,this.svelteComponent=t}setValue(e){this.svelteComponentInstance?.setValue(e)}mount(e,t,r={}){let i=Object.assign({plugin:this.plugin,value:t,onValueChange:a=>{this.notifyListeners(a)}},r);this.svelteComponentInstance=new this.svelteComponent({target:e,props:i}),this.mounted=!0}unmount(){this.unregisterAllListeners(),this.svelteComponentInstance?.$destroy(),this.mounted=!1}isMounted(){return this.mounted}};var rr=class extends Jn{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Lr(void 0),this.inputFieldComponent=new Vp(this.plugin,this.getSvelteComponent()),this.computedSignal=new Lp(this.inputSignal,t=>{let r=this.filterValue(t);return r!==void 0?r:this.getDefaultValue()})}destroy(){this.inputFieldComponent.isMounted()&&this.unmount()}reverseMapValue(e){let t=this.rawReverseMapValue(e);if(t!==void 0)return t;let r=this.rawReverseMapValue(this.getDefaultValue());return r!==void 0?r:this.getFallbackDefaultValue()}mapValue(e){return this.rawMapValue(e)}getValue(){return this.computedSignal.get()}getInternalValue(){return this.reverseMapValue(this.getValue())}setValue(e){this.computedSignal.set(e),this.notifySubscription(e)}setInternalValue(e){this.setValue(this.mapValue(e))}notifySubscription(e){this.metadataSubscription?.update(e)}getDefaultValue(){let e=this.mountable.getArgument("defaultValue");if(e===void 0)return this.mapValue(this.getFallbackDefaultValue());let t=this.filterValue(e.value);return t!==void 0?t:this.mapValue(this.getFallbackDefaultValue())}getMountArgs(){return{}}onMount(e){this.inputSignal.set(this.inputSignal.get()),this.computedSignal.registerListener({callback:r=>this.inputFieldComponent.setValue(this.reverseMapValue(r))});let t=this.mountable.getBindTarget();t&&(this.inputFieldComponent.registerListener({callback:r=>{this.notifySubscription(this.mapValue(r))}}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribe(this.mountable.getUuid(),this.inputSignal,t,()=>this.mountable.unmount())),this.inputFieldComponent.mount(e,this.reverseMapValue(this.getValue()),this.getMountArgs())}onUnmount(){this.computedSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe(),this.inputFieldComponent.unmount()}};function c$(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","date")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function f$(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var lv=class extends Pe{constructor(e){super(),Be(this,e,f$,c$,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},bD=lv;var Up=class extends rr{filterValue(e){return Ga(e)}getFallbackDefaultValue(){return jn.stringify(jn.getDefaultDate())}getSvelteComponent(){return bD}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function p$(n){let e,t,r=(n[0]?n[0].format(n[2]):"none")+"",i,a,o,u,s,l;return o=new qr({props:{plugin:n[1],iconName:"calendar"}}),{c(){e=ee("div"),t=ee("span"),i=He(r),a=fe(),be(o.$$.fragment),q(t,"class","date-picker-text"),q(e,"class","date-picker-input"),q(e,"role","button"),q(e,"tabindex","0")},m(c,f){J(c,e,f),K(e,t),K(t,i),K(e,a),ve(o,e,null),u=!0,s||(l=[Fe(e,"click",n[3]),Fe(e,"keydown",n[4])],s=!0)},p(c,[f]){(!u||f&5)&&r!==(r=(c[0]?c[0].format(c[2]):"none")+"")&&yt(i,r);let p={};f&2&&(p.plugin=c[1]),o.$set(p)},i(c){u||(j(o.$$.fragment,c),u=!0)},o(c){ne(o.$$.fragment,c),u=!1},d(c){c&&Y(e),ye(o),s=!1,Ft(l)}}}function m$(n,e,t){let{plugin:r}=e,{value:i}=e,{dateFormat:a}=e,{showDatePicker:o}=e,{onValueChange:u}=e;function s(f){t(0,i=f)}function l(f){o()}function c(f){f.key===" "&&o()}return n.$$set=f=>{"plugin"in f&&t(1,r=f.plugin),"value"in f&&t(0,i=f.value),"dateFormat"in f&&t(2,a=f.dateFormat),"showDatePicker"in f&&t(5,o=f.showDatePicker),"onValueChange"in f&&t(6,u=f.onValueChange)},[i,r,a,l,c,o,u,s]}var cv=class extends Pe{constructor(e){super(),Be(this,e,m$,p$,ke,{plugin:1,value:0,dateFormat:2,showDatePicker:5,onValueChange:6,setValue:7})}get setValue(){return this.$$.ctx[7]}},xD=cv;var qp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){if(e===null)return null;if(e===void 0||typeof e!="string")return;let t=jn.parse(e);if(t.isValid())return jn.stringify(t)}getFallbackDefaultValue(){return jn.getDefaultDate()}getSvelteComponent(){return xD}rawMapValue(e){return e===null?null:jn.stringify(e)}rawReverseMapValue(e){if(e===null)return null;let t=jn.parse(e);if(t.isValid())return t}getMountArgs(){return{dateFormat:this.mountable.plugin.settings.preferredDateFormat,showDatePicker:()=>{this.mountable.plugin.internal.openDatePickerModal(this)}}}};function d$(n){aa(n,"svelte-1tfnqy0",".editor-input.svelte-1tfnqy0.svelte-1tfnqy0{background:var(--background-secondary);width:100%;height:500px;padding:0;position:relative;margin-left:0;overflow:scroll}.editor-input.svelte-1tfnqy0>textarea.svelte-1tfnqy0{background:var(--background-secondary);border:none;padding:var(--size-4-4) var(--size-4-8);margin:0;position:absolute;inset:0;resize:none;border-radius:0}.editor-input.svelte-1tfnqy0>div.svelte-1tfnqy0{padding:var(--size-4-4) var(--size-4-8);position:absolute;inset:0}")}function h$(n){let e,t,r,i,a,o;return{c(){e=ee("div"),t=ee("textarea"),r=fe(),i=ee("div"),q(t,"class","svelte-1tfnqy0"),q(i,"class","svelte-1tfnqy0"),q(e,"class","editor-input card svelte-1tfnqy0"),q(e,"role","button"),q(e,"tabindex","0")},m(u,s){J(u,e,s),K(e,t),n[10](t),je(t,n[0]),K(e,r),K(e,i),n[14](i),a||(o=[Fe(t,"input",n[11]),Fe(t,"focusout",n[12]),Fe(t,"input",n[13]),Fe(e,"click",n[15]),Fe(e,"keypress",n[16])],a=!0)},p(u,[s]){s&1&&je(t,u[0])},i:Ke,o:Ke,d(u){u&&Y(e),n[10](null),n[14](null),a=!1,Ft(o)}}}function g$(n,e,t){let{plugin:r}=e,{value:i}=e,{onValueChange:a}=e,{render:o}=e,u,s;zi(()=>{t(2,u.style.display="block",u),t(3,s.style.display="none",s),o(u,i)});function l(w){t(0,i=w),o(u,w)}function c(){t(2,u.style.display="block",u),t(3,s.style.display="none",s),o(u,i)}function f(){t(2,u.style.display="none",u),t(3,s.style.display="block",s),s.focus()}function p(w){w.key===" "&&f()}function m(w){Pr[w?"unshift":"push"](()=>{s=w,t(3,s)})}function h(){i=this.value,t(0,i)}let d=()=>c(),g=()=>a(i);function y(w){Pr[w?"unshift":"push"](()=>{u=w,t(2,u)})}let S=()=>f(),b=w=>p(w);return n.$$set=w=>{"plugin"in w&&t(7,r=w.plugin),"value"in w&&t(0,i=w.value),"onValueChange"in w&&t(1,a=w.onValueChange),"render"in w&&t(8,o=w.render)},[i,a,u,s,c,f,p,r,o,l,m,h,d,g,y,S,b]}var fv=class extends Pe{constructor(e){super(),Be(this,e,g$,h$,ke,{plugin:7,value:0,onValueChange:1,render:8,setValue:9},d$)}get setValue(){return this.$$.ctx[9]}},wD=fv;var zp=class extends rr{filterValue(e){return Jo(e)?e?.toString():void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return wD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{render:(e,t)=>void this.renderInElement(e,t)}}async renderInElement(e,t){this.mdUnloadCallback?.(),e.innerHTML="",this.mdUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())}onUnmount(){super.onUnmount(),this.mdUnloadCallback?.()}};function v$(n){aa(n,"svelte-12xcpmj","button.svelte-12xcpmj{gap:var(--size-4-1)}.mod-plain.svelte-12xcpmj{background:none;box-shadow:none;border:none;color:var(--text-muted)}.mod-plain.svelte-12xcpmj:hover{color:var(--text-normal)}.disabled.svelte-12xcpmj{opacity:0.6}")}function y$(n){let e,t,r,i,a=n[4].default,o=Ma(a,n,n[3],null);return{c(){e=ee("button"),o&&o.c(),q(e,"aria-label",n[2]),e.disabled=n[1],q(e,"class","svelte-12xcpmj"),Yt(e,"mod-cta",n[0]==="primary"),Yt(e,"mod-warning",n[0]==="destructive"),Yt(e,"mod-plain",n[0]==="plain"),Yt(e,"disabled",n[1])},m(u,s){J(u,e,s),o&&o.m(e,null),t=!0,r||(i=Fe(e,"click",n[5]),r=!0)},p(u,[s]){o&&o.p&&(!t||s&8)&&Da(o,a,u,u[3],t?Ea(a,u[3],s,null):Na(u[3]),null),(!t||s&4)&&q(e,"aria-label",u[2]),(!t||s&2)&&(e.disabled=u[1]),(!t||s&1)&&Yt(e,"mod-cta",u[0]==="primary"),(!t||s&1)&&Yt(e,"mod-warning",u[0]==="destructive"),(!t||s&1)&&Yt(e,"mod-plain",u[0]==="plain"),(!t||s&2)&&Yt(e,"disabled",u[1])},i(u){t||(j(o,u),t=!0)},o(u){ne(o,u),t=!1},d(u){u&&Y(e),o&&o.d(u),r=!1,i()}}}function b$(n,e,t){let{$$slots:r={},$$scope:i}=e,{variant:a="default"}=e,{disabled:o=!1}=e,{tooltip:u=""}=e;function s(l){pD.call(this,n,l)}return n.$$set=l=>{"variant"in l&&t(0,a=l.variant),"disabled"in l&&t(1,o=l.disabled),"tooltip"in l&&t(2,u=l.tooltip),"$$scope"in l&&t(3,i=l.$$scope)},[a,o,u,i,r,s]}var pv=class extends Pe{constructor(e){super(),Be(this,e,b$,y$,ke,{variant:0,disabled:1,tooltip:2},v$)}},It=pv;function _D(n){let e,t;return{c(){e=ee("img"),q(e,"class","mb-image-card-image"),ia(e.src,t=n[1].internal.imagePathToUri(n[0]))||q(e,"src",t),q(e,"alt",n[0])},m(r,i){J(r,e,i)},p(r,i){i&3&&!ia(e.src,t=r[1].internal.imagePathToUri(r[0]))&&q(e,"src",t),i&1&&q(e,"alt",r[0])},d(r){r&&Y(e)}}}function x$(n){let e,t;return e=new qr({props:{iconName:"pencil",plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function w$(n){let e,t,r,i,a=(n[0]||"no image selected")+"",o,u,s,l,c=n[0]&&_D(n);return s=new It({props:{variant:"plain",$$slots:{default:[x$]},$$scope:{ctx:n}}}),s.$on("click",n[2]),{c(){e=ee("div"),c&&c.c(),t=fe(),r=ee("div"),i=ee("span"),o=He(a),u=fe(),be(s.$$.fragment),q(r,"class","mb-image-card-footer"),q(e,"class","mb-image-card")},m(f,p){J(f,e,p),c&&c.m(e,null),K(e,t),K(e,r),K(r,i),K(i,o),K(r,u),ve(s,r,null),l=!0},p(f,[p]){f[0]?c?c.p(f,p):(c=_D(f),c.c(),c.m(e,t)):c&&(c.d(1),c=null),(!l||p&1)&&a!==(a=(f[0]||"no image selected")+"")&&yt(o,a);let m={};p&66&&(m.$$scope={dirty:p,ctx:f}),s.$set(m)},i(f){l||(j(s.$$.fragment,f),l=!0)},o(f){ne(s.$$.fragment,f),l=!1},d(f){f&&Y(e),c&&c.d(),ye(s)}}}function _$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{onValueChange:o}=e;function u(l){t(0,i=l)}function s(l){a()}return n.$$set=l=>{"plugin"in l&&t(1,r=l.plugin),"value"in l&&t(0,i=l.value),"showSuggester"in l&&t(3,a=l.showSuggester),"onValueChange"in l&&t(4,o=l.onValueChange)},[i,r,s,a,o,u]}var mv=class extends Pe{constructor(e){super(),Be(this,e,_$,w$,ke,{plugin:1,value:0,showSuggester:3,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},SD=mv;var $p=class extends rr{filterValue(e){return Jo(e)?e:void 0}getFallbackDefaultValue(){return""}getSvelteComponent(){return SD}rawMapValue(e){return e}rawReverseMapValue(e){return Aa(e)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>this.setInternalValue(e))}};function S$(n){let e,t;return{c(){e=ee("a"),t=He(n[2]),q(e,"data-href",n[2]),q(e,"href",n[2]),q(e,"class",n[1]),q(e,"target","_blank"),q(e,"rel","noopener")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&4&&yt(t,r[2]),i&4&&q(e,"data-href",r[2]),i&4&&q(e,"href",r[2]),i&2&&q(e,"class",r[1])},d(r){r&&Y(e)}}}function A$(n){let e,t=n[0].alias+"",r;return{c(){e=ee("a"),r=He(t),q(e,"data-href",n[2]),q(e,"href",n[2]),q(e,"class",n[1]),q(e,"target","_blank"),q(e,"rel","noopener"),q(e,"aria-label",n[2])},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].alias+"")&&yt(r,t),a&4&&q(e,"data-href",i[2]),a&4&&q(e,"href",i[2]),a&2&&q(e,"class",i[1]),a&4&&q(e,"aria-label",i[2])},d(i){i&&Y(e)}}}function M$(n){let e;function t(a,o){return a[0].alias?A$:S$}let r=t(n,-1),i=r(n);return{c(){i.c(),e=Er()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Ke,o:Ke,d(a){a&&Y(e),i.d(a)}}}function E$(n,e,t){let r,i,{mdLink:a}=e;return n.$$set=o=>{"mdLink"in o&&t(0,a=o.mdLink)},n.$$.update=()=>{n.$$.dirty&1&&t(2,r=a.block?`${a.target}#${a.block}`:a.target),n.$$.dirty&1&&t(1,i=a.internal?"internal-link":"external-link")},[a,i,r]}var dv=class extends Pe{constructor(e){super(),Be(this,e,E$,M$,ke,{mdLink:0})}},ts=dv;var D$=n=>({element:n&1}),AD=n=>({element:n[0][n[0].length-1]});function MD(n,e,t){let r=n.slice();return r[3]=e[t],r}var N$=n=>({element:n&1}),ED=n=>({element:n[3]});function DD(n){let e,t,r,i,a,o=n[2].default,u=Ma(o,n,n[1],ED);return{c(){u&&u.c(),e=fe(),t=ee("span"),t.textContent=",",r=fe(),i=ee("span")},m(s,l){u&&u.m(s,l),J(s,e,l),J(s,t,l),J(s,r,l),J(s,i,l),a=!0},p(s,l){u&&u.p&&(!a||l&3)&&Da(u,o,s,s[1],a?Ea(o,s[1],l,N$):Na(s[1]),ED)},i(s){a||(j(u,s),a=!0)},o(s){ne(u,s),a=!1},d(s){s&&(Y(e),Y(t),Y(r),Y(i)),u&&u.d(s)}}}function T$(n){let e,t,r=ct(n[0].slice(0,n[0].length-1)),i=[];for(let s=0;s<r.length;s+=1)i[s]=DD(MD(n,r,s));let a=s=>ne(i[s],1,1,()=>{i[s]=null}),o=n[2].default,u=Ma(o,n,n[1],AD);return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=fe(),u&&u.c()},m(s,l){for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(s,l);J(s,e,l),u&&u.m(s,l),t=!0},p(s,[l]){if(l&3){r=ct(s[0].slice(0,s[0].length-1));let c;for(c=0;c<r.length;c+=1){let f=MD(s,r,c);i[c]?(i[c].p(f,l),j(i[c],1)):(i[c]=DD(f),i[c].c(),j(i[c],1),i[c].m(e.parentNode,e))}for(bt(),c=r.length;c<i.length;c+=1)a(c);xt()}u&&u.p&&(!t||l&3)&&Da(u,o,s,s[1],t?Ea(o,s[1],l,D$):Na(s[1]),AD)},i(s){if(!t){for(let l=0;l<r.length;l+=1)j(i[l]);j(u,s),t=!0}},o(s){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)ne(i[l]);ne(u,s),t=!1},d(s){s&&Y(e),Qt(i,s),u&&u.d(s)}}}function C$(n,e,t){let{$$slots:r={},$$scope:i}=e,{elements:a=[]}=e;return n.$$set=o=>{"elements"in o&&t(0,a=o.elements),"$$scope"in o&&t(1,i=o.$$scope)},[a,i,r]}var hv=class extends Pe{constructor(e){super(),Be(this,e,C$,T$,ke,{elements:0})}},Hp=hv;function F$(n){let e,t,r;return t=new ts({props:{mdLink:n[0]}}),{c(){e=ee("span"),be(t.$$.fragment)},m(i,a){J(i,e,a),ve(t,e,null),r=!0},p(i,a){let o={};a&1&&(o.mdLink=i[0]),t.$set(o)},i(i){r||(j(t.$$.fragment,i),r=!0)},o(i){ne(t.$$.fragment,i),r=!1},d(i){i&&Y(e),ye(t)}}}function I$(n){let e,t,r;return t=new Hp({props:{elements:n[0],$$slots:{default:[O$,({element:i})=>({2:i}),({element:i})=>i?4:0]},$$scope:{ctx:n}}}),{c(){e=ee("span"),be(t.$$.fragment)},m(i,a){J(i,e,a),ve(t,e,null),r=!0},p(i,a){let o={};a&1&&(o.elements=i[0]),a&12&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(j(t.$$.fragment,i),r=!0)},o(i){ne(t.$$.fragment,i),r=!1},d(i){i&&Y(e),ye(t)}}}function P$(n){let e,t;return{c(){e=ee("span"),t=He(n[0]),_o(e,"white-space","pre")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&1&&yt(t,r[0])},i:Ke,o:Ke,d(r){r&&Y(e)}}}function k$(n){let e,t;return e=new ts({props:{mdLink:n[2]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&4&&(a.mdLink=r[2]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function B$(n){let e,t=n[2]+"",r;return{c(){e=ee("span"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&4&&t!==(t=i[2]+"")&&yt(r,t)},i:Ke,o:Ke,d(i){i&&Y(e)}}}function O$(n){let e,t,r,i,a=[B$,k$],o=[];function u(s,l){return typeof s[2]=="string"?0:1}return e=u(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=Er()},m(s,l){o[e].m(s,l),J(s,r,l),i=!0},p(s,l){let c=e;e=u(s,l),e===c?o[e].p(s,l):(bt(),ne(o[c],1,1,()=>{o[c]=null}),xt(),t=o[e],t?t.p(s,l):(t=o[e]=a[e](s),t.c()),j(t,1),t.m(r.parentNode,r))},i(s){i||(j(t),i=!0)},o(s){ne(t),i=!1},d(s){s&&Y(r),o[e].d(s)}}}function R$(n){let e,t,r,i,a,o=[P$,I$,F$],u=[];function s(l,c){return c&1&&(e=null),typeof l[0]=="string"?0:(e==null&&(e=!!Array.isArray(l[0])),e?1:2)}return t=s(n,-1),r=u[t]=o[t](n),{c(){r.c(),i=Er()},m(l,c){u[t].m(l,c),J(l,i,c),a=!0},p(l,[c]){let f=t;t=s(l,c),t===f?u[t].p(l,c):(bt(),ne(u[f],1,1,()=>{u[f]=null}),xt(),r=u[t],r?r.p(l,c):(r=u[t]=o[t](l),r.c()),j(r,1),r.m(i.parentNode,i))},i(l){a||(j(r),a=!0)},o(l){ne(r),a=!1},d(l){l&&Y(i),u[t].d(l)}}}function L$(n,e,t){let{value:r=void 0}=e,i;return n.$$set=a=>{"value"in a&&t(1,r=a.value)},n.$$.update=()=>{n.$$.dirty&2&&t(0,i=nD(r,!1))},[i,r]}var gv=class extends Pe{constructor(e){super(),Be(this,e,L$,R$,ke,{value:1})}},oa=gv;function ND(n,e,t){let r=n.slice();return r[11]=e[t],r[13]=t,r}function TD(n){let e,t,r,i,a;t=new oa({props:{value:n[11]}});function o(...u){return n[8](n[13],...u)}return{c(){e=ee("div"),be(t.$$.fragment),q(e,"class","mb-inline-list-item"),q(e,"role","listitem")},m(u,s){J(u,e,s),ve(t,e,null),r=!0,i||(a=Fe(e,"contextmenu",o),i=!0)},p(u,s){n=u;let l={};s&1&&(l.value=n[11]),t.$set(l)},i(u){r||(j(t.$$.fragment,u),r=!0)},o(u){ne(t.$$.fragment,u),r=!1},d(u){u&&Y(e),ye(t),i=!1,a()}}}function V$(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=TD(ND(n,c,m));let p=m=>ne(f[m],1,1,()=>{f[m]=null});return o=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){e=ee("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),r=ee("div"),i=ee("span"),i.textContent="\u200B",a=fe(),be(o.$$.fragment),q(r,"class","mb-inline-list-add"),q(r,"role","button"),q(r,"tabindex","0"),q(e,"class","mb-inline-list")},m(m,h){J(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);K(e,t),K(e,r),K(r,i),K(r,a),ve(o,r,null),u=!0,s||(l=[Fe(r,"click",n[9]),Fe(r,"keydown",n[3])],s=!0)},p(m,[h]){if(h&17){c=ct(m[0]);let g;for(g=0;g<c.length;g+=1){let y=ND(m,c,g);f[g]?(f[g].p(y,h),j(f[g],1)):(f[g]=TD(y),f[g].c(),j(f[g],1),f[g].m(e,t))}for(bt(),g=c.length;g<f.length;g+=1)p(g);xt()}let d={};h&2&&(d.plugin=m[1]),o.$set(d)},i(m){if(!u){for(let h=0;h<c.length;h+=1)j(f[h]);j(o.$$.fragment,m),u=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)ne(f[h]);ne(o.$$.fragment,m),u=!1},d(m){m&&Y(e),Qt(f,m),ye(o),s=!1,Ft(l)}}}function U$(n,e,t){let{plugin:r}=e,{value:i}=e,{showInput:a}=e,{onValueChange:o}=e;function u(h){t(0,i=h)}function s(h){i.push(h),t(0,i)}function l(h){i.splice(h,1),o(i),t(0,i)}function c(h){h.key===" "&&a()}function f(h,d){let g=[];d>0&&g.push({name:"Move left",icon:"arrow-left",onclick:()=>{let y=i[d-1];t(0,i[d-1]=i[d],i),t(0,i[d]=y,i),o(i)}}),d<i.length-1&&g.push({name:"Move right",icon:"arrow-right",onclick:()=>{let y=i[d+1];t(0,i[d+1]=i[d],i),t(0,i[d]=y,i),o(i)}}),g.push({name:"Edit",icon:"pencil",onclick:()=>{r.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:Aa(i[d]),multiline:!1,onSubmit:y=>{t(0,i[d]=y,i),o(i)},onCancel:()=>{}})}}),g.push({name:"Remove",icon:"x",warning:!0,onclick:()=>l(d)}),r.internal.createContextMenu(g).showWithEvent(h)}let p=(h,d)=>f(d,h),m=()=>a();return n.$$set=h=>{"plugin"in h&&t(1,r=h.plugin),"value"in h&&t(0,i=h.value),"showInput"in h&&t(2,a=h.showInput),"onValueChange"in h&&t(5,o=h.onValueChange)},[i,r,a,c,f,o,u,s,p,m]}var vv=class extends Pe{constructor(e){super(),Be(this,e,U$,V$,ke,{plugin:1,value:0,showInput:2,onValueChange:5,setValue:6,addValue:7})}get setValue(){return this.$$.ctx[6]}get addValue(){return this.$$.ctx[7]}},CD=vv;var Gp=class extends rr{filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return CD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showInput:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function FD(n,e,t){let r=n.slice();return r[13]=e[t],r[15]=t,r}function ID(n){let e,t,r,i,a;t=new oa({props:{value:n[13]}});function o(...u){return n[11](n[15],...u)}return{c(){e=ee("div"),be(t.$$.fragment),q(e,"class","mb-inline-list-item"),q(e,"role","listitem")},m(u,s){J(u,e,s),ve(t,e,null),r=!0,i||(a=Fe(e,"contextmenu",o),i=!0)},p(u,s){n=u;let l={};s&1&&(l.value=n[13]),t.$set(l)},i(u){r||(j(t.$$.fragment,u),r=!0)},o(u){ne(t.$$.fragment,u),r=!1},d(u){u&&Y(e),ye(t),i=!1,a()}}}function q$(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let m=0;m<c.length;m+=1)f[m]=ID(FD(n,c,m));let p=m=>ne(f[m],1,1,()=>{f[m]=null});return o=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){e=ee("div");for(let m=0;m<f.length;m+=1)f[m].c();t=fe(),r=ee("div"),i=ee("span"),i.textContent="\u200B",a=fe(),be(o.$$.fragment),q(r,"class","mb-inline-list-add"),q(r,"role","button"),q(r,"tabindex","0"),q(e,"class","mb-inline-list")},m(m,h){J(m,e,h);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(e,null);K(e,t),K(e,r),K(r,i),K(r,a),ve(o,r,null),u=!0,s||(l=[Fe(r,"click",n[2]),Fe(r,"keydown",n[3])],s=!0)},p(m,[h]){if(h&17){c=ct(m[0]);let g;for(g=0;g<c.length;g+=1){let y=FD(m,c,g);f[g]?(f[g].p(y,h),j(f[g],1)):(f[g]=ID(y),f[g].c(),j(f[g],1),f[g].m(e,t))}for(bt(),g=c.length;g<f.length;g+=1)p(g);xt()}let d={};h&2&&(d.plugin=m[1]),o.$set(d)},i(m){if(!u){for(let h=0;h<c.length;h+=1)j(f[h]);j(o.$$.fragment,m),u=!0}},o(m){f=f.filter(Boolean);for(let h=0;h<f.length;h+=1)ne(f[h]);ne(o.$$.fragment,m),u=!1},d(m){m&&Y(e),Qt(f,m),ye(o),s=!1,Ft(l)}}}function z$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowsOther:u}=e,{onValueChange:s}=e;function l(g){t(0,i=g)}function c(g){i.push(g),t(0,i)}function f(g){i.splice(g,1),s(i),t(0,i)}function p(g){if(!u){a();return}r.internal.createContextMenu([{name:"From Options",onclick:()=>a()},{name:"From Text",onclick:()=>o()}]).showWithEvent(g)}function m(g){g.key===" "&&a()}function h(g,y){let S=[];y>0&&S.push({name:"Move left",icon:"arrow-left",onclick:()=>{let b=i[y-1];t(0,i[y-1]=i[y],i),t(0,i[y]=b,i),s(i)}}),y<i.length-1&&S.push({name:"Move right",icon:"arrow-right",onclick:()=>{let b=i[y+1];t(0,i[y+1]=i[y],i),t(0,i[y]=b,i),s(i)}}),S.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(y)}),r.internal.createContextMenu(S).showWithEvent(g)}let d=(g,y)=>h(y,g);return n.$$set=g=>{"plugin"in g&&t(1,r=g.plugin),"value"in g&&t(0,i=g.value),"showSuggester"in g&&t(5,a=g.showSuggester),"showTextPrompt"in g&&t(6,o=g.showTextPrompt),"allowsOther"in g&&t(7,u=g.allowsOther),"onValueChange"in g&&t(8,s=g.onValueChange)},[i,r,p,m,h,a,o,u,s,l,c,d]}var yv=class extends Pe{constructor(e){super(),Be(this,e,z$,q$,ke,{plugin:1,value:0,showSuggester:5,showTextPrompt:6,allowsOther:7,onValueChange:8,setValue:9,addValue:10})}get setValue(){return this.$$.ctx[9]}get addValue(){return this.$$.ctx[10]}},PD=yv;var Wp=class extends rr{filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return PD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowsOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function kD(n,e,t){let r=n.slice();return r[8]=e[t],r}function BD(n){let e,t=n[8].name+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[8].value,je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&2&&t!==(t=a[8].name+"")&&yt(r,t),o&2&&i!==(i=a[8].value)&&(e.__value=i,je(e,e.__value))},d(a){a&&Y(e)}}}function $$(n){let e,t,r,i=ct(n[1]),a=[];for(let o=0;o<i.length;o+=1)a[o]=BD(kD(n,i,o));return{c(){e=ee("select");for(let o=0;o<a.length;o+=1)a[o].c();q(e,"class","dropdown"),n[0]===void 0&&Wa(()=>n[6].call(e))},m(o,u){J(o,e,u);for(let s=0;s<a.length;s+=1)a[s]&&a[s].m(e,null);Qo(e,n[0],!0),t||(r=[Fe(e,"change",n[6]),Fe(e,"change",n[7])],t=!0)},p(o,[u]){if(u&2){i=ct(o[1]);let s;for(s=0;s<i.length;s+=1){let l=kD(o,i,s);a[s]?a[s].p(l,u):(a[s]=BD(l),a[s].c(),a[s].m(e,null))}for(;s<a.length;s+=1)a[s].d(1);a.length=i.length}u&3&&Qo(e,o[0])},i:Ke,o:Ke,d(o){o&&Y(e),Qt(a,o),t=!1,Ft(r)}}}function H$(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(f){t(0,i=f)}function s(){o(i)}function l(){i=bc(this),t(0,i),t(1,a)}let c=()=>s();return n.$$set=f=>{"plugin"in f&&t(3,r=f.plugin),"value"in f&&t(0,i=f.value),"options"in f&&t(1,a=f.options),"onValueChange"in f&&t(4,o=f.onValueChange)},[i,a,s,r,o,u,l,c]}var bv=class extends Pe{constructor(e){super(),Be(this,e,H$,$$,ke,{plugin:3,value:0,options:1,onValueChange:4,setValue:5})}get setValue(){return this.$$.ctx[5]}},OD=bv;var Yp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Xo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return OD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function RD(n,e,t){let r=n.slice();return r[16]=e[t],r[18]=t,r}function LD(n){let e;return{c(){e=ee("span"),e.textContent="Empty",q(e,"class","mb-list-empty")},m(t,r){J(t,e,r)},p:Ke,d(t){t&&Y(e)}}}function VD(n){let e,t,r,i,a,o;t=new oa({props:{value:n[16]}});function u(...s){return n[10](n[18],...s)}return{c(){e=ee("div"),be(t.$$.fragment),r=fe(),q(e,"class","mb-list-item"),q(e,"role","listitem")},m(s,l){J(s,e,l),ve(t,e,null),K(e,r),i=!0,a||(o=Fe(e,"contextmenu",u),a=!0)},p(s,l){n=s;let c={};l&1&&(c.value=n[16]),t.$set(c)},i(s){i||(j(t.$$.fragment,s),i=!0)},o(s){ne(t.$$.fragment,s),i=!1},d(s){s&&Y(e),ye(t),a=!1,o()}}}function G$(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"tabindex","0"),q(e,"placeholder",n[3]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[5]),t||(r=[Fe(e,"input",n[12]),Fe(e,"keyup",n[13])],t=!0)},p(i,a){a&8&&q(e,"placeholder",i[3]),a&4&&q(e,"maxlength",i[2]),a&32&&e.value!==i[5]&&je(e,i[5])},d(i){i&&Y(e),t=!1,Ft(r)}}}function W$(n){let e,t,r;return{c(){e=ee("textarea"),q(e,"tabindex","0"),q(e,"placeholder",n[3]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[5]),t||(r=Fe(e,"input",n[11]),t=!0)},p(i,a){a&8&&q(e,"placeholder",i[3]),a&4&&q(e,"maxlength",i[2]),a&32&&je(e,i[5])},d(i){i&&Y(e),t=!1,r()}}}function UD(n){let e,t=qD(n[0].length,n[2])+"",r,i;return{c(){e=ee("span"),r=He(t),q(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&5&&t!==(t=qD(a[0].length,a[2])+"")&&yt(r,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&q(e,"class",i)},d(a){a&&Y(e)}}}function Y$(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"plus"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function j$(n){let e,t,r,i,a,o,u,s=ct(n[0]),l=[];for(let g=0;g<s.length;g+=1)l[g]=VD(RD(n,s,g));let c=g=>ne(l[g],1,1,()=>{l[g]=null}),f=null;s.length||(f=LD(n));function p(g,y){return g[4]?W$:G$}let m=p(n,-1),h=m(n),d=n[2]!==void 0&&UD(n);return o=new It({props:{disabled:!n[5],$$slots:{default:[Y$]},$$scope:{ctx:n}}}),o.$on("click",n[14]),{c(){e=ee("div");for(let g=0;g<l.length;g+=1)l[g].c();f&&f.c(),t=fe(),r=ee("div"),h.c(),i=fe(),d&&d.c(),a=fe(),be(o.$$.fragment),q(e,"class","mb-list-items"),q(r,"class","mb-list-input")},m(g,y){J(g,e,y);for(let S=0;S<l.length;S+=1)l[S]&&l[S].m(e,null);f&&f.m(e,null),J(g,t,y),J(g,r,y),h.m(r,null),K(r,i),d&&d.m(r,null),K(r,a),ve(o,r,null),u=!0},p(g,[y]){if(y&129){s=ct(g[0]);let b;for(b=0;b<s.length;b+=1){let w=RD(g,s,b);l[b]?(l[b].p(w,y),j(l[b],1)):(l[b]=VD(w),l[b].c(),j(l[b],1),l[b].m(e,null))}for(bt(),b=s.length;b<l.length;b+=1)c(b);xt(),!s.length&&f?f.p(g,y):s.length?f&&(f.d(1),f=null):(f=LD(g),f.c(),f.m(e,null))}m===(m=p(g,y))&&h?h.p(g,y):(h.d(1),h=m(g),h&&(h.c(),h.m(r,i))),g[2]!==void 0?d?d.p(g,y):(d=UD(g),d.c(),d.m(r,a)):d&&(d.d(1),d=null);let S={};y&32&&(S.disabled=!g[5]),y&524290&&(S.$$scope={dirty:y,ctx:g}),o.$set(S)},i(g){if(!u){for(let y=0;y<s.length;y+=1)j(l[y]);j(o.$$.fragment,g),u=!0}},o(g){l=l.filter(Boolean);for(let y=0;y<l.length;y+=1)ne(l[y]);ne(o.$$.fragment,g),u=!1},d(g){g&&(Y(e),Y(t),Y(r)),Qt(l,g),f&&f.d(),h.d(),d&&d.d(),ye(o)}}}function qD(n,e){let t=e.toString();return`${n.toString().padStart(t.length,"0")}/${t}`}function Z$(n,e,t){let{plugin:r}=e,{value:i}=e,{limit:a}=e,{placeholder:o}=e,{multiLine:u}=e,{onValueChange:s}=e,l="";function c(b){t(0,i=b)}function f(){i.push(l),s(i),t(5,l=""),t(0,i)}function p(b){i.splice(b,1),s(i),t(0,i)}function m(b,w){let A=[];w>0&&A.push({name:"Move up",icon:"arrow-up",onclick:()=>{let x=i[w-1];t(0,i[w-1]=i[w],i),t(0,i[w]=x,i),s(i)}}),w<i.length-1&&A.push({name:"Move down",icon:"arrow-down",onclick:()=>{let x=i[w+1];t(0,i[w+1]=i[w],i),t(0,i[w]=x,i),s(i)}}),A.push({name:"Edit",icon:"pencil",onclick:()=>{r.internal.openTextPromptModal({title:"Meta Bind List",subTitle:"Edit the value of a list item.",value:Aa(i[w]),multiline:u,onSubmit:x=>{t(0,i[w]=x,i),s(i)},onCancel:()=>{}})}}),A.push({name:"Remove",icon:"x",warning:!0,onclick:()=>p(w)}),r.internal.createContextMenu(A).showWithEvent(b)}let h=(b,w)=>m(w,b);function d(){l=this.value,t(5,l)}function g(){l=this.value,t(5,l)}let y=b=>{b.key==="Enter"&&l.length>0&&f()},S=()=>f();return n.$$set=b=>{"plugin"in b&&t(1,r=b.plugin),"value"in b&&t(0,i=b.value),"limit"in b&&t(2,a=b.limit),"placeholder"in b&&t(3,o=b.placeholder),"multiLine"in b&&t(4,u=b.multiLine),"onValueChange"in b&&t(8,s=b.onValueChange)},[i,r,a,o,u,l,f,m,s,c,h,d,g,y,S]}var xv=class extends Pe{constructor(e){super(),Be(this,e,Z$,j$,ke,{plugin:1,value:0,limit:2,placeholder:3,multiLine:4,onValueChange:8,setValue:9})}get setValue(){return this.$$.ctx[9]}},zD=xv;var jp=class extends rr{filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return zD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"New Entry...",limit:this.mountable.getArgument("limit")?.value,multiLine:this.mountable.getArgument("multiLine")?.value===!0}}};function $D(n,e,t){let r=n.slice();return r[14]=e[t],r[16]=t,r}function HD(n){let e;return{c(){e=ee("span"),e.textContent="Empty",q(e,"class","mb-list-empty")},m(t,r){J(t,e,r)},p:Ke,d(t){t&&Y(e)}}}function GD(n){let e,t,r,i,a,o;t=new oa({props:{value:n[14]}});function u(...s){return n[9](n[16],...s)}return{c(){e=ee("div"),be(t.$$.fragment),r=fe(),q(e,"class","mb-list-item"),q(e,"role","listitem")},m(s,l){J(s,e,l),ve(t,e,null),K(e,r),i=!0,a||(o=Fe(e,"contextmenu",u),a=!0)},p(s,l){n=s;let c={};l&1&&(c.value=n[14]),t.$set(c)},i(s){i||(j(t.$$.fragment,s),i=!0)},o(s){ne(t.$$.fragment,s),i=!1},d(s){s&&Y(e),ye(t),a=!1,o()}}}function J$(n){let e;return{c(){e=He("Add new item")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function WD(n){let e,t;return e=new It({props:{variant:"default",$$slots:{default:[X$]},$$scope:{ctx:n}}}),e.$on("click",n[11]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function X$(n){let e;return{c(){e=He("Add other item")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Q$(n){let e,t,r,i,a,o,u=ct(n[0]),s=[];for(let p=0;p<u.length;p+=1)s[p]=GD($D(n,u,p));let l=p=>ne(s[p],1,1,()=>{s[p]=null}),c=null;u.length||(c=HD(n)),i=new It({props:{variant:"default",$$slots:{default:[J$]},$$scope:{ctx:n}}}),i.$on("click",n[10]);let f=n[3]&&WD(n);return{c(){e=ee("div");for(let p=0;p<s.length;p+=1)s[p].c();c&&c.c(),t=fe(),r=ee("div"),be(i.$$.fragment),a=fe(),f&&f.c(),q(e,"class","mb-list-items"),q(r,"class","mb-list-input")},m(p,m){J(p,e,m);for(let h=0;h<s.length;h+=1)s[h]&&s[h].m(e,null);c&&c.m(e,null),J(p,t,m),J(p,r,m),ve(i,r,null),K(r,a),f&&f.m(r,null),o=!0},p(p,[m]){if(m&17){u=ct(p[0]);let d;for(d=0;d<u.length;d+=1){let g=$D(p,u,d);s[d]?(s[d].p(g,m),j(s[d],1)):(s[d]=GD(g),s[d].c(),j(s[d],1),s[d].m(e,null))}for(bt(),d=u.length;d<s.length;d+=1)l(d);xt(),!u.length&&c?c.p(p,m):u.length?c&&(c.d(1),c=null):(c=HD(p),c.c(),c.m(e,null))}let h={};m&131072&&(h.$$scope={dirty:m,ctx:p}),i.$set(h),p[3]?f?(f.p(p,m),m&8&&j(f,1)):(f=WD(p),f.c(),j(f,1),f.m(r,null)):f&&(bt(),ne(f,1,1,()=>{f=null}),xt())},i(p){if(!o){for(let m=0;m<u.length;m+=1)j(s[m]);j(i.$$.fragment,p),j(f),o=!0}},o(p){s=s.filter(Boolean);for(let m=0;m<s.length;m+=1)ne(s[m]);ne(i.$$.fragment,p),ne(f),o=!1},d(p){p&&(Y(e),Y(t),Y(r)),Qt(s,p),c&&c.d(),ye(i),f&&f.d()}}}function K$(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowOther:u}=e,{onValueChange:s}=e;function l(y){t(0,i=y)}function c(y){i.push(y),t(0,i)}function f(y){i.splice(y,1),s(i),t(0,i)}function p(y){y.key===" "&&a()}function m(y,S){let b=[];S>0&&b.push({name:"Move up",icon:"arrow-up",onclick:()=>{let w=i[S-1];t(0,i[S-1]=i[S],i),t(0,i[S]=w,i),s(i)}}),S<i.length-1&&b.push({name:"Move down",icon:"arrow-down",onclick:()=>{let w=i[S+1];t(0,i[S+1]=i[S],i),t(0,i[S]=w,i),s(i)}}),b.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(S)}),r.internal.createContextMenu(b).showWithEvent(y)}let h=(y,S)=>m(S,y),d=()=>a(),g=()=>o();return n.$$set=y=>{"plugin"in y&&t(5,r=y.plugin),"value"in y&&t(0,i=y.value),"showSuggester"in y&&t(1,a=y.showSuggester),"showTextPrompt"in y&&t(2,o=y.showTextPrompt),"allowOther"in y&&t(3,u=y.allowOther),"onValueChange"in y&&t(6,s=y.onValueChange)},[i,a,o,u,m,r,s,l,c,h,d,g]}var wv=class extends Pe{constructor(e){super(),Be(this,e,K$,Q$,ke,{plugin:5,value:0,showSuggester:1,showTextPrompt:2,allowOther:3,onValueChange:6,setValue:7,addValue:8})}get setValue(){return this.$$.ctx[7]}get addValue(){return this.$$.ctx[8]}},YD=wv;var Zp=class extends rr{filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return YD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e.value),this.setInternalValue(t)})}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind List Suggester",subTitle:"Create a new List Element.",value:"",multiline:!1,onSubmit:e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)},onCancel:()=>{}})}};function jD(n,e,t){let r=n.slice();return r[10]=e[t],r}function ZD(n){let e,t,r,i,a,o,u,s,l;function c(){return n[7](n[10])}a=new oa({props:{value:n[10].name}});function f(...m){return n[8](n[10],...m)}function p(...m){return n[9](n[10],...m)}return{c(){e=ee("div"),t=ee("input"),i=fe(),be(a.$$.fragment),o=fe(),q(t,"type","checkbox"),t.checked=r=n[0].includes(n[10].value),q(e,"class","mb-select-input-element mb-mod-multi"),q(e,"role","button"),q(e,"tabindex","0"),Yt(e,"is-selected",n[0].includes(n[10].value))},m(m,h){J(m,e,h),K(e,t),K(e,i),ve(a,e,null),K(e,o),u=!0,s||(l=[Fe(t,"input",c),Fe(e,"click",f),Fe(e,"keypress",p)],s=!0)},p(m,h){n=m,(!u||h&3&&r!==(r=n[0].includes(n[10].value)))&&(t.checked=r);let d={};h&2&&(d.value=n[10].name),a.$set(d),(!u||h&3)&&Yt(e,"is-selected",n[0].includes(n[10].value))},i(m){u||(j(a.$$.fragment,m),u=!0)},o(m){ne(a.$$.fragment,m),u=!1},d(m){m&&Y(e),ye(a),s=!1,Ft(l)}}}function eH(n){let e,t,r=ct(n[1]),i=[];for(let o=0;o<r.length;o+=1)i[o]=ZD(jD(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,[u]){if(u&15){r=ct(o[1]);let s;for(s=0;s<r.length;s+=1){let l=jD(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=ZD(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function tH(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(m){t(0,i=m)}function s(m){i.includes(m)?t(0,i=i.filter(h=>h!==m)):(i.push(m),t(0,i)),o(i)}function l(m,h){m.key===" "&&s(h)}let c=m=>s(m.value),f=(m,h)=>{h.target instanceof HTMLInputElement||s(m.value)},p=(m,h)=>l(h,m.value);return n.$$set=m=>{"plugin"in m&&t(4,r=m.plugin),"value"in m&&t(0,i=m.value),"options"in m&&t(1,a=m.options),"onValueChange"in m&&t(5,o=m.onValueChange)},[i,a,s,l,r,o,u,c,f,p]}var _v=class extends Pe{constructor(e){super(),Be(this,e,tH,eH,ke,{plugin:4,value:0,options:1,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},JD=_v;var Jp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return JD}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function rH(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"tabindex","0"),q(e,"placeholder",n[1])},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[5]),Fe(e,"input",n[6])],t=!0)},p(i,[a]){a&2&&q(e,"placeholder",i[1]),a&1&&Xn(e.value)!==i[0]&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function nH(n,e,t){let{plugin:r}=e,{value:i}=e,{placeholder:a}=e,{onValueChange:o}=e;function u(c){t(0,i=c)}function s(){i=Xn(this.value),t(0,i)}let l=()=>o(i);return n.$$set=c=>{"plugin"in c&&t(3,r=c.plugin),"value"in c&&t(0,i=c.value),"placeholder"in c&&t(1,a=c.placeholder),"onValueChange"in c&&t(2,o=c.onValueChange)},[i,a,o,r,u,s,l]}var Sv=class extends Pe{constructor(e){super(),Be(this,e,nH,rH,ke,{plugin:3,value:0,placeholder:1,onValueChange:2,setValue:4})}get setValue(){return this.$$.ctx[4]}},XD=Sv;var Xp=class extends rr{filterValue(e){return Qu(e)}getFallbackDefaultValue(){return 0}getSvelteComponent(){return XD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")??"Number"}}};var{window:xc}=yc;function iH(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h;return{c(){e=ee("div"),t=ee("div"),i=fe(),a=ee("span"),o=He(n[0]),u=fe(),s=ee("span"),l=He(n[1]),c=fe(),f=ee("span"),p=He(n[2]),q(t,"class","mb-progress-bar-progress"),q(t,"style",r=`width: ${n[5](n[0])}%`),q(t,"role","slider"),q(t,"aria-valuemin",n[1]),q(t,"aria-valuemax",n[2]),q(t,"aria-valuenow",n[0]),q(t,"tabindex","0"),q(a,"class","mb-progress-bar-value"),q(s,"class","mb-progress-bar-label-left"),q(f,"class","mb-progress-bar-label-right"),q(e,"class","mb-progress-bar-input"),q(e,"tabindex","0"),q(e,"role","button")},m(d,g){J(d,e,g),K(e,t),K(e,i),K(e,a),K(a,o),K(e,u),K(e,s),K(s,l),K(e,c),K(e,f),K(f,p),n[15](e),m||(h=[Fe(xc,"touchmove",n[8],{passive:!1}),Fe(xc,"touchcancel",n[6]),Fe(xc,"touchend",n[6]),Fe(xc,"mousemove",n[8]),Fe(xc,"mouseup",n[6]),Fe(t,"dragstart",n[14]),Fe(e,"keydown",n[9]),Fe(e,"mousedown",n[7]),Fe(e,"touchstart",n[7])],m=!0)},p(d,[g]){g&1&&r!==(r=`width: ${d[5](d[0])}%`)&&q(t,"style",r),g&2&&q(t,"aria-valuemin",d[1]),g&4&&q(t,"aria-valuemax",d[2]),g&1&&q(t,"aria-valuenow",d[0]),g&1&&yt(o,d[0]),g&2&&yt(l,d[1]),g&4&&yt(p,d[2])},i:Ke,o:Ke,d(d){d&&Y(e),n[15](null),m=!1,Ft(h)}}}function aH(n,e){return Number.parseFloat((Math.round(n/e)*e).toFixed(10))}function oH(n,e,t){let{plugin:r}=e,{onValueChange:i}=e,{value:a}=e,{minValue:o}=e,{maxValue:u}=e,{stepSize:s}=e,l=!1,c,f=0,p;function m(E){t(0,a=E)}function h(E){t(0,a=E),i(E)}function d(E){return E=mc(E,o,u),Tg(E,o,u,0,100)}function g(){t(3,l=!0)}function y(){t(3,l=!1)}function S(E){g(),b(E)}function b(E){if(!l)return;E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault();let _=E instanceof TouchEvent?E.touches[0].clientX:E.clientX;w(_)}function w(E){let _=c.getBoundingClientRect();E=mc(E,_.left,_.right);let N=Tg(E,_.left,_.right,o,u);N=aH(N,s),h(N)}function A(E){f<50&&(f+=1);let _=Math.ceil(f/5);if(E.key==="ArrowUp"||E.key==="ArrowRight"){let N=mc(a+_,o,u);h(N)}if(E.key==="ArrowDown"||E.key==="ArrowLeft"){let N=mc(a-_,o,u);h(N)}window.clearTimeout(p),p=window.setTimeout(()=>f=1,100)}let x=()=>t(3,l=!0);function D(E){Pr[E?"unshift":"push"](()=>{c=E,t(4,c)})}return n.$$set=E=>{"plugin"in E&&t(10,r=E.plugin),"onValueChange"in E&&t(11,i=E.onValueChange),"value"in E&&t(0,a=E.value),"minValue"in E&&t(1,o=E.minValue),"maxValue"in E&&t(2,u=E.maxValue),"stepSize"in E&&t(12,s=E.stepSize)},[a,o,u,l,c,d,y,S,b,A,r,i,s,m,x,D]}var Av=class extends Pe{constructor(e){super(),Be(this,e,oH,iH,ke,{plugin:10,onValueChange:11,value:0,minValue:1,maxValue:2,stepSize:12,setValue:13})}get setValue(){return this.$$.ctx[13]}},QD=Av;var Qp=class extends rr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new Cr({errorLevel:"ERROR",effect:"can not create progress bar input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Zf(Qu(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return QD}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize}}};function KD(n,e,t){let r=n.slice();return r[10]=e[t],r}function eN(n){let e,t,r,i,a,o,u,s,l;function c(){return n[7](n[10])}a=new oa({props:{value:n[10].name}});function f(...m){return n[8](n[10],...m)}function p(...m){return n[9](n[10],...m)}return{c(){e=ee("div"),t=ee("input"),i=fe(),be(a.$$.fragment),o=fe(),q(t,"type","checkbox"),t.checked=r=n[10].value===n[0],q(e,"class","mb-select-input-element"),q(e,"role","button"),q(e,"tabindex","0"),Yt(e,"is-selected",n[10].value===n[0])},m(m,h){J(m,e,h),K(e,t),K(e,i),ve(a,e,null),K(e,o),u=!0,s||(l=[Fe(t,"input",c),Fe(e,"click",f),Fe(e,"keypress",p)],s=!0)},p(m,h){n=m,(!u||h&3&&r!==(r=n[10].value===n[0]))&&(t.checked=r);let d={};h&2&&(d.value=n[10].name),a.$set(d),(!u||h&3)&&Yt(e,"is-selected",n[10].value===n[0])},i(m){u||(j(a.$$.fragment,m),u=!0)},o(m){ne(a.$$.fragment,m),u=!1},d(m){m&&Y(e),ye(a),s=!1,Ft(l)}}}function sH(n){let e,t,r=ct(n[1]),i=[];for(let o=0;o<r.length;o+=1)i[o]=eN(KD(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,[u]){if(u&15){r=ct(o[1]);let s;for(s=0;s<r.length;s+=1){let l=KD(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=eN(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function uH(n,e,t){let{plugin:r}=e,{value:i}=e,{options:a}=e,{onValueChange:o}=e;function u(m){t(0,i=m)}function s(m){i===m?t(0,i=null):t(0,i=m),o(i)}function l(m,h){m.key===" "&&s(h)}let c=m=>s(m.value),f=(m,h)=>{h.target instanceof HTMLInputElement||s(m.value)},p=(m,h)=>l(h,m.value);return n.$$set=m=>{"plugin"in m&&t(4,r=m.plugin),"value"in m&&t(0,i=m.value),"options"in m&&t(1,a=m.options),"onValueChange"in m&&t(5,o=m.onValueChange)},[i,a,s,l,r,o,u,c,f,p]}var Mv=class extends Pe{constructor(e){super(),Be(this,e,uH,sH,ke,{plugin:4,value:0,options:1,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},tN=Mv;var Kp=class extends rr{constructor(e){super(e),this.options=this.mountable.getArguments("option")}filterValue(e){return Xo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return tN}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{options:this.options}}};function rN(n){let e,t;return{c(){e=ee("span"),t=He(n[1]),q(e,"class","mb-slider-input-label")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&2&&yt(t,r[1])},d(r){r&&Y(e)}}}function nN(n){let e,t;return{c(){e=ee("span"),t=He(n[2]),q(e,"class","mb-slider-input-label")},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&4&&yt(t,r[2])},d(r){r&&Y(e)}}}function lH(n){let e,t,r,i,a,o,u=n[4]&&rN(n),s=n[4]&&nN(n);return{c(){u&&u.c(),e=fe(),t=ee("input"),r=fe(),s&&s.c(),i=Er(),q(t,"class","mb-slider-input slider"),q(t,"type","range"),q(t,"tabindex","0"),q(t,"min",n[1]),q(t,"max",n[2]),q(t,"step",n[3])},m(l,c){u&&u.m(l,c),J(l,e,c),J(l,t,c),je(t,n[0]),J(l,r,c),s&&s.m(l,c),J(l,i,c),a||(o=[Fe(t,"change",n[7]),Fe(t,"input",n[7]),Fe(t,"input",n[8])],a=!0)},p(l,[c]){l[4]?u?u.p(l,c):(u=rN(l),u.c(),u.m(e.parentNode,e)):u&&(u.d(1),u=null),c&2&&q(t,"min",l[1]),c&4&&q(t,"max",l[2]),c&8&&q(t,"step",l[3]),c&1&&je(t,l[0]),l[4]?s?s.p(l,c):(s=nN(l),s.c(),s.m(i.parentNode,i)):s&&(s.d(1),s=null)},i:Ke,o:Ke,d(l){l&&(Y(e),Y(t),Y(r),Y(i)),u&&u.d(l),s&&s.d(l),a=!1,Ft(o)}}}function cH(n,e,t){let{value:r}=e,{minValue:i}=e,{maxValue:a}=e,{stepSize:o}=e,{addLabels:u}=e,{onValueChange:s}=e;function l(p){t(0,r=p)}function c(){r=Xn(this.value),t(0,r)}let f=()=>s(r);return n.$$set=p=>{"value"in p&&t(0,r=p.value),"minValue"in p&&t(1,i=p.minValue),"maxValue"in p&&t(2,a=p.maxValue),"stepSize"in p&&t(3,o=p.stepSize),"addLabels"in p&&t(4,u=p.addLabels),"onValueChange"in p&&t(5,s=p.onValueChange)},[r,i,a,o,u,s,l,c,f]}var Ev=class extends Pe{constructor(e){super(),Be(this,e,cH,lH,ke,{value:0,minValue:1,maxValue:2,stepSize:3,addLabels:4,onValueChange:5,setValue:6})}get setValue(){return this.$$.ctx[6]}},iN=Ev;var em=class extends rr{constructor(e){if(super(e),this.minValue=this.mountable.getArgument("minValue")?.value??0,this.maxValue=this.mountable.getArgument("maxValue")?.value??100,this.stepSize=this.mountable.getArgument("stepSize")?.value??1,this.minValue>=this.maxValue)throw new Cr({errorLevel:"ERROR",effect:"can not create slider input field",cause:`minValue (${this.maxValue}) must be less than maxValue (${this.maxValue})`})}filterValue(e){return Zf(Qu(e),this.minValue,this.maxValue)}getFallbackDefaultValue(){return this.minValue}getSvelteComponent(){return iN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{minValue:this.minValue,maxValue:this.maxValue,stepSize:this.stepSize,addLabels:this.mountable.getArgument("addLabels")?.value===!0}}};function fH(n){let e,t;return{c(){e=ee("span"),t=He(n[5])},m(r,i){J(r,e,i),K(e,t)},p(r,i){i&32&&yt(t,r[5])},i:Ke,o:Ke,d(r){r&&Y(e)}}}function pH(n){let e,t,r;function i(o){n[10](o)}let a={};return n[4]!==void 0&&(a.mdLink=n[4]),e=new ts({props:a}),Pr.push(()=>Kn(e,"mdLink",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u&16&&(t=!0,s.mdLink=o[4],Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function mH(n){let e,t;return e=new qr({props:{plugin:n[0],iconName:"list"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function aN(n){let e,t;return e=new It({props:{variant:"plain",$$slots:{default:[dH]},$$scope:{ctx:n}}}),e.$on("click",function(){Ws(n[2])&&n[2].apply(this,arguments)}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){n=r;let a={};i&2049&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function dH(n){let e,t;return e=new qr({props:{plugin:n[0],iconName:"pencil"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function hH(n){let e,t,r,i,a,o,u,s,l=[pH,fH],c=[];function f(m,h){return m[6]?0:1}r=f(n,-1),i=c[r]=l[r](n),o=new It({props:{variant:"plain",$$slots:{default:[mH]},$$scope:{ctx:n}}}),o.$on("click",function(){Ws(n[1])&&n[1].apply(this,arguments)});let p=n[3]&&aN(n);return{c(){e=ee("div"),t=ee("div"),i.c(),a=fe(),be(o.$$.fragment),u=fe(),p&&p.c(),q(t,"class","mb-suggest-text"),q(e,"class","mb-suggest-input")},m(m,h){J(m,e,h),K(e,t),c[r].m(t,null),K(e,a),ve(o,e,null),K(e,u),p&&p.m(e,null),s=!0},p(m,[h]){n=m;let d=r;r=f(n,h),r===d?c[r].p(n,h):(bt(),ne(c[d],1,1,()=>{c[d]=null}),xt(),i=c[r],i?i.p(n,h):(i=c[r]=l[r](n),i.c()),j(i,1),i.m(t,null));let g={};h&2049&&(g.$$scope={dirty:h,ctx:n}),o.$set(g),n[3]?p?(p.p(n,h),h&8&&j(p,1)):(p=aN(n),p.c(),j(p,1),p.m(e,null)):p&&(bt(),ne(p,1,1,()=>{p=null}),xt())},i(m){s||(j(i),j(o.$$.fragment,m),j(p),s=!0)},o(m){ne(i),ne(o.$$.fragment,m),ne(p),s=!1},d(m){m&&Y(e),c[r].d(),ye(o),p&&p.d()}}}function gH(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{showTextPrompt:o}=e,{allowOther:u}=e,{onValueChange:s}=e,l,c,f=!1;zi(()=>{p(i)});function p(h){let d=h?.toString()??"null";if(t(6,f=un.isLink(d)),f)try{t(4,l=un.parseLink(d))}catch(g){console.warn(g)}else t(5,c=d)}function m(h){l=h,t(4,l)}return n.$$set=h=>{"plugin"in h&&t(0,r=h.plugin),"value"in h&&t(7,i=h.value),"showSuggester"in h&&t(1,a=h.showSuggester),"showTextPrompt"in h&&t(2,o=h.showTextPrompt),"allowOther"in h&&t(3,u=h.allowOther),"onValueChange"in h&&t(8,s=h.onValueChange)},[r,a,o,u,l,c,f,i,s,p,m]}var Dv=class extends Pe{constructor(e){super(),Be(this,e,gH,hH,ke,{plugin:0,value:7,showSuggester:1,showTextPrompt:2,allowOther:3,onValueChange:8,setValue:9})}get setValue(){return this.$$.ctx[9]}},oN=Dv;var tm=class extends rr{filterValue(e){return Xo(e)}getFallbackDefaultValue(){return null}getSvelteComponent(){return oN}rawMapValue(e){return e}rawReverseMapValue(e){return e}getMountArgs(){return{showSuggester:()=>this.openModal(),showTextPrompt:()=>this.openTextModal(),allowOther:this.mountable.getArgument("allowOther")?.value===!0}}openModal(){this.mountable.plugin.internal.openSuggesterModal(this,e=>this.setInternalValue(e.value))}openTextModal(){this.mountable.plugin.internal.openTextPromptModal({title:"Meta Bind Suggester",subTitle:"Set the suggester value.",value:"",multiline:!1,onSubmit:e=>{this.setInternalValue(e)},onCancel:()=>{}})}};function sN(n){let e,t=uN(n[0].length,n[2])+"",r,i;return{c(){e=ee("span"),r=He(t),q(e,"class",i=`mb-content-limit-indicator ${n[0].length>n[2]?"mb-content-limit-indicator-overflow":""}`)},m(a,o){J(a,e,o),K(e,r)},p(a,o){o&5&&t!==(t=uN(a[0].length,a[2])+"")&&yt(r,t),o&5&&i!==(i=`mb-content-limit-indicator ${a[0].length>a[2]?"mb-content-limit-indicator-overflow":""}`)&&q(e,"class",i)},d(a){a&&Y(e)}}}function vH(n){let e,t,r,i,a,o=n[2]!==void 0&&sN(n);return{c(){e=ee("input"),t=fe(),o&&o.c(),r=Er(),q(e,"type","text"),q(e,"tabindex","0"),q(e,"placeholder",n[1]),q(e,"maxlength",n[2])},m(u,s){J(u,e,s),je(e,n[0]),J(u,t,s),o&&o.m(u,s),J(u,r,s),i||(a=[Fe(e,"input",n[6]),Fe(e,"input",n[7])],i=!0)},p(u,[s]){s&2&&q(e,"placeholder",u[1]),s&4&&q(e,"maxlength",u[2]),s&1&&e.value!==u[0]&&je(e,u[0]),u[2]!==void 0?o?o.p(u,s):(o=sN(u),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null)},i:Ke,o:Ke,d(u){u&&(Y(e),Y(t),Y(r)),o&&o.d(u),i=!1,Ft(a)}}}function uN(n,e){let t=e.toString();return`${n.toString().padStart(t.length,"0")}/${t}`}function yH(n,e,t){let{plugin:r}=e,{value:i}=e,{placeholder:a}=e,{limit:o}=e,{onValueChange:u}=e;function s(f){t(0,i=f)}function l(){i=this.value,t(0,i)}let c=()=>u(i);return n.$$set=f=>{"plugin"in f&&t(4,r=f.plugin),"value"in f&&t(0,i=f.value),"placeholder"in f&&t(1,a=f.placeholder),"limit"in f&&t(2,o=f.limit),"onValueChange"in f&&t(3,u=f.onValueChange)},[i,a,o,u,r,s,l,c]}var Nv=class extends Pe{constructor(e){super(),Be(this,e,yH,vH,ke,{plugin:4,value:0,placeholder:1,limit:2,onValueChange:3,setValue:5})}get setValue(){return this.$$.ctx[5]}},lN=Nv;var rm=class extends rr{filterValue(e){return Ga(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return lN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};function bH(n){let e,t,r;return{c(){e=ee("textarea"),q(e,"class","mb-input-textarea"),q(e,"tabindex","0"),q(e,"placeholder",n[1]),q(e,"maxlength",n[2])},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[5]),Fe(e,"input",n[6])],t=!0)},p(i,[a]){a&2&&q(e,"placeholder",i[1]),a&4&&q(e,"maxlength",i[2]),a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function xH(n,e,t){let{value:r}=e,{placeholder:i}=e,{limit:a}=e,{onValueChange:o}=e;function u(c){t(0,r=c)}function s(){r=this.value,t(0,r)}let l=()=>o(r);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"placeholder"in c&&t(1,i=c.placeholder),"limit"in c&&t(2,a=c.limit),"onValueChange"in c&&t(3,o=c.onValueChange)},[r,i,a,o,u,s,l]}var Tv=class extends Pe{constructor(e){super(),Be(this,e,xH,bH,ke,{value:0,placeholder:1,limit:2,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},cN=Tv;var nm=class extends rr{filterValue(e){return Ga(e)}getFallbackDefaultValue(){return""}getSvelteComponent(){return cN}rawReverseMapValue(e){return e}rawMapValue(e){return e}getMountArgs(){return{placeholder:this.mountable.getArgument("placeholder")?.value??"Text",limit:this.mountable.getArgument("limit")?.value}}};function wH(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","time")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function _H(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var Cv=class extends Pe{constructor(e){super(),Be(this,e,_H,wH,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},fN=Cv;var im=class extends rr{filterValue(e){return Ga(e)}getFallbackDefaultValue(){return"00:00"}getSvelteComponent(){return fN}rawMapValue(e){return e}rawReverseMapValue(e){return e}};function SH(n){let e,t,r,i;return{c(){e=ee("div"),t=ee("input"),q(t,"type","checkbox"),q(t,"tabindex","-1"),t.checked=n[0],q(e,"class","checkbox-container"),q(e,"role","switch"),q(e,"tabindex","0"),q(e,"aria-checked",n[0]),Yt(e,"is-enabled",n[0])},m(a,o){J(a,e,o),K(e,t),r||(i=[Fe(e,"click",n[5]),Fe(e,"keypress",n[6])],r=!0)},p(a,[o]){o&1&&(t.checked=a[0]),o&1&&q(e,"aria-checked",a[0]),o&1&&Yt(e,"is-enabled",a[0])},i:Ke,o:Ke,d(a){a&&Y(e),r=!1,Ft(i)}}}function AH(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(c){t(0,r=c)}function o(){t(0,r=!r),i(r)}function u(c){c.key===" "&&o()}let s=()=>o(),l=c=>u(c);return n.$$set=c=>{"value"in c&&t(0,r=c.value),"onValueChange"in c&&t(3,i=c.onValueChange)},[r,o,u,i,a,s,l]}var Fv=class extends Pe{constructor(e){super(),Be(this,e,AH,SH,ke,{value:0,onValueChange:3,setValue:4})}get setValue(){return this.$$.ctx[4]}},pN=Fv;var am=class extends rr{constructor(e){super(e),this.onValue=this.mountable.getArgument("onValue")?.value??!0,this.offValue=this.mountable.getArgument("offValue")?.value??!1}filterValue(e){return e===this.onValue||e===this.offValue?Xo(e):void 0}getFallbackDefaultValue(){return!1}getSvelteComponent(){return pN}rawReverseMapValue(e){return e===this.onValue?!0:(e===this.offValue,!1)}rawMapValue(e){return e?this.onValue:this.offValue}};function mN(n,e,t){let r=n.slice();return r[11]=e[t],r[13]=t,r}function dN(n){let e,t,r,i,a,o,u,s=n[11]+"",l,c,f,p;function m(...h){return n[7](n[13],...h)}return{c(){e=ee("div"),t=ee("img"),a=fe(),o=ee("div"),u=ee("span"),l=He(s),c=fe(),q(t,"class","mb-image-card-image"),ia(t.src,r=n[1].internal.imagePathToUri(n[11]))||q(t,"src",r),q(t,"alt",i=n[11]),q(o,"class","mb-image-card-footer"),q(e,"class","mb-image-card"),q(e,"role","listitem")},m(h,d){J(h,e,d),K(e,t),K(e,a),K(e,o),K(o,u),K(u,l),K(e,c),f||(p=Fe(e,"contextmenu",m),f=!0)},p(h,d){n=h,d&3&&!ia(t.src,r=n[1].internal.imagePathToUri(n[11]))&&q(t,"src",r),d&1&&i!==(i=n[11])&&q(t,"alt",i),d&1&&s!==(s=n[11]+"")&&yt(l,s)},d(h){h&&Y(e),f=!1,p()}}}function MH(n){let e;return{c(){e=He("Add new image")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function EH(n){let e,t,r,i,a,o=ct(n[0]),u=[];for(let s=0;s<o.length;s+=1)u[s]=dN(mN(n,o,s));return i=new It({props:{variant:"default",$$slots:{default:[MH]},$$scope:{ctx:n}}}),i.$on("click",n[8]),{c(){e=ee("div");for(let s=0;s<u.length;s+=1)u[s].c();t=fe(),r=ee("div"),be(i.$$.fragment),q(e,"class","mb-image-card-grid"),q(r,"class","mb-list-input")},m(s,l){J(s,e,l);for(let c=0;c<u.length;c+=1)u[c]&&u[c].m(e,null);J(s,t,l),J(s,r,l),ve(i,r,null),a=!0},p(s,[l]){if(l&11){o=ct(s[0]);let f;for(f=0;f<o.length;f+=1){let p=mN(s,o,f);u[f]?u[f].p(p,l):(u[f]=dN(p),u[f].c(),u[f].m(e,null))}for(;f<u.length;f+=1)u[f].d(1);u.length=o.length}let c={};l&16384&&(c.$$scope={dirty:l,ctx:s}),i.$set(c)},i(s){a||(j(i.$$.fragment,s),a=!0)},o(s){ne(i.$$.fragment,s),a=!1},d(s){s&&(Y(e),Y(t),Y(r)),Qt(u,s),ye(i)}}}function DH(n,e,t){let{plugin:r}=e,{value:i}=e,{showSuggester:a}=e,{onValueChange:o}=e;function u(h){t(0,i=h)}function s(h){i.push(h),t(0,i)}function l(h){i.splice(h,1),o(i),t(0,i)}function c(h){h.key===" "&&a()}function f(h,d){let g=[];d>0&&g.push({name:"Move left",icon:"arrow-left",onclick:()=>{let y=i[d-1];t(0,i[d-1]=i[d],i),t(0,i[d]=y,i),o(i)}}),d<i.length-1&&g.push({name:"Move right",icon:"arrow-right",onclick:()=>{let y=i[d+1];t(0,i[d+1]=i[d],i),t(0,i[d]=y,i),o(i)}}),g.push({name:"Copy image path",icon:"copy",onclick:()=>{let y=i[d];navigator.clipboard.writeText(y).then(()=>{r.internal.showNotice("Image path copied to clipboard")})}}),g.push({name:"Remove",icon:"x",warning:!0,onclick:()=>l(d)}),r.internal.createContextMenu(g).showWithEvent(h)}let p=(h,d)=>f(d,h),m=()=>a();return n.$$set=h=>{"plugin"in h&&t(1,r=h.plugin),"value"in h&&t(0,i=h.value),"showSuggester"in h&&t(2,a=h.showSuggester),"onValueChange"in h&&t(4,o=h.onValueChange)},[i,r,a,f,o,u,s,p,m]}var Iv=class extends Pe{constructor(e){super(),Be(this,e,DH,EH,ke,{plugin:1,value:0,showSuggester:2,onValueChange:4,setValue:5,addValue:6})}get setValue(){return this.$$.ctx[5]}get addValue(){return this.$$.ctx[6]}},hN=Iv;var om=class extends rr{filterValue(e){return na(e)}getFallbackDefaultValue(){return[]}getSvelteComponent(){return hN}rawMapValue(e){return e}rawReverseMapValue(e){return e.map(t=>Aa(t)).filter(t=>t!==void 0)}getMountArgs(){return{showSuggester:()=>this.openModal()}}openModal(){this.mountable.plugin.internal.openImageSuggesterModal(this,e=>{let t=this.getInternalValue();t.push(e),this.setInternalValue(t)})}};function NH(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","datetime-local")},m(i,a){J(i,e,a),je(e,n[0]),t||(r=[Fe(e,"input",n[3]),Fe(e,"input",n[4])],t=!0)},p(i,[a]){a&1&&je(e,i[0])},i:Ke,o:Ke,d(i){i&&Y(e),t=!1,Ft(r)}}}function TH(n,e,t){let{value:r}=e,{onValueChange:i}=e;function a(s){t(0,r=s)}function o(){r=this.value,t(0,r)}let u=()=>i(r);return n.$$set=s=>{"value"in s&&t(0,r=s.value),"onValueChange"in s&&t(1,i=s.onValueChange)},[r,i,a,o,u]}var Pv=class extends Pe{constructor(e){super(),Be(this,e,TH,NH,ke,{value:0,onValueChange:1,setValue:2})}get setValue(){return this.$$.ctx[2]}},gN=Pv;var sm=class extends rr{filterValue(e){return Ga(e)}getFallbackDefaultValue(){return jn.stringify(jn.getDefaultDate())}getSvelteComponent(){return gN}rawMapValue(e){return e}rawReverseMapValue(e){return e}};var um=class{constructor(e){this.plugin=e}createInputField(e){let t=e.declaration.inputFieldType,r=e.renderChildType;if(t!=="invalid"&&this.checkRenderChildTypeAllowed(t,r),t==="toggle")return new am(e);if(t==="slider")return new em(e);if(t==="text")return new rm(e);if(t==="textArea")return new nm(e);if(t==="select")return new Kp(e);if(t==="multiSelect")return new Jp(e);if(t==="datePicker")return new qp(e);if(t==="number")return new Xp(e);if(t==="suggester")return new tm(e);if(t==="editor")return new zp(e);if(t==="progressBar")return new Qp(e);if(t==="inlineSelect")return new Yp(e);if(t==="imageSuggester")return new $p(e);if(t==="list")return new jp(e);if(t==="listSuggester")return new Zp(e);if(t==="date")return new Up(e);if(t==="time")return new im(e);if(t==="inlineListSuggester")return new Wp(e);if(t==="inlineList")return new Gp(e);if(t==="imageListSuggester")return new om(e);if(t==="dateTime")return new sm(e);}checkRenderChildTypeAllowed(e,t){if(this.plugin.settings.ignoreCodeBlockRestrictions)return;let r=zf[e];if(t==="block"&&!r.allowInBlock)throw new _a({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of code blocks`,docs:[qt.linkToInputField(e)]});if(t==="inline"&&!r.allowInline)throw new _a({errorLevel:"ERROR",effect:"can not create input field",cause:`input fields of type '${e}' are not allowed inside of inline code blocks`,docs:[qt.linkToInputField(e)]})}};var lm=class extends An{constructor(e,t,r,i){super(e,t,r),this.declaration=i,this.declarationString=i.declarationString,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(i.errorCollection),this.variables=[],this.buildVariables()}buildVariables(){if(this.errorCollection.isEmpty())try{for(let e of this.declaration.bindTargetMappings??[])this.variables.push({bindTargetDeclaration:e.bindTarget,inputSignal:new Lr(void 0),uuid:Ir(),contextName:e.name})}catch(e){this.errorCollection.add(e)}}buildContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}async evaluate(){return this.jsRenderer?.evaluate({bound:this.buildContext()})}registerSelfToMetadataManager(){let e=new Lr(void 0);this.metadataSubscription=this.plugin.metadataManager.subscribeComputed(this.getUuid(),e,this.declaration.writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.evaluate(),()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataSubscription?.unsubscribe()}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){if(console.debug("meta-bind | JsViewFieldMountable >> mount",this.declaration),super.onMount(e),mt.addClass(e,"mb-view"),mt.empty(e),this.plugin.internal.isJsEngineAvailable()||this.errorCollection.add(new yo({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 yo({errorLevel:"CRITICAL",effect:"Can't evaluate expression.",cause:"JS evaluation is disabled in the plugin settings."})),this.createErrorIndicator(e),this.errorCollection.hasErrors())return;let t=document.createElement("div");mt.addClass(t,"mb-view-wrapper"),this.jsRenderer=this.plugin.internal.createJsRenderer(t,this.getFilePath(),this.declaration.code,this.declaration.hidden),this.registerSelfToMetadataManager(),e.appendChild(t)}onUnmount(e){console.debug("meta-bind | JsViewFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.unregisterSelfFromMetadataManager(),Yn(e,"js view field")}};var cm=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.renderChildType=i,this.declaration=a,this.declarationString=a.declarationString,this.errorCollection=new Gt(this.getUuid()),this.errorCollection.merge(a.errorCollection)}hasArgument(e){return this.getArguments(e).length>0}getArgument(e){return this.getArguments(e).at(0)}getArguments(e){if(this.declaration.errorCollection.hasErrors())throw new Ut({errorLevel:"ERROR",effect:"an not retrieve arguments",cause:"viewFieldDeclaration has errors"});return this.declaration.argumentContainer.getAll(e)}getDeclaration(){return this.declaration}createViewField(){if(!this.errorCollection.hasErrors())try{this.viewField=this.plugin.api.viewFieldFactory.createViewField(this)}catch(e){this.errorCollection.add(e)}!this.errorCollection.hasErrors()&&!this.viewField&&this.errorCollection.add(new Ut({errorLevel:"CRITICAL",effect:"can't render view field",cause:"view field is undefined"}))}createErrorIndicator(e){this.plugin.internal.createErrorIndicator(e,{errorCollection:this.errorCollection,errorText:"Errors caused the creation of the field to fail. Sometimes one error only occurs because of another.",warningText:"Warnings will not cause the creation of a field to fail, but they indicate that a part of the declaration was invalid or uses deprecated functionality.",code:this.declarationString})}onMount(e){if(console.debug("meta-bind | ViewFieldMountable >> mount",this.declaration),super.onMount(e),mt.empty(e),mt.addClass(e,"mb-view"),this.createViewField(),this.errorCollection.hasErrors()){this.createErrorIndicator(e);return}let t=document.createElement("div");mt.addClass(t,"mb-view-wrapper");try{this.viewField?.mount(t)}catch(i){this.errorCollection.add(i)}this.createErrorIndicator(e),e.append(t);let r=this.getArguments("class");for(let i of r)mt.addClasses(t,i.value);mt.addClass(t,`mb-view-type-${this.declaration.viewFieldType}`),this.renderChildType==="block"?mt.addClass(e,"mb-view-block"):mt.addClass(e,"mb-view-inline")}onUnmount(e){console.debug("meta-bind | ViewFieldMountable >> unmount",this.declaration),super.onUnmount(e),this.viewField?.unmount(),Yn(e,"view field")}};var Ya=class extends Jn{constructor(e){super(),this.mountable=e,this.plugin=e.plugin,this.inputSignal=new Lr(void 0),this.variables=[],this.hidden=!1}async initialRender(e){mt.addClass(e,"mb-view-text"),this.hidden=this.mountable.getArgument("hidden")?.value??!1,this.hidden&&mt.addClass(e,"mb-view-hidden"),await this.onInitialRender(e),await this.rerender(e,"")}async rerender(e,t){if(!this.hidden){let r=wp(t,this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty)??"";mt.empty(e),await this.onRerender(e,r)}}onMount(e){this.buildVariables(),this.inputSignal.registerListener({callback:t=>void this.rerender(e,t)}),this.metadataSubscription=this.mountable.plugin.metadataManager.subscribeComputed(this.mountable.getUuid(),this.inputSignal,this.mountable.getDeclaration().writeToBindTarget,this.variables.map(t=>({bindTarget:t.bindTargetDeclaration,callbackSignal:t.inputSignal})),async()=>await this.computeValue(),()=>this.mountable.unmount()),this.initialRender(e)}onUnmount(){this.inputSignal.unregisterAllListeners(),this.metadataSubscription?.unsubscribe()}};function CH(n){let e,t;return e=new Hp({props:{elements:n[0],$$slots:{default:[PH,({element:r})=>({1:r}),({element:r})=>r?2:0]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.elements=r[0]),i&6&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function FH(n){let e,t;return e=new ts({props:{mdLink:n[0][0]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.mdLink=r[0][0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function IH(n){let e;return{c(){e=ee("span")},m(t,r){J(t,e,r)},p:Ke,i:Ke,o:Ke,d(t){t&&Y(e)}}}function PH(n){let e,t;return e=new ts({props:{mdLink:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.mdLink=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function kH(n){let e,t,r,i,a=[IH,FH,CH],o=[];function u(s,l){return s[0].length===0?0:s[0].length===1?1:2}return e=u(n,-1),t=o[e]=a[e](n),{c(){t.c(),r=Er()},m(s,l){o[e].m(s,l),J(s,r,l),i=!0},p(s,[l]){let c=e;e=u(s,l),e===c?o[e].p(s,l):(bt(),ne(o[c],1,1,()=>{o[c]=null}),xt(),t=o[e],t?t.p(s,l):(t=o[e]=a[e](s),t.c()),j(t,1),t.m(r.parentNode,r))},i(s){i||(j(t),i=!0)},o(s){ne(t),i=!1},d(s){s&&Y(r),o[e].d(s)}}}function BH(n,e,t){let{mdLinkList:r}=e;return n.$$set=i=>{"mdLinkList"in i&&t(0,r=i.mdLinkList)},[r]}var kv=class extends Pe{constructor(e){super(),Be(this,e,BH,kH,ke,{mdLinkList:0})}},Bv=kv;var fm=class extends Ya{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(r=>typeof r=="string"?r:!0);if(e.length!==1)throw new Yo({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new Yo({errorLevel:"ERROR",effect:"can not create view field",cause:"link view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new Sa({errorLevel:"CRITICAL",effect:"failed to evaluate link view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?un.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>un.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new Bv({target:e,props:{mdLinkList:[]}})}async onRerender(e,t){let r=un.parseLinkList(t);this.component=new Bv({target:e,props:{mdLinkList:r}})}onUnmount(){super.onUnmount(),this.component?.$destroy()}};function zr(){return zr=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zr.apply(this,arguments)}var Ov={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function At(n){return typeof n=="number"}function pt(n){return!n||typeof n!="object"||typeof n.constructor!="function"?!1:n.isBigNumber===!0&&typeof n.constructor.prototype=="object"&&n.constructor.prototype.isBigNumber===!0||typeof n.constructor.isDecimal=="function"&&n.constructor.isDecimal(n)===!0}function gi(n){return n&&typeof n=="object"&&Object.getPrototypeOf(n).isComplex===!0||!1}function Ao(n){return n&&typeof n=="object"&&Object.getPrototypeOf(n).isFraction===!0||!1}function Un(n){return n&&n.constructor.prototype.isUnit===!0||!1}function rn(n){return typeof n=="string"}var nr=Array.isArray;function ot(n){return n&&n.constructor.prototype.isMatrix===!0||!1}function ln(n){return Array.isArray(n)||ot(n)}function Xs(n){return n&&n.isDenseMatrix&&n.constructor.prototype.isMatrix===!0||!1}function Ta(n){return n&&n.isSparseMatrix&&n.constructor.prototype.isMatrix===!0||!1}function il(n){return n&&n.constructor.prototype.isRange===!0||!1}function rs(n){return n&&n.constructor.prototype.isIndex===!0||!1}function vN(n){return typeof n=="boolean"}function yN(n){return n&&n.constructor.prototype.isResultSet===!0||!1}function pm(n){return n&&n.constructor.prototype.isHelp===!0||!1}function bN(n){return typeof n=="function"}function xN(n){return n instanceof Date}function wN(n){return n instanceof RegExp}function ns(n){return!!(n&&typeof n=="object"&&n.constructor===Object&&!gi(n)&&!Ao(n))}function _N(n){return n===null}function SN(n){return n===void 0}function $i(n){return n&&n.isAccessorNode===!0&&n.constructor.prototype.isNode===!0||!1}function qn(n){return n&&n.isArrayNode===!0&&n.constructor.prototype.isNode===!0||!1}function AN(n){return n&&n.isAssignmentNode===!0&&n.constructor.prototype.isNode===!0||!1}function MN(n){return n&&n.isBlockNode===!0&&n.constructor.prototype.isNode===!0||!1}function EN(n){return n&&n.isConditionalNode===!0&&n.constructor.prototype.isNode===!0||!1}function zt(n){return n&&n.isConstantNode===!0&&n.constructor.prototype.isNode===!0||!1}function wc(n){return zt(n)||Vr(n)&&n.args.length===1&&zt(n.args[0])&&"-+~".includes(n.op)}function ja(n){return n&&n.isFunctionAssignmentNode===!0&&n.constructor.prototype.isNode===!0||!1}function vi(n){return n&&n.isFunctionNode===!0&&n.constructor.prototype.isNode===!0||!1}function sa(n){return n&&n.isIndexNode===!0&&n.constructor.prototype.isNode===!0||!1}function jt(n){return n&&n.isNode===!0&&n.constructor.prototype.isNode===!0||!1}function is(n){return n&&n.isObjectNode===!0&&n.constructor.prototype.isNode===!0||!1}function Vr(n){return n&&n.isOperatorNode===!0&&n.constructor.prototype.isNode===!0||!1}function zn(n){return n&&n.isParenthesisNode===!0&&n.constructor.prototype.isNode===!0||!1}function DN(n){return n&&n.isRangeNode===!0&&n.constructor.prototype.isNode===!0||!1}function NN(n){return n&&n.isRelationalNode===!0&&n.constructor.prototype.isNode===!0||!1}function Fr(n){return n&&n.isSymbolNode===!0&&n.constructor.prototype.isNode===!0||!1}function mm(n){return n&&n.constructor.prototype.isChain===!0||!1}function Kt(n){var e=typeof n;return e==="object"?n===null?"null":pt(n)?"BigNumber":n.constructor&&n.constructor.name?n.constructor.name:"Object":e}function vt(n){var e=typeof n;if(e==="number"||e==="string"||e==="boolean"||n===null||n===void 0)return n;if(typeof n.clone=="function")return n.clone();if(Array.isArray(n))return n.map(function(t){return vt(t)});if(n instanceof Date)return new Date(n.valueOf());if(pt(n))return n;if(ns(n))return OH(n,vt);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(n,")"))}function OH(n,e){var t={};for(var r in n)ut(n,r)&&(t[r]=e(n[r]));return t}function dm(n,e){for(var t in e)ut(e,t)&&(n[t]=e[t]);return n}function Ca(n,e){var t,r,i;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(r=0,i=n.length;r<i;r++)if(!Ca(n[r],e[r]))return!1;return!0}else{if(typeof n=="function")return n===e;if(n instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in n)if(!(t in e)||!Ca(n[t],e[t]))return!1;for(t in e)if(!(t in n))return!1;return!0}else return n===e}}function TN(n,e,t){var r=!0,i;Object.defineProperty(n,e,{get:function(){return r&&(i=t(),r=!1),i},set:function(o){i=o,r=!1},configurable:!0,enumerable:!0})}function ut(n,e){return n&&Object.hasOwnProperty.call(n,e)}function CN(n,e){for(var t={},r=0;r<e.length;r++){var i=e[r],a=n[i];a!==void 0&&(t[i]=a)}return t}var FN=["Matrix","Array"],IN=["number","BigNumber","Fraction"];var Ue=function(e){if(e)throw new Error(`The global config is readonly. 
Please create a mathjs instance if you want to change the default configuration. 
Example:

  import { create, all } from 'mathjs';
  const mathjs = create(all);
  mathjs.config({ number: 'BigNumber' });
`);return Object.freeze(Ov)};zr(Ue,Ov,{MATRIX_OPTIONS:FN,NUMBER_OPTIONS:IN});var Qv=wr(Vv(),1);function nt(n){return typeof n=="boolean"?!0:isFinite(n)?n===Math.round(n):!1}var ua=Math.sign||function(n){return n>0?1:n<0?-1:0},BN=Math.log2||function(e){return Math.log(e)/Math.LN2},ON=Math.log10||function(e){return Math.log(e)/Math.LN10},hm=Math.log1p||function(n){return Math.log(n+1)},RN=Math.cbrt||function(e){if(e===0)return e;var t=e<0,r;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},LN=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Uv(n,e,t){var r={2:"0b",8:"0o",16:"0x"},i=r[e],a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!nt(t))throw new Error("size must be an integer");if(n>2**(t-1)-1||n<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!nt(n))throw new Error("Value must be an integer");n<0&&(n=n+2**t),a="i".concat(t)}var o="";return n<0&&(n=-n,o="-"),"".concat(o).concat(i).concat(n.toString(e)).concat(a)}function Fa(n,e){if(typeof e=="function")return e(n);if(n===1/0)return"Infinity";if(n===-1/0)return"-Infinity";if(isNaN(n))return"NaN";var{notation:t,precision:r,wordSize:i}=qv(e);switch(t){case"fixed":return zv(n,r);case"exponential":return VN(n,r);case"engineering":return RH(n,r);case"bin":return Uv(n,2,i);case"oct":return Uv(n,8,i);case"hex":return Uv(n,16,i);case"auto":return LH(n,r,e).replace(/((\.\d*?)(0+))($|e)/,function(){var a=arguments[2],o=arguments[4];return a!=="."?a+o:o});default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function qv(n){var e="auto",t,r;if(n!==void 0)if(At(n))t=n;else if(pt(n))t=n.toNumber();else if(ns(n))n.precision!==void 0&&(t=PN(n.precision,()=>{throw new Error('Option "precision" must be a number or BigNumber')})),n.wordSize!==void 0&&(r=PN(n.wordSize,()=>{throw new Error('Option "wordSize" must be a number or BigNumber')})),n.notation&&(e=n.notation);else throw new Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:e,precision:t,wordSize:r}}function ol(n){var e=String(n).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+n);var t=e[1],r=e[2],i=parseFloat(e[4]||"0"),a=r.indexOf(".");i+=a!==-1?a-1:r.length-1;var o=r.replace(".","").replace(/^0*/,function(u){return i-=u.length,""}).replace(/0*$/,"").split("").map(function(u){return parseInt(u)});return o.length===0&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function RH(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=ol(n),r=gm(t,e),i=r.exponent,a=r.coefficients,o=i%3===0?i:i<0?i-3-i%3:i-i%3;if(At(e))for(;e>a.length||i-o+1>a.length;)a.push(0);else for(var u=Math.abs(i-o)-(a.length-1),s=0;s<u;s++)a.push(0);for(var l=Math.abs(i-o),c=1;l>0;)c++,l--;var f=a.slice(c).join(""),p=At(e)&&f.length||f.match(/[1-9]/)?"."+f:"",m=a.slice(0,c).join("")+p+"e"+(i>=0?"+":"")+o.toString();return r.sign+m}function zv(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=ol(n),r=typeof e=="number"?gm(t,t.exponent+1+e):t,i=r.coefficients,a=r.exponent+1,o=a+(e||0);return i.length<o&&(i=i.concat(al(o-i.length))),a<0&&(i=al(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,a===0?"0.":"."),r.sign+i.join("")}function VN(n,e){if(isNaN(n)||!isFinite(n))return String(n);var t=ol(n),r=e?gm(t,e):t,i=r.coefficients,a=r.exponent;i.length<e&&(i=i.concat(al(e-i.length)));var o=i.shift();return r.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function LH(n,e,t){if(isNaN(n)||!isFinite(n))return String(n);var r=kN(t?.lowerExp,-3),i=kN(t?.upperExp,5),a=ol(n),o=e?gm(a,e):a;if(o.exponent<r||o.exponent>=i)return VN(n,e);var u=o.coefficients,s=o.exponent;u.length<e&&(u=u.concat(al(e-u.length))),u=u.concat(al(s-u.length+1+(u.length<e?e-u.length:0))),u=al(-s).concat(u);var l=s>0?s:0;return l<u.length-1&&u.splice(l+1,0,"."),o.sign+u.join("")}function gm(n,e){for(var t={sign:n.sign,coefficients:n.coefficients,exponent:n.exponent},r=t.coefficients;e<=0;)r.unshift(0),t.exponent++,e++;if(r.length>e){var i=r.splice(e,r.length-e);if(i[0]>=5){var a=e-1;for(r[a]++;r[a]===10;)r.pop(),a===0&&(r.unshift(0),t.exponent++,a++),a--,r[a]++}}return t}function al(n){for(var e=[],t=0;t<n;t++)e.push(0);return e}function UN(n){return n.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var VH=Number.EPSILON||2220446049250313e-31;function Jr(n,e,t){if(t==null)return n===e;if(n===e)return!0;if(isNaN(n)||isNaN(e))return!1;if(isFinite(n)&&isFinite(e)){var r=Math.abs(n-e);return r<=VH?!0:r<=Math.max(Math.abs(n),Math.abs(e))*t}return!1}var qN=Math.acosh||function(n){return Math.log(Math.sqrt(n*n-1)+n)},zN=Math.asinh||function(n){return Math.log(Math.sqrt(n*n+1)+n)},$N=Math.atanh||function(n){return Math.log((1+n)/(1-n))/2},vm=Math.cosh||function(n){return(Math.exp(n)+Math.exp(-n))/2},HN=Math.sinh||function(n){return(Math.exp(n)-Math.exp(-n))/2},ym=Math.tanh||function(n){var e=Math.exp(2*n);return(e-1)/(e+1)};function GN(n,e){var t=n>0?!0:n<0?!1:1/n===1/0,r=e>0?!0:e<0?!1:1/e===1/0;return t^r?-n:n}function PN(n,e){if(At(n))return n;if(pt(n))return n.toNumber();e()}function kN(n,e){return At(n)?n:pt(n)?n.toNumber():e}function $v(n,e,t){var r=n.constructor,i=new r(2),a="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!nt(t))throw new Error("size must be an integer");if(n.greaterThan(i.pow(t-1).sub(1))||n.lessThan(i.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!n.isInteger())throw new Error("Value must be an integer");n.lessThan(0)&&(n=n.add(i.pow(t))),a="i".concat(t)}switch(e){case 2:return"".concat(n.toBinary()).concat(a);case 8:return"".concat(n.toOctal()).concat(a);case 16:return"".concat(n.toHexadecimal()).concat(a);default:throw new Error("Base ".concat(e," not supported "))}}function jN(n,e){if(typeof e=="function")return e(n);if(!n.isFinite())return n.isNaN()?"NaN":n.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:r,wordSize:i}=qv(e);switch(t){case"fixed":return qH(n,r);case"exponential":return WN(n,r);case"engineering":return UH(n,r);case"bin":return $v(n,2,i);case"oct":return $v(n,8,i);case"hex":return $v(n,16,i);case"auto":{var a=YN(e?.lowerExp,-3),o=YN(e?.upperExp,5);if(n.isZero())return"0";var u,s=n.toSignificantDigits(r),l=s.e;return l>=a&&l<o?u=s.toFixed():u=WN(n,r),u.replace(/((\.\d*?)(0+))($|e)/,function(){var c=arguments[2],f=arguments[4];return c!=="."?c+f:f})}default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function UH(n,e){var t=n.e,r=t%3===0?t:t<0?t-3-t%3:t-t%3,i=n.mul(Math.pow(10,-r)),a=i.toPrecision(e);if(a.indexOf("e")!==-1){var o=n.constructor;a=new o(a).toFixed()}return a+"e"+(t>=0?"+":"")+r.toString()}function WN(n,e){return e!==void 0?n.toExponential(e-1):n.toExponential()}function qH(n,e){return n.toFixed(e)}function YN(n,e){return At(n)?n:pt(n)?n.toNumber():e}function JN(n,e){var t=n.length-e.length,r=n.length;return n.substring(t,r)===e}function Mt(n,e){var t=zH(n,e);return e&&typeof e=="object"&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function zH(n,e){if(typeof n=="number")return Fa(n,e);if(pt(n))return jN(n,e);if($H(n))return!e||e.fraction!=="decimal"?n.s*n.n+"/"+n.d:n.toString();if(Array.isArray(n))return XN(n,e);if(rn(n))return Qs(n);if(typeof n=="function")return n.syntax?String(n.syntax):"function";if(n&&typeof n=="object"){if(typeof n.format=="function")return n.format(e);if(n&&n.toString(e)!=={}.toString())return n.toString(e);var t=Object.keys(n).map(r=>Qs(r)+": "+Mt(n[r],e));return"{"+t.join(", ")+"}"}return String(n)}function Qs(n){for(var e=String(n),t="",r=0;r<e.length;){var i=e.charAt(r);t+=i in ZN?ZN[i]:i,r++}return'"'+t+'"'}var ZN={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t"};function Cn(n){var e=String(n);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e}function XN(n,e){if(Array.isArray(n)){for(var t="[",r=n.length,i=0;i<r;i++)i!==0&&(t+=", "),t+=XN(n[i],e);return t+="]",t}else return Mt(n,e)}function $H(n){return n&&typeof n=="object"&&typeof n.s=="number"&&typeof n.n=="number"&&typeof n.d=="number"||!1}function bm(n,e){if(!rn(n))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Kt(n)+", index: 0)");if(!rn(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Kt(e)+", index: 1)");return n===e?0:n>e?1:-1}function Dt(n,e,t){if(!(this instanceof Dt))throw new SyntaxError("Constructor must be called with the new operator");this.actual=n,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(n)?"["+n.join(", ")+"]":n)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=new Error().stack}Dt.prototype=new RangeError;Dt.prototype.constructor=RangeError;Dt.prototype.name="DimensionError";Dt.prototype.isDimensionError=!0;function $n(n,e,t){if(!(this instanceof $n))throw new SyntaxError("Constructor must be called with the new operator");this.index=n,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),this.min!==void 0&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":this.max!==void 0&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=new Error().stack}$n.prototype=new RangeError;$n.prototype.constructor=RangeError;$n.prototype.name="IndexError";$n.prototype.isIndexError=!0;function _t(n){for(var e=[];Array.isArray(n);)e.push(n.length),n=n[0];return e}function QN(n,e,t){var r,i=n.length;if(i!==e[t])throw new Dt(i,e[t]);if(t<e.length-1){var a=t+1;for(r=0;r<i;r++){var o=n[r];if(!Array.isArray(o))throw new Dt(e.length-1,e.length,"<");QN(n[r],e,a)}}else for(r=0;r<i;r++)if(Array.isArray(n[r]))throw new Dt(e.length+1,e.length,">")}function Gv(n,e){var t=e.length===0;if(t){if(Array.isArray(n))throw new Dt(n.length,0)}else QN(n,e,0)}function _c(n,e){var t=n.isMatrix?n._size:_t(n),r=e._sourceSize;r.forEach((i,a)=>{if(i!==null&&i!==t[a])throw new Dt(i,t[a])})}function br(n,e){if(n!==void 0){if(!At(n)||!nt(n))throw new TypeError("Index must be an integer (value: "+n+")");if(n<0||typeof e=="number"&&n>=e)throw new $n(n,e)}}function Ks(n){for(var e=0;e<n._dimensions.length;++e){var t=n._dimensions[e];if(t._data&&nr(t._data)){if(t._size[0]===0)return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(rn(t)&&t.length===0)return!0}return!1}function Ia(n,e,t){if(!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Error("Resizing to scalar is not supported");e.forEach(function(i){if(!At(i)||!nt(i)||i<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(e)+")")}),(At(n)||pt(n))&&(n=[n]);var r=t!==void 0?t:0;return Hv(n,e,0,r),n}function Hv(n,e,t,r){var i,a,o=n.length,u=e[t],s=Math.min(o,u);if(n.length=u,t<e.length-1){var l=t+1;for(i=0;i<s;i++)a=n[i],Array.isArray(a)||(a=[a],n[i]=a),Hv(a,e,l,r);for(i=s;i<u;i++)a=[],n[i]=a,Hv(a,e,l,r)}else{for(i=0;i<s;i++)for(;Array.isArray(n[i]);)n[i]=n[i][0];for(i=s;i<u;i++)n[i]=r}}function Sc(n,e){var t=kt(n),r=t.length;if(!Array.isArray(n)||!Array.isArray(e))throw new TypeError("Array expected");if(e.length===0)throw new Dt(0,r,"!=");e=Ac(e,r);var i=KN(e);if(r!==i)throw new Dt(i,r,"!=");try{return HH(t,e)}catch(a){throw a instanceof Dt?new Dt(i,r,"!="):a}}function Ac(n,e){var t=KN(n),r=n.slice(),i=-1,a=n.indexOf(i),o=n.indexOf(i,a+1)>=0;if(o)throw new Error("More than one wildcard in sizes");var u=a>=0,s=e%t===0;if(u)if(s)r[a]=-e/t;else throw new Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return r}function KN(n){return n.reduce((e,t)=>e*t,1)}function HH(n,e){for(var t=n,r,i=e.length-1;i>0;i--){var a=e[i];r=[];for(var o=t.length/a,u=0;u<o;u++)r.push(t.slice(u*a,(u+1)*a));t=r}return t}function sl(n,e){for(var t=e||_t(n);Array.isArray(n)&&n.length===1;)n=n[0],t.shift();for(var r=t.length;t[r-1]===1;)r--;return r<t.length&&(n=eT(n,r,0),t.length=r),n}function eT(n,e,t){var r,i;if(t<e){var a=t+1;for(r=0,i=n.length;r<i;r++)n[r]=eT(n[r],e,a)}else for(;Array.isArray(n);)n=n[0];return n}function xm(n,e,t,r){var i=r||_t(n);if(t)for(var a=0;a<t;a++)n=[n],i.unshift(1);for(n=tT(n,e,0);i.length<e;)i.push(1);return n}function tT(n,e,t){var r,i;if(Array.isArray(n)){var a=t+1;for(r=0,i=n.length;r<i;r++)n[r]=tT(n[r],e,a)}else for(var o=t;o<e;o++)n=[n];return n}function kt(n){if(!Array.isArray(n))return n;var e=[];return n.forEach(function t(r){Array.isArray(r)?r.forEach(t):e.push(r)}),e}function Ei(n,e){return Array.prototype.map.call(n,e)}function as(n,e){Array.prototype.forEach.call(n,e)}function wm(n,e){if(_t(n).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(n,e)}function ul(n,e){if(_t(n).length!==1)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(n,t=>e.test(t))}function Wv(n,e){return Array.prototype.join.call(n,e)}function Mo(n){if(!Array.isArray(n))throw new TypeError("Array input expected");if(n.length===0)return n;var e=[],t=0;e[0]={value:n[0],identifier:0};for(var r=1;r<n.length;r++)n[r]===n[r-1]?t++:t=0,e.push({value:n[r],identifier:t});return e}function ll(n){if(!Array.isArray(n))throw new TypeError("Array input expected");if(n.length===0)return n;for(var e=[],t=0;t<n.length;t++)e.push(n[t].value);return e}function os(n,e){for(var t,r=0,i=0;i<n.length;i++){var a=n[i],o=Array.isArray(a);if(i===0&&o&&(r=a.length),o&&a.length!==r)return;var u=o?os(a,e):e(a);if(t===void 0)t=u;else if(t!==u)return"mixed"}return t}function rT(n,e,t,r){if(r<t){if(n.length!==e.length)throw new Dt(n.length,e.length);for(var i=[],a=0;a<n.length;a++)i[a]=rT(n[a],e[a],t,r+1);return i}else return n.concat(e)}function Yv(){var n=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(n.length===1)return n[0];if(n.length>1)return n.slice(1).reduce(function(t,r){return rT(t,r,e,0)},n[0]);throw new Error("Wrong number of arguments in function concat")}function GH(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];for(var r=e.map(p=>p.length),i=Math.max(...r),a=new Array(i).fill(null),o=0;o<e.length;o++)for(var u=e[o],s=r[o],l=0;l<s;l++){var c=i-s+l;u[l]>a[c]&&(a[c]=u[l])}for(var f=0;f<e.length;f++)Mc(e[f],a);return a}function Mc(n,e){for(var t=e.length,r=n.length,i=0;i<r;i++){var a=t-r+i;if(n[i]<e[a]&&n[i]>1||n[i]>e[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(n,") not possible to broadcast dimension ").concat(r," with size ").concat(n[i]," to size ").concat(e[a]))}}function jv(n,e){var t=_t(n);if(Ca(t,e))return n;Mc(t,e);var r=GH(t,e),i=r.length,a=[...Array(i-t.length).fill(1),...t],o=YH(n);t.length<i&&(o=Sc(o,a),t=_t(o));for(var u=0;u<i;u++)t[u]<r[u]&&(o=WH(o,r[u],u),t=_t(o));return o}function WH(n,e,t){return Yv(...Array(e).fill(n),t)}function YH(n){return zr([],n)}function T(n,e,t,r){function i(a){var o=CN(a,e.map(JH));return jH(n,e,a),t(o)}return i.isFactory=!0,i.fn=n,i.dependencies=e.slice().sort(),r&&(i.meta=r),i}function jH(n,e,t){var r=e.filter(a=>!ZH(a)).every(a=>t[a]!==void 0);if(!r){var i=e.filter(a=>t[a]===void 0);throw new Error('Cannot create function "'.concat(n,'", ')+"some dependencies are missing: ".concat(i.map(a=>'"'.concat(a,'"')).join(", "),"."))}}function ZH(n){return n&&n[0]==="?"}function JH(n){return n&&n[0]==="?"?n.slice(1):n}function $r(n,e){if(oT(n)&&iT(n,e))return n[e];throw typeof n[e]=="function"&&_m(n,e)?new Error('Cannot access method "'+e+'" as a property'):new Error('No access to property "'+e+'"')}function Za(n,e,t){if(oT(n)&&iT(n,e))return n[e]=t,t;throw new Error('No access to property "'+e+'"')}function nT(n,e){return e in n}function iT(n,e){return!n||typeof n!="object"?!1:ut(XH,e)?!0:!(e in Object.prototype||e in Function.prototype)}function aT(n,e){if(!_m(n,e))throw new Error('No access to method "'+e+'"');return n[e]}function _m(n,e){return n==null||typeof n[e]!="function"||ut(n,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(n)?!1:ut(QH,e)?!0:!(e in Object.prototype||e in Function.prototype)}function oT(n){return typeof n=="object"&&n&&n.constructor===Object}var XH={length:!0,name:!0},QH={toString:!0,valueOf:!0,toLocaleString:!0};var eu=class{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return $r(this.wrappedObject,e)}set(e,t){return Za(this.wrappedObject,e,t),this}has(e){return nT(this.wrappedObject,e)}entries(){return sT(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}},cl=class{constructor(e,t,r){this.a=e,this.b=t,this.bKeys=r,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return sT(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}};function sT(n,e){return{next:()=>{var t=n.next();return t.done?t:{value:e(t.value),done:!1}}}}function ss(){return new Map}function Eo(n){if(!n)return ss();if(Zv(n))return n;if(ns(n))return new eu(n);throw new Error("createMap can create maps from objects or Maps")}function uT(n){if(n instanceof eu)return n.wrappedObject;var e={};for(var t of n.keys()){var r=n.get(t);Za(e,t,r)}return e}function Zv(n){return n?n instanceof Map||n instanceof eu||typeof n.set=="function"&&typeof n.get=="function"&&typeof n.keys=="function"&&typeof n.has=="function":!1}var lT=function(){return lT=Qv.default.create,Qv.default},KH=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],Kv=T("typed",KH,function(e){var{BigNumber:t,Complex:r,DenseMatrix:i,Fraction:a}=e,o=lT();return o.clear(),o.addTypes([{name:"number",test:At},{name:"Complex",test:gi},{name:"BigNumber",test:pt},{name:"Fraction",test:Ao},{name:"Unit",test:Un},{name:"identifier",test:u=>rn&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(u)},{name:"string",test:rn},{name:"Chain",test:mm},{name:"Array",test:nr},{name:"Matrix",test:ot},{name:"DenseMatrix",test:Xs},{name:"SparseMatrix",test:Ta},{name:"Range",test:il},{name:"Index",test:rs},{name:"boolean",test:vN},{name:"ResultSet",test:yN},{name:"Help",test:pm},{name:"function",test:bN},{name:"Date",test:xN},{name:"RegExp",test:wN},{name:"null",test:_N},{name:"undefined",test:SN},{name:"AccessorNode",test:$i},{name:"ArrayNode",test:qn},{name:"AssignmentNode",test:AN},{name:"BlockNode",test:MN},{name:"ConditionalNode",test:EN},{name:"ConstantNode",test:zt},{name:"FunctionNode",test:vi},{name:"FunctionAssignmentNode",test:ja},{name:"IndexNode",test:sa},{name:"Node",test:jt},{name:"ObjectNode",test:is},{name:"OperatorNode",test:Vr},{name:"ParenthesisNode",test:zn},{name:"RangeNode",test:DN},{name:"RelationalNode",test:NN},{name:"SymbolNode",test:Fr},{name:"Map",test:Zv},{name:"Object",test:ns}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(s){if(t||Jv(s),UN(s)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+s+"). Use function bignumber(x) to convert to BigNumber.");return new t(s)}},{from:"number",to:"Complex",convert:function(s){return r||Sm(s),new r(s,0)}},{from:"BigNumber",to:"Complex",convert:function(s){return r||Sm(s),new r(s.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(s){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(s){return r||Sm(s),new r(s.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(s){a||Xv(s);var l=new a(s);if(l.valueOf()!==s)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+s+"). Use function fraction(x) to convert to Fraction.");return l}},{from:"string",to:"number",convert:function(s){var l=Number(s);if(isNaN(l))throw new Error('Cannot convert "'+s+'" to a number');return l}},{from:"string",to:"BigNumber",convert:function(s){t||Jv(s);try{return new t(s)}catch{throw new Error('Cannot convert "'+s+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(s){a||Xv(s);try{return new a(s)}catch{throw new Error('Cannot convert "'+s+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(s){r||Sm(s);try{return new r(s)}catch{throw new Error('Cannot convert "'+s+'" to Complex')}}},{from:"boolean",to:"number",convert:function(s){return+s}},{from:"boolean",to:"BigNumber",convert:function(s){return t||Jv(s),new t(+s)}},{from:"boolean",to:"Fraction",convert:function(s){return a||Xv(s),new a(+s)}},{from:"boolean",to:"string",convert:function(s){return String(s)}},{from:"Array",to:"Matrix",convert:function(s){return i||eG(),new i(s)}},{from:"Matrix",to:"Array",convert:function(s){return s.valueOf()}}]),o.onMismatch=(u,s,l)=>{var c=o.createError(u,s,l);if(["wrongType","mismatch"].includes(c.data.category)&&s.length===1&&ln(s[0])&&l.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=c.data,f}throw c},o.onMismatch=(u,s,l)=>{var c=o.createError(u,s,l);if(["wrongType","mismatch"].includes(c.data.category)&&s.length===1&&ln(s[0])&&l.some(p=>!p.params.includes(","))){var f=new TypeError("Function '".concat(u,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(u,")'."));throw f.data=c.data,f}throw c},o});function Jv(n){throw new Error("Cannot convert value ".concat(n," into a BigNumber: no class 'BigNumber' provided"))}function Sm(n){throw new Error("Cannot convert value ".concat(n," into a Complex number: no class 'Complex' provided"))}function eG(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}function Xv(n){throw new Error("Cannot convert value ".concat(n," into a Fraction, no class 'Fraction' provided."))}var tG="ResultSet",rG=[],ey=T(tG,rG,()=>{function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return n.prototype.type="ResultSet",n.prototype.isResultSet=!0,n.prototype.valueOf=function(){return this.entries},n.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},n.fromJSON=function(e){return new n(e.entries)},n},{isClass:!0});var fl=9e15,fs=1e9,ty="0123456789abcdef",Mm="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Em="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ry={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-fl,maxE:fl,crypto:!1},mT,Do,Zt=!0,Nm="[DecimalError] ",cs=Nm+"Invalid argument: ",dT=Nm+"Precision limit exceeded",hT=Nm+"crypto unavailable",gT="[object Decimal]",ei=Math.floor,Fn=Math.pow,nG=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,iG=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aG=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,vT=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ka=1e7,Ot=7,oG=9007199254740991,sG=Mm.length-1,ny=Em.length-1,Je={toStringTag:gT};Je.absoluteValue=Je.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Tt(n)};Je.ceil=function(){return Tt(new this.constructor(this),this.e+1,2)};Je.clampedTo=Je.clamp=function(n,e){var t,r=this,i=r.constructor;if(n=new i(n),e=new i(e),!n.s||!e.s)return new i(NaN);if(n.gt(e))throw Error(cs+e);return t=r.cmp(n),t<0?n:r.cmp(e)>0?e:new i(r)};Je.comparedTo=Je.cmp=function(n){var e,t,r,i,a=this,o=a.d,u=(n=new a.constructor(n)).d,s=a.s,l=n.s;if(!o||!u)return!s||!l?NaN:s!==l?s:o===u?0:!o^s<0?1:-1;if(!o[0]||!u[0])return o[0]?s:u[0]?-l:0;if(s!==l)return s;if(a.e!==n.e)return a.e>n.e^s<0?1:-1;for(r=o.length,i=u.length,e=0,t=r<i?r:i;e<t;++e)if(o[e]!==u[e])return o[e]>u[e]^s<0?1:-1;return r===i?0:r>i^s<0?1:-1};Je.cosine=Je.cos=function(){var n,e,t=this,r=t.constructor;return t.d?t.d[0]?(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+Ot,r.rounding=1,t=uG(r,_T(r,t)),r.precision=n,r.rounding=e,Tt(Do==2||Do==3?t.neg():t,n,e,!0)):new r(1):new r(NaN)};Je.cubeRoot=Je.cbrt=function(){var n,e,t,r,i,a,o,u,s,l,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(Zt=!1,a=c.s*Fn(c.s*c,1/3),!a||Math.abs(a)==1/0?(t=Hn(c.d),n=c.e,(a=(n-t.length+1)%3)&&(t+=a==1||a==-2?"0":"00"),a=Fn(t,1/3),n=ei((n+1)/3)-(n%3==(n<0?-1:2)),a==1/0?t="5e"+n:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+n),r=new f(t),r.s=c.s):r=new f(a.toString()),o=(n=f.precision)+3;;)if(u=r,s=u.times(u).times(u),l=s.plus(c),r=Hr(l.plus(c).times(u),l.plus(s),o+2,1),Hn(u.d).slice(0,o)===(t=Hn(r.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(Tt(u,n+1,0),u.times(u).times(u).eq(c))){r=u;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Tt(r,n+1,1),e=!r.times(r).times(r).eq(c));break}return Zt=!0,Tt(r,n,f.rounding,e)};Je.decimalPlaces=Je.dp=function(){var n,e=this.d,t=NaN;if(e){if(n=e.length-1,t=(n-ei(this.e/Ot))*Ot,n=e[n],n)for(;n%10==0;n/=10)t--;t<0&&(t=0)}return t};Je.dividedBy=Je.div=function(n){return Hr(this,new this.constructor(n))};Je.dividedToIntegerBy=Je.divToInt=function(n){var e=this,t=e.constructor;return Tt(Hr(e,new t(n),0,1,1),t.precision,t.rounding)};Je.equals=Je.eq=function(n){return this.cmp(n)===0};Je.floor=function(){return Tt(new this.constructor(this),this.e+1,3)};Je.greaterThan=Je.gt=function(n){return this.cmp(n)>0};Je.greaterThanOrEqualTo=Je.gte=function(n){var e=this.cmp(n);return e==1||e===0};Je.hyperbolicCosine=Je.cosh=function(){var n,e,t,r,i,a=this,o=a.constructor,u=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return u;t=o.precision,r=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(n=Math.ceil(i/3),e=(1/Cm(4,n)).toString()):(n=16,e="2.3283064365386962890625e-10"),a=pl(o,1,a.times(e),new o(1),!0);for(var s,l=n,c=new o(8);l--;)s=a.times(a),a=u.minus(s.times(c.minus(s.times(c))));return Tt(a,o.precision=t,o.rounding=r,!0)};Je.hyperbolicSine=Je.sinh=function(){var n,e,t,r,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,t=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,r=i.d.length,r<3)i=pl(a,2,i,i,!0);else{n=1.4*Math.sqrt(r),n=n>16?16:n|0,i=i.times(1/Cm(5,n)),i=pl(a,2,i,i,!0);for(var o,u=new a(5),s=new a(16),l=new a(20);n--;)o=i.times(i),i=i.times(u.plus(o.times(s.times(o).plus(l))))}return a.precision=e,a.rounding=t,Tt(i,e,t,!0)};Je.hyperbolicTangent=Je.tanh=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+7,r.rounding=1,Hr(t.sinh(),t.cosh(),r.precision=n,r.rounding=e)):new r(t.s)};Je.inverseCosine=Je.acos=function(){var n,e=this,t=e.constructor,r=e.abs().cmp(1),i=t.precision,a=t.rounding;return r!==-1?r===0?e.isNeg()?Pa(t,i,a):new t(0):new t(NaN):e.isZero()?Pa(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),n=Pa(t,i+4,a).times(.5),t.precision=i,t.rounding=a,n.minus(e))};Je.inverseHyperbolicCosine=Je.acosh=function(){var n,e,t=this,r=t.constructor;return t.lte(1)?new r(t.eq(1)?0:NaN):t.isFinite()?(n=r.precision,e=r.rounding,r.precision=n+Math.max(Math.abs(t.e),t.sd())+4,r.rounding=1,Zt=!1,t=t.times(t).minus(1).sqrt().plus(t),Zt=!0,r.precision=n,r.rounding=e,t.ln()):new r(t)};Je.inverseHyperbolicSine=Je.asinh=function(){var n,e,t=this,r=t.constructor;return!t.isFinite()||t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+2*Math.max(Math.abs(t.e),t.sd())+6,r.rounding=1,Zt=!1,t=t.times(t).plus(1).sqrt().plus(t),Zt=!0,r.precision=n,r.rounding=e,t.ln())};Je.inverseHyperbolicTangent=Je.atanh=function(){var n,e,t,r,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(n=a.precision,e=a.rounding,r=i.sd(),Math.max(r,n)<2*-i.e-1?Tt(new a(i),n,e,!0):(a.precision=t=r-i.e,i=Hr(i.plus(1),new a(1).minus(i),t+n,1),a.precision=n+4,a.rounding=1,i=i.ln(),a.precision=n,a.rounding=e,i.times(.5))):new a(NaN)};Je.inverseSine=Je.asin=function(){var n,e,t,r,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),t=a.precision,r=a.rounding,e!==-1?e===0?(n=Pa(a,t+4,r).times(.5),n.s=i.s,n):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=r,i.times(2)))};Je.inverseTangent=Je.atan=function(){var n,e,t,r,i,a,o,u,s,l=this,c=l.constructor,f=c.precision,p=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);if(l.abs().eq(1)&&f+4<=ny)return o=Pa(c,f+4,p).times(.25),o.s=l.s,o}else{if(!l.s)return new c(NaN);if(f+4<=ny)return o=Pa(c,f+4,p).times(.5),o.s=l.s,o}for(c.precision=u=f+10,c.rounding=1,t=Math.min(28,u/Ot+2|0),n=t;n;--n)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(Zt=!1,e=Math.ceil(u/Ot),r=1,s=l.times(l),o=new c(l),i=l;n!==-1;)if(i=i.times(s),a=o.minus(i.div(r+=2)),i=i.times(s),o=a.plus(i.div(r+=2)),o.d[e]!==void 0)for(n=e;o.d[n]===a.d[n]&&n--;);return t&&(o=o.times(2<<t-1)),Zt=!0,Tt(o,c.precision=f,c.rounding=p,!0)};Je.isFinite=function(){return!!this.d};Je.isInteger=Je.isInt=function(){return!!this.d&&ei(this.e/Ot)>this.d.length-2};Je.isNaN=function(){return!this.s};Je.isNegative=Je.isNeg=function(){return this.s<0};Je.isPositive=Je.isPos=function(){return this.s>0};Je.isZero=function(){return!!this.d&&this.d[0]===0};Je.lessThan=Je.lt=function(n){return this.cmp(n)<0};Je.lessThanOrEqualTo=Je.lte=function(n){return this.cmp(n)<1};Je.logarithm=Je.log=function(n){var e,t,r,i,a,o,u,s,l=this,c=l.constructor,f=c.precision,p=c.rounding,m=5;if(n==null)n=new c(10),e=!0;else{if(n=new c(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new c(NaN);e=n.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new c(t&&!t[0]?-1/0:l.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)a=!0;else{for(i=t[0];i%10===0;)i/=10;a=i!==1}if(Zt=!1,u=f+m,o=ls(l,u),r=e?Dm(c,u+10):ls(n,u),s=Hr(o,r,u,1),Ec(s.d,i=f,p))do if(u+=10,o=ls(l,u),r=e?Dm(c,u+10):ls(n,u),s=Hr(o,r,u,1),!a){+Hn(s.d).slice(i+1,i+15)+1==1e14&&(s=Tt(s,f+1,0));break}while(Ec(s.d,i+=10,p));return Zt=!0,Tt(s,f,p)};Je.minus=Je.sub=function(n){var e,t,r,i,a,o,u,s,l,c,f,p,m=this,h=m.constructor;if(n=new h(n),!m.d||!n.d)return!m.s||!n.s?n=new h(NaN):m.d?n.s=-n.s:n=new h(n.d||m.s!==n.s?m:NaN),n;if(m.s!=n.s)return n.s=-n.s,m.plus(n);if(l=m.d,p=n.d,u=h.precision,s=h.rounding,!l[0]||!p[0]){if(p[0])n.s=-n.s;else if(l[0])n=new h(m);else return new h(s===3?-0:0);return Zt?Tt(n,u,s):n}if(t=ei(n.e/Ot),c=ei(m.e/Ot),l=l.slice(),a=c-t,a){for(f=a<0,f?(e=l,a=-a,o=p.length):(e=p,t=c,o=l.length),r=Math.max(Math.ceil(u/Ot),o)+2,a>r&&(a=r,e.length=1),e.reverse(),r=a;r--;)e.push(0);e.reverse()}else{for(r=l.length,o=p.length,f=r<o,f&&(o=r),r=0;r<o;r++)if(l[r]!=p[r]){f=l[r]<p[r];break}a=0}for(f&&(e=l,l=p,p=e,n.s=-n.s),o=l.length,r=p.length-o;r>0;--r)l[o++]=0;for(r=p.length;r>a;){if(l[--r]<p[r]){for(i=r;i&&l[--i]===0;)l[i]=ka-1;--l[i],l[r]+=ka}l[r]-=p[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(n.d=l,n.e=Tm(l,t),Zt?Tt(n,u,s):n):new h(s===3?-0:0)};Je.modulo=Je.mod=function(n){var e,t=this,r=t.constructor;return n=new r(n),!t.d||!n.s||n.d&&!n.d[0]?new r(NaN):!n.d||t.d&&!t.d[0]?Tt(new r(t),r.precision,r.rounding):(Zt=!1,r.modulo==9?(e=Hr(t,n.abs(),0,3,1),e.s*=n.s):e=Hr(t,n,0,r.modulo,1),e=e.times(n),Zt=!0,t.minus(e))};Je.naturalExponential=Je.exp=function(){return iy(this)};Je.naturalLogarithm=Je.ln=function(){return ls(this)};Je.negated=Je.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Tt(n)};Je.plus=Je.add=function(n){var e,t,r,i,a,o,u,s,l,c,f=this,p=f.constructor;if(n=new p(n),!f.d||!n.d)return!f.s||!n.s?n=new p(NaN):f.d||(n=new p(n.d||f.s===n.s?f:NaN)),n;if(f.s!=n.s)return n.s=-n.s,f.minus(n);if(l=f.d,c=n.d,u=p.precision,s=p.rounding,!l[0]||!c[0])return c[0]||(n=new p(f)),Zt?Tt(n,u,s):n;if(a=ei(f.e/Ot),r=ei(n.e/Ot),l=l.slice(),i=a-r,i){for(i<0?(t=l,i=-i,o=c.length):(t=c,r=a,o=l.length),a=Math.ceil(u/Ot),o=a>o?a+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=l.length,i=c.length,o-i<0&&(i=o,t=c,c=l,l=t),e=0;i;)e=(l[--i]=l[i]+c[i]+e)/ka|0,l[i]%=ka;for(e&&(l.unshift(e),++r),o=l.length;l[--o]==0;)l.pop();return n.d=l,n.e=Tm(l,r),Zt?Tt(n,u,s):n};Je.precision=Je.sd=function(n){var e,t=this;if(n!==void 0&&n!==!!n&&n!==1&&n!==0)throw Error(cs+n);return t.d?(e=yT(t.d),n&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Je.round=function(){var n=this,e=n.constructor;return Tt(new e(n),n.e+1,e.rounding)};Je.sine=Je.sin=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+Ot,r.rounding=1,t=cG(r,_T(r,t)),r.precision=n,r.rounding=e,Tt(Do>2?t.neg():t,n,e,!0)):new r(NaN)};Je.squareRoot=Je.sqrt=function(){var n,e,t,r,i,a,o=this,u=o.d,s=o.e,l=o.s,c=o.constructor;if(l!==1||!u||!u[0])return new c(!l||l<0&&(!u||u[0])?NaN:u?o:1/0);for(Zt=!1,l=Math.sqrt(+o),l==0||l==1/0?(e=Hn(u),(e.length+s)%2==0&&(e+="0"),l=Math.sqrt(e),s=ei((s+1)/2)-(s<0||s%2),l==1/0?e="5e"+s:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+s),r=new c(e)):r=new c(l.toString()),t=(s=c.precision)+3;;)if(a=r,r=a.plus(Hr(o,a,t+2,1)).times(.5),Hn(a.d).slice(0,t)===(e=Hn(r.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(Tt(a,s+1,0),a.times(a).eq(o))){r=a;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(Tt(r,s+1,1),n=!r.times(r).eq(o));break}return Zt=!0,Tt(r,s,c.rounding,n)};Je.tangent=Je.tan=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+10,r.rounding=1,t=t.sin(),t.s=1,t=Hr(t,new r(1).minus(t.times(t)).sqrt(),n+10,0),r.precision=n,r.rounding=e,Tt(Do==2||Do==4?t.neg():t,n,e,!0)):new r(NaN)};Je.times=Je.mul=function(n){var e,t,r,i,a,o,u,s,l,c=this,f=c.constructor,p=c.d,m=(n=new f(n)).d;if(n.s*=c.s,!p||!p[0]||!m||!m[0])return new f(!n.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:!p||!m?n.s/0:n.s*0);for(t=ei(c.e/Ot)+ei(n.e/Ot),s=p.length,l=m.length,s<l&&(a=p,p=m,m=a,o=s,s=l,l=o),a=[],o=s+l,r=o;r--;)a.push(0);for(r=l;--r>=0;){for(e=0,i=s+r;i>r;)u=a[i]+m[r]*p[i-r-1]+e,a[i--]=u%ka|0,e=u/ka|0;a[i]=(a[i]+e)%ka|0}for(;!a[--o];)a.pop();return e?++t:a.shift(),n.d=a,n.e=Tm(a,t),Zt?Tt(n,f.precision,f.rounding):n};Je.toBinary=function(n,e){return oy(this,2,n,e)};Je.toDecimalPlaces=Je.toDP=function(n,e){var t=this,r=t.constructor;return t=new r(t),n===void 0?t:(Di(n,0,fs),e===void 0?e=r.rounding:Di(e,0,8),Tt(t,n+t.e+1,e))};Je.toExponential=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Ja(r,!0):(Di(n,0,fs),e===void 0?e=i.rounding:Di(e,0,8),r=Tt(new i(r),n+1,e),t=Ja(r,!0,n+1)),r.isNeg()&&!r.isZero()?"-"+t:t};Je.toFixed=function(n,e){var t,r,i=this,a=i.constructor;return n===void 0?t=Ja(i):(Di(n,0,fs),e===void 0?e=a.rounding:Di(e,0,8),r=Tt(new a(i),n+i.e+1,e),t=Ja(r,!1,n+r.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};Je.toFraction=function(n){var e,t,r,i,a,o,u,s,l,c,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(l=t=new d(1),r=s=new d(0),e=new d(r),a=e.e=yT(h)-m.e-1,o=a%Ot,e.d[0]=Fn(10,o<0?Ot+o:o),n==null)n=a>0?e:l;else{if(u=new d(n),!u.isInt()||u.lt(l))throw Error(cs+u);n=u.gt(e)?a>0?e:l:u}for(Zt=!1,u=new d(Hn(h)),c=d.precision,d.precision=a=h.length*Ot*2;f=Hr(u,e,0,1,1),i=t.plus(f.times(r)),i.cmp(n)!=1;)t=r,r=i,i=l,l=s.plus(f.times(i)),s=i,i=e,e=u.minus(f.times(i)),u=i;return i=Hr(n.minus(t),r,0,1,1),s=s.plus(i.times(l)),t=t.plus(i.times(r)),s.s=l.s=m.s,p=Hr(l,r,a,1).minus(m).abs().cmp(Hr(s,t,a,1).minus(m).abs())<1?[l,r]:[s,t],d.precision=c,Zt=!0,p};Je.toHexadecimal=Je.toHex=function(n,e){return oy(this,16,n,e)};Je.toNearest=function(n,e){var t=this,r=t.constructor;if(t=new r(t),n==null){if(!t.d)return t;n=new r(1),e=r.rounding}else{if(n=new r(n),e===void 0?e=r.rounding:Di(e,0,8),!t.d)return n.s?t:n;if(!n.d)return n.s&&(n.s=t.s),n}return n.d[0]?(Zt=!1,t=Hr(t,n,0,e,1).times(n),Zt=!0,Tt(t)):(n.s=t.s,t=n),t};Je.toNumber=function(){return+this};Je.toOctal=function(n,e){return oy(this,8,n,e)};Je.toPower=Je.pow=function(n){var e,t,r,i,a,o,u=this,s=u.constructor,l=+(n=new s(n));if(!u.d||!n.d||!u.d[0]||!n.d[0])return new s(Fn(+u,l));if(u=new s(u),u.eq(1))return u;if(r=s.precision,a=s.rounding,n.eq(1))return Tt(u,r,a);if(e=ei(n.e/Ot),e>=n.d.length-1&&(t=l<0?-l:l)<=oG)return i=bT(s,u,t,r),n.s<0?new s(1).div(i):Tt(i,r,a);if(o=u.s,o<0){if(e<n.d.length-1)return new s(NaN);if(n.d[e]&1||(o=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=o,u}return t=Fn(+u,l),e=t==0||!isFinite(t)?ei(l*(Math.log("0."+Hn(u.d))/Math.LN10+u.e+1)):new s(t+"").e,e>s.maxE+1||e<s.minE-1?new s(e>0?o/0:0):(Zt=!1,s.rounding=u.s=1,t=Math.min(12,(e+"").length),i=iy(n.times(ls(u,r+t)),r),i.d&&(i=Tt(i,r+5,1),Ec(i.d,r,a)&&(e=r+10,i=Tt(iy(n.times(ls(u,e+t)),e),e+5,1),+Hn(i.d).slice(r+1,r+15)+1==1e14&&(i=Tt(i,r+1,0)))),i.s=o,Zt=!0,s.rounding=a,Tt(i,r,a))};Je.toPrecision=function(n,e){var t,r=this,i=r.constructor;return n===void 0?t=Ja(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(Di(n,1,fs),e===void 0?e=i.rounding:Di(e,0,8),r=Tt(new i(r),n,e),t=Ja(r,n<=r.e||r.e<=i.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+t:t};Je.toSignificantDigits=Je.toSD=function(n,e){var t=this,r=t.constructor;return n===void 0?(n=r.precision,e=r.rounding):(Di(n,1,fs),e===void 0?e=r.rounding:Di(e,0,8)),Tt(new r(t),n,e)};Je.toString=function(){var n=this,e=n.constructor,t=Ja(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+t:t};Je.truncated=Je.trunc=function(){return Tt(new this.constructor(this),this.e+1,1)};Je.valueOf=Je.toJSON=function(){var n=this,e=n.constructor,t=Ja(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+t:t};function Hn(n){var e,t,r,i=n.length-1,a="",o=n[0];if(i>0){for(a+=o,e=1;e<i;e++)r=n[e]+"",t=Ot-r.length,t&&(a+=us(t)),a+=r;o=n[e],r=o+"",t=Ot-r.length,t&&(a+=us(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}function Di(n,e,t){if(n!==~~n||n<e||n>t)throw Error(cs+n)}function Ec(n,e,t,r){var i,a,o,u;for(a=n[0];a>=10;a/=10)--e;return--e<0?(e+=Ot,i=0):(i=Math.ceil((e+1)/Ot),e%=Ot),a=Fn(10,Ot-e),u=n[i]%a|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),o=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):o=(t<4&&u+1==a||t>3&&u+1==a/2)&&(n[i+1]/a/100|0)==Fn(10,e-2)-1||(u==a/2||u==0)&&(n[i+1]/a/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),o=(r||t<4)&&u==9999||!r&&t>3&&u==4999):o=((r||t<4)&&u+1==a||!r&&t>3&&u+1==a/2)&&(n[i+1]/a/1e3|0)==Fn(10,e-3)-1,o}function Am(n,e,t){for(var r,i=[0],a,o=0,u=n.length;o<u;){for(a=i.length;a--;)i[a]*=e;for(i[0]+=ty.indexOf(n.charAt(o++)),r=0;r<i.length;r++)i[r]>t-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/t|0,i[r]%=t)}return i.reverse()}function uG(n,e){var t,r,i;if(e.isZero())return e;r=e.d.length,r<32?(t=Math.ceil(r/3),i=(1/Cm(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),n.precision+=t,e=pl(n,1,e.times(i),new n(1));for(var a=t;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=t,e}var Hr=function(){function n(r,i,a){var o,u=0,s=r.length;for(r=r.slice();s--;)o=r[s]*i+u,r[s]=o%a|0,u=o/a|0;return u&&r.unshift(u),r}function e(r,i,a,o){var u,s;if(a!=o)s=a>o?1:-1;else for(u=s=0;u<a;u++)if(r[u]!=i[u]){s=r[u]>i[u]?1:-1;break}return s}function t(r,i,a,o){for(var u=0;a--;)r[a]-=u,u=r[a]<i[a]?1:0,r[a]=u*o+r[a]-i[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,a,o,u,s){var l,c,f,p,m,h,d,g,y,S,b,w,A,x,D,E,_,N,P,B,V=r.constructor,z=r.s==i.s?1:-1,L=r.d,k=i.d;if(!L||!L[0]||!k||!k[0])return new V(!r.s||!i.s||(L?k&&L[0]==k[0]:!k)?NaN:L&&L[0]==0||!k?z*0:z/0);for(s?(m=1,c=r.e-i.e):(s=ka,m=Ot,c=ei(r.e/m)-ei(i.e/m)),P=k.length,_=L.length,y=new V(z),S=y.d=[],f=0;k[f]==(L[f]||0);f++);if(k[f]>(L[f]||0)&&c--,a==null?(x=a=V.precision,o=V.rounding):u?x=a+(r.e-i.e)+1:x=a,x<0)S.push(1),h=!0;else{if(x=x/m+2|0,f=0,P==1){for(p=0,k=k[0],x++;(f<_||p)&&x--;f++)D=p*s+(L[f]||0),S[f]=D/k|0,p=D%k|0;h=p||f<_}else{for(p=s/(k[0]+1)|0,p>1&&(k=n(k,p,s),L=n(L,p,s),P=k.length,_=L.length),E=P,b=L.slice(0,P),w=b.length;w<P;)b[w++]=0;B=k.slice(),B.unshift(0),N=k[0],k[1]>=s/2&&++N;do p=0,l=e(k,b,P,w),l<0?(A=b[0],P!=w&&(A=A*s+(b[1]||0)),p=A/N|0,p>1?(p>=s&&(p=s-1),d=n(k,p,s),g=d.length,w=b.length,l=e(d,b,g,w),l==1&&(p--,t(d,P<g?B:k,g,s))):(p==0&&(l=p=1),d=k.slice()),g=d.length,g<w&&d.unshift(0),t(b,d,w,s),l==-1&&(w=b.length,l=e(k,b,P,w),l<1&&(p++,t(b,P<w?B:k,w,s))),w=b.length):l===0&&(p++,b=[0]),S[f++]=p,l&&b[0]?b[w++]=L[E]||0:(b=[L[E]],w=1);while((E++<_||b[0]!==void 0)&&x--);h=b[0]!==void 0}S[0]||S.shift()}if(m==1)y.e=c,mT=h;else{for(f=1,p=S[0];p>=10;p/=10)f++;y.e=f+c*m-1,Tt(y,u?a+y.e+1:a,o,h)}return y}}();function Tt(n,e,t,r){var i,a,o,u,s,l,c,f,p,m=n.constructor;e:if(e!=null){if(f=n.d,!f)return n;for(i=1,u=f[0];u>=10;u/=10)i++;if(a=e-i,a<0)a+=Ot,o=e,c=f[p=0],s=c/Fn(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Ot),u=f.length,p>=u)if(r){for(;u++<=p;)f.push(0);c=s=0,i=1,a%=Ot,o=a-Ot+1}else break e;else{for(c=u=f[p],i=1;u>=10;u/=10)i++;a%=Ot,o=a-Ot+i,s=o<0?0:c/Fn(10,i-o-1)%10|0}if(r=r||e<0||f[p+1]!==void 0||(o<0?c:c%Fn(10,i-o-1)),l=t<4?(s||r)&&(t==0||t==(n.s<0?3:2)):s>5||s==5&&(t==4||r||t==6&&(a>0?o>0?c/Fn(10,i-o):0:f[p-1])%10&1||t==(n.s<0?8:7)),e<1||!f[0])return f.length=0,l?(e-=n.e+1,f[0]=Fn(10,(Ot-e%Ot)%Ot),n.e=-e||0):f[0]=n.e=0,n;if(a==0?(f.length=p,u=1,p--):(f.length=p+1,u=Fn(10,Ot-a),f[p]=o>0?(c/Fn(10,i-o)%Fn(10,o)|0)*u:0),l)for(;;)if(p==0){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=u,u=1;o>=10;o/=10)u++;a!=u&&(n.e++,f[0]==ka&&(f[0]=1));break}else{if(f[p]+=u,f[p]!=ka)break;f[p--]=0,u=1}for(a=f.length;f[--a]===0;)f.pop()}return Zt&&(n.e>m.maxE?(n.d=null,n.e=NaN):n.e<m.minE&&(n.e=0,n.d=[0])),n}function Ja(n,e,t){if(!n.isFinite())return wT(n);var r,i=n.e,a=Hn(n.d),o=a.length;return e?(t&&(r=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+us(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(n.e<0?"e":"e+")+n.e):i<0?(a="0."+us(-i-1)+a,t&&(r=t-o)>0&&(a+=us(r))):i>=o?(a+=us(i+1-o),t&&(r=t-i-1)>0&&(a=a+"."+us(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),t&&(r=t-o)>0&&(i+1===o&&(a+="."),a+=us(r))),a}function Tm(n,e){var t=n[0];for(e*=Ot;t>=10;t/=10)e++;return e}function Dm(n,e,t){if(e>sG)throw Zt=!0,t&&(n.precision=t),Error(dT);return Tt(new n(Mm),e,1,!0)}function Pa(n,e,t){if(e>ny)throw Error(dT);return Tt(new n(Em),e,t,!0)}function yT(n){var e=n.length-1,t=e*Ot+1;if(e=n[e],e){for(;e%10==0;e/=10)t--;for(e=n[0];e>=10;e/=10)t++}return t}function us(n){for(var e="";n--;)e+="0";return e}function bT(n,e,t,r){var i,a=new n(1),o=Math.ceil(r/Ot+4);for(Zt=!1;;){if(t%2&&(a=a.times(e),fT(a.d,o)&&(i=!0)),t=ei(t/2),t===0){t=a.d.length-1,i&&a.d[t]===0&&++a.d[t];break}e=e.times(e),fT(e.d,o)}return Zt=!0,a}function cT(n){return n.d[n.d.length-1]&1}function xT(n,e,t){for(var r,i=new n(e[0]),a=0;++a<e.length;)if(r=new n(e[a]),r.s)i[t](r)&&(i=r);else{i=r;break}return i}function iy(n,e){var t,r,i,a,o,u,s,l=0,c=0,f=0,p=n.constructor,m=p.rounding,h=p.precision;if(!n.d||!n.d[0]||n.e>17)return new p(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(e==null?(Zt=!1,s=h):s=e,u=new p(.03125);n.e>-2;)n=n.times(u),f+=5;for(r=Math.log(Fn(2,f))/Math.LN10*2+5|0,s+=r,t=a=o=new p(1),p.precision=s;;){if(a=Tt(a.times(n),s,1),t=t.times(++c),u=o.plus(Hr(a,t,s,1)),Hn(u.d).slice(0,s)===Hn(o.d).slice(0,s)){for(i=f;i--;)o=Tt(o.times(o),s,1);if(e==null)if(l<3&&Ec(o.d,s-r,m,l))p.precision=s+=10,t=a=u=new p(1),c=0,l++;else return Tt(o,p.precision=h,m,Zt=!0);else return p.precision=h,o}o=u}}function ls(n,e){var t,r,i,a,o,u,s,l,c,f,p,m=1,h=10,d=n,g=d.d,y=d.constructor,S=y.rounding,b=y.precision;if(d.s<0||!g||!g[0]||!d.e&&g[0]==1&&g.length==1)return new y(g&&!g[0]?-1/0:d.s!=1?NaN:g?0:d);if(e==null?(Zt=!1,c=b):c=e,y.precision=c+=h,t=Hn(g),r=t.charAt(0),Math.abs(a=d.e)<15e14){for(;r<7&&r!=1||r==1&&t.charAt(1)>3;)d=d.times(n),t=Hn(d.d),r=t.charAt(0),m++;a=d.e,r>1?(d=new y("0."+t),a++):d=new y(r+"."+t.slice(1))}else return l=Dm(y,c+2,b).times(a+""),d=ls(new y(r+"."+t.slice(1)),c-h).plus(l),y.precision=b,e==null?Tt(d,b,S,Zt=!0):d;for(f=d,s=o=d=Hr(d.minus(1),d.plus(1),c,1),p=Tt(d.times(d),c,1),i=3;;){if(o=Tt(o.times(p),c,1),l=s.plus(Hr(o,new y(i),c,1)),Hn(l.d).slice(0,c)===Hn(s.d).slice(0,c))if(s=s.times(2),a!==0&&(s=s.plus(Dm(y,c+2,b).times(a+""))),s=Hr(s,new y(m),c,1),e==null)if(Ec(s.d,c-h,S,u))y.precision=c+=h,l=o=d=Hr(f.minus(1),f.plus(1),c,1),p=Tt(d.times(d),c,1),i=u=1;else return Tt(s,y.precision=b,S,Zt=!0);else return y.precision=b,s;s=l,i+=2}}function wT(n){return String(n.s*n.s/0)}function ay(n,e){var t,r,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,n.e=t=t-r-1,n.d=[],r=(t+1)%Ot,t<0&&(r+=Ot),r<i){for(r&&n.d.push(+e.slice(0,r)),i-=Ot;r<i;)n.d.push(+e.slice(r,r+=Ot));e=e.slice(r),r=Ot-e.length}else r-=i;for(;r--;)e+="0";n.d.push(+e),Zt&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function lG(n,e){var t,r,i,a,o,u,s,l,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),vT.test(e))return ay(n,e)}else if(e==="Infinity"||e==="NaN")return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(iG.test(e))t=16,e=e.toLowerCase();else if(nG.test(e))t=2;else if(aG.test(e))t=8;else throw Error(cs+e);for(a=e.search(/p/i),a>0?(s=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),a=e.indexOf("."),o=a>=0,r=n.constructor,o&&(e=e.replace(".",""),u=e.length,a=u-a,i=bT(r,new r(t),a,a*2)),l=Am(e,t,ka),c=l.length-1,a=c;l[a]===0;--a)l.pop();return a<0?new r(n.s*0):(n.e=Tm(l,c),n.d=l,Zt=!1,o&&(n=Hr(n,i,u*4)),s&&(n=n.times(Math.abs(s)<54?Fn(2,s):Dc.pow(2,s))),Zt=!0,n)}function cG(n,e){var t,r=e.d.length;if(r<3)return e.isZero()?e:pl(n,2,e,e);t=1.4*Math.sqrt(r),t=t>16?16:t|0,e=e.times(1/Cm(5,t)),e=pl(n,2,e,e);for(var i,a=new n(5),o=new n(16),u=new n(20);t--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(u))));return e}function pl(n,e,t,r,i){var a,o,u,s,l=1,c=n.precision,f=Math.ceil(c/Ot);for(Zt=!1,s=t.times(t),u=new n(r);;){if(o=Hr(u.times(s),new n(e++*e++),c,1),u=i?r.plus(o):r.minus(o),r=Hr(o.times(s),new n(e++*e++),c,1),o=u.plus(r),o.d[f]!==void 0){for(a=f;o.d[a]===u.d[a]&&a--;);if(a==-1)break}a=u,u=r,r=o,o=a,l++}return Zt=!0,o.d.length=f+1,o}function Cm(n,e){for(var t=n;--e;)t*=n;return t}function _T(n,e){var t,r=e.s<0,i=Pa(n,n.precision,1),a=i.times(.5);if(e=e.abs(),e.lte(a))return Do=r?4:1,e;if(t=e.divToInt(i),t.isZero())Do=r?3:2;else{if(e=e.minus(t.times(i)),e.lte(a))return Do=cT(t)?r?2:3:r?4:1,e;Do=cT(t)?r?1:4:r?3:2}return e.minus(i).abs()}function oy(n,e,t,r){var i,a,o,u,s,l,c,f,p,m=n.constructor,h=t!==void 0;if(h?(Di(t,1,fs),r===void 0?r=m.rounding:Di(r,0,8)):(t=m.precision,r=m.rounding),!n.isFinite())c=wT(n);else{for(c=Ja(n),o=c.indexOf("."),h?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,o>=0&&(c=c.replace(".",""),p=new m(1),p.e=c.length-o,p.d=Am(Ja(p),10,i),p.e=p.d.length),f=Am(c,10,i),a=s=f.length;f[--s]==0;)f.pop();if(!f[0])c=h?"0p+0":"0";else{if(o<0?a--:(n=new m(n),n.d=f,n.e=a,n=Hr(n,p,t,r,0,i),f=n.d,a=n.e,l=mT),o=f[t],u=i/2,l=l||f[t+1]!==void 0,l=r<4?(o!==void 0||l)&&(r===0||r===(n.s<0?3:2)):o>u||o===u&&(r===4||l||r===6&&f[t-1]&1||r===(n.s<0?8:7)),f.length=t,l)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(s=f.length;!f[s-1];--s);for(o=0,c="";o<s;o++)c+=ty.charAt(f[o]);if(h){if(s>1)if(e==16||e==8){for(o=e==16?4:3,--s;s%o;s++)c+="0";for(f=Am(c,i,e),s=f.length;!f[s-1];--s);for(o=1,c="1.";o<s;o++)c+=ty.charAt(f[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>s)for(a-=s;a--;)c+="0";else a<s&&(c=c.slice(0,a)+"."+c.slice(a))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return n.s<0?"-"+c:c}function fT(n,e){if(n.length>e)return n.length=e,!0}function fG(n){return new this(n).abs()}function pG(n){return new this(n).acos()}function mG(n){return new this(n).acosh()}function dG(n,e){return new this(n).plus(e)}function hG(n){return new this(n).asin()}function gG(n){return new this(n).asinh()}function vG(n){return new this(n).atan()}function yG(n){return new this(n).atanh()}function bG(n,e){n=new this(n),e=new this(e);var t,r=this.precision,i=this.rounding,a=r+4;return!n.s||!e.s?t=new this(NaN):!n.d&&!e.d?(t=Pa(this,a,1).times(e.s>0?.25:.75),t.s=n.s):!e.d||n.isZero()?(t=e.s<0?Pa(this,r,i):new this(0),t.s=n.s):!n.d||e.isZero()?(t=Pa(this,a,1).times(.5),t.s=n.s):e.s<0?(this.precision=a,this.rounding=1,t=this.atan(Hr(n,e,a,1)),e=Pa(this,a,1),this.precision=r,this.rounding=i,t=n.s<0?t.minus(e):t.plus(e)):t=this.atan(Hr(n,e,a,1)),t}function xG(n){return new this(n).cbrt()}function wG(n){return Tt(n=new this(n),n.e+1,2)}function _G(n,e,t){return new this(n).clamp(e,t)}function SG(n){if(!n||typeof n!="object")throw Error(Nm+"Object expected");var e,t,r,i=n.defaults===!0,a=["precision",1,fs,"rounding",0,8,"toExpNeg",-fl,0,"toExpPos",0,fl,"maxE",0,fl,"minE",-fl,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(t=a[e],i&&(this[t]=ry[t]),(r=n[t])!==void 0)if(ei(r)===r&&r>=a[e+1]&&r<=a[e+2])this[t]=r;else throw Error(cs+t+": "+r);if(t="crypto",i&&(this[t]=ry[t]),(r=n[t])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(hT);else this[t]=!1;else throw Error(cs+t+": "+r);return this}function AG(n){return new this(n).cos()}function MG(n){return new this(n).cosh()}function ST(n){var e,t,r;function i(a){var o,u,s,l=this;if(!(l instanceof i))return new i(a);if(l.constructor=i,pT(a)){l.s=a.s,Zt?!a.d||a.e>i.maxE?(l.e=NaN,l.d=null):a.e<i.minE?(l.e=0,l.d=[0]):(l.e=a.e,l.d=a.d.slice()):(l.e=a.e,l.d=a.d?a.d.slice():a.d);return}if(s=typeof a,s==="number"){if(a===0){l.s=1/a<0?-1:1,l.e=0,l.d=[0];return}if(a<0?(a=-a,l.s=-1):l.s=1,a===~~a&&a<1e7){for(o=0,u=a;u>=10;u/=10)o++;Zt?o>i.maxE?(l.e=NaN,l.d=null):o<i.minE?(l.e=0,l.d=[0]):(l.e=o,l.d=[a]):(l.e=o,l.d=[a]);return}else if(a*0!==0){a||(l.s=NaN),l.e=NaN,l.d=null;return}return ay(l,a.toString())}else if(s!=="string")throw Error(cs+a);return(u=a.charCodeAt(0))===45?(a=a.slice(1),l.s=-1):(u===43&&(a=a.slice(1)),l.s=1),vT.test(a)?ay(l,a):lG(l,a)}if(i.prototype=Je,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=SG,i.clone=ST,i.isDecimal=pT,i.abs=fG,i.acos=pG,i.acosh=mG,i.add=dG,i.asin=hG,i.asinh=gG,i.atan=vG,i.atanh=yG,i.atan2=bG,i.cbrt=xG,i.ceil=wG,i.clamp=_G,i.cos=AG,i.cosh=MG,i.div=EG,i.exp=DG,i.floor=NG,i.hypot=TG,i.ln=CG,i.log=FG,i.log10=PG,i.log2=IG,i.max=kG,i.min=BG,i.mod=OG,i.mul=RG,i.pow=LG,i.random=VG,i.round=UG,i.sign=qG,i.sin=zG,i.sinh=$G,i.sqrt=HG,i.sub=GG,i.sum=WG,i.tan=YG,i.tanh=jG,i.trunc=ZG,n===void 0&&(n={}),n&&n.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)n.hasOwnProperty(t=r[e++])||(n[t]=this[t]);return i.config(n),i}function EG(n,e){return new this(n).div(e)}function DG(n){return new this(n).exp()}function NG(n){return Tt(n=new this(n),n.e+1,3)}function TG(){var n,e,t=new this(0);for(Zt=!1,n=0;n<arguments.length;)if(e=new this(arguments[n++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return Zt=!0,new this(1/0);t=e}return Zt=!0,t.sqrt()}function pT(n){return n instanceof Dc||n&&n.toStringTag===gT||!1}function CG(n){return new this(n).ln()}function FG(n,e){return new this(n).log(e)}function IG(n){return new this(n).log(2)}function PG(n){return new this(n).log(10)}function kG(){return xT(this,arguments,"lt")}function BG(){return xT(this,arguments,"gt")}function OG(n,e){return new this(n).mod(e)}function RG(n,e){return new this(n).mul(e)}function LG(n,e){return new this(n).pow(e)}function VG(n){var e,t,r,i,a=0,o=new this(1),u=[];if(n===void 0?n=this.precision:Di(n,1,fs),r=Math.ceil(n/Ot),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));a<r;)i=e[a],i>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);a<r;)i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((e[a+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,a):(u.push(i%1e7),a+=4);a=r/4}else throw Error(hT);else for(;a<r;)u[a++]=Math.random()*1e7|0;for(r=u[--a],n%=Ot,r&&n&&(i=Fn(10,Ot-n),u[a]=(r/i|0)*i);u[a]===0;a--)u.pop();if(a<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=Ot)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<Ot&&(t-=Ot-r)}return o.e=t,o.d=u,o}function UG(n){return Tt(n=new this(n),n.e+1,this.rounding)}function qG(n){return n=new this(n),n.d?n.d[0]?n.s:0*n.s:n.s||NaN}function zG(n){return new this(n).sin()}function $G(n){return new this(n).sinh()}function HG(n){return new this(n).sqrt()}function GG(n,e){return new this(n).sub(e)}function WG(){var n=0,e=arguments,t=new this(e[n]);for(Zt=!1;t.s&&++n<e.length;)t=t.plus(e[n]);return Zt=!0,Tt(t,this.precision,this.rounding)}function YG(n){return new this(n).tan()}function jG(n){return new this(n).tanh()}function ZG(n){return Tt(n=new this(n),n.e+1,1)}Je[Symbol.for("nodejs.util.inspect.custom")]=Je.toString;Je[Symbol.toStringTag]="Decimal";var Dc=Je.constructor=ST(ry);Mm=new Dc(Mm);Em=new Dc(Em);var tu=Dc;var JG="BigNumber",XG=["?on","config"],sy=T(JG,XG,n=>{var{on:e,config:t}=n,r=tu.clone({precision:t.precision,modulo:tu.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(i){return new r(i.value)},e&&e("config",function(i,a){i.precision!==a.precision&&r.config({precision:i.precision})}),r},{isClass:!0});var On=wr(MT(),1);var QG="Complex",KG=[],ly=T(QG,KG,()=>(Object.defineProperty(On.default,"name",{value:"Complex"}),On.default.prototype.constructor=On.default,On.default.prototype.type="Complex",On.default.prototype.isComplex=!0,On.default.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},On.default.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},On.default.prototype.format=function(n){var e="",t=this.im,r=this.re,i=Fa(this.re,n),a=Fa(this.im,n),o=At(n)?n:n?n.precision:null;if(o!==null){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return t===0?e=i:r===0?t===1?e="i":t===-1?e="-i":e=a+"i":t<0?t===-1?e=i+" - i":e=i+" - "+a.substring(1)+"i":t===1?e=i+" + i":e=i+" + "+a+"i",e},On.default.fromPolar=function(n){switch(arguments.length){case 1:{var e=arguments[0];if(typeof e=="object")return(0,On.default)(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{var t=arguments[0],r=arguments[1];if(At(t)){if(Un(r)&&r.hasBase("ANGLE")&&(r=r.toNumber("rad")),At(r))return new On.default({r:t,phi:r});throw new TypeError("Phi is not a number nor an angle unit.")}else throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},On.default.prototype.valueOf=On.default.prototype.toString,On.default.fromJSON=function(n){return new On.default(n)},On.default.compare=function(n,e){return n.re>e.re?1:n.re<e.re?-1:n.im>e.im?1:n.im<e.im?-1:0},On.default),{isClass:!0});var Xa=wr(DT(),1);var eW="Fraction",tW=[],fy=T(eW,tW,()=>(Object.defineProperty(Xa.default,"name",{value:"Fraction"}),Xa.default.prototype.constructor=Xa.default,Xa.default.prototype.type="Fraction",Xa.default.prototype.isFraction=!0,Xa.default.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Xa.default.fromJSON=function(n){return new Xa.default(n)},Xa.default),{isClass:!0});var rW="Range",nW=[],py=T(rW,nW,()=>{function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");var i=e!=null,a=t!=null,o=r!=null;if(i){if(pt(e))e=e.toNumber();else if(typeof e!="number")throw new TypeError("Parameter start must be a number")}if(a){if(pt(t))t=t.toNumber();else if(typeof t!="number")throw new TypeError("Parameter end must be a number")}if(o){if(pt(r))r=r.toNumber();else if(typeof r!="number")throw new TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=a?parseFloat(t):0,this.step=o?parseFloat(r):1}return n.prototype.type="Range",n.prototype.isRange=!0,n.parse=function(e){if(typeof e!="string")return null;var t=e.split(":"),r=t.map(function(a){return parseFloat(a)}),i=r.some(function(a){return isNaN(a)});if(i)return null;switch(r.length){case 2:return new n(r[0],r[1]);case 3:return new n(r[0],r[2],r[1]);default:return null}},n.prototype.clone=function(){return new n(this.start,this.end,this.step)},n.prototype.size=function(){var e=0,t=this.start,r=this.step,i=this.end,a=i-t;return ua(r)===ua(a)?e=Math.ceil(a/r):a===0&&(e=0),isNaN(e)&&(e=0),[e]},n.prototype.min=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start:this.start+(e-1)*this.step},n.prototype.max=function(){var e=this.size()[0];if(e>0)return this.step>0?this.start+(e-1)*this.step:this.start},n.prototype.forEach=function(e){var t=this.start,r=this.step,i=this.end,a=0;if(r>0)for(;t<i;)e(t,[a],this),t+=r,a++;else if(r<0)for(;t>i;)e(t,[a],this),t+=r,a++},n.prototype.map=function(e){var t=[];return this.forEach(function(r,i,a){t[i[0]]=e(r,i,a)}),t},n.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},n.prototype.valueOf=function(){return this.toArray()},n.prototype.format=function(e){var t=Fa(this.start,e);return this.step!==1&&(t+=":"+Fa(this.step,e)),t+=":"+Fa(this.end,e),t},n.prototype.toString=function(){return this.format()},n.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},n.fromJSON=function(e){return new n(e.start,e.end,e.step)},n},{isClass:!0});var iW="Matrix",aW=[],my=T(iW,aW,()=>{function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator")}return n.prototype.type="Matrix",n.prototype.isMatrix=!0,n.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},n.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},n.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},n.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},n.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},n.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},n.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},n.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},n.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},n.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},n.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},n.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},n.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},n.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},n.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},n.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},n.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},n},{isClass:!0});function NT(n){var e=0,t=1,r=Object.create(null),i=Object.create(null),a=0,o=function(s){var l=i[s];if(l&&(delete r[l],delete i[s],--e,t===l)){if(!e){a=0,t=1;return}for(;!Object.prototype.hasOwnProperty.call(r,++t););}};return n=Math.abs(n),{hit:function(s){var l=i[s],c=++a;if(r[c]=s,i[s]=c,!l)return++e,e<=n?void 0:(s=r[t],o(s),s);if(delete r[l],t===l)for(;!Object.prototype.hasOwnProperty.call(r,++t););},delete:o,clear:function(){e=a=0,t=1,r=Object.create(null),i=Object.create(null)}}}function ru(n){var{hasher:e,limit:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t=t??Number.POSITIVE_INFINITY,e=e??JSON.stringify,function r(){typeof r.cache!="object"&&(r.cache={values:new Map,lru:NT(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e(i);if(r.cache.values.has(o))return r.cache.lru.hit(o),r.cache.values.get(o);var u=n.apply(n,i);return r.cache.values.set(o,u),r.cache.values.delete(r.cache.lru.hit(o)),u}}function Fm(n){return Object.keys(n.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var oW="DenseMatrix",sW=["Matrix"],dy=T(oW,sW,n=>{var{Matrix:e}=n;function t(c,f){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(f&&!rn(f))throw new Error("Invalid datatype: "+f);if(ot(c))c.type==="DenseMatrix"?(this._data=vt(c._data),this._size=vt(c._size),this._datatype=f||c._datatype):(this._data=c.toArray(),this._size=c.size(),this._datatype=f||c._datatype);else if(c&&nr(c.data)&&nr(c.size))this._data=c.data,this._size=c.size,Gv(this._data,this._size),this._datatype=f||c.datatype;else if(nr(c))this._data=l(c),this._size=_t(this._data),Gv(this._data,this._size),this._datatype=f;else{if(c)throw new TypeError("Unsupported type of data ("+Kt(c)+")");this._data=[],this._size=[0],this._datatype=f}}t.prototype=new e,t.prototype.createDenseMatrix=function(c,f){return new t(c,f)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return os(this._data,Kt)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(c,f){return new t(c,f)},t.prototype.subset=function(c,f,p){switch(arguments.length){case 1:return r(this,c);case 2:case 3:return a(this,c,f,p);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(c){if(!nr(c))throw new TypeError("Array expected");if(c.length!==this._size.length)throw new Dt(c.length,this._size.length);for(var f=0;f<c.length;f++)br(c[f],this._size[f]);for(var p=this._data,m=0,h=c.length;m<h;m++){var d=c[m];br(d,p.length),p=p[d]}return p},t.prototype.set=function(c,f,p){if(!nr(c))throw new TypeError("Array expected");if(c.length<this._size.length)throw new Dt(c.length,this._size.length,"<");var m,h,d,g=c.map(function(S){return S+1});s(this,g,p);var y=this._data;for(m=0,h=c.length-1;m<h;m++)d=c[m],br(d,y.length),y=y[d];return d=c[c.length-1],br(d,y.length),y[d]=f,this};function r(c,f){if(!rs(f))throw new TypeError("Invalid index");var p=f.isScalar();if(p)return c.get(f.min());var m=f.size();if(m.length!==c._size.length)throw new Dt(m.length,c._size.length);for(var h=f.min(),d=f.max(),g=0,y=c._size.length;g<y;g++)br(h[g],c._size[g]),br(d[g],c._size[g]);return new t(i(c._data,f,m.length,0),c._datatype)}function i(c,f,p,m){var h=m===p-1,d=f.dimension(m);return h?d.map(function(g){return br(g,c.length),c[g]}).valueOf():d.map(function(g){br(g,c.length);var y=c[g];return i(y,f,p,m+1)}).valueOf()}function a(c,f,p,m){if(!f||f.isIndex!==!0)throw new TypeError("Invalid index");var h=f.size(),d=f.isScalar(),g;if(ot(p)?(g=p.size(),p=p.valueOf()):g=_t(p),d){if(g.length!==0)throw new TypeError("Scalar expected");c.set(f.min(),p,m)}else{if(!Ca(g,h))try{g.length===0?p=jv([p],h):p=jv(p,h),g=_t(p)}catch{}if(h.length<c._size.length)throw new Dt(h.length,c._size.length,"<");if(g.length<h.length){for(var y=0,S=0;h[y]===1&&g[y]===1;)y++;for(;h[y]===1;)S++,y++;p=xm(p,h.length,S,g)}if(!Ca(h,g))throw new Dt(h,g,">");var b=f.max().map(function(x){return x+1});s(c,b,m);var w=h.length,A=0;o(c._data,f,p,w,A)}return c}function o(c,f,p,m,h){var d=h===m-1,g=f.dimension(h);d?g.forEach(function(y,S){br(y),c[y]=p[S[0]]}):g.forEach(function(y,S){br(y),o(c[y],f,p[S[0]],m,h+1)})}t.prototype.resize=function(c,f,p){if(!ln(c))throw new TypeError("Array or Matrix expected");var m=c.valueOf().map(d=>Array.isArray(d)&&d.length===1?d[0]:d),h=p?this.clone():this;return u(h,m,f)};function u(c,f,p){if(f.length===0){for(var m=c._data;nr(m);)m=m[0];return m}return c._size=f.slice(0),c._data=Ia(c._data,c._size,p),c}t.prototype.reshape=function(c,f){var p=f?this.clone():this;p._data=Sc(p._data,c);var m=p._size.reduce((h,d)=>h*d);return p._size=Ac(c,m),p};function s(c,f,p){for(var m=c._size.slice(0),h=!1;m.length<f.length;)m.push(0),h=!0;for(var d=0,g=f.length;d<g;d++)f[d]>m[d]&&(m[d]=f[d],h=!0);h&&u(c,m,p)}t.prototype.clone=function(){var c=new t({data:vt(this._data),size:vt(this._size),datatype:this._datatype});return c},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(c){var f=this,p=Fm(c),m=function g(y,S){return nr(y)?y.map(function(b,w){return g(b,S.concat(w))}):p===1?c(y):p===2?c(y,S):c(y,S,f)},h=m(this._data,[]),d=this._datatype!==void 0?os(h,Kt):void 0;return new t(h,d)},t.prototype.forEach=function(c){var f=this,p=function m(h,d){nr(h)?h.forEach(function(g,y){m(g,d.concat(y))}):c(h,d,f)};p(this._data,[])},t.prototype[Symbol.iterator]=function*(){var c=function*f(p,m){if(nr(p))for(var h=0;h<p.length;h++)yield*f(p[h],m.concat(h));else yield{value:p,index:m}};yield*c(this._data,[])},t.prototype.rows=function(){var c=[],f=this.size();if(f.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");var p=this._data;for(var m of p)c.push(new t([m],this._datatype));return c},t.prototype.columns=function(){var c=this,f=[],p=this.size();if(p.length!==2)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var m=this._data,h=function(y){var S=m.map(b=>[b[y]]);f.push(new t(S,c._datatype))},d=0;d<p[1];d++)h(d);return f},t.prototype.toArray=function(){return vt(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(c){return Mt(this._data,c)},t.prototype.toString=function(){return Mt(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(c){if(c){if(pt(c)&&(c=c.toNumber()),!At(c)||!nt(c))throw new TypeError("The parameter k must be an integer number")}else c=0;for(var f=c>0?c:0,p=c<0?-c:0,m=this._size[0],h=this._size[1],d=Math.min(m-p,h-f),g=[],y=0;y<d;y++)g[y]=this._data[y+p][y+f];return new t({data:g,size:[d],datatype:this._datatype})},t.diagonal=function(c,f,p,m){if(!nr(c))throw new TypeError("Array expected, size parameter");if(c.length!==2)throw new Error("Only two dimensions matrix are supported");if(c=c.map(function(D){if(pt(D)&&(D=D.toNumber()),!At(D)||!nt(D)||D<1)throw new Error("Size values must be positive integers");return D}),p){if(pt(p)&&(p=p.toNumber()),!At(p)||!nt(p))throw new TypeError("The parameter k must be an integer number")}else p=0;var h=p>0?p:0,d=p<0?-p:0,g=c[0],y=c[1],S=Math.min(g-d,y-h),b;if(nr(f)){if(f.length!==S)throw new Error("Invalid value array length");b=function(E){return f[E]}}else if(ot(f)){var w=f.size();if(w.length!==1||w[0]!==S)throw new Error("Invalid matrix length");b=function(E){return f.get([E])}}else b=function(){return f};m||(m=pt(b(0))?b(0).mul(0):0);var A=[];if(c.length>0){A=Ia(A,c,m);for(var x=0;x<S;x++)A[x+d][x+h]=b(x)}return new t({data:A,size:[g,y]})},t.fromJSON=function(c){return new t(c)},t.prototype.swapRows=function(c,f){if(!At(c)||!nt(c)||!At(f)||!nt(f))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return br(c,this._size[0]),br(f,this._size[0]),t._swapRows(c,f,this._data),this},t._swapRows=function(c,f,p){var m=p[c];p[c]=p[f],p[f]=m};function l(c){return ot(c)?l(c.valueOf()):nr(c)?c.map(l):c}return t},{isClass:!0});var TT="clone",uW=["typed"],hy=T(TT,uW,n=>{var{typed:e}=n;return e(TT,{any:vt})});function Im(n){var e=n.length,t=n[0].length,r,i,a=[];for(i=0;i<t;i++){var o=[];for(r=0;r<e;r++)o.push(n[r][i]);a.push(o)}return a}function la(n){for(var e=0;e<n.length;e++)if(ln(n[e]))return!0;return!1}function ti(n,e){ot(n)&&(n=n.valueOf());for(var t=0,r=n.length;t<r;t++){var i=n[t];Array.isArray(i)?ti(i,e):e(i)}}function lt(n,e,t){return n&&typeof n.map=="function"?n.map(function(r){return lt(r,e,t)}):e(n)}function ps(n,e,t){var r=Array.isArray(n)?_t(n):n.size();if(e<0||e>=r.length)throw new $n(e,r.length);return ot(n)?n.create(Pm(n.valueOf(),e,t)):Pm(n,e,t)}function Pm(n,e,t){var r,i,a,o;if(e<=0)if(Array.isArray(n[0])){for(o=Im(n),i=[],r=0;r<o.length;r++)i[r]=Pm(o[r],e-1,t);return i}else{for(a=n[0],r=1;r<n.length;r++)a=t(a,n[r]);return a}else{for(i=[],r=0;r<n.length;r++)i[r]=Pm(n[r],e-1,t);return i}}function gy(n,e,t,r,i,a,o,u,s,l,c){var f=n._values,p=n._index,m=n._ptr,h,d,g,y;if(r)for(d=m[e],g=m[e+1],h=d;h<g;h++)y=p[h],t[y]!==a?(t[y]=a,o.push(y),l?(r[y]=s?u(f[h],c):u(c,f[h]),i[y]=a):r[y]=f[h]):(r[y]=s?u(f[h],r[y]):u(r[y],f[h]),i[y]=a);else for(d=m[e],g=m[e+1],h=d;h<g;h++)y=p[h],t[y]!==a?(t[y]=a,o.push(y)):i[y]=a}var CT="isInteger",lW=["typed"],vy=T(CT,lW,n=>{var{typed:e}=n;return e(CT,{number:nt,BigNumber:function(r){return r.isInt()},Fraction:function(r){return r.d===1&&isFinite(r.n)},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var Ni="number",No="number, number";function yy(n){return Math.abs(n)}yy.signature=Ni;function by(n,e){return n+e}by.signature=No;function xy(n,e){return n-e}xy.signature=No;function wy(n,e){return n*e}wy.signature=No;function cW(n,e){return n/e}cW.signature=No;function _y(n){return-n}_y.signature=Ni;function Sy(n){return n}Sy.signature=Ni;function ml(n){return RN(n)}ml.signature=Ni;function Ay(n){return n*n*n}Ay.signature=Ni;function My(n){return Math.exp(n)}My.signature=Ni;function Ey(n){return LN(n)}Ey.signature=Ni;function fW(n,e){if(!nt(n)||!nt(e))throw new Error("Parameters in function gcd must be integer numbers");for(var t;e!==0;)t=n%e,n=e,e=t;return n<0?-n:n}fW.signature=No;function Dy(n,e){if(!nt(n)||!nt(e))throw new Error("Parameters in function lcm must be integer numbers");if(n===0||e===0)return 0;for(var t,r=n*e;e!==0;)t=e,e=n%t,n=t;return Math.abs(r/n)}Dy.signature=No;function FT(n,e){return e?Math.log(n)/Math.log(e):Math.log(n)}function Ny(n){return ON(n)}Ny.signature=Ni;function Ty(n){return BN(n)}Ty.signature=Ni;function pW(n){return hm(n)}pW.signature=Ni;function mW(n,e){return e===0?n:n-e*Math.floor(n/e)}mW.signature=No;function Cy(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,t=e<0;if(t&&(e=-e),e===0)throw new Error("Root must be non-zero");if(n<0&&Math.abs(e)%2!==1)throw new Error("Root must be odd when a is negative.");if(n===0)return t?1/0:0;if(!isFinite(n))return t?0:n;var r=Math.pow(Math.abs(n),1/e);return r=n<0?-r:r,t?1/r:r}function km(n){return ua(n)}km.signature=Ni;function dW(n){return Math.sqrt(n)}dW.signature=Ni;function Fy(n){return n*n}Fy.signature=Ni;function Iy(n,e){var t,r,i,a=0,o=1,u=1,s=0;if(!nt(n)||!nt(e))throw new Error("Parameters in function xgcd must be integer numbers");for(;e;)r=Math.floor(n/e),i=n-r*e,t=a,a=o-r*a,o=t,t=u,u=s-r*u,s=t,n=e,e=i;var l;return n<0?l=[-n,-o,-s]:l=[n,n?o:0,s],l}Iy.signature=No;function Py(n,e){return n*n<1&&e===1/0||n*n>1&&e===-1/0?0:Math.pow(n,e)}Py.signature=No;function dl(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!nt(e)||e<0||e>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(zv(n,e))}function hW(n){return Math.abs(n)}hW.signature=Ni;var gW="number",hl="number, number";function ky(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitAnd");return n&e}ky.signature=hl;function By(n){if(!nt(n))throw new Error("Integer expected in function bitNot");return~n}By.signature=gW;function Oy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitOr");return n|e}Oy.signature=hl;function Ry(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function bitXor");return n^e}Ry.signature=hl;function Ly(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function leftShift");return n<<e}Ly.signature=hl;function Vy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function rightArithShift");return n>>e}Vy.signature=hl;function Uy(n,e){if(!nt(n)||!nt(e))throw new Error("Integers expected in function rightLogShift");return n>>>e}Uy.signature=hl;function Hi(n,e){if(e<n)return 1;if(e===n)return e;var t=e+n>>1;return Hi(n,t)*Hi(t+1,e)}function qy(n,e){if(!nt(n)||n<0)throw new TypeError("Positive integer value expected in function combinations");if(!nt(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(e>n)throw new TypeError("k must be less than or equal to n");for(var t=n-e,r=1,i=e<t?t+1:e+1,a=2,o=e<t?e:t,u=i;u<=n;++u)for(r*=u;a<=o&&r%a===0;)r/=a,++a;return a<=o&&(r/=Hi(a,o)),r}qy.signature="number, number";var IT=Math.PI,PT=2*Math.PI,kT=Math.E,BT=1.618033988749895;var vW="number",zy="number, number";function $y(n){return!n}$y.signature=vW;function Hy(n,e){return!!(n||e)}Hy.signature=zy;function Gy(n,e){return!!n!=!!e}Gy.signature=zy;function Wy(n,e){return!!(n&&e)}Wy.signature=zy;function Nc(n){var e;if(nt(n))return n<=0?isFinite(n)?1/0:NaN:n>171?1/0:Hi(1,n-1);if(n<.5)return Math.PI/(Math.sin(Math.PI*n)*Nc(1-n));if(n>=171.35)return 1/0;if(n>85){var t=n*n,r=t*n,i=r*n,a=i*n;return Math.sqrt(2*Math.PI/n)*Math.pow(n/Math.E,n)*(1+1/(12*n)+1/(288*t)-139/(51840*r)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*n))}--n,e=nu[0];for(var o=1;o<nu.length;++o)e+=nu[o]/(n+o);var u=n+Yy+.5;return Math.sqrt(2*Math.PI)*Math.pow(u,n+.5)*Math.exp(-u)*e}Nc.signature="number";var Yy=4.7421875,nu=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],jy=.9189385332046728,yW=5,bW=7,OT=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Tc(n){if(n<0)return NaN;if(n===0)return 1/0;if(!isFinite(n))return n;if(n<.5)return Math.log(Math.PI/Math.sin(Math.PI*n))-Tc(1-n);n=n-1;for(var e=n+yW+.5,t=OT[0],r=bW-1;r>=1;r--)t+=OT[r]/(n+r);return jy+(n+.5)*Math.log(e)-e+Math.log(t)}Tc.signature="number";var nn="number",xW="number, number";function wW(n){return Math.acos(n)}wW.signature=nn;function Zy(n){return qN(n)}Zy.signature=nn;function Jy(n){return Math.atan(1/n)}Jy.signature=nn;function Xy(n){return isFinite(n)?(Math.log((n+1)/n)+Math.log(n/(n-1)))/2:0}Xy.signature=nn;function Qy(n){return Math.asin(1/n)}Qy.signature=nn;function Ky(n){var e=1/n;return Math.log(e+Math.sqrt(e*e+1))}Ky.signature=nn;function e0(n){return Math.acos(1/n)}e0.signature=nn;function t0(n){var e=1/n,t=Math.sqrt(e*e-1);return Math.log(t+e)}t0.signature=nn;function _W(n){return Math.asin(n)}_W.signature=nn;function r0(n){return zN(n)}r0.signature=nn;function SW(n){return Math.atan(n)}SW.signature=nn;function AW(n,e){return Math.atan2(n,e)}AW.signature=xW;function n0(n){return $N(n)}n0.signature=nn;function MW(n){return Math.cos(n)}MW.signature=nn;function EW(n){return vm(n)}EW.signature=nn;function i0(n){return 1/Math.tan(n)}i0.signature=nn;function a0(n){var e=Math.exp(2*n);return(e+1)/(e-1)}a0.signature=nn;function o0(n){return 1/Math.sin(n)}o0.signature=nn;function s0(n){return n===0?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(n)-Math.exp(-n)))*ua(n)}s0.signature=nn;function u0(n){return 1/Math.cos(n)}u0.signature=nn;function l0(n){return 2/(Math.exp(n)+Math.exp(-n))}l0.signature=nn;function DW(n){return Math.sin(n)}DW.signature=nn;function c0(n){return HN(n)}c0.signature=nn;function NW(n){return Math.tan(n)}NW.signature=nn;function TW(n){return ym(n)}TW.signature=nn;var Cc="number";function CW(n){return nt(n)}CW.signature=Cc;function f0(n){return n<0}f0.signature=Cc;function p0(n){return n>0}p0.signature=Cc;function m0(n){return n===0}m0.signature=Cc;function d0(n){return Number.isNaN(n)}d0.signature=Cc;var RT="isNegative",FW=["typed"],h0=T(RT,FW,n=>{var{typed:e}=n;return e(RT,{number:f0,BigNumber:function(r){return r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s<0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var LT="isNumeric",IW=["typed"],g0=T(LT,IW,n=>{var{typed:e}=n;return e(LT,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var VT="hasNumericValue",PW=["typed","isNumeric"],v0=T(VT,PW,n=>{var{typed:e,isNumeric:t}=n;return e(VT,{boolean:()=>!0,string:function(i){return i.trim().length>0&&!isNaN(Number(i))},any:function(i){return t(i)}})});var UT="isPositive",kW=["typed"],y0=T(UT,kW,n=>{var{typed:e}=n;return e(UT,{number:p0,BigNumber:function(r){return!r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s>0&&r.n>0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var qT="isZero",BW=["typed"],b0=T(qT,BW,n=>{var{typed:e}=n;return e(qT,{number:m0,BigNumber:function(r){return r.isZero()},Complex:function(r){return r.re===0&&r.im===0},Fraction:function(r){return r.d===1&&r.n===0},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var zT="isNaN",OW=["typed"],x0=T(zT,OW,n=>{var{typed:e}=n;return e(zT,{number:d0,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return lt(r,Number.isNaN)}})});var $T="typeOf",RW=["typed"],w0=T($T,RW,n=>{var{typed:e}=n;return e($T,{any:Kt})});function gn(n,e,t){if(t==null)return n.eq(e);if(n.eq(e))return!0;if(n.isNaN()||e.isNaN())return!1;if(n.isFinite()&&e.isFinite()){var r=n.minus(e).abs();if(r.isZero())return!0;var i=n.constructor.max(n.abs(),e.abs());return r.lte(i.times(t))}return!1}function HT(n,e,t){return Jr(n.re,e.re,t)&&Jr(n.im,e.im,t)}var ca=T("compareUnits",["typed"],n=>{var{typed:e}=n;return{"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(!r.equalBase(i))throw new Error("Cannot compare units with different base");return e.find(t,[r.valueType(),i.valueType()])(r.value,i.value)})}});var Bm="equalScalar",LW=["typed","config"],_0=T(Bm,LW,n=>{var{typed:e,config:t}=n,r=ca({typed:e});return e(Bm,{"boolean, boolean":function(a,o){return a===o},"number, number":function(a,o){return Jr(a,o,t.epsilon)},"BigNumber, BigNumber":function(a,o){return a.eq(o)||gn(a,o,t.epsilon)},"Fraction, Fraction":function(a,o){return a.equals(o)},"Complex, Complex":function(a,o){return HT(a,o,t.epsilon)}},r)}),uve=T(Bm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Bm,{"number, number":function(i,a){return Jr(i,a,t.epsilon)}})});var VW="SparseMatrix",UW=["typed","equalScalar","Matrix"],S0=T(VW,UW,n=>{var{typed:e,equalScalar:t,Matrix:r}=n;function i(d,g){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(g&&!rn(g))throw new Error("Invalid datatype: "+g);if(ot(d))a(this,d,g);else if(d&&nr(d.index)&&nr(d.ptr)&&nr(d.size))this._values=d.values,this._index=d.index,this._ptr=d.ptr,this._size=d.size,this._datatype=g||d.datatype;else if(nr(d))o(this,d,g);else{if(d)throw new TypeError("Unsupported type of data ("+Kt(d)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=g}}function a(d,g,y){g.type==="SparseMatrix"?(d._values=g._values?vt(g._values):void 0,d._index=vt(g._index),d._ptr=vt(g._ptr),d._size=vt(g._size),d._datatype=y||g._datatype):o(d,g.valueOf(),y||g._datatype)}function o(d,g,y){d._values=[],d._index=[],d._ptr=[],d._datatype=y;var S=g.length,b=0,w=t,A=0;if(rn(y)&&(w=e.find(t,[y,y])||t,A=e.convert(0,y)),S>0){var x=0;do{d._ptr.push(d._index.length);for(var D=0;D<S;D++){var E=g[D];if(nr(E)){if(x===0&&b<E.length&&(b=E.length),x<E.length){var _=E[x];w(_,A)||(d._values.push(_),d._index.push(D))}}else x===0&&b<1&&(b=1),w(E,A)||(d._values.push(E),d._index.push(D))}x++}while(x<b)}d._ptr.push(d._index.length),d._size=[S,b]}i.prototype=new r,i.prototype.createSparseMatrix=function(d,g){return new i(d,g)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return os(this._values,Kt)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(d,g){return new i(d,g)},i.prototype.density=function(){var d=this._size[0],g=this._size[1];return d!==0&&g!==0?this._index.length/(d*g):0},i.prototype.subset=function(d,g,y){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return u(this,d);case 2:case 3:return s(this,d,g,y);default:throw new SyntaxError("Wrong number of arguments")}};function u(d,g){if(!rs(g))throw new TypeError("Invalid index");var y=g.isScalar();if(y)return d.get(g.min());var S=g.size();if(S.length!==d._size.length)throw new Dt(S.length,d._size.length);var b,w,A,x,D=g.min(),E=g.max();for(b=0,w=d._size.length;b<w;b++)br(D[b],d._size[b]),br(E[b],d._size[b]);var _=d._values,N=d._index,P=d._ptr,B=g.dimension(0),V=g.dimension(1),z=[],L=[];B.forEach(function(O,H){L[O]=H[0],z[O]=!0});var k=_?[]:void 0,C=[],W=[];return V.forEach(function(O){for(W.push(C.length),A=P[O],x=P[O+1];A<x;A++)b=N[A],z[b]===!0&&(C.push(L[b]),k&&k.push(_[A]))}),W.push(C.length),new i({values:k,index:C,ptr:W,size:S,datatype:d._datatype})}function s(d,g,y,S){if(!g||g.isIndex!==!0)throw new TypeError("Invalid index");var b=g.size(),w=g.isScalar(),A;if(ot(y)?(A=y.size(),y=y.toArray()):A=_t(y),w){if(A.length!==0)throw new TypeError("Scalar expected");d.set(g.min(),y,S)}else{if(b.length!==1&&b.length!==2)throw new Dt(b.length,d._size.length,"<");if(A.length<b.length){for(var x=0,D=0;b[x]===1&&A[x]===1;)x++;for(;b[x]===1;)D++,x++;y=xm(y,b.length,D,A)}if(!Ca(b,A))throw new Dt(b,A,">");if(b.length===1){var E=g.dimension(0);E.forEach(function(P,B){br(P),d.set([P,0],y[B[0]],S)})}else{var _=g.dimension(0),N=g.dimension(1);_.forEach(function(P,B){br(P),N.forEach(function(V,z){br(V),d.set([P,V],y[B[0]][z[0]],S)})})}}return d}i.prototype.get=function(d){if(!nr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Dt(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var g=d[0],y=d[1];br(g,this._size[0]),br(y,this._size[1]);var S=l(g,this._ptr[y],this._ptr[y+1],this._index);return S<this._ptr[y+1]&&this._index[S]===g?this._values[S]:0},i.prototype.set=function(d,g,y){if(!nr(d))throw new TypeError("Array expected");if(d.length!==this._size.length)throw new Dt(d.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var S=d[0],b=d[1],w=this._size[0],A=this._size[1],x=t,D=0;rn(this._datatype)&&(x=e.find(t,[this._datatype,this._datatype])||t,D=e.convert(0,this._datatype)),(S>w-1||b>A-1)&&(p(this,Math.max(S+1,w),Math.max(b+1,A),y),w=this._size[0],A=this._size[1]),br(S,w),br(b,A);var E=l(S,this._ptr[b],this._ptr[b+1],this._index);return E<this._ptr[b+1]&&this._index[E]===S?x(g,D)?c(E,b,this._values,this._index,this._ptr):this._values[E]=g:x(g,D)||f(E,S,b,g,this._values,this._index,this._ptr),this};function l(d,g,y,S){if(y-g===0)return y;for(var b=g;b<y;b++)if(S[b]===d)return b;return g}function c(d,g,y,S,b){y.splice(d,1),S.splice(d,1);for(var w=g+1;w<b.length;w++)b[w]--}function f(d,g,y,S,b,w,A){b.splice(d,0,S),w.splice(d,0,g);for(var x=y+1;x<A.length;x++)A[x]++}i.prototype.resize=function(d,g,y){if(!ln(d))throw new TypeError("Array or Matrix expected");var S=d.valueOf().map(w=>Array.isArray(w)&&w.length===1?w[0]:w);if(S.length!==2)throw new Error("Only two dimensions matrix are supported");S.forEach(function(w){if(!At(w)||!nt(w)||w<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(S)+")")});var b=y?this.clone():this;return p(b,S[0],S[1],g)};function p(d,g,y,S){var b=S||0,w=t,A=0;rn(d._datatype)&&(w=e.find(t,[d._datatype,d._datatype])||t,A=e.convert(0,d._datatype),b=e.convert(b,d._datatype));var x=!w(b,A),D=d._size[0],E=d._size[1],_,N,P;if(y>E){for(N=E;N<y;N++)if(d._ptr[N]=d._values.length,x)for(_=0;_<D;_++)d._values.push(b),d._index.push(_);d._ptr[y]=d._values.length}else y<E&&(d._ptr.splice(y+1,E-y),d._values.splice(d._ptr[y],d._values.length),d._index.splice(d._ptr[y],d._index.length));if(E=y,g>D){if(x){var B=0;for(N=0;N<E;N++){d._ptr[N]=d._ptr[N]+B,P=d._ptr[N+1]+B;var V=0;for(_=D;_<g;_++,V++)d._values.splice(P+V,0,b),d._index.splice(P+V,0,_),B++}d._ptr[E]=d._values.length}}else if(g<D){var z=0;for(N=0;N<E;N++){d._ptr[N]=d._ptr[N]-z;var L=d._ptr[N],k=d._ptr[N+1]-z;for(P=L;P<k;P++)_=d._index[P],_>g-1&&(d._values.splice(P,1),d._index.splice(P,1),z++)}d._ptr[N]=d._values.length}return d._size[0]=g,d._size[1]=y,d}i.prototype.reshape=function(d,g){if(!nr(d))throw new TypeError("Array expected");if(d.length!==2)throw new Error("Sparse matrices can only be reshaped in two dimensions");d.forEach(function(O){if(!At(O)||!nt(O)||O<=-2||O===0)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Mt(d)+")")});var y=this._size[0]*this._size[1];d=Ac(d,y);var S=d[0]*d[1];if(y!==S)throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var b=g?this.clone():this;if(this._size[0]===d[0]&&this._size[1]===d[1])return b;for(var w=[],A=0;A<b._ptr.length;A++)for(var x=0;x<b._ptr[A+1]-b._ptr[A];x++)w.push(A);for(var D=b._values.slice(),E=b._index.slice(),_=0;_<b._index.length;_++){var N=E[_],P=w[_],B=N*b._size[1]+P;w[_]=B%d[1],E[_]=Math.floor(B/d[1])}b._values.length=0,b._index.length=0,b._ptr.length=d[1]+1,b._size=d.slice();for(var V=0;V<b._ptr.length;V++)b._ptr[V]=0;for(var z=0;z<D.length;z++){var L=E[z],k=w[z],C=D[z],W=l(L,b._ptr[k],b._ptr[k+1],b._index);f(W,L,k,C,b._values,b._index,b._ptr)}return b},i.prototype.clone=function(){var d=new i({values:this._values?vt(this._values):void 0,index:vt(this._index),ptr:vt(this._ptr),size:vt(this._size),datatype:this._datatype});return d},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(d,g){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var y=this,S=this._size[0],b=this._size[1],w=Fm(d),A=function(D,E,_){return w===1?d(D):w===2?d(D,[E,_]):d(D,[E,_],y)};return m(this,0,S-1,0,b-1,A,g)};function m(d,g,y,S,b,w,A){var x=[],D=[],E=[],_=t,N=0;rn(d._datatype)&&(_=e.find(t,[d._datatype,d._datatype])||t,N=e.convert(0,d._datatype));for(var P=function(U,me,De){U=w(U,me,De),_(U,N)||(x.push(U),D.push(me))},B=S;B<=b;B++){E.push(x.length);var V=d._ptr[B],z=d._ptr[B+1];if(A)for(var L=V;L<z;L++){var k=d._index[L];k>=g&&k<=y&&P(d._values[L],k-g,B-S)}else{for(var C={},W=V;W<z;W++){var O=d._index[W];C[O]=d._values[W]}for(var H=g;H<=y;H++){var Z=H in C?C[H]:0;P(Z,H-g,B-S)}}}return E.push(x.length),new i({values:x,index:D,ptr:E,size:[y-g+1,b-S+1]})}i.prototype.forEach=function(d,g){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var y=this,S=this._size[0],b=this._size[1],w=0;w<b;w++){var A=this._ptr[w],x=this._ptr[w+1];if(g)for(var D=A;D<x;D++){var E=this._index[D];d(this._values[D],[E,w],y)}else{for(var _={},N=A;N<x;N++){var P=this._index[N];_[P]=this._values[N]}for(var B=0;B<S;B++){var V=B in _?_[B]:0;d(V,[B,w],y)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var d=this._size[1],g=0;g<d;g++)for(var y=this._ptr[g],S=this._ptr[g+1],b=y;b<S;b++){var w=this._index[b];yield{value:this._values[b],index:[w,g]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)};function h(d,g,y,S,b){var w=S[0],A=S[1],x=[],D,E;for(D=0;D<w;D++)for(x[D]=[],E=0;E<A;E++)x[D][E]=0;for(E=0;E<A;E++)for(var _=y[E],N=y[E+1],P=_;P<N;P++)D=g[P],x[D][E]=d?b?vt(d[P]):d[P]:1;return x}return i.prototype.format=function(d){for(var g=this._size[0],y=this._size[1],S=this.density(),b="Sparse Matrix ["+Mt(g,d)+" x "+Mt(y,d)+"] density: "+Mt(S,d)+`
`,w=0;w<y;w++)for(var A=this._ptr[w],x=this._ptr[w+1],D=A;D<x;D++){var E=this._index[D];b+=`
    (`+Mt(E,d)+", "+Mt(w,d)+") ==> "+(this._values?Mt(this._values[D],d):"X")}return b},i.prototype.toString=function(){return Mt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(d){if(d){if(pt(d)&&(d=d.toNumber()),!At(d)||!nt(d))throw new TypeError("The parameter k must be an integer number")}else d=0;var g=d>0?d:0,y=d<0?-d:0,S=this._size[0],b=this._size[1],w=Math.min(S-y,b-g),A=[],x=[],D=[];D[0]=0;for(var E=g;E<b&&A.length<w;E++)for(var _=this._ptr[E],N=this._ptr[E+1],P=_;P<N;P++){var B=this._index[P];if(B===E-g+y){A.push(this._values[P]),x[A.length-1]=B-y;break}}return D.push(A.length),new i({values:A,index:x,ptr:D,size:[w,1]})},i.fromJSON=function(d){return new i(d)},i.diagonal=function(d,g,y,S,b){if(!nr(d))throw new TypeError("Array expected, size parameter");if(d.length!==2)throw new Error("Only two dimensions matrix are supported");if(d=d.map(function(O){if(pt(O)&&(O=O.toNumber()),!At(O)||!nt(O)||O<1)throw new Error("Size values must be positive integers");return O}),y){if(pt(y)&&(y=y.toNumber()),!At(y)||!nt(y))throw new TypeError("The parameter k must be an integer number")}else y=0;var w=t,A=0;rn(b)&&(w=e.find(t,[b,b])||t,A=e.convert(0,b));var x=y>0?y:0,D=y<0?-y:0,E=d[0],_=d[1],N=Math.min(E-D,_-x),P;if(nr(g)){if(g.length!==N)throw new Error("Invalid value array length");P=function(H){return g[H]}}else if(ot(g)){var B=g.size();if(B.length!==1||B[0]!==N)throw new Error("Invalid matrix length");P=function(H){return g.get([H])}}else P=function(){return g};for(var V=[],z=[],L=[],k=0;k<_;k++){L.push(V.length);var C=k-x;if(C>=0&&C<N){var W=P(C);w(W,A)||(z.push(C+D),V.push(W))}}return L.push(V.length),new i({values:V,index:z,ptr:L,size:[E,_]})},i.prototype.swapRows=function(d,g){if(!At(d)||!nt(d)||!At(g)||!nt(g))throw new Error("Row index must be positive integers");if(this._size.length!==2)throw new Error("Only two dimensional matrix is supported");return br(d,this._size[0]),br(g,this._size[0]),i._swapRows(d,g,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(d,g,y,S,b){for(var w=S[d],A=S[d+1],x=w;x<A;x++)b(y[x],g[x])},i._swapRows=function(d,g,y,S,b,w){for(var A=0;A<y;A++){var x=w[A],D=w[A+1],E=l(d,x,D,b),_=l(g,x,D,b);if(E<D&&_<D&&b[E]===d&&b[_]===g){if(S){var N=S[E];S[E]=S[_],S[_]=N}continue}if(E<D&&b[E]===d&&(_>=D||b[_]!==g)){var P=S?S[E]:void 0;b.splice(_,0,g),S&&S.splice(_,0,P),b.splice(_<=E?E+1:E,1),S&&S.splice(_<=E?E+1:E,1);continue}if(_<D&&b[_]===g&&(E>=D||b[E]!==d)){var B=S?S[_]:void 0;b.splice(E,0,d),S&&S.splice(E,0,B),b.splice(E<=_?_+1:_,1),S&&S.splice(E<=_?_+1:_,1)}}},i},{isClass:!0});var qW="number",zW=["typed"];function $W(n){var e=n.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(e){var t={"0b":2,"0o":8,"0x":16}[e[1]],r=e[2],i=e[3];return{input:n,radix:t,integerPart:r,fractionalPart:i}}else return null}function HW(n){for(var e=parseInt(n.integerPart,n.radix),t=0,r=0;r<n.fractionalPart.length;r++){var i=parseInt(n.fractionalPart[r],n.radix);t+=i/Math.pow(n.radix,r+1)}var a=e+t;if(isNaN(a))throw new SyntaxError('String "'+n.input+'" is not a valid number');return a}var A0=T(qW,zW,n=>{var{typed:e}=n,t=e("number",{"":function(){return 0},number:function(i){return i},string:function(i){if(i==="NaN")return NaN;var a=$W(i);if(a)return HW(a);var o=0,u=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);u&&(o=Number(u[2]),i=u[1]);var s=Number(i);if(isNaN(s))throw new SyntaxError('String "'+i+'" is not a valid number');if(u){if(s>2**o-1)throw new SyntaxError('String "'.concat(i,'" is out of range'));s>=2**(o-1)&&(s=s-2**o)}return s},BigNumber:function(i){return i.toNumber()},Fraction:function(i){return i.valueOf()},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),null:function(i){return 0},"Unit, string | Unit":function(i,a){return i.toNumber(a)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t});var GT="string",GW=["typed"],M0=T(GT,GW,n=>{var{typed:e}=n;return e(GT,{"":function(){return""},number:Fa,null:function(r){return"null"},boolean:function(r){return r+""},string:function(r){return r},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t)),any:function(r){return String(r)}})});var WT="boolean",WW=["typed"],E0=T(WT,WW,n=>{var{typed:e}=n;return e(WT,{"":function(){return!1},boolean:function(r){return r},number:function(r){return!!r},null:function(r){return!1},BigNumber:function(r){return!r.isZero()},string:function(r){var i=r.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;var a=Number(r);if(r!==""&&!isNaN(a))return!!a;throw new Error('Cannot convert "'+r+'" to a boolean')},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var YW="bignumber",jW=["typed","BigNumber"],D0=T(YW,jW,n=>{var{typed:e,BigNumber:t}=n;return e("bignumber",{"":function(){return new t(0)},number:function(i){return new t(i+"")},string:function(i){var a=i.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(a){var o=a[2],u=t(a[1]),s=new t(2).pow(Number(o));if(u.gt(s.sub(1)))throw new SyntaxError('String "'.concat(i,'" is out of range'));var l=new t(2).pow(Number(o)-1);return u.gte(l)?u.sub(s):u}return new t(i)},BigNumber:function(i){return i},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),Fraction:function(i){return new t(i.n).div(i.d).times(i.s)},null:function(i){return new t(0)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var ZW="complex",JW=["typed","Complex"],N0=T(ZW,JW,n=>{var{typed:e,Complex:t}=n;return e("complex",{"":function(){return t.ZERO},number:function(i){return new t(i,0)},"number, number":function(i,a){return new t(i,a)},"BigNumber, BigNumber":function(i,a){return new t(i.toNumber(),a.toNumber())},Fraction:function(i){return new t(i.valueOf(),0)},Complex:function(i){return i.clone()},string:function(i){return t(i)},null:function(i){return t(0)},Object:function(i){if("re"in i&&"im"in i)return new t(i.re,i.im);if("r"in i&&"phi"in i||"abs"in i&&"arg"in i)return new t(i);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var XW="fraction",QW=["typed","Fraction"],T0=T(XW,QW,n=>{var{typed:e,Fraction:t}=n;return e("fraction",{number:function(i){if(!isFinite(i)||isNaN(i))throw new Error(i+" cannot be represented as a fraction");return new t(i)},string:function(i){return new t(i)},"number, number":function(i,a){return new t(i,a)},null:function(i){return new t(0)},BigNumber:function(i){return new t(i.toString())},Fraction:function(i){return i},Unit:e.referToSelf(r=>i=>{var a=i.clone();return a.value=r(i.value),a}),Object:function(i){return new t(i)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var YT="matrix",KW=["typed","Matrix","DenseMatrix","SparseMatrix"],C0=T(YT,KW,n=>{var{typed:e,Matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e(YT,{"":function(){return a([])},string:function(u){return a([],u)},"string, string":function(u,s){return a([],u,s)},Array:function(u){return a(u)},Matrix:function(u){return a(u,u.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(o,u,s){if(u==="dense"||u==="default"||u===void 0)return new r(o,s);if(u==="sparse")return new i(o,s);throw new TypeError("Unknown matrix type "+JSON.stringify(u)+".")}});var jT="matrixFromFunction",eY=["typed","matrix","isZero"],F0=T(jT,eY,n=>{var{typed:e,matrix:t,isZero:r}=n;return e(jT,{"Array | Matrix, function, string, string":function(o,u,s,l){return i(o,u,s,l)},"Array | Matrix, function, string":function(o,u,s){return i(o,u,s)},"Matrix, function":function(o,u){return i(o,u,"dense")},"Array, function":function(o,u){return i(o,u,"dense").toArray()},"Array | Matrix, string, function":function(o,u,s){return i(o,s,u)},"Array | Matrix, string, string, function":function(o,u,s,l){return i(o,l,u,s)}});function i(a,o,u,s){var l;return s!==void 0?l=t(u,s):l=t(u),l.resize(a),l.forEach(function(c,f){var p=o(f);r(p)||l.set(f,p)}),l}});var ZT="matrixFromRows",tY=["typed","matrix","flatten","size"],I0=T(ZT,tY,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(ZT,{"...Array":function(s){return a(s)},"...Matrix":function(s){return t(a(s.map(l=>l.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one row is needed to construct a matrix.");var s=o(u[0]),l=[];for(var c of u){var f=o(c);if(f!==s)throw new TypeError("The vectors had different length: "+(s|0)+" \u2260 "+(f|0));l.push(r(c))}return l}function o(u){var s=i(u);if(s.length===1)return s[0];if(s.length===2){if(s[0]===1)return s[1];if(s[1]===1)return s[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var JT="matrixFromColumns",rY=["typed","matrix","flatten","size"],P0=T(JT,rY,n=>{var{typed:e,matrix:t,flatten:r,size:i}=n;return e(JT,{"...Array":function(s){return a(s)},"...Matrix":function(s){return t(a(s.map(l=>l.toArray())))}});function a(u){if(u.length===0)throw new TypeError("At least one column is needed to construct a matrix.");for(var s=o(u[0]),l=[],c=0;c<s;c++)l[c]=[];for(var f of u){var p=o(f);if(p!==s)throw new TypeError("The vectors had different length: "+(s|0)+" \u2260 "+(p|0));for(var m=r(f),h=0;h<s;h++)l[h].push(m[h])}return l}function o(u){var s=i(u);if(s.length===1)return s[0];if(s.length===2){if(s[0]===1)return s[1];if(s[1]===1)return s[0];throw new TypeError("At least one of the arguments is not a vector.")}else throw new TypeError("Only one- or two-dimensional vectors are supported.")}});var XT="splitUnit",nY=["typed"],k0=T(XT,nY,n=>{var{typed:e}=n;return e(XT,{"Unit, Array":function(r,i){return r.splitUnit(i)}})});var QT="unaryMinus",iY=["typed"],B0=T(QT,iY,n=>{var{typed:e}=n;return e(QT,{number:_y,"Complex | BigNumber | Fraction":t=>t.neg(),Unit:e.referToSelf(t=>r=>{var i=r.clone();return i.value=e.find(t,i.valueType())(r.value),i}),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t,!0))})});var KT="unaryPlus",aY=["typed","config","BigNumber"],O0=T(KT,aY,n=>{var{typed:e,config:t,BigNumber:r}=n;return e(KT,{number:Sy,Complex:function(a){return a},BigNumber:function(a){return a},Fraction:function(a){return a},Unit:function(a){return a.clone()},"Array | Matrix":e.referToSelf(i=>a=>lt(a,i,!0)),"boolean | string":function(a){return t.number==="BigNumber"?new r(+a):+a}})});var eC="abs",oY=["typed"],R0=T(eC,oY,n=>{var{typed:e}=n;return e(eC,{number:yy,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t,!0))})});var tC="apply",sY=["typed","isInteger"],iu=T(tC,sY,n=>{var{typed:e,isInteger:t}=n;return e(tC,{"Array | Matrix, number | BigNumber, function":function(i,a,o){if(!t(a))throw new TypeError("Integer number expected for dimension");var u=Array.isArray(i)?_t(i):i.size();if(a<0||a>=u.length)throw new $n(a,u.length);return ot(i)?i.create(Om(i.valueOf(),a,o)):Om(i,a,o)}})});function Om(n,e,t){var r,i,a;if(e<=0)if(Array.isArray(n[0])){for(a=uY(n),i=[],r=0;r<a.length;r++)i[r]=Om(a[r],e-1,t);return i}else return t(n);else{for(i=[],r=0;r<n.length;r++)i[r]=Om(n[r],e-1,t);return i}}function uY(n){var e=n.length,t=n[0].length,r,i,a=[];for(i=0;i<t;i++){var o=[];for(r=0;r<e;r++)o.push(n[r][i]);a.push(o)}return a}var rC="addScalar",lY=["typed"],L0=T(rC,lY,n=>{var{typed:e}=n;return e(rC,{"number, number":by,"Complex, Complex":function(r,i){return r.add(i)},"BigNumber, BigNumber":function(r,i){return r.plus(i)},"Fraction, Fraction":function(r,i){return r.add(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var nC="subtractScalar",cY=["typed"],V0=T(nC,cY,n=>{var{typed:e}=n;return e(nC,{"number, number":xy,"Complex, Complex":function(r,i){return r.sub(i)},"BigNumber, BigNumber":function(r,i){return r.minus(i)},"Fraction, Fraction":function(r,i){return r.sub(i)},"Unit, Unit":e.referToSelf(t=>(r,i)=>{if(r.value===null||r.value===void 0)throw new Error("Parameter x contains a unit with undefined value");if(i.value===null||i.value===void 0)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(i))throw new Error("Units do not match");var a=r.clone();return a.value=e.find(t,[a.valueType(),i.valueType()])(a.value,i.value),a.fixPrefix=!1,a})})});var iC="cbrt",fY=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],U0=T(iC,fY,n=>{var{config:e,typed:t,isNegative:r,unaryMinus:i,matrix:a,Complex:o,BigNumber:u,Fraction:s}=n;return t(iC,{number:ml,Complex:l,"Complex, boolean":l,BigNumber:function(p){return p.cbrt()},Unit:c});function l(f,p){var m=f.arg()/3,h=f.abs(),d=new o(ml(h),0).mul(new o(0,m).exp());if(p){var g=[d,new o(ml(h),0).mul(new o(0,m+Math.PI*2/3).exp()),new o(ml(h),0).mul(new o(0,m-Math.PI*2/3).exp())];return e.matrix==="Array"?g:a(g)}else return d}function c(f){if(f.value&&gi(f.value)){var p=f.clone();return p.value=1,p=p.pow(1/3),p.value=l(f.value),p}else{var m=r(f.value);m&&(f.value=i(f.value));var h;pt(f.value)?h=new u(1).div(3):Ao(f.value)?h=new s(1,3):h=1/3;var d=f.pow(h);return m&&(d.value=i(d.value)),d}}});var pY="matAlgo11xS0s",mY=["typed","equalScalar"],xr=T(pY,mY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=t,y=0,S=o;typeof p=="string"&&(d=p,g=e.find(t,[d,d]),y=e.convert(0,d),a=e.convert(a,d),S=e.find(o,[d,d]));for(var b=[],w=[],A=[],x=0;x<h;x++){A[x]=w.length;for(var D=c[x],E=c[x+1],_=D;_<E;_++){var N=l[_],P=u?S(a,s[_]):S(s[_],a);g(P,y)||(w.push(N),b.push(P))}}return A[h]=w.length,i.createSparseMatrix({values:b,index:w,ptr:A,size:[m,h],datatype:d})}});var dY="matAlgo12xSfs",hY=["typed","DenseMatrix"],cr=T(dY,hY,n=>{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var y=[],S=[],b=[],w=0;w<h;w++){for(var A=w+1,x=c[w],D=c[w+1],E=x;E<D;E++){var _=l[E];S[_]=s[E],b[_]=A}for(var N=0;N<m;N++)w===0&&(y[N]=[]),b[N]===A?y[N][w]=u?g(a,S[N]):g(S[N],a):y[N][w]=u?g(a,0):g(0,a)}return new t({data:y,size:[m,h],datatype:d})}});var gY="matAlgo14xDs",vY=["typed"],pn=T(gY,vY,n=>{var{typed:e}=n;return function(i,a,o,u){var s=i._data,l=i._size,c=i._datatype,f,p=o;typeof c=="string"&&(f=c,a=e.convert(a,f),p=e.find(o,[f,f]));var m=l.length>0?t(p,0,l,l[0],s,a,u):[];return i.createDenseMatrix({data:m,size:vt(l),datatype:f})};function t(r,i,a,o,u,s,l){var c=[];if(i===a.length-1)for(var f=0;f<o;f++)c[f]=l?r(s,u[f]):r(u[f],s);else for(var p=0;p<o;p++)c[p]=t(r,i+1,a,a[i+1],u[p],s,l);return c}});var q0="ceil",yY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],bY=T(q0,["typed","config","round"],n=>{var{typed:e,config:t,round:r}=n;return e(q0,{number:function(a){return Jr(a,r(a),t.epsilon)?r(a):Math.ceil(a)},"number, number":function(a,o){if(Jr(a,r(a,o),t.epsilon))return r(a,o);var[u,s]="".concat(a,"e").split("e"),l=Math.ceil(Number("".concat(u,"e").concat(Number(s)+o)));return[u,s]="".concat(l,"e").split("e"),Number("".concat(u,"e").concat(Number(s)-o))}})}),z0=T(q0,yY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:a}),l=cr({typed:e,DenseMatrix:u}),c=pn({typed:e}),f=bY({typed:e,config:t,round:r});return e("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.ceil()},"Complex, number":function(m,h){return m.ceil(h)},"Complex, BigNumber":function(m,h){return m.ceil(h.toNumber())},BigNumber:function(m){return gn(m,r(m),t.epsilon)?r(m):m.ceil()},"BigNumber, BigNumber":function(m,h){return gn(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),tu.ROUND_CEIL)},Fraction:function(m){return m.ceil()},"Fraction, number":function(m,h){return m.ceil(h)},"Fraction, BigNumber":function(m,h){return m.ceil(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>lt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):l(h,m,p,!0))})});var aC="cube",xY=["typed"],$0=T(aC,xY,n=>{var{typed:e}=n;return e(aC,{number:Ay,Complex:function(r){return r.mul(r).mul(r)},BigNumber:function(r){return r.times(r).times(r)},Fraction:function(r){return r.pow(3)},Unit:function(r){return r.pow(3)}})});var oC="exp",wY=["typed"],H0=T(oC,wY,n=>{var{typed:e}=n;return e(oC,{number:My,Complex:function(r){return r.exp()},BigNumber:function(r){return r.exp()}})});var sC="expm1",_Y=["typed","Complex"],G0=T(sC,_Y,n=>{var{typed:e,Complex:t}=n;return e(sC,{number:Ey,Complex:function(i){var a=Math.exp(i.re);return new t(a*Math.cos(i.im)-1,a*Math.sin(i.im))},BigNumber:function(i){return i.exp().minus(1)}})});var W0="fix",SY=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],AY=T(W0,["typed","ceil","floor"],n=>{var{typed:e,ceil:t,floor:r}=n;return e(W0,{number:function(a){return a>0?r(a):t(a)},"number, number":function(a,o){return a>0?r(a,o):t(a,o)}})}),Y0=T(W0,SY,n=>{var{typed:e,Complex:t,matrix:r,ceil:i,floor:a,equalScalar:o,zeros:u,DenseMatrix:s}=n,l=cr({typed:e,DenseMatrix:s}),c=pn({typed:e}),f=AY({typed:e,ceil:i,floor:a});return e("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(m){return new t(m.re>0?Math.floor(m.re):Math.ceil(m.re),m.im>0?Math.floor(m.im):Math.ceil(m.im))},"Complex, number":function(m,h){return new t(m.re>0?a(m.re,h):i(m.re,h),m.im>0?a(m.im,h):i(m.im,h))},"Complex, BigNumber":function(m,h){var d=h.toNumber();return new t(m.re>0?a(m.re,d):i(m.re,d),m.im>0?a(m.im,d):i(m.im,d))},BigNumber:function(m){return m.isNegative()?i(m):a(m)},"BigNumber, number | BigNumber":function(m,h){return m.isNegative()?i(m,h):a(m,h)},Fraction:function(m){return m.s<0?m.ceil():m.floor()},"Fraction, number | BigNumber":function(m,h){return m.s<0?i(m,h):a(m,h)},"Array | Matrix":e.referToSelf(p=>m=>lt(m,p,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(r(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>o(m,0)?u(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):l(h,m,p,!0))})});var j0="floor",MY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],EY=T(j0,["typed","config","round"],n=>{var{typed:e,config:t,round:r}=n;return e(j0,{number:function(a){return Jr(a,r(a),t.epsilon)?r(a):Math.floor(a)},"number, number":function(a,o){if(Jr(a,r(a,o),t.epsilon))return r(a,o);var[u,s]="".concat(a,"e").split("e"),l=Math.floor(Number("".concat(u,"e").concat(Number(s)+o)));return[u,s]="".concat(l,"e").split("e"),Number("".concat(u,"e").concat(Number(s)-o))}})}),Fc=T(j0,MY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:a}),l=cr({typed:e,DenseMatrix:u}),c=pn({typed:e}),f=EY({typed:e,config:t,round:r});return e("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(m){return m.floor()},"Complex, number":function(m,h){return m.floor(h)},"Complex, BigNumber":function(m,h){return m.floor(h.toNumber())},BigNumber:function(m){return gn(m,r(m),t.epsilon)?r(m):m.floor()},"BigNumber, BigNumber":function(m,h){return gn(m,r(m,h),t.epsilon)?r(m,h):m.toDecimalPlaces(h.toNumber(),tu.ROUND_FLOOR)},Fraction:function(m){return m.floor()},"Fraction, number":function(m,h){return m.floor(h)},"Fraction, BigNumber":function(m,h){return m.floor(h.toNumber())},"Array | Matrix":e.referToSelf(p=>m=>lt(m,p,!0)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>lt(m,d=>p(d,h),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(p=>(m,h)=>c(i(h),m,p,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(p=>(m,h)=>a(m,0)?o(h.size(),h.storage()):h.storage()==="dense"?c(h,m,p,!0):l(h,m,p,!0))})});var DY="matAlgo02xDS0",NY=["typed","equalScalar"],mn=T(DY,NY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o,u){var s=i._data,l=i._size,c=i._datatype||i.getDataType(),f=a._values,p=a._index,m=a._ptr,h=a._size,d=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(l.length!==h.length)throw new Dt(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=l[0],y=l[1],S,b=t,w=0,A=o;typeof c=="string"&&c===d&&c!=="mixed"&&(S=c,b=e.find(t,[S,S]),w=e.convert(0,S),A=e.find(o,[S,S]));for(var x=[],D=[],E=[],_=0;_<y;_++){E[_]=D.length;for(var N=m[_],P=m[_+1],B=N;B<P;B++){var V=p[B],z=u?A(f[B],s[V][_]):A(s[V][_],f[B]);b(z,w)||(D.push(V),x.push(z))}}return E[y]=D.length,a.createSparseMatrix({values:x,index:D,ptr:E,size:[g,y],datatype:c===i._datatype&&d===a._datatype?S:void 0})}});var TY="matAlgo03xDSf",CY=["typed"],kr=T(TY,CY,n=>{var{typed:e}=n;return function(r,i,a,o){var u=r._data,s=r._size,l=r._datatype||r.getDataType(),c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==m.length)throw new Dt(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=s[0],g=s[1],y,S=0,b=a;typeof l=="string"&&l===h&&l!=="mixed"&&(y=l,S=e.convert(0,y),b=e.find(a,[y,y]));for(var w=[],A=0;A<d;A++)w[A]=[];for(var x=[],D=[],E=0;E<g;E++){for(var _=E+1,N=p[E],P=p[E+1],B=N;B<P;B++){var V=f[B];x[V]=o?b(c[B],u[V][E]):b(u[V][E],c[B]),D[V]=_}for(var z=0;z<d;z++)D[z]===_?w[z][E]=x[z]:w[z][E]=o?b(S,u[z][E]):b(u[z][E],S)}return r.createDenseMatrix({data:w,size:[d,g],datatype:l===r._datatype&&h===i._datatype?y:void 0})}});var FY="matAlgo05xSfSf",IY=["typed","equalScalar"],ms=T(FY,IY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===g&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=D?[]:void 0,P=D?[]:void 0,B=[],V=[],z,L,k,C;for(L=0;L<S;L++){_[L]=E.length;var W=L+1;for(k=l[L],C=l[L+1];k<C;k++)z=s[k],E.push(z),B[z]=W,N&&(N[z]=u[k]);for(k=h[L],C=h[L+1];k<C;k++)z=m[k],B[z]!==W&&E.push(z),V[z]=W,P&&(P[z]=p[k]);if(D)for(k=_[L];k<E.length;){z=E[k];var O=B[z],H=V[z];if(O===W||H===W){var Z=O===W?N[z]:A,Q=H===W?P[z]:A,U=x(Z,Q);w(U,A)?E.splice(k,1):(D.push(U),k++)}}}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&g===a._datatype?b:void 0})}});var PY="matAlgo13xDD",kY=["typed"],uC=T(PY,kY,n=>{var{typed:e}=n;return function(i,a,o){var u=i._data,s=i._size,l=i._datatype,c=a._data,f=a._size,p=a._datatype,m=[];if(s.length!==f.length)throw new Dt(s.length,f.length);for(var h=0;h<s.length;h++){if(s[h]!==f[h])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+f+")");m[h]=s[h]}var d,g=o;typeof l=="string"&&l===p&&(d=l,g=e.find(o,[d,d]));var y=m.length>0?t(g,0,m,m[0],u,c):[];return i.createDenseMatrix({data:y,size:m,datatype:d})};function t(r,i,a,o,u,s){var l=[];if(i===a.length-1)for(var c=0;c<o;c++)l[c]=r(u[c],s[c]);else for(var f=0;f<o;f++)l[f]=t(r,i+1,a,a[i+1],u[f],s[f]);return l}});var BY="broadcast",OY=["concat"],lC=T(BY,OY,n=>{var{concat:e}=n;return function(i,a){var o=Math.max(i._size.length,a._size.length);if(i._size.length===a._size.length&&i._size.every((h,d)=>h===a._size[d]))return[i,a];for(var u=t(i._size,o,0),s=t(a._size,o,0),l=[],c=0;c<o;c++)l[c]=Math.max(u[c],s[c]);Mc(u,l),Mc(s,l);var f=i.clone(),p=a.clone();f._size.length<o?f.reshape(t(f._size,o,1)):p._size.length<o&&p.reshape(t(p._size,o,1));for(var m=0;m<o;m++)f._size[m]<l[m]&&(f=r(f,l[m],m)),p._size[m]<l[m]&&(p=r(p,l[m],m));return[f,p]};function t(i,a,o){return[...Array(a-i.length).fill(o),...i]}function r(i,a,o){return e(...Array(a).fill(i),o)}});var RY="matrixAlgorithmSuite",LY=["typed","matrix","concat"],Ct=T(RY,LY,n=>{var{typed:e,matrix:t,concat:r}=n,i=uC({typed:e}),a=pn({typed:e}),o=lC({concat:r});return function(s){var l=s.elop,c=s.SD||s.DS,f;l?(f={"DenseMatrix, DenseMatrix":(d,g)=>i(...o(d,g),l),"Array, Array":(d,g)=>i(...o(t(d),t(g)),l).valueOf(),"Array, DenseMatrix":(d,g)=>i(...o(t(d),g),l),"DenseMatrix, Array":(d,g)=>i(...o(d,t(g)),l)},s.SS&&(f["SparseMatrix, SparseMatrix"]=(d,g)=>s.SS(...o(d,g),l,!1)),s.DS&&(f["DenseMatrix, SparseMatrix"]=(d,g)=>s.DS(...o(d,g),l,!1),f["Array, SparseMatrix"]=(d,g)=>s.DS(...o(t(d),g),l,!1)),c&&(f["SparseMatrix, DenseMatrix"]=(d,g)=>c(...o(g,d),l,!0),f["SparseMatrix, Array"]=(d,g)=>c(...o(t(g),d),l,!0))):(f={"DenseMatrix, DenseMatrix":e.referToSelf(d=>(g,y)=>i(...o(g,y),d)),"Array, Array":e.referToSelf(d=>(g,y)=>i(...o(t(g),t(y)),d).valueOf()),"Array, DenseMatrix":e.referToSelf(d=>(g,y)=>i(...o(t(g),y),d)),"DenseMatrix, Array":e.referToSelf(d=>(g,y)=>i(...o(g,t(y)),d))},s.SS&&(f["SparseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,y)=>s.SS(...o(g,y),d,!1))),s.DS&&(f["DenseMatrix, SparseMatrix"]=e.referToSelf(d=>(g,y)=>s.DS(...o(g,y),d,!1)),f["Array, SparseMatrix"]=e.referToSelf(d=>(g,y)=>s.DS(...o(t(g),y),d,!1))),c&&(f["SparseMatrix, DenseMatrix"]=e.referToSelf(d=>(g,y)=>c(...o(y,g),d,!0)),f["SparseMatrix, Array"]=e.referToSelf(d=>(g,y)=>c(...o(t(y),g),d,!0))));var p=s.scalar||"any",m=s.Ds||s.Ss;m&&(l?(f["DenseMatrix,"+p]=(d,g)=>a(d,g,l,!1),f[p+", DenseMatrix"]=(d,g)=>a(g,d,l,!0),f["Array,"+p]=(d,g)=>a(t(d),g,l,!1).valueOf(),f[p+", Array"]=(d,g)=>a(t(g),d,l,!0).valueOf()):(f["DenseMatrix,"+p]=e.referToSelf(d=>(g,y)=>a(g,y,d,!1)),f[p+", DenseMatrix"]=e.referToSelf(d=>(g,y)=>a(y,g,d,!0)),f["Array,"+p]=e.referToSelf(d=>(g,y)=>a(t(g),y,d,!1).valueOf()),f[p+", Array"]=e.referToSelf(d=>(g,y)=>a(t(y),g,d,!0).valueOf())));var h=s.sS!==void 0?s.sS:s.Ss;return l?(s.Ss&&(f["SparseMatrix,"+p]=(d,g)=>s.Ss(d,g,l,!1)),h&&(f[p+", SparseMatrix"]=(d,g)=>h(g,d,l,!0))):(s.Ss&&(f["SparseMatrix,"+p]=e.referToSelf(d=>(g,y)=>s.Ss(g,y,d,!1))),h&&(f[p+", SparseMatrix"]=e.referToSelf(d=>(g,y)=>h(y,g,d,!0)))),l&&l.signatures&&dm(f,l.signatures),f}});var cC="mod",VY=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],Ic=T(cC,VY,n=>{var{typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u,concat:s}=n,l=Fc({typed:e,config:t,round:r,matrix:i,equalScalar:a,zeros:o,DenseMatrix:u}),c=mn({typed:e,equalScalar:a}),f=kr({typed:e}),p=ms({typed:e,equalScalar:a}),m=xr({typed:e,equalScalar:a}),h=cr({typed:e,DenseMatrix:u}),d=Ct({typed:e,matrix:i,concat:s});return e(cC,{"number, number":g,"BigNumber, BigNumber":function(S,b){return b.isZero()?S:S.sub(b.mul(l(S.div(b))))},"Fraction, Fraction":function(S,b){return b.equals(0)?S:S.sub(b.mul(l(S.div(b))))}},d({SS:p,DS:f,SD:c,Ss:m,sS:h}));function g(y,S){return S===0?y:y-S*l(y/S)}});var UY="matAlgo01xDSid",qY=["typed"],ri=T(UY,qY,n=>{var{typed:e}=n;return function(r,i,a,o){var u=r._data,s=r._size,l=r._datatype||r.getDataType(),c=i._values,f=i._index,p=i._ptr,m=i._size,h=i._datatype||i._data===void 0?i._datatype:i.getDataType();if(s.length!==m.length)throw new Dt(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=s[0],g=s[1],y=typeof l=="string"&&l!=="mixed"&&l===h?l:void 0,S=y?e.find(a,[y,y]):a,b,w,A=[];for(b=0;b<d;b++)A[b]=[];var x=[],D=[];for(w=0;w<g;w++){for(var E=w+1,_=p[w],N=p[w+1],P=_;P<N;P++)b=f[P],x[b]=o?S(c[P],u[b][w]):S(u[b][w],c[P]),D[b]=E;for(b=0;b<d;b++)D[b]===E?A[b][w]=x[b]:A[b][w]=u[b][w]}return r.createDenseMatrix({data:A,size:[d,g],datatype:l===r._datatype&&h===i._datatype?y:void 0})}});var zY="matAlgo04xSidSid",$Y=["typed","equalScalar"],gl=T(zY,$Y,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===g&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=u&&p?[]:void 0,P=u&&p?[]:void 0,B=[],V=[],z,L,k,C,W;for(L=0;L<S;L++){_[L]=E.length;var O=L+1;for(C=l[L],W=l[L+1],k=C;k<W;k++)z=s[k],E.push(z),B[z]=O,N&&(N[z]=u[k]);for(C=h[L],W=h[L+1],k=C;k<W;k++)if(z=m[k],B[z]===O){if(N){var H=x(N[z],p[k]);w(H,A)?B[z]=null:N[z]=H}}else E.push(z),V[z]=O,P&&(P[z]=p[k]);if(N&&P)for(k=_[L];k<E.length;)z=E[k],B[z]===O?(D[k]=N[z],k++):V[z]===O?(D[k]=P[z],k++):E.splice(k,1)}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&g===a._datatype?b:void 0})}});var HY="matAlgo10xSids",GY=["typed","DenseMatrix"],Ti=T(HY,GY,n=>{var{typed:e,DenseMatrix:t}=n;return function(i,a,o,u){var s=i._values,l=i._index,c=i._ptr,f=i._size,p=i._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=f[0],h=f[1],d,g=o;typeof p=="string"&&(d=p,a=e.convert(a,d),g=e.find(o,[d,d]));for(var y=[],S=[],b=[],w=0;w<h;w++){for(var A=w+1,x=c[w],D=c[w+1],E=x;E<D;E++){var _=l[E];S[_]=s[E],b[_]=A}for(var N=0;N<m;N++)w===0&&(y[N]=[]),b[N]===A?y[N][w]=u?g(a,S[N]):g(S[N],a):y[N][w]=a}return new t({data:y,size:[m,h],datatype:d})}});function To(n,e,t,r){if(!(this instanceof To))throw new SyntaxError("Constructor must be called with the new operator");this.fn=n,this.count=e,this.min=t,this.max=r,this.message="Wrong number of arguments in function "+n+" ("+e+" provided, "+t+(r!=null?"-"+r:"")+" expected)",this.stack=new Error().stack}To.prototype=new Error;To.prototype.constructor=Error;To.prototype.name="ArgumentsError";To.prototype.isArgumentsError=!0;var fC="gcd",WY=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],Z0="number | BigNumber | Fraction | Matrix | Array",YY="".concat(Z0,", ").concat(Z0,", ...").concat(Z0);function pC(n){return!n.some(e=>Array.isArray(e))}var J0=T(fC,WY,n=>{var{typed:e,matrix:t,config:r,round:i,equalScalar:a,zeros:o,BigNumber:u,DenseMatrix:s,concat:l}=n,c=Ic({typed:e,config:r,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:s,concat:l}),f=ri({typed:e}),p=gl({typed:e,equalScalar:a}),m=Ti({typed:e,DenseMatrix:s}),h=Ct({typed:e,matrix:t,concat:l});return e(fC,{"number, number":d,"BigNumber, BigNumber":g,"Fraction, Fraction":(y,S)=>y.gcd(S)},h({SS:p,DS:f,Ss:m}),{[YY]:e.referToSelf(y=>(S,b,w)=>{for(var A=y(S,b),x=0;x<w.length;x++)A=y(A,w[x]);return A}),Array:e.referToSelf(y=>S=>{if(S.length===1&&Array.isArray(S[0])&&pC(S[0]))return y(...S[0]);if(pC(S))return y(...S);throw new To("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(y=>S=>y(S.toArray()))});function d(y,S){if(!nt(y)||!nt(S))throw new Error("Parameters in function gcd must be integer numbers");for(var b;S!==0;)b=c(y,S),y=S,S=b;return y<0?-y:y}function g(y,S){if(!y.isInt()||!S.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var b=new u(0);!S.isZero();){var w=c(y,S);y=S,S=w}return y.lt(b)?y.neg():y}});var jY="matAlgo06xS0S0",ZY=["typed","equalScalar"],ds=T(jY,ZY,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._size,l=i._datatype||i._data===void 0?i._datatype:i.getDataType(),c=a._values,f=a._size,p=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(s.length!==f.length)throw new Dt(s.length,f.length);if(s[0]!==f[0]||s[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+f+")");var m=s[0],h=s[1],d,g=t,y=0,S=o;typeof l=="string"&&l===p&&l!=="mixed"&&(d=l,g=e.find(t,[d,d]),y=e.convert(0,d),S=e.find(o,[d,d]));for(var b=u&&c?[]:void 0,w=[],A=[],x=b?[]:void 0,D=[],E=[],_=0;_<h;_++){A[_]=w.length;var N=_+1;if(gy(i,_,D,x,E,N,w,S),gy(a,_,D,x,E,N,w,S),x)for(var P=A[_];P<w.length;){var B=w[P];if(E[B]===N){var V=x[B];g(V,y)?w.splice(P,1):(b.push(V),P++)}else w.splice(P,1)}else for(var z=A[_];z<w.length;){var L=w[z];E[L]!==N?w.splice(z,1):z++}}return A[h]=w.length,i.createSparseMatrix({values:b,index:w,ptr:A,size:[m,h],datatype:l===i._datatype&&p===a._datatype?d:void 0})}});var mC="lcm",JY=["typed","matrix","equalScalar","concat"],X0=T(mC,JY,n=>{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=mn({typed:e,equalScalar:r}),o=ds({typed:e,equalScalar:r}),u=xr({typed:e,equalScalar:r}),s=Ct({typed:e,matrix:t,concat:i}),l="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(l,", ").concat(l,", ...").concat(l)]=e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),y=0;y<d.length;y++)g=p(g,d[y]);return g}),e(mC,{"number, number":Dy,"BigNumber, BigNumber":f,"Fraction, Fraction":(p,m)=>p.lcm(m)},s({SS:o,DS:a,Ss:u}),c);function f(p,m){if(!p.isInt()||!m.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(p.isZero())return p;if(m.isZero())return m;for(var h=p.times(m);!m.isZero();){var d=m;m=p.mod(d),p=d}return h.div(p).abs()}});var dC="log10",XY=["typed","config","Complex"],Q0=T(dC,XY,n=>{var{typed:e,config:t,Complex:r}=n;return e(dC,{number:function(a){return a>=0||t.predictable?Ny(a):new r(a,0).log().div(Math.LN10)},Complex:function(a){return new r(a).log().div(Math.LN10)},BigNumber:function(a){return!a.isNegative()||t.predictable?a.log():new r(a.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(i=>a=>lt(a,i))})});var hC="log2",QY=["typed","config","Complex"],K0=T(hC,QY,n=>{var{typed:e,config:t,Complex:r}=n;return e(hC,{number:function(o){return o>=0||t.predictable?Ty(o):i(new r(o,0))},Complex:i,BigNumber:function(o){return!o.isNegative()||t.predictable?o.log(2):i(new r(o.toNumber(),0))},"Array | Matrix":e.referToSelf(a=>o=>lt(o,a))});function i(a){var o=Math.sqrt(a.re*a.re+a.im*a.im);return new r(Math.log2?Math.log2(o):Math.log(o)/Math.LN2,Math.atan2(a.im,a.re)/Math.LN2)}});var KY="multiplyScalar",ej=["typed"],eb=T(KY,ej,n=>{var{typed:e}=n;return e("multiplyScalar",{"number, number":wy,"Complex, Complex":function(r,i){return r.mul(i)},"BigNumber, BigNumber":function(r,i){return r.times(i)},"Fraction, Fraction":function(r,i){return r.mul(i)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})});var gC="multiply",tj=["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],tb=T(gC,tj,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,equalScalar:a,dot:o}=n,u=xr({typed:e,equalScalar:a}),s=pn({typed:e});function l(A,x){switch(A.length){case 1:switch(x.length){case 1:if(A[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(A[0]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+A[0]+") must match Matrix rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;case 2:switch(x.length){case 1:if(A[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+A[1]+") must match Vector length ("+x[0]+")");break;case 2:if(A[1]!==x[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+A[1]+") must match Matrix B rows ("+x[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+x.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+A.length+" dimensions)")}}function c(A,x,D){if(D===0)throw new Error("Cannot multiply two empty vectors");return o(A,x)}function f(A,x){if(x.storage()!=="dense")throw new Error("Support for SparseMatrix not implemented");return p(A,x)}function p(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._size,B=x._datatype||x.getDataType(),V=E[0],z=P[1],L,k=r,C=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&(L=_,k=e.find(r,[L,L]),C=e.find(i,[L,L]));for(var W=[],O=0;O<z;O++){for(var H=C(D[0],N[0][O]),Z=1;Z<V;Z++)H=k(H,C(D[Z],N[Z][O]));W[O]=H}return A.createDenseMatrix({data:W,size:[z],datatype:_===A._datatype&&B===x._datatype?L:void 0})}var m=e("_multiplyMatrixVector",{"DenseMatrix, any":d,"SparseMatrix, any":S}),h=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":g,"DenseMatrix, SparseMatrix":y,"SparseMatrix, DenseMatrix":b,"SparseMatrix, SparseMatrix":w});function d(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._datatype||x.getDataType(),B=E[0],V=E[1],z,L=r,k=i;_&&P&&_===P&&typeof _=="string"&&_!=="mixed"&&(z=_,L=e.find(r,[z,z]),k=e.find(i,[z,z]));for(var C=[],W=0;W<B;W++){for(var O=D[W],H=k(O[0],N[0]),Z=1;Z<V;Z++)H=L(H,k(O[Z],N[Z]));C[W]=H}return A.createDenseMatrix({data:C,size:[B],datatype:_===A._datatype&&P===x._datatype?z:void 0})}function g(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._data,P=x._size,B=x._datatype||x.getDataType(),V=E[0],z=E[1],L=P[1],k,C=r,W=i;_&&B&&_===B&&typeof _=="string"&&_!=="mixed"&&_!=="mixed"&&(k=_,C=e.find(r,[k,k]),W=e.find(i,[k,k]));for(var O=[],H=0;H<V;H++){var Z=D[H];O[H]=[];for(var Q=0;Q<L;Q++){for(var U=W(Z[0],N[0][Q]),me=1;me<z;me++)U=C(U,W(Z[me],N[me][Q]));O[H][Q]=U}}return A.createDenseMatrix({data:O,size:[V,L],datatype:_===A._datatype&&B===x._datatype?k:void 0})}function y(A,x){var D=A._data,E=A._size,_=A._datatype||A.getDataType(),N=x._values,P=x._index,B=x._ptr,V=x._size,z=x._datatype||x._data===void 0?x._datatype:x.getDataType();if(!N)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var L=E[0],k=V[1],C,W=r,O=i,H=a,Z=0;_&&z&&_===z&&typeof _=="string"&&_!=="mixed"&&(C=_,W=e.find(r,[C,C]),O=e.find(i,[C,C]),H=e.find(a,[C,C]),Z=e.convert(0,C));for(var Q=[],U=[],me=[],De=x.createSparseMatrix({values:Q,index:U,ptr:me,size:[L,k],datatype:_===A._datatype&&z===x._datatype?C:void 0}),pe=0;pe<k;pe++){me[pe]=U.length;var _e=B[pe],Ne=B[pe+1];if(Ne>_e)for(var Se=0,Me=0;Me<L;Me++){for(var Ee=Me+1,Ce=void 0,Ge=_e;Ge<Ne;Ge++){var We=P[Ge];Se!==Ee?(Ce=O(D[Me][We],N[Ge]),Se=Ee):Ce=W(Ce,O(D[Me][We],N[Ge]))}Se===Ee&&!H(Ce,Z)&&(U.push(Me),Q.push(Ce))}}return me[k]=U.length,De}function S(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType();if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=x._data,B=x._datatype||x.getDataType(),V=A._size[0],z=x._size[0],L=[],k=[],C=[],W,O=r,H=i,Z=a,Q=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(r,[W,W]),H=e.find(i,[W,W]),Z=e.find(a,[W,W]),Q=e.convert(0,W));var U=[],me=[];C[0]=0;for(var De=0;De<z;De++){var pe=P[De];if(!Z(pe,Q))for(var _e=_[De],Ne=_[De+1],Se=_e;Se<Ne;Se++){var Me=E[Se];me[Me]?U[Me]=O(U[Me],H(pe,D[Se])):(me[Me]=!0,k.push(Me),U[Me]=H(pe,D[Se]))}}for(var Ee=k.length,Ce=0;Ce<Ee;Ce++){var Ge=k[Ce];L[Ce]=U[Ge]}return C[1]=k.length,A.createSparseMatrix({values:L,index:k,ptr:C,size:[V,1],datatype:N===A._datatype&&B===x._datatype?W:void 0})}function b(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType();if(!D)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var P=x._data,B=x._datatype||x.getDataType(),V=A._size[0],z=x._size[0],L=x._size[1],k,C=r,W=i,O=a,H=0;N&&B&&N===B&&typeof N=="string"&&N!=="mixed"&&(k=N,C=e.find(r,[k,k]),W=e.find(i,[k,k]),O=e.find(a,[k,k]),H=e.convert(0,k));for(var Z=[],Q=[],U=[],me=A.createSparseMatrix({values:Z,index:Q,ptr:U,size:[V,L],datatype:N===A._datatype&&B===x._datatype?k:void 0}),De=[],pe=[],_e=0;_e<L;_e++){U[_e]=Q.length;for(var Ne=_e+1,Se=0;Se<z;Se++){var Me=P[Se][_e];if(!O(Me,H))for(var Ee=_[Se],Ce=_[Se+1],Ge=Ee;Ge<Ce;Ge++){var We=E[Ge];pe[We]!==Ne?(pe[We]=Ne,Q.push(We),De[We]=W(Me,D[Ge])):De[We]=C(De[We],W(Me,D[Ge]))}}for(var te=U[_e],oe=Q.length,he=te;he<oe;he++){var ie=Q[he];Z[he]=De[ie]}}return U[L]=Q.length,me}function w(A,x){var D=A._values,E=A._index,_=A._ptr,N=A._datatype||A._data===void 0?A._datatype:A.getDataType(),P=x._values,B=x._index,V=x._ptr,z=x._datatype||x._data===void 0?x._datatype:x.getDataType(),L=A._size[0],k=x._size[1],C=D&&P,W,O=r,H=i;N&&z&&N===z&&typeof N=="string"&&N!=="mixed"&&(W=N,O=e.find(r,[W,W]),H=e.find(i,[W,W]));for(var Z=C?[]:void 0,Q=[],U=[],me=A.createSparseMatrix({values:Z,index:Q,ptr:U,size:[L,k],datatype:N===A._datatype&&z===x._datatype?W:void 0}),De=C?[]:void 0,pe=[],_e,Ne,Se,Me,Ee,Ce,Ge,We,te=0;te<k;te++){U[te]=Q.length;var oe=te+1;for(Ee=V[te],Ce=V[te+1],Me=Ee;Me<Ce;Me++)if(We=B[Me],C)for(Ne=_[We],Se=_[We+1],_e=Ne;_e<Se;_e++)Ge=E[_e],pe[Ge]!==oe?(pe[Ge]=oe,Q.push(Ge),De[Ge]=H(P[Me],D[_e])):De[Ge]=O(De[Ge],H(P[Me],D[_e]));else for(Ne=_[We],Se=_[We+1],_e=Ne;_e<Se;_e++)Ge=E[_e],pe[Ge]!==oe&&(pe[Ge]=oe,Q.push(Ge));if(C)for(var he=U[te],ie=Q.length,re=he;re<ie;re++){var le=Q[re];Z[re]=De[le]}}return U[k]=Q.length,me}return e(gC,i,{"Array, Array":e.referTo("Matrix, Matrix",A=>(x,D)=>{l(_t(x),_t(D));var E=A(t(x),t(D));return ot(E)?E.valueOf():E}),"Matrix, Matrix":function(x,D){var E=x.size(),_=D.size();return l(E,_),E.length===1?_.length===1?c(x,D,E[0]):f(x,D):_.length===1?m(x,D):h(x,D)},"Matrix, Array":e.referTo("Matrix,Matrix",A=>(x,D)=>A(x,t(D))),"Array, Matrix":e.referToSelf(A=>(x,D)=>A(t(x,D.storage()),D)),"SparseMatrix, any":function(x,D){return u(x,D,i,!1)},"DenseMatrix, any":function(x,D){return s(x,D,i,!1)},"any, SparseMatrix":function(x,D){return u(D,x,i,!0)},"any, DenseMatrix":function(x,D){return s(D,x,i,!0)},"Array, any":function(x,D){return s(t(x),D,i,!1).valueOf()},"any, Array":function(x,D){return s(t(D),x,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(A=>(x,D,E)=>{for(var _=A(x,D),N=0;N<E.length;N++)_=A(_,E[N]);return _})})});var vC="nthRoot",rj=["typed","matrix","equalScalar","BigNumber","concat"],rb=T(vC,rj,n=>{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,concat:a}=n,o=ri({typed:e}),u=mn({typed:e,equalScalar:r}),s=ds({typed:e,equalScalar:r}),l=xr({typed:e,equalScalar:r}),c=Ct({typed:e,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(vC,{number:Cy,"number, number":Cy,BigNumber:m=>p(m,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:e.referTo("DenseMatrix,number",m=>h=>m(t(h),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",m=>h=>m(h,2)),SparseMatrix:e.referTo("SparseMatrix,number",m=>h=>m(h,2)),"SparseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return s(h,d,m);throw new Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return o(h,d,m,!1);throw new Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",m=>(h,d)=>m(t(h),d)),"number | BigNumber, SparseMatrix":e.referToSelf(m=>(h,d)=>{if(d.density()===1)return l(d,h,m,!0);throw new Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:u,Ss:l,sS:!1}));function p(m,h){var d=i.precision,g=i.clone({precision:d+2}),y=new i(0),S=new g(1),b=h.isNegative();if(b&&(h=h.neg()),h.isZero())throw new Error("Root must be non-zero");if(m.isNegative()&&!h.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(m.isZero())return b?new g(1/0):0;if(!m.isFinite())return b?y:m;var w=m.abs().pow(S.div(h));return w=m.isNeg()?w.neg():w,new i((b?S.div(w):w).toPrecision(d))}});var yC="sign",nj=["typed","BigNumber","Fraction","complex"],nb=T(yC,nj,n=>{var{typed:e,BigNumber:t,complex:r,Fraction:i}=n;return e(yC,{number:km,Complex:function(o){return o.im===0?r(km(o.re)):o.sign()},BigNumber:function(o){return new t(o.cmp(0))},Fraction:function(o){return new i(o.s,1)},"Array | Matrix":e.referToSelf(a=>o=>lt(o,a,!0)),Unit:e.referToSelf(a=>o=>{if(!o._isDerived()&&o.units[0].unit.offset!==0)throw new TypeError("sign is ambiguous for units with offset");return e.find(a,o.valueType())(o.value)})})});var ij="sqrt",aj=["config","typed","Complex"],ib=T(ij,aj,n=>{var{config:e,typed:t,Complex:r}=n;return t("sqrt",{number:i,Complex:function(o){return o.sqrt()},BigNumber:function(o){return!o.isNegative()||e.predictable?o.sqrt():i(o.toNumber())},Unit:function(o){return o.pow(.5)}});function i(a){return isNaN(a)?NaN:a>=0||e.predictable?Math.sqrt(a):new r(a,0).sqrt()}});var bC="square",oj=["typed"],ab=T(bC,oj,n=>{var{typed:e}=n;return e(bC,{number:Fy,Complex:function(r){return r.mul(r)},BigNumber:function(r){return r.times(r)},Fraction:function(r){return r.mul(r)},Unit:function(r){return r.pow(2)}})});var xC="subtract",sj=["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],ob=T(xC,sj,n=>{var{typed:e,matrix:t,equalScalar:r,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:u}=n,s=ri({typed:e}),l=kr({typed:e}),c=ms({typed:e,equalScalar:r}),f=Ti({typed:e,DenseMatrix:o}),p=cr({typed:e,DenseMatrix:o}),m=Ct({typed:e,matrix:t,concat:u});return e(xC,{"any, any":i},m({elop:i,SS:c,DS:s,SD:l,Ss:p,sS:f}))});var wC="xgcd",uj=["typed","config","matrix","BigNumber"],sb=T(wC,uj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(wC,{"number, number":function(u,s){var l=Iy(u,s);return t.matrix==="Array"?l:r(l)},"BigNumber, BigNumber":a});function a(o,u){var s,l,c,f=new i(0),p=new i(1),m=f,h=p,d=p,g=f;if(!o.isInt()||!u.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!u.isZero();)l=o.div(u).floor(),c=o.mod(u),s=m,m=h.minus(l.times(m)),h=s,s=d,d=g.minus(l.times(d)),g=s,o=u,u=c;var y;return o.lt(f)?y=[o.neg(),h.neg(),g.neg()]:y=[o,o.isZero()?0:h,g],t.matrix==="Array"?y:r(y)}});var _C="invmod",lj=["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],ub=T(_C,lj,n=>{var{typed:e,config:t,BigNumber:r,xgcd:i,equal:a,smaller:o,mod:u,add:s,isInteger:l}=n;return e(_C,{"number, number":c,"BigNumber, BigNumber":c});function c(f,p){if(!l(f)||!l(p))throw new Error("Parameters in function invmod must be integer numbers");if(f=u(f,p),a(p,0))throw new Error("Divisor must be non zero");var m=i(f,p);m=m.valueOf();var[h,d]=m;return a(h,r(1))?(d=u(d,p),o(d,r(0))&&(d=s(d,p)),d):NaN}});var cj="matAlgo09xS0Sf",fj=["typed","equalScalar"],Rm=T(cj,fj,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");var y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===g&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));var D=u&&p?[]:void 0,E=[],_=[],N=D?[]:void 0,P=[],B,V,z,L,k;for(V=0;V<S;V++){_[V]=E.length;var C=V+1;if(N)for(L=h[V],k=h[V+1],z=L;z<k;z++)B=m[z],P[B]=C,N[B]=p[z];for(L=l[V],k=l[V+1],z=L;z<k;z++)if(B=s[z],N){var W=P[B]===C?N[B]:A,O=x(u[z],W);w(O,A)||(E.push(B),D.push(O))}else E.push(B)}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&g===a._datatype?b:void 0})}});var SC="dotMultiply",pj=["typed","matrix","equalScalar","multiplyScalar","concat"],lb=T(SC,pj,n=>{var{typed:e,matrix:t,equalScalar:r,multiplyScalar:i,concat:a}=n,o=mn({typed:e,equalScalar:r}),u=Rm({typed:e,equalScalar:r}),s=xr({typed:e,equalScalar:r}),l=Ct({typed:e,matrix:t,concat:a});return e(SC,l({elop:i,SS:u,DS:o,Ss:s}))});function AC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitAnd");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero()||e.eq(-1)||n.eq(e))return n;if(e.isZero()||n.eq(-1))return e;if(!n.isFinite()||!e.isFinite()){if(!n.isFinite()&&!e.isFinite())return n.isNegative()===e.isNegative()?n:new t(0);if(!n.isFinite())return e.isNegative()?n:n.isNegative()?new t(0):e;if(!e.isFinite())return n.isNegative()?e:e.isNegative()?new t(0):n}return cb(n,e,function(r,i){return r&i})}function vl(n){if(n.isFinite()&&!n.isInteger())throw new Error("Integer expected in function bitNot");var e=n.constructor,t=e.precision;e.config({precision:1e9});var r=n.plus(new e(1));return r.s=-r.s||null,e.config({precision:t}),r}function MC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitOr");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);var r=new t(-1);return n.isZero()||e.eq(r)||n.eq(e)?e:e.isZero()||n.eq(r)?n:!n.isFinite()||!e.isFinite()?!n.isFinite()&&!n.isNegative()&&e.isNegative()||n.isNegative()&&!e.isNegative()&&!e.isFinite()?r:n.isNegative()&&e.isNegative()?n.isFinite()?n:e:n.isFinite()?e:n:cb(n,e,function(i,a){return i|a})}function cb(n,e,t){var r=n.constructor,i,a,o=+(n.s<0),u=+(e.s<0);if(o){i=Lm(vl(n));for(var s=0;s<i.length;++s)i[s]^=1}else i=Lm(n);if(u){a=Lm(vl(e));for(var l=0;l<a.length;++l)a[l]^=1}else a=Lm(e);var c,f,p;i.length<=a.length?(c=i,f=a,p=o):(c=a,f=i,p=u);var m=c.length,h=f.length,d=t(o,u)^1,g=new r(d^1),y=new r(1),S=new r(2),b=r.precision;for(r.config({precision:1e9});m>0;)t(c[--m],f[--h])===d&&(g=g.plus(y)),y=y.times(S);for(;h>0;)t(p,f[--h])===d&&(g=g.plus(y)),y=y.times(S);return r.config({precision:b}),d===0&&(g.s=-g.s),g}function Lm(n){for(var e=n.d,t=e[0]+"",r=1;r<e.length;++r){for(var i=e[r]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;t.charAt(o)==="0";)o--;var u=n.e,s=t.slice(0,o+1||1),l=s.length;if(u>0)if(++u>l)for(u-=l;u--;)s+="0";else u<l&&(s=s.slice(0,u)+"."+s.slice(u));for(var c=[0],f=0;f<s.length;){for(var p=c.length;p--;)c[p]*=10;c[0]+=parseInt(s.charAt(f++));for(var m=0;m<c.length;++m)c[m]>1&&((c[m+1]===null||c[m+1]===void 0)&&(c[m+1]=0),c[m+1]+=c[m]>>1,c[m]&=1)}return c.reverse()}function EC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function bitXor");var t=n.constructor;if(n.isNaN()||e.isNaN())return new t(NaN);if(n.isZero())return e;if(e.isZero())return n;if(n.eq(e))return new t(0);var r=new t(-1);return n.eq(r)?vl(e):e.eq(r)?vl(n):!n.isFinite()||!e.isFinite()?!n.isFinite()&&!e.isFinite()?r:new t(n.isNegative()===e.isNegative()?1/0:-1/0):cb(n,e,function(i,a){return i^a})}function DC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function leftShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:!n.isFinite()&&!e.isFinite()?new t(NaN):e.lt(55)?n.times(Math.pow(2,e.toNumber())+""):n.times(new t(2).pow(e))}function NC(n,e){if(n.isFinite()&&!n.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=n.constructor;return n.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):n.isZero()||e.isZero()?n:e.isFinite()?e.lt(55)?n.div(Math.pow(2,e.toNumber())+"").floor():n.div(new t(2).pow(e)).floor():n.isNegative()?new t(-1):n.isFinite()?new t(0):new t(NaN)}var TC="bitAnd",mj=["typed","matrix","equalScalar","concat"],Pc=T(TC,mj,n=>{var{typed:e,matrix:t,equalScalar:r,concat:i}=n,a=mn({typed:e,equalScalar:r}),o=ds({typed:e,equalScalar:r}),u=xr({typed:e,equalScalar:r}),s=Ct({typed:e,matrix:t,concat:i});return e(TC,{"number, number":ky,"BigNumber, BigNumber":AC},s({SS:o,DS:a,Ss:u}))});var CC="bitNot",dj=["typed"],fb=T(CC,dj,n=>{var{typed:e}=n;return e(CC,{number:By,BigNumber:vl,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var FC="bitOr",hj=["typed","matrix","equalScalar","DenseMatrix","concat"],kc=T(FC,hj,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=ri({typed:e}),u=gl({typed:e,equalScalar:r}),s=Ti({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e(FC,{"number, number":Oy,"BigNumber, BigNumber":MC},l({SS:u,DS:o,Ss:s}))});var gj="matAlgo07xSSf",vj=["typed","DenseMatrix"],Mn=T(gj,vj,n=>{var{typed:e,DenseMatrix:t}=n;return function(a,o,u){var s=a._size,l=a._datatype||a._data===void 0?a._datatype:a.getDataType(),c=o._size,f=o._datatype||o._data===void 0?o._datatype:o.getDataType();if(s.length!==c.length)throw new Dt(s.length,c.length);if(s[0]!==c[0]||s[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");var p=s[0],m=s[1],h,d=0,g=u;typeof l=="string"&&l===f&&l!=="mixed"&&(h=l,d=e.convert(0,h),g=e.find(u,[h,h]));var y,S,b=[];for(y=0;y<p;y++)b[y]=[];var w=[],A=[],x=[],D=[];for(S=0;S<m;S++){var E=S+1;for(r(a,S,x,w,E),r(o,S,D,A,E),y=0;y<p;y++){var _=x[y]===E?w[y]:d,N=D[y]===E?A[y]:d;b[y][S]=g(_,N)}}return new t({data:b,size:[p,m],datatype:l===a._datatype&&f===o._datatype?h:void 0})};function r(i,a,o,u,s){for(var l=i._values,c=i._index,f=i._ptr,p=f[a],m=f[a+1];p<m;p++){var h=c[p];o[h]=s,u[h]=l[p]}}});var IC="bitXor",yj=["typed","matrix","DenseMatrix","concat"],pb=T(IC,yj,n=>{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=kr({typed:e}),o=Mn({typed:e,DenseMatrix:r}),u=cr({typed:e,DenseMatrix:r}),s=Ct({typed:e,matrix:t,concat:i});return e(IC,{"number, number":Ry,"BigNumber, BigNumber":EC},s({SS:o,DS:a,Ss:u}))});var PC="arg",bj=["typed"],mb=T(PC,bj,n=>{var{typed:e}=n;return e(PC,{number:function(r){return Math.atan2(0,r)},BigNumber:function(r){return r.constructor.atan2(0,r)},Complex:function(r){return r.arg()},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var kC="conj",xj=["typed"],db=T(kC,xj,n=>{var{typed:e}=n;return e(kC,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var BC="im",wj=["typed"],hb=T(BC,wj,n=>{var{typed:e}=n;return e(BC,{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var OC="re",_j=["typed"],gb=T(OC,_j,n=>{var{typed:e}=n;return e(OC,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var RC="not",Sj=["typed"],vb=T(RC,Sj,n=>{var{typed:e}=n;return e(RC,{"null | undefined":()=>!0,number:$y,Complex:function(r){return r.re===0&&r.im===0},BigNumber:function(r){return r.isZero()||r.isNaN()},Unit:e.referToSelf(t=>r=>e.find(t,r.valueType())(r.value)),"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var LC="or",Aj=["typed","matrix","equalScalar","DenseMatrix","concat"],Bc=T(LC,Aj,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=ms({typed:e,equalScalar:r}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e(LC,{"number, number":Hy,"Complex, Complex":function(f,p){return f.re!==0||f.im!==0||p.re!==0||p.im!==0},"BigNumber, BigNumber":function(f,p){return!f.isZero()&&!f.isNaN()||!p.isZero()&&!p.isNaN()},"Unit, Unit":e.referToSelf(c=>(f,p)=>c(f.value||0,p.value||0))},l({SS:u,DS:o,Ss:s}))});var VC="xor",Mj=["typed","matrix","DenseMatrix","concat"],yb=T(VC,Mj,n=>{var{typed:e,matrix:t,DenseMatrix:r,concat:i}=n,a=kr({typed:e}),o=Mn({typed:e,DenseMatrix:r}),u=cr({typed:e,DenseMatrix:r}),s=Ct({typed:e,matrix:t,concat:i});return e(VC,{"number, number":Gy,"Complex, Complex":function(c,f){return(c.re!==0||c.im!==0)!=(f.re!==0||f.im!==0)},"BigNumber, BigNumber":function(c,f){return(!c.isZero()&&!c.isNaN())!=(!f.isZero()&&!f.isNaN())},"Unit, Unit":e.referToSelf(l=>(c,f)=>l(c.value||0,f.value||0))},s({SS:o,DS:a,Ss:u}))});var UC="concat",Ej=["typed","matrix","isInteger"],Oc=T(UC,Ej,n=>{var{typed:e,matrix:t,isInteger:r}=n;return e(UC,{"...Array | Matrix | number | BigNumber":function(a){var o,u=a.length,s=-1,l,c=!1,f=[];for(o=0;o<u;o++){var p=a[o];if(ot(p)&&(c=!0),At(p)||pt(p)){if(o!==u-1)throw new Error("Dimension must be specified as last argument");if(l=s,s=p.valueOf(),!r(s))throw new TypeError("Integer number expected for dimension");if(s<0||o>0&&s>l)throw new $n(s,l+1)}else{var m=vt(p).valueOf(),h=_t(m);if(f[o]=m,l=s,s=h.length-1,o>0&&s!==l)throw new Dt(l+1,s+1)}}if(f.length===0)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=Yv(d,f.shift(),s);return c?t(d):d},"...string":function(a){return a.join("")}})});var qC="column",Dj=["typed","Index","matrix","range"],Rc=T(qC,Dj,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(qC,{"Matrix, number":a,"Array, number":function(u,s){return a(r(vt(u)),s).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");br(u,o.size()[1]);var s=i(0,o.size()[0]),l=new t(s,u),c=o.subset(l);return ot(c)?c:r([[c]])}});var zC="count",Nj=["typed","size","prod"],bb=T(zC,Nj,n=>{var{typed:e,size:t,prod:r}=n;return e(zC,{string:function(a){return a.length},"Matrix | Array":function(a){return r(t(a))}})});var $C="cross",Tj=["typed","matrix","subtract","multiply"],xb=T($C,Tj,n=>{var{typed:e,matrix:t,subtract:r,multiply:i}=n;return e($C,{"Matrix, Matrix":function(u,s){return t(a(u.toArray(),s.toArray()))},"Matrix, Array":function(u,s){return t(a(u.toArray(),s))},"Array, Matrix":function(u,s){return t(a(u,s.toArray()))},"Array, Array":a});function a(o,u){var s=Math.max(_t(o).length,_t(u).length);o=sl(o),u=sl(u);var l=_t(o),c=_t(u);if(l.length!==1||c.length!==1||l[0]!==3||c[0]!==3)throw new RangeError("Vectors with length 3 expected (Size A = ["+l.join(", ")+"], B = ["+c.join(", ")+"])");var f=[r(i(o[1],u[2]),i(o[2],u[1])),r(i(o[2],u[0]),i(o[0],u[2])),r(i(o[0],u[1]),i(o[1],u[0]))];return s>1?[f]:f}});var HC="diag",Cj=["typed","matrix","DenseMatrix","SparseMatrix"],wb=T(HC,Cj,n=>{var{typed:e,matrix:t,DenseMatrix:r,SparseMatrix:i}=n;return e(HC,{Array:function(l){return a(l,0,_t(l),null)},"Array, number":function(l,c){return a(l,c,_t(l),null)},"Array, BigNumber":function(l,c){return a(l,c.toNumber(),_t(l),null)},"Array, string":function(l,c){return a(l,0,_t(l),c)},"Array, number, string":function(l,c,f){return a(l,c,_t(l),f)},"Array, BigNumber, string":function(l,c,f){return a(l,c.toNumber(),_t(l),f)},Matrix:function(l){return a(l,0,l.size(),l.storage())},"Matrix, number":function(l,c){return a(l,c,l.size(),l.storage())},"Matrix, BigNumber":function(l,c){return a(l,c.toNumber(),l.size(),l.storage())},"Matrix, string":function(l,c){return a(l,0,l.size(),c)},"Matrix, number, string":function(l,c,f){return a(l,c,l.size(),f)},"Matrix, BigNumber, string":function(l,c,f){return a(l,c.toNumber(),l.size(),f)}});function a(s,l,c,f){if(!nt(l))throw new TypeError("Second parameter in function diag must be an integer");var p=l>0?l:0,m=l<0?-l:0;switch(c.length){case 1:return o(s,l,f,c[0],m,p);case 2:return u(s,l,f,c,m,p)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function o(s,l,c,f,p,m){var h=[f+p,f+m];if(c&&c!=="sparse"&&c!=="dense")throw new TypeError("Unknown matrix type ".concat(c,'"'));var d=c==="sparse"?i.diagonal(h,s,l):r.diagonal(h,s,l);return c!==null?d:d.valueOf()}function u(s,l,c,f,p,m){if(ot(s)){var h=s.diagonal(l);return c!==null?c!==h.storage()?t(h,c):h:h.valueOf()}for(var d=Math.min(f[0]-p,f[1]-m),g=[],y=0;y<d;y++)g[y]=s[y+p][y+m];return c!==null?t(g):g}});var Lc=wr(Vv(),1);function fa(n,e,t,r,i){if(Lc.default.isTypedFunction(n)){var a=[e,t,r],o=Lc.default.resolve(n,a);if(o)return f(o.implementation,a);var u=[e,t],s=Lc.default.resolve(n,u);if(s)return f(s.implementation,u);var l=[e],c=Lc.default.resolve(n,l);return c?f(c.implementation,l):f(n,a)}else return n(e,t,r);function f(p,m){try{return p.apply(p,m)}catch(g){var h;if(g instanceof TypeError&&((h=g.data)===null||h===void 0?void 0:h.category)==="wrongType"){var d=[];throw d.push("value: ".concat(Kt(e))),m.length>=2&&d.push("index: ".concat(Kt(t))),m.length>=3&&d.push("array: ".concat(Kt(r))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(n.name,"(").concat(d.join(", "),") at index ").concat(JSON.stringify(t)))}else throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(n.name,": ").concat(g.message))}}}var Fj="filter",Ij=["typed"],_b=T(Fj,Ij,n=>{var{typed:e}=n;return e("filter",{"Array, function":GC,"Matrix, function":function(r,i){return r.create(GC(r.toArray(),i))},"Array, RegExp":ul,"Matrix, RegExp":function(r,i){return r.create(ul(r.toArray(),i))}})});function GC(n,e){return wm(n,function(t,r,i){return fa(e,t,[r],i,"filter")})}var WC="flatten",Pj=["typed","matrix"],Sb=T(WC,Pj,n=>{var{typed:e,matrix:t}=n;return e(WC,{Array:function(i){return kt(i)},Matrix:function(i){var a=kt(i.toArray());return t(a)}})});var YC="forEach",kj=["typed"],Ab=T(YC,kj,n=>{var{typed:e}=n;return e(YC,{"Array, function":Bj,"Matrix, function":function(r,i){r.forEach(i)}})});function Bj(n,e){var t=function r(i,a){if(Array.isArray(i))as(i,function(o,u){r(o,a.concat(u))});else return fa(e,i,a,n,"forEach")};t(n,[])}var jC="getMatrixDataType",Oj=["typed"],Mb=T(jC,Oj,n=>{var{typed:e}=n;return e(jC,{Array:function(r){return os(r,Kt)},Matrix:function(r){return r.getDataType()}})});var ZC="identity",Rj=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],Eb=T(ZC,Rj,n=>{var{typed:e,config:t,matrix:r,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=n;return e(ZC,{"":function(){return t.matrix==="Matrix"?r([]):[]},string:function(c){return r(c)},"number | BigNumber":function(c){return s(c,c,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, string":function(c,f){return s(c,c,f)},"number | BigNumber, number | BigNumber":function(c,f){return s(c,f,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(c,f,p){return s(c,f,p)},Array:function(c){return u(c)},"Array, string":function(c,f){return u(c,f)},Matrix:function(c){return u(c.valueOf(),c.storage())},"Matrix, string":function(c,f){return u(c.valueOf(),f)}});function u(l,c){switch(l.length){case 0:return c?r(c):[];case 1:return s(l[0],l[0],c);case 2:return s(l[0],l[1],c);default:throw new Error("Vector containing two values expected")}}function s(l,c,f){var p=pt(l)||pt(c)?i:null;if(pt(l)&&(l=l.toNumber()),pt(c)&&(c=c.toNumber()),!nt(l)||l<1)throw new Error("Parameters in function identity must be positive integers");if(!nt(c)||c<1)throw new Error("Parameters in function identity must be positive integers");var m=p?new i(1):1,h=p?new p(0):0,d=[l,c];if(f){if(f==="sparse")return o.diagonal(d,m,0,h);if(f==="dense")return a.diagonal(d,m,0,h);throw new TypeError('Unknown matrix type "'.concat(f,'"'))}for(var g=Ia([],d,h),y=l<c?l:c,S=0;S<y;S++)g[S][S]=m;return g}});var JC="kron",Lj=["typed","matrix","multiplyScalar"],Db=T(JC,Lj,n=>{var{typed:e,matrix:t,multiplyScalar:r}=n;return e(JC,{"Matrix, Matrix":function(o,u){return t(i(o.toArray(),u.toArray()))},"Matrix, Array":function(o,u){return t(i(o.toArray(),u))},"Array, Matrix":function(o,u){return t(i(o,u.toArray()))},"Array, Array":i});function i(a,o){if(_t(a).length===1&&(a=[a]),_t(o).length===1&&(o=[o]),_t(a).length>2||_t(o).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(a.length)+", y = "+JSON.stringify(o.length)+")");var u=[],s=[];return a.map(function(l){return o.map(function(c){return s=[],u.push(s),l.map(function(f){return c.map(function(p){return s.push(r(f,p))})})})})&&u}});var XC="map",Vj=["typed"],Nb=T(XC,Vj,n=>{var{typed:e}=n;return e(XC,{"Array, function":Uj,"Matrix, function":function(r,i){return r.map(i)}})});function Uj(n,e){var t=function r(i,a){return Array.isArray(i)?i.map(function(o,u){return r(o,a.concat(u))}):fa(e,i,a,n,"map")};return t(n,[])}var QC="diff",qj=["typed","matrix","subtract","number"],Vc=T(QC,qj,n=>{var{typed:e,matrix:t,subtract:r,number:i}=n;return e(QC,{"Array | Matrix":function(c){return ot(c)?t(o(c.toArray())):o(c)},"Array | Matrix, number":function(c,f){if(!nt(f))throw new RangeError("Dimension must be a whole number");return ot(c)?t(a(c.toArray(),f)):a(c,f)},"Array, BigNumber":e.referTo("Array,number",l=>(c,f)=>l(c,i(f))),"Matrix, BigNumber":e.referTo("Matrix,number",l=>(c,f)=>l(c,i(f)))});function a(l,c){if(ot(l)&&(l=l.toArray()),!Array.isArray(l))throw RangeError("Array/Matrix does not have that many dimensions");if(c>0){var f=[];return l.forEach(p=>{f.push(a(p,c-1))}),f}else{if(c===0)return o(l);throw RangeError("Cannot have negative dimension")}}function o(l){for(var c=[],f=l.length,p=1;p<f;p++)c.push(u(l[p-1],l[p]));return c}function u(l,c){ot(l)&&(l=l.toArray()),ot(c)&&(c=c.toArray());var f=Array.isArray(l),p=Array.isArray(c);if(f&&p)return s(l,c);if(!f&&!p)return r(c,l);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}function s(l,c){if(l.length!==c.length)throw RangeError("Not all sub-arrays have the same length");for(var f=[],p=l.length,m=0;m<p;m++)f.push(u(l[m],c[m]));return f}});var zj="ones",$j=["typed","config","matrix","BigNumber"],Tb=T(zj,$j,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e("ones",{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(l){var c=l[l.length-1];if(typeof c=="string"){var f=l.pop();return a(l,f)}else return t.matrix==="Array"?a(l):a(l,"default")},Array:a,Matrix:function(l){var c=l.storage();return a(l.valueOf(),c)},"Array | Matrix, string":function(l,c){return a(l.valueOf(),c)}});function a(s,l){var c=o(s),f=c?new i(1):1;if(u(s),l){var p=r(l);return s.length>0?p.resize(s,f):p}else{var m=[];return s.length>0?Ia(m,s,f):m}}function o(s){var l=!1;return s.forEach(function(c,f,p){pt(c)&&(l=!0,p[f]=c.toNumber())}),l}function u(s){s.forEach(function(l){if(typeof l!="number"||!nt(l)||l<0)throw new Error("Parameters in function ones must be positive integers")})}});function yl(){throw new Error('No "bignumber" implementation available')}function Vm(){throw new Error('No "fraction" implementation available')}function Um(){throw new Error('No "matrix" implementation available')}var KC="range",Hj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Uc=T(KC,Hj,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,isPositive:c}=n;return e(KC,{string:p,"string, boolean":p,"number, number":function(g,y){return f(m(g,y,1,!1))},"number, number, number":function(g,y,S){return f(m(g,y,S,!1))},"number, number, boolean":function(g,y,S){return f(m(g,y,1,S))},"number, number, number, boolean":function(g,y,S,b){return f(m(g,y,S,b))},"BigNumber, BigNumber":function(g,y){var S=g.constructor;return f(m(g,y,new S(1),!1))},"BigNumber, BigNumber, BigNumber":function(g,y,S){return f(m(g,y,S,!1))},"BigNumber, BigNumber, boolean":function(g,y,S){var b=g.constructor;return f(m(g,y,new b(1),S))},"BigNumber, BigNumber, BigNumber, boolean":function(g,y,S,b){return f(m(g,y,S,b))},"Unit, Unit, Unit":function(g,y,S){return f(m(g,y,S,!1))},"Unit, Unit, Unit, boolean":function(g,y,S,b){return f(m(g,y,S,b))}});function f(d){return t.matrix==="Matrix"?r?r(d):Um():d}function p(d,g){var y=h(d);if(!y)throw new SyntaxError('String "'+d+'" is no valid range');return t.number==="BigNumber"?(i===void 0&&yl(),f(m(i(y.start),i(y.end),i(y.step)),g)):f(m(y.start,y.end,y.step,g))}function m(d,g,y,S){for(var b=[],w=c(y)?S?o:a:S?s:u,A=d;w(A,g);)b.push(A),A=l(A,y);return b}function h(d){var g=d.split(":"),y=g.map(function(b){return Number(b)}),S=y.some(function(b){return isNaN(b)});if(S)return null;switch(y.length){case 2:return{start:y[0],end:y[1],step:1};case 3:return{start:y[0],end:y[2],step:y[1]};default:return null}}});var eF="reshape",Gj=["typed","isInteger","matrix"],Cb=T(eF,Gj,n=>{var{typed:e,isInteger:t}=n;return e(eF,{"Matrix, Array":function(i,a){return i.reshape(a,!0)},"Array, Array":function(i,a){return a.forEach(function(o){if(!t(o))throw new TypeError("Invalid size for dimension: "+o)}),Sc(i,a)}})});var Wj="resize",Yj=["config","matrix"],Fb=T(Wj,Yj,n=>{var{config:e,matrix:t}=n;return function(a,o,u){if(arguments.length!==2&&arguments.length!==3)throw new To("resize",arguments.length,2,3);if(ot(o)&&(o=o.valueOf()),pt(o[0])&&(o=o.map(function(c){return pt(c)?c.toNumber():c})),ot(a))return a.resize(o,u,!0);if(typeof a=="string")return r(a,o,u);var s=Array.isArray(a)?!1:e.matrix!=="Array";if(o.length===0){for(;Array.isArray(a);)a=a[0];return vt(a)}else{Array.isArray(a)||(a=[a]),a=vt(a);var l=Ia(a,o,u);return s?t(l):l}};function r(i,a,o){if(o!==void 0){if(typeof o!="string"||o.length!==1)throw new TypeError("Single character expected as defaultValue")}else o=" ";if(a.length!==1)throw new Dt(a.length,1);var u=a[0];if(typeof u!="number"||!nt(u))throw new TypeError("Invalid size, must contain positive integers (size: "+Mt(a)+")");if(i.length>u)return i.substring(0,u);if(i.length<u){for(var s=i,l=0,c=u-i.length;l<c;l++)s+=o;return s}else return i}});var tF="rotate",jj=["typed","multiply","rotationMatrix"],Ib=T(tF,jj,n=>{var{typed:e,multiply:t,rotationMatrix:r}=n;return e(tF,{"Array , number | BigNumber | Complex | Unit":function(o,u){i(o,2);var s=t(r(u),o);return s.toArray()},"Matrix , number | BigNumber | Complex | Unit":function(o,u){return i(o,2),t(r(u),o)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,s){i(o,3);var l=t(r(u,s),o);return l},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(o,u,s){return i(o,3),t(r(u,s),o)}});function i(a,o){var u=Array.isArray(a)?_t(a):a.size();if(u.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u.length===2&&u[1]!==1)throw new RangeError("Vector must be of dimensions 1x".concat(o));if(u[0]!==o)throw new RangeError("Vector must be of dimensions 1x".concat(o))}});var rF="rotationMatrix",Zj=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],Pb=T(rF,Zj,n=>{var{typed:e,config:t,multiplyScalar:r,addScalar:i,unaryMinus:a,norm:o,BigNumber:u,matrix:s,DenseMatrix:l,SparseMatrix:c,cos:f,sin:p}=n;return e(rF,{"":function(){return t.matrix==="Matrix"?s([]):[]},string:function(b){return s(b)},"number | BigNumber | Complex | Unit":function(b){return m(b,t.matrix==="Matrix"?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(b,w){return m(b,w)},"number | BigNumber | Complex | Unit, Array":function(b,w){var A=s(w);return h(A),y(b,A,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(b,w){h(w);var A=w.storage()||(t.matrix==="Matrix"?"dense":void 0);return y(b,w,A)},"number | BigNumber | Complex | Unit, Array, string":function(b,w,A){var x=s(w);return h(x),y(b,x,A)},"number | BigNumber | Complex | Unit, Matrix, string":function(b,w,A){return h(w),y(b,w,A)}});function m(S,b){var w=pt(S),A=w?new u(-1):-1,x=f(S),D=p(S),E=[[x,r(A,D)],[D,x]];return g(E,b)}function h(S){var b=S.size();if(b.length<1||b[0]!==3)throw new RangeError("Vector must be of dimensions 1x3")}function d(S){return S.reduce((b,w)=>r(b,w))}function g(S,b){if(b){if(b==="sparse")return new c(S);if(b==="dense")return new l(S);throw new TypeError('Unknown matrix type "'.concat(b,'"'))}return S}function y(S,b,w){var A=o(b);if(A===0)throw new RangeError("Rotation around zero vector");var x=pt(S)?u:null,D=x?new x(1):1,E=x?new x(-1):-1,_=x?new x(b.get([0])/A):b.get([0])/A,N=x?new x(b.get([1])/A):b.get([1])/A,P=x?new x(b.get([2])/A):b.get([2])/A,B=f(S),V=i(D,a(B)),z=p(S),L=i(B,d([_,_,V])),k=i(d([_,N,V]),d([E,P,z])),C=i(d([_,P,V]),d([N,z])),W=i(d([_,N,V]),d([P,z])),O=i(B,d([N,N,V])),H=i(d([N,P,V]),d([E,_,z])),Z=i(d([_,P,V]),d([E,N,z])),Q=i(d([N,P,V]),d([_,z])),U=i(B,d([P,P,V])),me=[[L,k,C],[W,O,H],[Z,Q,U]];return g(me,w)}});var nF="row",Jj=["typed","Index","matrix","range"],qc=T(nF,Jj,n=>{var{typed:e,Index:t,matrix:r,range:i}=n;return e(nF,{"Matrix, number":a,"Array, number":function(u,s){return a(r(vt(u)),s).valueOf()}});function a(o,u){if(o.size().length!==2)throw new Error("Only two dimensional matrix is supported");br(u,o.size()[0]);var s=i(0,o.size()[1]),l=new t(u,s),c=o.subset(l);return ot(c)?c:r([[c]])}});var iF="size",Xj=["typed","config","?matrix"],kb=T(iF,Xj,n=>{var{typed:e,config:t,matrix:r}=n;return e(iF,{Matrix:function(a){return a.create(a.size())},Array:_t,string:function(a){return t.matrix==="Array"?[a.length]:r([a.length])},"number | Complex | BigNumber | Unit | boolean | null":function(a){return t.matrix==="Array"?[]:r?r([]):Um()}})});var aF="squeeze",Qj=["typed","matrix"],Bb=T(aF,Qj,n=>{var{typed:e,matrix:t}=n;return e(aF,{Array:function(i){return sl(vt(i))},Matrix:function(i){var a=sl(i.toArray());return Array.isArray(a)?t(a):a},any:function(i){return vt(i)}})});var oF="subset",Kj=["typed","matrix","zeros","add"],zc=T(oF,Kj,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n;return e(oF,{"Matrix, Index":function(u,s){return Ks(s)?t():(_c(u,s),u.subset(s))},"Array, Index":e.referTo("Matrix, Index",function(o){return function(u,s){var l=o(t(u),s);return s.isScalar()?l:l.valueOf()}}),"Object, Index":tZ,"string, Index":eZ,"Matrix, Index, any, any":function(u,s,l,c){return Ks(s)?u:(_c(u,s),u.clone().subset(s,a(l,s),c))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l,c){var f=o(t(u),s,l,c);return f.isMatrix?f.valueOf():f}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l){return o(t(u),s,l,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(o){return function(u,s,l){return o(u,s,l,void 0)}}),"string, Index, string":sF,"string, Index, string, string":sF,"Object, Index, any":rZ});function a(o,u){if(typeof o=="string")throw new Error("can't boradcast a string");if(u._isScalar)return o;var s=u.size();if(s.every(l=>l>0))try{return i(o,r(s))}catch{return o}else return o}});function eZ(n,e){if(!rs(e))throw new TypeError("Index expected");if(Ks(e))return"";if(_c(Array.from(n),e),e.size().length!==1)throw new Dt(e.size().length,1);var t=n.length;br(e.min()[0],t),br(e.max()[0],t);var r=e.dimension(0),i="";return r.forEach(function(a){i+=n.charAt(a)}),i}function sF(n,e,t,r){if(!e||e.isIndex!==!0)throw new TypeError("Index expected");if(Ks(e))return n;if(_c(Array.from(n),e),e.size().length!==1)throw new Dt(e.size().length,1);if(r!==void 0){if(typeof r!="string"||r.length!==1)throw new TypeError("Single character expected as defaultValue")}else r=" ";var i=e.dimension(0),a=i.size()[0];if(a!==t.length)throw new Dt(i.size()[0],t.length);var o=n.length;br(e.min()[0]),br(e.max()[0]);for(var u=[],s=0;s<o;s++)u[s]=n.charAt(s);if(i.forEach(function(f,p){u[f]=t.charAt(p[0])}),u.length>o)for(var l=o-1,c=u.length;l<c;l++)u[l]||(u[l]=r);return u.join("")}function tZ(n,e){if(!Ks(e)){if(e.size().length!==1)throw new Dt(e.size(),1);var t=e.dimension(0);if(typeof t!="string")throw new TypeError("String expected as index to retrieve an object property");return $r(n,t)}}function rZ(n,e,t){if(Ks(e))return n;if(e.size().length!==1)throw new Dt(e.size(),1);var r=e.dimension(0);if(typeof r!="string")throw new TypeError("String expected as index to retrieve an object property");var i=vt(n);return Za(i,r,t),i}var uF="transpose",nZ=["typed","matrix"],Ob=T(uF,nZ,n=>{var{typed:e,matrix:t}=n;return e(uF,{Array:o=>r(t(o)).valueOf(),Matrix:r,any:vt});function r(o){var u=o.size(),s;switch(u.length){case 1:s=o.clone();break;case 2:{var l=u[0],c=u[1];if(c===0)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Mt(u)+")");switch(o.storage()){case"dense":s=i(o,l,c);break;case"sparse":s=a(o,l,c);break}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Mt(u)+")")}return s}function i(o,u,s){for(var l=o._data,c=[],f,p=0;p<s;p++){f=c[p]=[];for(var m=0;m<u;m++)f[m]=vt(l[m][p])}return o.createDenseMatrix({data:c,size:[s,u],datatype:o._datatype})}function a(o,u,s){for(var l=o._values,c=o._index,f=o._ptr,p=l?[]:void 0,m=[],h=[],d=[],g=0;g<u;g++)d[g]=0;var y,S,b;for(y=0,S=c.length;y<S;y++)d[c[y]]++;for(var w=0,A=0;A<u;A++)h.push(w),w+=d[A],d[A]=h[A];for(h.push(w),b=0;b<s;b++)for(var x=f[b],D=f[b+1],E=x;E<D;E++){var _=d[c[E]]++;m[_]=b,l&&(p[_]=vt(l[E]))}return o.createSparseMatrix({values:p,index:m,ptr:h,size:[s,u],datatype:o._datatype})}});var lF="ctranspose",iZ=["typed","transpose","conj"],Rb=T(lF,iZ,n=>{var{typed:e,transpose:t,conj:r}=n;return e(lF,{any:function(a){return r(t(a))}})});var cF="zeros",aZ=["typed","config","matrix","BigNumber"],Lb=T(cF,aZ,n=>{var{typed:e,config:t,matrix:r,BigNumber:i}=n;return e(cF,{"":function(){return t.matrix==="Array"?a([]):a([],"default")},"...number | BigNumber | string":function(l){var c=l[l.length-1];if(typeof c=="string"){var f=l.pop();return a(l,f)}else return t.matrix==="Array"?a(l):a(l,"default")},Array:a,Matrix:function(l){var c=l.storage();return a(l.valueOf(),c)},"Array | Matrix, string":function(l,c){return a(l.valueOf(),c)}});function a(s,l){var c=o(s),f=c?new i(0):0;if(u(s),l){var p=r(l);return s.length>0?p.resize(s,f):p}else{var m=[];return s.length>0?Ia(m,s,f):m}}function o(s){var l=!1;return s.forEach(function(c,f,p){pt(c)&&(l=!0,p[f]=c.toNumber())}),l}function u(s){s.forEach(function(l){if(typeof l!="number"||!nt(l)||l<0)throw new Error("Parameters in function zeros must be positive integers")})}});var fF="fft",oZ=["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],Vb=T(fF,oZ,n=>{var{typed:e,matrix:t,addScalar:r,multiplyScalar:i,divideScalar:a,exp:o,tau:u,i:s,dotDivide:l,conj:c,pow:f,ceil:p,log2:m}=n;return e(fF,{Array:h,Matrix:function(b){return b.create(h(b.toArray()))}});function h(S){var b=_t(S);return b.length===1?y(S,b[0]):d(S.map(w=>h(w,b.slice(1))),0)}function d(S,b){var w=_t(S);if(b!==0)return new Array(w[0]).fill(0).map((x,D)=>d(S[D],b-1));if(w.length===1)return y(S);function A(x){var D=_t(x);return new Array(D[1]).fill(0).map((E,_)=>new Array(D[0]).fill(0).map((N,P)=>x[P][_]))}return A(d(A(S),1))}function g(S){for(var b=S.length,w=o(a(i(-1,i(s,u)),b)),A=[],x=1-b;x<b;x++)A.push(f(w,a(f(x,2),2)));for(var D=f(2,p(m(b+b-1))),E=[...new Array(b).fill(0).map((k,C)=>i(S[C],A[b-1+C])),...new Array(D-b).fill(0)],_=[...new Array(b+b-1).fill(0).map((k,C)=>a(1,A[C])),...new Array(D-(b+b-1)).fill(0)],N=y(E),P=y(_),B=new Array(D).fill(0).map((k,C)=>i(N[C],P[C])),V=l(c(h(c(B))),D),z=[],L=b-1;L<b+b-1;L++)z.push(i(V[L],A[L]));return z}function y(S){var b=S.length;if(b===1)return[S[0]];if(b%2===0){for(var w=[...y(S.filter((E,_)=>_%2===0),b/2),...y(S.filter((E,_)=>_%2===1),b/2)],A=0;A<b/2;A++){var x=w[A],D=i(w[A+b/2],o(i(i(u,s),a(-A,b))));w[A]=r(x,D),w[A+b/2]=r(x,i(-1,D))}return w}else return g(S)}});var pF="ifft",sZ=["typed","fft","dotDivide","conj"],Ub=T(pF,sZ,n=>{var{typed:e,fft:t,dotDivide:r,conj:i}=n;return e(pF,{"Array | Matrix":function(o){var u=ot(o)?o.size():_t(o);return r(i(t(i(o))),u.reduce((s,l)=>s*l,1))}})});function hs(n){"@babel/helpers - typeof";return hs=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},hs(n)}function qb(n,e){if(hs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(hs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function zb(n){var e=qb(n,"string");return hs(e)=="symbol"?e:e+""}function fr(n,e,t){return e=zb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mF(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function uZ(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mF(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mF(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var lZ="solveODE",cZ=["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],$b=T(lZ,cZ,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,max:o,map:u,abs:s,isPositive:l,isNegative:c,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:d}=n;function g(E){return function(_,N,P,B){var V=!(N.length===2&&(N.every(x)||N.every(Un)));if(V)throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var z=N[0],L=N[1],k=f(L,z),C=B.firstStep;if(C!==void 0&&!l(C))throw new Error('"firstStep" must be positive');var W=B.maxStep;if(W!==void 0&&!l(W))throw new Error('"maxStep" must be positive');var O=B.minStep;if(O&&c(O))throw new Error('"minStep" must be positive or zero');var H=[z,L,C,O,W].filter(Ze=>Ze!==void 0);if(!(H.every(x)||H.every(Un)))throw new Error('Inconsistent type of "t" dependant variables');for(var Z=1,Q=B.tol?B.tol:1e-4,U=B.minDelta?B.minDelta:.2,me=B.maxDelta?B.maxDelta:5,De=B.maxIter?B.maxIter:1e4,pe=[z,L,...P,W,O].some(pt),[_e,Ne,Se,Me]=pe?[h(E.a),h(E.c),h(E.b),h(E.bp)]:[E.a,E.c,E.b,E.bp],Ee=C?k?C:d(C):a(r(L,z),Z),Ce=[z],Ge=[P],We=r(Se,Me),te=0,oe=0,he=w(k),ie=A(k);he(Ce[te],L);){var re=[];Ee=ie(Ce[te],L,Ee),re.push(_(Ce[te],Ge[te]));for(var le=1;le<Ne.length;++le)re.push(_(t(Ce[te],i(Ne[le],Ee)),t(Ge[te],i(Ee,_e[le],re))));var Te=o(s(u(i(We,re),Ze=>Un(Ze)?Ze.value:Ze)));Te<Q&&Q/Te>1/4&&(Ce.push(t(Ce[te],Ee)),Ge.push(t(Ge[te],i(Ee,Se,re))),te++);var Ie=.84*(Q/Te)**(1/5);if(p(Ie,U)?Ie=U:f(Ie,me)&&(Ie=me),Ie=pe?h(Ie):Ie,Ee=i(Ee,Ie),W&&f(s(Ee),W)?Ee=k?W:d(W):O&&p(s(Ee),O)&&(Ee=k?O:d(O)),oe++,oe>De)throw new Error("Maximum number of iterations reached, try changing options")}return{t:Ce,y:Ge}}}function y(E,_,N,P){var B=[[],[.5],[0,.75],[.2222222222222222,.3333333333333333,.4444444444444444]],V=[null,1/2,3/4,1],z=[2/9,1/3,4/9,0],L=[7/24,1/4,1/3,1/8],k={a:B,c:V,b:z,bp:L};return g(k)(E,_,N,P)}function S(E,_,N,P){var B=[[],[.2],[.075,.225],[.9777777777777777,-3.7333333333333334,3.5555555555555554],[2.9525986892242035,-11.595793324188385,9.822892851699436,-.2908093278463649],[2.8462752525252526,-10.757575757575758,8.906422717743473,.2784090909090909,-.2735313036020583],[.09114583333333333,0,.44923629829290207,.6510416666666666,-.322376179245283,.13095238095238096]],V=[null,1/5,3/10,4/5,8/9,1,1],z=[35/384,0,500/1113,125/192,-2187/6784,11/84,0],L=[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40],k={a:B,c:V,b:z,bp:L};return g(k)(E,_,N,P)}function b(E,_,N,P){var B=P.method?P.method:"RK45",V={RK23:y,RK45:S};if(B.toUpperCase()in V){var z=uZ({},P);return delete z.method,V[B.toUpperCase()](E,_,N,z)}else{var L=Object.keys(V).map(C=>'"'.concat(C,'"')),k="".concat(L.slice(0,-1).join(", ")," and ").concat(L.slice(-1));throw new Error('Unavailable method "'.concat(B,'". Available methods are ').concat(k))}}function w(E){return E?p:f}function A(E){var _=E?f:p;return function(N,P,B){var V=t(N,B);return _(V,P)?r(P,N):B}}function x(E){return pt(E)||At(E)}function D(E,_,N,P){var B=b(E,_.toArray(),N.toArray(),P);return{t:m(B.t),y:m(B.y)}}return e("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":D,"function, Array, Array":(E,_,N)=>b(E,_,N,{}),"function, Matrix, Matrix":(E,_,N)=>D(E,_,N,{}),"function, Array, number | BigNumber | Unit":(E,_,N)=>{var P=b(E,_,[N],{});return{t:P.t,y:P.y.map(B=>B[0])}},"function, Matrix, number | BigNumber | Unit":(E,_,N)=>{var P=b(E,_.toArray(),[N],{});return{t:m(P.t),y:m(P.y.map(B=>B[0]))}},"function, Array, number | BigNumber | Unit, Object":(E,_,N,P)=>{var B=b(E,_,[N],P);return{t:B.t,y:B.y.map(V=>V[0])}},"function, Matrix, number | BigNumber | Unit, Object":(E,_,N,P)=>{var B=b(E,_.toArray(),[N],P);return{t:m(B.t),y:m(B.y.map(V=>V[0]))}}})});var fZ="erf",pZ=["typed"],Hb=T(fZ,pZ,n=>{var{typed:e}=n;return e("name",{number:function(o){var u=Math.abs(o);return u>=hZ?ua(o):u<=mZ?ua(o)*t(u):u<=4?ua(o)*(1-r(u)):ua(o)*(1-i(u))},"Array | Matrix":e.referToSelf(a=>o=>lt(o,a))});function t(a){var o=a*a,u=Co[0][4]*o,s=o,l;for(l=0;l<3;l+=1)u=(u+Co[0][l])*o,s=(s+bl[0][l])*o;return a*(u+Co[0][3])/(s+bl[0][3])}function r(a){var o=Co[1][8]*a,u=a,s;for(s=0;s<7;s+=1)o=(o+Co[1][s])*a,u=(u+bl[1][s])*a;var l=(o+Co[1][7])/(u+bl[1][7]),c=parseInt(a*16)/16,f=(a-c)*(a+c);return Math.exp(-c*c)*Math.exp(-f)*l}function i(a){var o=1/(a*a),u=Co[2][5]*o,s=o,l;for(l=0;l<4;l+=1)u=(u+Co[2][l])*o,s=(s+bl[2][l])*o;var c=o*(u+Co[2][4])/(s+bl[2][4]);c=(dZ-c)/a,o=parseInt(a*16)/16;var f=(a-o)*(a+o);return Math.exp(-o*o)*Math.exp(-f)*c}}),mZ=.46875,dZ=.5641895835477563,Co=[[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]],bl=[[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]],hZ=Math.pow(2,53);var dF="zeta",gZ=["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],Gb=T(dF,gZ,n=>{var{typed:e,config:t,multiply:r,pow:i,divide:a,factorial:o,equal:u,smallerEq:s,isNegative:l,gamma:c,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=n;return e(dF,{number:x=>y(x,D=>D,()=>20),BigNumber:x=>y(x,D=>new d(D),()=>Math.abs(Math.log10(t.epsilon))),Complex:S});function y(x,D,E){return u(x,0)?D(-.5):u(x,1)?D(NaN):isFinite(x)?b(x,D,E,_=>_):l(x)?D(NaN):D(1)}function S(x){return x.re===0&&x.im===0?new h(-.5):x.re===1?new h(NaN,NaN):x.re===1/0&&x.im===0?new h(1):x.im===1/0||x.re===-1/0?new h(NaN,NaN):b(x,D=>D,D=>Math.round(1.3*15+.9*Math.abs(D.im)),D=>D.re)}function b(x,D,E,_){var N=E(x);if(_(x)>-(N-1)/2)return A(x,D(N),D);var P=r(i(2,x),i(D(g),p(x,1)));return P=r(P,f(r(a(D(g),2),x))),P=r(P,c(p(1,x))),r(P,b(p(1,x),D,E,_))}function w(x,D){for(var E=x,_=x;s(_,D);_=m(_,1)){var N=a(r(o(m(D,p(_,1))),i(4,_)),r(o(p(D,_)),o(r(2,_))));E=m(E,N)}return r(D,E)}function A(x,D,E){for(var _=a(1,r(w(E(0),D),p(1,i(2,p(1,x))))),N=E(0),P=E(1);s(P,D);P=m(P,1))N=m(N,a(r((-1)**(P-1),w(P,D)),i(P,x)));return r(_,N)}});var hF="mode",vZ=["typed","isNaN","isNumeric"],Wb=T(hF,vZ,n=>{var{typed:e,isNaN:t,isNumeric:r}=n;return e(hF,{"Array | Matrix":i,"...":function(o){return i(o)}});function i(a){a=kt(a.valueOf());var o=a.length;if(o===0)throw new Error("Cannot calculate mode of an empty array");for(var u={},s=[],l=0,c=0;c<a.length;c++){var f=a[c];if(r(f)&&t(f))throw new Error("Cannot calculate mode of an array containing NaN values");f in u||(u[f]=0),u[f]++,u[f]===l?s.push(f):u[f]>l&&(l=u[f],s=[f])}return s}});function an(n,e,t){var r;return String(n).indexOf("Unexpected type")!==-1?(r=arguments.length>2?" (type: "+Kt(t)+", value: "+JSON.stringify(t)+")":" (type: "+n.data.actual+")",new TypeError("Cannot calculate "+e+", unexpected type of argument"+r)):String(n).indexOf("complex numbers")!==-1?(r=arguments.length>2?" (type: "+Kt(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+r)):n}var gF="prod",yZ=["typed","config","multiplyScalar","numeric"],Yb=T(gF,yZ,n=>{var{typed:e,config:t,multiplyScalar:r,numeric:i}=n;return e(gF,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(u,s){throw new Error("prod(A, dim) is not yet supported")},"...":function(u){return a(u)}});function a(o){var u;if(ti(o,function(s){try{u=u===void 0?s:r(u,s)}catch(l){throw an(l,"prod",s)}}),typeof u=="string"&&(u=i(u,t.number)),u===void 0)throw new Error("Cannot calculate prod of an empty array");return u}});var vF="format",bZ=["typed"],jb=T(vF,bZ,n=>{var{typed:e}=n;return e(vF,{any:Mt,"any, Object | function | number | BigNumber":Mt})});var yF="bin",xZ=["typed","format"],Zb=T(yF,xZ,n=>{var{typed:e,format:t}=n;return e(yF,{"number | BigNumber":function(i){return t(i,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"bin",wordSize:a})}})});var bF="oct",wZ=["typed","format"],Jb=T(bF,wZ,n=>{var{typed:e,format:t}=n;return e(bF,{"number | BigNumber":function(i){return t(i,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"oct",wordSize:a})}})});var xF="hex",_Z=["typed","format"],Xb=T(xF,_Z,n=>{var{typed:e,format:t}=n;return e(xF,{"number | BigNumber":function(i){return t(i,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(i,a){return t(i,{notation:"hex",wordSize:a})}})});var qm=/\$([\w.]+)/g;var wF="print",SZ=["typed"],$c=T(wF,SZ,n=>{var{typed:e}=n;return e(wF,{"string, Object | Array":_F,"string, Object | Array, number | Object":_F})});function _F(n,e,t){return n.replace(qm,function(r,i){var a=i.split("."),o=e[a.shift()];for(o!==void 0&&o.isMatrix&&(o=o.toArray());a.length&&o!==void 0;){var u=a.shift();o=u?o[u]:o+"."}return o!==void 0?rn(o)?o:Mt(o,t):r})}var SF="to",AZ=["typed","matrix","concat"],Qb=T(SF,AZ,n=>{var{typed:e,matrix:t,concat:r}=n,i=Ct({typed:e,matrix:t,concat:r});return e(SF,{"Unit, Unit | string":(a,o)=>a.to(o)},i({Ds:!0}))});var AF="isPrime",MZ=["typed"],Kb=T(AF,MZ,n=>{var{typed:e}=n;return e(AF,{number:function(r){if(r*0!==0)return!1;if(r<=3)return r>1;if(r%2===0||r%3===0)return!1;for(var i=5;i*i<=r;i+=6)if(r%i===0||r%(i+2)===0)return!1;return!0},BigNumber:function(r){if(r.toNumber()*0!==0)return!1;if(r.lte(3))return r.gt(1);if(r.mod(2).eq(0)||r.mod(3).eq(0))return!1;if(r.lt(Math.pow(2,32))){for(var i=r.toNumber(),a=5;a*a<=i;a+=6)if(i%a===0||i%(a+2)===0)return!1;return!0}function o(S,b,w){for(var A=1;!b.eq(0);)b.mod(2).eq(0)?(b=b.div(2),S=S.mul(S).mod(w)):(b=b.sub(1),A=S.mul(A).mod(w));return A}var u=r.constructor.clone({precision:r.toFixed(0).length*2});r=new u(r);for(var s=0,l=r.sub(1);l.mod(2).eq(0);)l=l.div(2),s+=1;var c=null;if(r.lt("3317044064679887385961981"))c=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(S=>S<r);else{var f=Math.min(r.toNumber()-2,Math.floor(2*Math.pow(r.toFixed(0).length*Math.log(10),2)));c=[];for(var p=2;p<=f;p+=1)c.push(f)}for(var m=0;m<c.length;m+=1){var h=c[m],d=o(r.sub(r).add(h),l,r);if(!d.eq(1)){for(var g=0,y=d;!y.eq(r.sub(1));g+=1,y=y.mul(y).mod(r))if(g===s-1)return!1}}return!0},"Array | Matrix":e.referToSelf(t=>r=>lt(r,t))})});var EZ="numeric",DZ=["number","?bignumber","?fraction"],ex=T(EZ,DZ,n=>{var{number:e,bignumber:t,fraction:r}=n,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:o=>e(o),BigNumber:t?o=>t(o):yl,Fraction:r?o=>r(o):Vm};return function(u){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"number",l=arguments.length>2?arguments[2]:void 0;if(l!==void 0)throw new SyntaxError("numeric() takes one or two arguments");var c=Kt(u);if(!(c in i))throw new TypeError("Cannot convert "+u+' of type "'+c+'"; valid input types are '+Object.keys(i).join(", "));if(!(s in a))throw new TypeError("Cannot convert "+u+' to type "'+s+'"; valid output types are '+Object.keys(a).join(", "));return s===c?u:a[s](u)}});var MF="divideScalar",NZ=["typed","numeric"],tx=T(MF,NZ,n=>{var{typed:e,numeric:t}=n;return e(MF,{"number, number":function(i,a){return i/a},"Complex, Complex":function(i,a){return i.div(a)},"BigNumber, BigNumber":function(i,a){return i.div(a)},"Fraction, Fraction":function(i,a){return i.div(a)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,i)=>r.divide(i),"number | Fraction | Complex | BigNumber, Unit":(r,i)=>i.divideInto(r)})});var EF="pow",TZ=["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],rx=T(EF,TZ,n=>{var{typed:e,config:t,identity:r,multiply:i,matrix:a,inv:o,number:u,fraction:s,Complex:l}=n;return e(EF,{"number, number":c,"Complex, Complex":function(h,d){return h.pow(d)},"BigNumber, BigNumber":function(h,d){return d.isInteger()||h>=0||t.predictable?h.pow(d):new l(h.toNumber(),0).pow(d.toNumber(),0)},"Fraction, Fraction":function(h,d){var g=h.pow(d);if(g!=null)return g;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(h.valueOf(),d.valueOf())},"Array, number":f,"Array, BigNumber":function(h,d){return f(h,d.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(h,d){return p(h,d.toNumber())},"Unit, number | BigNumber":function(h,d){return h.pow(d)}});function c(m,h){if(t.predictable&&!nt(h)&&m<0)try{var d=s(h),g=u(d);if((h===g||Math.abs((h-g)/h)<1e-14)&&d.d%2===1)return(d.n%2===0?1:-1)*Math.pow(-m,h)}catch{}return t.predictable&&(m<-1&&h===1/0||m>-1&&m<0&&h===-1/0)?NaN:nt(h)||m>=0||t.predictable?Py(m,h):m*m<1&&h===1/0||m*m>1&&h===-1/0?0:new l(m,0).pow(h,0)}function f(m,h){if(!nt(h))throw new TypeError("For A^b, b must be an integer (value is "+h+")");var d=_t(m);if(d.length!==2)throw new Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!==d[1])throw new Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");if(h<0)try{return f(o(m),-h)}catch(S){throw S.message==="Cannot calculate inverse, determinant is zero"?new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+h+")"):S}for(var g=r(d[0]).valueOf(),y=m;h>=1;)(h&1)===1&&(g=i(y,g)),h>>=1,y=i(y,y);return g}function p(m,h){return a(f(m.valueOf(),h))}});var xl="Number of decimals in function round must be an integer",DF="round",CZ=["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],nx=T(DF,CZ,n=>{var{typed:e,config:t,matrix:r,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:u}=n,s=xr({typed:e,equalScalar:i}),l=cr({typed:e,DenseMatrix:u}),c=pn({typed:e});function f(p){return Math.abs(ol(p).exponent)}return e(DF,{number:function(m){var h=dl(m,f(t.epsilon)),d=Jr(m,h,t.epsilon)?h:m;return dl(d)},"number, number":function(m,h){var d=f(t.epsilon);if(h>=d)return dl(m,h);var g=dl(m,d),y=Jr(m,g,t.epsilon)?g:m;return dl(y,h)},"number, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(xl);return new o(m).toDecimalPlaces(h.toNumber())},Complex:function(m){return m.round()},"Complex, number":function(m,h){if(h%1)throw new TypeError(xl);return m.round(h)},"Complex, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(xl);var d=h.toNumber();return m.round(d)},BigNumber:function(m){var h=new o(m).toDecimalPlaces(f(t.epsilon)),d=gn(m,h,t.epsilon)?h:m;return d.toDecimalPlaces(0)},"BigNumber, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(xl);var d=f(t.epsilon);if(h>=d)return m.toDecimalPlaces(h.toNumber());var g=m.toDecimalPlaces(d),y=gn(m,g,t.epsilon)?g:m;return y.toDecimalPlaces(h.toNumber())},Fraction:function(m){return m.round()},"Fraction, number":function(m,h){if(h%1)throw new TypeError(xl);return m.round(h)},"Fraction, BigNumber":function(m,h){if(!h.isInteger())throw new TypeError(xl);return m.round(h.toNumber())},"Unit, number, Unit":e.referToSelf(p=>function(m,h,d){var g=m.toNumeric(d);return d.multiply(p(g,h))}),"Unit, BigNumber, Unit":e.referToSelf(p=>(m,h,d)=>p(m,h.toNumber(),d)),"Unit, Unit":e.referToSelf(p=>(m,h)=>p(m,0,h)),"Array | Matrix, number, Unit":e.referToSelf(p=>(m,h,d)=>lt(m,g=>p(g,h,d),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(p=>(m,h,d)=>p(m,h.toNumber(),d)),"Array | Matrix, Unit":e.referToSelf(p=>(m,h)=>p(m,0,h)),"Array | Matrix":e.referToSelf(p=>m=>lt(m,p,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>s(m,h,p,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(p=>(m,h)=>c(m,h,p,!1)),"Array, number | BigNumber":e.referToSelf(p=>(m,h)=>c(r(m),h,p,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(p=>(m,h)=>i(m,0)?a(h.size(),h.storage()):l(h,m,p,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(p=>(m,h)=>i(m,0)?a(h.size(),h.storage()):c(h,m,p,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(p=>(m,h)=>c(r(h),m,p,!0).valueOf())})});var NF="log",FZ=["config","typed","divideScalar","Complex"],ix=T(NF,FZ,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n;return e(NF,{number:function(o){return o>=0||t.predictable?FT(o):new i(o,0).log()},Complex:function(o){return o.log()},BigNumber:function(o){return!o.isNegative()||t.predictable?o.ln():new i(o.toNumber(),0).log()},"any, any":e.referToSelf(a=>(o,u)=>r(a(o),a(u)))})});var TF="log1p",IZ=["typed","config","divideScalar","log","Complex"],ax=T(TF,IZ,n=>{var{typed:e,config:t,divideScalar:r,log:i,Complex:a}=n;return e(TF,{number:function(s){return s>=-1||t.predictable?hm(s):o(new a(s,0))},Complex:o,BigNumber:function(s){var l=s.plus(1);return!l.isNegative()||t.predictable?l.ln():o(new a(s.toNumber(),0))},"Array | Matrix":e.referToSelf(u=>s=>lt(s,u)),"any, any":e.referToSelf(u=>(s,l)=>r(u(s),i(l)))});function o(u){var s=u.re+1;return new a(Math.log(Math.sqrt(s*s+u.im*u.im)),Math.atan2(u.im,s))}});var CF="nthRoots",PZ=["config","typed","divideScalar","Complex"],ox=T(CF,PZ,n=>{var{typed:e,config:t,divideScalar:r,Complex:i}=n,a=[function(s){return new i(s,0)},function(s){return new i(0,s)},function(s){return new i(-s,0)},function(s){return new i(0,-s)}];function o(u,s){if(s<0)throw new Error("Root must be greater than zero");if(s===0)throw new Error("Root must be non-zero");if(s%1!==0)throw new Error("Root must be an integer");if(u===0||u.abs()===0)return[new i(0,0)];var l=typeof u=="number",c;(l||u.re===0||u.im===0)&&(l?c=2*+(u<0):u.im===0?c=2*+(u.re<0):c=2*+(u.im<0)+1);for(var f=u.arg(),p=u.abs(),m=[],h=Math.pow(p,1/s),d=0;d<s;d++){var g=(c+4*d)/s;if(g===Math.round(g)){m.push(a[g%4](h));continue}m.push(new i({r:h,phi:(f+2*Math.PI*d)/s}))}return m}return e(CF,{Complex:function(s){return o(s,2)},"Complex, number":o})});var FF="dotPow",kZ=["typed","equalScalar","matrix","pow","DenseMatrix","concat"],sx=T(FF,kZ,n=>{var{typed:e,equalScalar:t,matrix:r,pow:i,DenseMatrix:a,concat:o}=n,u=kr({typed:e}),s=Mn({typed:e,DenseMatrix:a}),l=xr({typed:e,equalScalar:t}),c=cr({typed:e,DenseMatrix:a}),f=Ct({typed:e,matrix:r,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&!m.includes("Matrix")&&!m.includes("Array")&&(p[m]=i.signatures[m]);var h=e(p);return e(FF,f({elop:h,SS:s,DS:u,Ss:l,sS:c}))});var IF="dotDivide",BZ=["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],ux=T(IF,BZ,n=>{var{typed:e,matrix:t,equalScalar:r,divideScalar:i,DenseMatrix:a,concat:o}=n,u=mn({typed:e,equalScalar:r}),s=kr({typed:e}),l=Mn({typed:e,DenseMatrix:a}),c=xr({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:a}),p=Ct({typed:e,matrix:t,concat:o});return e(IF,p({elop:i,SS:l,DS:s,SD:u,Ss:c,sS:f}))});function Qa(n){var{DenseMatrix:e}=n;return function(r,i,a){var o=r.size();if(o.length!==2)throw new RangeError("Matrix must be two dimensional (size: "+Mt(o)+")");var u=o[0],s=o[1];if(u!==s)throw new RangeError("Matrix must be square (size: "+Mt(o)+")");var l=[];if(ot(i)){var c=i.size(),f=i._data;if(c.length===1){if(c[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var p=0;p<u;p++)l[p]=[f[p]];return new e({data:l,size:[u,1],datatype:i._datatype})}if(c.length===2){if(c[0]!==u||c[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Xs(i)){if(a){l=[];for(var m=0;m<u;m++)l[m]=[f[m][0]];return new e({data:l,size:[u,1],datatype:i._datatype})}return i}if(Ta(i)){for(var h=0;h<u;h++)l[h]=[0];for(var d=i._values,g=i._index,y=i._ptr,S=y[1],b=y[0];b<S;b++){var w=g[b];l[w][0]=d[b]}return new e({data:l,size:[u,1],datatype:i._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(nr(i)){var A=_t(i);if(A.length===1){if(A[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var x=0;x<u;x++)l[x]=[i[x]];return new e({data:l,size:[u,1]})}if(A.length===2){if(A[0]!==u||A[1]!==1)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var D=0;D<u;D++)l[D]=[i[D][0]];return new e({data:l,size:[u,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var PF="lsolve",OZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],lx=T(PF,OZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Qa({DenseMatrix:u});return e(PF,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.valueOf()}});function l(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],y=f._data,S=0;S<d;S++){var b=m[S][0]||0,w=void 0;if(o(b,0))w=0;else{var A=y[S][S];if(o(A,0))throw new Error("Linear system cannot be solved since matrix is singular");w=r(b,A);for(var x=S+1;x<h;x++)m[x]=[a(m[x][0]||0,i(w,y[x][S]))]}g[S]=[w]}return new u({data:g,size:[h,1]})}function c(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=f._values,y=f._index,S=f._ptr,b=[],w=0;w<d;w++){var A=m[w][0]||0;if(o(A,0))b[w]=[0];else{for(var x=0,D=[],E=[],_=S[w],N=S[w+1],P=_;P<N;P++){var B=y[P];B===w?x=g[P]:B>w&&(D.push(g[P]),E.push(B))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var V=r(A,x),z=0,L=E.length;z<L;z++){var k=E[z];m[k]=[a(m[k][0]||0,i(V,D[z]))]}b[w]=[V]}}return new u({data:b,size:[h,1]})}});var kF="usolve",RZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],cx=T(kF,RZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Qa({DenseMatrix:u});return e(kF,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.valueOf()}});function l(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=[],y=f._data,S=d-1;S>=0;S--){var b=m[S][0]||0,w=void 0;if(o(b,0))w=0;else{var A=y[S][S];if(o(A,0))throw new Error("Linear system cannot be solved since matrix is singular");w=r(b,A);for(var x=S-1;x>=0;x--)m[x]=[a(m[x][0]||0,i(w,y[x][S]))]}g[S]=[w]}return new u({data:g,size:[h,1]})}function c(f,p){p=s(f,p,!0);for(var m=p._data,h=f._size[0],d=f._size[1],g=f._values,y=f._index,S=f._ptr,b=[],w=d-1;w>=0;w--){var A=m[w][0]||0;if(o(A,0))b[w]=[0];else{for(var x=0,D=[],E=[],_=S[w],N=S[w+1],P=N-1;P>=_;P--){var B=y[P];B===w?x=g[P]:B<w&&(D.push(g[P]),E.push(B))}if(o(x,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var V=r(A,x),z=0,L=E.length;z<L;z++){var k=E[z];m[k]=[a(m[k][0],i(V,D[z]))]}b[w]=[V]}}return new u({data:b,size:[h,1]})}});var BF="lsolveAll",LZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],fx=T(BF,LZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Qa({DenseMatrix:u});return e(BF,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.map(g=>g.valueOf())}});function l(f,p){for(var m=[s(f,p,!0)._data.map(E=>E[0])],h=f._data,d=f._size[0],g=f._size[1],y=0;y<g;y++)for(var S=m.length,b=0;b<S;b++){var w=m[b];if(o(h[y][y],0))if(o(w[y],0)){if(b===0){var x=[...w];x[y]=1;for(var D=y+1;D<g;D++)x[D]=a(x[D],h[D][y]);m.push(x)}}else{if(b===0)return[];m.splice(b,1),b-=1,S-=1}else{w[y]=r(w[y],h[y][y]);for(var A=y+1;A<g;A++)w[A]=a(w[A],i(w[y],h[A][y]))}}return m.map(E=>new u({data:E.map(_=>[_]),size:[d,1]}))}function c(f,p){for(var m=[s(f,p,!0)._data.map(Z=>Z[0])],h=f._size[0],d=f._size[1],g=f._values,y=f._index,S=f._ptr,b=0;b<d;b++)for(var w=m.length,A=0;A<w;A++){for(var x=m[A],D=[],E=[],_=S[b],N=S[b+1],P=0,B=_;B<N;B++){var V=y[B];V===b?P=g[B]:V>b&&(D.push(g[B]),E.push(V))}if(o(P,0))if(o(x[b],0)){if(A===0){var C=[...x];C[b]=1;for(var W=0,O=E.length;W<O;W++){var H=E[W];C[H]=a(C[H],D[W])}m.push(C)}}else{if(A===0)return[];m.splice(A,1),A-=1,w-=1}else{x[b]=r(x[b],P);for(var z=0,L=E.length;z<L;z++){var k=E[z];x[k]=a(x[k],i(x[b],D[z]))}}}return m.map(Z=>new u({data:Z.map(Q=>[Q]),size:[h,1]}))}});var OF="usolveAll",VZ=["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],px=T(OF,VZ,n=>{var{typed:e,matrix:t,divideScalar:r,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:u}=n,s=Qa({DenseMatrix:u});return e(OF,{"SparseMatrix, Array | Matrix":function(p,m){return c(p,m)},"DenseMatrix, Array | Matrix":function(p,m){return l(p,m)},"Array, Array | Matrix":function(p,m){var h=t(p),d=l(h,m);return d.map(g=>g.valueOf())}});function l(f,p){for(var m=[s(f,p,!0)._data.map(E=>E[0])],h=f._data,d=f._size[0],g=f._size[1],y=g-1;y>=0;y--)for(var S=m.length,b=0;b<S;b++){var w=m[b];if(o(h[y][y],0))if(o(w[y],0)){if(b===0){var x=[...w];x[y]=1;for(var D=y-1;D>=0;D--)x[D]=a(x[D],h[D][y]);m.push(x)}}else{if(b===0)return[];m.splice(b,1),b-=1,S-=1}else{w[y]=r(w[y],h[y][y]);for(var A=y-1;A>=0;A--)w[A]=a(w[A],i(w[y],h[A][y]))}}return m.map(E=>new u({data:E.map(_=>[_]),size:[d,1]}))}function c(f,p){for(var m=[s(f,p,!0)._data.map(Z=>Z[0])],h=f._size[0],d=f._size[1],g=f._values,y=f._index,S=f._ptr,b=d-1;b>=0;b--)for(var w=m.length,A=0;A<w;A++){for(var x=m[A],D=[],E=[],_=S[b],N=S[b+1],P=0,B=N-1;B>=_;B--){var V=y[B];V===b?P=g[B]:V<b&&(D.push(g[B]),E.push(V))}if(o(P,0))if(o(x[b],0)){if(A===0){var C=[...x];C[b]=1;for(var W=0,O=E.length;W<O;W++){var H=E[W];C[H]=a(C[H],D[W])}m.push(C)}}else{if(A===0)return[];m.splice(A,1),A-=1,w-=1}else{x[b]=r(x[b],P);for(var z=0,L=E.length;z<L;z++){var k=E[z];x[k]=a(x[k],i(x[b],D[z]))}}}return m.map(Z=>new u({data:Z.map(Q=>[Q]),size:[h,1]}))}});var UZ="matAlgo08xS0Sid",qZ=["typed","equalScalar"],wl=T(UZ,qZ,n=>{var{typed:e,equalScalar:t}=n;return function(i,a,o){var u=i._values,s=i._index,l=i._ptr,c=i._size,f=i._datatype||i._data===void 0?i._datatype:i.getDataType(),p=a._values,m=a._index,h=a._ptr,d=a._size,g=a._datatype||a._data===void 0?a._datatype:a.getDataType();if(c.length!==d.length)throw new Dt(c.length,d.length);if(c[0]!==d[0]||c[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+d+")");if(!u||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var y=c[0],S=c[1],b,w=t,A=0,x=o;typeof f=="string"&&f===g&&f!=="mixed"&&(b=f,w=e.find(t,[b,b]),A=e.convert(0,b),x=e.find(o,[b,b]));for(var D=[],E=[],_=[],N=[],P=[],B,V,z,L,k=0;k<S;k++){_[k]=E.length;var C=k+1;for(V=l[k],z=l[k+1],B=V;B<z;B++)L=s[B],P[L]=C,N[L]=u[B],E.push(L);for(V=h[k],z=h[k+1],B=V;B<z;B++)L=m[B],P[L]===C&&(N[L]=x(N[L],p[B]));for(B=_[k];B<E.length;){L=E[B];var W=N[L];w(W,A)?E.splice(B,1):(D.push(W),B++)}}return _[S]=E.length,i.createSparseMatrix({values:D,index:E,ptr:_,size:[y,S],datatype:f===i._datatype&&g===a._datatype?b:void 0})}});var _l=T("useMatrixForArrayScalar",["typed","matrix"],n=>{var{typed:e,matrix:t}=n;return{"Array, number":e.referTo("DenseMatrix, number",r=>(i,a)=>r(t(i),a).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",r=>(i,a)=>r(t(i),a).valueOf()),"number, Array":e.referTo("number, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",r=>(i,a)=>r(i,t(a)).valueOf())}});var RF="leftShift",zZ=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],mx=T(RF,zZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ri({typed:e}),s=mn({typed:e,equalScalar:r}),l=wl({typed:e,equalScalar:r}),c=Ti({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=pn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=_l({typed:e,matrix:t});return e(RF,{"number, number":Ly,"BigNumber, BigNumber":DC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:l,DS:u,SD:s}))});var LF="rightArithShift",$Z=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],dx=T(LF,$Z,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ri({typed:e}),s=mn({typed:e,equalScalar:r}),l=wl({typed:e,equalScalar:r}),c=Ti({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=pn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=_l({typed:e,matrix:t});return e(LF,{"number, number":Vy,"BigNumber, BigNumber":NC,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:l,DS:u,SD:s}))});var VF="rightLogShift",HZ=["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],hx=T(VF,HZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,DenseMatrix:a,concat:o}=n,u=ri({typed:e}),s=mn({typed:e,equalScalar:r}),l=wl({typed:e,equalScalar:r}),c=Ti({typed:e,DenseMatrix:a}),f=xr({typed:e,equalScalar:r}),p=pn({typed:e}),m=Ct({typed:e,matrix:t,concat:o}),h=_l({typed:e,matrix:t});return e(VF,{"number, number":Uy,"SparseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():f(g,y,d,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(d=>(g,y)=>r(y,0)?g.clone():p(g,y,d,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):c(y,g,d,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(d=>(g,y)=>r(g,0)?i(y.size(),y.storage()):p(y,g,d,!0))},h,m({SS:l,DS:u,SD:s}))});var UF="and",GZ=["typed","matrix","equalScalar","zeros","not","concat"],Hc=T(UF,GZ,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=mn({typed:e,equalScalar:r}),s=ds({typed:e,equalScalar:r}),l=xr({typed:e,equalScalar:r}),c=pn({typed:e}),f=Ct({typed:e,matrix:t,concat:o});return e(UF,{"number, number":Wy,"Complex, Complex":function(m,h){return(m.re!==0||m.im!==0)&&(h.re!==0||h.im!==0)},"BigNumber, BigNumber":function(m,h){return!m.isZero()&&!h.isZero()&&!m.isNaN()&&!h.isNaN()},"Unit, Unit":e.referToSelf(p=>(m,h)=>p(m.value||0,h.value||0)),"SparseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):l(m,h,p,!1)),"DenseMatrix, any":e.referToSelf(p=>(m,h)=>a(h)?i(m.size(),m.storage()):c(m,h,p,!1)),"any, SparseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):l(h,m,p,!0)),"any, DenseMatrix":e.referToSelf(p=>(m,h)=>a(m)?i(m.size(),m.storage()):c(h,m,p,!0)),"Array, any":e.referToSelf(p=>(m,h)=>p(t(m),h).valueOf()),"any, Array":e.referToSelf(p=>(m,h)=>p(m,t(h)).valueOf())},f({SS:s,DS:u}))});var zm="compare",WZ=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],gx=T(zm,WZ,n=>{var{typed:e,config:t,equalScalar:r,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:u,concat:s}=n,l=kr({typed:e}),c=ms({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:u}),p=Ct({typed:e,matrix:i,concat:s}),m=ca({typed:e});return e(zm,YZ({typed:e,config:t}),{"boolean, boolean":function(d,g){return d===g?0:d>g?1:-1},"BigNumber, BigNumber":function(d,g){return gn(d,g,t.epsilon)?new a(0):new a(d.cmp(g))},"Fraction, Fraction":function(d,g){return new o(d.compare(g))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:c,DS:l,Ss:f}))}),YZ=T(zm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(zm,{"number, number":function(i,a){return Jr(i,a,t.epsilon)?0:i>a?1:-1}})});var au=wr(zF(),1);var $F="compareNatural",jZ=["typed","compare"],vx=T($F,jZ,n=>{var{typed:e,compare:t}=n,r=t.signatures["boolean,boolean"];return e($F,{"any, any":i});function i(s,l){var c=Kt(s),f=Kt(l),p;if((c==="number"||c==="BigNumber"||c==="Fraction")&&(f==="number"||f==="BigNumber"||f==="Fraction"))return p=t(s,l),p.toString()!=="0"?p>0?1:-1:(0,au.default)(c,f);var m=["Array","DenseMatrix","SparseMatrix"];if(m.includes(c)||m.includes(f))return p=a(i,s,l),p!==0?p:(0,au.default)(c,f);if(c!==f)return(0,au.default)(c,f);if(c==="Complex")return ZZ(s,l);if(c==="Unit")return s.equalBase(l)?i(s.value,l.value):o(i,s.formatUnits(),l.formatUnits());if(c==="boolean")return r(s,l);if(c==="string")return(0,au.default)(s,l);if(c==="Object")return u(i,s,l);if(c==="null"||c==="undefined")return 0;throw new TypeError('Unsupported type of value "'+c+'"')}function a(s,l,c){return Ta(l)&&Ta(c)?o(s,l.toJSON().values,c.toJSON().values):Ta(l)?a(s,l.toArray(),c):Ta(c)?a(s,l,c.toArray()):Xs(l)?a(s,l.toJSON().data,c):Xs(c)?a(s,l,c.toJSON().data):Array.isArray(l)?Array.isArray(c)?o(s,l,c):a(s,l,[c]):a(s,[l],c)}function o(s,l,c){for(var f=0,p=Math.min(l.length,c.length);f<p;f++){var m=s(l[f],c[f]);if(m!==0)return m}return l.length>c.length?1:l.length<c.length?-1:0}function u(s,l,c){var f=Object.keys(l),p=Object.keys(c);f.sort(au.default),p.sort(au.default);var m=o(s,f,p);if(m!==0)return m;for(var h=0;h<f.length;h++){var d=s(l[f[h]],c[p[h]]);if(d!==0)return d}return 0}});function ZZ(n,e){return n.re>e.re?1:n.re<e.re?-1:n.im>e.im?1:n.im<e.im?-1:0}var HF="compareText",JZ=["typed","matrix","concat"];bm.signature="any, any";var yx=T(HF,JZ,n=>{var{typed:e,matrix:t,concat:r}=n,i=Ct({typed:e,matrix:t,concat:r});return e(HF,bm,i({elop:bm,Ds:!0}))});var $m="equal",XZ=["typed","matrix","equalScalar","DenseMatrix","concat"],bx=T($m,XZ,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:t,concat:a});return e($m,QZ({typed:e,equalScalar:r}),l({elop:r,SS:u,DS:o,Ss:s}))}),QZ=T($m,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e($m,{"any, any":function(i,a){return i===null?a===null:a===null?i===null:i===void 0?a===void 0:a===void 0?i===void 0:t(i,a)}})});var GF="equalText",KZ=["typed","compareText","isZero"],xx=T(GF,KZ,n=>{var{typed:e,compareText:t,isZero:r}=n;return e(GF,{"any, any":function(a,o){return r(t(a,o))}})});var Hm="smaller",eJ=["typed","config","matrix","DenseMatrix","concat"],wx=T(Hm,eJ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=ca({typed:e});return e(Hm,tJ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<p,"BigNumber, BigNumber":function(p,m){return p.lt(m)&&!gn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)===-1,"Complex, Complex":function(p,m){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:u,DS:o,Ss:s}))}),tJ=T(Hm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Hm,{"number, number":function(i,a){return i<a&&!Jr(i,a,t.epsilon)}})});var Gm="smallerEq",rJ=["typed","config","matrix","DenseMatrix","concat"],_x=T(Gm,rJ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=ca({typed:e});return e(Gm,nJ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f<=p,"BigNumber, BigNumber":function(p,m){return p.lte(m)||gn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:u,DS:o,Ss:s}))}),nJ=T(Gm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Gm,{"number, number":function(i,a){return i<=a||Jr(i,a,t.epsilon)}})});var Wm="larger",iJ=["typed","config","matrix","DenseMatrix","concat"],Sx=T(Wm,iJ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=ca({typed:e});return e(Wm,aJ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>p,"BigNumber, BigNumber":function(p,m){return p.gt(m)&&!gn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)===1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:u,DS:o,Ss:s}))}),aJ=T(Wm,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Wm,{"number, number":function(i,a){return i>a&&!Jr(i,a,t.epsilon)}})});var Ym="largerEq",oJ=["typed","config","matrix","DenseMatrix","concat"],Ax=T(Ym,oJ,n=>{var{typed:e,config:t,matrix:r,DenseMatrix:i,concat:a}=n,o=kr({typed:e}),u=Mn({typed:e,DenseMatrix:i}),s=cr({typed:e,DenseMatrix:i}),l=Ct({typed:e,matrix:r,concat:a}),c=ca({typed:e});return e(Ym,sJ({typed:e,config:t}),{"boolean, boolean":(f,p)=>f>=p,"BigNumber, BigNumber":function(p,m){return p.gte(m)||gn(p,m,t.epsilon)},"Fraction, Fraction":(f,p)=>f.compare(p)!==-1,"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:u,DS:o,Ss:s}))}),sJ=T(Ym,["typed","config"],n=>{var{typed:e,config:t}=n;return e(Ym,{"number, number":function(i,a){return i>=a||Jr(i,a,t.epsilon)}})});var WF="deepEqual",uJ=["typed","equal"],Mx=T(WF,uJ,n=>{var{typed:e,equal:t}=n;return e(WF,{"any, any":function(a,o){return r(a.valueOf(),o.valueOf())}});function r(i,a){if(Array.isArray(i))if(Array.isArray(a)){var o=i.length;if(o!==a.length)return!1;for(var u=0;u<o;u++)if(!r(i[u],a[u]))return!1;return!0}else return!1;else return Array.isArray(a)?!1:t(i,a)}});var jm="unequal",lJ=["typed","config","equalScalar","matrix","DenseMatrix","concat"],Ex=T(jm,lJ,n=>{var{typed:e,config:t,equalScalar:r,matrix:i,DenseMatrix:a,concat:o}=n,u=kr({typed:e}),s=Mn({typed:e,DenseMatrix:a}),l=cr({typed:e,DenseMatrix:a}),c=Ct({typed:e,matrix:i,concat:o});return e(jm,cJ({typed:e,equalScalar:r}),c({elop:f,SS:s,DS:u,Ss:l}));function f(p,m){return!r(p,m)}}),cJ=T(jm,["typed","equalScalar"],n=>{var{typed:e,equalScalar:t}=n;return e(jm,{"any, any":function(i,a){return i===null?a!==null:a===null?i!==null:i===void 0?a!==void 0:a===void 0?i!==void 0:!t(i,a)}})});var YF="partitionSelect",fJ=["typed","isNumeric","isNaN","compare"],Dx=T(YF,fJ,n=>{var{typed:e,isNumeric:t,isNaN:r,compare:i}=n,a=i,o=(l,c)=>-i(l,c);return e(YF,{"Array | Matrix, number":function(c,f){return u(c,f,a)},"Array | Matrix, number, string":function(c,f,p){if(p==="asc")return u(c,f,a);if(p==="desc")return u(c,f,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":u});function u(l,c,f){if(!nt(c)||c<0)throw new Error("k must be a non-negative integer");if(ot(l)){var p=l.size();if(p.length>1)throw new Error("Only one dimensional matrices supported");return s(l.valueOf(),c,f)}if(Array.isArray(l))return s(l,c,f)}function s(l,c,f){if(c>=l.length)throw new Error("k out of bounds");for(var p=0;p<l.length;p++)if(t(l[p])&&r(l[p]))return l[p];for(var m=0,h=l.length-1;m<h;){for(var d=m,g=h,y=l[Math.floor(Math.random()*(h-m+1))+m];d<g;)if(f(l[d],y)>=0){var S=l[g];l[g]=l[d],l[d]=S,--g}else++d;f(l[d],y)>0&&--d,c<=d?h=d:m=d+1}return l[c]}});var jF="sort",pJ=["typed","matrix","compare","compareNatural"],Nx=T(jF,pJ,n=>{var{typed:e,matrix:t,compare:r,compareNatural:i}=n,a=r,o=(c,f)=>-r(c,f);return e(jF,{Array:function(f){return s(f),f.sort(a)},Matrix:function(f){return l(f),t(f.toArray().sort(a),f.storage())},"Array, function":function(f,p){return s(f),f.sort(p)},"Matrix, function":function(f,p){return l(f),t(f.toArray().sort(p),f.storage())},"Array, string":function(f,p){return s(f),f.sort(u(p))},"Matrix, string":function(f,p){return l(f),t(f.toArray().sort(u(p)),f.storage())}});function u(c){if(c==="asc")return a;if(c==="desc")return o;if(c==="natural")return i;throw new Error('String "asc", "desc", or "natural" expected')}function s(c){if(_t(c).length!==1)throw new Error("One dimensional array expected")}function l(c){if(c.size().length!==1)throw new Error("One dimensional matrix expected")}});var ZF="max",mJ=["typed","config","numeric","larger"],Gc=T(ZF,mJ,n=>{var{typed:e,config:t,numeric:r,larger:i}=n;return e(ZF,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(s,l){return ps(s,l.valueOf(),a)},"...":function(s){if(la(s))throw new TypeError("Scalar values expected in function max");return o(s)}});function a(u,s){try{return i(u,s)?u:s}catch(l){throw an(l,"max",s)}}function o(u){var s;if(ti(u,function(l){try{isNaN(l)&&typeof l=="number"?s=NaN:(s===void 0||i(l,s))&&(s=l)}catch(c){throw an(c,"max",l)}}),s===void 0)throw new Error("Cannot calculate max of an empty array");return typeof s=="string"&&(s=r(s,t.number)),s}});var JF="min",dJ=["typed","config","numeric","smaller"],Wc=T(JF,dJ,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n;return e(JF,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(s,l){return ps(s,l.valueOf(),a)},"...":function(s){if(la(s))throw new TypeError("Scalar values expected in function min");return o(s)}});function a(u,s){try{return i(u,s)?u:s}catch(l){throw an(l,"min",s)}}function o(u){var s;if(ti(u,function(l){try{isNaN(l)&&typeof l=="number"?s=NaN:(s===void 0||i(l,s))&&(s=l)}catch(c){throw an(c,"min",l)}}),s===void 0)throw new Error("Cannot calculate min of an empty array");return typeof s=="string"&&(s=r(s,t.number)),s}});var hJ="ImmutableDenseMatrix",gJ=["smaller","DenseMatrix"],Tx=T(hJ,gJ,n=>{var{smaller:e,DenseMatrix:t}=n;function r(i,a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(a&&!rn(a))throw new Error("Invalid datatype: "+a);if(ot(i)||nr(i)){var o=new t(i,a);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(i&&nr(i.data)&&nr(i.size))this._data=i.data,this._size=i.size,this._datatype=i.datatype,this._min=typeof i.min<"u"?i.min:null,this._max=typeof i.max<"u"?i.max:null;else{if(i)throw new TypeError("Unsupported type of data ("+Kt(i)+")");this._data=[],this._size=[0],this._datatype=a,this._min=null,this._max=null}}return r.prototype=new t,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(i){switch(arguments.length){case 1:{var a=t.prototype.subset.call(this,i);return ot(a)?new r({data:a._data,size:a._size,datatype:a._datatype}):a}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:vt(this._data),size:vt(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(i){return new r(i)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.prototype.min=function(){if(this._min===null){var i=null;this.forEach(function(a){(i===null||e(a,i))&&(i=a)}),this._min=i!==null?i:void 0}return this._min},r.prototype.max=function(){if(this._max===null){var i=null;this.forEach(function(a){(i===null||e(i,a))&&(i=a)}),this._max=i!==null?i:void 0}return this._max},r},{isClass:!0});var vJ="Index",yJ=["ImmutableDenseMatrix","getMatrixDataType"],Cx=T(vJ,yJ,n=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=n;function r(a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var o=0,u=arguments.length;o<u;o++){var s=arguments[o],l=nr(s),c=ot(s),f=null;if(il(s))this._dimensions.push(s),this._isScalar=!1;else if(l||c){var p=void 0;t(s)==="boolean"?(l&&(p=i(XF(s).valueOf())),c&&(p=i(XF(s._data).valueOf())),f=s.valueOf().length):p=i(s.valueOf()),this._dimensions.push(p);var m=p.size();(m.length!==1||m[0]!==1||f!==null)&&(this._isScalar=!1)}else if(typeof s=="number")this._dimensions.push(i([s]));else if(typeof s=="string")this._dimensions.push(s);else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}r.prototype.type="Index",r.prototype.isIndex=!0;function i(a){for(var o=0,u=a.length;o<u;o++)if(typeof a[o]!="number"||!nt(a[o]))throw new TypeError("Index parameters must be positive integer numbers");return new e(a)}return r.prototype.clone=function(){var a=new r;return a._dimensions=vt(this._dimensions),a._isScalar=this._isScalar,a._sourceSize=this._sourceSize,a},r.create=function(a){var o=new r;return r.apply(o,a),o},r.prototype.size=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?1:s.size()[0]}return a},r.prototype.max=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?s:s.max()}return a},r.prototype.min=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a[o]=typeof s=="string"?s:s.min()}return a},r.prototype.forEach=function(a){for(var o=0,u=this._dimensions.length;o<u;o++)a(this._dimensions[o],o,this)},r.prototype.dimension=function(a){return this._dimensions[a]||null},r.prototype.isObjectProperty=function(){return this._dimensions.length===1&&typeof this._dimensions[0]=="string"},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];a.push(typeof s=="string"?s:s.toArray())}return a},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var a=[],o=0,u=this._dimensions.length;o<u;o++){var s=this._dimensions[o];typeof s=="string"?a.push(JSON.stringify(s)):a.push(s.toString())}return"["+a.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(a){return r.create(a.dimensions)},r},{isClass:!0});function XF(n){var e=[];return n.forEach((t,r)=>{t&&e.push(r)}),e}var bJ="FibonacciHeap",xJ=["smaller","larger"],Fx=T(bJ,xJ,n=>{var{smaller:e,larger:t}=n,r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(c,f){var p={key:c,value:f,degree:0};if(this._minimum){var m=this._minimum;p.left=m,p.right=m.right,m.right=p,p.right.left=p,e(c,m.key)&&(this._minimum=p)}else p.left=p,p.right=p,this._minimum=p;return this._size++,p},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return this._size===0},i.prototype.extractMinimum=function(){var c=this._minimum;if(c===null)return c;for(var f=this._minimum,p=c.degree,m=c.child;p>0;){var h=m.right;m.left.right=m.right,m.right.left=m.left,m.left=f,m.right=f.right,f.right=m,m.right.left=m,m.parent=null,m=h,p--}return c.left.right=c.right,c.right.left=c.left,c===c.right?f=null:(f=c.right,f=l(f,this._size)),this._size--,this._minimum=f,c},i.prototype.remove=function(c){this._minimum=a(this._minimum,c,-1),this.extractMinimum()};function a(c,f,p){f.key=p;var m=f.parent;return m&&e(f.key,m.key)&&(o(c,f,m),u(c,m)),e(f.key,c.key)&&(c=f),c}function o(c,f,p){f.left.right=f.right,f.right.left=f.left,p.degree--,p.child===f&&(p.child=f.right),p.degree===0&&(p.child=null),f.left=c,f.right=c.right,c.right=f,f.right.left=f,f.parent=null,f.mark=!1}function u(c,f){var p=f.parent;p&&(f.mark?(o(c,f,p),u(p)):f.mark=!0)}var s=function(f,p){f.left.right=f.right,f.right.left=f.left,f.parent=p,p.child?(f.left=p.child,f.right=p.child.right,p.child.right=f,f.right.left=f):(p.child=f,f.right=f,f.left=f),p.degree++,f.mark=!1};function l(c,f){var p=Math.floor(Math.log(f)*r)+1,m=new Array(p),h=0,d=c;if(d)for(h++,d=d.right;d!==c;)h++,d=d.right;for(var g;h>0;){for(var y=d.degree,S=d.right;g=m[y],!!g;){if(t(d.key,g.key)){var b=g;g=d,d=b}s(g,d),m[y]=null,y++}m[y]=d,d=S,h--}c=null;for(var w=0;w<p;w++)g=m[w],g&&(c?(g.left.right=g.right,g.right.left=g.left,g.left=c,g.right=c.right,c.right=g,g.right.left=g,e(g.key,c.key)&&(c=g)):c=g);return c}return i},{isClass:!0});var wJ="Spa",_J=["addScalar","equalScalar","FibonacciHeap"],Ix=T(wJ,_J,n=>{var{addScalar:e,equalScalar:t,FibonacciHeap:r}=n;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(a,o){if(this._values[a])this._values[a].value=o;else{var u=this._heap.insert(a,o);this._values[a]=u}},i.prototype.get=function(a){var o=this._values[a];return o?o.value:0},i.prototype.accumulate=function(a,o){var u=this._values[a];u?u.value=e(u.value,o):(u=this._heap.insert(a,o),this._values[a]=u)},i.prototype.forEach=function(a,o,u){var s=this._heap,l=this._values,c=[],f=s.extractMinimum();for(f&&c.push(f);f&&f.key<=o;)f.key>=a&&(t(f.value,0)||u(f.key,f.value,this)),f=s.extractMinimum(),f&&c.push(f);for(var p=0;p<c.length;p++){var m=c[p];f=s.insert(m.key,m.value),l[f.key]=f}},i.prototype.swap=function(a,o){var u=this._values[a],s=this._values[o];if(!u&&s)u=this._heap.insert(a,s.value),this._heap.remove(s),this._values[a]=u,this._values[o]=void 0;else if(u&&!s)s=this._heap.insert(o,u.value),this._heap.remove(u),this._values[o]=s,this._values[a]=void 0;else if(u&&s){var l=u.value;u.value=s.value,s.value=l}},i},{isClass:!0});var QF=ru(function(n){return new n(1).exp()},{hasher:Zm}),KF=ru(function(n){return new n(1).plus(new n(5).sqrt()).div(2)},{hasher:Zm}),Yc=ru(function(n){return n.acos(-1)},{hasher:Zm}),e2=ru(function(n){return Yc(n).times(2)},{hasher:Zm});function Zm(n){return n[0].precision}function t2(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Px(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t2(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):t2(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var SJ="Unit",AJ=["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],kx=T(SJ,AJ,n=>{var{on:e,config:t,addScalar:r,subtractScalar:i,multiplyScalar:a,divideScalar:o,pow:u,abs:s,fix:l,round:c,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=n,S=h;function b(te,oe){if(!(this instanceof b))throw new Error("Constructor must be called with the new operator");if(!(te==null||p(te)||gi(te)))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,oe===void 0)this.units=[],this.dimensions=W.map(ie=>0);else if(typeof oe=="string"){var he=b.parse(oe);this.units=he.units,this.dimensions=he.dimensions}else if(Un(oe)&&oe.value===null)this.fixPrefix=oe.fixPrefix,this.skipAutomaticSimplification=oe.skipAutomaticSimplification,this.dimensions=oe.dimensions.slice(0),this.units=oe.units.map(ie=>zr({},ie));else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(te)}Object.defineProperty(b,"name",{value:"Unit"}),b.prototype.constructor=b,b.prototype.type="Unit",b.prototype.isUnit=!0;var w,A,x;function D(){for(;x===" "||x==="	";)N()}function E(te){return te>="0"&&te<="9"||te==="."}function _(te){return te>="0"&&te<="9"}function N(){A++,x=w.charAt(A)}function P(te){A=te,x=w.charAt(A)}function B(){var te="",oe=A;if(x==="+"?N():x==="-"&&(te+=x,N()),!E(x))return P(oe),null;if(x==="."){if(te+=x,N(),!_(x))return P(oe),null}else{for(;_(x);)te+=x,N();x==="."&&(te+=x,N())}for(;_(x);)te+=x,N();if(x==="E"||x==="e"){var he="",ie=A;if(he+=x,N(),(x==="+"||x==="-")&&(he+=x,N()),!_(x))return P(ie),te;for(te=te+he;_(x);)te+=x,N()}return te}function V(){for(var te="";_(x)||b.isValidAlpha(x);)te+=x,N();var oe=te.charAt(0);return b.isValidAlpha(oe)?te:null}function z(te){return x===te?(N(),te):null}b.parse=function(te,oe){if(oe=oe||{},w=te,A=-1,x="",typeof w!="string")throw new TypeError("Invalid argument in Unit.parse, string expected");var he=new b;he.units=[];var ie=1,re=!1;N(),D();var le=B(),Te=null;if(le){if(t.number==="BigNumber")Te=new g(le);else if(t.number==="Fraction")try{Te=new y(le)}catch{Te=parseFloat(le)}else Te=parseFloat(le);D(),z("*")?(ie=1,re=!0):z("/")&&(ie=-1,re=!0)}for(var Ie=[],Ze=1;;){for(D();x==="(";)Ie.push(ie),Ze*=ie,ie=1,N(),D();var xe=void 0;if(x){var ht=x;if(xe=V(),xe===null)throw new SyntaxError('Unexpected "'+ht+'" in "'+w+'" at index '+A.toString())}else break;var Nt=L(xe);if(Nt===null)throw new SyntaxError('Unit "'+xe+'" not found.');var Ht=ie*Ze;if(D(),z("^")){D();var Et=B();if(Et===null)throw new SyntaxError('In "'+te+'", "^" must be followed by a floating-point number');Ht*=Et}he.units.push({unit:Nt.unit,prefix:Nt.prefix,power:Ht});for(var ae=0;ae<W.length;ae++)he.dimensions[ae]+=(Nt.unit.dimensions[ae]||0)*Ht;for(D();x===")";){if(Ie.length===0)throw new SyntaxError('Unmatched ")" in "'+w+'" at index '+A.toString());Ze/=Ie.pop(),N(),D()}if(re=!1,z("*")?(ie=1,re=!0):z("/")?(ie=-1,re=!0):ie=1,Nt.unit.base){var de=Nt.unit.base.key;pe.auto[de]={unit:Nt.unit,prefix:Nt.prefix}}}if(D(),x)throw new SyntaxError('Could not parse: "'+te+'"');if(re)throw new SyntaxError('Trailing characters: "'+te+'"');if(Ie.length!==0)throw new SyntaxError('Unmatched "(" in "'+w+'"');if(he.units.length===0&&!oe.allowNoUnits)throw new SyntaxError('"'+te+'" contains no units');return he.value=Te!==void 0?he._normalize(Te):null,he},b.prototype.clone=function(){var te=new b;te.fixPrefix=this.fixPrefix,te.skipAutomaticSimplification=this.skipAutomaticSimplification,te.value=vt(this.value),te.dimensions=this.dimensions.slice(0),te.units=[];for(var oe=0;oe<this.units.length;oe++){te.units[oe]={};for(var he in this.units[oe])ut(this.units[oe],he)&&(te.units[oe][he]=this.units[oe][he])}return te},b.prototype.valueType=function(){return Kt(this.value)},b.prototype._isDerived=function(){return this.units.length===0?!1:this.units.length>1||Math.abs(this.units[0].power-1)>1e-15},b.prototype._normalize=function(te){if(te==null||this.units.length===0)return te;for(var oe=te,he=b._getNumberConverter(Kt(te)),ie=0;ie<this.units.length;ie++){var re=he(this.units[ie].unit.value),le=he(this.units[ie].prefix.value),Te=he(this.units[ie].power);oe=a(oe,u(a(re,le),Te))}return oe},b.prototype._denormalize=function(te,oe){if(te==null||this.units.length===0)return te;for(var he=te,ie=b._getNumberConverter(Kt(te)),re=0;re<this.units.length;re++){var le=ie(this.units[re].unit.value),Te=ie(this.units[re].prefix.value),Ie=ie(this.units[re].power);he=o(he,u(a(le,Te),Ie))}return he};var L=ru(te=>{if(ut(U,te)){var oe=U[te],he=oe.prefixes[""];return{unit:oe,prefix:he}}for(var ie in U)if(ut(U,ie)&&JN(te,ie)){var re=U[ie],le=te.length-ie.length,Te=te.substring(0,le),Ie=ut(re.prefixes,Te)?re.prefixes[Te]:void 0;if(Ie!==void 0)return{unit:re,prefix:Ie}}return null},{hasher:te=>te[0],limit:100});b.isValuelessUnit=function(te){return L(te)!==null},b.prototype.hasBase=function(te){if(typeof te=="string"&&(te=O[te]),!te)return!1;for(var oe=0;oe<W.length;oe++)if(Math.abs((this.dimensions[oe]||0)-(te.dimensions[oe]||0))>1e-12)return!1;return!0},b.prototype.equalBase=function(te){for(var oe=0;oe<W.length;oe++)if(Math.abs((this.dimensions[oe]||0)-(te.dimensions[oe]||0))>1e-12)return!1;return!0},b.prototype.equals=function(te){return this.equalBase(te)&&f(this.value,te.value)},b.prototype.multiply=function(te){for(var oe=this.clone(),he=Un(te)?te:new b(te),ie=0;ie<W.length;ie++)oe.dimensions[ie]=(this.dimensions[ie]||0)+(he.dimensions[ie]||0);for(var re=0;re<he.units.length;re++){var le=Px({},he.units[re]);oe.units.push(le)}if(this.value!==null||he.value!==null){var Te=this.value===null?this._normalize(1):this.value,Ie=he.value===null?he._normalize(1):he.value;oe.value=a(Te,Ie)}else oe.value=null;return Un(te)&&(oe.skipAutomaticSimplification=!1),k(oe)},b.prototype.divideInto=function(te){return new b(te).divide(this)},b.prototype.divide=function(te){for(var oe=this.clone(),he=Un(te)?te:new b(te),ie=0;ie<W.length;ie++)oe.dimensions[ie]=(this.dimensions[ie]||0)-(he.dimensions[ie]||0);for(var re=0;re<he.units.length;re++){var le=Px(Px({},he.units[re]),{},{power:-he.units[re].power});oe.units.push(le)}if(this.value!==null||he.value!==null){var Te=this.value===null?this._normalize(1):this.value,Ie=he.value===null?he._normalize(1):he.value;oe.value=o(Te,Ie)}else oe.value=null;return Un(te)&&(oe.skipAutomaticSimplification=!1),k(oe)},b.prototype.pow=function(te){for(var oe=this.clone(),he=0;he<W.length;he++)oe.dimensions[he]=(this.dimensions[he]||0)*te;for(var ie=0;ie<oe.units.length;ie++)oe.units[ie].power*=te;return oe.value!==null?oe.value=u(oe.value,te):oe.value=null,oe.skipAutomaticSimplification=!1,k(oe)};function k(te){return te.equalBase(O.NONE)&&te.value!==null&&!t.predictable?te.value:te}b.prototype.abs=function(){var te=this.clone();if(te.value!==null)if(te._isDerived()||te.units.length===0||te.units[0].unit.offset===0)te.value=s(te.value);else{var oe=te._numberConverter(),he=oe(te.units[0].unit.value),ie=oe(te.units[0].unit.offset),re=a(he,ie);te.value=i(s(r(te.value,re)),re)}for(var le in te.units)(te.units[le].unit.name==="VA"||te.units[le].unit.name==="VAR")&&(te.units[le].unit=U.W);return te},b.prototype.to=function(te){var oe=this.value===null?this._normalize(1):this.value,he;if(typeof te=="string")he=b.parse(te);else if(Un(te))he=te.clone();else throw new Error("String or Unit expected as parameter");if(!this.equalBase(he))throw new Error("Units do not match ('".concat(he.toString(),"' != '").concat(this.toString(),"')"));if(he.value!==null)throw new Error("Cannot convert to a unit with a value");if(this.value===null||this._isDerived()||this.units.length===0||he.units.length===0||this.units[0].unit.offset===he.units[0].unit.offset)he.value=vt(oe);else{var ie=b._getNumberConverter(Kt(oe)),re=this.units[0].unit.value,le=this.units[0].unit.offset,Te=a(re,le),Ie=he.units[0].unit.value,Ze=he.units[0].unit.offset,xe=a(Ie,Ze);he.value=r(oe,ie(i(Te,xe)))}return he.fixPrefix=!0,he.skipAutomaticSimplification=!0,he},b.prototype.toNumber=function(te){return S(this.toNumeric(te))},b.prototype.toNumeric=function(te){var oe;return te?oe=this.to(te):oe=this.clone(),oe._isDerived()||oe.units.length===0?oe._denormalize(oe.value):oe._denormalize(oe.value,oe.units[0].prefix.value)},b.prototype.toString=function(){return this.format()},b.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},b.fromJSON=function(te){var oe=new b(te.value,te.unit);return oe.fixPrefix=te.fixPrefix||!1,oe},b.prototype.valueOf=b.prototype.toString,b.prototype.simplify=function(){var te=this.clone(),oe=[],he;for(var ie in _e)if(ut(_e,ie)&&te.hasBase(O[ie])){he=ie;break}if(he==="NONE")te.units=[];else{var re;if(he&&ut(_e,he)&&(re=_e[he]),re)te.units=[{unit:re.unit,prefix:re.prefix,power:1}];else{for(var le=!1,Te=0;Te<W.length;Te++){var Ie=W[Te];Math.abs(te.dimensions[Te]||0)>1e-12&&(ut(_e,Ie)?oe.push({unit:_e[Ie].unit,prefix:_e[Ie].prefix,power:te.dimensions[Te]||0}):le=!0)}oe.length<te.units.length&&!le&&(te.units=oe)}}return te},b.prototype.toSI=function(){for(var te=this.clone(),oe=[],he=0;he<W.length;he++){var ie=W[he];if(Math.abs(te.dimensions[he]||0)>1e-12)if(ut(pe.si,ie))oe.push({unit:pe.si[ie].unit,prefix:pe.si[ie].prefix,power:te.dimensions[he]||0});else throw new Error("Cannot express custom unit "+ie+" in SI units")}return te.units=oe,te.fixPrefix=!0,te.skipAutomaticSimplification=!0,this.value!==null?(te.value=null,this.to(te)):te},b.prototype.formatUnits=function(){for(var te="",oe="",he=0,ie=0,re=0;re<this.units.length;re++)this.units[re].power>0?(he++,te+=" "+this.units[re].prefix.name+this.units[re].unit.name,Math.abs(this.units[re].power-1)>1e-15&&(te+="^"+this.units[re].power)):this.units[re].power<0&&ie++;if(ie>0)for(var le=0;le<this.units.length;le++)this.units[le].power<0&&(he>0?(oe+=" "+this.units[le].prefix.name+this.units[le].unit.name,Math.abs(this.units[le].power+1)>1e-15&&(oe+="^"+-this.units[le].power)):(oe+=" "+this.units[le].prefix.name+this.units[le].unit.name,oe+="^"+this.units[le].power));te=te.substr(1),oe=oe.substr(1),he>1&&ie>0&&(te="("+te+")"),ie>1&&he>0&&(oe="("+oe+")");var Te=te;return he>0&&ie>0&&(Te+=" / "),Te+=oe,Te},b.prototype.format=function(te){var oe=this.skipAutomaticSimplification||this.value===null?this.clone():this.simplify(),he=!1;typeof oe.value<"u"&&oe.value!==null&&gi(oe.value)&&(he=Math.abs(oe.value.re)<1e-14);for(var ie in oe.units)ut(oe.units,ie)&&oe.units[ie].unit&&(oe.units[ie].unit.name==="VA"&&he?oe.units[ie].unit=U.VAR:oe.units[ie].unit.name==="VAR"&&!he&&(oe.units[ie].unit=U.VA));oe.units.length===1&&!oe.fixPrefix&&Math.abs(oe.units[0].power-Math.round(oe.units[0].power))<1e-14&&(oe.units[0].prefix=oe._bestPrefix());var re=oe._denormalize(oe.value),le=oe.value!==null?m(re,te||{}):"",Te=oe.formatUnits();return oe.value&&gi(oe.value)&&(le="("+le+")"),Te.length>0&&le.length>0&&(le+=" "),le+=Te,le},b.prototype._bestPrefix=function(){if(this.units.length!==1)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var te=this.value!==null?s(this.value):0,oe=s(this.units[0].unit.value),he=this.units[0].prefix;if(te===0)return he;var ie=this.units[0].power,re=Math.log(te/Math.pow(he.value*oe,ie))/Math.LN10-1.2;if(re>-2.200001&&re<1.800001)return he;re=Math.abs(re);var le=this.units[0].unit.prefixes;for(var Te in le)if(ut(le,Te)){var Ie=le[Te];if(Ie.scientific){var Ze=Math.abs(Math.log(te/Math.pow(Ie.value*oe,ie))/Math.LN10-1.2);(Ze<re||Ze===re&&Ie.name.length<he.name.length)&&(he=Ie,re=Ze)}}return he},b.prototype.splitUnit=function(te){for(var oe=this.clone(),he=[],ie=0;ie<te.length&&(oe=oe.to(te[ie]),ie!==te.length-1);ie++){var re=oe.toNumeric(),le=c(re),Te=void 0,Ie=f(le,re);Ie?Te=le:Te=l(oe.toNumeric());var Ze=new b(Te,te[ie].toString());he.push(Ze),oe=i(oe,Ze)}for(var xe=0,ht=0;ht<he.length;ht++)xe=r(xe,he[ht].value);return f(xe,this.value)&&(oe.value=0),he.push(oe),he};var C={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};C.SHORTLONG=zr({},C.SHORT,C.LONG),C.BINARY_SHORT=zr({},C.BINARY_SHORT_SI,C.BINARY_SHORT_IEC),C.BINARY_LONG=zr({},C.BINARY_LONG_SI,C.BINARY_LONG_IEC);var W=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],O={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var H in O)ut(O,H)&&(O[H].key=H);var Z={},Q={name:"",base:Z,value:1,offset:0,dimensions:W.map(te=>0)},U={meter:{name:"meter",base:O.LENGTH,prefixes:C.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:C.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rod:{name:"rod",base:O.LENGTH,prefixes:C.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:C.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:C.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:C.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:C.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:C.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:C.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:C.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:C.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:C.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:C.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:C.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:C.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:C.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:C.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:C.NONE,value:2589988110336e-6,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:C.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:C.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:C.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:C.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:C.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:C.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:C.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:C.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:C.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:C.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:C.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:C.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:C.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:C.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:C.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:C.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:C.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:C.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:O.VOLUME,prefixes:C.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:O.VOLUME,prefixes:C.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:O.VOLUME,prefixes:C.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:O.VOLUME,prefixes:C.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:O.VOLUME,prefixes:C.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:O.VOLUME,prefixes:C.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:O.VOLUME,prefixes:C.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:O.VOLUME,prefixes:C.NONE,value:.1173478,offset:0},obl:{name:"obl",base:O.VOLUME,prefixes:C.NONE,value:.1589873,offset:0},g:{name:"g",base:O.MASS,prefixes:C.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:C.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:C.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:C.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:C.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:O.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:C.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:C.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:C.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:C.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:C.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:C.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:C.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:C.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:C.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:C.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:C.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:C.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:C.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:C.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:C.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:C.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:C.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:C.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:C.NONE,value:7*86400,offset:0},month:{name:"month",base:O.TIME,prefixes:C.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:C.NONE,value:31557600,offset:0},decade:{name:"decade",base:O.TIME,prefixes:C.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:C.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:C.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:C.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:C.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:C.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:C.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:C.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:C.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:C.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:C.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:C.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:C.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:C.LONG,value:1,offset:0},K:{name:"K",base:O.TEMPERATURE,prefixes:C.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:C.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:C.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:C.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:C.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:C.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:C.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:C.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:C.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:C.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:C.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:C.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:C.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:C.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:C.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:C.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:C.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:C.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:C.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:C.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:C.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:C.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:C.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:C.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:C.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:C.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:C.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:C.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:C.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:C.SHORT,value:d.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:C.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:C.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:C.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:C.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:C.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:C.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:C.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:C.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:C.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:C.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:C.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:C.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:C.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:C.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:C.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:C.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:C.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:C.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:C.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:C.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:C.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:C.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:C.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:C.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:O.BIT,prefixes:C.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:C.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:C.BINARY_LONG,value:8,offset:0}},me={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function De(te){if(te.number==="BigNumber"){var oe=Yc(g);U.rad.value=new g(1),U.deg.value=oe.div(180),U.grad.value=oe.div(200),U.cycle.value=oe.times(2),U.arcsec.value=oe.div(648e3),U.arcmin.value=oe.div(10800)}else U.rad.value=1,U.deg.value=Math.PI/180,U.grad.value=Math.PI/200,U.cycle.value=Math.PI*2,U.arcsec.value=Math.PI/648e3,U.arcmin.value=Math.PI/10800;U.radian.value=U.rad.value,U.degree.value=U.deg.value,U.gradian.value=U.grad.value}De(t),e&&e("config",function(te,oe){te.number!==oe.number&&De(te)});var pe={si:{NONE:{unit:Q,prefix:C.NONE[""]},LENGTH:{unit:U.m,prefix:C.SHORT[""]},MASS:{unit:U.g,prefix:C.SHORT.k},TIME:{unit:U.s,prefix:C.SHORT[""]},CURRENT:{unit:U.A,prefix:C.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:C.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:C.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:C.SHORT[""]},ANGLE:{unit:U.rad,prefix:C.SHORT[""]},BIT:{unit:U.bits,prefix:C.SHORT[""]},FORCE:{unit:U.N,prefix:C.SHORT[""]},ENERGY:{unit:U.J,prefix:C.SHORT[""]},POWER:{unit:U.W,prefix:C.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:C.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:C.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:C.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:C.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:C.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:C.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:C.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:C.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:C.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:C.SHORT[""]}}};pe.cgs=JSON.parse(JSON.stringify(pe.si)),pe.cgs.LENGTH={unit:U.m,prefix:C.SHORT.c},pe.cgs.MASS={unit:U.g,prefix:C.SHORT[""]},pe.cgs.FORCE={unit:U.dyn,prefix:C.SHORT[""]},pe.cgs.ENERGY={unit:U.erg,prefix:C.NONE[""]},pe.us=JSON.parse(JSON.stringify(pe.si)),pe.us.LENGTH={unit:U.ft,prefix:C.NONE[""]},pe.us.MASS={unit:U.lbm,prefix:C.NONE[""]},pe.us.TEMPERATURE={unit:U.degF,prefix:C.NONE[""]},pe.us.FORCE={unit:U.lbf,prefix:C.NONE[""]},pe.us.ENERGY={unit:U.BTU,prefix:C.BTU[""]},pe.us.POWER={unit:U.hp,prefix:C.NONE[""]},pe.us.PRESSURE={unit:U.psi,prefix:C.NONE[""]},pe.auto=JSON.parse(JSON.stringify(pe.si));var _e=pe.auto;b.setUnitSystem=function(te){if(ut(pe,te))_e=pe[te];else throw new Error("Unit system "+te+" does not exist. Choices are: "+Object.keys(pe).join(", "))},b.getUnitSystem=function(){for(var te in pe)if(ut(pe,te)&&pe[te]===_e)return te},b.typeConverters={BigNumber:function(oe){return oe!=null&&oe.isFraction?new g(oe.n).div(oe.d).times(oe.s):new g(oe+"")},Fraction:function(oe){return new y(oe)},Complex:function(oe){return oe},number:function(oe){return oe!=null&&oe.isFraction?h(oe):oe}},b.prototype._numberConverter=function(){var te=b.typeConverters[this.valueType()];if(te)return te;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},b._getNumberConverter=function(te){if(!b.typeConverters[te])throw new TypeError('Unsupported type "'+te+'"');return b.typeConverters[te]};for(var Ne in U)if(ut(U,Ne)){var Se=U[Ne];Se.dimensions=Se.base.dimensions}for(var Me in me)if(ut(me,Me)){var Ee=U[me[Me]],Ce={};for(var Ge in Ee)ut(Ee,Ge)&&(Ce[Ge]=Ee[Ge]);Ce.name=Me,U[Me]=Ce}b.isValidAlpha=function(oe){return/^[a-zA-Z]$/.test(oe)};function We(te){for(var oe=0;oe<te.length;oe++){if(x=te.charAt(oe),oe===0&&!b.isValidAlpha(x))throw new Error('Invalid unit name (must begin with alpha character): "'+te+'"');if(oe>0&&!(b.isValidAlpha(x)||_(x)))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+te+'"')}}return b.createUnit=function(te,oe){if(typeof te!="object")throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(oe&&oe.override){for(var he in te)if(ut(te,he)&&b.deleteUnit(he),te[he].aliases)for(var ie=0;ie<te[he].aliases.length;ie++)b.deleteUnit(te[he].aliases[ie])}var re;for(var le in te)ut(te,le)&&(re=b.createUnitSingle(le,te[le]));return re},b.createUnitSingle=function(te,oe){if((typeof oe>"u"||oe===null)&&(oe={}),typeof te!="string")throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(ut(U,te))throw new Error('Cannot create unit "'+te+'": a unit with that name already exists');We(te);var he=null,ie=[],re=0,le,Te,Ie;if(oe&&oe.type==="Unit")he=oe.clone();else if(typeof oe=="string")oe!==""&&(le=oe);else if(typeof oe=="object")le=oe.definition,Te=oe.prefixes,re=oe.offset,Ie=oe.baseName,oe.aliases&&(ie=oe.aliases.valueOf());else throw new TypeError('Cannot create unit "'+te+'" from "'+oe.toString()+'": expecting "string" or "Unit" or "Object"');if(ie){for(var Ze=0;Ze<ie.length;Ze++)if(ut(U,ie[Ze]))throw new Error('Cannot create alias "'+ie[Ze]+'": a unit with that name already exists')}if(le&&typeof le=="string"&&!he)try{he=b.parse(le,{allowNoUnits:!0})}catch(F){throw F.message='Could not create unit "'+te+'" from "'+le+'": '+F.message,F}else le&&le.type==="Unit"&&(he=le.clone());ie=ie||[],re=re||0,Te&&Te.toUpperCase?Te=C[Te.toUpperCase()]||C.NONE:Te=C.NONE;var xe={};if(he){xe={name:te,value:he.value,dimensions:he.dimensions.slice(0),prefixes:Te,offset:re};var Et=!1;for(var ae in O)if(ut(O,ae)){for(var de=!0,ge=0;ge<W.length;ge++)if(Math.abs((xe.dimensions[ge]||0)-(O[ae].dimensions[ge]||0))>1e-12){de=!1;break}if(de){Et=!0,xe.base=O[ae];break}}if(!Et){Ie=Ie||te+"_STUFF";var qe={dimensions:he.dimensions.slice(0)};qe.key=Ie,O[Ie]=qe,_e[Ie]={unit:xe,prefix:C.NONE[""]},xe.base=O[Ie]}}else{if(Ie=Ie||te+"_STUFF",W.indexOf(Ie)>=0)throw new Error('Cannot create new base unit "'+te+'": a base unit with that name already exists (and cannot be overridden)');W.push(Ie);for(var ht in O)ut(O,ht)&&(O[ht].dimensions[W.length-1]=0);for(var Nt={dimensions:[]},Ht=0;Ht<W.length;Ht++)Nt.dimensions[Ht]=0;Nt.dimensions[W.length-1]=1,Nt.key=Ie,O[Ie]=Nt,xe={name:te,value:1,dimensions:O[Ie].dimensions.slice(0),prefixes:Te,offset:re,base:O[Ie]},_e[Ie]={unit:xe,prefix:C.NONE[""]}}b.UNITS[te]=xe;for(var $e=0;$e<ie.length;$e++){var Re=ie[$e],ze={};for(var Xe in xe)ut(xe,Xe)&&(ze[Xe]=xe[Xe]);ze.name=Re,b.UNITS[Re]=ze}return delete L.cache,new b(null,te)},b.deleteUnit=function(te){delete b.UNITS[te],delete L.cache},b.PREFIXES=C,b.BASE_DIMENSIONS=W,b.BASE_UNITS=O,b.UNIT_SYSTEMS=pe,b.UNITS=U,b},{isClass:!0});var r2="unit",MJ=["typed","Unit"],Bx=T(r2,MJ,n=>{var{typed:e,Unit:t}=n;return e(r2,{Unit:function(i){return i.clone()},string:function(i){return t.isValuelessUnit(i)?new t(null,i):t.parse(i,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(i,a){return new t(i,a)},"number | BigNumber | Fraction":function(i){return new t(i)},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var n2="sparse",EJ=["typed","SparseMatrix"],Ox=T(n2,EJ,n=>{var{typed:e,SparseMatrix:t}=n;return e(n2,{"":function(){return new t([])},string:function(i){return new t([],i)},"Array | Matrix":function(i){return new t(i)},"Array | Matrix, string":function(i,a){return new t(i,a)}})});var i2="createUnit",DJ=["typed","Unit"],Rx=T(i2,DJ,n=>{var{typed:e,Unit:t}=n;return e(i2,{"Object, Object":function(i,a){return t.createUnit(i,a)},Object:function(i){return t.createUnit(i,{})},"string, Unit | string | Object, Object":function(i,a,o){var u={};return u[i]=a,t.createUnit(u,o)},"string, Unit | string | Object":function(i,a){var o={};return o[i]=a,t.createUnit(o,{})},string:function(i){var a={};return a[i]={},t.createUnit(a,{})}})});var a2="acos",NJ=["typed","config","Complex"],Lx=T(a2,NJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(a2,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.acos(a):new r(a,0).acos()},Complex:function(a){return a.acos()},BigNumber:function(a){return a.acos()}})});var o2="acosh",TJ=["typed","config","Complex"],Vx=T(o2,TJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(o2,{number:function(a){return a>=1||t.predictable?Zy(a):a<=-1?new r(Math.log(Math.sqrt(a*a-1)-a),Math.PI):new r(a,0).acosh()},Complex:function(a){return a.acosh()},BigNumber:function(a){return a.acosh()}})});var s2="acot",CJ=["typed","BigNumber"],Ux=T(s2,CJ,n=>{var{typed:e,BigNumber:t}=n;return e(s2,{number:Jy,Complex:function(i){return i.acot()},BigNumber:function(i){return new t(1).div(i).atan()}})});var u2="acoth",FJ=["typed","config","Complex","BigNumber"],qx=T(u2,FJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(u2,{number:function(o){return o>=1||o<=-1||t.predictable?Xy(o):new r(o,0).acoth()},Complex:function(o){return o.acoth()},BigNumber:function(o){return new i(1).div(o).atanh()}})});var l2="acsc",IJ=["typed","config","Complex","BigNumber"],zx=T(l2,IJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(l2,{number:function(o){return o<=-1||o>=1||t.predictable?Qy(o):new r(o,0).acsc()},Complex:function(o){return o.acsc()},BigNumber:function(o){return new i(1).div(o).asin()}})});var c2="acsch",PJ=["typed","BigNumber"],$x=T(c2,PJ,n=>{var{typed:e,BigNumber:t}=n;return e(c2,{number:Ky,Complex:function(i){return i.acsch()},BigNumber:function(i){return new t(1).div(i).asinh()}})});var f2="asec",kJ=["typed","config","Complex","BigNumber"],Hx=T(f2,kJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(f2,{number:function(o){return o<=-1||o>=1||t.predictable?e0(o):new r(o,0).asec()},Complex:function(o){return o.asec()},BigNumber:function(o){return new i(1).div(o).acos()}})});var p2="asech",BJ=["typed","config","Complex","BigNumber"],Gx=T(p2,BJ,n=>{var{typed:e,config:t,Complex:r,BigNumber:i}=n;return e(p2,{number:function(o){if(o<=1&&o>=-1||t.predictable){var u=1/o;if(u>0||t.predictable)return t0(o);var s=Math.sqrt(u*u-1);return new r(Math.log(s-u),Math.PI)}return new r(o,0).asech()},Complex:function(o){return o.asech()},BigNumber:function(o){return new i(1).div(o).acosh()}})});var m2="asin",OJ=["typed","config","Complex"],Wx=T(m2,OJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(m2,{number:function(a){return a>=-1&&a<=1||t.predictable?Math.asin(a):new r(a,0).asin()},Complex:function(a){return a.asin()},BigNumber:function(a){return a.asin()}})});var RJ="asinh",LJ=["typed"],Yx=T(RJ,LJ,n=>{var{typed:e}=n;return e("asinh",{number:r0,Complex:function(r){return r.asinh()},BigNumber:function(r){return r.asinh()}})});var VJ="atan",UJ=["typed"],jx=T(VJ,UJ,n=>{var{typed:e}=n;return e("atan",{number:function(r){return Math.atan(r)},Complex:function(r){return r.atan()},BigNumber:function(r){return r.atan()}})});var d2="atan2",qJ=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Zx=T(d2,qJ,n=>{var{typed:e,matrix:t,equalScalar:r,BigNumber:i,DenseMatrix:a,concat:o}=n,u=mn({typed:e,equalScalar:r}),s=kr({typed:e}),l=Rm({typed:e,equalScalar:r}),c=xr({typed:e,equalScalar:r}),f=cr({typed:e,DenseMatrix:a}),p=Ct({typed:e,matrix:t,concat:o});return e(d2,{"number, number":Math.atan2,"BigNumber, BigNumber":(m,h)=>i.atan2(m,h)},p({scalar:"number | BigNumber",SS:l,DS:s,SD:u,Ss:c,sS:f}))});var h2="atanh",zJ=["typed","config","Complex"],Jx=T(h2,zJ,n=>{var{typed:e,config:t,Complex:r}=n;return e(h2,{number:function(a){return a<=1&&a>=-1||t.predictable?n0(a):new r(a,0).atanh()},Complex:function(a){return a.atanh()},BigNumber:function(a){return a.atanh()}})});var pa=T("trigUnit",["typed"],n=>{var{typed:e}=n;return{Unit:e.referToSelf(t=>r=>{if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return e.find(t,r.valueType())(r.value)})}});var g2="cos",$J=["typed"],Xx=T(g2,$J,n=>{var{typed:e}=n,t=pa({typed:e});return e(g2,{number:Math.cos,"Complex | BigNumber":r=>r.cos()},t)});var v2="cosh",HJ=["typed"],Qx=T(v2,HJ,n=>{var{typed:e}=n;return e(v2,{number:vm,"Complex | BigNumber":t=>t.cosh()})});var y2="cot",GJ=["typed","BigNumber"],Kx=T(y2,GJ,n=>{var{typed:e,BigNumber:t}=n,r=pa({typed:e});return e(y2,{number:i0,Complex:i=>i.cot(),BigNumber:i=>new t(1).div(i.tan())},r)});var b2="coth",WJ=["typed","BigNumber"],e1=T(b2,WJ,n=>{var{typed:e,BigNumber:t}=n;return e(b2,{number:a0,Complex:r=>r.coth(),BigNumber:r=>new t(1).div(r.tanh())})});var x2="csc",YJ=["typed","BigNumber"],t1=T(x2,YJ,n=>{var{typed:e,BigNumber:t}=n,r=pa({typed:e});return e(x2,{number:o0,Complex:i=>i.csc(),BigNumber:i=>new t(1).div(i.sin())},r)});var w2="csch",jJ=["typed","BigNumber"],r1=T(w2,jJ,n=>{var{typed:e,BigNumber:t}=n;return e(w2,{number:s0,Complex:r=>r.csch(),BigNumber:r=>new t(1).div(r.sinh())})});var _2="sec",ZJ=["typed","BigNumber"],n1=T(_2,ZJ,n=>{var{typed:e,BigNumber:t}=n,r=pa({typed:e});return e(_2,{number:u0,Complex:i=>i.sec(),BigNumber:i=>new t(1).div(i.cos())},r)});var S2="sech",JJ=["typed","BigNumber"],i1=T(S2,JJ,n=>{var{typed:e,BigNumber:t}=n;return e(S2,{number:l0,Complex:r=>r.sech(),BigNumber:r=>new t(1).div(r.cosh())})});var A2="sin",XJ=["typed"],a1=T(A2,XJ,n=>{var{typed:e}=n,t=pa({typed:e});return e(A2,{number:Math.sin,"Complex | BigNumber":r=>r.sin()},t)});var M2="sinh",QJ=["typed"],o1=T(M2,QJ,n=>{var{typed:e}=n;return e(M2,{number:c0,"Complex | BigNumber":t=>t.sinh()})});var E2="tan",KJ=["typed"],s1=T(E2,KJ,n=>{var{typed:e}=n,t=pa({typed:e});return e(E2,{number:Math.tan,"Complex | BigNumber":r=>r.tan()},t)});var eX="tanh",tX=["typed"],u1=T(eX,tX,n=>{var{typed:e}=n;return e("tanh",{number:ym,"Complex | BigNumber":t=>t.tanh()})});var D2="setCartesian",rX=["typed","size","subset","compareNatural","Index","DenseMatrix"],l1=T(D2,rX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(D2,{"Array | Matrix, Array | Matrix":function(s,l){var c=[];if(r(t(s),new a(0))!==0&&r(t(l),new a(0))!==0){var f=kt(Array.isArray(s)?s:s.toArray()).sort(i),p=kt(Array.isArray(l)?l:l.toArray()).sort(i);c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)c.push([f[m],p[h]])}return Array.isArray(s)&&Array.isArray(l)?c:new o(c)}})});var N2="setDifference",nX=["typed","size","subset","compareNatural","Index","DenseMatrix"],c1=T(N2,nX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(N2,{"Array | Matrix, Array | Matrix":function(s,l){var c;if(r(t(s),new a(0))===0)c=[];else{if(r(t(l),new a(0))===0)return kt(s.toArray());var f=Mo(kt(Array.isArray(s)?s:s.toArray()).sort(i)),p=Mo(kt(Array.isArray(l)?l:l.toArray()).sort(i));c=[];for(var m,h=0;h<f.length;h++){m=!1;for(var d=0;d<p.length;d++)if(i(f[h].value,p[d].value)===0&&f[h].identifier===p[d].identifier){m=!0;break}m||c.push(f[h])}}return Array.isArray(s)&&Array.isArray(l)?ll(c):new o(ll(c))}})});var T2="setDistinct",iX=["typed","size","subset","compareNatural","Index","DenseMatrix"],f1=T(T2,iX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(T2,{"Array | Matrix":function(s){var l;if(r(t(s),new a(0))===0)l=[];else{var c=kt(Array.isArray(s)?s:s.toArray()).sort(i);l=[],l.push(c[0]);for(var f=1;f<c.length;f++)i(c[f],c[f-1])!==0&&l.push(c[f])}return Array.isArray(s)?l:new o(l)}})});var C2="setIntersect",aX=["typed","size","subset","compareNatural","Index","DenseMatrix"],p1=T(C2,aX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a,DenseMatrix:o}=n;return e(C2,{"Array | Matrix, Array | Matrix":function(s,l){var c;if(r(t(s),new a(0))===0||r(t(l),new a(0))===0)c=[];else{var f=Mo(kt(Array.isArray(s)?s:s.toArray()).sort(i)),p=Mo(kt(Array.isArray(l)?l:l.toArray()).sort(i));c=[];for(var m=0;m<f.length;m++)for(var h=0;h<p.length;h++)if(i(f[m].value,p[h].value)===0&&f[m].identifier===p[h].identifier){c.push(f[m]);break}}return Array.isArray(s)&&Array.isArray(l)?ll(c):new o(ll(c))}})});var F2="setIsSubset",oX=["typed","size","subset","compareNatural","Index"],m1=T(F2,oX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(F2,{"Array | Matrix, Array | Matrix":function(u,s){if(r(t(u),new a(0))===0)return!0;if(r(t(s),new a(0))===0)return!1;for(var l=Mo(kt(Array.isArray(u)?u:u.toArray()).sort(i)),c=Mo(kt(Array.isArray(s)?s:s.toArray()).sort(i)),f,p=0;p<l.length;p++){f=!1;for(var m=0;m<c.length;m++)if(i(l[p].value,c[m].value)===0&&l[p].identifier===c[m].identifier){f=!0;break}if(f===!1)return!1}return!0}})});var I2="setMultiplicity",sX=["typed","size","subset","compareNatural","Index"],d1=T(I2,sX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(I2,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(u,s){if(r(t(s),new a(0))===0)return 0;for(var l=kt(Array.isArray(s)?s:s.toArray()),c=0,f=0;f<l.length;f++)i(l[f],u)===0&&c++;return c}})});var P2="setPowerset",uX=["typed","size","subset","compareNatural","Index"],h1=T(P2,uX,n=>{var{typed:e,size:t,subset:r,compareNatural:i,Index:a}=n;return e(P2,{"Array | Matrix":function(l){if(r(t(l),new a(0))===0)return[];for(var c=kt(Array.isArray(l)?l:l.toArray()).sort(i),f=[],p=0;p.toString(2).length<=c.length;)f.push(o(c,p.toString(2).split("").reverse())),p++;return u(f)}});function o(s,l){for(var c=[],f=0;f<l.length;f++)l[f]==="1"&&c.push(s[f]);return c}function u(s){for(var l=[],c=s.length-1;c>0;c--)for(var f=0;f<c;f++)s[f].length>s[f+1].length&&(l=s[f],s[f]=s[f+1],s[f+1]=l);return s}});var k2="setSize",lX=["typed","compareNatural"],g1=T(k2,lX,n=>{var{typed:e,compareNatural:t}=n;return e(k2,{"Array | Matrix":function(i){return Array.isArray(i)?kt(i).length:kt(i.toArray()).length},"Array | Matrix, boolean":function(i,a){if(a===!1||i.length===0)return Array.isArray(i)?kt(i).length:kt(i.toArray()).length;for(var o=kt(Array.isArray(i)?i:i.toArray()).sort(t),u=1,s=1;s<o.length;s++)t(o[s],o[s-1])!==0&&u++;return u}})});var B2="setSymDifference",cX=["typed","size","concat","subset","setDifference","Index"],v1=T(B2,cX,n=>{var{typed:e,size:t,concat:r,subset:i,setDifference:a,Index:o}=n;return e(B2,{"Array | Matrix, Array | Matrix":function(s,l){if(i(t(s),new o(0))===0)return kt(l);if(i(t(l),new o(0))===0)return kt(s);var c=kt(s),f=kt(l);return r(a(c,f),a(f,c))}})});var O2="setUnion",fX=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],y1=T(O2,fX,n=>{var{typed:e,size:t,concat:r,subset:i,setIntersect:a,setSymDifference:o,Index:u}=n;return e(O2,{"Array | Matrix, Array | Matrix":function(l,c){if(i(t(l),new u(0))===0)return kt(c);if(i(t(c),new u(0))===0)return kt(l);var f=kt(l),p=kt(c);return r(o(f,p),a(f,p))}})});var R2="add",pX=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],b1=T(R2,pX,n=>{var{typed:e,matrix:t,addScalar:r,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:u}=n,s=ri({typed:e}),l=gl({typed:e,equalScalar:i}),c=Ti({typed:e,DenseMatrix:a}),f=Ct({typed:e,matrix:t,concat:u});return e(R2,{"any, any":r,"any, any, ...any":e.referToSelf(p=>(m,h,d)=>{for(var g=p(m,h),y=0;y<d.length;y++)g=p(g,d[y]);return g})},f({elop:r,DS:s,SS:l,Ss:c}))});var L2="hypot",mX=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],x1=T(L2,mX,n=>{var{typed:e,abs:t,addScalar:r,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:u,isPositive:s}=n;return e(L2,{"... number | BigNumber":l,Array:l,Matrix:c=>l(kt(c.toArray()))});function l(c){for(var f=0,p=0,m=0;m<c.length;m++){if(gi(c[m]))throw new TypeError("Unexpected type of argument to hypot");var h=t(c[m]);u(p,h)?(f=a(f,a(i(p,h),i(p,h))),f=r(f,1),p=h):f=r(f,s(h)?a(i(h,p),i(h,p)):h)}return a(p,o(f))}});var V2="norm",dX=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],w1=T(V2,dX,n=>{var{typed:e,abs:t,add:r,pow:i,conj:a,sqrt:o,multiply:u,equalScalar:s,larger:l,smaller:c,matrix:f,ctranspose:p,eigs:m}=n;return e(V2,{number:Math.abs,Complex:function(E){return E.abs()},BigNumber:function(E){return E.abs()},boolean:function(E){return Math.abs(E)},Array:function(E){return x(f(E),2)},Matrix:function(E){return x(E,2)},"Array, number | BigNumber | string":function(E,_){return x(f(E),_)},"Matrix, number | BigNumber | string":function(E,_){return x(E,_)}});function h(D){var E=0;return D.forEach(function(_){var N=t(_);l(N,E)&&(E=N)},!0),E}function d(D){var E;return D.forEach(function(_){var N=t(_);(!E||c(N,E))&&(E=N)},!0),E||0}function g(D,E){if(E===Number.POSITIVE_INFINITY||E==="inf")return h(D);if(E===Number.NEGATIVE_INFINITY||E==="-inf")return d(D);if(E==="fro")return x(D,2);if(typeof E=="number"&&!isNaN(E)){if(!s(E,0)){var _=0;return D.forEach(function(N){_=r(i(t(N),E),_)},!0),i(_,1/E)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function y(D){var E=0;return D.forEach(function(_,N){E=r(E,u(_,a(_)))}),t(o(E))}function S(D){var E=[],_=0;return D.forEach(function(N,P){var B=P[1],V=r(E[B]||0,t(N));l(V,_)&&(_=V),E[B]=V},!0),_}function b(D){var E=D.size();if(E[0]!==E[1])throw new RangeError("Invalid matrix dimensions");var _=p(D),N=u(_,D),P=m(N).values.toArray(),B=P[P.length-1];return t(o(B))}function w(D){var E=[],_=0;return D.forEach(function(N,P){var B=P[0],V=r(E[B]||0,t(N));l(V,_)&&(_=V),E[B]=V},!0),_}function A(D,E){if(E===1)return S(D);if(E===Number.POSITIVE_INFINITY||E==="inf")return w(D);if(E==="fro")return y(D);if(E===2)return b(D);throw new Error("Unsupported parameter value "+E)}function x(D,E){var _=D.size();if(_.length===1)return g(D,E);if(_.length===2){if(_[0]&&_[1])return A(D,E);throw new RangeError("Invalid matrix dimensions")}}});var U2="dot",hX=["typed","addScalar","multiplyScalar","conj","size"],_1=T(U2,hX,n=>{var{typed:e,addScalar:t,multiplyScalar:r,conj:i,size:a}=n;return e(U2,{"Array | DenseMatrix, Array | DenseMatrix":u,"SparseMatrix, SparseMatrix":s});function o(c,f){var p=l(c),m=l(f),h,d;if(p.length===1)h=p[0];else if(p.length===2&&p[1]===1)h=p[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+p.join(", ")+")");if(m.length===1)d=m[0];else if(m.length===2&&m[1]===1)d=m[0];else throw new RangeError("Expected a column vector, instead got a matrix of size ("+m.join(", ")+")");if(h!==d)throw new RangeError("Vectors must have equal length ("+h+" != "+d+")");if(h===0)throw new RangeError("Cannot calculate the dot product of empty vectors");return h}function u(c,f){var p=o(c,f),m=ot(c)?c._data:c,h=ot(c)?c._datatype||c.getDataType():void 0,d=ot(f)?f._data:f,g=ot(f)?f._datatype||f.getDataType():void 0,y=l(c).length===2,S=l(f).length===2,b=t,w=r;if(h&&g&&h===g&&typeof h=="string"&&h!=="mixed"){var A=h;b=e.find(t,[A,A]),w=e.find(r,[A,A])}if(!y&&!S){for(var x=w(i(m[0]),d[0]),D=1;D<p;D++)x=b(x,w(i(m[D]),d[D]));return x}if(!y&&S){for(var E=w(i(m[0]),d[0][0]),_=1;_<p;_++)E=b(E,w(i(m[_]),d[_][0]));return E}if(y&&!S){for(var N=w(i(m[0][0]),d[0]),P=1;P<p;P++)N=b(N,w(i(m[P][0]),d[P]));return N}if(y&&S){for(var B=w(i(m[0][0]),d[0][0]),V=1;V<p;V++)B=b(B,w(i(m[V][0]),d[V][0]));return B}}function s(c,f){o(c,f);for(var p=c._index,m=c._values,h=f._index,d=f._values,g=0,y=t,S=r,b=0,w=0;b<p.length&&w<h.length;){var A=p[b],x=h[w];if(A<x){b++;continue}if(A>x){w++;continue}A===x&&(g=y(g,S(m[b],d[w])),b++,w++)}return g}function l(c){return ot(c)?c.size():a(c)}});var gX="trace",vX=["typed","matrix","add"],S1=T(gX,vX,n=>{var{typed:e,matrix:t,add:r}=n;return e("trace",{Array:function(u){return i(t(u))},SparseMatrix:a,DenseMatrix:i,any:vt});function i(o){var u=o._size,s=o._data;switch(u.length){case 1:if(u[0]===1)return vt(s[0]);throw new RangeError("Matrix must be square (size: "+Mt(u)+")");case 2:{var l=u[0],c=u[1];if(l===c){for(var f=0,p=0;p<l;p++)f=r(f,s[p][p]);return f}else throw new RangeError("Matrix must be square (size: "+Mt(u)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(u)+")")}}function a(o){var u=o._values,s=o._index,l=o._ptr,c=o._size,f=c[0],p=c[1];if(f===p){var m=0;if(u.length>0)for(var h=0;h<p;h++)for(var d=l[h],g=l[h+1],y=d;y<g;y++){var S=s[y];if(S===h){m=r(m,u[y]);break}if(S>h)break}return m}throw new RangeError("Matrix must be square (size: "+Mt(c)+")")}});var q2="index",yX=["typed","Index"],A1=T(q2,yX,n=>{var{typed:e,Index:t}=n;return e(q2,{"...number | string | BigNumber | Range | Array | Matrix":function(i){var a=i.map(function(u){return pt(u)?u.toNumber():nr(u)||ot(u)?u.map(function(s){return pt(s)?s.toNumber():s}):u}),o=new t;return t.apply(o,a),o}})});var Jm=new Set(["end"]);var bX="Node",xX=["mathWithTransform"],M1=T(bX,xX,n=>{var{mathWithTransform:e}=n;function t(i){for(var a of[...Jm])if(i.has(a))throw new Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword')}class r{get type(){return"Node"}get isNode(){return!0}evaluate(a){return this.compile().evaluate(a)}compile(){var a=this._compile(e,{}),o={},u=null;function s(l){var c=Eo(l);return t(c),a(c,o,u)}return{evaluate:s}}_compile(a,o){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(a){throw new Error("Cannot run forEach on a Node interface")}map(a){throw new Error("Cannot run map on a Node interface")}_ifNode(a){if(!jt(a))throw new TypeError("Callback function must return a Node");return a}traverse(a){a(this,null,null);function o(u,s){u.forEach(function(l,c,f){s(l,c,f),o(l,s)})}o(this,a)}transform(a){function o(u,s,l){var c=a(u,s,l);return c!==u?c:u.map(o)}return o(this,null,null)}filter(a){var o=[];return this.traverse(function(u,s,l){a(u,s,l)&&o.push(u)}),o}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(a){return a.cloneDeep()})}equals(a){return a?this.type===a.type&&Ca(this,a):!1}toString(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toString(a)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toHTML(a)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(a){var o=this._getCustomString(a);return typeof o<"u"?o:this._toTex(a)}_toTex(a){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(a){if(a&&typeof a=="object")switch(typeof a.handler){case"object":case"undefined":return;case"function":return a.handler(this,a);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return r},{isClass:!0,isNode:!0});function Br(n){return n&&n.isIndexError?new $n(n.index+1,n.min+1,n.max!==void 0?n.max+1:void 0):n}function Xm(n){var{subset:e}=n;return function(r,i){try{if(Array.isArray(r))return e(r,i);if(r&&typeof r.subset=="function")return r.subset(i);if(typeof r=="string")return e(r,i);if(typeof r=="object"){if(!i.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return $r(r,i.getObjectProperty())}else throw new TypeError("Cannot apply index: unsupported type of object")}catch(a){throw Br(a)}}}var Qm="AccessorNode",wX=["subset","Node"],E1=T(Qm,wX,n=>{var{subset:e,Node:t}=n,r=Xm({subset:e});function i(o){return!($i(o)||qn(o)||zt(o)||vi(o)||is(o)||zn(o)||Fr(o))}class a extends t{constructor(u,s){if(super(),!jt(u))throw new TypeError('Node expected for parameter "object"');if(!sa(s))throw new TypeError('IndexNode expected for parameter "index"');this.object=u,this.index=s}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Qm}get isAccessorNode(){return!0}_compile(u,s){var l=this.object._compile(u,s),c=this.index._compile(u,s);if(this.index.isObjectProperty()){var f=this.index.getObjectProperty();return function(m,h,d){return $r(l(m,h,d),f)}}else return function(m,h,d){var g=l(m,h,d),y=c(m,h,g);return r(g,y)}}forEach(u){u(this.object,"object",this),u(this.index,"index",this)}map(u){return new a(this._ifNode(u(this.object,"object",this)),this._ifNode(u(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(u){var s=this.object.toString(u);return i(this.object)&&(s="("+s+")"),s+this.index.toString(u)}_toHTML(u){var s=this.object.toHTML(u);return i(this.object)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+this.index.toHTML(u)}_toTex(u){var s=this.object.toTex(u);return i(this.object)&&(s="\\left(' + object + '\\right)"),s+this.index.toTex(u)}toJSON(){return{mathjs:Qm,object:this.object,index:this.index}}static fromJSON(u){return new a(u.object,u.index)}}return fr(a,"name",Qm),a},{isClass:!0,isNode:!0});var Km="ArrayNode",_X=["Node"],D1=T(Km,_X,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.items=i||[],!Array.isArray(this.items)||!this.items.every(jt))throw new TypeError("Array containing Nodes expected")}get type(){return Km}get isArrayNode(){return!0}_compile(i,a){var o=Ei(this.items,function(l){return l._compile(i,a)}),u=i.config.matrix!=="Array";if(u){var s=i.matrix;return function(c,f,p){return s(Ei(o,function(m){return m(c,f,p)}))}}else return function(c,f,p){return Ei(o,function(m){return m(c,f,p)})}}forEach(i){for(var a=0;a<this.items.length;a++){var o=this.items[a];i(o,"items["+a+"]",this)}}map(i){for(var a=[],o=0;o<this.items.length;o++)a[o]=this._ifNode(i(this.items[o],"items["+o+"]",this));return new t(a)}clone(){return new t(this.items.slice(0))}_toString(i){var a=this.items.map(function(o){return o.toString(i)});return"["+a.join(", ")+"]"}toJSON(){return{mathjs:Km,items:this.items}}static fromJSON(i){return new t(i.items)}_toHTML(i){var a=this.items.map(function(o){return o.toHTML(i)});return'<span class="math-parenthesis math-square-parenthesis">[</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(i){function a(o,u){var s=o.some(qn)&&!o.every(qn),l=u||s,c=l?"&":"\\\\",f=o.map(function(p){return p.items?a(p.items,!u):p.toTex(i)}).join(c);return s||!l||l&&!u?"\\begin{bmatrix}"+f+"\\end{bmatrix}":f}return a(this.items,!1)}}return fr(t,"name",Km),t},{isClass:!0,isNode:!0});function z2(n){var{subset:e,matrix:t}=n;return function(i,a,o){try{if(Array.isArray(i)){var u=t(i).subset(a,o).valueOf();return u.forEach((s,l)=>{i[l]=s}),i}else{if(i&&typeof i.subset=="function")return i.subset(a,o);if(typeof i=="string")return e(i,a,o);if(typeof i=="object"){if(!a.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Za(i,a.getObjectProperty(),o),i}else throw new TypeError("Cannot apply index: unsupported type of object")}}catch(s){throw Br(s)}}}var ma=[{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 ed(n,e){if(!e||e!=="auto")return n;for(var t=n;zn(t);)t=t.content;return t}function gr(n,e,t,r){var i=n;e!=="keep"&&(i=n.getContent());for(var a=i.getIdentifier(),o=null,u=0;u<ma.length;u++)if(a in ma[u]){o=u;break}if(a==="OperatorNode:multiply"&&i.implicit&&t!=="show"){var s=ed(i.args[0],e);!(zt(s)&&r&&r.getIdentifier()==="OperatorNode:divide"&&wc(ed(r.args[0],e)))&&!(s.getIdentifier()==="OperatorNode:divide"&&wc(ed(s.args[0],e))&&zt(ed(s.args[1])))&&(o+=1)}return o}function Sl(n,e){var t=n;e!=="keep"&&(t=n.getContent());var r=t.getIdentifier(),i=gr(t,e);if(i===null)return null;var a=ma[i][r];if(ut(a,"associativity")){if(a.associativity==="left")return"left";if(a.associativity==="right")return"right";throw Error("'"+r+"' has the invalid associativity '"+a.associativity+"'.")}return null}function td(n,e,t){var r=t!=="keep"?n.getContent():n,i=t!=="keep"?n.getContent():e,a=r.getIdentifier(),o=i.getIdentifier(),u=gr(r,t);if(u===null)return null;var s=ma[u][a];if(ut(s,"associativeWith")&&s.associativeWith instanceof Array){for(var l=0;l<s.associativeWith.length;l++)if(s.associativeWith[l]===o)return!0;return!1}return null}function $2(n){var e="OperatorNode:"+n;for(var t of ma)if(e in t)return t[e].op;return null}var rd="AssignmentNode",SX=["subset","?matrix","Node"],N1=T(rd,SX,n=>{var{subset:e,matrix:t,Node:r}=n,i=Xm({subset:e}),a=z2({subset:e,matrix:t});function o(s,l,c){l||(l="keep");var f=gr(s,l,c),p=gr(s.value,l,c);return l==="all"||p!==null&&p<=f}class u extends r{constructor(l,c,f){if(super(),this.object=l,this.index=f?c:null,this.value=f||c,!Fr(l)&&!$i(l))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Fr(l)&&l.name==="end")throw new Error('Cannot assign to symbol "end"');if(this.index&&!sa(this.index))throw new TypeError('IndexNode expected as "index"');if(!jt(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return rd}get isAssignmentNode(){return!0}_compile(l,c){var f=this.object._compile(l,c),p=this.index?this.index._compile(l,c):null,m=this.value._compile(l,c),h=this.object.name;if(this.index)if(this.index.isObjectProperty()){var d=this.index.getObjectProperty();return function(w,A,x){var D=f(w,A,x),E=m(w,A,x);return Za(D,d,E),E}}else{if(Fr(this.object))return function(w,A,x){var D=f(w,A,x),E=m(w,A,x),_=p(w,A,D);return w.set(h,a(D,_,E)),E};var g=this.object.object._compile(l,c);if(this.object.index.isObjectProperty()){var y=this.object.index.getObjectProperty();return function(w,A,x){var D=g(w,A,x),E=$r(D,y),_=p(w,A,E),N=m(w,A,x);return Za(D,y,a(E,_,N)),N}}else{var S=this.object.index._compile(l,c);return function(w,A,x){var D=g(w,A,x),E=S(w,A,D),_=i(D,E),N=p(w,A,_),P=m(w,A,x);return a(D,E,a(_,N,P)),P}}}else{if(!Fr(this.object))throw new TypeError("SymbolNode expected as object");return function(w,A,x){var D=m(w,A,x);return w.set(h,D),D}}}forEach(l){l(this.object,"object",this),this.index&&l(this.index,"index",this),l(this.value,"value",this)}map(l){var c=this._ifNode(l(this.object,"object",this)),f=this.index?this._ifNode(l(this.index,"index",this)):null,p=this._ifNode(l(this.value,"value",this));return new u(c,f,p)}clone(){return new u(this.object,this.index,this.value)}_toString(l){var c=this.object.toString(l),f=this.index?this.index.toString(l):"",p=this.value.toString(l);return o(this,l&&l.parenthesis,l&&l.implicit)&&(p="("+p+")"),c+f+" = "+p}toJSON(){return{mathjs:rd,object:this.object,index:this.index,value:this.value}}static fromJSON(l){return new u(l.object,l.index,l.value)}_toHTML(l){var c=this.object.toHTML(l),f=this.index?this.index.toHTML(l):"",p=this.value.toHTML(l);return o(this,l&&l.parenthesis,l&&l.implicit)&&(p='<span class="math-paranthesis math-round-parenthesis">(</span>'+p+'<span class="math-paranthesis math-round-parenthesis">)</span>'),c+f+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+p}_toTex(l){var c=this.object.toTex(l),f=this.index?this.index.toTex(l):"",p=this.value.toTex(l);return o(this,l&&l.parenthesis,l&&l.implicit)&&(p="\\left(".concat(p,"\\right)")),c+f+"="+p}}return fr(u,"name",rd),u},{isClass:!0,isNode:!0});var nd="BlockNode",AX=["ResultSet","Node"],T1=T(nd,AX,n=>{var{ResultSet:e,Node:t}=n;class r extends t{constructor(a){if(super(),!Array.isArray(a))throw new Error("Array expected");this.blocks=a.map(function(o){var u=o&&o.node,s=o&&o.visible!==void 0?o.visible:!0;if(!jt(u))throw new TypeError('Property "node" must be a Node');if(typeof s!="boolean")throw new TypeError('Property "visible" must be a boolean');return{node:u,visible:s}})}get type(){return nd}get isBlockNode(){return!0}_compile(a,o){var u=Ei(this.blocks,function(s){return{evaluate:s.node._compile(a,o),visible:s.visible}});return function(l,c,f){var p=[];return as(u,function(h){var d=h.evaluate(l,c,f);h.visible&&p.push(d)}),new e(p)}}forEach(a){for(var o=0;o<this.blocks.length;o++)a(this.blocks[o].node,"blocks["+o+"].node",this)}map(a){for(var o=[],u=0;u<this.blocks.length;u++){var s=this.blocks[u],l=this._ifNode(a(s.node,"blocks["+u+"].node",this));o[u]={node:l,visible:s.visible}}return new r(o)}clone(){var a=this.blocks.map(function(o){return{node:o.node,visible:o.visible}});return new r(a)}_toString(a){return this.blocks.map(function(o){return o.node.toString(a)+(o.visible?"":";")}).join(`
`)}toJSON(){return{mathjs:nd,blocks:this.blocks}}static fromJSON(a){return new r(a.blocks)}_toHTML(a){return this.blocks.map(function(o){return o.node.toHTML(a)+(o.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(a){return this.blocks.map(function(o){return o.node.toTex(a)+(o.visible?"":";")}).join(`\\;\\;
`)}}return fr(r,"name",nd),r},{isClass:!0,isNode:!0});var id="ConditionalNode",MX=["Node"],C1=T(id,MX,n=>{var{Node:e}=n;function t(i){if(typeof i=="number"||typeof i=="boolean"||typeof i=="string")return!!i;if(i){if(pt(i))return!i.isZero();if(gi(i))return!!(i.re||i.im);if(Un(i))return!!i.value}if(i==null)return!1;throw new TypeError('Unsupported type of condition "'+Kt(i)+'"')}class r extends e{constructor(a,o,u){if(super(),!jt(a))throw new TypeError("Parameter condition must be a Node");if(!jt(o))throw new TypeError("Parameter trueExpr must be a Node");if(!jt(u))throw new TypeError("Parameter falseExpr must be a Node");this.condition=a,this.trueExpr=o,this.falseExpr=u}get type(){return id}get isConditionalNode(){return!0}_compile(a,o){var u=this.condition._compile(a,o),s=this.trueExpr._compile(a,o),l=this.falseExpr._compile(a,o);return function(f,p,m){return t(u(f,p,m))?s(f,p,m):l(f,p,m)}}forEach(a){a(this.condition,"condition",this),a(this.trueExpr,"trueExpr",this),a(this.falseExpr,"falseExpr",this)}map(a){return new r(this._ifNode(a(this.condition,"condition",this)),this._ifNode(a(this.trueExpr,"trueExpr",this)),this._ifNode(a(this.falseExpr,"falseExpr",this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.condition.toString(a),l=gr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=u)&&(s="("+s+")");var c=this.trueExpr.toString(a),f=gr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(c="("+c+")");var p=this.falseExpr.toString(a),m=gr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p="("+p+")"),s+" ? "+c+" : "+p}toJSON(){return{mathjs:id,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(a){return new r(a.condition,a.trueExpr,a.falseExpr)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.condition.toHTML(a),l=gr(this.condition,o,a&&a.implicit);(o==="all"||this.condition.type==="OperatorNode"||l!==null&&l<=u)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>');var c=this.trueExpr.toHTML(a),f=gr(this.trueExpr,o,a&&a.implicit);(o==="all"||this.trueExpr.type==="OperatorNode"||f!==null&&f<=u)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>');var p=this.falseExpr.toHTML(a),m=gr(this.falseExpr,o,a&&a.implicit);return(o==="all"||this.falseExpr.type==="OperatorNode"||m!==null&&m<=u)&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+'<span class="math-operator math-conditional-operator">?</span>'+c+'<span class="math-operator math-conditional-operator">:</span>'+p}_toTex(a){return"\\begin{cases} {"+this.trueExpr.toTex(a)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(a)+"}\\\\{"+this.falseExpr.toTex(a)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return fr(r,"name",id),r},{isClass:!0,isNode:!0});var Y2=wr(G2(),1);var I1={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},pr={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},P1={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(pr.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(pr.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(pr.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(pr.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(pr.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(pr.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(pr.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(pr.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(pr.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(pr.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(pr.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(pr.bitAnd,"${args[1]}\\right)")},bitNot:{1:pr.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(pr.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(pr.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(pr.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(pr.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(pr.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(pr.and,"${args[1]}\\right)")},not:{1:pr.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(pr.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(pr.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(pr.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(pr.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(pr.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(pr.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(pr.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(pr.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(pr.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(pr.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(pr.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(pr.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(pr.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(I1.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)"}},j2="\\mathrm{${name}}\\left(${args}\\right)",W2={deg:"^\\circ"};function ad(n){return(0,Y2.default)(n,{preserveFormatting:!0})}function od(n,e){return e=typeof e>"u"?!1:e,e?ut(W2,n)?W2[n]:"\\mathrm{"+ad(n)+"}":ut(I1,n)?I1[n]:ad(n)}var sd="ConstantNode",TX=["Node"],k1=T(sd,TX,n=>{var{Node:e}=n;class t extends e{constructor(i){super(),this.value=i}get type(){return sd}get isConstantNode(){return!0}_compile(i,a){var o=this.value;return function(){return o}}forEach(i){}map(i){return this.clone()}clone(){return new t(this.value)}_toString(i){return Mt(this.value,i)}_toHTML(i){var a=this._toString(i);switch(Kt(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+a+"</span>";case"string":return'<span class="math-string">'+a+"</span>";case"boolean":return'<span class="math-boolean">'+a+"</span>";case"null":return'<span class="math-null-symbol">'+a+"</span>";case"undefined":return'<span class="math-undefined">'+a+"</span>";default:return'<span class="math-symbol">'+a+"</span>"}}toJSON(){return{mathjs:sd,value:this.value}}static fromJSON(i){return new t(i.value)}_toTex(i){var a=this._toString(i),o=Kt(this.value);switch(o){case"string":return"\\mathtt{"+ad(a)+"}";case"number":case"BigNumber":{var u=o==="BigNumber"?this.value.isFinite():isFinite(this.value);if(!u)return this.value.valueOf()<0?"-\\infty":"\\infty";var s=a.toLowerCase().indexOf("e");return s!==-1?a.substring(0,s)+"\\cdot10^{"+a.substring(s+1)+"}":a}case"Fraction":return this.value.toLatex();default:return a}}}return fr(t,"name",sd),t},{isClass:!0,isNode:!0});var ud="FunctionAssignmentNode",CX=["typed","Node"],B1=T(ud,CX,n=>{var{typed:e,Node:t}=n;function r(a,o,u){var s=gr(a,o,u),l=gr(a.expr,o,u);return o==="all"||l!==null&&l<=s}class i extends t{constructor(o,u,s){if(super(),typeof o!="string")throw new TypeError('String expected for parameter "name"');if(!Array.isArray(u))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!jt(s))throw new TypeError('Node expected for parameter "expr"');if(Jm.has(o))throw new Error('Illegal function name, "'+o+'" is a reserved keyword');var l=new Set;for(var c of u){var f=typeof c=="string"?c:c.name;if(l.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));l.add(f)}this.name=o,this.params=u.map(function(p){return p&&p.name||p}),this.types=u.map(function(p){return p&&p.type||"any"}),this.expr=s}get type(){return ud}get isFunctionAssignmentNode(){return!0}_compile(o,u){var s=Object.create(u);as(this.params,function(h){s[h]=!0});var l=this.expr._compile(o,s),c=this.name,f=this.params,p=Wv(this.types,","),m=c+"("+Wv(this.params,", ")+")";return function(d,g,y){var S={};S[p]=function(){for(var w=Object.create(g),A=0;A<f.length;A++)w[f[A]]=arguments[A];return l(d,w,y)};var b=e(c,S);return b.syntax=m,d.set(c,b),b}}forEach(o){o(this.expr,"expr",this)}map(o){var u=this._ifNode(o(this.expr,"expr",this));return new i(this.name,this.params.slice(0),u)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=this.expr.toString(o);return r(this,u,o&&o.implicit)&&(s="("+s+")"),this.name+"("+this.params.join(", ")+") = "+s}toJSON(){var o=this.types;return{mathjs:ud,name:this.name,params:this.params.map(function(u,s){return{name:u,type:o[s]}}),expr:this.expr}}static fromJSON(o){return new i(o.name,o.params,o.expr)}_toHTML(o){for(var u=o&&o.parenthesis?o.parenthesis:"keep",s=[],l=0;l<this.params.length;l++)s.push('<span class="math-symbol math-parameter">'+Cn(this.params[l])+"</span>");var c=this.expr.toHTML(o);return r(this,u,o&&o.implicit)&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Cn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+s.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+c}_toTex(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=this.expr.toTex(o);return r(this,u,o&&o.implicit)&&(s="\\left(".concat(s,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(od).join(",")+"\\right)="+s}}return fr(i,"name",ud),i},{isClass:!0,isNode:!0});var ld="IndexNode",FX=["Node","size"],O1=T(ld,FX,n=>{var{Node:e,size:t}=n;class r extends e{constructor(a,o){if(super(),this.dimensions=a,this.dotNotation=o||!1,!Array.isArray(a)||!a.every(jt))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return ld}get isIndexNode(){return!0}_compile(a,o){var u=Ei(this.dimensions,function(l,c){var f=l.filter(h=>h.isSymbolNode&&h.name==="end").length>0;if(f){var p=Object.create(o);p.end=!0;var m=l._compile(a,p);return function(d,g,y){if(!ot(y)&&!nr(y)&&!rn(y))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+Kt(y));var S=t(y).valueOf(),b=Object.create(g);return b.end=S[c],m(d,b,y)}}else return l._compile(a,o)}),s=$r(a,"index");return function(c,f,p){var m=Ei(u,function(h){return h(c,f,p)});return s(...m)}}forEach(a){for(var o=0;o<this.dimensions.length;o++)a(this.dimensions[o],"dimensions["+o+"]",this)}map(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this._ifNode(a(this.dimensions[u],"dimensions["+u+"]",this));return new r(o,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return this.dimensions.length===1&&zt(this.dimensions[0])&&typeof this.dimensions[0].value=="string"}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(a){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:ld,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(a){return new r(a.dimensions,a.dotNotation)}_toHTML(a){for(var o=[],u=0;u<this.dimensions.length;u++)o[u]=this.dimensions[u].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Cn(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+o.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(a){var o=this.dimensions.map(function(u){return u.toTex(a)});return this.dotNotation?"."+this.getObjectProperty():"_{"+o.join(",")+"}"}}return fr(r,"name",ld),r},{isClass:!0,isNode:!0});var cd="ObjectNode",IX=["Node"],R1=T(cd,IX,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),this.properties=i||{},i&&(typeof i!="object"||!Object.keys(i).every(function(a){return jt(i[a])})))throw new TypeError("Object containing Nodes expected")}get type(){return cd}get isObjectNode(){return!0}_compile(i,a){var o={};for(var u in this.properties)if(ut(this.properties,u)){var s=Qs(u),l=JSON.parse(s),c=$r(this.properties,u);o[l]=c._compile(i,a)}return function(p,m,h){var d={};for(var g in o)ut(o,g)&&(d[g]=o[g](p,m,h));return d}}forEach(i){for(var a in this.properties)ut(this.properties,a)&&i(this.properties[a],"properties["+Qs(a)+"]",this)}map(i){var a={};for(var o in this.properties)ut(this.properties,o)&&(a[o]=this._ifNode(i(this.properties[o],"properties["+Qs(o)+"]",this)));return new t(a)}clone(){var i={};for(var a in this.properties)ut(this.properties,a)&&(i[a]=this.properties[a]);return new t(i)}_toString(i){var a=[];for(var o in this.properties)ut(this.properties,o)&&a.push(Qs(o)+": "+this.properties[o].toString(i));return"{"+a.join(", ")+"}"}toJSON(){return{mathjs:cd,properties:this.properties}}static fromJSON(i){return new t(i.properties)}_toHTML(i){var a=[];for(var o in this.properties)ut(this.properties,o)&&a.push('<span class="math-symbol math-property">'+Cn(o)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[o].toHTML(i));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(i){var a=[];for(var o in this.properties)ut(this.properties,o)&&a.push("\\mathbf{"+o+":} & "+this.properties[o].toTex(i)+"\\\\");var u="\\left\\{\\begin{array}{ll}"+a.join(`
`)+"\\end{array}\\right\\}";return u}}return fr(t,"name",cd),t},{isClass:!0,isNode:!0});function ou(n,e){return new cl(n,new eu(e),new Set(Object.keys(e)))}var fd="OperatorNode",PX=["Node"],L1=T(fd,PX,n=>{var{Node:e}=n;function t(a,o){var u=a;if(o==="auto")for(;zn(u);)u=u.content;return zt(u)?!0:Vr(u)?t(u.args[0],o):!1}function r(a,o,u,s,l){var c=gr(a,o,u),f=Sl(a,o);if(o==="all"||s.length>2&&a.getIdentifier()!=="OperatorNode:add"&&a.getIdentifier()!=="OperatorNode:multiply")return s.map(function(N){switch(N.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});var p;switch(s.length){case 0:p=[];break;case 1:{var m=gr(s[0],o,u,a);if(l&&m!==null){var h,d;if(o==="keep"?(h=s[0].getIdentifier(),d=a.getIdentifier()):(h=s[0].getContent().getIdentifier(),d=a.getContent().getIdentifier()),ma[c][d].latexLeftParens===!1){p=[!1];break}if(ma[m][h].latexParens===!1){p=[!1];break}}if(m===null){p=[!1];break}if(m<=c){p=[!0];break}p=[!1]}break;case 2:{var g,y=gr(s[0],o,u,a),S=td(a,s[0],o);y===null?g=!1:y===c&&f==="right"&&!S||y<c?g=!0:g=!1;var b,w=gr(s[1],o,u,a),A=td(a,s[1],o);if(w===null?b=!1:w===c&&f==="left"&&!A||w<c?b=!0:b=!1,l){var x,D,E;o==="keep"?(x=a.getIdentifier(),D=a.args[0].getIdentifier(),E=a.args[1].getIdentifier()):(x=a.getContent().getIdentifier(),D=a.args[0].getContent().getIdentifier(),E=a.args[1].getContent().getIdentifier()),y!==null&&(ma[c][x].latexLeftParens===!1&&(g=!1),ma[y][D].latexParens===!1&&(g=!1)),w!==null&&(ma[c][x].latexRightParens===!1&&(b=!1),ma[w][E].latexParens===!1&&(b=!1))}p=[g,b]}break;default:(a.getIdentifier()==="OperatorNode:add"||a.getIdentifier()==="OperatorNode:multiply")&&(p=s.map(function(N){var P=gr(N,o,u,a),B=td(a,N,o),V=Sl(N,o);return P===null?!1:c===P&&f===V&&!B?!0:P<c}));break}if(s.length>=2&&a.getIdentifier()==="OperatorNode:multiply"&&a.implicit&&o!=="all"&&u==="hide")for(var _=1;_<p.length;++_)t(s[_],o)&&!p[_-1]&&(o!=="keep"||!zn(s[_-1]))&&(p[_]=!0);return p}class i extends e{constructor(o,u,s,l,c){if(super(),typeof o!="string")throw new TypeError('string expected for parameter "op"');if(typeof u!="string")throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(s)||!s.every(jt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=l===!0,this.isPercentage=c===!0,this.op=o,this.fn=u,this.args=s||[]}get type(){return fd}get isOperatorNode(){return!0}_compile(o,u){if(typeof this.fn!="string"||!_m(o,this.fn))throw o[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var s=$r(o,this.fn),l=Ei(this.args,function(h){return h._compile(o,u)});if(typeof s=="function"&&s.rawArgs===!0){var c=this.args;return function(d,g,y){return s(c,o,ou(d,g))}}else if(l.length===1){var f=l[0];return function(d,g,y){return s(f(d,g,y))}}else if(l.length===2){var p=l[0],m=l[1];return function(d,g,y){return s(p(d,g,y),m(d,g,y))}}else return function(d,g,y){return s.apply(null,Ei(l,function(S){return S(d,g,y)}))}}forEach(o){for(var u=0;u<this.args.length;u++)o(this.args[u],"args["+u+"]",this)}map(o){for(var u=[],s=0;s<this.args.length;s++)u[s]=this._ifNode(o(this.args[s],"args["+s+"]",this));return new i(this.op,this.fn,u,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return this.args.length===1}isBinary(){return this.args.length===2}_toString(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!1);if(l.length===1){var f=Sl(this,u),p=l[0].toString(o);c[0]&&(p="("+p+")");var m=/[a-zA-Z]+/.test(this.op);return f==="right"?this.op+(m?" ":"")+p:f==="left"?p+(m?" ":"")+this.op:p+this.op}else if(l.length===2){var h=l[0].toString(o),d=l[1].toString(o);return c[0]&&(h="("+h+")"),c[1]&&(d="("+d+")"),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?h+" "+d:h+" "+this.op+" "+d}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var g=l.map(function(y,S){return y=y.toString(o),c[S]&&(y="("+y+")"),y});return this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?g.join(" "):g.join(" "+this.op+" ")}else return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:fd,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(o){return new i(o.op,o.fn,o.args,o.implicit,o.isPercentage)}_toHTML(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!1);if(l.length===1){var f=Sl(this,u),p=l[0].toHTML(o);return c[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),f==="right"?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Cn(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Cn(this.op)+"</span>"}else if(l.length===2){var m=l[0].toHTML(o),h=l[1].toHTML(o);return c[0]&&(m='<span class="math-parenthesis math-round-parenthesis">(</span>'+m+'<span class="math-parenthesis math-round-parenthesis">)</span>'),c[1]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?m+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+h:m+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Cn(this.op)+"</span>"+h}else{var d=l.map(function(g,y){return g=g.toHTML(o),c[y]&&(g='<span class="math-parenthesis math-round-parenthesis">(</span>'+g+'<span class="math-parenthesis math-round-parenthesis">)</span>'),g});return l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")?this.implicit&&this.getIdentifier()==="OperatorNode:multiply"&&s==="hide"?d.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):d.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Cn(this.op)+"</span>"):'<span class="math-function">'+Cn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+d.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(o){var u=o&&o.parenthesis?o.parenthesis:"keep",s=o&&o.implicit?o.implicit:"hide",l=this.args,c=r(this,u,s,l,!0),f=pr[this.fn];if(f=typeof f>"u"?this.op:f,l.length===1){var p=Sl(this,u),m=l[0].toTex(o);return c[0]&&(m="\\left(".concat(m,"\\right)")),p==="right"?f+m:m+f}else if(l.length===2){var h=l[0],d=h.toTex(o);c[0]&&(d="\\left(".concat(d,"\\right)"));var g=l[1],y=g.toTex(o);c[1]&&(y="\\left(".concat(y,"\\right)"));var S;switch(u==="keep"?S=h.getIdentifier():S=h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return f+"{"+d+"}{"+y+"}";case"OperatorNode:pow":switch(d="{"+d+"}",y="{"+y+"}",S){case"ConditionalNode":case"OperatorNode:divide":d="\\left(".concat(d,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&s==="hide")return d+"~"+y}return d+f+y}else if(l.length>2&&(this.getIdentifier()==="OperatorNode:add"||this.getIdentifier()==="OperatorNode:multiply")){var b=l.map(function(w,A){return w=w.toTex(o),c[A]&&(w="\\left(".concat(w,"\\right)")),w});return this.getIdentifier()==="OperatorNode:multiply"&&this.implicit&&s==="hide"?b.join("~"):b.join(f)}else return"\\mathrm{"+this.fn+"}\\left("+l.map(function(w){return w.toTex(o)}).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return fr(i,"name",fd),i},{isClass:!0,isNode:!0});var pd="ParenthesisNode",kX=["Node"],V1=T(pd,kX,n=>{var{Node:e}=n;class t extends e{constructor(i){if(super(),!jt(i))throw new TypeError('Node expected for parameter "content"');this.content=i}get type(){return pd}get isParenthesisNode(){return!0}_compile(i,a){return this.content._compile(i,a)}getContent(){return this.content.getContent()}forEach(i){i(this.content,"content",this)}map(i){var a=i(this.content,"content",this);return new t(a)}clone(){return new t(this.content)}_toString(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"("+this.content.toString(i)+")":this.content.toString(i)}toJSON(){return{mathjs:pd,content:this.content}}static fromJSON(i){return new t(i.content)}_toHTML(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(i)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(i)}_toTex(i){return!i||i&&!i.parenthesis||i&&i.parenthesis==="keep"?"\\left(".concat(this.content.toTex(i),"\\right)"):this.content.toTex(i)}}return fr(t,"name",pd),t},{isClass:!0,isNode:!0});var md="RangeNode",BX=["Node"],U1=T(md,BX,n=>{var{Node:e}=n;function t(i,a,o){var u=gr(i,a,o),s={},l=gr(i.start,a,o);if(s.start=l!==null&&l<=u||a==="all",i.step){var c=gr(i.step,a,o);s.step=c!==null&&c<=u||a==="all"}var f=gr(i.end,a,o);return s.end=f!==null&&f<=u||a==="all",s}class r extends e{constructor(a,o,u){if(super(),!jt(a))throw new TypeError("Node expected");if(!jt(o))throw new TypeError("Node expected");if(u&&!jt(u))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=a,this.end=o,this.step=u||null}get type(){return md}get isRangeNode(){return!0}needsEnd(){var a=this.filter(function(o){return Fr(o)&&o.name==="end"});return a.length>0}_compile(a,o){var u=a.range,s=this.start._compile(a,o),l=this.end._compile(a,o);if(this.step){var c=this.step._compile(a,o);return function(p,m,h){return u(s(p,m,h),l(p,m,h),c(p,m,h))}}else return function(p,m,h){return u(s(p,m,h),l(p,m,h))}}forEach(a){a(this.start,"start",this),a(this.end,"end",this),this.step&&a(this.step,"step",this)}map(a){return new r(this._ifNode(a(this.start,"start",this)),this._ifNode(a(this.end,"end",this)),this.step&&this._ifNode(a(this.step,"step",this)))}clone(){return new r(this.start,this.end,this.step&&this.step)}_toString(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s,l=this.start.toString(a);if(u.start&&(l="("+l+")"),s=l,this.step){var c=this.step.toString(a);u.step&&(c="("+c+")"),s+=":"+c}var f=this.end.toString(a);return u.end&&(f="("+f+")"),s+=":"+f,s}toJSON(){return{mathjs:md,start:this.start,end:this.end,step:this.step}}static fromJSON(a){return new r(a.start,a.end,a.step)}_toHTML(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s,l=this.start.toHTML(a);if(u.start&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s=l,this.step){var c=this.step.toHTML(a);u.step&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+='<span class="math-operator math-range-operator">:</span>'+c}var f=this.end.toHTML(a);return u.end&&(f='<span class="math-parenthesis math-round-parenthesis">(</span>'+f+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s+='<span class="math-operator math-range-operator">:</span>'+f,s}_toTex(a){var o=a&&a.parenthesis?a.parenthesis:"keep",u=t(this,o,a&&a.implicit),s=this.start.toTex(a);if(u.start&&(s="\\left(".concat(s,"\\right)")),this.step){var l=this.step.toTex(a);u.step&&(l="\\left(".concat(l,"\\right)")),s+=":"+l}var c=this.end.toTex(a);return u.end&&(c="\\left(".concat(c,"\\right)")),s+=":"+c,s}}return fr(r,"name",md),r},{isClass:!0,isNode:!0});var dd="RelationalNode",OX=["Node"],q1=T(dd,OX,n=>{var{Node:e}=n,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r extends e{constructor(a,o){if(super(),!Array.isArray(a))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(o))throw new TypeError("Parameter params must be an array");if(a.length!==o.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=a,this.params=o}get type(){return dd}get isRelationalNode(){return!0}_compile(a,o){var u=this,s=this.params.map(l=>l._compile(a,o));return function(c,f,p){for(var m,h=s[0](c,f,p),d=0;d<u.conditionals.length;d++){m=h,h=s[d+1](c,f,p);var g=$r(a,u.conditionals[d]);if(!g(m,h))return!1}return!0}}forEach(a){this.params.forEach((o,u)=>a(o,"params["+u+"]",this),this)}map(a){return new r(this.conditionals.slice(),this.params.map((o,u)=>this._ifNode(a(o,"params["+u+"]",this)),this))}clone(){return new r(this.conditionals,this.params)}_toString(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"("+f.toString(a)+")":f.toString(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+=" "+t[this.conditionals[c]],l+=" "+s[c+1];return l}toJSON(){return{mathjs:dd,conditionals:this.conditionals,params:this.params}}static fromJSON(a){return new r(a.conditionals,a.params)}_toHTML(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?'<span class="math-parenthesis math-round-parenthesis">(</span>'+f.toHTML(a)+'<span class="math-parenthesis math-round-parenthesis">)</span>':f.toHTML(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Cn(t[this.conditionals[c]])+"</span>"+s[c+1];return l}_toTex(a){for(var o=a&&a.parenthesis?a.parenthesis:"keep",u=gr(this,o,a&&a.implicit),s=this.params.map(function(f,p){var m=gr(f,o,a&&a.implicit);return o==="all"||m!==null&&m<=u?"\\left("+f.toTex(a)+"\right)":f.toTex(a)}),l=s[0],c=0;c<this.conditionals.length;c++)l+=pr[this.conditionals[c]]+s[c+1];return l}}return fr(r,"name",dd),r},{isClass:!0,isNode:!0});var RX="SymbolNode",LX=["math","?Unit","Node"],z1=T(RX,LX,n=>{var{math:e,Unit:t,Node:r}=n;function i(o){return t?t.isValuelessUnit(o):!1}class a extends r{constructor(u){if(super(),typeof u!="string")throw new TypeError('String expected for parameter "name"');this.name=u}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(u,s){var l=this.name;if(s[l]===!0)return function(f,p,m){return $r(p,l)};if(l in u)return function(f,p,m){return f.has(l)?f.get(l):$r(u,l)};var c=i(l);return function(f,p,m){return f.has(l)?f.get(l):c?new t(null,l):a.onUndefinedSymbol(l)}}forEach(u){}map(u){return this.clone()}static onUndefinedSymbol(u){throw new Error("Undefined symbol "+u)}clone(){return new a(this.name)}_toString(u){return this.name}_toHTML(u){var s=Cn(this.name);return s==="true"||s==="false"?'<span class="math-symbol math-boolean">'+s+"</span>":s==="i"?'<span class="math-symbol math-imaginary-symbol">'+s+"</span>":s==="Infinity"?'<span class="math-symbol math-infinity-symbol">'+s+"</span>":s==="NaN"?'<span class="math-symbol math-nan-symbol">'+s+"</span>":s==="null"?'<span class="math-symbol math-null-symbol">'+s+"</span>":s==="undefined"?'<span class="math-symbol math-undefined-symbol">'+s+"</span>":'<span class="math-symbol">'+s+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(u){return new a(u.name)}_toTex(u){var s=!1;typeof e[this.name]>"u"&&i(this.name)&&(s=!0);var l=od(this.name,s);return l[0]==="\\"?l:" "+l}}return a},{isClass:!0,isNode:!0});var hd="FunctionNode",VX=["math","Node","SymbolNode"],$1=T(hd,VX,n=>{var e,{math:t,Node:r,SymbolNode:i}=n,a=s=>Mt(s,{truncate:78});function o(s,l,c){for(var f="",p=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,m=0,h;(h=p.exec(s))!==null;)if(f+=s.substring(m,h.index),m=h.index,h[0]==="$$")f+="$",m++;else{m+=h[0].length;var d=l[h[1]];if(!d)throw new ReferenceError("Template: Property "+h[1]+" does not exist.");if(h[2]===void 0)switch(typeof d){case"string":f+=d;break;case"object":if(jt(d))f+=d.toTex(c);else if(Array.isArray(d))f+=d.map(function(g,y){if(jt(g))return g.toTex(c);throw new TypeError("Template: "+h[1]+"["+y+"] is not a Node.")}).join(",");else throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes");break;default:throw new TypeError("Template: "+h[1]+" has to be a Node, String or array of Nodes")}else if(jt(d[h[2]]&&d[h[2]]))f+=d[h[2]].toTex(c);else throw new TypeError("Template: "+h[1]+"["+h[2]+"] is not a Node.")}return f+=s.slice(m),f}class u extends r{constructor(l,c){if(super(),typeof l=="string"&&(l=new i(l)),!jt(l))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(c)||!c.every(jt))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=l,this.args=c||[]}get name(){return this.fn.name||""}get type(){return hd}get isFunctionNode(){return!0}_compile(l,c){var f=this.args.map(E=>E._compile(l,c));if(Fr(this.fn)){var p=this.fn.name;if(c[p]){var y=this.args;return function(_,N,P){var B=$r(N,p);if(typeof B!="function")throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(B)));if(B.rawArgs)return B(y,l,ou(_,N));var V=f.map(z=>z(_,N,P));return B.apply(B,V)}}else{var m=p in l?$r(l,p):void 0,h=typeof m=="function"&&m.rawArgs===!0,d=E=>{var _;if(E.has(p))_=E.get(p);else if(p in l)_=$r(l,p);else return u.onUndefinedFunction(p);if(typeof _=="function")return _;throw new TypeError("'".concat(p,`' is not a function; its value is:
  `).concat(a(_)))};if(h){var g=this.args;return function(_,N,P){var B=d(_);return B(g,l,ou(_,N))}}else switch(f.length){case 0:return function(_,N,P){var B=d(_);return B()};case 1:return function(_,N,P){var B=d(_),V=f[0];return B(V(_,N,P))};case 2:return function(_,N,P){var B=d(_),V=f[0],z=f[1];return B(V(_,N,P),z(_,N,P))};default:return function(_,N,P){var B=d(_),V=f.map(z=>z(_,N,P));return B(...V)}}}}else if($i(this.fn)&&sa(this.fn.index)&&this.fn.index.isObjectProperty()){var S=this.fn.object._compile(l,c),b=this.fn.index.getObjectProperty(),w=this.args;return function(_,N,P){var B=S(_,N,P),V=aT(B,b);if(V!=null&&V.rawArgs)return V(w,l,ou(_,N));var z=f.map(L=>L(_,N,P));return V.apply(B,z)}}else{var A=this.fn.toString(),x=this.fn._compile(l,c),D=this.args;return function(_,N,P){var B=x(_,N,P);if(typeof B!="function")throw new TypeError("Expression '".concat(A,"' did not evaluate to a function; value is:")+`
  `.concat(a(B)));if(B.rawArgs)return B(D,l,ou(_,N));var V=f.map(z=>z(_,N,P));return B.apply(B,V)}}}forEach(l){l(this.fn,"fn",this);for(var c=0;c<this.args.length;c++)l(this.args[c],"args["+c+"]",this)}map(l){for(var c=this._ifNode(l(this.fn,"fn",this)),f=[],p=0;p<this.args.length;p++)f[p]=this._ifNode(l(this.args[p],"args["+p+"]",this));return new u(c,f)}clone(){return new u(this.fn,this.args.slice(0))}toString(l){var c,f=this.fn.toString(l);return l&&typeof l.handler=="object"&&ut(l.handler,f)&&(c=l.handler[f](this,l)),typeof c<"u"?c:super.toString(l)}_toString(l){var c=this.args.map(function(p){return p.toString(l)}),f=ja(this.fn)?"("+this.fn.toString(l)+")":this.fn.toString(l);return f+"("+c.join(", ")+")"}toJSON(){return{mathjs:hd,fn:this.fn,args:this.args}}_toHTML(l){var c=this.args.map(function(f){return f.toHTML(l)});return'<span class="math-function">'+Cn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(l){var c;return l&&typeof l.handler=="object"&&ut(l.handler,this.name)&&(c=l.handler[this.name](this,l)),typeof c<"u"?c:super.toTex(l)}_toTex(l){var c=this.args.map(function(m){return m.toTex(l)}),f;P1[this.name]&&(f=P1[this.name]),t[this.name]&&(typeof t[this.name].toTex=="function"||typeof t[this.name].toTex=="object"||typeof t[this.name].toTex=="string")&&(f=t[this.name].toTex);var p;switch(typeof f){case"function":p=f(this,l);break;case"string":p=o(f,this,l);break;case"object":switch(typeof f[c.length]){case"function":p=f[c.length](this,l);break;case"string":p=o(f[c.length],this,l);break}}return typeof p<"u"?p:o(j2,this,l)}getIdentifier(){return this.type+":"+this.name}}return e=u,fr(u,"name",hd),fr(u,"onUndefinedFunction",function(s){throw new Error("Undefined function "+s)}),fr(u,"fromJSON",function(s){return new e(s.fn,s.args)}),u},{isClass:!0,isNode:!0});var Z2="parse",UX=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],H1=T(Z2,UX,n=>{var{typed:e,numeric:t,config:r,AccessorNode:i,ArrayNode:a,AssignmentNode:o,BlockNode:u,ConditionalNode:s,ConstantNode:l,FunctionAssignmentNode:c,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:S}=n,b=e(Z2,{string:function(X){return Z(X,{})},"Array | Matrix":function(X){return w(X,{})},"string, Object":function(X,Ae){var Le=Ae.nodes!==void 0?Ae.nodes:{};return Z(X,Le)},"Array | Matrix, Object":w});function w(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ae=X.nodes!==void 0?X.nodes:{};return lt(F,function(Le){if(typeof Le!="string")throw new TypeError("String expected");return Z(Le,Ae)})}var A={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},x={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},D={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},E={true:!0,false:!1,null:null,undefined:void 0},_=["NaN","Infinity"],N={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:"	"};function P(){return{extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:A.NULL,nestingLevel:0,conditionalLevel:null}}function B(F,X){return F.expression.substr(F.index,X)}function V(F){return B(F,1)}function z(F){F.index++}function L(F){return F.expression.charAt(F.index-1)}function k(F){return F.expression.charAt(F.index+1)}function C(F){for(F.tokenType=A.NULL,F.token="",F.comment="";;){if(V(F)==="#")for(;V(F)!==`
`&&V(F)!=="";)F.comment+=V(F),z(F);if(b.isWhitespace(V(F),F.nestingLevel))z(F);else break}if(V(F)===""){F.tokenType=A.DELIMITER;return}if(V(F)===`
`&&!F.nestingLevel){F.tokenType=A.DELIMITER,F.token=V(F),z(F);return}var X=V(F),Ae=B(F,2),Le=B(F,3);if(Le.length===3&&x[Le]){F.tokenType=A.DELIMITER,F.token=Le,z(F),z(F),z(F);return}if(Ae.length===2&&x[Ae]){F.tokenType=A.DELIMITER,F.token=Ae,z(F),z(F);return}if(x[X]){F.tokenType=A.DELIMITER,F.token=X,z(F);return}if(b.isDigitDot(X)){F.tokenType=A.NUMBER;var ft=B(F,2);if(ft==="0b"||ft==="0o"||ft==="0x"){for(F.token+=V(F),z(F),F.token+=V(F),z(F);b.isHexDigit(V(F));)F.token+=V(F),z(F);if(V(F)===".")for(F.token+=".",z(F);b.isHexDigit(V(F));)F.token+=V(F),z(F);else if(V(F)==="i")for(F.token+="i",z(F);b.isDigit(V(F));)F.token+=V(F),z(F);return}if(V(F)==="."){if(F.token+=V(F),z(F),!b.isDigit(V(F))){F.tokenType=A.DELIMITER;return}}else{for(;b.isDigit(V(F));)F.token+=V(F),z(F);b.isDecimalMark(V(F),k(F))&&(F.token+=V(F),z(F))}for(;b.isDigit(V(F));)F.token+=V(F),z(F);if(V(F)==="E"||V(F)==="e"){if(b.isDigit(k(F))||k(F)==="-"||k(F)==="+"){if(F.token+=V(F),z(F),(V(F)==="+"||V(F)==="-")&&(F.token+=V(F),z(F)),!b.isDigit(V(F)))throw ze(F,'Digit expected, got "'+V(F)+'"');for(;b.isDigit(V(F));)F.token+=V(F),z(F);if(b.isDecimalMark(V(F),k(F)))throw ze(F,'Digit expected, got "'+V(F)+'"')}else if(k(F)===".")throw z(F),ze(F,'Digit expected, got "'+V(F)+'"')}return}if(b.isAlpha(V(F),L(F),k(F))){for(;b.isAlpha(V(F),L(F),k(F))||b.isDigit(V(F));)F.token+=V(F),z(F);ut(D,F.token)?F.tokenType=A.DELIMITER:F.tokenType=A.SYMBOL;return}for(F.tokenType=A.UNKNOWN;V(F)!=="";)F.token+=V(F),z(F);throw ze(F,'Syntax error in part "'+F.token+'"')}function W(F){do C(F);while(F.token===`
`)}function O(F){F.nestingLevel++}function H(F){F.nestingLevel--}b.isAlpha=function(X,Ae,Le){return b.isValidLatinOrGreek(X)||b.isValidMathSymbol(X,Le)||b.isValidMathSymbol(Ae,X)},b.isValidLatinOrGreek=function(X){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(X)},b.isValidMathSymbol=function(X,Ae){return/^[\uD835]$/.test(X)&&/^[\uDC00-\uDFFF]$/.test(Ae)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(Ae)},b.isWhitespace=function(X,Ae){return X===" "||X==="	"||X===`
`&&Ae>0},b.isDecimalMark=function(X,Ae){return X==="."&&Ae!=="/"&&Ae!=="*"&&Ae!=="^"},b.isDigitDot=function(X){return X>="0"&&X<="9"||X==="."},b.isDigit=function(X){return X>="0"&&X<="9"},b.isHexDigit=function(X){return X>="0"&&X<="9"||X>="a"&&X<="f"||X>="A"&&X<="F"};function Z(F,X){var Ae=P();zr(Ae,{expression:F,extraNodes:X}),C(Ae);var Le=Q(Ae);if(Ae.token!=="")throw Ae.tokenType===A.DELIMITER?Xe(Ae,"Unexpected operator "+Ae.token):ze(Ae,'Unexpected part "'+Ae.token+'"');return Le}function Q(F){var X,Ae=[],Le;for(F.token!==""&&F.token!==`
`&&F.token!==";"&&(X=U(F),F.comment&&(X.comment=F.comment));F.token===`
`||F.token===";";)Ae.length===0&&X&&(Le=F.token!==";",Ae.push({node:X,visible:Le})),C(F),F.token!==`
`&&F.token!==";"&&F.token!==""&&(X=U(F),F.comment&&(X.comment=F.comment),Le=F.token!==";",Ae.push({node:X,visible:Le}));return Ae.length>0?new u(Ae):(X||(X=new l(void 0),F.comment&&(X.comment=F.comment)),X)}function U(F){var X,Ae,Le,ft,St=me(F);if(F.token==="="){if(Fr(St))return X=St.name,W(F),Le=U(F),new o(new S(X),Le);if($i(St))return W(F),Le=U(F),new o(St.object,St.index,Le);if(vi(St)&&Fr(St.fn)&&(ft=!0,Ae=[],X=St.name,St.args.forEach(function(Ye,kn){Fr(Ye)?Ae[kn]=Ye.name:ft=!1}),ft))return W(F),Le=U(F),new c(X,Ae,Le);throw ze(F,"Invalid left hand side of assignment operator =")}return St}function me(F){for(var X=De(F);F.token==="?";){var Ae=F.conditionalLevel;F.conditionalLevel=F.nestingLevel,W(F);var Le=X,ft=U(F);if(F.token!==":")throw ze(F,"False part of conditional expression expected");F.conditionalLevel=null,W(F);var St=U(F);X=new s(Le,ft,St),F.conditionalLevel=Ae}return X}function De(F){for(var X=pe(F);F.token==="or";)W(F),X=new h("or","or",[X,pe(F)]);return X}function pe(F){for(var X=_e(F);F.token==="xor";)W(F),X=new h("xor","xor",[X,_e(F)]);return X}function _e(F){for(var X=Ne(F);F.token==="and";)W(F),X=new h("and","and",[X,Ne(F)]);return X}function Ne(F){for(var X=Se(F);F.token==="|";)W(F),X=new h("|","bitOr",[X,Se(F)]);return X}function Se(F){for(var X=Me(F);F.token==="^|";)W(F),X=new h("^|","bitXor",[X,Me(F)]);return X}function Me(F){for(var X=Ee(F);F.token==="&";)W(F),X=new h("&","bitAnd",[X,Ee(F)]);return X}function Ee(F){for(var X=[Ce(F)],Ae=[],Le={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};ut(Le,F.token);){var ft={name:F.token,fn:Le[F.token]};Ae.push(ft),W(F),X.push(Ce(F))}return X.length===1?X[0]:X.length===2?new h(Ae[0].name,Ae[0].fn,X):new y(Ae.map(St=>St.fn),X)}function Ce(F){var X,Ae,Le,ft;X=Ge(F);for(var St={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),ft=[X,Ge(F)],X=new h(Ae,Le,ft);return X}function Ge(F){var X,Ae,Le,ft;X=We(F);for(var St={to:"to",in:"to"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),Ae==="in"&&F.token===""?X=new h("*","multiply",[X,new S("in")],!0):(ft=[X,We(F)],X=new h(Ae,Le,ft));return X}function We(F){var X,Ae=[];if(F.token===":"?X=new l(1):X=te(F),F.token===":"&&F.conditionalLevel!==F.nestingLevel){for(Ae.push(X);F.token===":"&&Ae.length<3;)W(F),F.token===")"||F.token==="]"||F.token===","||F.token===""?Ae.push(new S("end")):Ae.push(te(F));Ae.length===3?X=new g(Ae[0],Ae[2],Ae[1]):X=new g(Ae[0],Ae[1])}return X}function te(F){var X,Ae,Le,ft;X=oe(F);for(var St={"+":"add","-":"subtract"};ut(St,F.token);){Ae=F.token,Le=St[Ae],W(F);var Ye=oe(F);Ye.isPercentage?ft=[X,new h("*","multiply",[X,Ye])]:ft=[X,Ye],X=new h(Ae,Le,ft)}return X}function oe(F){var X,Ae,Le,ft;X=he(F),Ae=X;for(var St={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};ut(St,F.token);)Le=F.token,ft=St[Le],W(F),Ae=he(F),X=new h(Le,ft,[X,Ae]);return X}function he(F){var X,Ae;for(X=ie(F),Ae=X;F.tokenType===A.SYMBOL||F.token==="in"&&zt(X)||F.tokenType===A.NUMBER&&!zt(Ae)&&(!Vr(Ae)||Ae.op==="!")||F.token==="(";)Ae=ie(F),X=new h("*","multiply",[X,Ae],!0);return X}function ie(F){for(var X=re(F),Ae=X,Le=[];F.token==="/"&&wc(Ae);)if(Le.push(zr({},F)),W(F),F.tokenType===A.NUMBER)if(Le.push(zr({},F)),W(F),F.tokenType===A.SYMBOL||F.token==="(")zr(F,Le.pop()),Le.pop(),Ae=re(F),X=new h("/","divide",[X,Ae]);else{Le.pop(),zr(F,Le.pop());break}else{zr(F,Le.pop());break}return X}function re(F){var X,Ae,Le,ft;X=le(F);for(var St={"%":"mod",mod:"mod"};ut(St,F.token);)Ae=F.token,Le=St[Ae],W(F),Ae==="%"&&F.tokenType===A.DELIMITER&&F.token!=="("?X=new h("/","divide",[X,new l(100)],!1,!0):(ft=[X,le(F)],X=new h(Ae,Le,ft));return X}function le(F){var X,Ae,Le,ft={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return ut(ft,F.token)?(Le=ft[F.token],X=F.token,W(F),Ae=[le(F)],new h(X,Le,Ae)):Te(F)}function Te(F){var X,Ae,Le,ft;return X=Ie(F),(F.token==="^"||F.token===".^")&&(Ae=F.token,Le=Ae==="^"?"pow":"dotPow",W(F),ft=[X,le(F)],X=new h(Ae,Le,ft)),X}function Ie(F){var X,Ae,Le,ft;X=Ze(F);for(var St={"!":"factorial","'":"ctranspose"};ut(St,F.token);)Ae=F.token,Le=St[Ae],C(F),ft=[X],X=new h(Ae,Le,ft),X=ht(F,X);return X}function Ze(F){var X=[];if(F.tokenType===A.SYMBOL&&ut(F.extraNodes,F.token)){var Ae=F.extraNodes[F.token];if(C(F),F.token==="("){if(X=[],O(F),C(F),F.token!==")")for(X.push(U(F));F.token===",";)C(F),X.push(U(F));if(F.token!==")")throw ze(F,"Parenthesis ) expected");H(F),C(F)}return new Ae(X)}return xe(F)}function xe(F){var X,Ae;return F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D?(Ae=F.token,C(F),ut(E,Ae)?X=new l(E[Ae]):_.indexOf(Ae)!==-1?X=new l(t(Ae,"number")):X=new S(Ae),X=ht(F,X),X):Nt(F)}function ht(F,X,Ae){for(var Le;(F.token==="("||F.token==="["||F.token===".")&&(!Ae||Ae.indexOf(F.token)!==-1);)if(Le=[],F.token==="(")if(Fr(X)||$i(X)){if(O(F),C(F),F.token!==")")for(Le.push(U(F));F.token===",";)C(F),Le.push(U(F));if(F.token!==")")throw ze(F,"Parenthesis ) expected");H(F),C(F),X=new f(X,Le)}else return X;else if(F.token==="["){if(O(F),C(F),F.token!=="]")for(Le.push(U(F));F.token===",";)C(F),Le.push(U(F));if(F.token!=="]")throw ze(F,"Parenthesis ] expected");H(F),C(F),X=new i(X,new p(Le))}else{C(F);var ft=F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D;if(!ft)throw ze(F,"Property name expected after dot");Le.push(new l(F.token)),C(F);var St=!0;X=new i(X,new p(Le,St))}return X}function Nt(F){var X,Ae;return F.token==='"'||F.token==="'"?(Ae=Ht(F,F.token),X=new l(Ae),X=ht(F,X),X):Et(F)}function Ht(F,X){for(var Ae="";V(F)!==""&&V(F)!==X;)if(V(F)==="\\"){z(F);var Le=V(F),ft=N[Le];if(ft!==void 0)Ae+=ft,F.index+=1;else if(Le==="u"){var St=F.expression.slice(F.index+1,F.index+5);if(/^[0-9A-Fa-f]{4}$/.test(St))Ae+=String.fromCharCode(parseInt(St,16)),F.index+=5;else throw ze(F,"Invalid unicode character \\u".concat(St))}else throw ze(F,"Bad escape character \\".concat(Le))}else Ae+=V(F),z(F);if(C(F),F.token!==X)throw ze(F,"End of string ".concat(X," expected"));return C(F),Ae}function Et(F){var X,Ae,Le,ft;if(F.token==="["){if(O(F),C(F),F.token!=="]"){var St=ae(F);if(F.token===";"){for(Le=1,Ae=[St];F.token===";";)C(F),F.token!=="]"&&(Ae[Le]=ae(F),Le++);if(F.token!=="]")throw ze(F,"End of matrix ] expected");H(F),C(F),ft=Ae[0].items.length;for(var Ye=1;Ye<Le;Ye++)if(Ae[Ye].items.length!==ft)throw Xe(F,"Column dimensions mismatch ("+Ae[Ye].items.length+" !== "+ft+")");X=new a(Ae)}else{if(F.token!=="]")throw ze(F,"End of matrix ] expected");H(F),C(F),X=St}}else H(F),C(F),X=new a([]);return ht(F,X)}return de(F)}function ae(F){for(var X=[U(F)],Ae=1;F.token===",";)C(F),F.token!=="]"&&F.token!==";"&&(X[Ae]=U(F),Ae++);return new a(X)}function de(F){if(F.token==="{"){O(F);var X,Ae={};do if(C(F),F.token!=="}"){if(F.token==='"'||F.token==="'")X=Ht(F,F.token);else if(F.tokenType===A.SYMBOL||F.tokenType===A.DELIMITER&&F.token in D)X=F.token,C(F);else throw ze(F,"Symbol or string expected as object key");if(F.token!==":")throw ze(F,"Colon : expected after object key");C(F),Ae[X]=U(F)}while(F.token===",");if(F.token!=="}")throw ze(F,"Comma , or bracket } expected after object value");H(F),C(F);var Le=new m(Ae);return Le=ht(F,Le),Le}return ge(F)}function ge(F){var X;return F.tokenType===A.NUMBER?(X=F.token,C(F),new l(t(X,r.number))):qe(F)}function qe(F){var X;if(F.token==="("){if(O(F),C(F),X=U(F),F.token!==")")throw ze(F,"Parenthesis ) expected");return H(F),C(F),X=new d(X),X=ht(F,X),X}return $e(F)}function $e(F){throw F.token===""?ze(F,"Unexpected end of expression"):ze(F,"Value expected")}function Re(F){return F.index-F.token.length+1}function ze(F,X){var Ae=Re(F),Le=new SyntaxError(X+" (char "+Ae+")");return Le.char=Ae,Le}function Xe(F,X){var Ae=Re(F),Le=new SyntaxError(X+" (char "+Ae+")");return Le.char=Ae,Le}return e.addConversion({from:"string",to:"Node",convert:b}),b});var J2="compile",qX=["typed","parse"],G1=T(J2,qX,n=>{var{typed:e,parse:t}=n;return e(J2,{string:function(i){return t(i).compile()},"Array | Matrix":function(i){return lt(i,function(a){return t(a).compile()})}})});var X2="evaluate",zX=["typed","parse"],W1=T(X2,zX,n=>{var{typed:e,parse:t}=n;return e(X2,{string:function(i){var a=ss();return t(i).compile().evaluate(a)},"string, Map | Object":function(i,a){return t(i).compile().evaluate(a)},"Array | Matrix":function(i){var a=ss();return lt(i,function(o){return t(o).compile().evaluate(a)})},"Array | Matrix, Map | Object":function(i,a){return lt(i,function(o){return t(o).compile().evaluate(a)})}})});var $X="Parser",HX=["evaluate"],Y1=T($X,HX,n=>{var{evaluate:e}=n;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:ss(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(r){return e(r,this.scope)},t.prototype.get=function(r){if(this.scope.has(r))return this.scope.get(r)},t.prototype.getAll=function(){return uT(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(r,i){return this.scope.set(r,i),i},t.prototype.remove=function(r){this.scope.delete(r)},t.prototype.clear=function(){this.scope.clear()},t},{isClass:!0});var Q2="parser",GX=["typed","Parser"],j1=T(Q2,GX,n=>{var{typed:e,Parser:t}=n;return e(Q2,{"":function(){return new t}})});var K2="lup",WX=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Z1=T(K2,WX,n=>{var{typed:e,matrix:t,abs:r,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:u,larger:s,equalScalar:l,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=n;return e(K2,{DenseMatrix:function(y){return h(y)},SparseMatrix:function(y){return d(y)},Array:function(y){var S=t(y),b=h(S);return{L:b.L.valueOf(),U:b.U.valueOf(),p:b.p}}});function h(g){var y=g._size[0],S=g._size[1],b=Math.min(y,S),w=vt(g._data),A=[],x=[y,b],D=[],E=[b,S],_,N,P,B=[];for(_=0;_<y;_++)B[_]=_;for(N=0;N<S;N++){if(N>0)for(_=0;_<y;_++){var V=Math.min(_,N),z=0;for(P=0;P<V;P++)z=i(z,o(w[_][P],w[P][N]));w[_][N]=u(w[_][N],z)}var L=N,k=0,C=0;for(_=N;_<y;_++){var W=w[_][N],O=r(W);s(O,k)&&(L=_,k=O,C=W)}if(N!==L&&(B[N]=[B[L],B[L]=B[N]][0],f._swapRows(N,L,w)),N<y)for(_=N+1;_<y;_++){var H=w[_][N];l(H,0)||(w[_][N]=a(w[_][N],C))}}for(N=0;N<S;N++)for(_=0;_<y;_++){if(N===0&&(_<S&&(D[_]=[]),A[_]=[]),_<N){_<S&&(D[_][N]=w[_][N]),N<y&&(A[_][N]=0);continue}if(_===N){_<S&&(D[_][N]=w[_][N]),N<y&&(A[_][N]=1);continue}_<S&&(D[_][N]=0),N<y&&(A[_][N]=w[_][N])}var Z=new f({data:A,size:x}),Q=new f({data:D,size:E}),U=[];for(_=0,b=B.length;_<b;_++)U[B[_]]=_;return{L:Z,U:Q,p:U,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}function d(g){var y=g._size[0],S=g._size[1],b=Math.min(y,S),w=g._values,A=g._index,x=g._ptr,D=[],E=[],_=[],N=[y,b],P=[],B=[],V=[],z=[b,S],L,k,C,W=[],O=[];for(L=0;L<y;L++)W[L]=L,O[L]=L;var H=function(U,me){var De=O[U],pe=O[me];W[De]=me,W[pe]=U,O[U]=pe,O[me]=De},Z=function(){var U=new m;k<y&&(_.push(D.length),D.push(1),E.push(k)),V.push(P.length);var me=x[k],De=x[k+1];for(C=me;C<De;C++)L=A[C],U.set(W[L],w[C]);k>0&&U.forEach(0,k-1,function(Se,Me){p._forEachRow(Se,D,E,_,function(Ee,Ce){Ee>Se&&U.accumulate(Ee,c(o(Ce,Me)))})});var pe=k,_e=U.get(k),Ne=r(_e);U.forEach(k+1,y-1,function(Se,Me){var Ee=r(Me);s(Ee,Ne)&&(pe=Se,Ne=Ee,_e=Me)}),k!==pe&&(p._swapRows(k,pe,N[1],D,E,_),p._swapRows(k,pe,z[1],P,B,V),U.swap(k,pe),H(k,pe)),U.forEach(0,y-1,function(Se,Me){Se<=k?(P.push(Me),B.push(Se)):(Me=a(Me,_e),l(Me,0)||(D.push(Me),E.push(Se)))})};for(k=0;k<S;k++)Z();return V.push(P.length),_.push(D.length),{L:new p({values:D,index:E,ptr:_,size:N}),U:new p({values:P,index:B,ptr:V,size:z}),p:W,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
P: `+this.p}}}});var eI="qr",YX=["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],J1=T(eI,YX,n=>{var{typed:e,matrix:t,zeros:r,identity:i,isZero:a,equal:o,sign:u,sqrt:s,conj:l,unaryMinus:c,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=n;return zr(e(eI,{DenseMatrix:function(w){return y(w)},SparseMatrix:function(w){return S(w)},Array:function(w){var A=t(w),x=y(A);return{Q:x.Q.valueOf(),R:x.R.valueOf()}}}),{_denseQRimpl:g});function g(b){var w=b._size[0],A=b._size[1],x=i([w],"dense"),D=x._data,E=b.clone(),_=E._data,N,P,B,V=r([w],"");for(B=0;B<Math.min(A,w);++B){var z=_[B][B],L=c(o(z,0)?1:u(z)),k=l(L),C=0;for(N=B;N<w;N++)C=f(C,m(_[N][B],l(_[N][B])));var W=m(L,s(C));if(!a(W)){var O=h(z,W);for(V[B]=1,N=B+1;N<w;N++)V[N]=p(_[N][B],O);var H=c(l(p(O,W))),Z=void 0;for(P=B;P<A;P++){for(Z=0,N=B;N<w;N++)Z=f(Z,m(l(V[N]),_[N][P]));for(Z=m(Z,H),N=B;N<w;N++)_[N][P]=m(h(_[N][P],m(V[N],Z)),k)}for(N=0;N<w;N++){for(Z=0,P=B;P<w;P++)Z=f(Z,m(D[N][P],V[P]));for(Z=m(Z,H),P=B;P<w;++P)D[N][P]=p(h(D[N][P],m(Z,l(V[P]))),k)}}}return{Q:x,R:E,toString:function(){return"Q: "+this.Q.toString()+`
R: `+this.R.toString()}}}function y(b){var w=g(b),A=w.R._data;if(b._data.length>0)for(var x=A[0][0].type==="Complex"?d(0):0,D=0;D<A.length;++D)for(var E=0;E<D&&E<(A[0]||[]).length;++E)A[D][E]=x;return w}function S(b){throw new Error("qr not implemented for sparse matrices yet")}});function tI(n,e,t,r){for(var i=n._values,a=n._index,o=n._ptr,u=n._size,s=n._datatype,l=u[0],c=u[1],f=r&&n._values?[]:null,p=[],m=[],h=0,d=0;d<c;d++){m[d]=h;for(var g=t?t[d]:d,y=o[g],S=o[g+1],b=y;b<S;b++){var w=e?e[a[b]]:a[b];p[h]=w,f&&(f[h]=i[b]),h++}}return m[c]=h,n.createSparseMatrix({values:f,index:p,ptr:m,size:[l,c],datatype:s})}function gd(n,e,t,r,i,a,o){var u=0;for(t[o]=n;u>=0;){var s=t[o+u],l=t[r+s];l===-1?(u--,a[e++]=s):(t[r+s]=t[i+l],++u,t[o+u]=l)}return e}function rI(n,e){if(!n)return null;var t=0,r,i=[],a=[],o=0,u=e,s=2*e;for(r=0;r<e;r++)a[o+r]=-1;for(r=e-1;r>=0;r--)n[r]!==-1&&(a[u+r]=a[o+n[r]],a[o+n[r]]=r);for(r=0;r<e;r++)n[r]===-1&&(t=gd(r,t,a,o,u,i,s));return i}function nI(n,e){if(!n)return null;var t=n._index,r=n._ptr,i=n._size,a=i[0],o=i[1],u=[],s=[],l=0,c=o,f,p;if(e)for(f=0;f<a;f++)s[c+f]=-1;for(var m=0;m<o;m++){u[m]=-1,s[l+m]=-1;for(var h=r[m],d=r[m+1],g=h;g<d;g++){var y=t[g];for(f=e?s[c+y]:y;f!==-1&&f<m;f=p)p=s[l+f],s[l+f]=m,p===-1&&(u[f]=m);e&&(s[c+y]=m)}}return u}function iI(n,e,t){for(var r=n._values,i=n._index,a=n._ptr,o=n._size,u=o[1],s=0,l=0;l<u;l++){var c=a[l];for(a[l]=s;c<a[l+1];c++)e(i[c],l,r?r[c]:1,t)&&(i[s]=i[c],r&&(r[s]=r[c]),s++)}return a[u]=s,i.splice(s,i.length-s),r&&r.splice(s,r.length-s),s}function Ba(n){return-n-2}var jX="csAmd",ZX=["add","multiply","transpose"],aI=T(jX,ZX,n=>{var{add:e,multiply:t,transpose:r}=n;return function(c,f){if(!f||c<=0||c>3)return null;var p=f._size,m=p[0],h=p[1],d=0,g=Math.max(16,10*Math.sqrt(h));g=Math.min(h-2,g);var y=i(c,f,m,h,g);iI(y,s,null);for(var S=y._index,b=y._ptr,w=b[h],A=[],x=[],D=0,E=h+1,_=2*(h+1),N=3*(h+1),P=4*(h+1),B=5*(h+1),V=6*(h+1),z=7*(h+1),L=A,k=a(h,b,x,D,N,L,_,z,E,V,P,B),C=o(h,b,x,B,P,V,g,E,N,L,_),W=0,O,H,Z,Q,U,me,De,pe,_e,Ne,Se,Me,Ee,Ce,Ge,We;C<h;){for(Z=-1;W<h&&(Z=x[N+W])===-1;W++);x[_+Z]!==-1&&(L[x[_+Z]]=-1),x[N+W]=x[_+Z];var te=x[P+Z],oe=x[E+Z];C+=oe;var he=0;x[E+Z]=-oe;var ie=b[Z],re=te===0?ie:w,le=re;for(Q=1;Q<=te+1;Q++){for(Q>te?(me=Z,De=ie,pe=x[D+Z]-te):(me=S[ie++],De=b[me],pe=x[D+me]),U=1;U<=pe;U++)O=S[De++],!((_e=x[E+O])<=0)&&(he+=_e,x[E+O]=-_e,S[le++]=O,x[_+O]!==-1&&(L[x[_+O]]=L[O]),L[O]!==-1?x[_+L[O]]=x[_+O]:x[N+x[B+O]]=x[_+O]);me!==Z&&(b[me]=Ba(Z),x[V+me]=0)}for(te!==0&&(w=le),x[B+Z]=he,b[Z]=re,x[D+Z]=le-re,x[P+Z]=-2,k=u(k,d,x,V,h),Ne=re;Ne<le;Ne++)if(O=S[Ne],!((Se=x[P+O])<=0)){_e=-x[E+O];var Te=k-_e;for(ie=b[O],Me=b[O]+Se-1;ie<=Me;ie++)me=S[ie],x[V+me]>=k?x[V+me]-=_e:x[V+me]!==0&&(x[V+me]=x[B+me]+Te)}for(Ne=re;Ne<le;Ne++){for(O=S[Ne],Me=b[O],Ee=Me+x[P+O]-1,Ce=Me,Ge=0,We=0,ie=Me;ie<=Ee;ie++)if(me=S[ie],x[V+me]!==0){var Ie=x[V+me]-k;Ie>0?(We+=Ie,S[Ce++]=me,Ge+=me):(b[me]=Ba(Z),x[V+me]=0)}x[P+O]=Ce-Me+1;var Ze=Ce,xe=Me+x[D+O];for(ie=Ee+1;ie<xe;ie++){H=S[ie];var ht=x[E+H];ht<=0||(We+=ht,S[Ce++]=H,Ge+=H)}We===0?(b[O]=Ba(Z),_e=-x[E+O],he-=_e,oe+=_e,C+=_e,x[E+O]=0,x[P+O]=-1):(x[B+O]=Math.min(x[B+O],We),S[Ce]=S[Ze],S[Ze]=S[Me],S[Me]=Z,x[D+O]=Ce-Me+1,Ge=(Ge<0?-Ge:Ge)%h,x[_+O]=x[z+Ge],x[z+Ge]=O,L[O]=Ge)}for(x[B+Z]=he,d=Math.max(d,he),k=u(k+d,d,x,V,h),Ne=re;Ne<le;Ne++)if(O=S[Ne],!(x[E+O]>=0))for(Ge=L[O],O=x[z+Ge],x[z+Ge]=-1;O!==-1&&x[_+O]!==-1;O=x[_+O],k++){for(pe=x[D+O],Se=x[P+O],ie=b[O]+1;ie<=b[O]+pe-1;ie++)x[V+S[ie]]=k;var Nt=O;for(H=x[_+O];H!==-1;){var Ht=x[D+H]===pe&&x[P+H]===Se;for(ie=b[H]+1;Ht&&ie<=b[H]+pe-1;ie++)x[V+S[ie]]!==k&&(Ht=0);Ht?(b[H]=Ba(O),x[E+O]+=x[E+H],x[E+H]=0,x[P+H]=-1,H=x[_+H],x[_+Nt]=H):(Nt=H,H=x[_+H])}}for(ie=re,Ne=re;Ne<le;Ne++)O=S[Ne],!((_e=-x[E+O])<=0)&&(x[E+O]=_e,We=x[B+O]+he-_e,We=Math.min(We,h-C-_e),x[N+We]!==-1&&(L[x[N+We]]=O),x[_+O]=x[N+We],L[O]=-1,x[N+We]=O,W=Math.min(W,We),x[B+O]=We,S[ie++]=O);x[E+Z]=oe,(x[D+Z]=ie-re)===0&&(b[Z]=-1,x[V+Z]=0),te!==0&&(w=ie)}for(O=0;O<h;O++)b[O]=Ba(b[O]);for(H=0;H<=h;H++)x[N+H]=-1;for(H=h;H>=0;H--)x[E+H]>0||(x[_+H]=x[N+b[H]],x[N+b[H]]=H);for(me=h;me>=0;me--)x[E+me]<=0||b[me]!==-1&&(x[_+me]=x[N+b[me]],x[N+b[me]]=me);for(Z=0,O=0;O<=h;O++)b[O]===-1&&(Z=gd(O,Z,x,N,_,A,V));return A.splice(A.length-1,1),A};function i(l,c,f,p,m){var h=r(c);if(l===1&&p===f)return e(c,h);if(l===2){for(var d=h._index,g=h._ptr,y=0,S=0;S<f;S++){var b=g[S];if(g[S]=y,!(g[S+1]-b>m))for(var w=g[S+1];b<w;b++)d[y++]=d[b]}return g[f]=y,c=r(h),t(h,c)}return t(h,c)}function a(l,c,f,p,m,h,d,g,y,S,b,w){for(var A=0;A<l;A++)f[p+A]=c[A+1]-c[A];f[p+l]=0;for(var x=0;x<=l;x++)f[m+x]=-1,h[x]=-1,f[d+x]=-1,f[g+x]=-1,f[y+x]=1,f[S+x]=1,f[b+x]=0,f[w+x]=f[p+x];var D=u(0,0,f,S,l);return f[b+l]=-2,c[l]=-1,f[S+l]=0,D}function o(l,c,f,p,m,h,d,g,y,S,b){for(var w=0,A=0;A<l;A++){var x=f[p+A];if(x===0)f[m+A]=-2,w++,c[A]=-1,f[h+A]=0;else if(x>d)f[g+A]=0,f[m+A]=-1,w++,c[A]=Ba(l),f[g+l]++;else{var D=f[y+x];D!==-1&&(S[D]=A),f[b+A]=f[y+x],f[y+x]=A}}return w}function u(l,c,f,p,m){if(l<2||l+c<0){for(var h=0;h<m;h++)f[p+h]!==0&&(f[p+h]=1);l=2}return l}function s(l,c){return l!==c}});function oI(n,e,t,r,i,a,o){var u,s,l=0,c;if(n<=e||t[r+e]<=t[i+n])return-1;t[i+n]=t[r+e];var f=t[a+n];if(t[a+n]=e,f===-1)l=1,c=n;else{for(l=2,c=f;c!==t[o+c];c=t[o+c]);for(u=f;u!==c;u=s)s=t[o+u],t[o+u]=c}return{jleaf:l,q:c}}var JX="csCounts",XX=["transpose"],sI=T(JX,XX,n=>{var{transpose:e}=n;return function(t,r,i,a){if(!t||!r||!i)return null;var o=t._size,u=o[0],s=o[1],l,c,f,p,m,h,d,g=4*s+(a?s+u+1:0),y=[],S=0,b=s,w=2*s,A=3*s,x=4*s,D=5*s+1;for(f=0;f<g;f++)y[f]=-1;var E=[],_=e(t),N=_._index,P=_._ptr;for(f=0;f<s;f++)for(c=i[f],E[c]=y[A+c]===-1?1:0;c!==-1&&y[A+c]===-1;c=r[c])y[A+c]=f;if(a){for(f=0;f<s;f++)y[i[f]]=f;for(l=0;l<u;l++){for(f=s,h=P[l],d=P[l+1],m=h;m<d;m++)f=Math.min(f,y[N[m]]);y[D+l]=y[x+f],y[x+f]=l}}for(l=0;l<s;l++)y[S+l]=l;for(f=0;f<s;f++){for(c=i[f],r[c]!==-1&&E[r[c]]--,p=a?y[x+f]:c;p!==-1;p=a?y[D+p]:-1)for(m=P[p];m<P[p+1];m++){l=N[m];var B=oI(l,c,y,A,b,w,S);B.jleaf>=1&&E[c]++,B.jleaf===2&&E[B.q]--}r[c]!==-1&&(y[S+c]=r[c])}for(c=0;c<s;c++)r[c]!==-1&&(E[r[c]]+=E[c]);return E}});var QX="csSqr",KX=["add","multiply","transpose"],uI=T(QX,KX,n=>{var{add:e,multiply:t,transpose:r}=n,i=aI({add:e,multiply:t,transpose:r}),a=sI({transpose:r});return function(s,l,c){var f=l._ptr,p=l._size,m=p[1],h,d={};if(d.q=i(s,l),s&&!d.q)return null;if(c){var g=s?tI(l,null,d.q,0):l;d.parent=nI(g,1);var y=rI(d.parent,m);if(d.cp=a(g,d.parent,y,1),g&&d.parent&&d.cp&&o(g,d))for(d.unz=0,h=0;h<m;h++)d.unz+=d.cp[h]}else d.unz=4*f[m]+m,d.lnz=d.unz;return d};function o(u,s){var l=u._ptr,c=u._index,f=u._size,p=f[0],m=f[1];s.pinv=[],s.leftmost=[];var h=s.parent,d=s.pinv,g=s.leftmost,y=[],S=0,b=p,w=p+m,A=p+2*m,x,D,E,_,N;for(D=0;D<m;D++)y[b+D]=-1,y[w+D]=-1,y[A+D]=0;for(x=0;x<p;x++)g[x]=-1;for(D=m-1;D>=0;D--)for(_=l[D],N=l[D+1],E=_;E<N;E++)g[c[E]]=D;for(x=p-1;x>=0;x--)d[x]=-1,D=g[x],D!==-1&&(y[A+D]++===0&&(y[w+D]=x),y[S+x]=y[b+D],y[b+D]=x);for(s.lnz=0,s.m2=p,D=0;D<m;D++)if(x=y[b+D],s.lnz++,x<0&&(x=s.m2++),d[x]=D,!(--A[D]<=0)){s.lnz+=y[A+D];var P=h[D];P!==-1&&(y[A+P]===0&&(y[w+P]=y[w+D]),y[S+y[w+D]]=y[b+P],y[b+P]=y[S+x],y[A+P]+=y[A+D])}for(x=0;x<p;x++)d[x]<0&&(d[x]=D++);return!0}});function jc(n,e){return n[e]<0}function vd(n,e){n[e]=Ba(n[e])}function X1(n){return n<0?Ba(n):n}function lI(n,e,t,r,i){var a=e._index,o=e._ptr,u=e._size,s=u[1],l,c,f,p=0;for(r[0]=n;p>=0;){n=r[p];var m=i?i[n]:n;jc(o,n)||(vd(o,n),r[s+p]=m<0?0:X1(o[m]));var h=1;for(c=r[s+p],f=m<0?0:X1(o[m+1]);c<f;c++)if(l=a[c],!jc(o,l)){r[s+p]=c,r[++p]=l,h=0;break}h&&(p--,r[--t]=n)}return t}function cI(n,e,t,r,i){var a=n._ptr,o=n._size,u=e._index,s=e._ptr,l=o[1],c,f,p,m=l;for(f=s[t],p=s[t+1],c=f;c<p;c++){var h=u[c];jc(a,h)||(m=lI(h,n,m,r,i))}for(c=m;c<l;c++)vd(a,r[c]);return m}var eQ="csSpsolve",tQ=["divideScalar","multiply","subtract"],fI=T(eQ,tQ,n=>{var{divideScalar:e,multiply:t,subtract:r}=n;return function(a,o,u,s,l,c,f){var p=a._values,m=a._index,h=a._ptr,d=a._size,g=d[1],y=o._values,S=o._index,b=o._ptr,w,A,x,D,E=cI(a,o,u,s,c);for(w=E;w<g;w++)l[s[w]]=0;for(A=b[u],x=b[u+1],w=A;w<x;w++)l[S[w]]=y[w];for(var _=E;_<g;_++){var N=s[_],P=c?c[N]:N;if(!(P<0))for(A=h[P],x=h[P+1],l[N]=e(l[N],p[f?A:x-1]),w=f?A+1:A,D=f?x:x-1;w<D;w++){var B=m[w];l[B]=r(l[B],t(p[w],l[N]))}}return E}});var rQ="csLu",nQ=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],pI=T(rQ,nQ,n=>{var{abs:e,divideScalar:t,multiply:r,subtract:i,larger:a,largerEq:o,SparseMatrix:u}=n,s=fI({divideScalar:t,multiply:r,subtract:i});return function(c,f,p){if(!c)return null;var m=c._size,h=m[1],d,g=100,y=100;f&&(d=f.q,g=f.lnz||g,y=f.unz||y);var S=[],b=[],w=[],A=new u({values:S,index:b,ptr:w,size:[h,h]}),x=[],D=[],E=[],_=new u({values:x,index:D,ptr:E,size:[h,h]}),N=[],P,B,V=[],z=[];for(P=0;P<h;P++)V[P]=0,N[P]=-1,w[P+1]=0;g=0,y=0;for(var L=0;L<h;L++){w[L]=g,E[L]=y;var k=d?d[L]:L,C=s(A,c,k,z,V,N,1),W=-1,O=-1;for(B=C;B<h;B++)if(P=z[B],N[P]<0){var H=e(V[P]);a(H,O)&&(O=H,W=P)}else D[y]=N[P],x[y++]=V[P];if(W===-1||O<=0)return null;N[k]<0&&o(e(V[k]),r(O,p))&&(W=k);var Z=V[W];for(D[y]=L,x[y++]=Z,N[W]=L,b[g]=W,S[g++]=1,B=C;B<h;B++)P=z[B],N[P]<0&&(b[g]=P,S[g++]=t(V[P],Z)),V[P]=0}for(w[h]=g,E[h]=y,B=0;B<g;B++)b[B]=N[b[B]];return S.splice(g,S.length-g),b.splice(g,b.length-g),x.splice(y,x.length-y),D.splice(y,D.length-y),{L:A,U:_,pinv:N}}});var mI="slu",iQ=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],Q1=T(mI,iQ,n=>{var{typed:e,abs:t,add:r,multiply:i,transpose:a,divideScalar:o,subtract:u,larger:s,largerEq:l,SparseMatrix:c}=n,f=uI({add:r,multiply:i,transpose:a}),p=pI({abs:t,divideScalar:o,multiply:i,subtract:u,larger:s,largerEq:l,SparseMatrix:c});return e(mI,{"SparseMatrix, number, number":function(h,d,g){if(!nt(d)||d<0||d>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(g<0||g>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var y=f(d,h,!1),S=p(h,y,g);return{L:S.L,U:S.U,p:S.pinv,q:y.q,toString:function(){return"L: "+this.L.toString()+`
U: `+this.U.toString()+`
p: `+this.p.toString()+(this.q?`
q: `+this.q.toString():"")+`
`}}}})});function K1(n,e){var t,r=e.length,i=[];if(n)for(t=0;t<r;t++)i[n[t]]=e[t];else for(t=0;t<r;t++)i[t]=e[t];return i}var dI="lusolve",aQ=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],ew=T(dI,aQ,n=>{var{typed:e,matrix:t,lup:r,slu:i,usolve:a,lsolve:o,DenseMatrix:u}=n,s=Qa({DenseMatrix:u});return e(dI,{"Array, Array | Matrix":function(p,m){p=t(p);var h=r(p),d=c(h.L,h.U,h.p,null,m);return d.valueOf()},"DenseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix":function(p,m){var h=r(p);return c(h.L,h.U,h.p,null,m)},"SparseMatrix, Array | Matrix, number, number":function(p,m,h,d){var g=i(p,h,d);return c(g.L,g.U,g.p,g.q,m)},"Object, Array | Matrix":function(p,m){return c(p.L,p.U,p.p,p.q,m)}});function l(f){if(ot(f))return f;if(nr(f))return t(f);throw new TypeError("Invalid Matrix LU decomposition")}function c(f,p,m,h,d){f=l(f),p=l(p),m&&(d=s(f,d,!0),d._data=K1(m,d._data));var g=o(f,d),y=a(p,g);return h&&(y._data=K1(h,y._data)),y}});var hI="polynomialRoot",oQ=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],tw=T(hI,oQ,n=>{var{typed:e,isZero:t,equalScalar:r,add:i,subtract:a,multiply:o,divide:u,sqrt:s,unaryMinus:l,cbrt:c,typeOf:f,im:p,re:m}=n;return e(hI,{"number|Complex, ...number|Complex":(h,d)=>{for(var g=[h,...d];g.length>0&&t(g[g.length-1]);)g.pop();if(g.length<2)throw new RangeError("Polynomial [".concat(h,", ").concat(d,"] must have a non-zero non-constant coefficient"));switch(g.length){case 2:return[l(u(g[0],g[1]))];case 3:{var[y,S,b]=g,w=o(2,b),A=o(S,S),x=o(4,b,y);if(r(A,x))return[u(l(S),w)];var D=s(a(A,x));return[u(a(D,S),w),u(a(l(D),S),w)]}case 4:{var[E,_,N,P]=g,B=l(o(3,P)),V=o(N,N),z=o(3,P,_),L=i(o(2,N,N,N),o(27,P,P,E)),k=o(9,P,N,_);if(r(V,z)&&r(L,k))return[u(N,B)];var C=a(V,z),W=a(L,k),O=i(o(18,P,N,_,E),o(N,N,_,_)),H=i(o(4,N,N,N,E),o(4,P,_,_,_),o(27,P,P,E,E));if(r(O,H))return[u(a(o(4,P,N,_),i(o(9,P,P,E),o(N,N,N))),o(P,C)),u(a(o(9,P,E),o(N,_)),o(2,C))];var Z;r(V,z)?Z=W:Z=u(i(W,s(a(o(W,W),o(4,C,C,C)))),2);var Q=!0,U=c(Z,Q).toArray().map(me=>u(i(N,me,u(C,me)),B));return U.map(me=>f(me)==="Complex"&&r(m(me),m(me)+p(me))?m(me):me)}default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(g))}}})});var sQ="Help",uQ=["evaluate"],rw=T(sQ,uQ,n=>{var{evaluate:e}=n;function t(r){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!r)throw new Error('Argument "doc" missing');this.doc=r}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var r=this.doc||{},i=`
`;if(r.name&&(i+="Name: "+r.name+`

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

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

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

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

`),r.seealso&&r.seealso.length&&(i+="See also: "+r.seealso.join(", ")+`
`),i},t.prototype.toJSON=function(){var r=vt(this.doc);return r.mathjs="Help",r},t.fromJSON=function(r){var i={};return Object.keys(r).filter(a=>a!=="mathjs").forEach(a=>{i[a]=r[a]}),new t(i)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0});var lQ="Chain",cQ=["?on","math","typed"],nw=T(lQ,cQ,n=>{var{on:e,math:t,typed:r}=n;function i(l){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");mm(l)?this.value=l.value:this.value=l}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Mt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(l){return new i(l.value)};function a(l,c){typeof c=="function"&&(i.prototype[l]=u(c))}function o(l,c){TN(i.prototype,l,function(){var p=c();if(typeof p=="function")return u(p)})}function u(l){return function(){if(arguments.length===0)return new i(l(this.value));for(var c=[this.value],f=0;f<arguments.length;f++)c[f+1]=arguments[f];if(r.isTypedFunction(l)){var p=r.resolve(l,c);if(p.params.length===1)throw new Error("chain function "+l.name+" cannot match rest parameter between chain value and additional arguments.");return new i(p.implementation.apply(l,c))}return new i(l.apply(l,c))}}i.createProxy=function(l,c){if(typeof l=="string")a(l,c);else{var f=function(h){ut(l,h)&&s[h]===void 0&&o(h,()=>l[h])};for(var p in l)f(p)}};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),e&&e("import",function(l,c,f){f||o(l,c)}),i},{isClass:!0});var iw={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 gI={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};var vI={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 yI={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 bI={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};var xI={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};var wI={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 _I={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 SI={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};var AI={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};var MI={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 aw={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 EI={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 DI={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};var NI={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 TI={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};var CI={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};var FI={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};var II={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 PI={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 kI={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 BI={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 OI={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 RI={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 LI={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};var VI={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 UI={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 qI={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 zI={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 $I={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 HI={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 GI={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 WI={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 YI={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 jI={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 ZI={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 JI={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 XI={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 QI={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 KI={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 eP={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 tP={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 rP={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 nP={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 iP={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 aP={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 oP={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 sP={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 uP={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 lP={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};var cP={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 fP={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 pP={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};var mP={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 dP={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 hP={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 gP={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 vP={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 yP={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 bP={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 xP={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 wP={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};var _P={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};var SP={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 AP={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};var MP={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 EP={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 DP={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 NP={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 TP={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 CP={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 FP={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 IP={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 PP={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 kP={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 BP={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 OP={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 RP={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 LP={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 VP={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 UP={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 qP={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 zP={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 $P={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 HP={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 GP={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 WP={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 YP={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};var jP={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 ZP={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 JP={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 XP={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 QP={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 KP={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 ek={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 tk={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 rk={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 nk={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 ik={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 ak={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 ok={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 sk={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 uk={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 lk={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 ck={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 fk={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 pk={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 mk={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 dk={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 hk={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 gk={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 vk={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 yk={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 bk={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 xk={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 wk={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 _k={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 Sk={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 Ak={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 Mk={name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicant the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]};var Ek={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 Dk={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 Nk={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 Tk={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 Ck={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 Fk={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 Ik={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 Pk={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 kk={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 Bk={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 Ok={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};var Rk={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 Lk={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 Vk={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 Uk={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 qk={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 zk={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 $k={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 Hk={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 Gk={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 Wk={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 Yk={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 jk={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 Zk={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 Jk={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 Xk={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 Qk={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 Kk={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 eB={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 tB={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]};var rB={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]};var nB={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 iB={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 aB={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 oB={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 sB={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 uB={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 lB={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 cB={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 fB={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 pB={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 mB={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 dB={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 hB={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 gB={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 vB={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 yB={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 bB={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 xB={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 wB={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 _B={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 SB={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 AB={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 MB={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 EB={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 DB={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 NB={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 TB={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 CB={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 FB={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 IB={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 PB={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 kB={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 BB={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 OB={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 RB={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 LB={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]};var VB={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 UB={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 qB={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 zB={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 $B={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 HB={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 GB={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 WB={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:`Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. 

In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`,examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]};var YB={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 jB={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 ZB={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 JB={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 XB={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 QB={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 KB={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 eO={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 tO={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};var rO={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 nO={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};var iO={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 aO={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};var oO={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 sO={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 uO={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 lO={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 cO={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 fO={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 pO={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 mO={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 dO={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 hO={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 gO={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 vO={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 yO={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 bO={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 xO={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};var wO={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 _O={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 SO={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 AO={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]};var MO={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 EO={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 DO={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 NO={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]};var TO={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 CO={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 FO={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 IO={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 PO={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 kO={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 BO={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 OO={name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]};var RO={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]};var LO={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 VO={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 UO={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 qO={bignumber:FI,boolean:II,complex:PI,createUnit:kI,fraction:BI,index:OI,matrix:RI,number:LI,sparse:VI,splitUnit:UI,string:qI,unit:zI,e:iw,E:iw,false:gI,i:vI,Infinity:yI,LN2:xI,LN10:bI,LOG2E:_I,LOG10E:wI,NaN:SI,null:AI,pi:aw,PI:aw,phi:MI,SQRT1_2:EI,SQRT2:DI,tau:NI,true:TI,version:CI,speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:WI,lsolve:jI,lsolveAll:ZI,lup:JI,lusolve:XI,leafCount:YI,polynomialRoot:QI,resolve:tP,simplify:rP,simplifyConstant:nP,simplifyCore:iP,symbolicEqual:oP,rationalize:eP,slu:aP,usolve:sP,usolveAll:uP,qr:KI,abs:lP,add:cP,cbrt:fP,ceil:pP,cube:mP,divide:dP,dotDivide:hP,dotMultiply:gP,dotPow:vP,exp:yP,expm:bP,expm1:xP,fix:wP,floor:_P,gcd:SP,hypot:AP,lcm:EP,log:DP,log2:CP,log1p:TP,log10:NP,mod:FP,multiply:IP,norm:PP,nthRoot:kP,nthRoots:BP,pow:OP,round:RP,sign:LP,sqrt:VP,sqrtm:UP,square:HP,subtract:GP,unaryMinus:WP,unaryPlus:YP,xgcd:jP,invmod:MP,bitAnd:ZP,bitNot:JP,bitOr:XP,bitXor:QP,leftShift:KP,rightArithShift:ek,rightLogShift:tk,bellNumbers:rk,catalan:nk,composition:ik,stirlingS2:ak,config:$I,import:HI,typed:GI,arg:ok,conj:sk,re:lk,im:uk,evaluate:ck,help:fk,distance:pk,intersect:mk,and:dk,not:hk,or:gk,xor:vk,concat:bk,count:xk,cross:wk,column:yk,ctranspose:_k,det:Sk,diag:Ak,diff:Mk,dot:Ek,getMatrixDataType:Fk,identity:Ik,filter:Nk,flatten:Tk,forEach:Ck,inv:Pk,pinv:kk,eigs:Dk,kron:Bk,matrixFromFunction:Lk,matrixFromRows:Vk,matrixFromColumns:Rk,map:Ok,ones:Uk,partitionSelect:qk,range:zk,resize:Hk,reshape:$k,rotate:Gk,rotationMatrix:Wk,row:Yk,size:jk,sort:Zk,squeeze:Jk,subset:Xk,trace:Qk,transpose:Kk,zeros:eB,fft:tB,ifft:rB,sylvester:qP,schur:zP,lyap:$P,solveODE:UO,combinations:nB,combinationsWithRep:iB,factorial:aB,gamma:oB,kldivergence:uB,lgamma:sB,multinomial:lB,permutations:cB,pickRandom:fB,random:pB,randomInt:mB,compare:dB,compareNatural:hB,compareText:gB,deepEqual:vB,equal:yB,equalText:bB,larger:xB,largerEq:wB,smaller:_B,smallerEq:SB,unequal:AB,setCartesian:MB,setDifference:EB,setDistinct:DB,setIntersect:NB,setIsSubset:TB,setMultiplicity:CB,setPowerset:FB,setSize:IB,setSymDifference:PB,setUnion:kB,zpk2tf:BB,freqz:OB,erf:RB,zeta:LB,cumsum:jB,mad:VB,max:UB,mean:qB,median:zB,min:$B,mode:HB,prod:GB,quantileSeq:WB,std:YB,sum:ZB,variance:JB,corr:XB,acos:QB,acosh:KB,acot:eO,acoth:tO,acsc:rO,acsch:nO,asec:iO,asech:aO,asin:oO,asinh:sO,atan:uO,atanh:cO,atan2:lO,cos:fO,cosh:pO,cot:mO,coth:dO,csc:hO,csch:gO,sec:vO,sech:yO,sin:bO,sinh:xO,tan:wO,tanh:_O,to:SO,clone:MO,format:EO,bin:AO,oct:RO,hex:NO,isNaN:CO,isInteger:TO,isNegative:FO,isNumeric:IO,hasNumericValue:DO,isPositive:PO,isPrime:kO,isZero:BO,print:LO,typeOf:VO,numeric:OO};var zO="help",fQ=["typed","mathWithTransform","Help"],ow=T(zO,fQ,n=>{var{typed:e,mathWithTransform:t,Help:r}=n;return e(zO,{any:function(a){var o,u=a;if(typeof a!="string"){for(o in t)if(ut(t,o)&&a===t[o]){u=o;break}}var s=$r(qO,u);if(!s){var l=typeof u=="function"?u.name:u;throw new Error('No documentation found on "'+l+'"')}return new r(s)}})});var $O="chain",pQ=["typed","Chain"],sw=T($O,pQ,n=>{var{typed:e,Chain:t}=n;return e($O,{"":function(){return new t},any:function(i){return new t(i)}})});var HO="det",mQ=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],uw=T(HO,mQ,n=>{var{typed:e,matrix:t,subtractScalar:r,multiply:i,divideScalar:a,isZero:o,unaryMinus:u}=n;return e(HO,{any:function(c){return vt(c)},"Array | Matrix":function(c){var f;switch(ot(c)?f=c.size():Array.isArray(c)?(c=t(c),f=c.size()):f=[],f.length){case 0:return vt(c);case 1:if(f[0]===1)return vt(c.valueOf()[0]);if(f[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Mt(f)+")");case 2:{var p=f[0],m=f[1];if(p===m)return s(c.clone().valueOf(),p,m);if(m===0)return 1;throw new RangeError("Matrix must be square (size: "+Mt(f)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(f)+")")}}});function s(l,c,f){if(c===1)return vt(l[0][0]);if(c===2)return r(i(l[0][0],l[1][1]),i(l[1][0],l[0][1]));for(var p=!1,m=new Array(c).fill(0).map((D,E)=>E),h=0;h<c;h++){var d=m[h];if(o(l[d][h])){var g=void 0;for(g=h+1;g<c;g++)if(!o(l[m[g]][h])){d=m[g],m[g]=m[h],m[h]=d,p=!p;break}if(g===c)return l[d][h]}for(var y=l[d][h],S=h===0?1:l[m[h-1]][h-1],b=h+1;b<c;b++)for(var w=m[b],A=h+1;A<c;A++)l[w][A]=a(r(i(l[w][A],y),i(l[w][h],l[d][A])),S)}var x=l[m[c-1]][c-1];return p?u(x):x}});var GO="inv",dQ=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],lw=T(GO,dQ,n=>{var{typed:e,matrix:t,divideScalar:r,addScalar:i,multiply:a,unaryMinus:o,det:u,identity:s,abs:l}=n;return e(GO,{"Array | Matrix":function(p){var m=ot(p)?p.size():_t(p);switch(m.length){case 1:if(m[0]===1)return ot(p)?t([r(1,p.valueOf()[0])]):[r(1,p[0])];throw new RangeError("Matrix must be square (size: "+Mt(m)+")");case 2:{var h=m[0],d=m[1];if(h===d)return ot(p)?t(c(p.valueOf(),h,d),p.storage()):c(p,h,d);throw new RangeError("Matrix must be square (size: "+Mt(m)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(m)+")")}},any:function(p){return r(1,p)}});function c(f,p,m){var h,d,g,y,S;if(p===1){if(y=f[0][0],y===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,y)]]}else if(p===2){var b=u(f);if(b===0)throw Error("Cannot calculate inverse, determinant is zero");return[[r(f[1][1],b),r(o(f[0][1]),b)],[r(o(f[1][0]),b),r(f[0][0],b)]]}else{var w=f.concat();for(h=0;h<p;h++)w[h]=w[h].concat();for(var A=s(p).valueOf(),x=0;x<m;x++){var D=l(w[x][x]),E=x;for(h=x+1;h<p;)l(w[h][x])>D&&(D=l(w[h][x]),E=h),h++;if(D===0)throw Error("Cannot calculate inverse, determinant is zero");h=E,h!==x&&(S=w[x],w[x]=w[h],w[h]=S,S=A[x],A[x]=A[h],A[h]=S);var _=w[x],N=A[x];for(h=0;h<p;h++){var P=w[h],B=A[h];if(h!==x){if(P[x]!==0){for(g=r(o(P[x]),_[x]),d=x;d<m;d++)P[d]=i(P[d],a(g,_[d]));for(d=0;d<m;d++)B[d]=i(B[d],a(g,N[d]))}}else{for(g=_[x],d=x;d<m;d++)P[d]=r(P[d],g);for(d=0;d<m;d++)B[d]=r(B[d],g)}}}return A}}});var WO="pinv",hQ=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],cw=T(WO,hQ,n=>{var{typed:e,matrix:t,inv:r,deepEqual:i,equal:a,dotDivide:o,dot:u,ctranspose:s,divideScalar:l,multiply:c,add:f,Complex:p}=n;return e(WO,{"Array | Matrix":function(b){var w=ot(b)?b.size():_t(b);switch(w.length){case 1:return y(b)?s(b):w[0]===1?r(b):o(s(b),u(b,b));case 2:{if(y(b))return s(b);var A=w[0],x=w[1];if(A===x)try{return r(b)}catch(D){if(!(D instanceof Error&&D.message.match(/Cannot calculate inverse, determinant is zero/)))throw D}return ot(b)?t(m(b.valueOf(),A,x),b.storage()):m(b,A,x)}default:throw new RangeError("Matrix must be two dimensional (size: "+Mt(w)+")")}},any:function(b){return a(b,0)?vt(b):l(1,b)}});function m(S,b,w){var{C:A,F:x}=d(S,b,w),D=c(r(c(s(A),A)),s(A)),E=c(s(x),r(c(x,s(x))));return c(E,D)}function h(S,b,w){for(var A=vt(S),x=0,D=0;D<b;D++){if(w<=x)return A;for(var E=D;g(A[E][x]);)if(E++,b===E&&(E=D,x++,w===x))return A;[A[E],A[D]]=[A[D],A[E]];for(var _=A[D][x],N=0;N<w;N++)A[D][N]=o(A[D][N],_);for(var P=0;P<b;P++)if(P!==D){_=A[P][x];for(var B=0;B<w;B++)A[P][B]=f(A[P][B],c(-1,c(_,A[D][B])))}x++}return A}function d(S,b,w){var A=h(S,b,w),x=S.map((E,_)=>E.filter((N,P)=>P<b&&!g(u(A[P],A[P])))),D=A.filter((E,_)=>!g(u(A[_],A[_])));return{C:x,F:D}}function g(S){return a(f(S,p(1,1)),f(0,p(1,1)))}function y(S){return i(f(S,p(1,1)),f(c(S,0),p(1,1)))}});function YO(n){var{addScalar:e,subtract:t,flatten:r,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:u,abs:s,bignumber:l,diag:c,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:S,larger:b,smaller:w,matrixFromColumns:A,dot:x}=n;function D(Q,U,me,De){var pe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,_e=E(Q,U,me,De,pe);_(Q,U,me,De,pe,_e);var{values:Ne,C:Se}=N(Q,U,me,De,pe);if(pe){var Me=P(Q,U,Se,_e,Ne,me,De);return{values:Ne,eigenvectors:Me}}return{values:Ne}}function E(Q,U,me,De,pe){var _e=De==="BigNumber",Ne=De==="Complex",Se=_e?l(0):0,Me=_e?l(1):Ne?S(1):1,Ee=_e?l(1):1,Ce=_e?l(10):2,Ge=a(Ce,Ce),We;pe&&(We=Array(U).fill(Me));for(var te=!1;!te;){te=!0;for(var oe=0;oe<U;oe++){for(var he=Se,ie=Se,re=0;re<U;re++)oe!==re&&(he=e(he,s(Q[re][oe])),ie=e(ie,s(Q[oe][re])));if(!y(he,0)&&!y(ie,0)){for(var le=Ee,Te=he,Ie=o(ie,Ce),Ze=a(ie,Ce);w(Te,Ie);)Te=a(Te,Ge),le=a(le,Ce);for(;b(Te,Ze);)Te=o(Te,Ge),le=o(le,Ce);var xe=w(o(e(Te,ie),le),a(e(he,ie),.95));if(xe){te=!1;for(var ht=o(1,le),Nt=0;Nt<U;Nt++)oe!==Nt&&(Q[oe][Nt]=a(Q[oe][Nt],ht),Q[Nt][oe]=a(Q[Nt][oe],le));pe&&(We[oe]=a(We[oe],ht))}}}}return pe?c(We):null}function _(Q,U,me,De,pe,_e){var Ne=De==="BigNumber",Se=De==="Complex",Me=Ne?l(0):Se?S(0):0;Ne&&(me=l(me));for(var Ee=0;Ee<U-2;Ee++){for(var Ce=0,Ge=Me,We=Ee+1;We<U;We++){var te=Q[We][Ee];w(s(Ge),s(te))&&(Ge=te,Ce=We)}if(!w(s(Ge),me)){if(Ce!==Ee+1){var oe=Q[Ce];Q[Ce]=Q[Ee+1],Q[Ee+1]=oe;for(var he=0;he<U;he++){var ie=Q[he][Ce];Q[he][Ce]=Q[he][Ee+1],Q[he][Ee+1]=ie}if(pe){var re=_e[Ce];_e[Ce]=_e[Ee+1],_e[Ee+1]=re}}for(var le=Ee+2;le<U;le++){var Te=o(Q[le][Ee],Ge);if(Te!==0){for(var Ie=0;Ie<U;Ie++)Q[le][Ie]=t(Q[le][Ie],a(Te,Q[Ee+1][Ie]));for(var Ze=0;Ze<U;Ze++)Q[Ze][Ee+1]=e(Q[Ze][Ee+1],a(Te,Q[Ze][le]));if(pe)for(var xe=0;xe<U;xe++)_e[le][xe]=t(_e[le][xe],a(Te,_e[Ee+1][xe]))}}}}return _e}function N(Q,U,me,De,pe){var _e=De==="BigNumber",Ne=De==="Complex",Se=_e?l(1):Ne?S(1):1;_e&&(me=l(me));for(var Me=vt(Q),Ee=[],Ce=U,Ge=[],We=pe?c(Array(U).fill(Se)):void 0,te=pe?c(Array(Ce).fill(Se)):void 0,oe=0;oe<=100;){oe+=1;for(var he=Me[Ce-1][Ce-1],ie=0;ie<Ce;ie++)Me[ie][ie]=t(Me[ie][ie],he);var{Q:re,R:le}=h(Me);Me=i(le,re);for(var Te=0;Te<Ce;Te++)Me[Te][Te]=e(Me[Te][Te],he);if(pe&&(te=i(te,re)),Ce===1||w(s(Me[Ce-1][Ce-2]),me)){oe=0,Ee.push(Me[Ce-1][Ce-1]),pe&&(Ge.unshift([[1]]),z(te,U),We=i(We,te),Ce>1&&(te=c(Array(Ce-1).fill(Se)))),Ce-=1,Me.pop();for(var Ie=0;Ie<Ce;Ie++)Me[Ie].pop()}else if(Ce===2||w(s(Me[Ce-2][Ce-3]),me)){oe=0;var Ze=B(Me[Ce-2][Ce-2],Me[Ce-2][Ce-1],Me[Ce-1][Ce-2],Me[Ce-1][Ce-1]);Ee.push(...Ze),pe&&(Ge.unshift(V(Me[Ce-2][Ce-2],Me[Ce-2][Ce-1],Me[Ce-1][Ce-2],Me[Ce-1][Ce-1],Ze[0],Ze[1],me,De)),z(te,U),We=i(We,te),Ce>2&&(te=c(Array(Ce-2).fill(Se)))),Ce-=2,Me.pop(),Me.pop();for(var xe=0;xe<Ce;xe++)Me[xe].pop(),Me[xe].pop()}if(Ce===0)break}if(Ee.sort((Ht,Et)=>+t(s(Ht),s(Et))),oe>100){var ht=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+Ee.join(", "));throw ht.values=Ee,ht.vectors=[],ht}var Nt=pe?i(We,L(Ge,U)):void 0;return{values:Ee,C:Nt}}function P(Q,U,me,De,pe,_e,Ne){var Se=m(me),Me=i(Se,Q,me),Ee=Ne==="BigNumber",Ce=Ne==="Complex",Ge=Ee?l(0):Ce?S(0):0,We=Ee?l(1):Ce?S(1):1,te=[],oe=[];for(var he of pe){var ie=k(te,he,y);ie===-1?(te.push(he),oe.push(1)):oe[ie]+=1}for(var re=[],le=te.length,Te=Array(U).fill(Ge),Ie=c(Array(U).fill(We)),Ze=function(){var Nt=te[xe],Ht=t(Me,i(Nt,Ie)),Et=g(Ht,Te);for(Et.shift();Et.length<oe[xe];){var ae=C(Ht,U,Et,_e,Ne);if(ae===null)break;Et.push(ae)}var de=i(m(De),me);Et=Et.map(ge=>i(de,ge)),re.push(...Et.map(ge=>({value:Nt,vector:r(ge)})))},xe=0;xe<le;xe++)Ze();return re}function B(Q,U,me,De){var pe=e(Q,De),_e=t(a(Q,De),a(U,me)),Ne=a(pe,.5),Se=a(u(t(a(pe,pe),a(4,_e))),.5);return[e(Ne,Se),t(Ne,Se)]}function V(Q,U,me,De,pe,_e,Ne,Se){var Me=Se==="BigNumber",Ee=Se==="Complex",Ce=Me?l(0):Ee?S(0):0,Ge=Me?l(1):Ee?S(1):1;if(w(s(me),Ne))return[[Ge,Ce],[Ce,Ge]];if(b(s(t(pe,_e)),Ne))return[[t(pe,De),t(_e,De)],[me,me]];var We=t(Q,pe),te=t(De,pe);return w(s(U),Ne)&&w(s(te),Ne)?[[We,Ge],[me,Ce]]:[[U,Ce],[te,Ge]]}function z(Q,U){for(var me=0;me<Q.length;me++)Q[me].push(...Array(U-Q[me].length).fill(0));for(var De=Q.length;De<U;De++)Q.push(Array(U).fill(0)),Q[De][De]=1;return Q}function L(Q,U){for(var me=[],De=0;De<U;De++)me[De]=Array(U).fill(0);var pe=0;for(var _e of Q){for(var Ne=_e.length,Se=0;Se<Ne;Se++)for(var Me=0;Me<Ne;Me++)me[pe+Se][pe+Me]=_e[Se][Me];pe+=Ne}return me}function k(Q,U,me){for(var De=0;De<Q.length;De++)if(me(Q[De],U))return De;return-1}function C(Q,U,me,De,pe){for(var _e=pe==="BigNumber"?l(1e3):1e3,Ne,Se=0;Se<5;++Se){Ne=W(U,me,pe);try{Ne=d(Q,Ne)}catch{continue}if(b(H(Ne),_e))break}if(Se>=5)return null;for(Se=0;;){var Me=d(Q,Ne);if(w(H(O(Ne,[Me])),De))break;if(++Se>=10)return null;Ne=Z(Me)}return Ne}function W(Q,U,me){var De=me==="BigNumber",pe=me==="Complex",_e=Array(Q).fill(0).map(Ne=>2*Math.random()-1);return De&&(_e=_e.map(Ne=>l(Ne))),pe&&(_e=_e.map(Ne=>S(Ne))),_e=O(_e,U),Z(_e,me)}function O(Q,U){var me=f(Q);for(var De of U)De=p(De,me),Q=t(Q,i(o(x(De,Q),x(De,De)),De));return Q}function H(Q){return s(u(x(Q,Q)))}function Z(Q,U){var me=U==="BigNumber",De=U==="Complex",pe=me?l(1):De?S(1):1;return i(o(pe,H(Q)),Q)}return D}function jO(n){var{config:e,addScalar:t,subtract:r,abs:i,atan:a,cos:o,sin:u,multiplyScalar:s,inv:l,bignumber:c,multiply:f,add:p}=n;function m(_,N){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.epsilon,B=arguments.length>3?arguments[3]:void 0,V=arguments.length>4?arguments[4]:void 0;if(B==="number")return h(_,P,V);if(B==="BigNumber")return d(_,P,V);throw TypeError("Unsupported data type: "+B)}function h(_,N,P){var B=_.length,V=Math.abs(N/B),z,L;if(P){L=new Array(B);for(var k=0;k<B;k++)L[k]=Array(B).fill(0),L[k][k]=1}for(var C=x(_);Math.abs(C[1])>=Math.abs(V);){var W=C[0][0],O=C[0][1];z=g(_[W][W],_[O][O],_[W][O]),_=A(_,z,W,O),P&&(L=S(L,z,W,O)),C=x(_)}for(var H=Array(B).fill(0),Z=0;Z<B;Z++)H[Z]=_[Z][Z];return E(vt(H),L,P)}function d(_,N,P){var B=_.length,V=i(N/B),z,L;if(P){L=new Array(B);for(var k=0;k<B;k++)L[k]=Array(B).fill(0),L[k][k]=1}for(var C=D(_);i(C[1])>=i(V);){var W=C[0][0],O=C[0][1];z=y(_[W][W],_[O][O],_[W][O]),_=w(_,z,W,O),P&&(L=b(L,z,W,O)),C=D(_)}for(var H=Array(B).fill(0),Z=0;Z<B;Z++)H[Z]=_[Z][Z];return E(vt(H),L,P)}function g(_,N,P){var B=N-_;return Math.abs(B)<=e.epsilon?Math.PI/4:.5*Math.atan(2*P/(N-_))}function y(_,N,P){var B=r(N,_);return i(B)<=e.epsilon?c(-1).acos().div(4):s(.5,a(f(2,P,l(B))))}function S(_,N,P,B){for(var V=_.length,z=Math.cos(N),L=Math.sin(N),k=Array(V).fill(0),C=Array(V).fill(0),W=0;W<V;W++)k[W]=z*_[W][P]-L*_[W][B],C[W]=L*_[W][P]+z*_[W][B];for(var O=0;O<V;O++)_[O][P]=k[O],_[O][B]=C[O];return _}function b(_,N,P,B){for(var V=_.length,z=o(N),L=u(N),k=Array(V).fill(c(0)),C=Array(V).fill(c(0)),W=0;W<V;W++)k[W]=r(s(z,_[W][P]),s(L,_[W][B])),C[W]=t(s(L,_[W][P]),s(z,_[W][B]));for(var O=0;O<V;O++)_[O][P]=k[O],_[O][B]=C[O];return _}function w(_,N,P,B){for(var V=_.length,z=c(o(N)),L=c(u(N)),k=s(z,z),C=s(L,L),W=Array(V).fill(c(0)),O=Array(V).fill(c(0)),H=f(c(2),z,L,_[P][B]),Z=t(r(s(k,_[P][P]),H),s(C,_[B][B])),Q=p(s(C,_[P][P]),H,s(k,_[B][B])),U=0;U<V;U++)W[U]=r(s(z,_[P][U]),s(L,_[B][U])),O[U]=t(s(L,_[P][U]),s(z,_[B][U]));_[P][P]=Z,_[B][B]=Q,_[P][B]=c(0),_[B][P]=c(0);for(var me=0;me<V;me++)me!==P&&me!==B&&(_[P][me]=W[me],_[me][P]=W[me],_[B][me]=O[me],_[me][B]=O[me]);return _}function A(_,N,P,B){for(var V=_.length,z=Math.cos(N),L=Math.sin(N),k=z*z,C=L*L,W=Array(V).fill(0),O=Array(V).fill(0),H=k*_[P][P]-2*z*L*_[P][B]+C*_[B][B],Z=C*_[P][P]+2*z*L*_[P][B]+k*_[B][B],Q=0;Q<V;Q++)W[Q]=z*_[P][Q]-L*_[B][Q],O[Q]=L*_[P][Q]+z*_[B][Q];_[P][P]=H,_[B][B]=Z,_[P][B]=0,_[B][P]=0;for(var U=0;U<V;U++)U!==P&&U!==B&&(_[P][U]=W[U],_[U][P]=W[U],_[B][U]=O[U],_[U][B]=O[U]);return _}function x(_){for(var N=_.length,P=0,B=[0,1],V=0;V<N;V++)for(var z=V+1;z<N;z++)Math.abs(P)<Math.abs(_[V][z])&&(P=Math.abs(_[V][z]),B=[V,z]);return[B,P]}function D(_){for(var N=_.length,P=0,B=[0,1],V=0;V<N;V++)for(var z=V+1;z<N;z++)i(P)<i(_[V][z])&&(P=i(_[V][z]),B=[V,z]);return[B,P]}function E(_,N,P){var B=_.length,V=Array(B),z;if(P){z=Array(B);for(var L=0;L<B;L++)z[L]=Array(B)}for(var k=0;k<B;k++){for(var C=0,W=_[0],O=0;O<_.length;O++)i(_[O])<i(W)&&(C=O,W=_[C]);if(V[k]=_.splice(C,1)[0],P)for(var H=0;H<B;H++)z[k][H]=N[H][C],N[H].splice(C,1)}if(!P)return{values:V};var Z=z.map((Q,U)=>({value:V[U],vector:Q}));return{values:V,eigenvectors:Z}}return m}var gQ="eigs",vQ=["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"],fw=T(gQ,vQ,n=>{var{config:e,typed:t,matrix:r,addScalar:i,subtract:a,equal:o,abs:u,atan:s,cos:l,sin:c,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:d,add:g,larger:y,column:S,flatten:b,number:w,complex:A,sqrt:x,diag:D,size:E,reshape:_,qr:N,usolve:P,usolveAll:B,im:V,re:z,smaller:L,matrixFromColumns:k,dot:C}=n,W=jO({config:e,addScalar:i,subtract:a,column:S,flatten:b,equal:o,abs:u,atan:s,cos:l,sin:c,multiplyScalar:f,inv:m,bignumber:h,complex:A,multiply:d,add:g}),O=YO({config:e,addScalar:i,subtract:a,multiply:d,multiplyScalar:f,flatten:b,divideScalar:p,sqrt:x,abs:u,bignumber:h,diag:D,size:E,reshape:_,qr:N,inv:m,usolve:P,usolveAll:B,equal:o,complex:A,larger:y,smaller:L,matrixFromColumns:k,dot:C});return t("eigs",{Array:function(_e){return H(r(_e))},"Array, number|BigNumber":function(_e,Ne){return H(r(_e),{precision:Ne})},"Array, Object"(pe,_e){return H(r(pe),_e)},Matrix:function(_e){return H(_e,{matricize:!0})},"Matrix, number|BigNumber":function(_e,Ne){return H(_e,{precision:Ne,matricize:!0})},"Matrix, Object":function(_e,Ne){var Se={matricize:!0};return zr(Se,Ne),H(_e,Se)}});function H(pe){var _e,Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Se="eigenvectors"in Ne?Ne.eigenvectors:!0,Me=(_e=Ne.precision)!==null&&_e!==void 0?_e:e.epsilon,Ee=Z(pe,Me,Se);return Ne.matricize&&(Ee.values=r(Ee.values),Se&&(Ee.eigenvectors=Ee.eigenvectors.map(Ce=>{var{value:Ge,vector:We}=Ce;return{value:Ge,vector:r(We)}}))),Se&&Object.defineProperty(Ee,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),Ee}function Z(pe,_e,Ne){var Se=pe.toArray(),Me=pe.size();if(Me.length!==2||Me[0]!==Me[1])throw new RangeError("Matrix must be square (size: ".concat(Mt(Me),")"));var Ee=Me[0];if(U(Se,Ee,_e)&&(me(Se,Ee),Q(Se,Ee,_e))){var Ce=De(pe,Se,Ee);return W(Se,Ee,_e,Ce,Ne)}var Ge=De(pe,Se,Ee);return O(Se,Ee,_e,Ge,Ne)}function Q(pe,_e,Ne){for(var Se=0;Se<_e;Se++)for(var Me=Se;Me<_e;Me++)if(y(h(u(a(pe[Se][Me],pe[Me][Se]))),Ne))return!1;return!0}function U(pe,_e,Ne){for(var Se=0;Se<_e;Se++)for(var Me=0;Me<_e;Me++)if(y(h(u(V(pe[Se][Me]))),Ne))return!1;return!0}function me(pe,_e){for(var Ne=0;Ne<_e;Ne++)for(var Se=0;Se<_e;Se++)pe[Ne][Se]=z(pe[Ne][Se])}function De(pe,_e,Ne){var Se=pe.datatype();if(Se==="number"||Se==="BigNumber"||Se==="Complex")return Se;for(var Me=!1,Ee=!1,Ce=!1,Ge=0;Ge<Ne;Ge++)for(var We=0;We<Ne;We++){var te=_e[Ge][We];if(At(te)||Ao(te))Me=!0;else if(pt(te))Ee=!0;else if(gi(te))Ce=!0;else throw TypeError("Unsupported type in Matrix: "+Kt(te))}if(Ee&&Ce&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),Ce){for(var oe=0;oe<Ne;oe++)for(var he=0;he<Ne;he++)_e[oe][he]=A(_e[oe][he]);return"Complex"}if(Ee){for(var ie=0;ie<Ne;ie++)for(var re=0;re<Ne;re++)_e[ie][re]=h(_e[ie][re]);return"BigNumber"}if(Me){for(var le=0;le<Ne;le++)for(var Te=0;Te<Ne;Te++)_e[le][Te]=w(_e[le][Te]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}});var ZO="expm",yQ=["typed","abs","add","identity","inv","multiply"],pw=T(ZO,yQ,n=>{var{typed:e,abs:t,add:r,identity:i,inv:a,multiply:o}=n;return e(ZO,{Matrix:function(f){var p=f.size();if(p.length!==2||p[0]!==p[1])throw new RangeError("Matrix must be square (size: "+Mt(p)+")");for(var m=p[0],h=1e-15,d=u(f),g=s(d,h),y=g.q,S=g.j,b=o(f,Math.pow(2,-S)),w=i(m),A=i(m),x=1,D=b,E=-1,_=1;_<=y;_++)_>1&&(D=o(D,b),E=-E),x=x*(y-_+1)/((2*y-_+1)*_),w=r(w,o(x,D)),A=r(A,o(x*E,D));for(var N=o(a(A),w),P=0;P<S;P++)N=o(N,N);return Ta(f)?f.createSparseMatrix(N):N}});function u(c){for(var f=c.size()[0],p=0,m=0;m<f;m++){for(var h=0,d=0;d<f;d++)h+=t(c.get([m,d]));p=Math.max(h,p)}return p}function s(c,f){for(var p=30,m=0;m<p;m++)for(var h=0;h<=m;h++){var d=m-h;if(l(c,h,d)<f)return{q:h,j:d}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function l(c,f,p){for(var m=1,h=2;h<=f;h++)m*=h;for(var d=m,g=f+1;g<=2*f;g++)d*=g;var y=d*(2*f+1);return 8*Math.pow(c/Math.pow(2,p),2*f)*m*m/(d*y)}});var JO="sqrtm",bQ=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],mw=T(JO,bQ,n=>{var{typed:e,abs:t,add:r,multiply:i,map:a,sqrt:o,subtract:u,inv:s,size:l,max:c,identity:f}=n,p=1e3,m=1e-6;function h(d){var g,y=0,S=d,b=f(l(d));do{var w=S;if(S=i(.5,r(w,s(b))),b=i(.5,r(b,s(w))),g=c(t(u(S,w))),g>m&&++y>p)throw new Error("computing square root of matrix: iterative method could not converge")}while(g>m);return S}return e(JO,{"Array | Matrix":function(g){var y=ot(g)?g.size():_t(g);switch(y.length){case 1:if(y[0]===1)return a(g,o);throw new RangeError("Matrix must be square (size: "+Mt(y)+")");case 2:{var S=y[0],b=y[1];if(S===b)return h(g);throw new RangeError("Matrix must be square (size: "+Mt(y)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Mt(y)+")")}}})});var XO="sylvester",xQ=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],dw=T(XO,xQ,n=>{var{typed:e,schur:t,matrixFromColumns:r,matrix:i,multiply:a,range:o,concat:u,transpose:s,index:l,subset:c,add:f,subtract:p,identity:m,lusolve:h,abs:d}=n;return e(XO,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(S,b,w){return g(i(S),b,w)},"Array, Array, Matrix":function(S,b,w){return g(i(S),i(b),w)},"Array, Matrix, Array":function(S,b,w){return g(i(S),b,i(w))},"Matrix, Array, Matrix":function(S,b,w){return g(S,i(b),w)},"Matrix, Array, Array":function(S,b,w){return g(S,i(b),i(w))},"Matrix, Matrix, Array":function(S,b,w){return g(S,b,i(w))},"Array, Array, Array":function(S,b,w){return g(i(S),i(b),i(w)).toArray()}});function g(y,S,b){for(var w=S.size()[0],A=y.size()[0],x=t(y),D=x.T,E=x.U,_=t(a(-1,S)),N=_.T,P=_.U,B=a(a(s(E),b),P),V=o(0,A),z=[],L=(Ce,Ge)=>u(Ce,Ge,1),k=(Ce,Ge)=>u(Ce,Ge,0),C=0;C<w;C++)if(C<w-1&&d(c(N,l(C+1,C)))>1e-5){for(var W=k(c(B,l(V,C)),c(B,l(V,C+1))),O=0;O<C;O++)W=f(W,k(a(z[O],c(N,l(O,C))),a(z[O],c(N,l(O,C+1)))));var H=a(m(A),a(-1,c(N,l(C,C)))),Z=a(m(A),a(-1,c(N,l(C+1,C)))),Q=a(m(A),a(-1,c(N,l(C,C+1)))),U=a(m(A),a(-1,c(N,l(C+1,C+1)))),me=k(L(f(D,H),Z),L(Q,f(D,U))),De=h(me,W);z[C]=De.subset(l(o(0,A),0)),z[C+1]=De.subset(l(o(A,2*A),0)),C++}else{for(var pe=c(B,l(V,C)),_e=0;_e<C;_e++)pe=f(pe,a(z[_e],c(N,l(_e,C))));var Ne=c(N,l(C,C)),Se=p(D,a(Ne,m(A)));z[C]=h(Se,pe)}var Me=i(r(...z)),Ee=a(E,a(Me,s(P)));return Ee}});var QO="schur",wQ=["typed","matrix","identity","multiply","qr","norm","subtract"],hw=T(QO,wQ,n=>{var{typed:e,matrix:t,identity:r,multiply:i,qr:a,norm:o,subtract:u}=n;return e(QO,{Array:function(c){var f=s(t(c));return{U:f.U.valueOf(),T:f.T.valueOf()}},Matrix:function(c){return s(c)}});function s(l){var c=l.size()[0],f=l,p=r(c),m=0,h;do{h=f;var d=a(f),g=d.Q,y=d.R;if(f=i(y,g),p=i(p,g),m++>100)break}while(o(u(f,h))>1e-4);return{U:p,T:f}}});var KO="lyap",_Q=["typed","matrix","sylvester","multiply","transpose"],gw=T(KO,_Q,n=>{var{typed:e,matrix:t,sylvester:r,multiply:i,transpose:a}=n;return e(KO,{"Matrix, Matrix":function(u,s){return r(u,a(u),i(-1,s))},"Array, Matrix":function(u,s){return r(t(u),a(t(u)),i(-1,s))},"Matrix, Array":function(u,s){return r(u,a(t(u)),t(i(-1,s)))},"Array, Array":function(u,s){return r(t(u),a(t(u)),t(i(-1,s))).toArray()}})});var SQ="divide",AQ=["typed","matrix","multiply","equalScalar","divideScalar","inv"],vw=T(SQ,AQ,n=>{var{typed:e,matrix:t,multiply:r,equalScalar:i,divideScalar:a,inv:o}=n,u=xr({typed:e,equalScalar:i}),s=pn({typed:e});return e("divide",dm({"Array | Matrix, Array | Matrix":function(c,f){return r(c,o(f))},"DenseMatrix, any":function(c,f){return s(c,f,a,!1)},"SparseMatrix, any":function(c,f){return u(c,f,a,!1)},"Array, any":function(c,f){return s(t(c),f,a,!1).valueOf()},"any, Array | Matrix":function(c,f){return r(c,o(f))}},a.signatures))});var eR="distance",MQ=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],yw=T(eR,MQ,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:u,abs:s}=n;return e(eR,{"Array, Array, Array":function(A,x,D){if(A.length===2&&x.length===2&&D.length===2){if(!c(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(D))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(x,D))throw new TypeError("LinePoint1 should not be same with LinePoint2");var E=r(D[1],x[1]),_=r(x[0],D[0]),N=r(i(D[0],x[1]),i(x[0],D[1]));return g(A[0],A[1],E,_,N)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(A,x,D){if(Object.keys(A).length===2&&Object.keys(x).length===2&&Object.keys(D).length===2){if(!c(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(D))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(x),h(D)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in A&&"pointY"in A&&"lineOnePtX"in x&&"lineOnePtY"in x&&"lineTwoPtX"in D&&"lineTwoPtY"in D){var E=r(D.lineTwoPtY,x.lineOnePtY),_=r(x.lineOnePtX,D.lineTwoPtX),N=r(i(D.lineTwoPtX,x.lineOnePtY),i(x.lineOnePtX,D.lineTwoPtY));return g(A.pointX,A.pointY,E,_,N)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(A,x){if(A.length===2&&x.length===3){if(!c(A))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(A[0],A[1],x[0],x[1],x[2])}else if(A.length===3&&x.length===6){if(!f(A))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(x))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(A[0],A[1],A[2],x[0],x[1],x[2],x[3],x[4],x[5])}else if(A.length===x.length&&A.length>0){if(!p(A))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(x))throw new TypeError("All values of an array should be numbers or BigNumbers");return S(A,x)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(A,x){if(Object.keys(A).length===2&&Object.keys(x).length===3){if(!c(A))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"xCoeffLine"in x&&"yCoeffLine"in x&&"constant"in x)return g(A.pointX,A.pointY,x.xCoeffLine,x.yCoeffLine,x.constant);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(x).length===6){if(!f(A))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(x))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in A&&"pointY"in A&&"x0"in x&&"y0"in x&&"z0"in x&&"a"in x&&"b"in x&&"c"in x)return y(A.pointX,A.pointY,A.pointZ,x.x0,x.y0,x.z0,x.a,x.b,x.c);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===2&&Object.keys(x).length===2){if(!c(A))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(x))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointTwoX"in x&&"pointTwoY"in x)return S([A.pointOneX,A.pointOneY],[x.pointTwoX,x.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(A).length===3&&Object.keys(x).length===3){if(!f(A))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(x))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in A&&"pointOneY"in A&&"pointOneZ"in A&&"pointTwoX"in x&&"pointTwoY"in x&&"pointTwoZ"in x)return S([A.pointOneX,A.pointOneY,A.pointOneZ],[x.pointTwoX,x.pointTwoY,x.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(A){if(!d(A))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return b(A)}});function l(w){return typeof w=="number"||pt(w)}function c(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])}function f(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])&&l(w[2])}function p(w){return Array.isArray(w)||(w=h(w)),w.every(l)}function m(w){return w.constructor!==Array&&(w=h(w)),l(w[0])&&l(w[1])&&l(w[2])&&l(w[3])&&l(w[4])&&l(w[5])}function h(w){for(var A=Object.keys(w),x=[],D=0;D<A.length;D++)x.push(w[A[D]]);return x}function d(w){if(w[0].length===2&&l(w[0][0])&&l(w[0][1])){if(w.some(A=>A.length!==2||!l(A[0])||!l(A[1])))return!1}else if(w[0].length===3&&l(w[0][0])&&l(w[0][1])&&l(w[0][2])){if(w.some(A=>A.length!==3||!l(A[0])||!l(A[1])||!l(A[2])))return!1}else return!1;return!0}function g(w,A,x,D,E){var _=s(t(t(i(x,w),i(D,A)),E)),N=u(t(i(x,x),i(D,D)));return a(_,N)}function y(w,A,x,D,E,_,N,P,B){var V=[r(i(r(E,A),B),i(r(_,x),P)),r(i(r(_,x),N),i(r(D,w),B)),r(i(r(D,w),P),i(r(E,A),N))];V=u(t(t(i(V[0],V[0]),i(V[1],V[1])),i(V[2],V[2])));var z=u(t(t(i(N,N),i(P,P)),i(B,B)));return a(V,z)}function S(w,A){for(var x=w.length,D=0,E=0,_=0;_<x;_++)E=r(w[_],A[_]),D=t(i(E,E),D);return u(D)}function b(w){for(var A=[],x=[],D=[],E=0;E<w.length-1;E++)for(var _=E+1;_<w.length;_++)w[0].length===2?(x=[w[E][0],w[E][1]],D=[w[_][0],w[_][1]]):w[0].length===3&&(x=[w[E][0],w[E][1],w[E][2]],D=[w[_][0],w[_][1],w[_][2]]),A.push(S(x,D));return A}});var EQ="intersect",DQ=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],bw=T(EQ,DQ,n=>{var{typed:e,config:t,abs:r,add:i,addScalar:a,matrix:o,multiply:u,multiplyScalar:s,divideScalar:l,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=n;return e("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(P,B,V){var z=g(P.valueOf(),B.valueOf(),V.valueOf());return z===null?null:o(z)},"Matrix, Matrix, Matrix, Matrix":function(P,B,V,z){var L=y(P.valueOf(),B.valueOf(),V.valueOf(),z.valueOf());return L===null?null:o(L)}});function g(N,P,B){if(N=S(N),P=S(P),B=S(B),!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!A(B))throw new TypeError("Array with 4 numbers expected as third argument");return _(N[0],N[1],N[2],P[0],P[1],P[2],B[0],B[1],B[2],B[3])}function y(N,P,B,V){if(N=S(N),P=S(P),B=S(B),V=S(V),N.length===2){if(!b(N))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(P))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(B))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(V))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return x(N,P,B,V)}else if(N.length===3){if(!w(N))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!w(P))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!w(B))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!w(V))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return E(N[0],N[1],N[2],P[0],P[1],P[2],B[0],B[1],B[2],V[0],V[1],V[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function S(N){return N.length===1?N[0]:N.length>1&&Array.isArray(N[0])&&N.every(P=>Array.isArray(P)&&P.length===1)?m(N):N}function b(N){return N.length===2&&d(N[0])&&d(N[1])}function w(N){return N.length===3&&d(N[0])&&d(N[1])&&d(N[2])}function A(N){return N.length===4&&d(N[0])&&d(N[1])&&d(N[2])&&d(N[3])}function x(N,P,B,V){var z=N,L=B,k=c(z,P),C=c(L,V),W=c(s(k[0],C[1]),s(C[0],k[1]));if(h(W)||f(r(W),t.epsilon))return null;var O=s(C[0],z[1]),H=s(C[1],z[0]),Z=s(C[0],L[1]),Q=s(C[1],L[0]),U=l(a(c(c(O,H),Z),Q),W);return i(u(k,U),z)}function D(N,P,B,V,z,L,k,C,W,O,H,Z){var Q=s(c(N,P),c(B,V)),U=s(c(z,L),c(k,C)),me=s(c(W,O),c(H,Z));return a(a(Q,U),me)}function E(N,P,B,V,z,L,k,C,W,O,H,Z){var Q=D(N,k,O,k,P,C,H,C,B,W,Z,W),U=D(O,k,V,N,H,C,z,P,Z,W,L,B),me=D(N,k,V,N,P,C,z,P,B,W,L,B),De=D(O,k,O,k,H,C,H,C,Z,W,Z,W),pe=D(V,N,V,N,z,P,z,P,L,B,L,B),_e=c(s(Q,U),s(me,De)),Ne=c(s(pe,De),s(U,U));if(h(Ne))return null;var Se=l(_e,Ne),Me=l(a(Q,s(Se,U)),De),Ee=a(N,s(Se,c(V,N))),Ce=a(P,s(Se,c(z,P))),Ge=a(B,s(Se,c(L,B))),We=a(k,s(Me,c(O,k))),te=a(C,s(Me,c(H,C))),oe=a(W,s(Me,c(Z,W)));return p(Ee,We)&&p(Ce,te)&&p(Ge,oe)?[Ee,Ce,Ge]:null}function _(N,P,B,V,z,L,k,C,W,O){var H=s(N,k),Z=s(V,k),Q=s(P,C),U=s(z,C),me=s(B,W),De=s(L,W),pe=c(c(c(O,H),Q),me),_e=c(c(c(a(a(Z,U),De),H),Q),me),Ne=l(pe,_e),Se=a(N,s(Ne,c(V,N))),Me=a(P,s(Ne,c(z,P))),Ee=a(B,s(Ne,c(L,B)));return[Se,Me,Ee]}});var tR="sum",NQ=["typed","config","add","numeric"],Zc=T(tR,NQ,n=>{var{typed:e,config:t,add:r,numeric:i}=n;return e(tR,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":o,"...":function(s){if(la(s))throw new TypeError("Scalar values expected in function sum");return a(s)}});function a(u){var s;return ti(u,function(l){try{s=s===void 0?l:r(s,l)}catch(c){throw an(c,"sum",l)}}),s===void 0&&(s=i(0,t.number)),typeof s=="string"&&(s=i(s,t.number)),s}function o(u,s){try{var l=ps(u,s,r);return l}catch(c){throw an(c,"sum")}}});var yd="cumsum",TQ=["typed","add","unaryPlus"],Jc=T(yd,TQ,n=>{var{typed:e,add:t,unaryPlus:r}=n;return e(yd,{Array:i,Matrix:function(l){return l.create(i(l.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(l,c){return l.create(o(l.valueOf(),c))},"...":function(l){if(la(l))throw new TypeError("All values expected to be scalar in function cumsum");return i(l)}});function i(s){try{return a(s)}catch(l){throw an(l,yd)}}function a(s){if(s.length===0)return[];for(var l=[r(s[0])],c=1;c<s.length;++c)l.push(t(l[c-1],s[c]));return l}function o(s,l){var c=_t(s);if(l<0||l>=c.length)throw new $n(l,c.length);try{return u(s,l)}catch(f){throw an(f,yd)}}function u(s,l){var c,f,p;if(l<=0){var m=s[0][0];if(Array.isArray(m)){for(p=Im(s),f=[],c=0;c<p.length;c++)f[c]=u(p[c],l-1);return f}else return a(s)}else{for(f=[],c=0;c<s.length;c++)f[c]=u(s[c],l-1);return f}}});var rR="mean",CQ=["typed","add","divide"],Xc=T(rR,CQ,n=>{var{typed:e,add:t,divide:r}=n;return e(rR,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":i,"...":function(u){if(la(u))throw new TypeError("Scalar values expected in function mean");return a(u)}});function i(o,u){try{var s=ps(o,u,t),l=Array.isArray(o)?_t(o):o.size();return r(s,l[u])}catch(c){throw an(c,"mean")}}function a(o){var u,s=0;if(ti(o,function(l){try{u=u===void 0?l:t(u,l),s++}catch(c){throw an(c,"mean",l)}}),s===0)throw new Error("Cannot calculate the mean of an empty array");return r(u,s)}});var nR="median",FQ=["typed","add","divide","compare","partitionSelect"],xw=T(nR,FQ,n=>{var{typed:e,add:t,divide:r,compare:i,partitionSelect:a}=n;function o(l){try{l=kt(l.valueOf());var c=l.length;if(c===0)throw new Error("Cannot calculate median of an empty array");if(c%2===0){for(var f=c/2-1,p=a(l,f+1),m=l[f],h=0;h<f;++h)i(l[h],m)>0&&(m=l[h]);return s(m,p)}else{var d=a(l,(c-1)/2);return u(d)}}catch(g){throw an(g,"median")}}var u=e({"number | BigNumber | Complex | Unit":function(c){return c}}),s=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(c,f){return r(t(c,f),2)}});return e(nR,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(c,f){throw new Error("median(A, dim) is not yet supported")},"...":function(c){if(la(c))throw new TypeError("Scalar values expected in function median");return o(c)}})});var iR="mad",IQ=["typed","abs","map","median","subtract"],ww=T(iR,IQ,n=>{var{typed:e,abs:t,map:r,median:i,subtract:a}=n;return e(iR,{"Array | Matrix":o,"...":function(s){return o(s)}});function o(u){if(u=kt(u.valueOf()),u.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var s=i(u);return i(r(u,function(l){return t(a(l,s))}))}catch(l){throw l instanceof TypeError&&l.message.indexOf("median")!==-1?new TypeError(l.message.replace("median","mad")):an(l,"mad")}}});var _w="unbiased",aR="variance",PQ=["typed","add","subtract","multiply","divide","apply","isNaN"],Qc=T(aR,PQ,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u}=n;return e(aR,{"Array | Matrix":function(f){return s(f,_w)},"Array | Matrix, string":s,"Array | Matrix, number | BigNumber":function(f,p){return l(f,p,_w)},"Array | Matrix, number | BigNumber, string":l,"...":function(f){return s(f,_w)}});function s(c,f){var p,m=0;if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ti(c,function(g){try{p=p===void 0?g:t(p,g),m++}catch(y){throw an(y,"variance",g)}}),m===0)throw new Error("Cannot calculate variance of an empty array");var h=a(p,m);if(p=void 0,ti(c,function(g){var y=r(g,h);p=p===void 0?i(y,y):t(p,i(y,y))}),u(p))return p;switch(f){case"uncorrected":return a(p,m);case"biased":return a(p,m+1);case"unbiased":{var d=pt(p)?p.mul(0):0;return m===1?d:a(p,m-1)}default:throw new Error('Unknown normalization "'+f+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function l(c,f,p){try{if(c.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return o(c,f,m=>s(m,p))}catch(m){throw an(m,"variance")}}});var oR="quantileSeq",kQ=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Kc=T(oR,kQ,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p}=n,m=iu({typed:e,isInteger:l});return e(oR,{"Array | Matrix, number | BigNumber":(S,b)=>d(S,b,!1),"Array | Matrix, number | BigNumber, number":(S,b,w)=>h(S,b,!1,w,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(S,b,w,A)=>h(S,b,w,A,d),"Array | Matrix, Array | Matrix":(S,b)=>g(S,b,!1),"Array | Matrix, Array | Matrix, number":(S,b,w)=>h(S,b,!1,w,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(S,b,w,A)=>h(S,b,w,A,g)});function h(S,b,w,A,x){return m(S,A,D=>x(D,b,w))}function d(S,b,w){var A,x=S.valueOf();if(c(b,0))throw new Error("N/prob must be non-negative");if(f(b,1))return At(b)?y(x,b,w):t(y(x,b,w));if(p(b,1)){if(!l(b))throw new Error("N must be a positive integer");if(p(b,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var D=r(b,1);A=[];for(var E=0;c(E,b);E++){var _=a(E+1,D);A.push(y(x,_,w))}return At(b)?A:t(A)}}function g(S,b,w){for(var A=S.valueOf(),x=b.valueOf(),D=[],E=0;E<x.length;++E)D.push(y(A,x[E],w));return D}function y(S,b,w){var A=kt(S),x=A.length;if(x===0)throw new Error("Cannot calculate quantile of an empty sequence");var D=At(b)?b*(x-1):b.times(x-1),E=At(b)?Math.floor(D):D.floor().toNumber(),_=At(b)?D%1:D.minus(E);if(l(D))return w?A[D]:u(A,At(b)?D:D.valueOf());var N,P;if(w)N=A[E],P=A[E+1];else{P=u(A,E+1),N=A[E];for(var B=0;B<E;++B)s(A[B],N)>0&&(N=A[B])}return r(o(N,i(1,_)),o(P,_))}});var sR="std",BQ=["typed","map","sqrt","variance"],ef=T(sR,BQ,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n;return e(sR,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(u){return a(u)}});function a(o,u){if(o.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var s=i.apply(null,arguments);return ln(s)?t(s,r):r(s)}catch(l){throw l instanceof TypeError&&l.message.indexOf(" variance")!==-1?new TypeError(l.message.replace(" variance"," std")):l}}});var uR="corr",OQ=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],Sw=T(uR,OQ,n=>{var{typed:e,matrix:t,sqrt:r,sum:i,add:a,subtract:o,multiply:u,pow:s,divide:l}=n;return e(uR,{"Array, Array":function(m,h){return c(m,h)},"Matrix, Matrix":function(m,h){var d=c(m.toArray(),h.toArray());return Array.isArray(d)?t(d):d}});function c(p,m){var h=[];if(Array.isArray(p[0])&&Array.isArray(m[0])){if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var d=0;d<p.length;d++){if(p[d].length!==m[d].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");h.push(f(p[d],m[d]))}return h}else{if(p.length!==m.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(p,m)}}function f(p,m){var h=p.length,d=i(p),g=i(m),y=p.reduce((x,D,E)=>a(x,u(D,m[E])),0),S=i(p.map(x=>s(x,2))),b=i(m.map(x=>s(x,2))),w=o(u(h,y),u(d,g)),A=r(u(o(u(h,S),s(d,2)),o(u(h,b),s(g,2))));return l(w,A)}});var lR="combinations",RQ=["typed"],Aw=T(lR,RQ,n=>{var{typed:e}=n;return e(lR,{"number, number":qy,"BigNumber, BigNumber":function(r,i){var a=r.constructor,o,u,s=r.minus(i),l=new a(1);if(!cR(r)||!cR(i))throw new TypeError("Positive integer value expected in function combinations");if(i.gt(r))throw new TypeError("k must be less than n in function combinations");if(o=l,i.lt(s))for(u=l;u.lte(s);u=u.plus(l))o=o.times(i.plus(u)).dividedBy(u);else for(u=l;u.lte(i);u=u.plus(l))o=o.times(s.plus(u)).dividedBy(u);return o}})});function cR(n){return n.isInteger()&&n.gte(0)}var fR="combinationsWithRep",LQ=["typed"],Mw=T(fR,LQ,n=>{var{typed:e}=n;return e(fR,{"number, number":function(r,i){if(!nt(r)||r<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!nt(i)||i<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(r<1)throw new TypeError("k must be less than or equal to n + k - 1");if(i<r-1){var a=Hi(r,r+i-1);return a/Hi(1,i)}var o=Hi(i+1,r+i-1);return o/Hi(1,r-1)},"BigNumber, BigNumber":function(r,i){var a=r.constructor,o,u,s=new a(1),l=r.minus(s);if(!pR(r)||!pR(i))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(r.lt(s))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(o=s,i.lt(l))for(u=s;u.lte(l);u=u.plus(s))o=o.times(i.plus(u)).dividedBy(u);else for(u=s;u.lte(i);u=u.plus(s))o=o.times(l.plus(u)).dividedBy(u);return o}})});function pR(n){return n.isInteger()&&n.gte(0)}var mR="gamma",VQ=["typed","config","multiplyScalar","pow","BigNumber","Complex"],Ew=T(mR,VQ,n=>{var{typed:e,config:t,multiplyScalar:r,pow:i,BigNumber:a,Complex:o}=n;function u(l){if(l.im===0)return Nc(l.re);if(l.re<.5){var c=new o(1-l.re,-l.im),f=new o(Math.PI*l.re,Math.PI*l.im);return new o(Math.PI).div(f.sin()).div(u(c))}l=new o(l.re-1,l.im);for(var p=new o(nu[0],0),m=1;m<nu.length;++m){var h=new o(nu[m],0);p=p.add(h.div(l.add(m)))}var d=new o(l.re+Yy+.5,l.im),g=Math.sqrt(2*Math.PI),y=d.pow(l.add(.5)),S=d.neg().exp();return p.mul(g).mul(y).mul(S)}return e(mR,{number:Nc,Complex:u,BigNumber:function(c){if(c.isInteger())return c.isNegative()||c.isZero()?new a(1/0):s(c.minus(1));if(!c.isFinite())return new a(c.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(l){if(l<8)return new a([1,1,2,6,24,120,720,5040][l]);var c=t.precision+(Math.log(l.toNumber())|0),f=a.clone({precision:c});if(l%2===1)return l.times(s(new a(l-1)));for(var p=l,m=new f(l),h=l.toNumber();p>2;)p-=2,h+=p,m=m.times(h);return new a(m.toPrecision(a.precision))}});var dR="lgamma",UQ=["Complex","typed"],Dw=T(dR,UQ,n=>{var{Complex:e,typed:t}=n,r=7,i=7,a=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t(dR,{number:Tc,Complex:o,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function o(l){var c=6.283185307179586,f=1.1447298858494002,p=.1;if(l.isNaN())return new e(NaN,NaN);if(l.im===0)return new e(Tc(l.re),0);if(l.re>=r||Math.abs(l.im)>=i)return u(l);if(l.re<=p){var m=GN(c,l.im)*Math.floor(.5*l.re+.25),h=l.mul(Math.PI).sin().log(),d=o(new e(1-l.re,-l.im));return new e(f,m).sub(h).sub(d)}else return l.im>=0?s(l):s(l.conjugate()).conjugate()}function u(l){for(var c=l.sub(.5).mul(l.log()).sub(l).add(jy),f=new e(1,0).div(l),p=f.div(l),m=a[0],h=a[1],d=2*p.re,g=p.re*p.re+p.im*p.im,y=2;y<8;y++){var S=h;h=-g*m+a[y],m=d*m+S}var b=f.mul(p.mul(m).add(h));return c.add(b)}function s(l){var c=0,f=0,p=l;for(l=l.add(1);l.re<=r;){p=p.mul(l);var m=p.im<0?1:0;m!==0&&f===0&&c++,f=m,l=l.add(1)}return u(l).sub(p.log()).sub(new e(0,c*2*Math.PI*1))}});var hR="factorial",qQ=["typed","gamma"],Nw=T(hR,qQ,n=>{var{typed:e,gamma:t}=n;return e(hR,{number:function(i){if(i<0)throw new Error("Value must be non-negative");return t(i+1)},BigNumber:function(i){if(i.isNegative())throw new Error("Value must be non-negative");return t(i.plus(1))},"Array | Matrix":e.referToSelf(r=>i=>lt(i,r))})});var gR="kldivergence",zQ=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],Tw=T(gR,zQ,n=>{var{typed:e,matrix:t,divide:r,sum:i,multiply:a,map:o,dotDivide:u,log:s,isNumeric:l}=n;return e(gR,{"Array, Array":function(p,m){return c(t(p),t(m))},"Matrix, Array":function(p,m){return c(p,t(m))},"Array, Matrix":function(p,m){return c(t(p),m)},"Matrix, Matrix":function(p,m){return c(p,m)}});function c(f,p){var m=p.size().length,h=f.size().length;if(m>1)throw new Error("first object must be one dimensional");if(h>1)throw new Error("second object must be one dimensional");if(m!==h)throw new Error("Length of two vectors must be equal");var d=i(f);if(d===0)throw new Error("Sum of elements in first object must be non zero");var g=i(p);if(g===0)throw new Error("Sum of elements in second object must be non zero");var y=r(f,i(f)),S=r(p,i(p)),b=i(a(y,o(u(y,S),w=>s(w))));return l(b)?b:Number.NaN}});var vR="multinomial",$Q=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Cw=T(vR,$Q,n=>{var{typed:e,add:t,divide:r,multiply:i,factorial:a,isInteger:o,isPositive:u}=n;return e(vR,{"Array | Matrix":function(l){var c=0,f=1;return ti(l,function(p){if(!o(p)||!u(p))throw new TypeError("Positive integer value expected in function multinomial");c=t(c,p),f=i(f,a(p))}),r(a(c),f)}})});var yR="permutations",HQ=["typed","factorial"],Fw=T(yR,HQ,n=>{var{typed:e,factorial:t}=n;return e(yR,{"number | BigNumber":t,"number, number":function(i,a){if(!nt(i)||i<0)throw new TypeError("Positive integer value expected in function permutations");if(!nt(a)||a<0)throw new TypeError("Positive integer value expected in function permutations");if(a>i)throw new TypeError("second argument k must be less than or equal to first argument n");return Hi(i-a+1,i)},"BigNumber, BigNumber":function(i,a){var o,u;if(!bR(i)||!bR(a))throw new TypeError("Positive integer value expected in function permutations");if(a.gt(i))throw new TypeError("second argument k must be less than or equal to first argument n");var s=i.mul(0).add(1);for(o=s,u=i.minus(a).plus(1);u.lte(i);u=u.plus(1))o=o.times(u);return o}})});function bR(n){return n.isInteger()&&n.gte(0)}var Lw=wr(BR(),1),XQ=(0,Lw.default)(Date.now());function Fo(n){var e;function t(i){e=i===null?XQ:(0,Lw.default)(String(i))}t(n);function r(){return e()}return r}var OR="pickRandom",QQ=["typed","config","?on"],Vw=T(OR,QQ,n=>{var{typed:e,config:t,on:r}=n,i=Fo(t.randomSeed);return r&&r("config",function(o,u){o.randomSeed!==u.randomSeed&&(i=Fo(o.randomSeed))}),e(OR,{"Array | Matrix":function(u){return a(u,{})},"Array | Matrix, Object":function(u,s){return a(u,s)},"Array | Matrix, number":function(u,s){return a(u,{number:s})},"Array | Matrix, Array | Matrix":function(u,s){return a(u,{weights:s})},"Array | Matrix, Array | Matrix, number":function(u,s,l){return a(u,{number:l,weights:s})},"Array | Matrix, number, Array | Matrix":function(u,s,l){return a(u,{number:s,weights:l})}});function a(o,u){var{number:s,weights:l,elementWise:c=!0}=u,f=typeof s>"u";f&&(s=1);var p=ot(o)?o.create:ot(l)?l.create:null;o=o.valueOf(),l&&(l=l.valueOf()),c===!0&&(o=kt(o),l=kt(l));var m=0;if(typeof l<"u"){if(l.length!==o.length)throw new Error("Weights must have the same length as possibles");for(var h=0,d=l.length;h<d;h++){if(!At(l[h])||l[h]<0)throw new Error("Weights must be an array of positive numbers");m+=l[h]}}for(var g=o.length,y=[],S;y.length<s;){if(typeof l>"u")S=o[Math.floor(i()*g)];else for(var b=i()*m,w=0,A=o.length;w<A;w++)if(b-=l[w],b<0){S=o[w];break}y.push(S)}return f?y[0]:p?p(y):y}});function tf(n,e){var t=[];if(n=n.slice(0),n.length>1)for(var r=0,i=n.shift();r<i;r++)t.push(tf(n,e));else for(var a=0,o=n.shift();a<o;a++)t.push(e());return t}var RR="random",KQ=["typed","config","?on"],Uw=T(RR,KQ,n=>{var{typed:e,config:t,on:r}=n,i=Fo(t.randomSeed);return r&&r("config",function(u,s){u.randomSeed!==s.randomSeed&&(i=Fo(u.randomSeed))}),e(RR,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,s)=>o(u,s),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,s)=>a(u,0,s),"Array | Matrix, number, number":(u,s,l)=>a(u,s,l)});function a(u,s,l){var c=tf(u.valueOf(),()=>o(s,l));return ot(u)?u.create(c):c}function o(u,s){return u+i()*(s-u)}});var LR="randomInt",eK=["typed","config","?on"],qw=T(LR,eK,n=>{var{typed:e,config:t,on:r}=n,i=Fo(t.randomSeed);return r&&r("config",function(u,s){u.randomSeed!==s.randomSeed&&(i=Fo(u.randomSeed))}),e(LR,{"":()=>o(0,1),number:u=>o(0,u),"number, number":(u,s)=>o(u,s),"Array | Matrix":u=>a(u,0,1),"Array | Matrix, number":(u,s)=>a(u,0,s),"Array | Matrix, number, number":(u,s,l)=>a(u,s,l)});function a(u,s,l){var c=tf(u.valueOf(),()=>o(s,l));return ot(u)?u.create(c):c}function o(u,s){return Math.floor(u+i()*(s-u))}});var VR="stirlingS2",tK=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],zw=T(VR,tK,n=>{var{typed:e,addScalar:t,subtractScalar:r,multiplyScalar:i,divideScalar:a,pow:o,factorial:u,combinations:s,isNegative:l,isInteger:c,number:f,bignumber:p,larger:m}=n,h=[],d=[];return e(VR,{"number | BigNumber, number | BigNumber":function(y,S){if(!c(y)||l(y)||!c(S)||l(S))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(S,y))throw new TypeError("k must be less than or equal to n in function stirlingS2");var b=!(At(y)&&At(S)),w=b?d:h,A=b?p:f,x=f(y),D=f(S);if(w[x]&&w[x].length>D)return w[x][D];for(var E=0;E<=x;++E)if(w[E]||(w[E]=[A(E===0?1:0)]),E!==0)for(var _=w[E],N=w[E-1],P=_.length;P<=E&&P<=D;++P)P===E?_[P]=1:_[P]=t(i(A(P),N[P]),N[P-1]);return w[x][D]}})});var UR="bellNumbers",rK=["typed","addScalar","isNegative","isInteger","stirlingS2"],$w=T(UR,rK,n=>{var{typed:e,addScalar:t,isNegative:r,isInteger:i,stirlingS2:a}=n;return e(UR,{"number | BigNumber":function(u){if(!i(u)||r(u))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var s=0,l=0;l<=u;l++)s=t(s,a(u,l));return s}})});var qR="catalan",nK=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],Hw=T(qR,nK,n=>{var{typed:e,addScalar:t,divideScalar:r,multiplyScalar:i,combinations:a,isNegative:o,isInteger:u}=n;return e(qR,{"number | BigNumber":function(l){if(!u(l)||o(l))throw new TypeError("Non-negative integer value expected in function catalan");return r(a(i(l,2),l),t(l,1))}})});var zR="composition",iK=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],Gw=T(zR,iK,n=>{var{typed:e,addScalar:t,combinations:r,isPositive:i,isNegative:a,isInteger:o,larger:u}=n;return e(zR,{"number | BigNumber, number | BigNumber":function(l,c){if(!o(l)||!i(l)||!o(c)||!i(c))throw new TypeError("Positive integer value expected in function composition");if(u(c,l))throw new TypeError("k must be less than or equal to n in function composition");return r(t(l,-1),t(c,-1))}})});var $R="leafCount",aK=["parse","typed"],Ww=T($R,aK,n=>{var{parse:e,typed:t}=n;function r(i){var a=0;return i.forEach(o=>{a+=r(o)}),a||1}return t($R,{Node:function(a){return r(a)}})});function Yw(n){return zt(n)||Vr(n)&&n.isUnary()&&zt(n.args[0])}function rf(n){return!!(zt(n)||(vi(n)||Vr(n))&&n.args.every(rf)||zn(n)&&rf(n.content))}function HR(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jw(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?HR(Object(t),!0).forEach(function(r){fr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):HR(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var oK="simplifyUtil",sK=["FunctionNode","OperatorNode","SymbolNode"],Al=T(oK,sK,n=>{var{FunctionNode:e,OperatorNode:t,SymbolNode:r}=n,i=!0,a=!1,o="defaultF",u={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}},s={divide:{total:a},log:{total:a}},l={subtract:{total:a},abs:{trivial:i},log:{total:i}};function c(b,w){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,x=o;if(typeof b=="string"?x=b:Vr(b)?x=b.fn.toString():vi(b)?x=b.name:zn(b)&&(x="paren"),ut(A,x)){var D=A[x];if(ut(D,w))return D[w];if(ut(u,x))return u[x][w]}if(ut(A,o)){var E=A[o];return ut(E,w)?E[w]:u[o][w]}if(ut(u,x)){var _=u[x];if(ut(_,w))return _[w]}return u[o][w]}function f(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return c(b,"commutative",w)}function p(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;return c(b,"associative",w)}function m(b,w){var A=jw({},b);for(var x in w)ut(b,x)?A[x]=jw(jw({},w[x]),b[x]):A[x]=w[x];return A}function h(b,w){if(!b.args||b.args.length===0)return b;b.args=d(b,w);for(var A=0;A<b.args.length;A++)h(b.args[A],w)}function d(b,w){var A,x=[],D=function E(_){for(var N=0;N<_.args.length;N++){var P=_.args[N];Vr(P)&&A===P.op?E(P):x.push(P)}};return p(b,w)?(A=b.op,D(b),x):b.args}function g(b,w){if(!(!b.args||b.args.length===0)){for(var A=S(b),x=b.args.length,D=0;D<x;D++)g(b.args[D],w);if(x>2&&p(b,w)){for(var E=b.args.pop();b.args.length>0;)E=A([b.args.pop(),E]);b.args=E.args}}}function y(b,w){if(!(!b.args||b.args.length===0)){for(var A=S(b),x=b.args.length,D=0;D<x;D++)y(b.args[D],w);if(x>2&&p(b,w)){for(var E=b.args.shift();b.args.length>0;)E=A([E,b.args.shift()]);b.args=E.args}}}function S(b){return Vr(b)?function(w){try{return new t(b.op,b.fn,w,b.implicit)}catch(A){return console.error(A),[]}}:function(w){return new e(new r(b.name),w)}}return{createMakeNodeFunction:S,hasProperty:c,isCommutative:f,isAssociative:p,mergeContext:m,flatten:h,allChildren:d,unflattenr:g,unflattenl:y,defaultContext:u,realContext:s,positiveContext:l}});var uK="simplify",lK=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Zw=T(uK,lK,n=>{var{config:e,typed:t,parse:r,add:i,subtract:a,multiply:o,divide:u,pow:s,isZero:l,equal:c,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:S,ArrayNode:b,ConstantNode:w,FunctionNode:A,IndexNode:x,ObjectNode:D,OperatorNode:E,ParenthesisNode:_,SymbolNode:N}=n,{hasProperty:P,isCommutative:B,isAssociative:V,mergeContext:z,flatten:L,unflattenr:k,unflattenl:C,createMakeNodeFunction:W,defaultContext:O,realContext:H,positiveContext:Z}=Al({FunctionNode:A,OperatorNode:E,SymbolNode:N});t.addConversion({from:"Object",to:"Map",convert:Eo});var Q=t("simplify",{Node:Se,"Node, Map":(ie,re)=>Se(ie,!1,re),"Node, Map, Object":(ie,re,le)=>Se(ie,!1,re,le),"Node, Array":Se,"Node, Array, Map":Se,"Node, Array, Map, Object":Se});t.removeConversion({from:"Object",to:"Map",convert:Eo}),Q.defaultContext=O,Q.realContext=H,Q.positiveContext=Z;function U(ie){return ie.transform(function(re,le,Te){return zn(re)?U(re.content):re})}var me={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};Q.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd   * ( vd   * n1 + n2)",r:"vd^2       * n1 +  vd   * n2"},{s:" vd   * (vd^n4 * n1 + n2)   ->  vd^(1+n4)  * n1 +  vd   * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd   * n1 + n2)   ->  vd^(n3+1)  * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2)   ->  vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 +   n3  * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3    -> (n1 + n2*n3^(n4 +  1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},p,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function De(ie,re){var le={};if(ie.s){var Te=ie.s.split("->");if(Te.length===2)le.l=Te[0],le.r=Te[1];else throw SyntaxError("Could not parse rule: "+ie.s)}else le.l=ie.l,le.r=ie.r;le.l=U(r(le.l)),le.r=U(r(le.r));for(var Ie of["imposeContext","repeat","assuming"])Ie in ie&&(le[Ie]=ie[Ie]);if(ie.evaluate&&(le.evaluate=r(ie.evaluate)),V(le.l,re)){var Ze=!B(le.l,re),xe;Ze&&(xe=Ne());var ht=W(le.l),Nt=Ne();le.expanded={},le.expanded.l=ht([le.l,Nt]),L(le.expanded.l,re),k(le.expanded.l,re),le.expanded.r=ht([le.r,Nt]),Ze&&(le.expandedNC1={},le.expandedNC1.l=ht([xe,le.l]),le.expandedNC1.r=ht([xe,le.r]),le.expandedNC2={},le.expandedNC2.l=ht([xe,le.expanded.l]),le.expandedNC2.r=ht([xe,le.expanded.r]))}return le}function pe(ie,re){for(var le=[],Te=0;Te<ie.length;Te++){var Ie=ie[Te],Ze=void 0,xe=typeof Ie;switch(xe){case"string":Ie={s:Ie};case"object":Ze=De(Ie,re);break;case"function":Ze=Ie;break;default:throw TypeError("Unsupported type of rule: "+xe)}le.push(Ze)}return le}var _e=0;function Ne(){return new N("_p"+_e++)}function Se(ie,re){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ss(),Te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ie=Te.consoleDebug;re=pe(re||Q.rules,Te.context);var Ze=f(ie,le);Ze=U(Ze);for(var xe={},ht=Ze.toString({parenthesis:"all"});!xe[ht];){xe[ht]=!0,_e=0;var Nt=ht;Ie&&console.log("Working on: ",ht);for(var Ht=0;Ht<re.length;Ht++){var Et="";if(typeof re[Ht]=="function"?(Ze=re[Ht](Ze,Te),Ie&&(Et=re[Ht].name)):(L(Ze,Te.context),Ze=Ee(Ze,re[Ht],Te.context),Ie&&(Et="".concat(re[Ht].l.toString()," -> ").concat(re[Ht].r.toString()))),Ie){var ae=Ze.toString({parenthesis:"all"});ae!==Nt&&(console.log("Applying",Et,"produced",ae),Nt=ae)}C(Ze,Te.context)}ht=Ze.toString({parenthesis:"all"})}return Ze}function Me(ie,re,le){var Te=ie;if(ie)for(var Ie=0;Ie<ie.length;++Ie){var Ze=Ee(ie[Ie],re,le);Ze!==ie[Ie]&&(Te===ie&&(Te=ie.slice()),Te[Ie]=Ze)}return Te}function Ee(ie,re,le){if(re.assuming){for(var Te in re.assuming)for(var Ie in re.assuming[Te])if(P(Te,Ie,le)!==re.assuming[Te][Ie])return ie}var Ze=z(re.imposeContext,le),xe=ie;if(xe instanceof E||xe instanceof A){var ht=Me(xe.args,re,le);ht!==xe.args&&(xe=xe.clone(),xe.args=ht)}else if(xe instanceof _){if(xe.content){var Nt=Ee(xe.content,re,le);Nt!==xe.content&&(xe=new _(Nt))}}else if(xe instanceof b){var Ht=Me(xe.items,re,le);Ht!==xe.items&&(xe=new b(Ht))}else if(xe instanceof S){var Et=xe.object;xe.object&&(Et=Ee(xe.object,re,le));var ae=xe.index;xe.index&&(ae=Ee(xe.index,re,le)),(Et!==xe.object||ae!==xe.index)&&(xe=new S(Et,ae))}else if(xe instanceof x){var de=Me(xe.dimensions,re,le);de!==xe.dimensions&&(xe=new x(de))}else if(xe instanceof D){var ge=!1,qe={};for(var $e in xe.properties)qe[$e]=Ee(xe.properties[$e],re,le),qe[$e]!==xe.properties[$e]&&(ge=!0);ge&&(xe=new D(qe))}var Re=re.r,ze=oe(re.l,xe,Ze)[0];if(!ze&&re.expanded&&(Re=re.expanded.r,ze=oe(re.expanded.l,xe,Ze)[0]),!ze&&re.expandedNC1&&(Re=re.expandedNC1.r,ze=oe(re.expandedNC1.l,xe,Ze)[0],ze||(Re=re.expandedNC2.r,ze=oe(re.expandedNC2.l,xe,Ze)[0])),ze){var Xe=xe.implicit;xe=Re.clone(),Xe&&"implicit"in Re&&(xe.implicit=!0),xe=xe.transform(function(F){return F.isSymbolNode&&ut(ze.placeholders,F.name)?ze.placeholders[F.name].clone():F})}return re.repeat&&xe!==ie&&(xe=Ee(xe,re,le)),xe}function Ce(ie,re){var le=[],Te,Ie,Ze=W(ie);if(B(ie,re))for(var xe=0;xe<ie.args.length;xe++)Ie=ie.args.slice(0),Ie.splice(xe,1),Te=Ie.length===1?Ie[0]:Ze(Ie),le.push(Ze([ie.args[xe],Te]));else for(var ht=1;ht<ie.args.length;ht++){var Nt=ie.args[0];ht>1&&(Nt=Ze(ie.args.slice(0,ht))),Ie=ie.args.slice(ht),Te=Ie.length===1?Ie[0]:Ze(Ie),le.push(Ze([Nt,Te]))}return le}function Ge(ie,re){var le={placeholders:{}};if(!ie.placeholders&&!re.placeholders)return le;if(ie.placeholders){if(!re.placeholders)return ie}else return re;for(var Te in ie.placeholders)if(ut(ie.placeholders,Te)&&(le.placeholders[Te]=ie.placeholders[Te],ut(re.placeholders,Te)&&!he(ie.placeholders[Te],re.placeholders[Te])))return null;for(var Ie in re.placeholders)ut(re.placeholders,Ie)&&(le.placeholders[Ie]=re.placeholders[Ie]);return le}function We(ie,re){var le=[];if(ie.length===0||re.length===0)return le;for(var Te,Ie=0;Ie<ie.length;Ie++)for(var Ze=0;Ze<re.length;Ze++)Te=Ge(ie[Ie],re[Ze]),Te&&le.push(Te);return le}function te(ie){if(ie.length===0)return ie;for(var re=ie.reduce(We),le=[],Te={},Ie=0;Ie<re.length;Ie++){var Ze=JSON.stringify(re[Ie]);Te[Ze]||(Te[Ze]=!0,le.push(re[Ie]))}return le}function oe(ie,re,le,Te){var Ie=[{placeholders:{}}];if(ie instanceof E&&re instanceof E||ie instanceof A&&re instanceof A){if(ie instanceof E){if(ie.op!==re.op||ie.fn!==re.fn)return[]}else if(ie instanceof A&&ie.name!==re.name)return[];if(re.args.length===1&&ie.args.length===1||!V(re,le)&&re.args.length===ie.args.length||Te){for(var Ze=[],xe=0;xe<ie.args.length;xe++){var ht=oe(ie.args[xe],re.args[xe],le);if(ht.length===0)break;Ze.push(ht)}if(Ze.length!==ie.args.length){if(!B(re,le)||ie.args.length===1)return[];if(ie.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var Nt=oe(ie.args[0],re.args[1],le);if(Nt.length===0)return[];var Ht=oe(ie.args[1],re.args[0],le);if(Ht.length===0)return[];Ze=[Nt,Ht]}Ie=te(Ze)}else if(re.args.length>=2&&ie.args.length===2){for(var Et=Ce(re,le),ae=[],de=0;de<Et.length;de++){var ge=oe(ie,Et[de],le,!0);ae=ae.concat(ge)}return ae}else{if(ie.args.length>2)throw Error("Unexpected non-binary associative function: "+ie.toString());return[]}}else if(ie instanceof N){if(ie.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(me[ie.name]){if(ie.name!==re.name)return[]}else switch(ie.name[1]>="a"&&ie.name[1]<="z"?ie.name.substring(0,2):ie.name[0]){case"n":case"_p":Ie[0].placeholders[ie.name]=re;break;case"c":case"cl":if(zt(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"v":if(!zt(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"vl":if(Fr(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"cd":if(Yw(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"vd":if(!Yw(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"ce":if(rf(re))Ie[0].placeholders[ie.name]=re;else return[];break;case"ve":if(!rf(re))Ie[0].placeholders[ie.name]=re;else return[];break;default:throw new Error("Invalid symbol in rule: "+ie.name)}}else if(ie instanceof w){if(!c(ie.value,re.value))return[]}else return[];return Ie}function he(ie,re){if(ie instanceof w&&re instanceof w){if(!c(ie.value,re.value))return!1}else if(ie instanceof N&&re instanceof N){if(ie.name!==re.name)return!1}else if(ie instanceof E&&re instanceof E||ie instanceof A&&re instanceof A){if(ie instanceof E){if(ie.op!==re.op||ie.fn!==re.fn)return!1}else if(ie instanceof A&&ie.name!==re.name)return!1;if(ie.args.length!==re.args.length)return!1;for(var le=0;le<ie.args.length;le++)if(!he(ie.args[le],re.args[le]))return!1}else return!1;return!0}return Q});var cK="simplifyConstant",fK=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],Jw=T(cK,fK,n=>{var{typed:e,config:t,mathWithTransform:r,matrix:i,fraction:a,bignumber:o,AccessorNode:u,ArrayNode:s,ConstantNode:l,FunctionNode:c,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=n,{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:S}=Al({FunctionNode:c,OperatorNode:m,SymbolNode:h}),b=e("simplifyConstant",{Node:L=>D(z(L,{})),"Node, Object":function(k,C){return D(z(k,C))}});function w(L){return Ao(L)?L.valueOf():L instanceof Array?L.map(w):ot(L)?i(w(L.valueOf())):L}function A(L,k,C){try{return r[L].apply(null,k)}catch{return k=k.map(w),_(r[L].apply(null,k),C)}}var x=e({Fraction:P,number:function(k){return k<0?N(new l(-k)):new l(k)},BigNumber:function(k){return k<0?N(new l(-k)):new l(k)},Complex:function(k){throw new Error("Cannot convert Complex number to Node")},string:function(k){return new l(k)},Matrix:function(k){return new s(k.valueOf().map(C=>x(C)))}});function D(L){return jt(L)?L:x(L)}function E(L,k){var C=k&&k.exactFractions!==!1;if(C&&isFinite(L)&&a){var W=a(L),O=k&&typeof k.fractionsLimit=="number"?k.fractionsLimit:1/0;if(W.valueOf()===L&&W.n<O&&W.d<O)return W}return L}var _=e({"string, Object":function(k,C){if(t.number==="BigNumber")return o===void 0&&yl(),o(k);if(t.number==="Fraction")return a===void 0&&Vm(),a(k);var W=parseFloat(k);return E(W,C)},"Fraction, Object":function(k,C){return k},"BigNumber, Object":function(k,C){return k},"number, Object":function(k,C){return E(k,C)},"Complex, Object":function(k,C){return k.im!==0?k:E(k.re,C)},"Matrix, Object":function(k,C){return i(E(k.valueOf()))},"Array, Object":function(k,C){return k.map(E)}});function N(L){return new m("-","unaryMinus",[L])}function P(L){var k,C=L.s*L.n;return C<0?k=new m("-","unaryMinus",[new l(-C)]):k=new l(C),L.d===1?k:new m("/","divide",[k,new l(L.d)])}function B(L,k,C){if(!sa(k))return new u(D(L),D(k));if(qn(L)||ot(L)){for(var W=Array.from(k.dimensions);W.length>0;)if(zt(W[0])&&typeof W[0].value!="string"){var O=_(W.shift().value,C);qn(L)?L=L.items[O-1]:(L=L.valueOf()[O-1],L instanceof Array&&(L=i(L)))}else if(W.length>1&&zt(W[1])&&typeof W[1].value!="string"){var H=_(W[1].value,C),Z=[],Q=qn(L)?L.items:L.valueOf();for(var U of Q)if(qn(U))Z.push(U.items[H-1]);else if(ot(L))Z.push(U[H-1]);else break;if(Z.length===Q.length)qn(L)?L=new s(Z):L=i(Z),W.splice(1,1);else break}else break;return W.length===k.dimensions.length?new u(D(L),k):W.length>0?(k=new f(W),new u(D(L),k)):L}if(is(L)&&k.dimensions.length===1&&zt(k.dimensions[0])){var me=k.dimensions[0].value;return me in L.properties?L.properties[me]:new l}return new u(D(L),k)}function V(L,k,C,W){var O=k.shift(),H=k.reduce((Z,Q)=>{if(!jt(Q)){var U=Z.pop();if(jt(U))return[U,Q];try{return Z.push(A(L,[U,Q],W)),Z}catch{Z.push(U)}}Z.push(D(Z.pop()));var me=Z.length===1?Z[0]:C(Z);return[C([me,D(Q)])]},[O]);return H.length===1?H[0]:C([H[0],x(H[1])])}function z(L,k){switch(L.type){case"SymbolNode":return L;case"ConstantNode":switch(typeof L.value){case"number":return _(L.value,k);case"string":return L.value;default:if(!isNaN(L.value))return _(L.value,k)}return L;case"FunctionNode":if(r[L.name]&&r[L.name].rawArgs)return L;{var C=["add","multiply"];if(C.indexOf(L.name)===-1){var W=L.args.map(Ee=>z(Ee,k));if(!W.some(jt))try{return A(L.name,W,k)}catch{}if(L.name==="size"&&W.length===1&&qn(W[0])){for(var O=[],H=W[0];qn(H);)O.push(H.items.length),H=H.items[0];return i(O)}return new c(L.name,W.map(D))}}case"OperatorNode":{var Z=L.fn.toString(),Q,U,me=S(L);if(Vr(L)&&L.isUnary())Q=[z(L.args[0],k)],jt(Q[0])?U=me(Q):U=A(Z,Q,k);else if(g(L,k.context))if(Q=y(L,k.context),Q=Q.map(Ee=>z(Ee,k)),d(Z,k.context)){for(var De=[],pe=[],_e=0;_e<Q.length;_e++)jt(Q[_e])?pe.push(Q[_e]):De.push(Q[_e]);De.length>1?(U=V(Z,De,me,k),pe.unshift(U),U=V(Z,pe,me,k)):U=V(Z,Q,me,k)}else U=V(Z,Q,me,k);else Q=L.args.map(Ee=>z(Ee,k)),U=V(Z,Q,me,k);return U}case"ParenthesisNode":return z(L.content,k);case"AccessorNode":return B(z(L.object,k),z(L.index,k),k);case"ArrayNode":{var Ne=L.items.map(Ee=>z(Ee,k));return Ne.some(jt)?new s(Ne.map(D)):i(Ne)}case"IndexNode":return new f(L.dimensions.map(Ee=>b(Ee,k)));case"ObjectNode":{var Se={};for(var Me in L.properties)Se[Me]=b(L.properties[Me],k);return new p(Se)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(L.type))}}return b});var GR="simplifyCore",pK=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],Xw=T(GR,pK,n=>{var{typed:e,parse:t,equal:r,isZero:i,add:a,subtract:o,multiply:u,divide:s,pow:l,AccessorNode:c,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:S}=n,b=new p(0),w=new p(1),A=new p(!0),x=new p(!1);function D(P){return Vr(P)&&["and","not","or"].includes(P.op)}var{hasProperty:E,isCommutative:_}=Al({FunctionNode:m,OperatorNode:g,SymbolNode:S});function N(P){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=B?B.context:void 0;if(E(P,"trivial",V)){if(vi(P)&&P.args.length===1)return N(P.args[0],B);var z=!1,L=0;if(P.forEach(pe=>{++L,L===1&&(z=N(pe,B))}),L===1)return z}var k=P;if(vi(k)){var C=$2(k.name);if(C){if(k.args.length>2&&E(k,"associative",V))for(;k.args.length>2;){var W=k.args.pop(),O=k.args.pop();k.args.push(new g(C,k.name,[W,O]))}k=new g(C,k.name,k.args)}else return new m(N(k.fn),k.args.map(pe=>N(pe,B)))}if(Vr(k)&&k.isUnary()){var H=N(k.args[0],B);if(k.op==="~"&&Vr(H)&&H.isUnary()&&H.op==="~"||k.op==="not"&&Vr(H)&&H.isUnary()&&H.op==="not"&&D(H.args[0]))return H.args[0];var Z=!0;if(k.op==="-"&&Vr(H)&&(H.isBinary()&&H.fn==="subtract"&&(k=new g("-","subtract",[H.args[1],H.args[0]]),Z=!1),H.isUnary()&&H.op==="-"))return H.args[0];if(Z)return new g(k.op,k.fn,[H])}if(Vr(k)&&k.isBinary()){var Q=N(k.args[0],B),U=N(k.args[1],B);if(k.op==="+"){if(zt(Q)&&i(Q.value))return U;if(zt(U)&&i(U.value))return Q;Vr(U)&&U.isUnary()&&U.op==="-"&&(U=U.args[0],k=new g("-","subtract",[Q,U]))}if(k.op==="-")return Vr(U)&&U.isUnary()&&U.op==="-"?N(new g("+","add",[Q,U.args[0]]),B):zt(Q)&&i(Q.value)?N(new g("-","unaryMinus",[U])):zt(U)&&i(U.value)?Q:new g(k.op,k.fn,[Q,U]);if(k.op==="*"){if(zt(Q)){if(i(Q.value))return b;if(r(Q.value,1))return U}if(zt(U)){if(i(U.value))return b;if(r(U.value,1))return Q;if(_(k,V))return new g(k.op,k.fn,[U,Q],k.implicit)}return new g(k.op,k.fn,[Q,U],k.implicit)}if(k.op==="/")return zt(Q)&&i(Q.value)?b:zt(U)&&r(U.value,1)?Q:new g(k.op,k.fn,[Q,U]);if(k.op==="^"&&zt(U)){if(i(U.value))return w;if(r(U.value,1))return Q}if(k.op==="and"){if(zt(Q))if(Q.value){if(D(U))return U;if(zt(U))return U.value?A:x}else return x;if(zt(U))if(U.value){if(D(Q))return Q}else return x}if(k.op==="or"){if(zt(Q)){if(Q.value)return A;if(D(U))return U}if(zt(U)){if(U.value)return A;if(D(Q))return Q}}return new g(k.op,k.fn,[Q,U])}if(Vr(k))return new g(k.op,k.fn,k.args.map(pe=>N(pe,B)));if(qn(k))return new f(k.items.map(pe=>N(pe,B)));if($i(k))return new c(N(k.object,B),N(k.index,B));if(sa(k))return new h(k.dimensions.map(pe=>N(pe,B)));if(is(k)){var me={};for(var De in k.properties)me[De]=N(k.properties[De],B);return new d(me)}return k}return e(GR,{Node:N,"Node,Object":N})});var mK="resolve",dK=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],Qw=T(mK,dK,n=>{var{typed:e,parse:t,ConstantNode:r,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=n;function u(s,l){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!l)return s;if(Fr(s)){if(c.has(s.name)){var f=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(f,"}"))}var p=l.get(s.name);if(jt(p)){var m=new Set(c);return m.add(s.name),u(p,l,m)}else return typeof p=="number"?t(String(p)):p!==void 0?new r(p):s}else if(Vr(s)){var h=s.args.map(function(g){return u(g,l,c)});return new a(s.op,s.fn,h,s.implicit)}else{if(zn(s))return new o(u(s.content,l,c));if(vi(s)){var d=s.args.map(function(g){return u(g,l,c)});return new i(s.name,d)}}return s.map(g=>u(g,l,c))}return e("resolve",{Node:u,"Node, Map | null | undefined":u,"Node, Object":(s,l)=>u(s,Eo(l)),"Array | Matrix":e.referToSelf(s=>l=>l.map(c=>s(c))),"Array | Matrix, null | undefined":e.referToSelf(s=>l=>l.map(c=>s(c))),"Array, Object":e.referTo("Array,Map",s=>(l,c)=>s(l,Eo(c))),"Matrix, Object":e.referTo("Matrix,Map",s=>(l,c)=>s(l,Eo(c))),"Array | Matrix, Map":e.referToSelf(s=>(l,c)=>l.map(f=>s(f,c)))})});var WR="symbolicEqual",hK=["parse","simplify","typed","OperatorNode"],Kw=T(WR,hK,n=>{var{parse:e,simplify:t,typed:r,OperatorNode:i}=n;function a(o,u){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=new i("-","subtract",[o,u]),c=t(l,{},s);return zt(c)&&!c.value}return r(WR,{"Node, Node":a,"Node, Node, Object":a})});var YR="derivative",gK=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],e_=T(YR,gK,n=>{var{typed:e,config:t,parse:r,simplify:i,equal:a,isZero:o,numeric:u,ConstantNode:s,FunctionNode:l,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=n;function m(b,w){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},x={};g(x,b,w.name);var D=y(b,x);return A.simplify?i(D):D}e.addConversion({from:"identifier",to:"SymbolNode",convert:r});var h=e(YR,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});e.removeConversion({from:"identifier",to:"SymbolNode",convert:r}),h._simplify=!0,h.toTex=function(b){return d.apply(null,b.args)};var d=e("_derivTex",{"Node, SymbolNode":function(w,A){return zt(w)&&Kt(w.value)==="string"?d(r(w.value).toString(),A.toString(),1):d(w.toTex(),A.toString(),1)},"Node, ConstantNode":function(w,A){if(Kt(A.value)==="string")return d(w,r(A.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(w,A,x){return d(w.toString(),A.name,x.value)},"string, string, number":function(w,A,x){var D;return x===1?D="{d\\over d"+A+"}":D="{d^{"+x+"}\\over d"+A+"^{"+x+"}}",D+"\\left[".concat(w,"\\right]")}}),g=e("constTag",{"Object, ConstantNode, string":function(w,A){return w[A]=!0,!0},"Object, SymbolNode, string":function(w,A,x){return A.name!==x?(w[A]=!0,!0):!1},"Object, ParenthesisNode, string":function(w,A,x){return g(w,A.content,x)},"Object, FunctionAssignmentNode, string":function(w,A,x){return A.params.indexOf(x)===-1?(w[A]=!0,!0):g(w,A.expr,x)},"Object, FunctionNode | OperatorNode, string":function(w,A,x){if(A.args.length>0){for(var D=g(w,A.args[0],x),E=1;E<A.args.length;++E)D=g(w,A.args[E],x)&&D;if(D)return w[A]=!0,!0}return!1}}),y=e("_derivative",{"ConstantNode, Object":function(w){return S(0)},"SymbolNode, Object":function(w,A){return A[w]!==void 0?S(0):S(1)},"ParenthesisNode, Object":function(w,A){return new f(y(w.content,A))},"FunctionAssignmentNode, Object":function(w,A){return A[w]!==void 0?S(0):y(w.expr,A)},"FunctionNode, Object":function(w,A){if(A[w]!==void 0)return S(0);var x=w.args[0],D,E=!1,_=!1,N;switch(w.name){case"cbrt":E=!0,N=new c("*","multiply",[S(3),new c("^","pow",[x,new c("/","divide",[S(2),S(3)])])]);break;case"sqrt":case"nthRoot":if(w.args.length===1)E=!0,N=new c("*","multiply",[S(2),new l("sqrt",[x])]);else if(w.args.length===2)return D=new c("/","divide",[S(1),w.args[1]]),A[D]=A[w.args[1]],y(new c("^","pow",[x,D]),A);break;case"log10":D=S(10);case"log":if(!D&&w.args.length===1)N=x.clone(),E=!0;else if(w.args.length===1&&D||w.args.length===2&&A[w.args[1]]!==void 0)N=new c("*","multiply",[x.clone(),new l("log",[D||w.args[1]])]),E=!0;else if(w.args.length===2)return y(new c("/","divide",[new l("log",[x]),new l("log",[w.args[1]])]),A);break;case"pow":if(w.args.length===2)return A[D]=A[w.args[1]],y(new c("^","pow",[x,w.args[1]]),A);break;case"exp":N=new l("exp",[x.clone()]);break;case"sin":N=new l("cos",[x.clone()]);break;case"cos":N=new c("-","unaryMinus",[new l("sin",[x.clone()])]);break;case"tan":N=new c("^","pow",[new l("sec",[x.clone()]),S(2)]);break;case"sec":N=new c("*","multiply",[w,new l("tan",[x.clone()])]);break;case"csc":_=!0,N=new c("*","multiply",[w,new l("cot",[x.clone()])]);break;case"cot":_=!0,N=new c("^","pow",[new l("csc",[x.clone()]),S(2)]);break;case"asin":E=!0,N=new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])]);break;case"acos":E=!0,_=!0,N=new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])]);break;case"atan":E=!0,N=new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)]);break;case"asec":E=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acsc":E=!0,_=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acot":E=!0,_=!0,N=new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)]);break;case"sinh":N=new l("cosh",[x.clone()]);break;case"cosh":N=new l("sinh",[x.clone()]);break;case"tanh":N=new c("^","pow",[new l("sech",[x.clone()]),S(2)]);break;case"sech":_=!0,N=new c("*","multiply",[w,new l("tanh",[x.clone()])]);break;case"csch":_=!0,N=new c("*","multiply",[w,new l("coth",[x.clone()])]);break;case"coth":_=!0,N=new c("^","pow",[new l("csch",[x.clone()]),S(2)]);break;case"asinh":E=!0,N=new l("sqrt",[new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)])]);break;case"acosh":E=!0,N=new l("sqrt",[new c("-","subtract",[new c("^","pow",[x.clone(),S(2)]),S(1)])]);break;case"atanh":E=!0,N=new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])]);break;case"asech":E=!0,_=!0,N=new c("*","multiply",[x.clone(),new l("sqrt",[new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])])])]);break;case"acsch":E=!0,_=!0,N=new c("*","multiply",[new l("abs",[x.clone()]),new l("sqrt",[new c("+","add",[new c("^","pow",[x.clone(),S(2)]),S(1)])])]);break;case"acoth":E=!0,_=!0,N=new c("-","subtract",[S(1),new c("^","pow",[x.clone(),S(2)])]);break;case"abs":N=new c("/","divide",[new l(new p("abs"),[x.clone()]),x.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+w.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var P,B;E?(P="/",B="divide"):(P="*",B="multiply");var V=y(x,A);return _&&(V=new c("-","unaryMinus",[V])),new c(P,B,[V,N])},"OperatorNode, Object":function(w,A){if(A[w]!==void 0)return S(0);if(w.op==="+")return new c(w.op,w.fn,w.args.map(function(L){return y(L,A)}));if(w.op==="-"){if(w.isUnary())return new c(w.op,w.fn,[y(w.args[0],A)]);if(w.isBinary())return new c(w.op,w.fn,[y(w.args[0],A),y(w.args[1],A)])}if(w.op==="*"){var x=w.args.filter(function(L){return A[L]!==void 0});if(x.length>0){var D=w.args.filter(function(L){return A[L]===void 0}),E=D.length===1?D[0]:new c("*","multiply",D),_=x.concat(y(E,A));return new c("*","multiply",_)}return new c("+","add",w.args.map(function(L){return new c("*","multiply",w.args.map(function(k){return k===L?y(k,A):k.clone()}))}))}if(w.op==="/"&&w.isBinary()){var N=w.args[0],P=w.args[1];return A[P]!==void 0?new c("/","divide",[y(N,A),P]):A[N]!==void 0?new c("*","multiply",[new c("-","unaryMinus",[N]),new c("/","divide",[y(P,A),new c("^","pow",[P.clone(),S(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(N,A),P.clone()]),new c("*","multiply",[N.clone(),y(P,A)])]),new c("^","pow",[P.clone(),S(2)])])}if(w.op==="^"&&w.isBinary()){var B=w.args[0],V=w.args[1];if(A[B]!==void 0)return zt(B)&&(o(B.value)||a(B.value,1))?S(0):new c("*","multiply",[w,new c("*","multiply",[new l("log",[B.clone()]),y(V.clone(),A)])]);if(A[V]!==void 0){if(zt(V)){if(o(V.value))return S(0);if(a(V.value,1))return y(B,A)}var z=new c("^","pow",[B.clone(),new c("-","subtract",[V,S(1)])]);return new c("*","multiply",[V.clone(),new c("*","multiply",[y(B,A),z])])}return new c("*","multiply",[new c("^","pow",[B.clone(),V.clone()]),new c("+","add",[new c("*","multiply",[y(B,A),new c("/","divide",[V.clone(),B.clone()])]),new c("*","multiply",[y(V,A),new l("log",[B.clone()])])])])}throw new Error('Cannot process operator "'+w.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function S(b,w){return new s(u(b,w||t.number))}return h});var jR="rationalize",vK=["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"],t_=T(jR,vK,n=>{var{config:e,typed:t,equal:r,isZero:i,add:a,subtract:o,multiply:u,divide:s,pow:l,parse:c,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:S,ArrayNode:b,ConstantNode:w,FunctionNode:A,IndexNode:x,ObjectNode:D,OperatorNode:E,SymbolNode:_,ParenthesisNode:N}=n;function P(k){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=V(),H=B(k,C,!0,O.firstRules),Z=H.variables.length,Q={exactFractions:!1},U={exactFractions:!0};if(k=H.expression,Z>=1){k=z(k);var me,De,pe=!0,_e=!1;k=m(k,O.firstRules,{},Q);for(var Ne;De=pe?O.distrDivRules:O.sucDivRules,k=m(k,De,{},U),pe=!pe,Ne=k.toString(),Ne!==me;)_e=!0,me=Ne;_e&&(k=m(k,O.firstRulesAgain,{},Q)),k=m(k,O.finalRules,{},Q)}var Se=[],Me={};return k.type==="OperatorNode"&&k.isBinary()&&k.op==="/"?(Z===1&&(k.args[0]=L(k.args[0],Se),k.args[1]=L(k.args[1])),W&&(Me.numerator=k.args[0],Me.denominator=k.args[1])):(Z===1&&(k=L(k,Se)),W&&(Me.numerator=k,Me.denominator=null)),W?(Me.coefficients=Se,Me.variables=H.variables,Me.expression=k,Me):k}return t(jR,{Node:P,"Node, boolean":(k,C)=>P(k,{},C),"Node, Object":P,"Node, Object, boolean":P});function B(k,C,W,O){var H=[],Z=m(k,O,C,{exactFractions:!1});W=!!W;var Q="+-*"+(W?"/":"");me(Z);var U={};return U.expression=Z,U.variables=H,U;function me(De){var pe=De.type;if(pe==="FunctionNode")throw new Error("There is an unsolved function call");if(pe==="OperatorNode")if(De.op==="^"){if(De.args[1].type!=="ConstantNode"||!nt(parseFloat(De.args[1].value)))throw new Error("There is a non-integer exponent");me(De.args[0])}else{if(Q.indexOf(De.op)===-1)throw new Error("Operator "+De.op+" invalid in polynomial expression");for(var _e=0;_e<De.args.length;_e++)me(De.args[_e])}else if(pe==="SymbolNode"){var Ne=De.name,Se=H.indexOf(Ne);Se===-1&&H.push(Ne)}else if(pe==="ParenthesisNode")me(De.content);else if(pe!=="ConstantNode")throw new Error("type "+pe+" is not allowed in polynomial expression")}}function V(){var k=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],C=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],W=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],O=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],H={};return H.firstRules=k.concat(C,O),H.distrDivRules=W,H.sucDivRules=O,H.firstRulesAgain=k.concat(C),H.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],H}function z(k,C,W){var O=k.type,H=arguments.length>1;if(O==="OperatorNode"&&k.isBinary()){var Z=!1,Q;if(k.op==="^"&&(k.args[0].type==="ParenthesisNode"||k.args[0].type==="OperatorNode")&&k.args[1].type==="ConstantNode"&&(Q=parseFloat(k.args[1].value),Z=Q>=2&&nt(Q)),Z){if(Q>2){var U=k.args[0],me=new E("^","pow",[k.args[0].cloneDeep(),new w(Q-1)]);k=new E("*","multiply",[U,me])}else k=new E("*","multiply",[k.args[0],k.args[0].cloneDeep()]);H&&(W==="content"?C.content=k:C.args[W]=k)}}if(O==="ParenthesisNode")z(k.content,k,"content");else if(O!=="ConstantNode"&&O!=="SymbolNode")for(var De=0;De<k.args.length;De++)z(k.args[De],k,De);if(!H)return k}function L(k,C){C===void 0&&(C=[]),C[0]=0;var W={};W.cte=1,W.oper="+",W.fire="";var O=0,H="";Ne(k,null,W),O=C.length-1;for(var Z=!0,Q,U=O;U>=0;U--)if(C[U]!==0){var me=new w(Z?C[U]:Math.abs(C[U])),De=C[U]<0?"-":"+";if(U>0){var pe=new _(H);if(U>1){var _e=new w(U);pe=new E("^","pow",[pe,_e])}C[U]===-1&&Z?me=new E("-","unaryMinus",[pe]):Math.abs(C[U])===1?me=pe:me=new E("*","multiply",[me,pe])}Z?Q=me:De==="+"?Q=new E("+","add",[Q,me]):Q=new E("-","subtract",[Q,me]),Z=!1}if(Z)return new w(0);return Q;function Ne(Se,Me,Ee){var Ce=Se.type;if(Ce==="FunctionNode")throw new Error("There is an unsolved function call");if(Ce==="OperatorNode"){if("+-*^".indexOf(Se.op)===-1)throw new Error("Operator "+Se.op+" invalid");if(Me!==null){if((Se.fn==="unaryMinus"||Se.fn==="pow")&&Me.fn!=="add"&&Me.fn!=="subtract"&&Me.fn!=="multiply")throw new Error("Invalid "+Se.op+" placing");if((Se.fn==="subtract"||Se.fn==="add"||Se.fn==="multiply")&&Me.fn!=="add"&&Me.fn!=="subtract")throw new Error("Invalid "+Se.op+" placing");if((Se.fn==="subtract"||Se.fn==="add"||Se.fn==="unaryMinus")&&Ee.noFil!==0)throw new Error("Invalid "+Se.op+" placing")}(Se.op==="^"||Se.op==="*")&&(Ee.fire=Se.op);for(var Ge=0;Ge<Se.args.length;Ge++)Se.fn==="unaryMinus"&&(Ee.oper="-"),(Se.op==="+"||Se.fn==="subtract")&&(Ee.fire="",Ee.cte=1,Ee.oper=Ge===0?"+":Se.op),Ee.noFil=Ge,Ne(Se.args[Ge],Se,Ee)}else if(Ce==="SymbolNode"){if(Se.name!==H&&H!=="")throw new Error("There is more than one variable");if(H=Se.name,Me===null){C[1]=1;return}if(Me.op==="^"&&Ee.noFil!==0)throw new Error("In power the variable should be the first parameter");if(Me.op==="*"&&Ee.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(Ee.fire===""||Ee.fire==="*")&&(O<1&&(C[1]=0),C[1]+=Ee.cte*(Ee.oper==="+"?1:-1),O=Math.max(1,O))}else if(Ce==="ConstantNode"){var We=parseFloat(Se.value);if(Me===null){C[0]=We;return}if(Me.op==="^"){if(Ee.noFil!==1)throw new Error("Constant cannot be powered");if(!nt(We)||We<=0)throw new Error("Non-integer exponent is not allowed");for(var te=O+1;te<We;te++)C[te]=0;We>O&&(C[We]=0),C[We]+=Ee.cte*(Ee.oper==="+"?1:-1),O=Math.max(We,O);return}Ee.cte=We,Ee.fire===""&&(C[0]+=Ee.cte*(Ee.oper==="+"?1:-1))}else throw new Error("Type "+Ce+" is not allowed")}}});var ZR="zpk2tf",yK=["typed","add","multiply","Complex","number"],r_=T(ZR,yK,n=>{var{typed:e,add:t,multiply:r,Complex:i,number:a}=n;return e(ZR,{"Array,Array,number":function(l,c,f){return o(l,c,f)},"Array,Array":function(l,c){return o(l,c,1)},"Matrix,Matrix,number":function(l,c,f){return o(l.valueOf(),c.valueOf(),f)},"Matrix,Matrix":function(l,c){return o(l.valueOf(),c.valueOf(),1)}});function o(s,l,c){s.some(S=>S.type==="BigNumber")&&(s=s.map(S=>a(S))),l.some(S=>S.type==="BigNumber")&&(l=l.map(S=>a(S)));for(var f=[i(1,0)],p=[i(1,0)],m=0;m<s.length;m++){var h=s[m];typeof h=="number"&&(h=i(h,0)),f=u(f,[i(1,0),i(-h.re,-h.im)])}for(var d=0;d<l.length;d++){var g=l[d];typeof g=="number"&&(g=i(g,0)),p=u(p,[i(1,0),i(-g.re,-g.im)])}for(var y=0;y<f.length;y++)f[y]=r(f[y],c);return[f,p]}function u(s,l){for(var c=[],f=0;f<s.length+l.length-1;f++){c[f]=i(0,0);for(var p=0;p<s.length;p++)f-p>=0&&f-p<l.length&&(c[f]=t(c[f],r(s[p],l[f-p])))}return c}});var JR="freqz",bK=["typed","add","multiply","Complex","divide","matrix"],n_=T(JR,bK,n=>{var{typed:e,add:t,multiply:r,Complex:i,divide:a,matrix:o}=n;return e(JR,{"Array, Array":function(c,f){var p=s(512);return u(c,f,p)},"Array, Array, Array":function(c,f,p){return u(c,f,p)},"Array, Array, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=s(p);return u(c,f,m)},"Matrix, Matrix":function(c,f){var p=s(512),{w:m,h}=u(c.valueOf(),f.valueOf(),p);return{w:o(m),h:o(h)}},"Matrix, Matrix, Matrix":function(c,f,p){var{h:m}=u(c.valueOf(),f.valueOf(),p.valueOf());return{h:o(m),w:o(p)}},"Matrix, Matrix, number":function(c,f,p){if(p<0)throw new Error("w must be a positive number");var m=s(p),{h}=u(c.valueOf(),f.valueOf(),m);return{h:o(h),w:o(m)}}});function u(l,c,f){for(var p=[],m=[],h=0;h<f.length;h++){for(var d=i(0,0),g=i(0,0),y=0;y<l.length;y++)d=t(d,r(l[y],i(Math.cos(-y*f[h]),Math.sin(-y*f[h]))));for(var S=0;S<c.length;S++)g=t(g,r(c[S],i(Math.cos(-S*f[h]),Math.sin(-S*f[h]))));p.push(d),m.push(g)}for(var b=[],w=0;w<p.length;w++)b.push(a(p[w],m[w]));return{h:b,w:f}}function s(l){for(var c=[],f=0;f<l;f++)c.push(f/l*Math.PI);return c}});var xK="reviver",wK=["classes"],i_=T(xK,wK,n=>{var{classes:e}=n;return function(r,i){var a=e[i&&i.mathjs];return a&&typeof a.fromJSON=="function"?a.fromJSON(i):i}});var _K="replacer",SK=[],a_=T(_K,SK,()=>function(e,t){return typeof t=="number"&&(!isFinite(t)||isNaN(t))?{mathjs:"number",value:String(t)}:t});var XR="12.4.1";var o_=T("true",[],()=>!0),s_=T("false",[],()=>!1),u_=T("null",[],()=>null),l_=Gi("Infinity",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1/0):1/0}),c_=Gi("NaN",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(NaN):NaN}),f_=Gi("pi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?Yc(t):IT}),p_=Gi("tau",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?e2(t):PT}),m_=Gi("e",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?QF(t):kT}),d_=Gi("phi",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?KF(t):BT}),h_=Gi("LN2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).ln():Math.LN2}),g_=Gi("LN10",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(10).ln():Math.LN10}),v_=Gi("LOG2E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(2).ln()):Math.LOG2E}),y_=Gi("LOG10E",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(1).div(new t(10).ln()):Math.LOG10E}),b_=Gi("SQRT1_2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t("0.5").sqrt():Math.SQRT1_2}),x_=Gi("SQRT2",["config","?BigNumber"],n=>{var{config:e,BigNumber:t}=n;return e.number==="BigNumber"?new t(2).sqrt():Math.SQRT2}),w_=Gi("i",["Complex"],n=>{var{Complex:e}=n;return e.I});var __=T("version",[],()=>XR);function Gi(n,e,t){return T(n,e,t,{recreateOnConfigChange:!0})}var S_=Jt("speedOfLight","299792458","m s^-1"),A_=Jt("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),M_=Jt("planckConstant","6.62607015e-34","J s"),E_=Jt("reducedPlanckConstant","1.0545718176461565e-34","J s"),D_=Jt("magneticConstant","1.25663706212e-6","N A^-2"),N_=Jt("electricConstant","8.8541878128e-12","F m^-1"),T_=Jt("vacuumImpedance","376.730313667","ohm"),C_=Jt("coulomb","8.987551792261171e9","N m^2 C^-2"),F_=Jt("elementaryCharge","1.602176634e-19","C"),I_=Jt("bohrMagneton","9.2740100783e-24","J T^-1"),P_=Jt("conductanceQuantum","7.748091729863649e-5","S"),k_=Jt("inverseConductanceQuantum","12906.403729652257","ohm"),B_=Jt("magneticFluxQuantum","2.0678338484619295e-15","Wb"),O_=Jt("nuclearMagneton","5.0507837461e-27","J T^-1"),R_=Jt("klitzing","25812.807459304513","ohm");var L_=Jt("bohrRadius","5.29177210903e-11","m"),V_=Jt("classicalElectronRadius","2.8179403262e-15","m"),U_=Jt("electronMass","9.1093837015e-31","kg"),q_=Jt("fermiCoupling","1.1663787e-5","GeV^-2"),z_=xd("fineStructure",.0072973525693),$_=Jt("hartreeEnergy","4.3597447222071e-18","J"),H_=Jt("protonMass","1.67262192369e-27","kg"),G_=Jt("deuteronMass","3.3435830926e-27","kg"),W_=Jt("neutronMass","1.6749271613e-27","kg"),Y_=Jt("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),j_=Jt("rydberg","10973731.568160","m^-1"),Z_=Jt("thomsonCrossSection","6.6524587321e-29","m^2"),J_=xd("weakMixingAngle",.2229),X_=xd("efimovFactor",22.7),Q_=Jt("atomicMass","1.66053906660e-27","kg"),K_=Jt("avogadro","6.02214076e23","mol^-1"),eS=Jt("boltzmann","1.380649e-23","J K^-1"),tS=Jt("faraday","96485.33212331001","C mol^-1"),rS=Jt("firstRadiation","3.7417718521927573e-16","W m^2"),nS=Jt("loschmidt","2.686780111798444e25","m^-3"),iS=Jt("gasConstant","8.31446261815324","J K^-1 mol^-1"),aS=Jt("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),oS=Jt("molarVolume","0.022413969545014137","m^3 mol^-1"),sS=xd("sackurTetrode",-1.16487052358),uS=Jt("secondRadiation","0.014387768775039337","m K"),lS=Jt("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),cS=Jt("wienDisplacement","2.897771955e-3","m K"),fS=Jt("molarMass","0.99999999965e-3","kg mol^-1"),pS=Jt("molarMassC12","11.9999999958e-3","kg mol^-1"),mS=Jt("gravity","9.80665","m s^-2"),dS=Jt("planckLength","1.616255e-35","m"),hS=Jt("planckMass","2.176435e-8","kg"),gS=Jt("planckTime","5.391245e-44","s"),vS=Jt("planckCharge","1.87554603778e-18","C"),yS=Jt("planckTemperature","1.416785e+32","K");function Jt(n,e,t){var r=["config","Unit","BigNumber"];return T(n,r,i=>{var{config:a,Unit:o,BigNumber:u}=i,s=a.number==="BigNumber"?new u(e):parseFloat(e),l=new o(s,t);return l.fixPrefix=!0,l})}function xd(n,e){var t=["config","BigNumber"];return T(n,t,r=>{var{config:i,BigNumber:a}=r;return i.number==="BigNumber"?new a(e):e})}var AK="apply",MK=["typed","isInteger"],bS=T(AK,MK,n=>{var{typed:e,isInteger:t}=n,r=iu({typed:e,isInteger:t});return e("apply",{"...any":function(a){var o=a[1];At(o)?a[1]=o-1:pt(o)&&(a[1]=o.minus(1));try{return r.apply(null,a)}catch(u){throw Br(u)}}})},{isTransformFunction:!0});var EK="column",DK=["typed","Index","matrix","range"],xS=T(EK,DK,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=Rc({typed:e,Index:t,matrix:r,range:i});return e("column",{"...any":function(u){var s=u.length-1,l=u[s];At(l)&&(u[s]=l-1);try{return a.apply(null,u)}catch(c){throw Br(c)}}})},{isTransformFunction:!0});function Ml(n,e,t){var r=n.filter(function(s){return Fr(s)&&!(s.name in e)&&!t.has(s.name)})[0];if(!r)throw new Error('No undefined variable found in inline expression "'+n+'"');var i=r.name,a=new Map,o=new cl(t,a,new Set([i])),u=n.compile();return function(l){return a.set(i,l),u.evaluate(o)}}var NK="filter",TK=["typed"],wS=T(NK,TK,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||ja(i[1])?s=i[1].compile().evaluate(o):s=Ml(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("filter",{"Array, function":QR,"Matrix, function":function(a,o){return a.create(QR(a.toArray(),o))},"Array, RegExp":ul,"Matrix, RegExp":function(a,o){return a.create(ul(a.toArray(),o))}});return t},{isTransformFunction:!0});function QR(n,e){return wm(n,function(t,r,i){return fa(e,t,[r+1],i,"filter")})}var CK="forEach",FK=["typed"],_S=T(CK,FK,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||ja(i[1])?s=i[1].compile().evaluate(o):s=Ml(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("forEach",{"Array | Matrix, function":function(a,o){var u=function s(l,c){if(Array.isArray(l))as(l,function(f,p){s(f,c.concat(p+1))});else return fa(o,l,c,a,"forEach")};u(a.valueOf(),[])}});return t},{isTransformFunction:!0});var IK="index",PK=["Index","getMatrixDataType"],SS=T(IK,PK,n=>{var{Index:e,getMatrixDataType:t}=n;return function(){for(var i=[],a=0,o=arguments.length;a<o;a++){var u=arguments[a];if(il(u))u.start--,u.end-=u.step>0?0:2;else if(u&&u.isSet===!0)u=u.map(function(l){return l-1});else if(nr(u)||ot(u))t(u)!=="boolean"&&(u=u.map(function(l){return l-1}));else if(At(u))u--;else if(pt(u))u=u.toNumber()-1;else if(typeof u!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");i[a]=u}var s=new e;return e.apply(s,i),s}},{isTransformFunction:!0});var kK="map",BK=["typed"],AS=T(kK,BK,n=>{var{typed:e}=n;function t(i,a,o){var u,s;return i[0]&&(u=i[0].compile().evaluate(o)),i[1]&&(Fr(i[1])||ja(i[1])?s=i[1].compile().evaluate(o):s=Ml(i[1],a,o)),r(u,s)}t.rawArgs=!0;var r=e("map",{"Array, function":function(a,o){return KR(a,o,a)},"Matrix, function":function(a,o){return a.create(KR(a.valueOf(),o,a))}});return t},{isTransformFunction:!0});function KR(n,e,t){function r(i,a){return Array.isArray(i)?Ei(i,function(o,u){return r(o,a.concat(u+1))}):fa(e,i,a,t,"map")}return r(n,[])}function ni(n){if(n.length===2&&ln(n[0])){n=n.slice();var e=n[1];At(e)?n[1]=e-1:pt(e)&&(n[1]=e.minus(1))}return n}var OK="max",RK=["typed","config","numeric","larger"],MS=T(OK,RK,n=>{var{typed:e,config:t,numeric:r,larger:i}=n,a=Gc({typed:e,config:t,numeric:r,larger:i});return e("max",{"...any":function(u){u=ni(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var LK="mean",VK=["typed","add","divide"],ES=T(LK,VK,n=>{var{typed:e,add:t,divide:r}=n,i=Xc({typed:e,add:t,divide:r});return e("mean",{"...any":function(o){o=ni(o);try{return i.apply(null,o)}catch(u){throw Br(u)}}})},{isTransformFunction:!0});var UK="min",qK=["typed","config","numeric","smaller"],DS=T(UK,qK,n=>{var{typed:e,config:t,numeric:r,smaller:i}=n,a=Wc({typed:e,config:t,numeric:r,smaller:i});return e("min",{"...any":function(u){u=ni(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var zK="range",$K=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],NS=T(zK,$K,n=>{var{typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,isPositive:c}=n,f=Uc({typed:e,config:t,matrix:r,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:l,isPositive:c});return e("range",{"...any":function(m){var h=m.length-1,d=m[h];return typeof d!="boolean"&&m.push(!0),f.apply(null,m)}})},{isTransformFunction:!0});var HK="row",GK=["typed","Index","matrix","range"],TS=T(HK,GK,n=>{var{typed:e,Index:t,matrix:r,range:i}=n,a=qc({typed:e,Index:t,matrix:r,range:i});return e("row",{"...any":function(u){var s=u.length-1,l=u[s];At(l)&&(u[s]=l-1);try{return a.apply(null,u)}catch(c){throw Br(c)}}})},{isTransformFunction:!0});var WK="subset",YK=["typed","matrix","zeros","add"],CS=T(WK,YK,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=zc({typed:e,matrix:t,zeros:r,add:i});return e("subset",{"...any":function(u){try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var jK="concat",ZK=["typed","matrix","isInteger"],FS=T(jK,ZK,n=>{var{typed:e,matrix:t,isInteger:r}=n,i=Oc({typed:e,matrix:t,isInteger:r});return e("concat",{"...any":function(o){var u=o.length-1,s=o[u];At(s)?o[u]=s-1:pt(s)&&(o[u]=s.minus(1));try{return i.apply(null,o)}catch(l){throw Br(l)}}})},{isTransformFunction:!0});var eL="diff",JK=["typed","matrix","subtract","number","bignumber"],IS=T(eL,JK,n=>{var{typed:e,matrix:t,subtract:r,number:i,bignumber:a}=n,o=Vc({typed:e,matrix:t,subtract:r,number:i,bignumber:a});return e(eL,{"...any":function(s){s=ni(s);try{return o.apply(null,s)}catch(l){throw Br(l)}}})},{isTransformFunction:!0});var XK="std",QK=["typed","map","sqrt","variance"],PS=T(XK,QK,n=>{var{typed:e,map:t,sqrt:r,variance:i}=n,a=ef({typed:e,map:t,sqrt:r,variance:i});return e("std",{"...any":function(u){u=ni(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var tL="sum",KK=["typed","config","add","numeric"],kS=T(tL,KK,n=>{var{typed:e,config:t,add:r,numeric:i}=n,a=Zc({typed:e,config:t,add:r,numeric:i});return e(tL,{"...any":function(u){u=ni(u);try{return a.apply(null,u)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var eee="quantileSeq",tee=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],BS=T(eee,tee,n=>{var{typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p}=n,m=Kc({typed:e,bignumber:t,add:r,subtract:i,divide:a,multiply:o,partitionSelect:u,compare:s,isInteger:l,smaller:c,smallerEq:f,larger:p});return e("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(d,g,y)=>m(d,g,h(y)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(d,g,y,S)=>m(d,g,y,h(S)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(d,g,y)=>m(d,g,h(y)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(d,g,y,S)=>m(d,g,y,h(S))});function h(d){return ni([[],d])[1]}},{isTransformFunction:!0});var rL="cumsum",ree=["typed","add","unaryPlus"],OS=T(rL,ree,n=>{var{typed:e,add:t,unaryPlus:r}=n,i=Jc({typed:e,add:t,unaryPlus:r});return e(rL,{"...any":function(o){if(o.length===2&&ln(o[0])){var u=o[1];At(u)?o[1]=u-1:pt(u)&&(o[1]=u.minus(1))}try{return i.apply(null,o)}catch(s){throw Br(s)}}})},{isTransformFunction:!0});var nL="variance",nee=["typed","add","subtract","multiply","divide","apply","isNaN"],RS=T(nL,nee,n=>{var{typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u}=n,s=Qc({typed:e,add:t,subtract:r,multiply:i,divide:a,apply:o,isNaN:u});return e(nL,{"...any":function(c){c=ni(c);try{return s.apply(null,c)}catch(f){throw Br(f)}}})},{isTransformFunction:!0});var iL="print",iee=["typed","matrix","zeros","add"],LS=T(iL,iee,n=>{var{typed:e,matrix:t,zeros:r,add:i}=n,a=$c({typed:e,matrix:t,zeros:r,add:i});return e(iL,{"string, Object | Array":function(s,l){return a(o(s),l)},"string, Object | Array, number | Object":function(s,l,c){return a(o(s),l,c)}});function o(u){return u.replace(qm,s=>{var l=s.slice(1).split("."),c=l.map(function(f){return!isNaN(f)&&f.length>0?parseInt(f)-1:f});return"$"+c.join(".")})}},{isTransformFunction:!0});var aee="and",oee=["typed","matrix","zeros","add","equalScalar","not","concat"],VS=T(aee,oee,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=Hc({typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o});function s(l,c,f){var p=l[0].compile().evaluate(f);if(!ln(p)&&!u(p,!0))return!1;var m=l[1].compile().evaluate(f);return u(p,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var see="or",uee=["typed","matrix","equalScalar","DenseMatrix","concat"],US=T(see,uee,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=Bc({typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a});function u(s,l,c){var f=s[0].compile().evaluate(c);if(!ln(f)&&o(f,!1))return!0;var p=s[1].compile().evaluate(c);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var lee="bitAnd",cee=["typed","matrix","zeros","add","equalScalar","not","concat"],qS=T(lee,cee,n=>{var{typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o}=n,u=Pc({typed:e,matrix:t,equalScalar:r,zeros:i,not:a,concat:o});function s(l,c,f){var p=l[0].compile().evaluate(f);if(!ln(p)){if(isNaN(p))return NaN;if(p===0||p===!1)return 0}var m=l[1].compile().evaluate(f);return u(p,m)}return s.rawArgs=!0,s},{isTransformFunction:!0});var fee="bitOr",pee=["typed","matrix","equalScalar","DenseMatrix","concat"],zS=T(fee,pee,n=>{var{typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a}=n,o=kc({typed:e,matrix:t,equalScalar:r,DenseMatrix:i,concat:a});function u(s,l,c){var f=s[0].compile().evaluate(c);if(!ln(f)){if(isNaN(f))return NaN;if(f===-1)return-1;if(f===!0)return 1}var p=s[1].compile().evaluate(c);return o(f,p)}return u.rawArgs=!0,u},{isTransformFunction:!0});var tt=sy({config:Ue}),Or=ly({}),$S=m_({BigNumber:tt,config:Ue}),aL=s_({}),oL=z_({BigNumber:tt,config:Ue}),gs=fy({}),HS=w_({Complex:Or}),sL=l_({BigNumber:tt,config:Ue}),uL=g_({BigNumber:tt,config:Ue}),lL=y_({BigNumber:tt,config:Ue}),nf=my({}),cL=c_({BigNumber:tt,config:Ue}),fL=u_({}),pL=d_({BigNumber:tt,config:Ue}),mL=py({}),GS=ey({}),dL=b_({BigNumber:tt,config:Ue}),hL=sS({BigNumber:tt,config:Ue}),WS=p_({BigNumber:tt,config:Ue}),gL=o_({}),vL=__({}),er=dy({Matrix:nf}),yL=X_({BigNumber:tt,config:Ue}),bL=h_({BigNumber:tt,config:Ue}),wd=f_({BigNumber:tt,config:Ue}),xL=a_({}),wL=x_({BigNumber:tt,config:Ue}),se=Kv({BigNumber:tt,Complex:Or,DenseMatrix:er,Fraction:gs}),_d=O0({BigNumber:tt,config:Ue,typed:se}),_L=J_({BigNumber:tt,config:Ue}),ii=R0({typed:se}),SL=Lx({Complex:Or,config:Ue,typed:se}),AL=Ux({BigNumber:tt,typed:se}),ML=zx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),En=L0({typed:se}),EL=mb({typed:se}),DL=Gx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),NL=Yx({typed:se}),YS=jx({typed:se}),TL=Jx({Complex:Or,config:Ue,typed:se}),Ci=D0({BigNumber:tt,typed:se}),CL=fb({typed:se}),FL=E0({typed:se}),IL=hy({typed:se}),af=Aw({typed:se}),of=N0({Complex:Or,typed:se}),vs=db({typed:se}),Sd=Xx({typed:se}),PL=Kx({BigNumber:tt,typed:se}),kL=t1({BigNumber:tt,typed:se}),BL=$0({typed:se}),ar=_0({config:Ue,typed:se}),OL=Hb({typed:se}),jS=H0({typed:se}),RL=G0({Complex:Or,typed:se}),LL=_b({typed:se}),VL=Ab({typed:se}),El=jb({typed:se}),Ad=Mb({typed:se}),UL=Xb({format:El,typed:se}),Md=hb({typed:se}),yi=vy({typed:se}),Io=h0({typed:se}),ys=y0({typed:se}),da=b0({typed:se}),qL=v_({BigNumber:tt,config:Ue}),zL=Dw({Complex:Or,typed:se}),$L=Q0({Complex:Or,config:Ue,typed:se}),ZS=K0({Complex:Or,config:Ue,typed:se}),bs=Nb({typed:se}),cn=eb({typed:se}),sf=vb({typed:se}),Ka=A0({typed:se}),HL=Jb({format:El,typed:se}),GL=Vw({config:Ue,typed:se}),WL=$c({typed:se}),YL=Uw({config:Ue,typed:se}),Ed=gb({typed:se}),jL=n1({BigNumber:tt,typed:se}),JS=nb({BigNumber:tt,Fraction:gs,complex:of,typed:se}),uf=a1({typed:se}),eo=S0({Matrix:nf,equalScalar:ar,typed:se}),ZL=k0({typed:se}),JL=ab({typed:se}),XL=M0({typed:se}),Wi=V0({typed:se}),QL=s1({typed:se}),XS=w0({typed:se}),KL=Vx({Complex:Or,config:Ue,typed:se}),e3=$x({BigNumber:tt,typed:se}),Dd=iu({isInteger:yi,typed:se}),t3=Hx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),r3=Zb({format:El,typed:se}),n3=Mw({typed:se}),i3=Qx({typed:se}),a3=r1({BigNumber:tt,typed:se}),Dl=x0({typed:se}),o3=Kb({typed:se}),s3=qw({config:Ue,typed:se}),u3=i1({BigNumber:tt,typed:se}),l3=o1({typed:se}),c3=Ox({SparseMatrix:eo,typed:se}),ha=ib({Complex:Or,config:Ue,typed:se}),f3=u1({typed:se}),Oa=B0({typed:se}),p3=qx({BigNumber:tt,Complex:Or,config:Ue,typed:se}),m3=e1({BigNumber:tt,typed:se}),uu=T0({Fraction:gs,typed:se}),xs=g0({typed:se}),Qe=C0({DenseMatrix:er,Matrix:nf,SparseMatrix:eo,typed:se}),d3=F0({isZero:da,matrix:Qe,typed:se}),h3=Wb({isNaN:Dl,isNumeric:xs,typed:se}),ga=ex({bignumber:Ci,fraction:uu,number:Ka}),QS=Yb({config:Ue,multiplyScalar:cn,numeric:ga,typed:se}),KS=Cb({isInteger:yi,matrix:Qe,typed:se}),Rn=kb({matrix:Qe,config:Ue,typed:se}),g3=Bb({matrix:Qe,typed:se}),Nl=Ob({matrix:Qe,typed:se}),eA=sb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),Ln=Lb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),v3=Wx({Complex:Or,config:Ue,typed:se}),tA=U0({BigNumber:tt,Complex:Or,Fraction:gs,config:Ue,isNegative:Io,matrix:Qe,typed:se,unaryMinus:Oa}),mr=Oc({isInteger:yi,matrix:Qe,typed:se}),y3=bb({prod:QS,size:Rn,typed:se}),Nd=Rb({conj:vs,transpose:Nl,typed:se}),rA=wb({DenseMatrix:er,SparseMatrix:eo,matrix:Qe,typed:se}),Xr=tx({numeric:ga,typed:se}),Tl=ux({DenseMatrix:er,concat:mr,divideScalar:Xr,equalScalar:ar,matrix:Qe,typed:se}),Yi=bx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),Cl=Sb({matrix:Qe,typed:se}),b3=v0({isNumeric:xs,typed:se}),Po=Eb({BigNumber:tt,DenseMatrix:er,SparseMatrix:eo,config:Ue,matrix:Qe,typed:se}),x3=Db({matrix:Qe,multiplyScalar:cn,typed:se}),lf=Ax({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),w3=mx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),nA=lx({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:cn,subtractScalar:Wi,typed:se}),Td=P0({flatten:Cl,matrix:Qe,size:Rn,typed:se}),_3=rb({BigNumber:tt,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),S3=Tb({BigNumber:tt,config:Ue,matrix:Qe,typed:se}),Cd=J1({addScalar:En,complex:of,conj:vs,divideScalar:Xr,equal:Yi,identity:Po,isZero:da,matrix:Qe,multiplyScalar:cn,sign:JS,sqrt:ha,subtractScalar:Wi,typed:se,unaryMinus:Oa,zeros:Ln}),A3=Fb({config:Ue,matrix:Qe}),M3=dx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),lu=nx({BigNumber:tt,DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),ai=wx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),fn=ob({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,subtractScalar:Wi,typed:se,unaryMinus:Oa}),E3=Qb({concat:mr,matrix:Qe,typed:se}),D3=Ex({DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,typed:se}),Fd=cx({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:cn,subtractScalar:Wi,typed:se}),N3=yb({DenseMatrix:er,concat:mr,matrix:Qe,typed:se}),lr=b1({DenseMatrix:er,SparseMatrix:eo,addScalar:En,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),T3=Zx({BigNumber:tt,DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),C3=Pc({concat:mr,equalScalar:ar,matrix:Qe,typed:se}),F3=kc({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),I3=pb({DenseMatrix:er,concat:mr,matrix:Qe,typed:se}),P3=Hw({addScalar:En,combinations:af,divideScalar:Xr,isInteger:yi,isNegative:Io,multiplyScalar:cn,typed:se}),ws=gx({BigNumber:tt,DenseMatrix:er,Fraction:gs,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,typed:se}),iA=yx({concat:mr,matrix:Qe,typed:se}),k3=Jc({add:lr,typed:se,unaryPlus:_d}),Id=Mx({equal:Yi,typed:se}),B3=Vc({matrix:Qe,number:Ka,subtract:fn,typed:se}),O3=yw({abs:ii,addScalar:En,deepEqual:Id,divideScalar:Xr,multiplyScalar:cn,sqrt:ha,subtractScalar:Wi,typed:se}),cf=_1({addScalar:En,conj:vs,multiplyScalar:cn,size:Rn,typed:se}),R3=xx({compareText:iA,isZero:da,typed:se}),aA=Fc({DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,round:lu,typed:se,zeros:Ln}),L3=J0({BigNumber:tt,DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,round:lu,typed:se,zeros:Ln}),V3=x1({abs:ii,addScalar:En,divideScalar:Xr,isPositive:ys,multiplyScalar:cn,smaller:ai,sqrt:ha,typed:se}),oA=Tx({DenseMatrix:er,smaller:ai}),Gn=Cx({ImmutableDenseMatrix:oA,getMatrixDataType:Ad}),oi=Sx({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),Pd=ix({Complex:Or,config:Ue,divideScalar:Xr,typed:se}),U3=fx({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:cn,subtractScalar:Wi,typed:se}),q3=I0({flatten:Cl,matrix:Qe,size:Rn,typed:se}),z3=Wc({config:Ue,numeric:ga,smaller:ai,typed:se}),sA=Ic({DenseMatrix:er,concat:mr,config:Ue,equalScalar:ar,matrix:Qe,round:lu,typed:se,zeros:Ln}),_r=tb({addScalar:En,dot:cf,equalScalar:ar,matrix:Qe,multiplyScalar:cn,typed:se}),$3=ox({Complex:Or,config:Ue,divideScalar:Xr,typed:se}),H3=Bc({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),ff=Dx({compare:ws,isNaN:Dl,isNumeric:xs,typed:se}),G3=hx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se,zeros:Ln}),uA=Q1({SparseMatrix:eo,abs:ii,add:lr,divideScalar:Xr,larger:oi,largerEq:lf,multiply:_r,subtract:fn,transpose:Nl,typed:se}),Fi=zc({add:lr,matrix:Qe,typed:se,zeros:Ln}),kd=Zc({add:lr,config:Ue,numeric:ga,typed:se}),W3=S1({add:lr,matrix:Qe,typed:se}),lA=px({DenseMatrix:er,divideScalar:Xr,equalScalar:ar,matrix:Qe,multiplyScalar:cn,subtractScalar:Wi,typed:se}),Y3=r_({Complex:Or,add:lr,multiply:_r,number:Ka,typed:se}),Bd=z0({DenseMatrix:er,config:Ue,equalScalar:ar,matrix:Qe,round:lu,typed:se,zeros:Ln}),Ra=vx({compare:ws,typed:se}),j3=Gw({addScalar:En,combinations:af,isInteger:yi,isNegative:Io,isPositive:ys,larger:oi,typed:se}),Z3=xb({matrix:Qe,multiply:_r,subtract:fn,typed:se}),cA=uw({divideScalar:Xr,isZero:da,matrix:Qe,multiply:_r,subtractScalar:Wi,typed:se,unaryMinus:Oa}),J3=lb({concat:mr,equalScalar:ar,matrix:Qe,multiplyScalar:cn,typed:se}),fA=Fx({larger:oi,smaller:ai}),pA=Y0({Complex:Or,DenseMatrix:er,ceil:Bd,equalScalar:ar,floor:aA,matrix:Qe,typed:se,zeros:Ln}),mA=A1({Index:Gn,typed:se}),X3=bw({abs:ii,add:lr,addScalar:En,config:Ue,divideScalar:Xr,equalScalar:ar,flatten:Cl,isNumeric:xs,isZero:da,matrix:Qe,multiply:_r,multiplyScalar:cn,smaller:ai,subtract:fn,typed:se}),Q3=ub({BigNumber:tt,add:lr,config:Ue,equal:Yi,isInteger:yi,mod:sA,smaller:ai,typed:se,xgcd:eA}),K3=X0({concat:mr,equalScalar:ar,matrix:Qe,typed:se}),e4=ax({Complex:Or,config:Ue,divideScalar:Xr,log:Pd,typed:se}),Od=Gc({config:Ue,larger:oi,numeric:ga,typed:se}),t4=l1({DenseMatrix:er,Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),r4=f1({DenseMatrix:er,Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),n4=m1({Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),i4=h1({Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),cu=_x({DenseMatrix:er,concat:mr,config:Ue,matrix:Qe,typed:se}),a4=Nx({compare:ws,compareNatural:Ra,matrix:Qe,typed:se}),o4=Hc({concat:mr,equalScalar:ar,matrix:Qe,not:sf,typed:se,zeros:Ln}),fu=Uc({bignumber:Ci,matrix:Qe,add:lr,config:Ue,isPositive:ys,larger:oi,largerEq:lf,smaller:ai,smallerEq:cu,typed:se}),s4=qc({Index:Gn,matrix:Qe,range:fu,typed:se}),dA=c1({DenseMatrix:er,Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),u4=d1({Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),hA=v1({Index:Gn,concat:mr,setDifference:dA,size:Rn,subset:Fi,typed:se}),gA=Ix({FibonacciHeap:fA,addScalar:En,equalScalar:ar}),vA=Rc({Index:Gn,matrix:Qe,range:fu,typed:se}),_s=lw({abs:ii,addScalar:En,det:cA,divideScalar:Xr,identity:Po,matrix:Qe,multiply:_r,typed:se,unaryMinus:Oa}),yA=Z1({DenseMatrix:er,Spa:gA,SparseMatrix:eo,abs:ii,addScalar:En,divideScalar:Xr,equalScalar:ar,larger:oi,matrix:Qe,multiplyScalar:cn,subtractScalar:Wi,typed:se,unaryMinus:Oa}),l4=cw({Complex:Or,add:lr,ctranspose:Nd,deepEqual:Id,divideScalar:Xr,dot:cf,dotDivide:Tl,equal:Yi,inv:_s,matrix:Qe,multiply:_r,typed:se}),ji=rx({Complex:Or,config:Ue,fraction:uu,identity:Po,inv:_s,matrix:Qe,multiply:_r,number:Ka,typed:se}),bA=p1({DenseMatrix:er,Index:Gn,compareNatural:Ra,size:Rn,subset:Fi,typed:se}),c4=y1({Index:Gn,concat:mr,setIntersect:bA,setSymDifference:hA,size:Rn,subset:Fi,typed:se}),f4=mw({abs:ii,add:lr,identity:Po,inv:_s,map:bs,max:Od,multiply:_r,size:Rn,sqrt:ha,subtract:fn,typed:se}),Rt=kx({BigNumber:tt,Complex:Or,Fraction:gs,abs:ii,addScalar:En,config:Ue,divideScalar:Xr,equal:Yi,fix:pA,format:El,isNumeric:xs,multiplyScalar:cn,number:Ka,pow:ji,round:lu,subtractScalar:Wi}),p4=T_({BigNumber:tt,Unit:Rt,config:Ue}),m4=cS({BigNumber:tt,Unit:Rt,config:Ue}),d4=Q_({BigNumber:tt,Unit:Rt,config:Ue}),h4=I_({BigNumber:tt,Unit:Rt,config:Ue}),g4=eS({BigNumber:tt,Unit:Rt,config:Ue}),v4=P_({BigNumber:tt,Unit:Rt,config:Ue}),y4=C_({BigNumber:tt,Unit:Rt,config:Ue}),b4=G_({BigNumber:tt,Unit:Rt,config:Ue}),x4=sx({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,pow:ji,typed:se}),w4=N_({BigNumber:tt,Unit:Rt,config:Ue}),_4=F_({BigNumber:tt,Unit:Rt,config:Ue}),S4=pw({abs:ii,add:lr,identity:Po,inv:_s,multiply:_r,typed:se}),A4=tS({BigNumber:tt,Unit:Rt,config:Ue}),xA=Vb({addScalar:En,ceil:Bd,conj:vs,divideScalar:Xr,dotDivide:Tl,exp:jS,i:HS,log2:ZS,matrix:Qe,multiplyScalar:cn,pow:ji,tau:WS,typed:se}),Rd=Ew({BigNumber:tt,Complex:Or,config:Ue,multiplyScalar:cn,pow:ji,typed:se}),M4=A_({BigNumber:tt,Unit:Rt,config:Ue}),E4=$_({BigNumber:tt,Unit:Rt,config:Ue}),D4=Ub({conj:vs,dotDivide:Tl,fft:xA,typed:se}),N4=R_({BigNumber:tt,Unit:Rt,config:Ue}),T4=nS({BigNumber:tt,Unit:Rt,config:Ue}),C4=D_({BigNumber:tt,Unit:Rt,config:Ue}),F4=fS({BigNumber:tt,Unit:Rt,config:Ue}),I4=aS({BigNumber:tt,Unit:Rt,config:Ue}),P4=W_({BigNumber:tt,Unit:Rt,config:Ue}),k4=O_({BigNumber:tt,Unit:Rt,config:Ue}),B4=vS({BigNumber:tt,Unit:Rt,config:Ue}),O4=dS({BigNumber:tt,Unit:Rt,config:Ue}),R4=yS({BigNumber:tt,Unit:Rt,config:Ue}),L4=H_({BigNumber:tt,Unit:Rt,config:Ue}),V4=Y_({BigNumber:tt,Unit:Rt,config:Ue}),U4=E_({BigNumber:tt,Unit:Rt,config:Ue}),q4=j_({BigNumber:tt,Unit:Rt,config:Ue}),z4=uS({BigNumber:tt,Unit:Rt,config:Ue}),$4=S_({BigNumber:tt,Unit:Rt,config:Ue}),H4=lS({BigNumber:tt,Unit:Rt,config:Ue}),G4=Z_({BigNumber:tt,Unit:Rt,config:Ue}),W4=K_({BigNumber:tt,Unit:Rt,config:Ue}),Y4=L_({BigNumber:tt,Unit:Rt,config:Ue}),j4=Rx({Unit:Rt,typed:se}),In=vw({divideScalar:Xr,equalScalar:ar,inv:_s,matrix:Qe,multiply:_r,typed:se}),Z4=U_({BigNumber:tt,Unit:Rt,config:Ue}),Fl=Nw({gamma:Rd,typed:se}),J4=rS({BigNumber:tt,Unit:Rt,config:Ue}),X4=mS({BigNumber:tt,Unit:Rt,config:Ue}),Q4=k_({BigNumber:tt,Unit:Rt,config:Ue}),wA=ew({DenseMatrix:er,lsolve:nA,lup:yA,matrix:Qe,slu:uA,typed:se,usolve:Fd}),K4=B_({BigNumber:tt,Unit:Rt,config:Ue}),eV=pS({BigNumber:tt,Unit:Rt,config:Ue}),tV=Cw({add:lr,divide:In,factorial:Fl,isInteger:yi,isPositive:ys,multiply:_r,typed:se}),rV=Fw({factorial:Fl,typed:se}),nV=hS({BigNumber:tt,Unit:Rt,config:Ue}),iV=tw({add:lr,cbrt:tA,divide:In,equalScalar:ar,im:Md,isZero:da,multiply:_r,re:Ed,sqrt:ha,subtract:fn,typeOf:XS,typed:se,unaryMinus:Oa}),aV=g1({compareNatural:Ra,typed:se}),oV=$b({abs:ii,add:lr,bignumber:Ci,divide:In,isNegative:Io,isPositive:ys,larger:oi,map:bs,matrix:Qe,max:Od,multiply:_r,smaller:ai,subtract:fn,typed:se,unaryMinus:Oa}),_A=zw({bignumber:Ci,addScalar:En,combinations:af,divideScalar:Xr,factorial:Fl,isInteger:yi,isNegative:Io,larger:oi,multiplyScalar:cn,number:Ka,pow:ji,subtractScalar:Wi,typed:se}),sV=Bx({Unit:Rt,typed:se}),uV=$w({addScalar:En,isInteger:yi,isNegative:Io,stirlingS2:_A,typed:se}),SA=fw({abs:ii,add:lr,addScalar:En,atan:YS,bignumber:Ci,column:vA,complex:of,config:Ue,cos:Sd,diag:rA,divideScalar:Xr,dot:cf,equal:Yi,flatten:Cl,im:Md,inv:_s,larger:oi,matrix:Qe,matrixFromColumns:Td,multiply:_r,multiplyScalar:cn,number:Ka,qr:Cd,re:Ed,reshape:KS,sin:uf,size:Rn,smaller:ai,sqrt:ha,subtract:fn,typed:se,usolve:Fd,usolveAll:lA}),lV=q_({BigNumber:tt,Unit:Rt,config:Ue}),cV=iS({BigNumber:tt,Unit:Rt,config:Ue}),fV=Tw({divide:In,dotDivide:Tl,isNumeric:xs,log:Pd,map:bs,matrix:Qe,multiply:_r,sum:kd,typed:se}),AA=Xc({add:lr,divide:In,typed:se}),pV=oS({BigNumber:tt,Unit:Rt,config:Ue}),mV=M_({BigNumber:tt,Unit:Rt,config:Ue}),dV=Kc({bignumber:Ci,add:lr,compare:ws,divide:In,isInteger:yi,larger:oi,multiply:_r,partitionSelect:ff,smaller:ai,smallerEq:cu,subtract:fn,typed:se}),Ld=Qc({add:lr,apply:Dd,divide:In,isNaN:Dl,multiply:_r,subtract:fn,typed:se}),hV=V_({BigNumber:tt,Unit:Rt,config:Ue}),MA=xw({add:lr,compare:ws,divide:In,partitionSelect:ff,typed:se}),gV=Sw({add:lr,divide:In,matrix:Qe,mean:AA,multiply:_r,pow:ji,sqrt:ha,subtract:fn,sum:kd,typed:se}),vV=n_({Complex:Or,add:lr,divide:In,matrix:Qe,multiply:_r,typed:se}),yV=ww({abs:ii,map:bs,median:MA,subtract:fn,typed:se}),bV=ef({map:bs,sqrt:ha,typed:se,variance:Ld}),xV=Gb({BigNumber:tt,Complex:Or,add:lr,config:Ue,divide:In,equal:Yi,factorial:Fl,gamma:Rd,isNegative:Io,multiply:_r,pi:wd,pow:ji,sin:uf,smallerEq:cu,subtract:fn,typed:se}),Vd=w1({abs:ii,add:lr,conj:vs,ctranspose:Nd,eigs:SA,equalScalar:ar,larger:oi,matrix:Qe,multiply:_r,pow:ji,smaller:ai,sqrt:ha,typed:se}),EA=Pb({BigNumber:tt,DenseMatrix:er,SparseMatrix:eo,addScalar:En,config:Ue,cos:Sd,matrix:Qe,multiplyScalar:cn,norm:Vd,sin:uf,typed:se,unaryMinus:Oa}),wV=gS({BigNumber:tt,Unit:Rt,config:Ue}),DA=hw({identity:Po,matrix:Qe,multiply:_r,norm:Vd,qr:Cd,subtract:fn,typed:se}),_V=Ib({multiply:_r,rotationMatrix:EA,typed:se}),NA=dw({abs:ii,add:lr,concat:mr,identity:Po,index:mA,lusolve:wA,matrix:Qe,matrixFromColumns:Td,multiply:_r,range:fu,schur:DA,subset:Fi,subtract:fn,transpose:Nl,typed:se}),SV=gw({matrix:Qe,multiply:_r,sylvester:NA,transpose:Nl,typed:se});var Il={},Pl={},AV={},si=M1({mathWithTransform:Pl}),kl=R1({Node:si}),ko=L1({Node:si}),pu=V1({Node:si}),MV=q1({Node:si}),Bl=D1({Node:si}),EV=T1({Node:si,ResultSet:GS}),DV=C1({Node:si}),Ss=k1({Node:si}),NV=U1({Node:si}),mee=i_({classes:AV}),TA=nw({math:Il,typed:se}),TV=B1({Node:si,typed:se}),dee=sw({Chain:TA,typed:se}),Ol=O1({Node:si,size:Rn}),Rl=E1({Node:si,subset:Fi}),CV=N1({matrix:Qe,Node:si,subset:Fi}),As=z1({Unit:Rt,Node:si,math:Il}),Ms=$1({Node:si,SymbolNode:As,math:Il}),to=H1({AccessorNode:Rl,ArrayNode:Bl,AssignmentNode:CV,BlockNode:EV,ConditionalNode:DV,ConstantNode:Ss,FunctionAssignmentNode:TV,FunctionNode:Ms,IndexNode:Ol,ObjectNode:kl,OperatorNode:ko,ParenthesisNode:pu,RangeNode:NV,RelationalNode:MV,SymbolNode:As,config:Ue,numeric:ga,typed:se}),FV=Qw({ConstantNode:Ss,FunctionNode:Ms,OperatorNode:ko,ParenthesisNode:pu,parse:to,typed:se}),CA=Jw({bignumber:Ci,fraction:uu,AccessorNode:Rl,ArrayNode:Bl,ConstantNode:Ss,FunctionNode:Ms,IndexNode:Ol,ObjectNode:kl,OperatorNode:ko,SymbolNode:As,config:Ue,mathWithTransform:Pl,matrix:Qe,typed:se}),FA=G1({parse:to,typed:se}),IA=Xw({AccessorNode:Rl,ArrayNode:Bl,ConstantNode:Ss,FunctionNode:Ms,IndexNode:Ol,ObjectNode:kl,OperatorNode:ko,ParenthesisNode:pu,SymbolNode:As,add:lr,divide:In,equal:Yi,isZero:da,multiply:_r,parse:to,pow:ji,subtract:fn,typed:se}),PA=W1({parse:to,typed:se}),IV=rw({evaluate:PA}),PV=Y1({evaluate:PA}),Ud=Zw({bignumber:Ci,fraction:uu,AccessorNode:Rl,ArrayNode:Bl,ConstantNode:Ss,FunctionNode:Ms,IndexNode:Ol,ObjectNode:kl,OperatorNode:ko,ParenthesisNode:pu,SymbolNode:As,add:lr,config:Ue,divide:In,equal:Yi,isZero:da,mathWithTransform:Pl,matrix:Qe,multiply:_r,parse:to,pow:ji,resolve:FV,simplifyConstant:CA,simplifyCore:IA,subtract:fn,typed:se}),hee=Kw({OperatorNode:ko,parse:to,simplify:Ud,typed:se}),gee=Ww({parse:to,typed:se}),vee=j1({Parser:PV,typed:se}),yee=t_({bignumber:Ci,fraction:uu,AccessorNode:Rl,ArrayNode:Bl,ConstantNode:Ss,FunctionNode:Ms,IndexNode:Ol,ObjectNode:kl,OperatorNode:ko,ParenthesisNode:pu,SymbolNode:As,add:lr,config:Ue,divide:In,equal:Yi,isZero:da,mathWithTransform:Pl,matrix:Qe,multiply:_r,parse:to,pow:ji,simplify:Ud,simplifyConstant:CA,simplifyCore:IA,subtract:fn,typed:se}),bee=e_({ConstantNode:Ss,FunctionNode:Ms,OperatorNode:ko,ParenthesisNode:pu,SymbolNode:As,config:Ue,equal:Yi,isZero:da,numeric:ga,parse:to,simplify:Ud,typed:se}),xee=ow({Help:IV,mathWithTransform:Pl,typed:se});zr(Il,{e:$S,false:aL,fineStructure:oL,i:HS,Infinity:sL,LN10:uL,LOG10E:lL,NaN:cL,null:fL,phi:pL,SQRT1_2:dL,sackurTetrode:hL,tau:WS,true:gL,E:$S,version:vL,efimovFactor:yL,LN2:bL,pi:wd,replacer:xL,reviver:mee,SQRT2:wL,typed:se,unaryPlus:_d,PI:wd,weakMixingAngle:_L,abs:ii,acos:SL,acot:AL,acsc:ML,addScalar:En,arg:EL,asech:DL,asinh:NL,atan:YS,atanh:TL,bignumber:Ci,bitNot:CL,boolean:FL,clone:IL,combinations:af,complex:of,conj:vs,cos:Sd,cot:PL,csc:kL,cube:BL,equalScalar:ar,erf:OL,exp:jS,expm1:RL,filter:LL,forEach:VL,format:El,getMatrixDataType:Ad,hex:UL,im:Md,isInteger:yi,isNegative:Io,isPositive:ys,isZero:da,LOG2E:qL,lgamma:zL,log10:$L,log2:ZS,map:bs,multiplyScalar:cn,not:sf,number:Ka,oct:HL,pickRandom:GL,print:WL,random:YL,re:Ed,sec:jL,sign:JS,sin:uf,splitUnit:ZL,square:JL,string:XL,subtractScalar:Wi,tan:QL,typeOf:XS,acosh:KL,acsch:e3,apply:Dd,asec:t3,bin:r3,chain:dee,combinationsWithRep:n3,cosh:i3,csch:a3,isNaN:Dl,isPrime:o3,randomInt:s3,sech:u3,sinh:l3,sparse:c3,sqrt:ha,tanh:f3,unaryMinus:Oa,acoth:p3,coth:m3,fraction:uu,isNumeric:xs,matrix:Qe,matrixFromFunction:d3,mode:h3,numeric:ga,prod:QS,reshape:KS,size:Rn,squeeze:g3,transpose:Nl,xgcd:eA,zeros:Ln,asin:v3,cbrt:tA,concat:mr,count:y3,ctranspose:Nd,diag:rA,divideScalar:Xr,dotDivide:Tl,equal:Yi,flatten:Cl,hasNumericValue:b3,identity:Po,kron:x3,largerEq:lf,leftShift:w3,lsolve:nA,matrixFromColumns:Td,nthRoot:_3,ones:S3,qr:Cd,resize:A3,rightArithShift:M3,round:lu,smaller:ai,subtract:fn,to:E3,unequal:D3,usolve:Fd,xor:N3,add:lr,atan2:T3,bitAnd:C3,bitOr:F3,bitXor:I3,catalan:P3,compare:ws,compareText:iA,cumsum:k3,deepEqual:Id,diff:B3,distance:O3,dot:cf,equalText:R3,floor:aA,gcd:L3,hypot:V3,larger:oi,log:Pd,lsolveAll:U3,matrixFromRows:q3,min:z3,mod:sA,multiply:_r,nthRoots:$3,or:H3,partitionSelect:ff,rightLogShift:G3,slu:uA,subset:Fi,sum:kd,trace:W3,usolveAll:lA,zpk2tf:Y3,ceil:Bd,compareNatural:Ra,composition:j3,cross:Z3,det:cA,dotMultiply:J3,fix:pA,index:mA,intersect:X3,invmod:Q3,lcm:K3,log1p:e4,max:Od,setCartesian:t4,setDistinct:r4,setIsSubset:n4,setPowerset:i4,smallerEq:cu,sort:a4,and:o4,range:fu,row:s4,setDifference:dA,setMultiplicity:u4,setSymDifference:hA,column:vA,inv:_s,lup:yA,pinv:l4,pow:ji,setIntersect:bA,setUnion:c4,sqrtm:f4,vacuumImpedance:p4,wienDisplacement:m4,atomicMass:d4,bohrMagneton:h4,boltzmann:g4,conductanceQuantum:v4,coulomb:y4,deuteronMass:b4,dotPow:x4,electricConstant:w4,elementaryCharge:_4,expm:S4,faraday:A4,fft:xA,gamma:Rd,gravitationConstant:M4,hartreeEnergy:E4,ifft:D4,klitzing:N4,loschmidt:T4,magneticConstant:C4,molarMass:F4,molarPlanckConstant:I4,neutronMass:P4,nuclearMagneton:k4,planckCharge:B4,planckLength:O4,planckTemperature:R4,protonMass:L4,quantumOfCirculation:V4,reducedPlanckConstant:U4,rydberg:q4,secondRadiation:z4,speedOfLight:$4,stefanBoltzmann:H4,thomsonCrossSection:G4,avogadro:W4,bohrRadius:Y4,createUnit:j4,divide:In,electronMass:Z4,factorial:Fl,firstRadiation:J4,gravity:X4,inverseConductanceQuantum:Q4,lusolve:wA,magneticFluxQuantum:K4,molarMassC12:eV,multinomial:tV,parse:to,permutations:rV,planckMass:nV,polynomialRoot:iV,resolve:FV,setSize:aV,simplifyConstant:CA,solveODE:oV,stirlingS2:_A,unit:sV,bellNumbers:uV,compile:FA,eigs:SA,fermiCoupling:lV,gasConstant:cV,kldivergence:fV,mean:AA,molarVolume:pV,planckConstant:mV,quantileSeq:dV,simplifyCore:IA,variance:Ld,classicalElectronRadius:hV,evaluate:PA,median:MA,simplify:Ud,symbolicEqual:hee,corr:gV,freqz:vV,leafCount:gee,mad:yV,parser:vee,rationalize:yee,std:bV,zeta:xV,derivative:bee,norm:Vd,rotationMatrix:EA,help:xee,planckTime:wV,schur:DA,rotate:_V,sylvester:NA,lyap:SV,config:Ue});zr(Pl,Il,{filter:wS({typed:se}),forEach:_S({typed:se}),map:AS({typed:se}),apply:bS({isInteger:yi,typed:se}),or:US({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),and:VS({add:lr,concat:mr,equalScalar:ar,matrix:Qe,not:sf,typed:se,zeros:Ln}),concat:FS({isInteger:yi,matrix:Qe,typed:se}),max:MS({config:Ue,larger:oi,numeric:ga,typed:se}),print:LS({add:lr,matrix:Qe,typed:se,zeros:Ln}),bitAnd:qS({add:lr,concat:mr,equalScalar:ar,matrix:Qe,not:sf,typed:se,zeros:Ln}),diff:IS({bignumber:Ci,matrix:Qe,number:Ka,subtract:fn,typed:se}),min:DS({config:Ue,numeric:ga,smaller:ai,typed:se}),subset:CS({add:lr,matrix:Qe,typed:se,zeros:Ln}),bitOr:zS({DenseMatrix:er,concat:mr,equalScalar:ar,matrix:Qe,typed:se}),cumsum:OS({add:lr,typed:se,unaryPlus:_d}),index:SS({Index:Gn,getMatrixDataType:Ad}),sum:kS({add:lr,config:Ue,numeric:ga,typed:se}),range:NS({bignumber:Ci,matrix:Qe,add:lr,config:Ue,isPositive:ys,larger:oi,largerEq:lf,smaller:ai,smallerEq:cu,typed:se}),row:TS({Index:Gn,matrix:Qe,range:fu,typed:se}),column:xS({Index:Gn,matrix:Qe,range:fu,typed:se}),mean:ES({add:lr,divide:In,typed:se}),quantileSeq:BS({add:lr,bignumber:Ci,compare:ws,divide:In,isInteger:yi,larger:oi,multiply:_r,partitionSelect:ff,smaller:ai,smallerEq:cu,subtract:fn,typed:se}),variance:RS({add:lr,apply:Dd,divide:In,isNaN:Dl,multiply:_r,subtract:fn,typed:se}),std:PS({map:bs,sqrt:ha,typed:se,variance:Ld})});zr(AV,{BigNumber:tt,Complex:Or,Fraction:gs,Matrix:nf,Node:si,ObjectNode:kl,OperatorNode:ko,ParenthesisNode:pu,Range:mL,RelationalNode:MV,ResultSet:GS,ArrayNode:Bl,BlockNode:EV,ConditionalNode:DV,ConstantNode:Ss,DenseMatrix:er,RangeNode:NV,Chain:TA,FunctionAssignmentNode:TV,SparseMatrix:eo,IndexNode:Ol,ImmutableDenseMatrix:oA,Index:Gn,AccessorNode:Rl,AssignmentNode:CV,FibonacciHeap:fA,Spa:gA,Unit:Rt,SymbolNode:As,FunctionNode:Ms,Help:IV,Parser:PV});TA.createProxy(Il);var qd=class extends Ya{constructor(e){super(e),this.hidden=!1,this.hasError=!1}buildVariables(){let e=0;this.expressionStr="",this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let r={bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:`MB_VAR_${e}`};this.variables.push(r),this.expressionStr+=r.contextName,e+=1}else this.expressionStr+=t;this.expression=FA(this.expressionStr)}buildMathJSContext(){let e={};for(let t of this.variables??[])!t.contextName||!t.inputSignal||(e[t.contextName]=t.inputSignal.get()??"");return e}computeValue(){if(this.hasError=!1,!this.expression)return this.handleComputeError(new Sa({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:"expression is undefined"}));let e=this.buildMathJSContext();try{return Ui(this.expression.evaluate(e)?.toString())}catch(t){return t instanceof Error?this.handleComputeError(new Sa({errorLevel:"ERROR",effect:"failed to evaluate expression",cause:t,context:{expression:this.expressionStr,context:e}})):this.handleComputeError(new Error("failed to evaluate js expression because of: unexpected thrown value"))}}onInitialRender(e){}onRerender(e,t){this.hasError?mt.addClass(e,"mb-error"):mt.removeClass(e,"mb-error"),e.innerText=t}handleComputeError(e){return this.hasError=!0,console.warn(e),e.message}};var zd=class extends Ya{constructor(e){super(e),this.renderMarkdown=!1}buildVariables(){this.textParts=[];let e=0;this.variables=[];for(let t of this.mountable.getDeclaration().templateDeclaration??[])if(typeof t!="string"){let r={bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:`MB_VAR_${e}`};this.variables.push(r),this.textParts.push(e),e+=1}else this.textParts.push(t)}computeValue(){if(!this.textParts)throw new Sa({errorLevel:"CRITICAL",effect:"failed to evaluate text view field",cause:"content parts is undefined"});return this.textParts.map(e=>typeof e=="number"?wp(this.variables[e].inputSignal.get(),this.mountable.plugin.settings.viewFieldDisplayNullAsEmpty):e).join("")}onInitialRender(e){this.renderMarkdown=this.mountable.getArgument("renderMarkdown")?.value??!1,this.renderMarkdown&&mt.addClass(e,"mb-view-markdown")}async onRerender(e,t){this.renderMarkdown?(this.markdownUnloadCallback?.(),this.markdownUnloadCallback=await this.mountable.plugin.internal.renderMarkdown(t,e,this.mountable.getFilePath())):e.innerText=t}onUnmount(){super.onUnmount(),this.markdownUnloadCallback?.()}};function wee(n){let e,t,r;return{c(){e=ee("div"),t=ee("img"),q(t,"class","mb-image-card-image"),ia(t.src,r=n[0].internal.imagePathToUri(n[1]))||q(t,"src",r),q(t,"alt",n[1]),q(e,"class","mb-image-card")},m(i,a){J(i,e,a),K(e,t)},p(i,[a]){a&3&&!ia(t.src,r=i[0].internal.imagePathToUri(i[1]))&&q(t,"src",r),a&2&&q(t,"alt",i[1])},i:Ke,o:Ke,d(i){i&&Y(e)}}}function _ee(n,e,t){let{plugin:r}=e,{image:i}=e;return n.$$set=a=>{"plugin"in a&&t(0,r=a.plugin),"image"in a&&t(1,i=a.image)},[r,i]}var kA=class extends Pe{constructor(e){super(),Be(this,e,_ee,wee,ke,{plugin:0,image:1})}},kV=kA;function BV(n,e,t){let r=n.slice();return r[2]=e[t],r}function OV(n){let e,t;return e=new kV({props:{plugin:n[1],image:n[2]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),i&1&&(a.image=r[2]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function See(n){let e,t,r=ct(n[0]),i=[];for(let o=0;o<r.length;o+=1)i[o]=OV(BV(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){e=ee("div");for(let o=0;o<i.length;o+=1)i[o].c();q(e,"class","mb-image-card-grid")},m(o,u){J(o,e,u);for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(e,null);t=!0},p(o,[u]){if(u&3){r=ct(o[0]);let s;for(s=0;s<r.length;s+=1){let l=BV(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=OV(l),i[s].c(),j(i[s],1),i[s].m(e,null))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function Aee(n,e,t){let{images:r=[]}=e,{plugin:i}=e;return n.$$set=a=>{"images"in a&&t(0,r=a.images),"plugin"in a&&t(1,i=a.plugin)},[r,i]}var BA=class extends Pe{constructor(e){super(),Be(this,e,Aee,See,ke,{images:0,plugin:1})}},OA=BA;var $d=class extends Ya{constructor(e){super(e)}buildVariables(){let e=this.mountable.getDeclaration().templateDeclaration.filter(r=>typeof r=="string"?r:!0);if(e.length!==1)throw new Yo({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});let t=e[0];if(typeof t=="string")throw new Yo({errorLevel:"ERROR",effect:"can not create view field",cause:"image view filed only supports exactly a single bind target and not text content"});t.listenToChildren=!0,this.variables=[{bindTargetDeclaration:t,inputSignal:new Lr(void 0),uuid:Ir(),contextName:"MB_VAR_0"}]}computeValue(){if(this.variables.length!==1)throw new Sa({errorLevel:"CRITICAL",effect:"failed to evaluate image view field",cause:"there should be exactly one variable"});let t=this.variables[0].inputSignal.get();return typeof t=="string"?un.convertToLinkString(t):Array.isArray(t)?t.filter(i=>typeof i=="string").map(i=>un.convertToLinkString(i)).filter(i=>i!=="").join(", "):""}onInitialRender(e){this.component=new OA({target:e,props:{images:[],plugin:this.mountable.plugin}})}async onRerender(e,t){let r=un.parseLinkList(t);this.component?.$destroy(),this.component=new OA({target:e,props:{images:r.map(i=>i.target),plugin:this.mountable.plugin}})}onUnmount(){super.onUnmount(),this.component?.$destroy()}};var Hd=class{constructor(e){this.plugin=e}createViewField(e){let t=e.declaration.viewFieldType;if(t==="math")return new qd(e);if(t==="text")return new zd(e);if(t==="link")return new fm(e);if(t==="image")return new $d(e);}};var Es=class n{constructor(e){this.path=e}get(e){if(this.path.length===0)throw new Error("can not use empty path to access object");let t=this.path[0].get(e);for(let r of this.path.slice(1))t=r.get(t.child);return t}tryGet(e){try{return this.get(e)}catch{return}}set(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);for(let i of this.path.slice(1))r=i.get(r.child);r.access.set(r.parent,t)}setAndCreate(e,t){if(this.path.length===0)throw new Error("can not use empty path to access object");let r=this.path[0].get(e);r.child===void 0&&(r.access.set(r.parent,this.getNextPathElementValue(0,t)),r=r.access.get(r.parent));for(let i=1;i<this.path.length;i++)r=this.path[i].get(r.child),r.child===void 0&&(r.access.set(r.parent,this.getNextPathElementValue(i,t)),r=r.access.get(r.parent));r.access.set(r.parent,t)}getNextPathElement(e){return this.path[e+1]}getNextPathElementValue(e,t){let r=this.getNextPathElement(e);return r===void 0?t:r.type==="object"?{}:[]}toStringArray(){return this.path.map(e=>e.prop)}toString(){return this.toStringArray().join(".")}concat(e){return new n(this.path.concat(e.path))}compareDiffArray(e){let t=Math.min(this.path.length,e.length);for(let r=0;r<t;r++){let i=this.path[r],a=e[r];if(i.prop!==a.toString())return!1}return!0}};var Gd=class{constructor(e){this.plugin=e}fromString(e){return Tn($a,e)}fromStringAndValidate(e,t,r){return this.validate(e,this.fromString(e),t,r)}fromExistingDeclaration(e){if(e!==void 0)return{storageType:Vi(e.storageType),storagePath:Vi(e.storagePath),storageProp:e.storageProp.path.map(t=>({type:t.type,prop:Vi(t.prop)})),listenToChildren:e.listenToChildren}}validate(e,t,r,i){let a={};a.listenToChildren=t.listenToChildren,a.storageProp=new Es(t.storageProp.map(l=>new Hs(l.type,l.prop.value))),t.storageType===void 0?a.storageType=this.plugin.metadataManager.defaultSource:a.storageType=this.validateStorageType(t.storageType,e);let o=t.storagePath!==void 0,u=t.storagePath??{value:r},s=this.plugin.metadataManager.getSource(a.storageType);if(s===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"can not validate bind target",cause:`Source '${a.storageType}' not found. But validation was successful. This should not happen.`,context:{fullDeclaration:e,sources:[...this.plugin.metadataManager.sources.keys()]}});return a.storagePath=s.validateStoragePath(u,o,e,this),s.resolveBindTargetScope(a,i,this)}resolveScope(e,t){if(t===void 0)throw new _n("ERROR","Bind Target Scope Validator","Failed to resolve bind target scope, no scope provided");return e.storageType=t.scope.storageType,e.storagePath=t.scope.storagePath,e.storageProp=t.scope.storageProp.concat(e.storageProp),e}validateStorageType(e,t){for(let r of this.plugin.metadataManager.iterateSources())if(r===e.value)return r;throw new _n("ERROR","Bind Target Validator",`Encountered invalid identifier. Expected token to be a storage type but received '${e?.value}'.`,t,e?.position)}validateStoragePathAsFilePath(e,t){let r=e?.value;if(r===void 0)throw new _n("ERROR","Bind Target Validator","Failed to parse bind target. Bind target storage path is undefined.",t,e?.position);let i=this.plugin.internal.getFilePathByName(r);if(i===void 0)throw new _n("ERROR","Bind Target Validator",`Failed to parse bind target. Bind target file path '${r}' not found.`,t,e?.position);return i}};var Ll=class{constructor(){this.arguments=[]}add(e){this.arguments.push(e)}validate(){let e={};for(let t of Object.values(Zr))e[t]=0;for(let t of this.arguments){let r=t.getConfig();if(e[r.type]+=1,e[r.type]>1&&!r.allowMultiple)throw new Cr({errorLevel:"ERROR",effect:"failed to validate argument container",cause:`argument '${r.type}' does not allow duplicates`,docs:[qt.linkToSearch(r.type)]})}}mergeByOverride(e){for(let t of e.arguments){let r=t.getConfig();r.allowMultiple||(this.arguments=this.arguments.filter(i=>i.getConfig().type!==r.type)),this.arguments.push(t)}return this.validate(),this}mergeByThrow(e){for(let t of e.arguments){let r=t.getConfig();if(!r.allowMultiple&&this.arguments.filter(i=>i.getConfig().type===r.type).length>0)throw new Cr({errorLevel:"ERROR",effect:"failed to merge argument container",cause:"can not merge FieldArgumentContainers, since arguments overlap"});this.arguments.push(t)}return this.validate(),this}getAll(e){return this.arguments.filter(t=>t.getConfig().type===e)}get(e){return this.getAll(e).at(0)}};var Wd=class extends Ll{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Vl=class{parseValue(e){this.validateValues(e,this.getConfig().values),this._parseValue(e)}validateValues(e,t){if(t.find(r=>r.length===e.length)===void 0)throw new Cr({errorLevel:"WARNING",effect:`Failed to parse argument value for argument '${this.getConfig().type}'.`,cause:`Expected argument values to follow the form ${t.map(r=>r.length===0?"none":r.map(i=>`'${i.name}'`).join(", ")).join(" or ")}. Received arguments of length ${e.length}.`,docs:[qt.linkToSearch(this.getConfig().type)]})}isAllowed(e){return this.getConfig().allowedFieldTypes.length===0?!0:this.getConfig().allowedFieldTypes.includes(e)}getAllowedFieldsAsString(){return this.getConfig().allowedFieldTypes.length===0?"all":this.getConfig().allowedFieldTypes.join(", ")}};var dr=class extends Vl{};var Yd=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.addLabels}};var jd=class extends dr{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return yr.class}};var Zd=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=Ui(t[0].value)}getConfig(){return yr.defaultValue}};var Jd=class extends dr{constructor(){super(...arguments);this.value=void 0}_parseValue(t){if(this.value=Number.parseInt(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'limit' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.limit}};var Xd=class extends dr{constructor(){super(...arguments);this.value=100}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'maxValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.maxValue}};var Qd=class extends dr{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'minValue' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.minValue}};var Kd=class extends dr{constructor(){super(...arguments);this.value=!1}_parseValue(t){this.value=Ui(t[0].value)}getConfig(){return yr.offValue}};var eh=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=Ui(t[0].value)}getConfig(){return yr.onValue}};var th=class extends dr{constructor(){super(...arguments);this.value="";this.name=""}_parseValue(t){t.length===1?(this.value=Ui(t[0].value),this.name=t[0].value):t.length===2&&(this.value=Ui(t[0].value),this.name=t[1].value)}getConfig(){return yr.option}};var rh=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.optionQuery}};var nh=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.placeholder}};var ih=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.showcase}};var ah=class extends dr{constructor(){super(...arguments);this.value=0}_parseValue(t){if(this.value=Number.parseFloat(t[0].value),Number.isNaN(this.value))throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be of type number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]});if(this.value<=0)throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:"value of argument 'stepSize' must be a positive number",docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.stepSize}};var oh=class extends dr{constructor(){super(...arguments);this.value=""}_parseValue(t){this.value=t[0].value}getConfig(){return yr.title}};function RV(n,e,t){return t==="true"?`[[${n}|${e}]]`:t==="partial"?`[[${e}]]`:`${e}`}var sh=class extends dr{constructor(){super(...arguments);this.value="true"}_parseValue(t){let r=t[0]?.value.toLowerCase();if(r===void 0){this.value="true";return}if(r==="true"||r==="partial"||r==="false"){this.value=r;return}throw new Cr({errorLevel:"WARNING",effect:"failed to set value for input field argument",cause:`value of argument 'useLinks' must be one of ${AE(["true","partial","false"],i=>`'${i}'`,", ","or")}`,docs:[qt.linkToInputFieldArgument(this.getConfig().type)]})}getConfig(){return yr.useLinks}};var uh=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.multiLine}};var lh=class extends dr{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return yr.allowOther}};var LV={class:jd,addLabels:Yd,minValue:Qd,maxValue:Xd,stepSize:ah,option:th,title:oh,optionQuery:rh,showcase:ih,offValue:Kd,onValue:eh,defaultValue:Zd,placeholder:nh,useLinks:sh,limit:Jd,allowOther:lh,multiLine:uh},ch=class{static createInputFieldArgument(e){if(e in LV){let t=LV[e];if(t)return new t}throw new _a({errorLevel:"WARNING",effect:"can not crate input field argument",cause:`unknown argument '${e}'`})}};var fh=class{constructor(e,t,r){this.plugin=e,this.unvalidatedDeclaration=t,this.filePath=r,this.errorCollection=new Gt("input field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a={declarationString:this.unvalidatedDeclaration.declarationString,inputFieldType:t,bindTarget:r,argumentContainer:i,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(a),a}validateInputFieldType(){let e=this.unvalidatedDeclaration.inputFieldType;for(let t of Object.entries(Wo))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new _n("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(t){this.errorCollection.add(t)}}validateArguments(e){let t=new Wd;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=ch.createInputFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new _n("WARNING","Declaration Validator",`Failed to parse input field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" input fields.`,this.unvalidatedDeclaration.declarationString,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(Zr))if(t[1]===e.value)return t[1];return this.errorCollection.add(new _n("WARNING","Declaration Validator",`Encountered invalid identifier. Expected an input field argument type but received '${e.value}'.`,this.unvalidatedDeclaration.declarationString,e.position)),"invalid"}};var ui=wr(Ri()),Gr=wr(Ai());var Eee=Gr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},Zn.node(pi).trim(ui.P_UTILS.optionalWhitespace()).describe("input field type"),gc.trim(ui.P_UTILS.optionalWhitespace()).wrap(Gr.P.string("(").describe('arguments paren "("'),Gr.P.string(")").describe('arguments paren ")"')).trim(ui.P_UTILS.optionalWhitespace()).optional([]),Gr.P.sequence(Gr.P.string(":").trim(ui.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),$a).trim(ui.P_UTILS.optionalWhitespace()).optional()),VV=Gr.P.sequenceMap((n,e,t)=>{let r=t===void 0?void 0:t[1];return{inputFieldType:n,arguments:e,bindTarget:r}},Zn.node(pi).trim(ui.P_UTILS.optionalWhitespace()).optional().describe("input field type"),gc.trim(ui.P_UTILS.optionalWhitespace()).wrap(Gr.P.string("(").describe('arguments paren "("'),Gr.P.string(")").describe('arguments paren ")"')).trim(ui.P_UTILS.optionalWhitespace()).optional([]),Gr.P.sequence(Gr.P.string(":").trim(ui.P_UTILS.optionalWhitespace()).describe('bind target separator ":"'),$a).trim(ui.P_UTILS.optionalWhitespace()).optional()),UV=Gr.P.or(Gr.P.sequenceMap((n,e,t)=>(t.templateName=e,t),Gr.P.string("INPUT"),Gr.P.sequenceMap((n,e,t)=>e,Gr.P.string("["),UE.node(pi).trim(ui.P_UTILS.optionalWhitespace()).describe("template name"),Gr.P.string("]").skip(ui.P_UTILS.optionalWhitespace())),VV.wrap(Gr.P.string("["),Gr.P.string("]")),ui.P_UTILS.eof()),Gr.P.sequenceMap((n,e)=>e,Gr.P.string("INPUT"),Eee.wrap(Gr.P.string("["),Gr.P.string("]")),ui.P_UTILS.eof())),qV=Gr.P.sequenceMap((n,e)=>e,Gr.P.string("INPUT"),VV.wrap(Gr.P.string("["),Gr.P.string("]")),ui.P_UTILS.eof());var ph=class{constructor(e){this.plugin=e,this.templates=[]}fromString(e){let t=new Gt("InputField");try{let r=Tn(UV,e),i=this.partialToFullDeclaration(r,e,t);return i=this.applyTemplate(i),i}catch(r){t.add(r)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}fromStringAndValidate(e,t,r){return this.validate(this.fromString(e),t,r)}fromSimpleDeclaration(e){let t=new Gt("InputField");return{declarationString:void 0,inputFieldType:Vi(e.inputFieldType),bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.bindTarget),arguments:(e.arguments??[]).map(r=>({name:Vi(r.name),value:r.value.map(i=>Vi(i))})),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,r){return this.validate(this.fromSimpleDeclaration(e),t,r)}partialToFullDeclaration(e,t,r){return{...structuredClone(e),declarationString:t,errorCollection:r}}validate(e,t,r){return new fh(this.plugin,e,t).validate(r)}merge(e,t){let r;return e.bindTarget===void 0?r=t.bindTarget:(r=e.bindTarget,t.bindTarget?.storagePath!==void 0&&(r.storagePath=t.bindTarget.storagePath),t.bindTarget?.storageProp!==void 0&&(r.storageProp=t.bindTarget.storageProp)),{declarationString:t.declarationString,inputFieldType:t.inputFieldType??e.inputFieldType,bindTarget:r,arguments:t.arguments.concat(e.arguments).reduce((i,a)=>(i.find(o=>o.name===a.name)===void 0&&i.push(a),i),[]),errorCollection:new Gt("input field declaration").merge(e.errorCollection).merge(t.errorCollection)}}parseTemplateString(e){let t=new Gt("InputFieldParser");try{let r=Tn(qV,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,inputFieldType:{value:"invalid"},bindTarget:void 0,arguments:[],errorCollection:t}}parseTemplates(e){this.templates=[];let t=new Gt("input field template parser");for(let r of e){let i=this.parseTemplateString(r.declaration);t.merge(i.errorCollection);let a={name:r.name,template:i};this.templates.push(Fg(a))}return t}getTemplate(e){return this.templates.find(t=>t.name===e)?.template}applyTemplate(e){if(e.templateName===void 0)return e;let t=this.getTemplate(e.templateName.value);return t===void 0?(e.errorCollection.add(new _n("WARNING","Input Field Parser",`Invalid template name. Could not find 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(t,e)}};var mh=class extends Ll{getAll(e){return super.getAll(e)}get(e){return this.getAll(e).at(0)}};var Ds=class extends Vl{};var dh=class extends Ds{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Uu.hidden}};var hh=class extends Ds{constructor(){super(...arguments);this.value=!0}_parseValue(t){this.value=t[0]===void 0||t[0]?.value.toLowerCase()==="true"}getConfig(){return Uu.renderMarkdown}};var gh=class extends Ds{constructor(){super(...arguments);this.value=[]}_parseValue(t){this.value=t[0].value.split(" ")}getConfig(){return Uu.class}};var zV={renderMarkdown:hh,hidden:dh,class:gh},vh=class{static createViewFieldArgument(e){if(e in zV){let t=zV[e];if(t)return new t}throw new _a({errorLevel:"WARNING",effect:"can not crate view field argument",cause:`unknown argument '${e}'`})}};var yh=class{constructor(e,t,r){this.unvalidatedDeclaration=e,this.plugin=r,this.filePath=t,this.errorCollection=new Gt("view field declaration")}validate(e){let t=this.validateInputFieldType(),r=this.validateBindTarget(e),i=this.validateArguments(t),a=this.validateTemplateDeclaration(e),o={declarationString:this.unvalidatedDeclaration.declarationString,viewFieldType:t,writeToBindTarget:r,argumentContainer:i,templateDeclaration:a,errorCollection:this.errorCollection.merge(this.unvalidatedDeclaration.errorCollection)};return this.checkForDeprecation(o),o}validateInputFieldType(){let e=this.unvalidatedDeclaration.viewFieldType;if(e===void 0)return"math";for(let t of Object.entries(cc))if(t[1]===e?.value)return t[1];return this.errorCollection.add(new _n("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 t=new mh;for(let r of this.unvalidatedDeclaration.arguments){let i=this.validateArgumentType(r.name);if(i==="invalid")continue;let a=vh.createViewFieldArgument(i);if(!a.isAllowed(e)){this.errorCollection.add(new _n("WARNING","Declaration Validator",`Failed to parse view field arguments. Argument "${r.name.value}" is only applicable to "${a.getAllowedFieldsAsString()}" view fields.`,this.unvalidatedDeclaration.declarationString,r.name.position));continue}try{a.parseValue(r.value)}catch(o){this.errorCollection.add(o);continue}t.add(a)}try{t.validate()}catch(r){this.errorCollection.add(r)}return t}validateArgumentType(e){for(let t of Object.entries(qs))if(t[1]===e.value)return t[1];return this.errorCollection.add(new _n("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(t=>typeof t=="string"?t:this.plugin.api.bindTargetParser.validate(this.unvalidatedDeclaration.declarationString,t,this.filePath,e))??[]}catch(t){return this.errorCollection.add(t),[]}}};var bh=class{constructor(e){this.plugin=e}fromString(e){let t=new Gt("ViewFieldDeclaration");try{let r=Tn(WE,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,errorCollection:t,viewFieldType:{value:"invalid"},writeToBindTarget:void 0,arguments:[],templateDeclaration:[]}}fromStringAndValidate(e,t,r){return this.validate(this.fromString(e),t,r)}fromSimpleDeclaration(e){let t=new Gt("ViewFieldDeclaration");return{declarationString:void 0,templateDeclaration:(e.templateDeclaration??[]).map(r=>typeof r=="string"?r:this.plugin.api.bindTargetParser.fromExistingDeclaration(r)),viewFieldType:Vi(e.viewFieldType),arguments:(e.arguments??[]).map(r=>({name:Vi(r.name),value:r.value.map(i=>Vi(i))})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),errorCollection:t}}fromSimpleDeclarationAndValidate(e,t,r){return this.validate(this.fromSimpleDeclaration(e),t,r)}partialToFullDeclaration(e,t,r){return{...structuredClone(e),declarationString:t,errorCollection:r}}validate(e,t,r){return new yh(e,t,this.plugin).validate(r)}};var xh=class extends An{constructor(e,t,r,i,a){super(e,t,r),this.depth=i,this.content=a}async parseContent(){let e=this.content.split(`
`).map(a=>a.trim()).filter(a=>a.length>0);if(e.length===0)return"";if(e.length>1)throw new zs({errorLevel:"ERROR",effect:"can not create embed",cause:"embed may only contain one link"});let t=e[0],r=un.parseLink(t);if(!r.internal)throw new zs({errorLevel:"ERROR",effect:"can not create embed",cause:"embed link is not an internal link"});let i=this.plugin.internal.getFilePathByName(r.target,this.getFilePath());if(i===void 0)throw new zs({errorLevel:"ERROR",effect:"can not create embed",cause:"link target not found"});return await this.plugin.internal.readFilePath(i)}checkMaxDepth(){if(this.depth>$f)throw new zs({errorLevel:"ERROR",effect:"can not create embed",cause:"embed depth exceeds maximum"})}async renderContent(e){try{this.checkMaxDepth();let r=(await this.parseContent()).replace(/(```+|~~~+)meta-bind-embed.*/g,`$1meta-bind-embed-internal-${this.depth+1}`);this.markdownUnloadCallback=await this.plugin.internal.renderMarkdown(r,e,this.getFilePath())}catch(t){let r=new Gt("Embed");r.add(t),this.plugin.internal.createErrorIndicator(e,{errorCollection:r})}}onMount(e){console.debug("meta-bind | EmbedMountable >> mount",this.content),super.onMount(e),this.renderContent(e)}onUnmount(e){console.debug("meta-bind | EmbedMountable >> unmount",this.content),super.onUnmount(e),this.markdownUnloadCallback?.(),Yn(e,"Embed")}};var wh=class extends An{constructor(e,t,r){super(e,t,r)}onMount(e){console.debug("meta-bind | ExcludedMountable >> mount"),super.onMount(e),mt.empty(e),mt.createElement(e,"span",{text:"[META_BIND] This folder has been excluded in the settings",class:"mb-error"})}onUnmount(e){console.debug("meta-bind | ExcludedMountable >> unmount"),super.onUnmount(e),mt.empty(e),Yn(e,"Excluded")}};var s5=wr(Ri()),gf=wr(Ai());var Dr;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},n.getValidEnumValues=i=>{let a=n.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),o={};for(let u of a)o[u]=i[u];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(a){return i[a]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},n.find=(i,a)=>{for(let o of i)if(a(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}n.joinValues=r,n.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Dr||(Dr={}));var LA;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(LA||(LA={}));var dt=Dr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ns=n=>{switch(typeof n){case"undefined":return dt.undefined;case"string":return dt.string;case"number":return isNaN(n)?dt.nan:dt.number;case"boolean":return dt.boolean;case"function":return dt.function;case"bigint":return dt.bigint;case"symbol":return dt.symbol;case"object":return Array.isArray(n)?dt.array:n===null?dt.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?dt.promise:typeof Map<"u"&&n instanceof Map?dt.map:typeof Set<"u"&&n instanceof Set?dt.set:typeof Date<"u"&&n instanceof Date?dt.date:dt.object;default:return dt.unknown}},it=Dr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Dee=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),Zi=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let u=r,s=0;for(;s<o.path.length;){let l=o.path[s];s===o.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(t(o))):u[l]=u[l]||{_errors:[]},u=u[l],s++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,Dr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Zi.create=n=>new Zi(n);var pf=(n,e)=>{let t;switch(n.code){case it.invalid_type:n.received===dt.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case it.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Dr.jsonStringifyReplacer)}`;break;case it.unrecognized_keys:t=`Unrecognized key(s) in object: ${Dr.joinValues(n.keys,", ")}`;break;case it.invalid_union:t="Invalid input";break;case it.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Dr.joinValues(n.options)}`;break;case it.invalid_enum_value:t=`Invalid enum value. Expected ${Dr.joinValues(n.options)}, received '${n.received}'`;break;case it.invalid_arguments:t="Invalid function arguments";break;case it.invalid_return_type:t="Invalid function return type";break;case it.invalid_date:t="Invalid date";break;case it.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Dr.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case it.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case it.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case it.custom:t="Invalid input";break;case it.invalid_intersection_types:t="Intersection results could not be merged";break;case it.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case it.not_finite:t="Number must be finite";break;default:t=e.defaultError,Dr.assertNever(n)}return{message:t}},GV=pf;function Nee(n){GV=n}function Sh(){return GV}var Ah=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,a=[...t,...i.path||[]],o={...i,path:a},u="",s=r.filter(l=>!!l).slice().reverse();for(let l of s)u=l(o,{data:e,defaultError:u}).message;return{...i,path:a,message:i.message||u}},Tee=[];function wt(n,e){let t=Ah({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sh(),pf].filter(r=>!!r)});n.common.issues.push(t)}var li=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ir;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t)r.push({key:await i.key,value:await i.value});return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return ir;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},ir=Object.freeze({status:"aborted"}),WV=n=>({status:"dirty",value:n}),bi=n=>({status:"valid",value:n}),VA=n=>n.status==="aborted",UA=n=>n.status==="dirty",mf=n=>n.status==="valid",Mh=n=>typeof Promise<"u"&&n instanceof Promise,Pt;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Pt||(Pt={}));var va=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$V=(n,e)=>{if(mf(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Zi(n.common.issues);return this._error=t,this._error}}};function or(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,u)=>o.code!=="invalid_type"?{message:u.defaultError}:typeof u.data>"u"?{message:r??u.defaultError}:{message:t??u.defaultError},description:i}}var sr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ns(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ns(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new li,ctx:{common:e.parent.common,data:e.data,parsedType:Ns(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Mh(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let i={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ns(e)},a=this._parseSync({data:e,path:i.path,parent:i});return $V(i,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ns(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(Mh(i)?i:Promise.resolve(i));return $V(r,a)}refine(e,t){let r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{let o=e(i),u=()=>a.addIssue({code:it.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(s=>s?!0:(u(),!1)):o?!0:(u(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new Ji({schema:this,typeName:$t.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return La.create(this,this._def)}nullable(){return Ro.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Oo.create(this,this._def)}promise(){return Fs.create(this,this._def)}or(e){return bu.create([this,e],this._def)}and(e){return xu.create(this,e,this._def)}transform(e){return new Ji({...or(this._def),schema:this,typeName:$t.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Mu({...or(this._def),innerType:this,defaultValue:t,typeName:$t.ZodDefault})}brand(){return new Th({typeName:$t.ZodBranded,type:this,...or(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Gl({...or(this._def),innerType:this,catchValue:t,typeName:$t.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return df.create(this,e)}readonly(){return Yl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Cee=/^c[^\s-]{8,}$/i,Fee=/^[a-z][a-z0-9]*$/,Iee=/^[0-9A-HJKMNP-TV-Z]{26}$/,Pee=/^[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,kee=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bee="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",RA,Oee=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Ree=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lee=n=>n.precision?n.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`):n.precision===0?n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Vee(n,e){return!!((e==="v4"||!e)&&Oee.test(n)||(e==="v6"||!e)&&Ree.test(n))}var Ts=class n extends sr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dt.string){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.string,received:a.parsedType}),ir}let r=new li,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,u=e.data.length<a.value;(o||u)&&(i=this._getOrReturnCtx(e,i),o?wt(i,{code:it.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&wt(i,{code:it.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")kee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"email",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")RA||(RA=new RegExp(Bee,"u")),RA.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"emoji",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Pee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"uuid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Cee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"cuid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Fee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"cuid2",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Iee.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"ulid",code:it.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),wt(i,{validation:"url",code:it.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"regex",code:it.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Lee(a).test(e.data)||(i=this._getOrReturnCtx(e,i),wt(i,{code:it.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="ip"?Vee(e.data,a.version)||(i=this._getOrReturnCtx(e,i),wt(i,{validation:"ip",code:it.invalid_string,message:a.message}),r.dirty()):Dr.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:it.invalid_string,...Pt.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Pt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Pt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Pt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Pt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Pt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Pt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Pt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Pt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Pt.errToObj(t)})}nonempty(e){return this.min(1,Pt.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ts.create=n=>{var e;return new Ts({checks:[],typeName:$t.ZodString,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...or(n)})};function Uee(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,a=parseInt(n.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}var mu=class n extends sr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==dt.number){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.number,received:a.parsedType}),ir}let r,i=new li;for(let a of this._def.checks)a.kind==="int"?Dr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),wt(r,{code:it.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Uee(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_finite,message:a.message}),i.dirty()):Dr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pt.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Pt.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Pt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Pt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Dr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};mu.create=n=>new mu({checks:[],typeName:$t.ZodNumber,coerce:n?.coerce||!1,...or(n)});var du=class n extends sr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==dt.bigint){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.bigint,received:a.parsedType}),ir}let r,i=new li;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),wt(r,{code:it.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Dr.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pt.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Pt.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Pt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};du.create=n=>{var e;return new du({checks:[],typeName:$t.ZodBigInt,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...or(n)})};var hu=class extends sr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dt.boolean){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.boolean,received:r.parsedType}),ir}return bi(e.data)}};hu.create=n=>new hu({typeName:$t.ZodBoolean,coerce:n?.coerce||!1,...or(n)});var gu=class n extends sr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dt.date){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_type,expected:dt.date,received:a.parsedType}),ir}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return wt(a,{code:it.invalid_date}),ir}let r=new li,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),wt(i,{code:it.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Dr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Pt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Pt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};gu.create=n=>new gu({checks:[],coerce:n?.coerce||!1,typeName:$t.ZodDate,...or(n)});var ql=class extends sr{_parse(e){if(this._getType(e)!==dt.symbol){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.symbol,received:r.parsedType}),ir}return bi(e.data)}};ql.create=n=>new ql({typeName:$t.ZodSymbol,...or(n)});var vu=class extends sr{_parse(e){if(this._getType(e)!==dt.undefined){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.undefined,received:r.parsedType}),ir}return bi(e.data)}};vu.create=n=>new vu({typeName:$t.ZodUndefined,...or(n)});var yu=class extends sr{_parse(e){if(this._getType(e)!==dt.null){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.null,received:r.parsedType}),ir}return bi(e.data)}};yu.create=n=>new yu({typeName:$t.ZodNull,...or(n)});var Cs=class extends sr{constructor(){super(...arguments),this._any=!0}_parse(e){return bi(e.data)}};Cs.create=n=>new Cs({typeName:$t.ZodAny,...or(n)});var Bo=class extends sr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bi(e.data)}};Bo.create=n=>new Bo({typeName:$t.ZodUnknown,...or(n)});var Va=class extends sr{_parse(e){let t=this._getOrReturnCtx(e);return wt(t,{code:it.invalid_type,expected:dt.never,received:t.parsedType}),ir}};Va.create=n=>new Va({typeName:$t.ZodNever,...or(n)});var zl=class extends sr{_parse(e){if(this._getType(e)!==dt.undefined){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.void,received:r.parsedType}),ir}return bi(e.data)}};zl.create=n=>new zl({typeName:$t.ZodVoid,...or(n)});var Oo=class n extends sr{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==dt.array)return wt(t,{code:it.invalid_type,expected:dt.array,received:t.parsedType}),ir;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(o||u)&&(wt(t,{code:o?it.too_big:it.too_small,minimum:u?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(wt(t,{code:it.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(wt(t,{code:it.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,u)=>i.type._parseAsync(new va(t,o,t.path,u)))).then(o=>li.mergeArray(r,o));let a=[...t.data].map((o,u)=>i.type._parseSync(new va(t,o,t.path,u)));return li.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:Pt.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:Pt.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:Pt.toString(t)}})}nonempty(e){return this.min(1,e)}};Oo.create=(n,e)=>new Oo({type:n,minLength:null,maxLength:null,exactLength:null,typeName:$t.ZodArray,...or(e)});function Ul(n){if(n instanceof Ii){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=La.create(Ul(r))}return new Ii({...n._def,shape:()=>e})}else return n instanceof Oo?new Oo({...n._def,type:Ul(n.element)}):n instanceof La?La.create(Ul(n.unwrap())):n instanceof Ro?Ro.create(Ul(n.unwrap())):n instanceof ro?ro.create(n.items.map(e=>Ul(e))):n}var Ii=class n extends sr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Dr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==dt.object){let l=this._getOrReturnCtx(e);return wt(l,{code:it.invalid_type,expected:dt.object,received:l.parsedType}),ir}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),u=[];if(!(this._def.catchall instanceof Va&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||u.push(l);let s=[];for(let l of o){let c=a[l],f=i.data[l];s.push({key:{status:"valid",value:l},value:c._parse(new va(i,f,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Va){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of u)s.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(l==="strict")u.length>0&&(wt(i,{code:it.unrecognized_keys,keys:u}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of u){let f=i.data[c];s.push({key:{status:"valid",value:c},value:l._parse(new va(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of s){let f=await c.key;l.push({key:f,value:await c.value,alwaysSet:c.alwaysSet})}return l}).then(l=>li.mergeObjectSync(r,l)):li.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(e){return Pt.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,a,o,u;let s=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(u=Pt.errToObj(e).message)!==null&&u!==void 0?u:s}:{message:s}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$t.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};return Dr.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}omit(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new n({...this._def,shape:()=>t})}deepPartial(){return Ul(this)}partial(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new n({...this._def,shape:()=>t})}required(e){let t={};return Dr.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof La;)a=a._def.innerType;t[r]=a}}),new n({...this._def,shape:()=>t})}keyof(){return YV(Dr.objectKeys(this.shape))}};Ii.create=(n,e)=>new Ii({shape:()=>n,unknownKeys:"strip",catchall:Va.create(),typeName:$t.ZodObject,...or(e)});Ii.strictCreate=(n,e)=>new Ii({shape:()=>n,unknownKeys:"strict",catchall:Va.create(),typeName:$t.ZodObject,...or(e)});Ii.lazycreate=(n,e)=>new Ii({shape:n,unknownKeys:"strip",catchall:Va.create(),typeName:$t.ZodObject,...or(e)});var bu=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(a){for(let u of a)if(u.result.status==="valid")return u.result;for(let u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let o=a.map(u=>new Zi(u.ctx.common.issues));return wt(t,{code:it.invalid_union,unionErrors:o}),ir}if(t.common.async)return Promise.all(r.map(async a=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let s of r){let l={...t,common:{...t.common,issues:[]},parent:null},c=s._parseSync({data:t.data,path:t.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let u=o.map(s=>new Zi(s));return wt(t,{code:it.invalid_union,unionErrors:u}),ir}}get options(){return this._def.options}};bu.create=(n,e)=>new bu({options:n,typeName:$t.ZodUnion,...or(e)});var _h=n=>n instanceof wu?_h(n.schema):n instanceof Ji?_h(n.innerType()):n instanceof _u?[n.value]:n instanceof Su?n.options:n instanceof Au?Object.keys(n.enum):n instanceof Mu?_h(n._def.innerType):n instanceof vu?[void 0]:n instanceof yu?[null]:null,Eh=class n extends sr{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.object)return wt(t,{code:it.invalid_type,expected:dt.object,received:t.parsedType}),ir;let r=this.discriminator,i=t.data[r],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(wt(t,{code:it.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ir)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let a of t){let o=_h(a.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of o){if(i.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);i.set(u,a)}}return new n({typeName:$t.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...or(r)})}};function qA(n,e){let t=Ns(n),r=Ns(e);if(n===e)return{valid:!0,data:n};if(t===dt.object&&r===dt.object){let i=Dr.objectKeys(e),a=Dr.objectKeys(n).filter(u=>i.indexOf(u)!==-1),o={...n,...e};for(let u of a){let s=qA(n[u],e[u]);if(!s.valid)return{valid:!1};o[u]=s.data}return{valid:!0,data:o}}else if(t===dt.array&&r===dt.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<n.length;a++){let o=n[a],u=e[a],s=qA(o,u);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}else return t===dt.date&&r===dt.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var xu=class extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(VA(a)||VA(o))return ir;let u=qA(a.value,o.value);return u.valid?((UA(a)||UA(o))&&t.dirty(),{status:t.value,value:u.data}):(wt(r,{code:it.invalid_intersection_types}),ir)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};xu.create=(n,e,t)=>new xu({left:n,right:e,typeName:$t.ZodIntersection,...or(t)});var ro=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.array)return wt(r,{code:it.invalid_type,expected:dt.array,received:r.parsedType}),ir;if(r.data.length<this._def.items.length)return wt(r,{code:it.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ir;!this._def.rest&&r.data.length>this._def.items.length&&(wt(r,{code:it.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((o,u)=>{let s=this._def.items[u]||this._def.rest;return s?s._parse(new va(r,o,r.path,u)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>li.mergeArray(t,o)):li.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};ro.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ro({items:n,typeName:$t.ZodTuple,rest:null,...or(e)})};var Dh=class n extends sr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.object)return wt(r,{code:it.invalid_type,expected:dt.object,received:r.parsedType}),ir;let i=[],a=this._def.keyType,o=this._def.valueType;for(let u in r.data)i.push({key:a._parse(new va(r,u,r.path,u)),value:o._parse(new va(r,r.data[u],r.path,u))});return r.common.async?li.mergeObjectAsync(t,i):li.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof sr?new n({keyType:e,valueType:t,typeName:$t.ZodRecord,...or(r)}):new n({keyType:Ts.create(),valueType:e,typeName:$t.ZodRecord,...or(t)})}},$l=class extends sr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.map)return wt(r,{code:it.invalid_type,expected:dt.map,received:r.parsedType}),ir;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([u,s],l)=>({key:i._parse(new va(r,u,r.path,[l,"key"])),value:a._parse(new va(r,s,r.path,[l,"value"]))}));if(r.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let s of o){let l=await s.key,c=await s.value;if(l.status==="aborted"||c.status==="aborted")return ir;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),u.set(l.value,c.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let s of o){let l=s.key,c=s.value;if(l.status==="aborted"||c.status==="aborted")return ir;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),u.set(l.value,c.value)}return{status:t.value,value:u}}}};$l.create=(n,e,t)=>new $l({valueType:e,keyType:n,typeName:$t.ZodMap,...or(t)});var Hl=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.set)return wt(r,{code:it.invalid_type,expected:dt.set,received:r.parsedType}),ir;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(wt(r,{code:it.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(wt(r,{code:it.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let a=this._def.valueType;function o(s){let l=new Set;for(let c of s){if(c.status==="aborted")return ir;c.status==="dirty"&&t.dirty(),l.add(c.value)}return{status:t.value,value:l}}let u=[...r.data.values()].map((s,l)=>a._parse(new va(r,s,r.path,l)));return r.common.async?Promise.all(u).then(s=>o(s)):o(u)}min(e,t){return new n({...this._def,minSize:{value:e,message:Pt.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:Pt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Hl.create=(n,e)=>new Hl({valueType:n,minSize:null,maxSize:null,typeName:$t.ZodSet,...or(e)});var Nh=class n extends sr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.function)return wt(t,{code:it.invalid_type,expected:dt.function,received:t.parsedType}),ir;function r(u,s){return Ah({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Sh(),pf].filter(l=>!!l),issueData:{code:it.invalid_arguments,argumentsError:s}})}function i(u,s){return Ah({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Sh(),pf].filter(l=>!!l),issueData:{code:it.invalid_return_type,returnTypeError:s}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Fs){let u=this;return bi(async function(...s){let l=new Zi([]),c=await u._def.args.parseAsync(s,a).catch(m=>{throw l.addIssue(r(s,m)),l}),f=await Reflect.apply(o,this,c);return await u._def.returns._def.type.parseAsync(f,a).catch(m=>{throw l.addIssue(i(f,m)),l})})}else{let u=this;return bi(function(...s){let l=u._def.args.safeParse(s,a);if(!l.success)throw new Zi([r(s,l.error)]);let c=Reflect.apply(o,this,l.data),f=u._def.returns.safeParse(c,a);if(!f.success)throw new Zi([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ro.create(e).rest(Bo.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||ro.create([]).rest(Bo.create()),returns:t||Bo.create(),typeName:$t.ZodFunction,...or(r)})}},wu=class extends sr{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};wu.create=(n,e)=>new wu({getter:n,typeName:$t.ZodLazy,...or(e)});var _u=class extends sr{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return wt(t,{received:t.data,code:it.invalid_literal,expected:this._def.value}),ir}return{status:"valid",value:e.data}}get value(){return this._def.value}};_u.create=(n,e)=>new _u({value:n,typeName:$t.ZodLiteral,...or(e)});function YV(n,e){return new Su({values:n,typeName:$t.ZodEnum,...or(e)})}var Su=class n extends sr{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return wt(t,{expected:Dr.joinValues(r),received:t.parsedType,code:it.invalid_type}),ir}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return wt(t,{received:t.data,code:it.invalid_enum_value,options:r}),ir}return bi(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return n.create(e)}exclude(e){return n.create(this.options.filter(t=>!e.includes(t)))}};Su.create=YV;var Au=class extends sr{_parse(e){let t=Dr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==dt.string&&r.parsedType!==dt.number){let i=Dr.objectValues(t);return wt(r,{expected:Dr.joinValues(i),received:r.parsedType,code:it.invalid_type}),ir}if(t.indexOf(e.data)===-1){let i=Dr.objectValues(t);return wt(r,{received:r.data,code:it.invalid_enum_value,options:i}),ir}return bi(e.data)}get enum(){return this._def.values}};Au.create=(n,e)=>new Au({values:n,typeName:$t.ZodNativeEnum,...or(e)});var Fs=class extends sr{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dt.promise&&t.common.async===!1)return wt(t,{code:it.invalid_type,expected:dt.promise,received:t.parsedType}),ir;let r=t.parsedType===dt.promise?t.data:Promise.resolve(t.data);return bi(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Fs.create=(n,e)=>new Fs({type:n,typeName:$t.ZodPromise,...or(e)});var Ji=class extends sr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$t.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{wt(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(o).then(u=>this._def.schema._parseAsync({data:u,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}if(i.type==="refinement"){let o=u=>{let s=i.refinement(u,a);if(r.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?ir:(u.status==="dirty"&&t.dirty(),o(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?ir:(u.status==="dirty"&&t.dirty(),o(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mf(o))return o;let u=i.transform(o.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>mf(o)?Promise.resolve(i.transform(o.value,a)).then(u=>({status:t.value,value:u})):o);Dr.assertNever(i)}};Ji.create=(n,e,t)=>new Ji({schema:n,typeName:$t.ZodEffects,effect:e,...or(t)});Ji.createWithPreprocess=(n,e,t)=>new Ji({schema:e,effect:{type:"preprocess",transform:n},typeName:$t.ZodEffects,...or(t)});var La=class extends sr{_parse(e){return this._getType(e)===dt.undefined?bi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};La.create=(n,e)=>new La({innerType:n,typeName:$t.ZodOptional,...or(e)});var Ro=class extends sr{_parse(e){return this._getType(e)===dt.null?bi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ro.create=(n,e)=>new Ro({innerType:n,typeName:$t.ZodNullable,...or(e)});var Mu=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===dt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Mu.create=(n,e)=>new Mu({innerType:n,typeName:$t.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...or(e)});var Gl=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Mh(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Gl.create=(n,e)=>new Gl({innerType:n,typeName:$t.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...or(e)});var Wl=class extends sr{_parse(e){if(this._getType(e)!==dt.nan){let r=this._getOrReturnCtx(e);return wt(r,{code:it.invalid_type,expected:dt.nan,received:r.parsedType}),ir}return{status:"valid",value:e.data}}};Wl.create=n=>new Wl({typeName:$t.ZodNaN,...or(n)});var qee=Symbol("zod_brand"),Th=class extends sr{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},df=class n extends sr{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ir:a.status==="dirty"?(t.dirty(),WV(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ir:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:$t.ZodPipeline})}},Yl=class extends sr{_parse(e){let t=this._def.innerType._parse(e);return mf(t)&&(t.value=Object.freeze(t.value)),t}};Yl.create=(n,e)=>new Yl({innerType:n,typeName:$t.ZodReadonly,...or(e)});var jV=(n,e={},t)=>n?Cs.create().superRefine((r,i)=>{var a,o;if(!n(r)){let u=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,s=(o=(a=u.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0,l=typeof u=="string"?{message:u}:u;i.addIssue({code:"custom",...l,fatal:s})}}):Cs.create(),zee={object:Ii.lazycreate},$t;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})($t||($t={}));var $ee=(n,e={message:`Input not instance of ${n.name}`})=>jV(t=>t instanceof n,e),ZV=Ts.create,JV=mu.create,Hee=Wl.create,Gee=du.create,XV=hu.create,Wee=gu.create,Yee=ql.create,jee=vu.create,Zee=yu.create,Jee=Cs.create,Xee=Bo.create,Qee=Va.create,Kee=zl.create,ete=Oo.create,tte=Ii.create,rte=Ii.strictCreate,nte=bu.create,ite=Eh.create,ate=xu.create,ote=ro.create,ste=Dh.create,ute=$l.create,lte=Hl.create,cte=Nh.create,fte=wu.create,pte=_u.create,mte=Su.create,dte=Au.create,hte=Fs.create,HV=Ji.create,gte=La.create,vte=Ro.create,yte=Ji.createWithPreprocess,bte=df.create,xte=()=>ZV().optional(),wte=()=>JV().optional(),_te=()=>XV().optional(),Ste={string:n=>Ts.create({...n,coerce:!0}),number:n=>mu.create({...n,coerce:!0}),boolean:n=>hu.create({...n,coerce:!0}),bigint:n=>du.create({...n,coerce:!0}),date:n=>gu.create({...n,coerce:!0})},Ate=ir,we=Object.freeze({__proto__:null,defaultErrorMap:pf,setErrorMap:Nee,getErrorMap:Sh,makeIssue:Ah,EMPTY_PATH:Tee,addIssueToContext:wt,ParseStatus:li,INVALID:ir,DIRTY:WV,OK:bi,isAborted:VA,isDirty:UA,isValid:mf,isAsync:Mh,get util(){return Dr},get objectUtil(){return LA},ZodParsedType:dt,getParsedType:Ns,ZodType:sr,ZodString:Ts,ZodNumber:mu,ZodBigInt:du,ZodBoolean:hu,ZodDate:gu,ZodSymbol:ql,ZodUndefined:vu,ZodNull:yu,ZodAny:Cs,ZodUnknown:Bo,ZodNever:Va,ZodVoid:zl,ZodArray:Oo,ZodObject:Ii,ZodUnion:bu,ZodDiscriminatedUnion:Eh,ZodIntersection:xu,ZodTuple:ro,ZodRecord:Dh,ZodMap:$l,ZodSet:Hl,ZodFunction:Nh,ZodLazy:wu,ZodLiteral:_u,ZodEnum:Su,ZodNativeEnum:Au,ZodPromise:Fs,ZodEffects:Ji,ZodTransformer:Ji,ZodOptional:La,ZodNullable:Ro,ZodDefault:Mu,ZodCatch:Gl,ZodNaN:Wl,BRAND:qee,ZodBranded:Th,ZodPipeline:df,ZodReadonly:Yl,custom:jV,Schema:sr,ZodSchema:sr,late:zee,get ZodFirstPartyTypeKind(){return $t},coerce:Ste,any:Jee,array:ete,bigint:Gee,boolean:XV,date:Wee,discriminatedUnion:ite,effect:HV,enum:mte,function:cte,instanceof:$ee,intersection:ate,lazy:fte,literal:pte,map:ute,nan:Hee,nativeEnum:dte,never:Qee,null:Zee,nullable:vte,number:JV,object:tte,oboolean:_te,onumber:wte,optional:gte,ostring:xte,pipeline:bte,preprocess:yte,promise:hte,record:ste,set:lte,strictObject:rte,string:ZV,symbol:Yee,transformer:HV,tuple:ote,undefined:jee,union:nte,unknown:Xee,void:Kee,NEVER:Ate,ZodIssueCode:it,quotelessJson:Dee,ZodError:Zi});function e5(n,e){return(t,r)=>t[n]===void 0==(t[e]===void 0)?(r.addIssue({code:we.ZodIssueCode.custom,message:`Either ${n} or ${e} must be used, but not both.`}),!1):!0}function Lt(){return function(n){return n}}function Qr(n,e){let t=n.safeParse(e);if(!t.success)throw new Ut({errorLevel:"CRITICAL",effect:"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:t.error})}function t5(n,e){return n.safeParse(e,{errorMap:Ete})}var QV=["zeroth","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],KV=["twent","thirt","fort","fift","sixt","sevent","eight","ninet"];function Mte(n){return n<20?QV[n]:n%10===0?KV[Math.floor(n/10)-2]+"ieth":KV[Math.floor(n/10)-2]+"y-"+QV[n%10]}var Ete=(n,e)=>({message:`At '${n.path.map(r=>typeof r=="string"?r:Mte(r+1)+" element").join(" > ")}'. ${e.defaultError}`});function Ch(n,e,t){return we.number({required_error:`The ${n} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${n} action requires the value of the '${e}' fields to be a number.`})}function Wn(n,e,t){return we.string({required_error:`The ${n} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${n} action requires the value of the '${e}' fields to be a string.`})}function Eu(n,e,t){return we.boolean({required_error:`The ${n} action requires a specified ${t} with the '${e}' field.`,invalid_type_error:`The ${n} action requires the value of the '${e}' fields to be a boolean.`})}var Dte=Lt()(we.object({type:we.literal("command"),command:Wn("command","command","command to run")})),Nte=Lt()(we.object({type:we.literal("js"),file:Wn("js","file","file path to the file to run"),args:we.record(we.unknown()).optional()})),Tte=Lt()(we.object({type:we.literal("open"),link:Wn("open","link","link to open"),newTab:Eu("open","newTab","").optional()})),Cte=Lt()(we.object({type:we.literal("input"),str:Wn("input","str","value to input")})),Fte=Lt()(we.object({type:we.literal("sleep"),ms:Ch("sleep","ms","duration")})),Ite=Lt()(we.object({type:we.literal("templaterCreateNote"),templateFile:Wn("templaterCreateNote","templateFile","template file path"),folderPath:Wn("templaterCreateNote","folderPath","folder path").optional(),fileName:Wn("templaterCreateNote","fileName","file name").optional(),openNote:Eu("templaterCreateNote","openNote","value for whether to open the note").optional()})),Pte=Lt()(we.object({type:we.literal("updateMetadata"),bindTarget:Wn("updateMetadata","bindTarget","bind target to the metadata to update"),evaluate:Eu("updateMetadata","evaluate","value for whether to evaluate the value as a JavaScript expression"),value:we.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."})})),kte=Lt()(we.object({type:we.literal("createNote"),folderPath:Wn("createNote","folderPath","folder path").optional(),fileName:Wn("createNote","fileName","file name"),openNote:Eu("createNote","openNote","value for whether to open the note").optional()})),Bte=Lt()(we.object({type:we.literal("replaceInNote"),fromLine:Ch("replaceInNote","fromLine","line to replace from"),toLine:Ch("replaceInNote","toLine","line to replace to"),replacement:Wn("replaceInNote","replacement","replacement string"),templater:Eu("replaceInNote","templater","value for whether to use Templater").optional()})),Ote=Lt()(we.object({type:we.literal("replaceSelf"),replacement:Wn("replaceSelf","replacement","replacement string"),templater:Eu("replaceSelf","templater","value for whether to use Templater").optional()})),Rte=Lt()(we.object({type:we.literal("regexpReplaceInNote"),regexp:Wn("regexpReplaceInNote","regexp","search regular expression"),regexpFlags:Wn("regexpReplaceInNote","regexpFlags","regular expression flags string").optional(),replacement:Wn("regexpReplaceInNote","replacement","replacement string")})),Lte=Lt()(we.object({type:we.literal("insertIntoNote"),line:Ch("insertIntoNote","line","line to insert at"),value:Wn("insertIntoNote","value","string to insert"),templater:Eu("insertIntoNote","templater","value for whether to use Templater").optional()})),Vte=Lt()(we.object({type:we.literal("inlineJS"),code:Wn("inlineJS","code","code string to run")})),r5=Lt()(we.discriminatedUnion("type",[Dte,Nte,Tte,Cte,Fte,Ite,Pte,kte,Bte,Ote,Rte,Lte,Vte])),Ute=we.nativeEnum(tn),jl=Lt()(we.object({label:we.string(),icon:we.string().optional(),style:Ute,class:we.string().optional(),tooltip:we.string().optional(),id:we.string().optional(),hidden:we.boolean().optional(),action:r5.optional(),actions:r5.array().optional()}).superRefine(e5("action","actions")));var qte=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function n5(n){return n.length===1?n[0].toString():n.reduce((e,t)=>{if(typeof t=="number")return e+"["+t.toString()+"]";if(t.includes('"'))return e+'["'+zte(t)+'"]';if(!qte.test(t))return e+'["'+t+'"]';let r=e.length===0?"":".";return e+r+t},"")}function zte(n){return n.replace(/"/g,'\\"')}function i5(n){return n.length!==0}var $te=99,Hte="; ",Gte=", or ",a5="Validation error",Wte=": ",Fh=class extends Error{details;name;constructor(e,t=[]){super(e),this.details=t,this.name="ZodValidationError"}toString(){return this.message}};function o5(n){let{issue:e,issueSeparator:t,unionSeparator:r,includePath:i}=n;if(e.code==="invalid_union")return e.unionErrors.reduce((a,o)=>{let u=o.issues.map(s=>o5({issue:s,issueSeparator:t,unionSeparator:r,includePath:i})).join(t);return a.includes(u)||a.push(u),a},[]).join(r);if(i&&i5(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 "${n5(e.path)}"`}return e.message}function Yte(n,e,t){return e!==null?n.length>0?[e,n].join(t):e:n.length>0?n:a5}function hf(n,e={}){let{maxIssuesInMessage:t=$te,issueSeparator:r=Hte,unionSeparator:i=Gte,prefixSeparator:a=Wte,prefix:o=a5,includePath:u=!0}=e,s=n.errors.slice(0,t).map(c=>o5({issue:c,issueSeparator:r,unionSeparator:i,includePath:u})).join(r),l=Yte(s,o,a);return new Fh(l,n.errors)}var jte=gf.P.sequenceMap((n,e)=>e,gf.P.string("BUTTON"),gf.P.manyNotOf("[],^").separateBy(gf.P.string(",").trim(s5.P_UTILS.optionalWhitespace())).wrapString("[","]")),Ih=class{constructor(e){this.plugin=e}fromGroupString(e){let t=new Gt("ButtonGroup"),r=[];try{r=Tn(jte,e)}catch(i){t.add(i)}return{declarationString:e,referencedButtonIds:r,errorCollection:t}}validateGroup(e){return{declarationString:void 0,referencedButtonIds:e.referencedButtonIds,errorCollection:new Gt("ButtonGroup")}}fromString(e){let t=new Gt("Button"),r;try{let i=this.plugin.internal.parseYaml(e);r=this.validateConfig(i)}catch(i){t.add(i)}return{declarationString:e,config:r,errorCollection:t}}validateConfig(e){let t=t5(jl,e);if(!t.success){let r=hf(t.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null,includePath:!1});throw new bo({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:r.message,docs:[qt.linkToButtonConfig()]})}return t.data}validate(e){let t=new Gt("Button"),r;try{r=this.validateConfig(e)}catch(i){t.add(i)}return{declarationString:void 0,config:r,errorCollection:t}}};var Ph=class{constructor(e){this.plugin=e}fromString(e){let t=new Gt("JsViewFieldDeclaration");try{let r=Tn(YE,e);return this.partialToFullDeclaration(r,e,t)}catch(r){t.add(r)}return{declarationString:e,errorCollection:t,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}fromStringAndValidate(e,t){return this.validate(this.fromString(e),t)}fromSimpleDeclaration(e){let t=new Gt("JsViewFieldDeclaration");return{declarationString:void 0,code:e.code,bindTargetMappings:e.bindTargetMappings.map(r=>({bindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(r.bindTarget),name:r.name})),writeToBindTarget:this.plugin.api.bindTargetParser.fromExistingDeclaration(e.writeToBindTarget),hidden:e.hidden??!1,errorCollection:t}}fromSimpleDeclarationAndValidate(e,t){return this.validate(this.fromSimpleDeclaration(e),t)}partialToFullDeclaration(e,t,r){let i=e;return i.declarationString=t,i.errorCollection=r,i.bindTargetMappings=[...i.bindTargetMappings],i}validate(e,t){let r={};r.declarationString=e.declarationString,r.errorCollection=e.errorCollection;try{return r.bindTargetMappings=e.bindTargetMappings.map(i=>({bindTarget:this.plugin.api.bindTargetParser.validate(e.declarationString,i.bindTarget,t),name:i.name})),e.writeToBindTarget!==void 0&&(r.writeToBindTarget=this.plugin.api.bindTargetParser.validate(e.declarationString,e.writeToBindTarget,t)),r.code=e.code,r.hidden=e.hidden,r}catch(i){r.errorCollection.add(i)}return{declarationString:e.declarationString,errorCollection:r.errorCollection,bindTargetMappings:[],writeToBindTarget:void 0,hidden:!1,code:""}}};function kh(n){return new Es(n.map(e=>rD.tryParse(e).success?new Hs("array",e):new Hs("object",e)))}var Zl=class{constructor(e){this.scope=e}};var Qi=Lt()(we.string()),Jl=Lt()(we.nativeEnum(di)),vf=Lt()(we.nativeEnum(Xu)),l5=Lt()(we.nativeEnum(Wo)),c5=Lt()(we.instanceof(HTMLElement)),Xl=Lt()(we.instanceof(Zl)),wXe=Lt()(we.instanceof(Lr)),_Xe=Lt()(we.function().args().returns(we.void())),SXe=Lt()(we.instanceof(An)),f5=Lt()(we.instanceof(Jn)),p5=Lt()(we.instanceof(jo)),u5=Lt()(we.object({index:we.number(),line:we.number(),column:we.number()})),Zte=Lt()(we.object({from:u5,to:u5})),Is=Lt()(we.object({value:we.string(),position:Zte.optional()})),m5=Lt()(we.object({name:Is,value:Is.array()})),Jte=Lt()(we.object({type:we.nativeEnum(Gs),prop:Is})),zA=Lt()(we.object({storageType:Is.optional(),storagePath:Is.optional(),storageProp:Jte.array(),listenToChildren:we.boolean()})),AXe=Lt()(we.object({declarationString:we.string().optional(),inputFieldType:Is.optional(),templateName:Is.optional(),bindTarget:zA.optional(),arguments:m5.array(),errorCollection:we.instanceof(Gt)})),MXe=Lt()(we.object({declarationString:we.string().optional(),templateDeclaration:we.array(we.union([we.string(),zA])).optional(),viewFieldType:Is.optional(),arguments:m5.array(),writeToBindTarget:zA.optional(),errorCollection:we.instanceof(Gt)})),Xi=Lt()(we.object({storageType:we.string(),storagePath:we.string(),storageProp:we.instanceof(Es),listenToChildren:we.boolean()})),d5=Lt()(we.object({name:we.string(),value:we.string().array()})),EXe=Lt()(we.object({type:we.nativeEnum(Gs),prop:we.string()})),h5=Lt()(we.object({inputFieldType:l5.optional(),templateName:we.string().optional(),bindTarget:Xi.optional(),arguments:d5.array().optional()})),g5=Lt()(we.object({viewFieldType:l5.optional(),templateDeclaration:we.union([we.string(),Xi]).array().optional(),arguments:d5.array().optional(),writeToBindTarget:Xi.optional()})),Xte=Lt()(we.object({bindTarget:Xi,name:we.string()})),Qte=Lt()(we.object({bindTargetMappings:Xte.array(),writeToBindTarget:Xi.optional(),code:we.string()})),Kte=Lt()(we.object({referencedButtonIds:we.string().array()})),v5=Lt()(we.object({renderChildType:Jl,declaration:we.union([we.string(),h5]),scope:Xl.optional()})),y5=Lt()(we.object({renderChildType:Jl,declaration:we.union([we.string(),g5]),scope:Xl.optional()})),b5=Lt()(we.object({declaration:we.union([we.string(),Qte])})),x5=Lt()(we.object({bindTarget:Xi,tableHead:we.string().array(),columns:we.array(we.union([h5,g5,we.string()]))})),w5=Lt()(we.object({renderChildType:Jl,declaration:we.union([we.string(),Kte]),position:p5.optional()})),_5=Lt()(we.object({declaration:we.union([we.string(),jl]),position:p5.optional(),isPreview:we.boolean()})),S5=Lt()(we.object({depth:we.number(),content:we.string()}));function ere(n){let e,t;return{c(){e=ee("td"),t=ee("div")},m(r,i){J(r,e,i),K(e,t),n[3](t)},p:Ke,i:Ke,o:Ke,d(r){r&&Y(e),n[3](null)}}}function tre(n,e,t){let{table:r}=e,{cell:i}=e,a,o;zi(()=>{o=r.createCell(i,a)}),Ys(()=>{o?.()});function u(s){Pr[s?"unshift":"push"](()=>{a=s,t(0,a)})}return n.$$set=s=>{"table"in s&&t(1,r=s.table),"cell"in s&&t(2,i=s.cell)},[a,r,i,u]}var $A=class extends Pe{constructor(e){super(),Be(this,e,tre,ere,ke,{table:1,cell:2})}},A5=$A;function M5(n,e,t){let r=n.slice();return r[7]=e[t],r}function E5(n,e,t){let r=n.slice();return r[10]=e[t],r[11]=e,r[12]=t,r}function D5(n,e,t){let r=n.slice();return r[13]=e[t],r}function N5(n){let e,t=n[13]+"",r;return{c(){e=ee("th"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&2&&t!==(t=i[13]+"")&&yt(r,t)},d(i){i&&Y(e)}}}function rre(n){let e,t,r;return{c(){e=ee("td"),t=He("invalid data"),q(e,"class","meta-bind-error"),q(e,"colspan",r=n[1].length)},m(i,a){J(i,e,a),K(e,t)},p(i,a){a&2&&r!==(r=i[1].length)&&q(e,"colspan",r)},i:Ke,o:Ke,d(i){i&&Y(e)}}}function nre(n){let e,t,r=ct(n[7].cells),i=[];for(let o=0;o<r.length;o+=1)i[o]=T5(E5(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,u){if(u&5){r=ct(o[7].cells);let s;for(s=0;s<r.length;s+=1){let l=E5(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=T5(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function T5(n){let e,t,r;function i(o){n[4](o,n[10],n[11],n[12])}let a={table:n[0]};return n[10]!==void 0&&(a.cell=n[10]),e=new A5({props:a}),Pr.push(()=>Kn(e,"cell",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){n=o;let s={};u&1&&(s.table=n[0]),!t&&u&4&&(t=!0,s.cell=n[10],Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function ire(n){let e,t;return e=new qr({props:{plugin:n[0].plugin,iconName:"x"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0].plugin),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function C5(n,e){let t,r,i,a,o,u,s,l,c=[nre,rre],f=[];function p(h,d){return h[7].isValid?0:1}r=p(e,-1),i=f[r]=c[r](e);function m(){return e[5](e[7])}return u=new It({props:{$$slots:{default:[ire]},$$scope:{ctx:e}}}),u.$on("click",m),{key:n,first:null,c(){t=ee("tr"),i.c(),a=fe(),o=ee("td"),be(u.$$.fragment),s=fe(),q(o,"class","mb-html-table-button-cell"),this.first=t},m(h,d){J(h,t,d),f[r].m(t,null),K(t,a),K(t,o),ve(u,o,null),K(t,s),l=!0},p(h,d){e=h;let g=r;r=p(e,d),r===g?f[r].p(e,d):(bt(),ne(f[g],1,1,()=>{f[g]=null}),xt(),i=f[r],i?i.p(e,d):(i=f[r]=c[r](e),i.c()),j(i,1),i.m(t,a));let y={};d&65537&&(y.$$scope={dirty:d,ctx:e}),u.$set(y)},i(h){l||(j(i),j(u.$$.fragment,h),l=!0)},o(h){ne(i),ne(u.$$.fragment,h),l=!1},d(h){h&&Y(t),f[r].d(),ye(u)}}}function are(n){let e;return{c(){e=He("Add Row")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function ore(n){let e,t,r,i,a,o,u,s,l=[],c=new Map,f,p,m,h=ct(n[1]),d=[];for(let S=0;S<h.length;S+=1)d[S]=N5(D5(n,h,S));let g=ct(n[2]),y=S=>S[7].index;for(let S=0;S<g.length;S+=1){let b=M5(n,g,S),w=y(b);c.set(w,l[S]=C5(w,b))}return p=new It({props:{$$slots:{default:[are]},$$scope:{ctx:n}}}),p.$on("click",n[6]),{c(){e=ee("div"),t=ee("table"),r=ee("thead"),i=ee("tr");for(let S=0;S<d.length;S+=1)d[S].c();a=fe(),o=ee("th"),u=fe(),s=ee("tbody");for(let S=0;S<l.length;S+=1)l[S].c();f=fe(),be(p.$$.fragment),q(o,"class","mb-html-table-button-cell"),q(t,"class","mb-html-table"),q(e,"class","mb-table-wrapper")},m(S,b){J(S,e,b),K(e,t),K(t,r),K(r,i);for(let w=0;w<d.length;w+=1)d[w]&&d[w].m(i,null);K(i,a),K(i,o),K(t,u),K(t,s);for(let w=0;w<l.length;w+=1)l[w]&&l[w].m(s,null);J(S,f,b),ve(p,S,b),m=!0},p(S,[b]){if(b&2){h=ct(S[1]);let A;for(A=0;A<h.length;A+=1){let x=D5(S,h,A);d[A]?d[A].p(x,b):(d[A]=N5(x),d[A].c(),d[A].m(i,a))}for(;A<d.length;A+=1)d[A].d(1);d.length=h.length}b&7&&(g=ct(S[2]),bt(),l=tl(l,b,y,1,S,g,c,s,Fp,C5,null,M5),xt());let w={};b&65536&&(w.$$scope={dirty:b,ctx:S}),p.$set(w)},i(S){if(!m){for(let b=0;b<g.length;b+=1)j(l[b]);j(p.$$.fragment,S),m=!0}},o(S){for(let b=0;b<l.length;b+=1)ne(l[b]);ne(p.$$.fragment,S),m=!1},d(S){S&&(Y(e),Y(f)),Qt(d,S);for(let b=0;b<l.length;b+=1)l[b].d();ye(p,S)}}}function sre(n,e,t){let{table:r}=e,{tableHead:i=[]}=e,a=[];function o(c){t(2,a=c)}function u(c,f,p,m){p[m]=c,t(2,a)}let s=c=>r.removeColumn(c.index),l=()=>r.addColumn();return n.$$set=c=>{"table"in c&&t(0,r=c.table),"tableHead"in c&&t(1,i=c.tableHead)},[r,i,a,o,u,s,l]}var HA=class extends Pe{constructor(e){super(),Be(this,e,sre,ore,ke,{table:0,tableHead:1,updateTable:3})}get updateTable(){return this.$$.ctx[3]}},F5=HA;var Bh=class extends An{constructor(e,t,r,i,a,o){super(e,t,r),this.bindTarget=i,this.tableHead=a,this.columns=o,this.inputSignal=new Lr(void 0),this.outputSignal=new Lr(void 0),this.value=void 0}registerSelfToMetadataManager(){this.metadataManagerOutputSignalListener=this.outputSignal.registerListener({callback:this.updateMetadataManager.bind(this)}),this.metadataSubscription=this.plugin.metadataManager.subscribe(this.getUuid(),this.inputSignal,this.bindTarget,()=>this.unmount())}unregisterSelfFromMetadataManager(){this.metadataManagerOutputSignalListener&&this.outputSignal.unregisterListener(this.metadataManagerOutputSignalListener),this.metadataSubscription?.unsubscribe()}updateMetadataManager(e){this.metadataSubscription?.update(e)}updateDisplayValue(e){e=e??[];let t=[];for(let r=0;r<e.length;r++)if(typeof e[r]=="object"){let i=new Zl({storageType:this.bindTarget.storageType,storageProp:this.bindTarget.storageProp.concat(kh([r.toString()])),storagePath:this.bindTarget.storagePath,listenToChildren:!1}),a=this.columns.map(o=>typeof o=="string"?this.plugin.api.createInlineFieldFromString(o,this.getFilePath(),i,"inline"):"inputFieldType"in o?this.plugin.api.createInputFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}):this.plugin.api.createViewFieldMountable(this.getFilePath(),{declaration:o,scope:i,renderChildType:"inline"}));t.push({cells:a,index:r,value:e[r],isValid:!0})}else t.push({cells:[],index:r,value:e[r],isValid:!1});this.tableComponent?.updateTable(t)}createCell(e,t){return e.mount(t),()=>e.unmount()}removeColumn(e){this.value=this.value??[],this.value.splice(e,1),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}addColumn(){this.value=this.value??[],this.value.push({}),this.updateDisplayValue(this.value),this.outputSignal.set(this.value)}onMount(e){super.onMount(e),this.tableComponent=new F5({target:e,props:{table:this,tableHead:this.tableHead}}),this.inputSignal.registerListener({callback:t=>{this.value=t,this.updateDisplayValue(t)}}),this.registerSelfToMetadataManager()}onUnmount(e){super.onUnmount(e),this.unregisterSelfFromMetadataManager(),this.tableComponent?.$destroy(),Yn(e,"table")}};var Oh=class{constructor(e,t){this.plugin=e,this.inputFieldParser=t?.inputFieldParser??new ph(e),this.viewFieldParser=t?.viewFieldParser??new bh(e),this.jsViewFieldParser=t?.jsViewFieldParser??new Ph(e),this.buttonParser=t?.buttonParser??new Ih(e),this.bindTargetParser=t?.bindTargetParser??new Gd(e),this.inputFieldFactory=t?.inputFieldFactory??new um(e),this.viewFieldFactory=t?.viewFieldFactory??new Hd(e),this.buttonActionRunner=t?.buttonActionRunner??new _p(e),this.buttonManager=t?.buttonManager??new Bp(e),this.syntaxHighlighting=t?.syntaxHighlighting??new xp(e)}createField(e,t,r,i=!0){if(Qr(we.object({type:vf,filePath:Qi,options:we.any(),honorExcludedSetting:we.boolean()}),{type:e,filePath:t,options:r,honorExcludedSetting:i}),this.plugin.internal.isFilePathExcluded(t)&&i)return this.createExcludedMountable(t);if(e==="INPUT")return this.createInputFieldMountable(t,r);if(e==="VIEW")return this.createViewFieldMountable(t,r);if(e==="JS_VIEW")return this.createJsViewFieldMountable(t,r);if(e==="TABLE")return this.createTableMountable(t,r);if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(t,r);if(e==="BUTTON")return this.createButtonMountable(t,r);if(e==="EMBED")return this.createEmbedMountable(t,r);if(e==="EXCLUDED")return this.createExcludedMountable(t);throw new Error(`Unknown field type: ${e}`)}createInlineFieldFromString(e,t,r,i="inline",a,o=!0){Qr(we.object({fieldString:we.string(),filePath:Qi,scope:Xl.optional(),renderChildType:Jl,honorExcludedSetting:we.boolean()}),{fieldString:e,filePath:t,scope:r,renderChildType:i,honorExcludedSetting:o});let u=this.isInlineFieldDeclarationAndGetType(e);if(u===void 0)throw new Ut({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${u}"`});return this.createInlineFieldOfTypeFromString(u,e,t,r,i,a,o)}createInlineFieldOfTypeFromString(e,t,r,i,a="inline",o,u=!0){if(Qr(we.object({type:vf,declaration:we.string(),filePath:Qi,scope:Xl.optional(),renderChildType:Jl,honorExcludedSetting:we.boolean()}),{type:e,declaration:t,filePath:r,scope:i,renderChildType:a,honorExcludedSetting:u}),this.plugin.internal.isFilePathExcluded(r)&&u)return this.createExcludedMountable(r);if(e==="INPUT")return this.createInputFieldMountable(r,{renderChildType:a,declaration:t,scope:i});if(e==="VIEW")return this.createViewFieldMountable(r,{renderChildType:a,declaration:t,scope:i});if(e==="BUTTON_GROUP")return this.createButtonGroupMountable(r,{renderChildType:a,declaration:t,position:o});throw new Ut({errorLevel:"CRITICAL",effect:"failed to create inline field",cause:`Invalid inline mdrc type "${e}"`})}createInputFieldMountable(e,t){Qr(we.object({filePath:Qi,options:v5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.inputFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.inputFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new rl(this.plugin,r,e,t.renderChildType,i)}createViewFieldMountable(e,t){Qr(we.object({filePath:Qi,options:y5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.viewFieldParser.fromStringAndValidate(t.declaration,e,t.scope):i=this.viewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e,t.scope),new cm(this.plugin,r,e,t.renderChildType,i)}createJsViewFieldMountable(e,t){Qr(we.object({filePath:Qi,options:b5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.jsViewFieldParser.fromStringAndValidate(t.declaration,e):i=this.jsViewFieldParser.fromSimpleDeclarationAndValidate(t.declaration,e),new lm(this.plugin,r,e,i)}createTableMountable(e,t){Qr(we.object({filePath:Qi,options:x5}),{filePath:e,options:t});let r=Ir();return new Bh(this.plugin,r,e,t.bindTarget,t.tableHead,t.columns)}createButtonGroupMountable(e,t){Qr(we.object({filePath:Qi,options:w5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromGroupString(t.declaration):i=this.buttonParser.validateGroup(t.declaration),new Rp(this.plugin,r,e,i,t.renderChildType,t.position)}createButtonMountable(e,t){Qr(we.object({filePath:Qi,options:_5}),{filePath:e,options:t});let r=Ir(),i;return typeof t.declaration=="string"?i=this.buttonParser.fromString(t.declaration):i=this.buttonParser.validate(t.declaration),new Pp(this.plugin,r,e,i,t.position,t.isPreview)}createEmbedMountable(e,t){Qr(we.object({filePath:Qi,options:S5}),{filePath:e,options:t});let r=Ir();return new xh(this.plugin,r,e,t.depth,t.content)}createExcludedMountable(e){Qr(we.object({filePath:Qi}),{filePath:e});let t=Ir();return new wh(this.plugin,t,e)}getInlineFieldDeclarationPrefix(e){if(Qr(we.object({fieldType:vf}),{fieldType:e}),e==="INPUT")return"INPUT";if(e==="VIEW")return"VIEW";if(e==="BUTTON_GROUP")return"BUTTON";throw new Ut({errorLevel:"CRITICAL",effect:"failed to get declaration prefix",cause:`Invalid inline mdrc type "${e}"`})}isInlineFieldDeclaration(e,t){Qr(we.object({fieldType:vf,str:we.string()}),{fieldType:e,str:t});let r=this.getInlineFieldDeclarationPrefix(e)+"[";return t.startsWith(r)&&t.endsWith("]")}isInlineFieldDeclarationAndGetType(e){if(Qr(we.object({str:we.string()}),{str:e}),!!e.endsWith("]"))for(let t of Object.values(Xu)){if(!bp(t))continue;let r=this.getInlineFieldDeclarationPrefix(t)+"[";if(e.startsWith(r))return t}}createSignal(e){return new Lr(e)}createBindTarget(e,t,r,i=!1){return Qr(we.object({storageType:we.string(),storagePath:we.string(),property:we.string().array(),listenToChildren:we.boolean()}),{storageType:e,storagePath:t,property:r,listenToChildren:i}),{storageType:e,storagePath:t,storageProp:kh(r),listenToChildren:i}}parseBindTarget(e,t,r){return Qr(we.object({declarationString:we.string(),filePath:Qi,scope:Xl.optional()}),{declarationString:e,filePath:t,scope:r}),this.bindTargetParser.fromStringAndValidate(e,t,r)}setMetadata(e,t){Qr(we.object({bindTarget:Xi}),{bindTarget:e}),this.plugin.metadataManager.write(t,e)}getMetadata(e){return Qr(we.object({bindTarget:Xi}),{bindTarget:e}),this.plugin.metadataManager.read(e)}updateMetadata(e,t){Qr(we.object({bindTarget:Xi,updateFn:we.function().args(we.any()).returns(we.any())}),{bindTarget:e,updateFn:t});let r=this.plugin.metadataManager.read(e),i=t(r);this.plugin.metadataManager.write(i,e)}subscribeToMetadata(e,t,r){Qr(we.object({bindTarget:Xi,lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:we.function().args(we.any()).returns(we.void())}),{bindTarget:e,lifecycleHook:t,callback:r});let i=Ir(),a=new Lr(void 0);a.registerListener({callback:r});let o=this.plugin.metadataManager.subscribe(i,a,e,()=>{a.unregisterAllListeners()});t.register(()=>{o.unsubscribe()})}createNotePosition(e,t){return Qr(we.object({lineStart:we.number(),lineEnd:we.number()}),{lineStart:e,lineEnd:t}),new jo({lineStart:e,lineEnd:t})}};var I5=require("@codemirror/view"),Rh=class extends I5.WidgetType{constructor(e,t,r,i,a){super(),this.type=e,this.content=t,this.filePath=r,this.parentComponent=i,this.plugin=a}eq(e){return e.content===this.content}toDOM(e){let t=document.createElement("span");t.addClass("cm-inline-code");let r=this.plugin.api.createInlineFieldOfTypeFromString(this.type,this.content,this.filePath,void 0);return this.renderChild=this.plugin.api.wrapInMDRC(r,t,this.parentComponent),t}destroy(e){this.renderChild?.unload(),super.destroy(e)}};var P5=require("obsidian"),Lh=class extends P5.MarkdownRenderChild{constructor(e,t,r){super(r),this.plugin=e,this.mountable=t,this.mountable.registerUnmountCb(()=>{this.unload()})}onload(){this.mountable.mount(this.containerEl),super.onload()}onunload(){this.mountable.isMounted()&&this.mountable.unmount(),super.onunload()}};function k5(n){return n.dependencyManager.checkDependency("dataview").api}function Ps(n){return n.dependencyManager.checkDependency("js-engine").api}function GA(n){return n.dependencyManager.checkDependency("templater-obsidian").templater}var ure=we.object({addChild:we.function().args(we.instanceof(B5.Component)).returns(we.void())}),Vh=class extends Oh{constructor(e){super(e)}wrapInMDRC(e,t,r){Qr(we.object({field:f5,containerEl:c5,component:ure}),{field:e,containerEl:t,component:r});let i=new Lh(this.plugin,e,t);return r.addChild(i),i}constructMDRCWidget(e,t,r,i){if(bp(e))return new Rh(e,t,r,i,this.plugin);throw new Ut({errorLevel:"CRITICAL",effect:"failed to construct mdrc",cause:`Invalid inline field type "${e}"`})}reactiveMetadata(e,t,r){Qr(we.object({bindTargets:Xi.array(),lifecycleHook:this.plugin.internal.getLifecycleHookValidator(),callback:we.function()}),{bindTargets:e,lifecycleHook:t,callback:r});let i=Ps(this.plugin),a=Ir(),o=new Lr(void 0),u=e.map(c=>({bindTarget:c,callbackSignal:new Lr(void 0)})),s,l=this.plugin.metadataManager.subscribeComputed(a,o,void 0,u,c=>s?.refresh(...c),()=>{});return t.register(()=>l.unsubscribe()),s=i.reactive(r,...u.map(c=>c.callbackSignal.get())),s}};var Ur=require("obsidian");var no=class{constructor(e,t){this.plugin=e,this.selectCallback=t}onSelected(e){this.selectCallback(e)}};var Uh=class extends no{getItemText(e){return e.name}getItems(){return this.plugin.internal.getAllCommands()}};var qh=class extends no{getItemText(e){return e}getItems(){return this.plugin.internal.getAllFiles()}};var zh=class extends no{getItemText(e){return e}getItems(){return this.plugin.internal.getAllFolders()}};function lre(n){aa(n,"svelte-17mpvkc",".vertical.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1)}.vertical-control.svelte-17mpvkc{flex-direction:column;align-items:flex-start;gap:var(--size-4-1);width:100%}")}function cre(n){let e,t,r,i=(n[0]??"")+"",a,o,u,s=(n[1]??"")+"",l,c,f,p,m=n[5].default,h=Ma(m,n,n[4],null);return{c(){e=ee("div"),t=ee("div"),r=ee("div"),a=He(i),o=fe(),u=ee("div"),l=He(s),c=fe(),f=ee("div"),h&&h.c(),q(r,"class","setting-item-name"),q(u,"class","setting-item-description"),q(t,"class","setting-item-info"),q(f,"class","setting-item-control svelte-17mpvkc"),Yt(f,"vertical-control",n[3]),q(e,"class","setting-item svelte-17mpvkc"),Yt(e,"setting-item-heading",n[2]),Yt(e,"vertical",n[3])},m(d,g){J(d,e,g),K(e,t),K(t,r),K(r,a),K(t,o),K(t,u),K(u,l),K(e,c),K(e,f),h&&h.m(f,null),p=!0},p(d,[g]){(!p||g&1)&&i!==(i=(d[0]??"")+"")&&yt(a,i),(!p||g&2)&&s!==(s=(d[1]??"")+"")&&yt(l,s),h&&h.p&&(!p||g&16)&&Da(h,m,d,d[4],p?Ea(m,d[4],g,null):Na(d[4]),null),(!p||g&8)&&Yt(f,"vertical-control",d[3]),(!p||g&4)&&Yt(e,"setting-item-heading",d[2]),(!p||g&8)&&Yt(e,"vertical",d[3])},i(d){p||(j(h,d),p=!0)},o(d){ne(h,d),p=!1},d(d){d&&Y(e),h&&h.d(d)}}}function fre(n,e,t){let{$$slots:r={},$$scope:i}=e,{name:a=void 0}=e,{description:o=void 0}=e,{heading:u=!1}=e,{vertical:s=!1}=e;return n.$$set=l=>{"name"in l&&t(0,a=l.name),"description"in l&&t(1,o=l.description),"heading"in l&&t(2,u=l.heading),"vertical"in l&&t(3,s=l.vertical),"$$scope"in l&&t(4,i=l.$$scope)},[a,o,u,s,i,r]}var WA=class extends Pe{constructor(e){super(),Be(this,e,fre,cre,ke,{name:0,description:1,heading:2,vertical:3},lre)}},Xt=WA;function pre(n){let e,t,r=n[1].default,i=Ma(r,n,n[0],null);return{c(){e=ee("div"),i&&i.c(),q(e,"class","modal-button-container")},m(a,o){J(a,e,o),i&&i.m(e,null),t=!0},p(a,[o]){i&&i.p&&(!t||o&1)&&Da(i,r,a,a[0],t?Ea(r,a[0],o,null):Na(a[0]),null)},i(a){t||(j(i,a),t=!0)},o(a){ne(i,a),t=!1},d(a){a&&Y(e),i&&i.d(a)}}}function mre(n,e,t){let{$$slots:r={},$$scope:i}=e;return n.$$set=a=>{"$$scope"in a&&t(0,i=a.$$scope)},[i,r]}var YA=class extends Pe{constructor(e){super(),Be(this,e,mre,pre,ke,{})}},io=YA;function dre(n){let e,t,r,i,a,o;return{c(){e=ee("div"),t=ee("input"),q(t,"type","checkbox"),q(t,"tabindex","-1"),t.checked=r=n[0]??!1,q(e,"class","checkbox-container"),q(e,"role","switch"),q(e,"tabindex","0"),q(e,"aria-checked",i=n[0]??!1),Yt(e,"is-enabled",n[0]??!1)},m(u,s){J(u,e,s),K(e,t),a||(o=[Fe(e,"click",n[1]),Fe(e,"keydown",n[2])],a=!0)},p(u,[s]){s&1&&r!==(r=u[0]??!1)&&(t.checked=r),s&1&&i!==(i=u[0]??!1)&&q(e,"aria-checked",i),s&1&&Yt(e,"is-enabled",u[0]??!1)},i:Ke,o:Ke,d(u){u&&Y(e),a=!1,Ft(o)}}}function hre(n,e,t){let{checked:r}=e,i=()=>t(0,r=!r),a=o=>{o.key===" "&&t(0,r=!r)};return n.$$set=o=>{"checked"in o&&t(0,r=o.checked)},[r,i,a]}var jA=class extends Pe{constructor(e){super(),Be(this,e,hre,dre,ke,{checked:0})}},ao=jA;function gre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function vre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[gre]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&32&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function yre(n){let e,t;return e=new Xt({props:{name:"Command: "+(n[0].command||"none"),description:"The command to execute when this action runs.",$$slots:{default:[vre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,[i]){let a={};i&1&&(a.name="Command: "+(r[0].command||"none")),i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function bre(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(s){s.type==="command"&&i.internal.openCommandSelectModal(l=>{s.command=l.id,a()})}let u=()=>o(r);return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(2,i=s.plugin),"updateActions"in s&&t(3,a=s.updateActions)},[r,o,i,a,u]}var ZA=class extends Pe{constructor(e){super(),Be(this,e,bre,yre,ke,{action:0,plugin:2,updateActions:3})}},O5=ZA;function xre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","someJsFile.js")},m(i,a){J(i,e,a),je(e,n[0].file),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].file&&je(e,i[0].file)},d(i){i&&Y(e),t=!1,r()}}}function wre(n){let e,t;return e=new Xt({props:{name:"JS File",description:"The JavaScript file to run.",$$slots:{default:[xre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function _re(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.file=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var JA=class extends Pe{constructor(e){super(),Be(this,e,_re,wre,ke,{action:0,plugin:1})}},R5=JA;function Sre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","[[Some Note]] or https://www.example.com")},m(i,a){J(i,e,a),je(e,n[0].link),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].link&&je(e,i[0].link)},d(i){i&&Y(e),t=!1,r()}}}function Are(n){let e,t,r;function i(o){n[3](o)}let a={};return n[0].newTab!==void 0&&(a.checked=n[0].newTab),e=new ao({props:a}),Pr.push(()=>Kn(e,"checked",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].newTab,Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function Mre(n){let e,t,r,i;return e=new Xt({props:{name:"Link",description:"The link to open.",$$slots:{default:[Sre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"New Tab",description:"Whether to open the link in a new tab.",$$slots:{default:[Are]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,[o]){let u={};o&17&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&17&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function Ere(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.link=this.value,t(0,r)}function o(u){n.$$.not_equal(r.newTab,u)&&(r.newTab=u,t(0,r))}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var XA=class extends Pe{constructor(e){super(),Be(this,e,Ere,Mre,ke,{action:0,plugin:1})}},L5=XA;function Dre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some text")},m(i,a){J(i,e,a),je(e,n[0].str),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].str&&je(e,i[0].str)},d(i){i&&Y(e),t=!1,r()}}}function Nre(n){let e,t;return e=new Xt({props:{name:"Text",description:"The text to input at the cursor.",$$slots:{default:[Dre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Tre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.str=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var QA=class extends Pe{constructor(e){super(),Be(this,e,Tre,Nre,ke,{action:0,plugin:1})}},V5=QA;function Cre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","100 ms")},m(i,a){J(i,e,a),je(e,n[0].ms),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Xn(e.value)!==i[0].ms&&je(e,i[0].ms)},d(i){i&&Y(e),t=!1,r()}}}function Fre(n){let e,t;return e=new Xt({props:{name:"Sleep Time",description:"The time to sleep in milliseconds.",$$slots:{default:[Cre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,[i]){let a={};i&9&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Ire(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.ms=Xn(this.value),t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var KA=class extends Pe{constructor(e){super(),Be(this,e,Ire,Fre,ke,{action:0,plugin:1})}},U5=KA;function Pre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function kre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Pre]},$$scope:{ctx:n}}}),e.$on("click",n[5]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&512&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Bre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Ore(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Bre]},$$scope:{ctx:n}}}),e.$on("click",n[6]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&512&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Rre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some name")},m(i,a){J(i,e,a),je(e,n[0].fileName),t||(r=Fe(e,"input",n[7]),t=!0)},p(i,a){a&1&&e.value!==i[0].fileName&&je(e,i[0].fileName)},d(i){i&&Y(e),t=!1,r()}}}function Lre(n){let e,t,r;function i(o){n[8](o)}let a={};return n[0].openNote!==void 0&&(a.checked=n[0].openNote),e=new ao({props:a}),Pr.push(()=>Kn(e,"checked",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].openNote,Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function Vre(n){let e,t,r,i,a,o,u,s;return e=new Xt({props:{name:"Template File: "+(n[0].templateFile||"none"),description:"The template file to create a new note of.",$$slots:{default:[kre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Folder: "+(n[0].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[Ore]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"File Name: "+(n[0].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[Rre]},$$scope:{ctx:n}}}),u=new Xt({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[Lre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),be(a.$$.fragment),o=fe(),be(u.$$.fragment)},m(l,c){ve(e,l,c),J(l,t,c),ve(r,l,c),J(l,i,c),ve(a,l,c),J(l,o,c),ve(u,l,c),s=!0},p(l,[c]){let f={};c&1&&(f.name="Template File: "+(l[0].templateFile||"none")),c&513&&(f.$$scope={dirty:c,ctx:l}),e.$set(f);let p={};c&1&&(p.name="Folder: "+(l[0].folderPath||"none")),c&513&&(p.$$scope={dirty:c,ctx:l}),r.$set(p);let m={};c&1&&(m.name="File Name: "+(l[0].fileName||"default")),c&513&&(m.$$scope={dirty:c,ctx:l}),a.$set(m);let h={};c&513&&(h.$$scope={dirty:c,ctx:l}),u.$set(h)},i(l){s||(j(e.$$.fragment,l),j(r.$$.fragment,l),j(a.$$.fragment,l),j(u.$$.fragment,l),s=!0)},o(l){ne(e.$$.fragment,l),ne(r.$$.fragment,l),ne(a.$$.fragment,l),ne(u.$$.fragment,l),s=!1},d(l){l&&(Y(t),Y(i),Y(o)),ye(e,l),ye(r,l),ye(a,l),ye(u,l)}}}function Ure(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(p){p.type==="templaterCreateNote"&&i.internal.openFileSelectModal(m=>{p.templateFile=m,a()})}function u(p){p.type==="templaterCreateNote"&&i.internal.openFolderSelectModal(m=>{p.folderPath=m,a()})}let s=()=>o(r),l=()=>u(r);function c(){r.fileName=this.value,t(0,r)}function f(p){n.$$.not_equal(r.openNote,p)&&(r.openNote=p,t(0,r))}return n.$$set=p=>{"action"in p&&t(0,r=p.action),"plugin"in p&&t(3,i=p.plugin),"updateActions"in p&&t(4,a=p.updateActions)},[r,o,u,i,a,s,l,c,f]}var eM=class extends Pe{constructor(e){super(),Be(this,e,Ure,Vre,ke,{action:0,plugin:3,updateActions:4})}},q5=eM;function qre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some value")},m(i,a){J(i,e,a),je(e,n[0].bindTarget),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].bindTarget&&je(e,i[0].bindTarget)},d(i){i&&Y(e),t=!1,r()}}}function zre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some value")},m(i,a){J(i,e,a),je(e,n[0].value),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&1&&e.value!==i[0].value&&je(e,i[0].value)},d(i){i&&Y(e),t=!1,r()}}}function $re(n){let e,t,r;function i(o){n[4](o)}let a={};return n[0].evaluate!==void 0&&(a.checked=n[0].evaluate),e=new ao({props:a}),Pr.push(()=>Kn(e,"checked",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].evaluate,Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function Hre(n){let e,t,r,i,a,o;return e=new Xt({props:{name:"Metadata Property",description:"The metadata property in form of a bind target.",$$slots:{default:[qre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Value",description:"The new value.",$$slots:{default:[zre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Evaluate",description:"Whether to evaluate the value as a JS expression.",$$slots:{default:[$re]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),be(a.$$.fragment)},m(u,s){ve(e,u,s),J(u,t,s),ve(r,u,s),J(u,i,s),ve(a,u,s),o=!0},p(u,[s]){let l={};s&33&&(l.$$scope={dirty:s,ctx:u}),e.$set(l);let c={};s&33&&(c.$$scope={dirty:s,ctx:u}),r.$set(c);let f={};s&33&&(f.$$scope={dirty:s,ctx:u}),a.$set(f)},i(u){o||(j(e.$$.fragment,u),j(r.$$.fragment,u),j(a.$$.fragment,u),o=!0)},o(u){ne(e.$$.fragment,u),ne(r.$$.fragment,u),ne(a.$$.fragment,u),o=!1},d(u){u&&(Y(t),Y(i)),ye(e,u),ye(r,u),ye(a,u)}}}function Gre(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.bindTarget=this.value,t(0,r)}function o(){r.value=this.value,t(0,r)}function u(s){n.$$.not_equal(r.evaluate,s)&&(r.evaluate=s,t(0,r))}return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(1,i=s.plugin)},[r,i,a,o,u]}var tM=class extends Pe{constructor(e){super(),Be(this,e,Gre,Hre,ke,{action:0,plugin:1})}},z5=tM;function Wre(n){let e;return{c(){e=He("Change")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Yre(n){let e,t;return e=new It({props:{variant:"primary",$$slots:{default:[Wre]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&128&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function jre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text"),q(e,"placeholder","some name")},m(i,a){J(i,e,a),je(e,n[0].fileName),t||(r=Fe(e,"input",n[5]),t=!0)},p(i,a){a&1&&e.value!==i[0].fileName&&je(e,i[0].fileName)},d(i){i&&Y(e),t=!1,r()}}}function Zre(n){let e,t,r;function i(o){n[6](o)}let a={};return n[0].openNote!==void 0&&(a.checked=n[0].openNote),e=new ao({props:a}),Pr.push(()=>Kn(e,"checked",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u&1&&(t=!0,s.checked=o[0].openNote,Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function Jre(n){let e,t,r,i,a,o;return e=new Xt({props:{name:"Folder: "+(n[0].folderPath||"none"),description:"The folder to create a new note in.",$$slots:{default:[Yre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"File Name: "+(n[0].fileName||"default"),description:"The file name of the new note.",$$slots:{default:[jre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Open Note",description:"Whether to open the new note after this action ran.",$$slots:{default:[Zre]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),be(a.$$.fragment)},m(u,s){ve(e,u,s),J(u,t,s),ve(r,u,s),J(u,i,s),ve(a,u,s),o=!0},p(u,[s]){let l={};s&1&&(l.name="Folder: "+(u[0].folderPath||"none")),s&129&&(l.$$scope={dirty:s,ctx:u}),e.$set(l);let c={};s&1&&(c.name="File Name: "+(u[0].fileName||"default")),s&129&&(c.$$scope={dirty:s,ctx:u}),r.$set(c);let f={};s&129&&(f.$$scope={dirty:s,ctx:u}),a.$set(f)},i(u){o||(j(e.$$.fragment,u),j(r.$$.fragment,u),j(a.$$.fragment,u),o=!0)},o(u){ne(e.$$.fragment,u),ne(r.$$.fragment,u),ne(a.$$.fragment,u),o=!1},d(u){u&&(Y(t),Y(i)),ye(e,u),ye(r,u),ye(a,u)}}}function Xre(n,e,t){let{action:r}=e,{plugin:i}=e,{updateActions:a}=e;function o(c){c.type==="createNote"&&i.internal.openFolderSelectModal(f=>{c.folderPath=f,a()})}let u=()=>o(r);function s(){r.fileName=this.value,t(0,r)}function l(c){n.$$.not_equal(r.openNote,c)&&(r.openNote=c,t(0,r))}return n.$$set=c=>{"action"in c&&t(0,r=c.action),"plugin"in c&&t(2,i=c.plugin),"updateActions"in c&&t(3,a=c.updateActions)},[r,o,i,a,u,s,l]}var rM=class extends Pe{constructor(e){super(),Be(this,e,Xre,Jre,ke,{action:0,plugin:2,updateActions:3})}},$5=rM;function Qre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].fromLine),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Xn(e.value)!==i[0].fromLine&&je(e,i[0].fromLine)},d(i){i&&Y(e),t=!1,r()}}}function Kre(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].toLine),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&1&&Xn(e.value)!==i[0].toLine&&je(e,i[0].toLine)},d(i){i&&Y(e),t=!1,r()}}}function ene(n){let e,t,r,i,a,o,u,s,l,c,f;return e=new Xt({props:{name:"Line From",description:"The line that marks the start of the area to replace.",$$slots:{default:[Qre]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Line To",description:"The line that marks the end of the area to replace.",$$slots:{default:[Kre]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Replacement Text",description:"The text to replace the note section."}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),be(a.$$.fragment),o=fe(),u=ee("div"),s=ee("textarea"),q(u,"class","meta-bind-full-width meta-bind-high")},m(p,m){ve(e,p,m),J(p,t,m),ve(r,p,m),J(p,i,m),ve(a,p,m),J(p,o,m),J(p,u,m),K(u,s),je(s,n[0].replacement),l=!0,c||(f=Fe(s,"input",n[4]),c=!0)},p(p,[m]){let h={};m&33&&(h.$$scope={dirty:m,ctx:p}),e.$set(h);let d={};m&33&&(d.$$scope={dirty:m,ctx:p}),r.$set(d),m&1&&je(s,p[0].replacement)},i(p){l||(j(e.$$.fragment,p),j(r.$$.fragment,p),j(a.$$.fragment,p),l=!0)},o(p){ne(e.$$.fragment,p),ne(r.$$.fragment,p),ne(a.$$.fragment,p),l=!1},d(p){p&&(Y(t),Y(i),Y(o),Y(u)),ye(e,p),ye(r,p),ye(a,p),c=!1,f()}}}function tne(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.fromLine=Xn(this.value),t(0,r)}function o(){r.toLine=Xn(this.value),t(0,r)}function u(){r.replacement=this.value,t(0,r)}return n.$$set=s=>{"action"in s&&t(0,r=s.action),"plugin"in s&&t(1,i=s.plugin)},[r,i,a,o,u]}var nM=class extends Pe{constructor(e){super(),Be(this,e,tne,ene,ke,{action:0,plugin:1})}},H5=nM;function rne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].regexp),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&e.value!==i[0].regexp&&je(e,i[0].regexp)},d(i){i&&Y(e),t=!1,r()}}}function nne(n){let e,t,r,i,a,o,u,s,l;return e=new Xt({props:{name:"Regexp",description:"The regexp to find replacements.",$$slots:{default:[rne]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Replacement Text",description:"The text to replace the button with."}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),a=ee("div"),o=ee("textarea"),q(a,"class","meta-bind-full-width meta-bind-high")},m(c,f){ve(e,c,f),J(c,t,f),ve(r,c,f),J(c,i,f),J(c,a,f),K(a,o),je(o,n[0].replacement),u=!0,s||(l=Fe(o,"input",n[3]),s=!0)},p(c,[f]){let p={};f&17&&(p.$$scope={dirty:f,ctx:c}),e.$set(p),f&1&&je(o,c[0].replacement)},i(c){u||(j(e.$$.fragment,c),j(r.$$.fragment,c),u=!0)},o(c){ne(e.$$.fragment,c),ne(r.$$.fragment,c),u=!1},d(c){c&&(Y(t),Y(i),Y(a)),ye(e,c),ye(r,c),s=!1,l()}}}function ine(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.regexp=this.value,t(0,r)}function o(){r.replacement=this.value,t(0,r)}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var iM=class extends Pe{constructor(e){super(),Be(this,e,ine,nne,ke,{action:0,plugin:1})}},G5=iM;function ane(n){let e,t,r,i,a,o,u;return e=new Xt({props:{name:"Replacement Text",description:"The text to replace the match with."}}),{c(){be(e.$$.fragment),t=fe(),r=ee("div"),i=ee("textarea"),q(r,"class","meta-bind-full-width meta-bind-high")},m(s,l){ve(e,s,l),J(s,t,l),J(s,r,l),K(r,i),je(i,n[0].replacement),a=!0,o||(u=Fe(i,"input",n[2]),o=!0)},p(s,[l]){l&1&&je(i,s[0].replacement)},i(s){a||(j(e.$$.fragment,s),a=!0)},o(s){ne(e.$$.fragment,s),a=!1},d(s){s&&(Y(t),Y(r)),ye(e,s),o=!1,u()}}}function one(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.replacement=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var aM=class extends Pe{constructor(e){super(),Be(this,e,one,ane,ke,{action:0,plugin:1})}},W5=aM;function sne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","number"),q(e,"placeholder","0")},m(i,a){J(i,e,a),je(e,n[0].line),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&1&&Xn(e.value)!==i[0].line&&je(e,i[0].line)},d(i){i&&Y(e),t=!1,r()}}}function une(n){let e,t,r,i,a,o,u,s,l;return e=new Xt({props:{name:"Line",description:"The line number to insert at.",$$slots:{default:[sne]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Text to Insert",description:"The text to insert into the note."}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),a=ee("div"),o=ee("textarea"),q(a,"class","meta-bind-full-width meta-bind-high")},m(c,f){ve(e,c,f),J(c,t,f),ve(r,c,f),J(c,i,f),J(c,a,f),K(a,o),je(o,n[0].value),u=!0,s||(l=Fe(o,"input",n[3]),s=!0)},p(c,[f]){let p={};f&17&&(p.$$scope={dirty:f,ctx:c}),e.$set(p),f&1&&je(o,c[0].value)},i(c){u||(j(e.$$.fragment,c),j(r.$$.fragment,c),u=!0)},o(c){ne(e.$$.fragment,c),ne(r.$$.fragment,c),u=!1},d(c){c&&(Y(t),Y(i),Y(a)),ye(e,c),ye(r,c),s=!1,l()}}}function lne(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.line=Xn(this.value),t(0,r)}function o(){r.value=this.value,t(0,r)}return n.$$set=u=>{"action"in u&&t(0,r=u.action),"plugin"in u&&t(1,i=u.plugin)},[r,i,a,o]}var oM=class extends Pe{constructor(e){super(),Be(this,e,lne,une,ke,{action:0,plugin:1})}},Y5=oM;function cne(n){let e,t,r,i,a,o,u;return e=new Xt({props:{name:"JS Code",description:"The JavaScript code to run."}}),{c(){be(e.$$.fragment),t=fe(),r=ee("div"),i=ee("textarea"),q(r,"class","meta-bind-full-width meta-bind-high")},m(s,l){ve(e,s,l),J(s,t,l),J(s,r,l),K(r,i),je(i,n[0].code),a=!0,o||(u=Fe(i,"input",n[2]),o=!0)},p(s,[l]){l&1&&je(i,s[0].code)},i(s){a||(j(e.$$.fragment,s),a=!0)},o(s){ne(e.$$.fragment,s),a=!1},d(s){s&&(Y(t),Y(r)),ye(e,s),o=!1,u()}}}function fne(n,e,t){let{action:r}=e,{plugin:i}=e;function a(){r.code=this.value,t(0,r)}return n.$$set=o=>{"action"in o&&t(0,r=o.action),"plugin"in o&&t(1,i=o.plugin)},[r,i,a]}var sM=class extends Pe{constructor(e){super(),Be(this,e,fne,cne,ke,{action:0,plugin:1})}},j5=sM;function pne(n){let e,t,r,i=n[3].default,a=Ma(i,n,n[2],null);return{c(){e=ee("div"),a&&a.c(),q(e,"class",t=(n[0]?"mb-flex-row-reverse ":"mb-flex-row ")+(n[1]?"mb-flex-row-stretch ":""))},m(o,u){J(o,e,u),a&&a.m(e,null),r=!0},p(o,[u]){a&&a.p&&(!r||u&4)&&Da(a,i,o,o[2],r?Ea(i,o[2],u,null):Na(o[2]),null),(!r||u&3&&t!==(t=(o[0]?"mb-flex-row-reverse ":"mb-flex-row ")+(o[1]?"mb-flex-row-stretch ":"")))&&q(e,"class",t)},i(o){r||(j(a,o),r=!0)},o(o){ne(a,o),r=!1},d(o){o&&Y(e),a&&a.d(o)}}}function mne(n,e,t){let{$$slots:r={},$$scope:i}=e,{reverse:a=!1}=e,{stretchChildren:o=!0}=e;return n.$$set=u=>{"reverse"in u&&t(0,a=u.reverse),"stretchChildren"in u&&t(1,o=u.stretchChildren),"$$scope"in u&&t(2,i=u.$$scope)},[a,o,i,r]}var uM=class extends Pe{constructor(e){super(),Be(this,e,mne,pne,ke,{reverse:0,stretchChildren:1})}},ks=uM;function Z5(n,e,t){let r=n.slice();return r[28]=e[t],r[30]=t,r}function J5(n,e,t){let r=n.slice();return r[31]=e[t],r}function X5(n,e,t){let r=n.slice();return r[31]=e[t],r}function dne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].label),t||(r=Fe(e,"input",n[9]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].label&&je(e,i[0].label)},d(i){i&&Y(e),t=!1,r()}}}function hne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].icon),t||(r=Fe(e,"input",n[10]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].icon&&je(e,i[0].icon)},d(i){i&&Y(e),t=!1,r()}}}function Q5(n){let e,t=n[31]+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[31],je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p:Ke,d(a){a&&Y(e)}}}function gne(n){let e,t,r,i=ct(Object.values(tn)),a=[];for(let o=0;o<i.length;o+=1)a[o]=Q5(X5(n,i,o));return{c(){e=ee("select");for(let o=0;o<a.length;o+=1)a[o].c();q(e,"class","dropdown"),n[0].style===void 0&&Wa(()=>n[11].call(e))},m(o,u){J(o,e,u);for(let s=0;s<a.length;s+=1)a[s]&&a[s].m(e,null);Qo(e,n[0].style,!0),t||(r=Fe(e,"change",n[11]),t=!0)},p(o,u){if(u&0){i=ct(Object.values(tn));let s;for(s=0;s<i.length;s+=1){let l=X5(o,i,s);a[s]?a[s].p(l,u):(a[s]=Q5(l),a[s].c(),a[s].m(e,null))}for(;s<a.length;s+=1)a[s].d(1);a.length=i.length}u[0]&1&&Qo(e,o[0].style)},d(o){o&&Y(e),Qt(a,o),t=!1,r()}}}function vne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].class),t||(r=Fe(e,"input",n[12]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].class&&je(e,i[0].class)},d(i){i&&Y(e),t=!1,r()}}}function yne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].tooltip),t||(r=Fe(e,"input",n[13]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].tooltip&&je(e,i[0].tooltip)},d(i){i&&Y(e),t=!1,r()}}}function bne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[0].id),t||(r=Fe(e,"input",n[14]),t=!0)},p(i,a){a[0]&1&&e.value!==i[0].id&&je(e,i[0].id)},d(i){i&&Y(e),t=!1,r()}}}function xne(n){let e,t,r;function i(o){n[15](o)}let a={};return n[0].hidden!==void 0&&(a.checked=n[0].hidden),e=new ao({props:a}),Pr.push(()=>Kn(e,"checked",i)),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){let s={};!t&&u[0]&1&&(t=!0,s.checked=o[0].hidden,Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function K5(n){let e,t=n[31]+"",r,i;return{c(){e=ee("option"),r=He(t),e.__value=i=n[31],je(e,e.__value)},m(a,o){J(a,e,o),K(e,r)},p:Ke,d(a){a&&Y(e)}}}function wne(n){let e;return{c(){e=He("Add Action")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function _ne(n){let e,t;return e=new qr({props:{iconName:"more-vertical",plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Sne(n){let e,t=n[7](n[28].type)+"",r,i,a,o;function u(...s){return n[18](n[30],...s)}return a=new It({props:{variant:"plain",$$slots:{default:[_ne]},$$scope:{ctx:n}}}),a.$on("click",u),{c(){e=ee("h5"),r=He(t),i=fe(),be(a.$$.fragment)},m(s,l){J(s,e,l),K(e,r),J(s,i,l),ve(a,s,l),o=!0},p(s,l){n=s,(!o||l[0]&1)&&t!==(t=n[7](n[28].type)+"")&&yt(r,t);let c={};l[0]&2|l[1]&32&&(c.$$scope={dirty:l,ctx:n}),a.$set(c)},i(s){o||(j(a.$$.fragment,s),o=!0)},o(s){ne(a.$$.fragment,s),o=!1},d(s){s&&(Y(e),Y(i)),ye(a,s)}}}function eU(n){let e,t;return e=new O5({props:{action:n[28],plugin:n[1],updateActions:n[19]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function tU(n){let e,t;return e=new L5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function rU(n){let e,t;return e=new R5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function nU(n){let e,t;return e=new V5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function iU(n){let e,t;return e=new U5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function aU(n){let e,t;return e=new q5({props:{action:n[28],plugin:n[1],updateActions:n[20]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function oU(n){let e,t;return e=new z5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function sU(n){let e,t;return e=new $5({props:{action:n[28],plugin:n[1],updateActions:n[21]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function uU(n){let e,t;return e=new H5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function lU(n){let e,t;return e=new G5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function cU(n){let e,t;return e=new W5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function fU(n){let e,t;return e=new Y5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function pU(n){let e,t;return e=new j5({props:{action:n[28],plugin:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i[0]&1&&(a.action=r[28]),i[0]&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function mU(n,e){let t,r,i,a,o,u,s,l,c,f,p,m,h,d,g,y,S;r=new ks({props:{$$slots:{default:[Sne]},$$scope:{ctx:e}}});let b=e[28].type==="command"&&eU(e),w=e[28].type==="open"&&tU(e),A=e[28].type==="js"&&rU(e),x=e[28].type==="input"&&nU(e),D=e[28].type==="sleep"&&iU(e),E=e[28].type==="templaterCreateNote"&&aU(e),_=e[28].type==="updateMetadata"&&oU(e),N=e[28].type==="createNote"&&sU(e),P=e[28].type==="replaceInNote"&&uU(e),B=e[28].type==="regexpReplaceInNote"&&lU(e),V=e[28].type==="replaceSelf"&&cU(e),z=e[28].type==="insertIntoNote"&&fU(e),L=e[28].type==="inlineJS"&&pU(e);return{key:n,first:null,c(){t=Er(),be(r.$$.fragment),i=fe(),b&&b.c(),a=fe(),w&&w.c(),o=fe(),A&&A.c(),u=fe(),x&&x.c(),s=fe(),D&&D.c(),l=fe(),E&&E.c(),c=fe(),_&&_.c(),f=fe(),N&&N.c(),p=fe(),P&&P.c(),m=fe(),B&&B.c(),h=fe(),V&&V.c(),d=fe(),z&&z.c(),g=fe(),L&&L.c(),y=Er(),this.first=t},m(k,C){J(k,t,C),ve(r,k,C),J(k,i,C),b&&b.m(k,C),J(k,a,C),w&&w.m(k,C),J(k,o,C),A&&A.m(k,C),J(k,u,C),x&&x.m(k,C),J(k,s,C),D&&D.m(k,C),J(k,l,C),E&&E.m(k,C),J(k,c,C),_&&_.m(k,C),J(k,f,C),N&&N.m(k,C),J(k,p,C),P&&P.m(k,C),J(k,m,C),B&&B.m(k,C),J(k,h,C),V&&V.m(k,C),J(k,d,C),z&&z.m(k,C),J(k,g,C),L&&L.m(k,C),J(k,y,C),S=!0},p(k,C){e=k;let W={};C[0]&3|C[1]&32&&(W.$$scope={dirty:C,ctx:e}),r.$set(W),e[28].type==="command"?b?(b.p(e,C),C[0]&1&&j(b,1)):(b=eU(e),b.c(),j(b,1),b.m(a.parentNode,a)):b&&(bt(),ne(b,1,1,()=>{b=null}),xt()),e[28].type==="open"?w?(w.p(e,C),C[0]&1&&j(w,1)):(w=tU(e),w.c(),j(w,1),w.m(o.parentNode,o)):w&&(bt(),ne(w,1,1,()=>{w=null}),xt()),e[28].type==="js"?A?(A.p(e,C),C[0]&1&&j(A,1)):(A=rU(e),A.c(),j(A,1),A.m(u.parentNode,u)):A&&(bt(),ne(A,1,1,()=>{A=null}),xt()),e[28].type==="input"?x?(x.p(e,C),C[0]&1&&j(x,1)):(x=nU(e),x.c(),j(x,1),x.m(s.parentNode,s)):x&&(bt(),ne(x,1,1,()=>{x=null}),xt()),e[28].type==="sleep"?D?(D.p(e,C),C[0]&1&&j(D,1)):(D=iU(e),D.c(),j(D,1),D.m(l.parentNode,l)):D&&(bt(),ne(D,1,1,()=>{D=null}),xt()),e[28].type==="templaterCreateNote"?E?(E.p(e,C),C[0]&1&&j(E,1)):(E=aU(e),E.c(),j(E,1),E.m(c.parentNode,c)):E&&(bt(),ne(E,1,1,()=>{E=null}),xt()),e[28].type==="updateMetadata"?_?(_.p(e,C),C[0]&1&&j(_,1)):(_=oU(e),_.c(),j(_,1),_.m(f.parentNode,f)):_&&(bt(),ne(_,1,1,()=>{_=null}),xt()),e[28].type==="createNote"?N?(N.p(e,C),C[0]&1&&j(N,1)):(N=sU(e),N.c(),j(N,1),N.m(p.parentNode,p)):N&&(bt(),ne(N,1,1,()=>{N=null}),xt()),e[28].type==="replaceInNote"?P?(P.p(e,C),C[0]&1&&j(P,1)):(P=uU(e),P.c(),j(P,1),P.m(m.parentNode,m)):P&&(bt(),ne(P,1,1,()=>{P=null}),xt()),e[28].type==="regexpReplaceInNote"?B?(B.p(e,C),C[0]&1&&j(B,1)):(B=lU(e),B.c(),j(B,1),B.m(h.parentNode,h)):B&&(bt(),ne(B,1,1,()=>{B=null}),xt()),e[28].type==="replaceSelf"?V?(V.p(e,C),C[0]&1&&j(V,1)):(V=cU(e),V.c(),j(V,1),V.m(d.parentNode,d)):V&&(bt(),ne(V,1,1,()=>{V=null}),xt()),e[28].type==="insertIntoNote"?z?(z.p(e,C),C[0]&1&&j(z,1)):(z=fU(e),z.c(),j(z,1),z.m(g.parentNode,g)):z&&(bt(),ne(z,1,1,()=>{z=null}),xt()),e[28].type==="inlineJS"?L?(L.p(e,C),C[0]&1&&j(L,1)):(L=pU(e),L.c(),j(L,1),L.m(y.parentNode,y)):L&&(bt(),ne(L,1,1,()=>{L=null}),xt())},i(k){S||(j(r.$$.fragment,k),j(b),j(w),j(A),j(x),j(D),j(E),j(_),j(N),j(P),j(B),j(V),j(z),j(L),S=!0)},o(k){ne(r.$$.fragment,k),ne(b),ne(w),ne(A),ne(x),ne(D),ne(E),ne(_),ne(N),ne(P),ne(B),ne(V),ne(z),ne(L),S=!1},d(k){k&&(Y(t),Y(i),Y(a),Y(o),Y(u),Y(s),Y(l),Y(c),Y(f),Y(p),Y(m),Y(h),Y(d),Y(g),Y(y)),ye(r,k),b&&b.d(k),w&&w.d(k),A&&A.d(k),x&&x.d(k),D&&D.d(k),E&&E.d(k),_&&_.d(k),N&&N.d(k),P&&P.d(k),B&&B.d(k),V&&V.d(k),z&&z.d(k),L&&L.d(k)}}}function Ane(n){let e=n[2].options.submitText+"",t;return{c(){t=He(e)},m(r,i){J(r,t,i)},p(r,i){i[0]&4&&e!==(e=r[2].options.submitText+"")&&yt(t,e)},d(r){r&&Y(t)}}}function Mne(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Ene(n){let e,t,r,i;return e=new It({props:{variant:"primary",$$slots:{default:[Ane]},$$scope:{ctx:n}}}),e.$on("click",n[23]),r=new It({props:{variant:"default",$$slots:{default:[Mne]},$$scope:{ctx:n}}}),r.$on("click",n[24]),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,o){let u={};o[0]&4|o[1]&32&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o[1]&32&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function Dne(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h,d,g,y,S,b,w,A=[],x=new Map,D,E,_,N,P,B,V,z,L;e=new Xt({props:{name:"Label",description:"The label shown on the button.",$$slots:{default:[dne]},$$scope:{ctx:n}}}),r=new Xt({props:{name:"Icon",description:"The icon shown on the button. If left empty, no icon will show",$$slots:{default:[hne]},$$scope:{ctx:n}}}),a=new Xt({props:{name:"Style",description:"The style variant of the button",$$slots:{default:[gne]},$$scope:{ctx:n}}}),u=new Xt({props:{name:"CSS Classes",description:"A list of CSS classes to add to the button. Multiple classes should be separated by a space.",$$slots:{default:[vne]},$$scope:{ctx:n}}}),l=new Xt({props:{name:"Tooltip",description:"A tooltip to show when hovering the button. If not set, the button label will be shown instead.",$$slots:{default:[yne]},$$scope:{ctx:n}}}),f=new Xt({props:{name:"ID",description:"An ID that allows the button to be referenced in inline buttons.",$$slots:{default:[bne]},$$scope:{ctx:n}}}),m=new Xt({props:{name:"Hidden",description:"Whether to not render this button. This can be useful when using inline buttons.",$$slots:{default:[xne]},$$scope:{ctx:n}}});let k=ct(Object.values(wo)),C=[];for(let H=0;H<k.length;H+=1)C[H]=K5(J5(n,k,H));b=new It({props:{variant:"primary",$$slots:{default:[wne]},$$scope:{ctx:n}}}),b.$on("click",n[17]);let W=ct(n[0].actions??[]),O=H=>H[30];for(let H=0;H<W.length;H+=1){let Z=Z5(n,W,H),Q=O(Z);x.set(Q,A[H]=mU(Q,Z))}return B=new io({props:{$$slots:{default:[Ene]},$$scope:{ctx:n}}}),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment),i=fe(),be(a.$$.fragment),o=fe(),be(u.$$.fragment),s=fe(),be(l.$$.fragment),c=fe(),be(f.$$.fragment),p=fe(),be(m.$$.fragment),h=fe(),d=ee("h4"),d.textContent="Actions",g=He(`

Add action of type
`),y=ee("select");for(let H=0;H<C.length;H+=1)C[H].c();S=fe(),be(b.$$.fragment),w=fe();for(let H=0;H<A.length;H+=1)A[H].c();D=fe(),E=ee("h4"),E.textContent="Preview",_=fe(),N=ee("div"),P=fe(),be(B.$$.fragment),q(y,"class","dropdown"),n[4]===void 0&&Wa(()=>n[16].call(y))},m(H,Z){ve(e,H,Z),J(H,t,Z),ve(r,H,Z),J(H,i,Z),ve(a,H,Z),J(H,o,Z),ve(u,H,Z),J(H,s,Z),ve(l,H,Z),J(H,c,Z),ve(f,H,Z),J(H,p,Z),ve(m,H,Z),J(H,h,Z),J(H,d,Z),J(H,g,Z),J(H,y,Z);for(let Q=0;Q<C.length;Q+=1)C[Q]&&C[Q].m(y,null);Qo(y,n[4],!0),J(H,S,Z),ve(b,H,Z),J(H,w,Z);for(let Q=0;Q<A.length;Q+=1)A[Q]&&A[Q].m(H,Z);J(H,D,Z),J(H,E,Z),J(H,_,Z),J(H,N,Z),n[22](N),J(H,P,Z),ve(B,H,Z),V=!0,z||(L=Fe(y,"change",n[16]),z=!0)},p(H,Z){let Q={};Z[0]&1|Z[1]&32&&(Q.$$scope={dirty:Z,ctx:H}),e.$set(Q);let U={};Z[0]&1|Z[1]&32&&(U.$$scope={dirty:Z,ctx:H}),r.$set(U);let me={};Z[0]&1|Z[1]&32&&(me.$$scope={dirty:Z,ctx:H}),a.$set(me);let De={};Z[0]&1|Z[1]&32&&(De.$$scope={dirty:Z,ctx:H}),u.$set(De);let pe={};Z[0]&1|Z[1]&32&&(pe.$$scope={dirty:Z,ctx:H}),l.$set(pe);let _e={};Z[0]&1|Z[1]&32&&(_e.$$scope={dirty:Z,ctx:H}),f.$set(_e);let Ne={};if(Z[0]&1|Z[1]&32&&(Ne.$$scope={dirty:Z,ctx:H}),m.$set(Ne),Z&0){k=ct(Object.values(wo));let Ee;for(Ee=0;Ee<k.length;Ee+=1){let Ce=J5(H,k,Ee);C[Ee]?C[Ee].p(Ce,Z):(C[Ee]=K5(Ce),C[Ee].c(),C[Ee].m(y,null))}for(;Ee<C.length;Ee+=1)C[Ee].d(1);C.length=k.length}Z[0]&16&&Qo(y,H[4]);let Se={};Z[1]&32&&(Se.$$scope={dirty:Z,ctx:H}),b.$set(Se),Z[0]&451&&(W=ct(H[0].actions??[]),bt(),A=tl(A,Z,O,1,H,W,x,D.parentNode,Fp,mU,D,Z5),xt());let Me={};Z[0]&5|Z[1]&32&&(Me.$$scope={dirty:Z,ctx:H}),B.$set(Me)},i(H){if(!V){j(e.$$.fragment,H),j(r.$$.fragment,H),j(a.$$.fragment,H),j(u.$$.fragment,H),j(l.$$.fragment,H),j(f.$$.fragment,H),j(m.$$.fragment,H),j(b.$$.fragment,H);for(let Z=0;Z<W.length;Z+=1)j(A[Z]);j(B.$$.fragment,H),V=!0}},o(H){ne(e.$$.fragment,H),ne(r.$$.fragment,H),ne(a.$$.fragment,H),ne(u.$$.fragment,H),ne(l.$$.fragment,H),ne(f.$$.fragment,H),ne(m.$$.fragment,H),ne(b.$$.fragment,H);for(let Z=0;Z<A.length;Z+=1)ne(A[Z]);ne(B.$$.fragment,H),V=!1},d(H){H&&(Y(t),Y(i),Y(o),Y(s),Y(c),Y(p),Y(h),Y(d),Y(g),Y(y),Y(S),Y(w),Y(D),Y(E),Y(_),Y(N),Y(P)),ye(e,H),ye(r,H),ye(a,H),ye(u,H),ye(l,H),ye(f,H),ye(m,H),Qt(C,H),ye(b,H);for(let Z=0;Z<A.length;Z+=1)A[Z].d(H);n[22](null),ye(B,H),z=!1,L()}}}function Nne(n,e,t){let{plugin:r}=e,{modal:i}=e,{buttonConfig:a}=e,o,u,s;Ys(()=>{u?.unmount()});function l(L,k){u?.unmount(),k&&(mt.empty(k),u=new es(r,L,"","block",void 0,!1,!0),u.mount(k))}function c(){a.actions?.push(r.api.buttonActionRunner.createDefaultAction(s)),t(0,a)}function f(L){a.actions?.splice(L,1),t(0,a)}function p(){t(0,a)}function m(L){return L==="command"?"Run a Command":L==="open"?"Open a Link":L==="js"?"Run a JavaScript File":L==="input"?"Insert Text at Cursor":L==="sleep"?"Sleep for Some Time":L==="templaterCreateNote"?"Create a New Note Using Templater":L==="updateMetadata"?"Update Metadata":L==="createNote"?"Create a New Note":L==="replaceInNote"?"Replace Text in Note":L==="regexpReplaceInNote"?"Replace Text in Note using Regexp":L==="replaceSelf"?"Replace Button with Text":L==="insertIntoNote"?"Insert Text into the Note":L==="inlineJS"?"Run JavaScript Code":"CHANGE ME"}function h(L,k){if(a.actions===void 0)return;let C=[];L>0&&C.push({name:"Move up",icon:"arrow-up",onclick:()=>{if(a.actions===void 0)return;let W=a.actions[L-1];t(0,a.actions[L-1]=a.actions[L],a),t(0,a.actions[L]=W,a)}}),L<a.actions.length-1&&C.push({name:"Move down",icon:"arrow-down",onclick:()=>{if(a.actions===void 0)return;let W=a.actions[L+1];t(0,a.actions[L+1]=a.actions[L],a),t(0,a.actions[L]=W,a)}}),C.push({name:"Remove",icon:"x",warning:!0,onclick:()=>f(L)}),r.internal.createContextMenu(C).showWithEvent(k)}function d(){a.label=this.value,t(0,a)}function g(){a.icon=this.value,t(0,a)}function y(){a.style=bc(this),t(0,a)}function S(){a.class=this.value,t(0,a)}function b(){a.tooltip=this.value,t(0,a)}function w(){a.id=this.value,t(0,a)}function A(L){n.$$.not_equal(a.hidden,L)&&(a.hidden=L,t(0,a))}function x(){s=bc(this),t(4,s)}let D=()=>c(),E=(L,k)=>h(L,k),_=()=>p(),N=()=>p(),P=()=>p();function B(L){Pr[L?"unshift":"push"](()=>{o=L,t(3,o)})}let V=()=>i.okay(a),z=()=>i.cancel();return n.$$set=L=>{"plugin"in L&&t(1,r=L.plugin),"modal"in L&&t(2,i=L.modal),"buttonConfig"in L&&t(0,a=L.buttonConfig)},n.$$.update=()=>{n.$$.dirty[0]&9&&l(a,o)},[a,r,i,o,s,c,p,m,h,d,g,y,S,b,w,A,x,D,E,_,N,P,B,V,z]}var lM=class extends Pe{constructor(e){super(),Be(this,e,Nne,Dne,ke,{plugin:1,modal:2,buttonConfig:0},null,[-1,-1])}},dU=lM;var Ql=class extends Jn{setModal(e){this.modal=e}closeModal(){if(this.modal!==void 0)this.modal.close();else throw new Ut({errorLevel:"CRITICAL",effect:"Failed to close modal.",cause:"Modal reference in ModalContent is undefined."})}};var $h=class extends Ql{constructor(e,t){super(),this.plugin=e,this.options=t}onMount(e){mt.empty(e),this.component&&this.component.$destroy(),this.component=new dU({target:e,props:{plugin:this.plugin,modal:this,buttonConfig:this.options.config??this.plugin.api.buttonActionRunner.createDefaultButtonConfig()}})}onUnmount(e){mt.empty(e),this.component&&this.component.$destroy()}okay(e){this.closeModal(),this.options.onOkay(e)}cancel(){this.closeModal()}};var Du=class extends Ql{constructor(e){super(),this.createComponent=e}onMount(e){mt.empty(e),this.component=this.createComponent(this,e)}onUnmount(e){this.component?.$destroy(),mt.empty(e)}};var vU=wr(dc());function Tne(n){aa(n,"svelte-12l82wb",".calendar.svelte-12l82wb{margin-top:10px}.calendar-header.svelte-12l82wb{display:flex;justify-content:space-around;flex-wrap:wrap;gap:var(--size-4-1);background:var(--background-secondary);border-radius:var(--mb-border-radius);margin-bottom:var(--size-4-1)}.calendar-content.svelte-12l82wb{display:grid;flex-wrap:wrap;grid-template-columns:repeat(7, 1fr);gap:var(--size-4-1)}.cell.svelte-12l82wb{min-width:40px;padding:var(--size-4-2);display:flex;justify-content:center;align-items:center;border-radius:var(--mb-border-radius)}.content-cell.svelte-12l82wb{cursor:pointer}.cell-text.svelte-12l82wb{margin:auto;text-align:center}.selected.svelte-12l82wb{background:var(--interactive-accent);color:var(--text-on-accent)}.highlight.svelte-12l82wb:hover{background:var(--interactive-hover)}.selected.highlight.svelte-12l82wb:hover{background:var(--interactive-accent-hover)}")}function hU(n,e,t){let r=n.slice();return r[10]=e[t],r}function Cne(n,e,t){let r=n.slice();return r[13]=e[t],r}function Fne(n){let e,t,r;return{c(){e=ee("div"),t=ee("span"),t.textContent=`${n[13]}`,r=fe(),q(t,"class","cell-text svelte-12l82wb"),q(e,"class","cell header-cell svelte-12l82wb")},m(i,a){J(i,e,a),K(e,t),K(e,r)},p:Ke,d(i){i&&Y(e)}}}function gU(n,e){let t,r,i=(e[10]||"")+"",a,o,u,s;function l(){return e[6](e[10])}function c(...f){return e[7](e[10],...f)}return{key:n,first:null,c(){t=ee("div"),r=ee("span"),a=He(i),o=fe(),q(r,"class","cell-text svelte-12l82wb"),q(t,"class","cell svelte-12l82wb"),q(t,"role","button"),q(t,"tabindex","0"),Yt(t,"highlight",e[10]),Yt(t,"content-cell",e[10]),Yt(t,"selected",e[0]?.year()===e[2]&&e[0]?.month()===e[1]&&e[0]?.date()===e[10]),this.first=t},m(f,p){J(f,t,p),K(t,r),K(r,a),K(t,o),u||(s=[Fe(t,"click",l),Fe(t,"keydown",c)],u=!0)},p(f,p){e=f,p&8&&i!==(i=(e[10]||"")+"")&&yt(a,i),p&8&&Yt(t,"highlight",e[10]),p&8&&Yt(t,"content-cell",e[10]),p&15&&Yt(t,"selected",e[0]?.year()===e[2]&&e[0]?.month()===e[1]&&e[0]?.date()===e[10])},d(f){f&&Y(t),u=!1,Ft(s)}}}function Ine(n){let e,t,r,i,a=[],o=new Map,u=ct(CE()),s=[];for(let f=0;f<u.length;f+=1)s[f]=Fne(Cne(n,u,f));let l=ct(n[3]),c=f=>FE();for(let f=0;f<l.length;f+=1){let p=hU(n,l,f),m=c(p);o.set(m,a[f]=gU(m,p))}return{c(){e=ee("div"),t=ee("div");for(let f=0;f<s.length;f+=1)s[f].c();r=fe(),i=ee("div");for(let f=0;f<a.length;f+=1)a[f].c();q(t,"class","calendar-header svelte-12l82wb"),q(i,"class","calendar-content svelte-12l82wb"),q(e,"class","calendar svelte-12l82wb")},m(f,p){J(f,e,p),K(e,t);for(let m=0;m<s.length;m+=1)s[m]&&s[m].m(t,null);K(e,r),K(e,i);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(i,null)},p(f,[p]){p&63&&(l=ct(f[3]),a=tl(a,p,c,1,f,l,o,i,hD,gU,null,hU))},i:Ke,o:Ke,d(f){f&&Y(e),Qt(s,f);for(let p=0;p<a.length;p+=1)a[p].d()}}}function Pne(n,e,t){let r=js(),{selectedDate:i}=e,{month:a}=e,{year:o}=e,u;function s(m){r("dateChange",(0,vU.default)(new Date(o,a,m)))}function l(m){m&&s(m)}function c(m,h){m.key===" "&&l(h)}let f=m=>l(m),p=(m,h)=>c(h,m);return n.$$set=m=>{"selectedDate"in m&&t(0,i=m.selectedDate),"month"in m&&t(1,a=m.month),"year"in m&&t(2,o=m.year)},n.$$.update=()=>{n.$$.dirty&6&&t(3,u=TE(a,o))},[i,a,o,u,l,c,f,p]}var cM=class extends Pe{constructor(e){super(),Be(this,e,Pne,Ine,ke,{selectedDate:0,month:1,year:2},Tne)}},yU=cM;var Hh=wr(dc());function kne(n){aa(n,"svelte-berpp6",".date-picker.svelte-berpp6{display:block;padding:var(--size-4-4)}.date-picker-header.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:space-around}.date-picker-header-text.svelte-berpp6{flex:1;text-align:center;display:flex;gap:var(--size-4-2);align-items:center;justify-content:center;width:min-content}.date-picker-header-text-year.svelte-berpp6{width:60px;padding:var(--size-4-2)}.date-picker-header-text-month.svelte-berpp6{height:min-content}.month-switch-button.svelte-berpp6{margin:0}.date-picker-footer.svelte-berpp6{display:flex;gap:var(--size-4-2);align-items:center;justify-content:center}.none-button.svelte-berpp6{margin:0}")}function Bne(n){let e,t,r,i,a,o,u=Og(n[1])+"",s,l,c,f,p,m,h,d,g,y,S,b,w,A,x,D;return d=new yU({props:{month:n[1],year:n[2],selectedDate:n[0]}}),d.$on("dateChange",n[6]),{c(){e=ee("div"),t=ee("div"),r=ee("button"),r.textContent="Prev",i=fe(),a=ee("div"),o=ee("span"),s=He(u),l=fe(),c=ee("input"),p=fe(),m=ee("button"),m.textContent="Next",h=fe(),be(d.$$.fragment),g=fe(),y=ee("div"),S=ee("button"),S.textContent="Set no Date",b=fe(),w=ee("button"),w.textContent="Set to Now",q(r,"class","month-switch-button svelte-berpp6"),q(o,"class","date-picker-header-text-month svelte-berpp6"),q(c,"class","date-picker-header-text-year svelte-berpp6"),q(c,"type","number"),c.value=f=n[2].toString(),q(a,"class","date-picker-header-text svelte-berpp6"),q(m,"class","month-switch-button svelte-berpp6"),q(t,"class","date-picker-header svelte-berpp6"),q(S,"class","none-button svelte-berpp6"),q(w,"class","none-button svelte-berpp6"),q(y,"class","date-picker-footer svelte-berpp6"),q(e,"class","date-picker svelte-berpp6")},m(E,_){J(E,e,_),K(e,t),K(t,r),K(t,i),K(t,a),K(a,o),K(o,s),K(a,l),K(a,c),K(t,p),K(t,m),K(e,h),ve(d,e,null),K(e,g),K(e,y),K(y,S),K(y,b),K(y,w),A=!0,x||(D=[Fe(r,"click",n[4]),Fe(c,"input",n[5]),Fe(m,"click",n[3]),Fe(S,"click",n[7]),Fe(w,"click",n[8])],x=!0)},p(E,[_]){(!A||_&2)&&u!==(u=Og(E[1])+"")&&yt(s,u),(!A||_&4&&f!==(f=E[2].toString())&&c.value!==f)&&(c.value=f);let N={};_&2&&(N.month=E[1]),_&4&&(N.year=E[2]),_&1&&(N.selectedDate=E[0]),d.$set(N)},i(E){A||(j(d.$$.fragment,E),A=!0)},o(E){ne(d.$$.fragment,E),A=!1},d(E){E&&Y(e),ye(d),x=!1,Ft(D)}}}function One(n,e,t){let{selectedDate:r=(0,Hh.default)()}=e,{dateChangeCallback:i}=e,a,o;function u(){if(a===11){t(1,a=0),t(2,o+=1);return}t(1,a=a+1)}function s(){if(a===0){t(1,a=11),t(2,o-=1);return}t(1,a-=1)}function l(m){let h=m.target.value,d=Number.parseInt(h);Number.isNaN(d)||t(2,o=d)}function c(m){t(0,r=m.detail),i(m.detail)}function f(){t(0,r=null),i(null)}function p(){t(0,r=(0,Hh.default)()),i(r)}return n.$$set=m=>{"selectedDate"in m&&t(0,r=m.selectedDate),"dateChangeCallback"in m&&t(9,i=m.dateChangeCallback)},n.$$.update=()=>{if(n.$$.dirty&1)if(r)t(1,a=r.month()),t(2,o=r.year());else{let m=(0,Hh.default)();t(1,a=m.month()),t(2,o=m.year())}},[r,a,o,u,s,l,c,f,p,i]}var fM=class extends Pe{constructor(e){super(),Be(this,e,One,Bne,ke,{selectedDate:0,dateChangeCallback:9},kne)}},bU=fM;function Rne(n){let e,t,r,i,a,o,u,s,l;return{c(){e=ee("div"),t=ee("img"),i=fe(),a=ee("div"),o=ee("span"),u=He(n[1]),q(t,"class","mb-image-card-image"),ia(t.src,r=n[0].internal.imagePathToUri(n[1]))||q(t,"src",r),q(t,"alt",n[1]),q(a,"class","mb-image-card-footer"),q(e,"class","mb-image-card"),q(e,"role","button"),q(e,"tabindex","0")},m(c,f){J(c,e,f),K(e,t),K(e,i),K(e,a),K(a,o),K(o,u),s||(l=[Fe(e,"click",n[4]),Fe(e,"keydown",n[5])],s=!0)},p(c,[f]){f&3&&!ia(t.src,r=c[0].internal.imagePathToUri(c[1]))&&q(t,"src",r),f&2&&q(t,"alt",c[1]),f&2&&yt(u,c[1])},i:Ke,o:Ke,d(c){c&&Y(e),s=!1,Ft(l)}}}function Lne(n,e,t){let{plugin:r}=e,{image:i}=e,{onSelect:a}=e;function o(l,c){l.key===" "&&a(c)}let u=()=>a(i),s=l=>o(l,i);return n.$$set=l=>{"plugin"in l&&t(0,r=l.plugin),"image"in l&&t(1,i=l.image),"onSelect"in l&&t(2,a=l.onSelect)},[r,i,a,o,u,s]}var pM=class extends Pe{constructor(e){super(),Be(this,e,Lne,Rne,ke,{plugin:0,image:1,onSelect:2})}},xU=pM;function wU(n,e,t){let r=n.slice();return r[8]=e[t],r}function _U(n){let e,t;return e=new xU({props:{plugin:n[0],image:n[8].value,onSelect:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),i&8&&(a.image=r[8].value),i&2&&(a.onSelect=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Vne(n){let e,t,r,i,a,o,u,s=ct(n[3]),l=[];for(let f=0;f<s.length;f+=1)l[f]=_U(wU(n,s,f));let c=f=>ne(l[f],1,1,()=>{l[f]=null});return{c(){e=ee("div"),t=ee("input"),r=fe(),i=ee("div");for(let f=0;f<l.length;f+=1)l[f].c();q(t,"type","text"),q(t,"placeholder","Search Images..."),q(e,"class","mb-image-search-container"),q(i,"class","mb-image-card-grid")},m(f,p){J(f,e,p),K(e,t),je(t,n[2]),J(f,r,p),J(f,i,p);for(let m=0;m<l.length;m+=1)l[m]&&l[m].m(i,null);a=!0,o||(u=Fe(t,"input",n[5]),o=!0)},p(f,[p]){if(p&4&&t.value!==f[2]&&je(t,f[2]),p&11){s=ct(f[3]);let m;for(m=0;m<s.length;m+=1){let h=wU(f,s,m);l[m]?(l[m].p(h,p),j(l[m],1)):(l[m]=_U(h),l[m].c(),j(l[m],1),l[m].m(i,null))}for(bt(),m=s.length;m<l.length;m+=1)c(m);xt()}},i(f){if(!a){for(let p=0;p<s.length;p+=1)j(l[p]);a=!0}},o(f){l=l.filter(Boolean);for(let p=0;p<l.length;p+=1)ne(l[p]);a=!1},d(f){f&&(Y(e),Y(r),Y(i)),Qt(l,f),o=!1,u()}}}function Une(n,e,t){let{plugin:r}=e,{options:i}=e,{onSelect:a}=e,o="",u,s=r.internal.createFuzzySearch();function l(f){if(!f){t(3,u=i);return}s.setSearch(f),t(3,u=s.filterItems(i,p=>p.value))}function c(){o=this.value,t(2,o)}return n.$$set=f=>{"plugin"in f&&t(0,r=f.plugin),"options"in f&&t(4,i=f.options),"onSelect"in f&&t(1,a=f.onSelect)},n.$$.update=()=>{n.$$.dirty&4&&l(o)},[r,a,o,u,i,c]}var mM=class extends Pe{constructor(e){super(),Be(this,e,Une,Vne,ke,{plugin:0,options:4,onSelect:1})}},SU=mM;function AU(n,e,t){let r=n.slice();return r[1]=e[t],r}function qne(n){let e,t,r,i=n[0].stack+"",a;return{c(){e=ee("div"),t=ee("pre"),r=ee("code"),a=He(i),q(r,"class","language-none mb-none"),q(t,"class","mb-pre"),q(e,"class","mb-card")},m(o,u){J(o,e,u),K(e,t),K(t,r),K(r,a)},p(o,u){u&1&&i!==(i=o[0].stack+"")&&yt(a,i)},d(o){o&&Y(e)}}}function zne(n){let e,t,r,i=n[0].errorLevel+"",a,o,u=n[0].getErrorType()+"",s,l,c,f,p=n[0].effect+"",m,h,d,g,y,S,b,w,A,x=n[0].cause+"",D,E,_,N,P,B,V=n[0].effect+"",z,L,k,C,W=n[0].positionContext&&MU(n),O=n[0].tip&&EU(n),H=n[0].docs&&DU(n),Z=n[0].context&&TU(n);return{c(){e=ee("div"),t=ee("h6"),r=ee("span"),a=He(i),o=He(`
				[`),s=He(u),l=He("]"),f=He(`
			- `),m=He(p),h=fe(),W&&W.c(),d=fe(),g=ee("table"),y=ee("tbody"),S=ee("tr"),b=ee("td"),b.textContent="Cause",w=fe(),A=ee("td"),D=He(x),E=fe(),_=ee("tr"),N=ee("td"),N.textContent="Effect",P=fe(),B=ee("td"),z=He(V),L=fe(),O&&O.c(),k=fe(),H&&H.c(),C=fe(),Z&&Z.c(),q(r,"class",c=n[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text"),q(e,"class","mb-card mb-card-full-width markdown-rendered")},m(Q,U){J(Q,e,U),K(e,t),K(t,r),K(r,a),K(r,o),K(r,s),K(r,l),K(t,f),K(t,m),K(e,h),W&&W.m(e,null),K(e,d),K(e,g),K(g,y),K(y,S),K(S,b),K(S,w),K(S,A),K(A,D),K(y,E),K(y,_),K(_,N),K(_,P),K(_,B),K(B,z),K(y,L),O&&O.m(y,null),K(y,k),H&&H.m(y,null),K(y,C),Z&&Z.m(y,null)},p(Q,U){U&1&&i!==(i=Q[0].errorLevel+"")&&yt(a,i),U&1&&u!==(u=Q[0].getErrorType()+"")&&yt(s,u),U&1&&c!==(c=Q[0].errorLevel==="WARNING"?"mb-warning-text":"mb-error-text")&&q(r,"class",c),U&1&&p!==(p=Q[0].effect+"")&&yt(m,p),Q[0].positionContext?W?W.p(Q,U):(W=MU(Q),W.c(),W.m(e,d)):W&&(W.d(1),W=null),U&1&&x!==(x=Q[0].cause+"")&&yt(D,x),U&1&&V!==(V=Q[0].effect+"")&&yt(z,V),Q[0].tip?O?O.p(Q,U):(O=EU(Q),O.c(),O.m(y,k)):O&&(O.d(1),O=null),Q[0].docs?H?H.p(Q,U):(H=DU(Q),H.c(),H.m(y,C)):H&&(H.d(1),H=null),Q[0].context?Z?Z.p(Q,U):(Z=TU(Q),Z.c(),Z.m(y,null)):Z&&(Z.d(1),Z=null)},d(Q){Q&&Y(e),W&&W.d(),O&&O.d(),H&&H.d(),Z&&Z.d()}}}function MU(n){let e,t,r=n[0].positionContext+"",i;return{c(){e=ee("pre"),t=ee("code"),i=He(r),q(t,"class","language-none mb-none"),q(e,"class","mb-pre")},m(a,o){J(a,e,o),K(e,t),K(t,i)},p(a,o){o&1&&r!==(r=a[0].positionContext+"")&&yt(i,r)},d(a){a&&Y(e)}}}function EU(n){let e,t,r,i,a=n[0].tip+"",o;return{c(){e=ee("tr"),t=ee("td"),t.textContent="Tip",r=fe(),i=ee("td"),o=He(a)},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i),K(i,o)},p(u,s){s&1&&a!==(a=u[0].tip+"")&&yt(o,a)},d(u){u&&Y(e)}}}function DU(n){let e,t,r,i,a=ct(n[0].docs),o=[];for(let u=0;u<a.length;u+=1)o[u]=NU(AU(n,a,u));return{c(){e=ee("tr"),t=ee("td"),t.textContent="Docs",r=fe(),i=ee("td");for(let u=0;u<o.length;u+=1)o[u].c()},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i);for(let l=0;l<o.length;l+=1)o[l]&&o[l].m(i,null)},p(u,s){if(s&1){a=ct(u[0].docs);let l;for(l=0;l<a.length;l+=1){let c=AU(u,a,l);o[l]?o[l].p(c,s):(o[l]=NU(c),o[l].c(),o[l].m(i,null))}for(;l<o.length;l+=1)o[l].d(1);o.length=a.length}},d(u){u&&Y(e),Qt(o,u)}}}function NU(n){let e,t=n[1]+"",r,i,a;return{c(){e=ee("a"),r=He(t),a=ee("br"),q(e,"href",i=n[1])},m(o,u){J(o,e,u),K(e,r),J(o,a,u)},p(o,u){u&1&&t!==(t=o[1]+"")&&yt(r,t),u&1&&i!==(i=o[1])&&q(e,"href",i)},d(o){o&&(Y(e),Y(a))}}}function TU(n){let e,t,r,i,a,o,u=JSON.stringify(n[0].context,null,4)+"",s;return{c(){e=ee("tr"),t=ee("td"),t.textContent="Context",r=fe(),i=ee("td"),a=ee("pre"),o=ee("code"),s=He(u),q(o,"class","language-none mb-none"),q(a,"class","mb-pre")},m(l,c){J(l,e,c),K(e,t),K(e,r),K(e,i),K(i,a),K(a,o),K(o,s)},p(l,c){c&1&&u!==(u=JSON.stringify(l[0].context,null,4)+"")&&yt(s,u)},d(l){l&&Y(e)}}}function $ne(n){let e;function t(a,o){return a[0]instanceof wn?zne:qne}let r=t(n,-1),i=r(n);return{c(){i.c(),e=Er()},m(a,o){i.m(a,o),J(a,e,o)},p(a,[o]){r===(r=t(a,o))&&i?i.p(a,o):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},i:Ke,o:Ke,d(a){a&&Y(e),i.d(a)}}}function Hne(n,e,t){let{error:r}=e;return n.$$set=i=>{"error"in i&&t(0,r=i.error)},[r]}var dM=class extends Pe{constructor(e){super(),Be(this,e,Hne,$ne,ke,{error:0})}},hM=dM;function CU(n,e,t){let r=n.slice();return r[1]=e[t],r}function FU(n,e,t){let r=n.slice();return r[4]=e[t],r}function IU(n){let e,t=n[0].text+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].text+"")&&yt(r,t)},d(i){i&&Y(e)}}}function PU(n){let e,t,r=n[0].code+"",i;return{c(){e=ee("pre"),t=ee("code"),i=He(r),q(t,"class","language-none meta-bind-none"),q(e,"class","mb-pre")},m(a,o){J(a,e,o),K(e,t),K(t,i)},p(a,o){o&1&&r!==(r=a[0].code+"")&&yt(i,r)},d(a){a&&Y(e)}}}function kU(n){let e,t,r,i,a,o=n[0].errorText&&BU(n),u=ct(n[0].errorCollection.getErrors()),s=[];for(let c=0;c<u.length;c+=1)s[c]=OU(FU(n,u,c));let l=c=>ne(s[c],1,1,()=>{s[c]=null});return{c(){e=ee("h6"),e.textContent="Errors",t=fe(),o&&o.c(),r=fe();for(let c=0;c<s.length;c+=1)s[c].c();i=Er()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,r,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].errorText?o?o.p(c,f):(o=BU(c),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null),f&1){u=ct(c[0].errorCollection.getErrors());let p;for(p=0;p<u.length;p+=1){let m=FU(c,u,p);s[p]?(s[p].p(m,f),j(s[p],1)):(s[p]=OU(m),s[p].c(),j(s[p],1),s[p].m(i.parentNode,i))}for(bt(),p=u.length;p<s.length;p+=1)l(p);xt()}},i(c){if(!a){for(let f=0;f<u.length;f+=1)j(s[f]);a=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)ne(s[f]);a=!1},d(c){c&&(Y(e),Y(t),Y(r),Y(i)),o&&o.d(c),Qt(s,c)}}}function BU(n){let e,t=n[0].errorText+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].errorText+"")&&yt(r,t)},d(i){i&&Y(e)}}}function OU(n){let e,t;return e=new hM({props:{error:n[4]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.error=r[4]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function RU(n){let e,t,r,i,a,o=n[0].warningText&&LU(n),u=ct(n[0].errorCollection.getWarnings()),s=[];for(let c=0;c<u.length;c+=1)s[c]=VU(CU(n,u,c));let l=c=>ne(s[c],1,1,()=>{s[c]=null});return{c(){e=ee("h6"),e.textContent="Warnings",t=fe(),o&&o.c(),r=fe();for(let c=0;c<s.length;c+=1)s[c].c();i=Er()},m(c,f){J(c,e,f),J(c,t,f),o&&o.m(c,f),J(c,r,f);for(let p=0;p<s.length;p+=1)s[p]&&s[p].m(c,f);J(c,i,f),a=!0},p(c,f){if(c[0].warningText?o?o.p(c,f):(o=LU(c),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null),f&1){u=ct(c[0].errorCollection.getWarnings());let p;for(p=0;p<u.length;p+=1){let m=CU(c,u,p);s[p]?(s[p].p(m,f),j(s[p],1)):(s[p]=VU(m),s[p].c(),j(s[p],1),s[p].m(i.parentNode,i))}for(bt(),p=u.length;p<s.length;p+=1)l(p);xt()}},i(c){if(!a){for(let f=0;f<u.length;f+=1)j(s[f]);a=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)ne(s[f]);a=!1},d(c){c&&(Y(e),Y(t),Y(r),Y(i)),o&&o.d(c),Qt(s,c)}}}function LU(n){let e,t=n[0].warningText+"",r;return{c(){e=ee("p"),r=He(t)},m(i,a){J(i,e,a),K(e,r)},p(i,a){a&1&&t!==(t=i[0].warningText+"")&&yt(r,t)},d(i){i&&Y(e)}}}function VU(n){let e,t;return e=new hM({props:{error:n[1]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.error=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Gne(n){let e,t,r=n[0].errorCollection.hasErrors(),i,a=n[0].errorCollection.hasWarnings(),o,u,s=n[0].text&&IU(n),l=n[0].code&&PU(n),c=r&&kU(n),f=a&&RU(n);return{c(){s&&s.c(),e=fe(),l&&l.c(),t=fe(),c&&c.c(),i=fe(),f&&f.c(),o=Er()},m(p,m){s&&s.m(p,m),J(p,e,m),l&&l.m(p,m),J(p,t,m),c&&c.m(p,m),J(p,i,m),f&&f.m(p,m),J(p,o,m),u=!0},p(p,[m]){p[0].text?s?s.p(p,m):(s=IU(p),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),p[0].code?l?l.p(p,m):(l=PU(p),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null),m&1&&(r=p[0].errorCollection.hasErrors()),r?c?(c.p(p,m),m&1&&j(c,1)):(c=kU(p),c.c(),j(c,1),c.m(i.parentNode,i)):c&&(bt(),ne(c,1,1,()=>{c=null}),xt()),m&1&&(a=p[0].errorCollection.hasWarnings()),a?f?(f.p(p,m),m&1&&j(f,1)):(f=RU(p),f.c(),j(f,1),f.m(o.parentNode,o)):f&&(bt(),ne(f,1,1,()=>{f=null}),xt())},i(p){u||(j(c),j(f),u=!0)},o(p){ne(c),ne(f),u=!1},d(p){p&&(Y(e),Y(t),Y(i),Y(o)),s&&s.d(p),l&&l.d(p),c&&c.d(p),f&&f.d(p)}}}function Wne(n,e,t){let{settings:r}=e;return n.$$set=i=>{"settings"in i&&t(0,r=i.settings)},[r]}var gM=class extends Pe{constructor(e){super(),Be(this,e,Wne,Gne,ke,{settings:0})}},Bs=gM;function UU(n){let e,t,r,i,a;function o(l,c){return c&1&&(t=null),c&1&&(r=null),t==null&&(t=!!l[0].errorCollection.hasErrors()),t?Zne:(r==null&&(r=!!l[0].errorCollection.hasWarnings()),r?jne:Yne)}let u=o(n,-1),s=u(n);return{c(){e=ee("div"),s.c(),q(e,"class","mb-error-collection"),q(e,"role","button"),q(e,"tabindex","0")},m(l,c){J(l,e,c),s.m(e,null),i||(a=[Fe(e,"click",n[3]),Fe(e,"keydown",n[4])],i=!0)},p(l,c){u!==(u=o(l,c))&&(s.d(1),s=u(l),s&&(s.c(),s.m(e,null)))},d(l){l&&Y(e),s.d(),i=!1,Ft(a)}}}function Yne(n){let e,t,r,i;return{c(){e=qi("svg"),t=qi("circle"),r=qi("path"),i=qi("path"),q(t,"cx","12"),q(t,"cy","12"),q(t,"r","10"),q(r,"d","M12 16v-4"),q(i,"d","M12 8h.01"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-info")},m(a,o){J(a,e,o),K(e,t),K(e,r),K(e,i)},d(a){a&&Y(e)}}}function jne(n){let e,t,r,i;return{c(){e=qi("svg"),t=qi("path"),r=qi("line"),i=qi("line"),q(t,"d","m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"),q(r,"x1","12"),q(r,"x2","12"),q(r,"y1","9"),q(r,"y2","13"),q(i,"x1","12"),q(i,"x2","12.01"),q(i,"y1","17"),q(i,"y2","17"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-alert-triangle")},m(a,o){J(a,e,o),K(e,t),K(e,r),K(e,i)},d(a){a&&Y(e)}}}function Zne(n){let e,t,r,i,a,o;return{c(){e=qi("svg"),t=qi("circle"),r=qi("line"),i=qi("line"),a=fe(),o=ee("span"),o.textContent="[META_BIND_ERROR]",q(t,"cx","12"),q(t,"cy","12"),q(t,"r","10"),q(r,"x1","12"),q(r,"x2","12"),q(r,"y1","8"),q(r,"y2","12"),q(i,"x1","12"),q(i,"x2","12.01"),q(i,"y1","16"),q(i,"y2","16"),q(e,"xmlns","http://www.w3.org/2000/svg"),q(e,"width","24"),q(e,"height","24"),q(e,"viewBox","0 0 24 24"),q(e,"fill","none"),q(e,"stroke","currentColor"),q(e,"stroke-width","2"),q(e,"stroke-linecap","round"),q(e,"stroke-linejoin","round"),q(e,"class","lucide lucide-alert-circle"),q(o,"class","mb-error")},m(u,s){J(u,e,s),K(e,t),K(e,r),K(e,i),J(u,a,s),J(u,o,s)},d(u){u&&(Y(e),Y(a),Y(o))}}}function Jne(n){let e=!n[0].errorCollection.isEmpty(),t,r=e&&UU(n);return{c(){r&&r.c(),t=Er()},m(i,a){r&&r.m(i,a),J(i,t,a)},p(i,[a]){a&1&&(e=!i[0].errorCollection.isEmpty()),e?r?r.p(i,a):(r=UU(i),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},i:Ke,o:Ke,d(i){i&&Y(t),r&&r.d(i)}}}function Xne(n,e,t){let{plugin:r}=e,{settings:i}=e;function a(){r.internal.openErrorCollectionViewModal(i)}let o=()=>a(),u=s=>{s.key===" "&&a()};return n.$$set=s=>{"plugin"in s&&t(2,r=s.plugin),"settings"in s&&t(0,i=s.settings)},[i,a,r,o,u]}var vM=class extends Pe{constructor(e){super(),Be(this,e,Xne,Jne,ke,{plugin:2,settings:0})}},yf=vM;var Gh=class extends no{constructor(e,t,r){super(e,t),this.ipf=r}getItemText(e){return e.displayValue}getItems(){return this.plugin.internal.getSuggesterOptions(this.ipf)}};function Qne(n){let e,t,r;return{c(){e=ee("input"),q(e,"type","text")},m(i,a){J(i,e,a),je(e,n[1]),t||(r=Fe(e,"input",n[3]),t=!0)},p(i,a){a&2&&e.value!==i[1]&&je(e,i[1])},d(i){i&&Y(e),t=!1,r()}}}function Kne(n){let e,t,r;return{c(){e=ee("textarea")},m(i,a){J(i,e,a),je(e,n[1]),t||(r=Fe(e,"input",n[2]),t=!0)},p(i,a){a&2&&je(e,i[1])},d(i){i&&Y(e),t=!1,r()}}}function eie(n){let e;return{c(){e=He("OK")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function tie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function rie(n){let e,t,r,i;return e=new It({props:{variant:"primary",$$slots:{default:[eie]},$$scope:{ctx:n}}}),e.$on("click",n[4]),r=new It({props:{$$slots:{default:[tie]},$$scope:{ctx:n}}}),r.$on("click",n[5]),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,o){let u={};o&64&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&64&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function nie(n){let e,t=n[0].subTitle+"",r,i,a,o,u,s;function l(p,m){return p[0].multiline?Kne:Qne}let c=l(n,-1),f=c(n);return u=new io({props:{$$slots:{default:[rie]},$$scope:{ctx:n}}}),{c(){e=ee("p"),r=He(t),i=fe(),a=ee("div"),f.c(),o=fe(),be(u.$$.fragment),q(a,"class","mb-full-width-text-input")},m(p,m){J(p,e,m),K(e,r),J(p,i,m),J(p,a,m),f.m(a,null),J(p,o,m),ve(u,p,m),s=!0},p(p,[m]){(!s||m&1)&&t!==(t=p[0].subTitle+"")&&yt(r,t),c===(c=l(p,m))&&f?f.p(p,m):(f.d(1),f=c(p),f&&(f.c(),f.m(a,null)));let h={};m&67&&(h.$$scope={dirty:m,ctx:p}),u.$set(h)},i(p){s||(j(u.$$.fragment,p),s=!0)},o(p){ne(u.$$.fragment,p),s=!1},d(p){p&&(Y(e),Y(i),Y(a),Y(o)),f.d(),ye(u,p)}}}function iie(n,e,t){let{options:r}=e,i=r.value;function a(){i=this.value,t(1,i)}function o(){i=this.value,t(1,i)}let u=()=>r.onSubmit(i),s=()=>r.onCancel();return n.$$set=l=>{"options"in l&&t(0,r=l.options)},[r,i,a,o,u,s]}var yM=class extends Pe{constructor(e){super(),Be(this,e,iie,nie,ke,{options:0})}},qU=yM;var Wh=class{constructor(e){this.plugin=e}openCommandSelectModal(e){this.createSearchModal(new Uh(this.plugin,e)).open()}openFileSelectModal(e){this.createSearchModal(new qh(this.plugin,e)).open()}openFolderSelectModal(e){this.createSearchModal(new zh(this.plugin,e)).open()}openButtonBuilderModal(e){this.createModal(new $h(this.plugin,e),{title:"Meta Bind Button Builder"}).open()}openSuggesterModal(e,t){this.createSearchModal(new Gh(this.plugin,t,e)).open()}openImageSuggesterModal(e,t){this.createModal(new Du((r,i)=>new SU({target:i,props:{plugin:this.plugin,options:this.getImageSuggesterOptions(e),onSelect:a=>{t(a),r.closeModal()}}})),{title:"Meta Bind Image Suggester",classes:["mb-image-suggester-modal"]}).open()}openDatePickerModal(e){this.createModal(new Du((t,r)=>new bU({target:r,props:{selectedDate:e.getInternalValue(),dateChangeCallback:i=>{e.setInternalValue(i),t.closeModal()}}})),{title:"Meta Bind Date Picker"}).open()}openTextPromptModal(e){this.createModal(new Du((t,r)=>new qU({target:r,props:{options:{...e,onSubmit:i=>{e.onSubmit(i),t.closeModal()},onCancel:()=>{e.onCancel(),t.closeModal()}}}})),e).open()}openErrorCollectionViewModal(e){this.createModal(new Du((t,r)=>new Bs({target:r,props:{settings:e}})),{title:"Meta Bind Error Overview",classes:["mb-error-collection-modal","markdown-rendered"]}).open()}createErrorIndicator(e,t){new yf({target:e,props:{plugin:this.plugin,settings:t}})}isFilePathExcluded(e){for(let t of this.plugin.settings.excludedFolders)if(e.startsWith(t))return!0;return!1}};var bf=require("obsidian");var Yh=class{constructor(e,t,r,i,a){this.plugin=e,this.containerEl=t,this.code=i,this.hidden=a;let o=e.app.vault.getAbstractFileByPath(r);if(!(o instanceof bf.TFile))throw new Error(`File not found: ${r}`);this.file=o,this.jsEngine=Ps(this.plugin),this.renderComponent=new bf.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 bf.Component,this.renderComponent.load();let t=await this.evaluateCode(e),r=this.jsEngine.internal.createRenderer(this.containerEl,this.file.path,this.renderComponent);this.hidden||await r.render(t.result);let i=r.convertToSimpleObject(t.result);return console.log(i,typeof i),i}catch(t){t instanceof Error&&(this.containerEl.innerText=t.message,mt.addClass(this.containerEl,"mb-error"));return}}unload(){this.renderComponent.unload()}};var zU=require("obsidian");var jh=class extends zU.Modal{constructor(e,t,r){super(e.app),this.content=t,t.setModal(this),this.options=r}onOpen(){this.options?.title&&this.titleEl.setText(this.options.title),this.options?.classes&&mt.addClasses(this.modalEl,this.options.classes),this.content.mount(this.contentEl)}onClose(){this.content.unmount()}};var $U=require("obsidian"),Zh=class extends $U.FuzzySuggestModal{constructor(e,t){super(e.app),this.content=t}getItems(){return this.content.getItems()}getItemText(e){return this.content.getItemText(e)}onChooseItem(e,t){this.content.onSelected(e)}};var Pi=require("obsidian");var Os=class{constructor(e,t){this.value=e,this.displayValue=t}valueAsString(){return this.value?.toString()??"null"}};function HU(n){let e=[];for(let t of n.children)t instanceof Pi.TFile&&GU(t.extension)&&e.push(new Os(t.path,t.name)),t instanceof Pi.TFolder&&e.push(...HU(t));return e}function aie(n,e,t){let r=[];for(let i of e){let a=i.value;if(a.startsWith('"')&&a.endsWith('"'))a=a.substring(1,a.length-1);else{let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:"expected suggest option query for image suggester to start and end with double quotation marks"});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o;if(a===""||a==="."?o=t.app.vault.getRoot():o=t.app.vault.getAbstractFileByPath(a),o==null){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${a} for image suggester to exist`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof Pi.TFolder)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option query ${i.value} for image suggester to be a folder`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}r.push(...HU(o))}for(let i of n){let a=Aa(i.value);if(!a){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} to be truthy`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}let o=t.app.vault.getAbstractFileByPath(a);if(!o){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to exist`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!(o instanceof Pi.TFile)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be a file`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}if(!GU(o.extension)){let u=new Cr({errorLevel:"ERROR",effect:"failed to get suggest options",cause:`expected suggest option ${i.value} for image suggester to be an image file`});new Pi.Notice(`meta-bind | ${u.message}`),console.warn(u);continue}r.push(new Os(o.path,o.name))}return r}function GU(n){return["apng","avif","gif","jpg","jpeg","jfif","pjpeg","pjp","png","svg","webp"].contains(n)}function WU(n,e){let t=e.mountable.getArguments("option"),r=e.mountable.getArguments("optionQuery");return aie(t,r,n)}var YU=require("obsidian");function oie(n,e,t,r,i){let a=[];for(let o of t)a.push(new Os(o.value,o.name));if(r.length>0){let o;try{o=k5(n)}catch(s){return new YU.Notice("meta-bind | Dataview needs to be installed and enabled to use suggest option queries. Check the console for more information."),console.warn("meta-bind | failed to get dataview api",s),a}let u=we.object({name:we.string().min(1),path:we.string().min(1)});for(let s of r)o.pages(s.value,e).forEach(c=>{try{let f=c.file;if(!u.safeParse(f).success)return;let p=RV(f.path,f.name,i);a.push(new Os(p,`file: ${f.name}`))}catch(f){console.warn("meta-bind | error while computing suggest options",f)}})}return a}function jU(n,e){let t=e.mountable.getArguments("option"),r=e.mountable.getArguments("optionQuery"),i=e.mountable.getArgument("useLinks");return oie(n,e.mountable.getFilePath(),t,r,i===void 0?"true":i.value)}var ZU=require("obsidian"),Jh=class{constructor(){}setSearch(e){this.preparedSearch=(0,ZU.prepareFuzzySearch)(e)}filterItems(e,t){return this.preparedSearch?e.filter(r=>this.preparedSearch?.(t(r))?.score!=null):e}};var JU=require("obsidian"),Xh=class{constructor(){this.menu=new JU.Menu}setItems(e){for(let t of e)this.menu.addItem(r=>{r.setTitle(t.name),t.icon&&r.setIcon(t.icon),t.warning&&r.setWarning(t.warning),r.onClick(t.onclick)})}show(e,t){this.menu.showAtPosition({x:e,y:t},document)}showWithEvent(e){this.menu.showAtMouseEvent(e)}};var Qh=class extends Wh{constructor(e){super(e),this.app=e.app}getLifecycleHookValidator(){return we.instanceof(Ur.Component)}getImageSuggesterOptions(e){return WU(this.plugin,e)}getSuggesterOptions(e){return jU(this.plugin,e)}async renderMarkdown(e,t,r){let i=new Ur.Component;return i.load(),await Ur.MarkdownRenderer.render(this.app,e,t,r,i),()=>i.unload()}executeCommandById(e){return this.app.commands.executeCommandById(e)}isJsEngineAvailable(){try{return Ps(this.plugin),!0}catch{return!1}}async jsEngineRunFile(e,t,r,i){let a=Ps(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof Ur.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),s=new Ur.Component;return await a.internal.executeFile(e,{component:s,container:i,context:{metadata:u,file:o,line:0},contextOverrides:r}),()=>s.unload()}async jsEngineRunCode(e,t,r,i){let a=Ps(this.plugin),o=this.app.vault.getAbstractFileByPath(t);if(!o||!(o instanceof Ur.TFile))throw new Error(`calling file not found: ${t}`);let u=this.app.metadataCache.getFileCache(o),s=new Ur.Component;return await a.internal.execute({code:e,component:s,container:i,context:{metadata:u,file:o,line:0},contextOverrides:r}),()=>s.unload()}createJsRenderer(e,t,r,i){return new Yh(this.plugin,e,t,r,i)}openFile(e,t,r){this.app.workspace.openLinkText(e,t,r)}getFilePathByName(e,t=""){return this.app.metadataCache.getFirstLinkpathDest(e,t)?.path}showNotice(e){new Ur.Notice(e)}parseYaml(e){return(0,Ur.parseYaml)(e)}stringifyYaml(e){return(0,Ur.stringifyYaml)(e)}setIcon(e,t){(0,Ur.setIcon)(e,t)}imagePathToUri(e){return this.app.vault.adapter.getResourcePath(e)}createModal(e,t){return new jh(this.plugin,e,t)}createSearchModal(e){return new Zh(this.plugin,e)}getAllCommands(){return this.app.commands.listCommands().map(e=>({id:e.id,name:e.name}))}getAllFiles(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Ur.TFile).map(e=>e.path)}getAllFolders(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Ur.TFolder).map(e=>e.path)}createFuzzySearch(){return new Jh}async readFilePath(e){let t=this.app.vault.getAbstractFileByPath(e);if(!t||!(t instanceof Ur.TFile))throw new Error(`file not found: ${e}`);return this.app.vault.cachedRead(t)}writeFilePath(e,t){return this.app.vault.adapter.write(e,t)}createContextMenu(e){let t=new Xh;return t.setItems(e),t}async createFile(e,t,r,i){let a=this.app.vault.getAvailablePath((0,Ur.normalizePath)(e+"/"+t),r),o=await this.app.vault.create(a,"");if(i){let u=this.app.workspace.getLeaf(!1);u&&await u.openFile(o,{state:{mode:"source"}})}return o.path}async evaluateTemplaterTemplate(e,t){let r=GA(this.plugin),i=this.app.vault.getAbstractFileByPath(e);if(!i||!(i instanceof Ur.TFile))throw new Error(`Template file not found: ${e}`);let a=this.app.vault.getAbstractFileByPath(t);if(!a||!(a instanceof Ur.TFile))throw new Error(`Target file not found: ${t}`);let o=r.create_running_config(i,a,4);return await r.read_and_parse_template(o)}async createNoteWithTemplater(e,t,r,i){let a=GA(this.plugin),o=this.app.vault.getAbstractFileByPath(e);if(!o||!(o instanceof Ur.TFile))throw new Error(`Template file not found: ${e}`);let u;if(t!==void 0){let l=this.app.vault.getAbstractFileByPath(t);if(!l||!(l instanceof Ur.TFolder))throw new Error(`Folder not found: ${t}`);u=l}return(await a.create_new_note_from_template(o,u,r,i??!0))?.path}};var bM=require("obsidian");var Kh=class extends qu{constructor(e,t,r){super(t,r),this.plugin=e,this.plugin.registerEvent(this.plugin.app.metadataCache.on("changed",(i,a,o)=>{this.manager.onExternalUpdate(this,i.path,structuredClone(o.frontmatter)??{})}))}readExternal(e){let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof bM.TFile))throw new Ut({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let r=this.plugin.app.metadataCache.getFileCache(t)?.frontmatter;return structuredClone(r)??{}}getDefaultCacheItem(e){let t=this.plugin.app.vault.getAbstractFileByPath(e);if(t==null||!(t instanceof bM.TFile))throw new Ut({errorLevel:"CRITICAL",effect:"can not get default cache item",cause:`no file for path "${e}" found or path is not a file`});let r=this.plugin.app.metadataCache.getFileCache(t)?.frontmatter;return console.log("meta-bind | Obs Source >> loaded frontmatter",structuredClone(r),e),{data:structuredClone(r)??{},storagePath:e,file:t,...this.manager.getDefaultCacheItem()}}getTags(e){let t=this.plugin.app.metadataCache.getFileCache(e);if(!t)return[];let r=t.tags?.map(a=>a.tag.substring(1))??[],i=t.frontmatter?.tags;return i&&(Array.isArray(i)?r.push(...i):r.push(i)),Array.from(new Set(r))}async syncExternal(e){await this.plugin.app.fileManager.processFrontMatter(e.file,t=>{Object.assign(t,e.data)})}};var sie=["true","false","on","off","yes","no"],uie=new RegExp("\\b(("+sie.join(")|(")+"))$","i"),xf={name:"yaml",token:function(n,e){var t=n.peek(),r=e.escaped;if(e.escaped=!1,t=="#"&&(n.pos==0||/\s/.test(n.string.charAt(n.pos-1))))return n.skipToEnd(),"comment";if(n.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&n.indentation()>e.keyCol)return n.skipToEnd(),"string";if(e.literal&&(e.literal=!1),n.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,n.match("---")||n.match("..."))return"def";if(n.match(/^\s*-\s+/))return"meta"}if(n.match(/^(\{|\}|\[|\])/))return t=="{"?e.inlinePairs++:t=="}"?e.inlinePairs--:t=="["?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!r&&t==",")return n.next(),"meta";if(e.inlinePairs>0&&!r&&t==",")return e.keyCol=0,e.pair=!1,e.pairStart=!1,n.next(),"meta";if(e.pairStart){if(n.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(n.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(e.inlinePairs==0&&n.match(/^\s*-?[0-9\.\,]+\s?$/)||e.inlinePairs>0&&n.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(n.match(uie))return"keyword"}return!e.pair&&n.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=n.indentation(),"atom"):e.pair&&n.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped=t=="\\",n.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};function eg(n){var e=n.statementIndent,t=n.jsonld,r=n.json||t,i=n.typescript,a=n.wordCharacters||/[\w$\xa1-\uffff]/,o=function(){function $(yn){return{type:yn,style:"keyword"}}var ue=$("keyword a"),Ve=$("keyword b"),at=$("keyword c"),et=$("keyword d"),Vt=$("operator"),Ar={type:"atom",style:"atom"};return{if:$("if"),while:ue,with:ue,else:Ve,do:Ve,try:Ve,finally:Ve,return:et,break:et,continue:et,new:$("new"),delete:at,void:at,throw:at,debugger:$("debugger"),var:$("var"),const:$("var"),let:$("var"),function:$("function"),catch:$("catch"),for:$("for"),switch:$("switch"),case:$("case"),default:$("default"),in:Vt,typeof:Vt,instanceof:Vt,true:Ar,false:Ar,null:Ar,undefined:Ar,NaN:Ar,Infinity:Ar,this:$("this"),class:$("class"),super:$("atom"),yield:at,export:$("export"),import:$("import"),extends:at,await:at}}(),u=/[+\-*&%=<>!?|~^@]/,s=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function l($){for(var ue=!1,Ve,at=!1;(Ve=$.next())!=null;){if(!ue){if(Ve=="/"&&!at)return;Ve=="["?at=!0:at&&Ve=="]"&&(at=!1)}ue=!ue&&Ve=="\\"}}var c,f;function p($,ue,Ve){return c=$,f=Ve,ue}function m($,ue){var Ve=$.next();if(Ve=='"'||Ve=="'")return ue.tokenize=h(Ve),ue.tokenize($,ue);if(Ve=="."&&$.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if(Ve=="."&&$.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Ve))return p(Ve);if(Ve=="="&&$.eat(">"))return p("=>","operator");if(Ve=="0"&&$.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(Ve))return $.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if(Ve=="/")return $.eat("*")?(ue.tokenize=d,d($,ue)):$.eat("/")?($.skipToEnd(),p("comment","comment")):Yr($,ue,1)?(l($),$.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string.special")):($.eat("="),p("operator","operator",$.current()));if(Ve=="`")return ue.tokenize=g,g($,ue);if(Ve=="#"&&$.peek()=="!")return $.skipToEnd(),p("meta","meta");if(Ve=="#"&&$.eatWhile(a))return p("variable","property");if(Ve=="<"&&$.match("!--")||Ve=="-"&&$.match("->")&&!/\S/.test($.string.slice(0,$.start)))return $.skipToEnd(),p("comment","comment");if(u.test(Ve))return(Ve!=">"||!ue.lexical||ue.lexical.type!=">")&&($.eat("=")?(Ve=="!"||Ve=="=")&&$.eat("="):/[<>*+\-|&?]/.test(Ve)&&($.eat(Ve),Ve==">"&&$.eat(Ve))),Ve=="?"&&$.eat(".")?p("."):p("operator","operator",$.current());if(a.test(Ve)){$.eatWhile(a);var at=$.current();if(ue.lastType!="."){if(o.propertyIsEnumerable(at)){var et=o[at];return p(et.type,et.style,at)}if(at=="async"&&$.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",at)}return p("variable","variable",at)}}function h($){return function(ue,Ve){var at=!1,et;if(t&&ue.peek()=="@"&&ue.match(s))return Ve.tokenize=m,p("jsonld-keyword","meta");for(;(et=ue.next())!=null&&!(et==$&&!at);)at=!at&&et=="\\";return at||(Ve.tokenize=m),p("string","string")}}function d($,ue){for(var Ve=!1,at;at=$.next();){if(at=="/"&&Ve){ue.tokenize=m;break}Ve=at=="*"}return p("comment","comment")}function g($,ue){for(var Ve=!1,at;(at=$.next())!=null;){if(!Ve&&(at=="`"||at=="$"&&$.eat("{"))){ue.tokenize=m;break}Ve=!Ve&&at=="\\"}return p("quasi","string.special",$.current())}var y="([{}])";function S($,ue){ue.fatArrowAt&&(ue.fatArrowAt=null);var Ve=$.string.indexOf("=>",$.start);if(!(Ve<0)){if(i){var at=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec($.string.slice($.start,Ve));at&&(Ve=at.index)}for(var et=0,Vt=!1,Ar=Ve-1;Ar>=0;--Ar){var yn=$.string.charAt(Ar),bn=y.indexOf(yn);if(bn>=0&&bn<3){if(!et){++Ar;break}if(--et==0){yn=="("&&(Vt=!0);break}}else if(bn>=3&&bn<6)++et;else if(a.test(yn))Vt=!0;else if(/["'\/`]/.test(yn))for(;;--Ar){if(Ar==0)return;var co=$.string.charAt(Ar-1);if(co==yn&&$.string.charAt(Ar-2)!="\\"){Ar--;break}}else if(Vt&&!et){++Ar;break}}Vt&&!et&&(ue.fatArrowAt=Ar)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function w($,ue,Ve,at,et,Vt){this.indented=$,this.column=ue,this.type=Ve,this.prev=et,this.info=Vt,at!=null&&(this.align=at)}function A($,ue){for(var Ve=$.localVars;Ve;Ve=Ve.next)if(Ve.name==ue)return!0;for(var at=$.context;at;at=at.prev)for(var Ve=at.vars;Ve;Ve=Ve.next)if(Ve.name==ue)return!0}function x($,ue,Ve,at,et){var Vt=$.cc;for(D.state=$,D.stream=et,D.marked=null,D.cc=Vt,D.style=ue,$.lexical.hasOwnProperty("align")||($.lexical.align=!0);;){var Ar=Vt.length?Vt.pop():r?De:U;if(Ar(Ve,at)){for(;Vt.length&&Vt[Vt.length-1].lex;)Vt.pop()();return D.marked?D.marked:Ve=="variable"&&A($,at)?"variableName.local":ue}}}var D={state:null,column:null,marked:null,cc:null};function E(){for(var $=arguments.length-1;$>=0;$--)D.cc.push(arguments[$])}function _(){return E.apply(null,arguments),!0}function N($,ue){for(var Ve=ue;Ve;Ve=Ve.next)if(Ve.name==$)return!0;return!1}function P($){var ue=D.state;if(D.marked="def",ue.context){if(ue.lexical.info=="var"&&ue.context&&ue.context.block){var Ve=B($,ue.context);if(Ve!=null){ue.context=Ve;return}}else if(!N($,ue.localVars)){ue.localVars=new L($,ue.localVars);return}}n.globalVars&&!N($,ue.globalVars)&&(ue.globalVars=new L($,ue.globalVars))}function B($,ue){if(ue)if(ue.block){var Ve=B($,ue.prev);return Ve?Ve==ue.prev?ue:new z(Ve,ue.vars,!0):null}else return N($,ue.vars)?ue:new z(ue.prev,new L($,ue.vars),!1);else return null}function V($){return $=="public"||$=="private"||$=="protected"||$=="abstract"||$=="readonly"}function z($,ue,Ve){this.prev=$,this.vars=ue,this.block=Ve}function L($,ue){this.name=$,this.next=ue}var k=new L("this",new L("arguments",null));function C(){D.state.context=new z(D.state.context,D.state.localVars,!1),D.state.localVars=k}function W(){D.state.context=new z(D.state.context,D.state.localVars,!0),D.state.localVars=null}C.lex=W.lex=!0;function O(){D.state.localVars=D.state.context.vars,D.state.context=D.state.context.prev}O.lex=!0;function H($,ue){var Ve=function(){var at=D.state,et=at.indented;if(at.lexical.type=="stat")et=at.lexical.indented;else for(var Vt=at.lexical;Vt&&Vt.type==")"&&Vt.align;Vt=Vt.prev)et=Vt.indented;at.lexical=new w(et,D.stream.column(),$,null,at.lexical,ue)};return Ve.lex=!0,Ve}function Z(){var $=D.state;$.lexical.prev&&($.lexical.type==")"&&($.indented=$.lexical.indented),$.lexical=$.lexical.prev)}Z.lex=!0;function Q($){function ue(Ve){return Ve==$?_():$==";"||Ve=="}"||Ve==")"||Ve=="]"?E():_(ue)}return ue}function U($,ue){return $=="var"?_(H("vardef",ue),St,Q(";"),Z):$=="keyword a"?_(H("form"),_e,U,Z):$=="keyword b"?_(H("form"),U,Z):$=="keyword d"?D.stream.match(/^\s*$/,!1)?_():_(H("stat"),Se,Q(";"),Z):$=="debugger"?_(Q(";")):$=="{"?_(H("}"),W,Nt,Z,O):$==";"?_():$=="if"?(D.state.lexical.info=="else"&&D.state.cc[D.state.cc.length-1]==Z&&D.state.cc.pop()(),_(H("form"),_e,U,Z,ur)):$=="function"?_(ea):$=="for"?_(H("form"),W,zo,U,O,Z):$=="class"||i&&ue=="interface"?(D.marked="keyword",_(H("form",$=="class"?$:ue),Kr,Z)):$=="variable"?i&&ue=="declare"?(D.marked="keyword",_(U)):i&&(ue=="module"||ue=="enum"||ue=="type")&&D.stream.match(/^\s*\w/,!1)?(D.marked="keyword",ue=="enum"?_(ku):ue=="type"?_(dn,Q("operator"),ge,Q(";")):_(H("form"),Ye,Q("{"),H("}"),Nt,Z,Z)):i&&ue=="namespace"?(D.marked="keyword",_(H("form"),De,U,Z)):i&&ue=="abstract"?(D.marked="keyword",_(U)):_(H("stat"),re):$=="switch"?_(H("form"),_e,Q("{"),H("}","switch"),W,Nt,Z,Z,O):$=="case"?_(De,Q(":")):$=="default"?_(Q(":")):$=="catch"?_(H("form"),C,me,U,Z,O):$=="export"?_(H("stat"),rc,Z):$=="import"?_(H("stat"),uo,Z):$=="async"?_(U):ue=="@"?_(De,U):E(H("stat"),De,Q(";"),Z)}function me($){if($=="(")return _(Nn,Q(")"))}function De($,ue){return Ne($,ue,!1)}function pe($,ue){return Ne($,ue,!0)}function _e($){return $!="("?E():_(H(")"),Se,Q(")"),Z)}function Ne($,ue,Ve){if(D.state.fatArrowAt==D.stream.start){var at=Ve?te:We;if($=="(")return _(C,H(")"),xe(Nn,")"),Z,Q("=>"),at,O);if($=="variable")return E(C,Ye,Q("=>"),at,O)}var et=Ve?Ee:Me;return b.hasOwnProperty($)?_(et):$=="function"?_(ea,et):$=="class"||i&&ue=="interface"?(D.marked="keyword",_(H("form"),wi,Z)):$=="keyword c"||$=="async"?_(Ve?pe:De):$=="("?_(H(")"),Se,Q(")"),Z,et):$=="operator"||$=="spread"?_(Ve?pe:De):$=="["?_(H("]"),Pu,Z,et):$=="{"?ht(Te,"}",null,et):$=="quasi"?E(Ce,et):$=="new"?_(oe(Ve)):_()}function Se($){return $.match(/[;\}\)\],]/)?E():E(De)}function Me($,ue){return $==","?_(Se):Ee($,ue,!1)}function Ee($,ue,Ve){var at=Ve==!1?Me:Ee,et=Ve==!1?De:pe;if($=="=>")return _(C,Ve?te:We,O);if($=="operator")return/\+\+|--/.test(ue)||i&&ue=="!"?_(at):i&&ue=="<"&&D.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?_(H(">"),xe(ge,">"),Z,at):ue=="?"?_(De,Q(":"),et):_(et);if($=="quasi")return E(Ce,at);if($!=";"){if($=="(")return ht(pe,")","call",at);if($==".")return _(le,at);if($=="[")return _(H("]"),Se,Q("]"),Z,at);if(i&&ue=="as")return D.marked="keyword",_(ge,at);if($=="regexp")return D.state.lastType=D.marked="operator",D.stream.backUp(D.stream.pos-D.stream.start-1),_(et)}}function Ce($,ue){return $!="quasi"?E():ue.slice(ue.length-2)!="${"?_(Ce):_(Se,Ge)}function Ge($){if($=="}")return D.marked="string.special",D.state.tokenize=g,_(Ce)}function We($){return S(D.stream,D.state),E($=="{"?U:De)}function te($){return S(D.stream,D.state),E($=="{"?U:pe)}function oe($){return function(ue){return ue=="."?_($?ie:he):ue=="variable"&&i?_(Ae,$?Ee:Me):E($?pe:De)}}function he($,ue){if(ue=="target")return D.marked="keyword",_(Me)}function ie($,ue){if(ue=="target")return D.marked="keyword",_(Ee)}function re($){return $==":"?_(Z,U):E(Me,Q(";"),Z)}function le($){if($=="variable")return D.marked="property",_()}function Te($,ue){if($=="async")return D.marked="property",_(Te);if($=="variable"||D.style=="keyword"){if(D.marked="property",ue=="get"||ue=="set")return _(Ie);var Ve;return i&&D.state.fatArrowAt==D.stream.start&&(Ve=D.stream.match(/^\s*:\s*/,!1))&&(D.state.fatArrowAt=D.stream.pos+Ve[0].length),_(Ze)}else{if($=="number"||$=="string")return D.marked=t?"property":D.style+" property",_(Ze);if($=="jsonld-keyword")return _(Ze);if(i&&V(ue))return D.marked="keyword",_(Te);if($=="[")return _(De,Ht,Q("]"),Ze);if($=="spread")return _(pe,Ze);if(ue=="*")return D.marked="keyword",_(Te);if($==":")return E(Ze)}}function Ie($){return $!="variable"?E(Ze):(D.marked="property",_(ea))}function Ze($){if($==":")return _(pe);if($=="(")return E(ea)}function xe($,ue,Ve){function at(et,Vt){if(Ve?Ve.indexOf(et)>-1:et==","){var Ar=D.state.lexical;return Ar.info=="call"&&(Ar.pos=(Ar.pos||0)+1),_(function(yn,bn){return yn==ue||bn==ue?E():E($)},at)}return et==ue||Vt==ue?_():Ve&&Ve.indexOf(";")>-1?E($):_(Q(ue))}return function(et,Vt){return et==ue||Vt==ue?_():E($,at)}}function ht($,ue,Ve){for(var at=3;at<arguments.length;at++)D.cc.push(arguments[at]);return _(H(ue,Ve),xe($,ue),Z)}function Nt($){return $=="}"?_():E(U,Nt)}function Ht($,ue){if(i){if($==":")return _(ge);if(ue=="?")return _(Ht)}}function Et($,ue){if(i&&($==":"||ue=="in"))return _(ge)}function ae($){if(i&&$==":")return D.stream.match(/^\s*\w+\s+is\b/,!1)?_(De,de,ge):_(ge)}function de($,ue){if(ue=="is")return D.marked="keyword",_()}function ge($,ue){if(ue=="keyof"||ue=="typeof"||ue=="infer"||ue=="readonly")return D.marked="keyword",_(ue=="typeof"?pe:ge);if($=="variable"||ue=="void")return D.marked="type",_(X);if(ue=="|"||ue=="&")return _(ge);if($=="string"||$=="number"||$=="atom")return _(X);if($=="[")return _(H("]"),xe(ge,"]",","),Z,X);if($=="{")return _(H("}"),$e,Z,X);if($=="(")return _(xe(F,")"),qe,X);if($=="<")return _(xe(ge,">"),ge);if($=="quasi")return E(ze,X)}function qe($){if($=="=>")return _(ge)}function $e($){return $.match(/[\}\)\]]/)?_():$==","||$==";"?_($e):E(Re,$e)}function Re($,ue){if($=="variable"||D.style=="keyword")return D.marked="property",_(Re);if(ue=="?"||$=="number"||$=="string")return _(Re);if($==":")return _(ge);if($=="[")return _(Q("variable"),Et,Q("]"),Re);if($=="(")return E(Bi,Re);if(!$.match(/[;\}\)\],]/))return _()}function ze($,ue){return $!="quasi"?E():ue.slice(ue.length-2)!="${"?_(ze):_(ge,Xe)}function Xe($){if($=="}")return D.marked="string.special",D.state.tokenize=g,_(ze)}function F($,ue){return $=="variable"&&D.stream.match(/^\s*[?:]/,!1)||ue=="?"?_(F):$==":"?_(ge):$=="spread"?_(F):E(ge)}function X($,ue){if(ue=="<")return _(H(">"),xe(ge,">"),Z,X);if(ue=="|"||$=="."||ue=="&")return _(ge);if($=="[")return _(ge,Q("]"),X);if(ue=="extends"||ue=="implements")return D.marked="keyword",_(ge);if(ue=="?")return _(ge,Q(":"),ge)}function Ae($,ue){if(ue=="<")return _(H(">"),xe(ge,">"),Z,X)}function Le(){return E(ge,ft)}function ft($,ue){if(ue=="=")return _(ge)}function St($,ue){return ue=="enum"?(D.marked="keyword",_(ku)):E(Ye,Ht,Wr,Dn)}function Ye($,ue){if(i&&V(ue))return D.marked="keyword",_(Ye);if($=="variable")return P(ue),_();if($=="spread")return _(Ye);if($=="[")return ht(ci,"]");if($=="{")return ht(kn,"}")}function kn($,ue){return $=="variable"&&!D.stream.match(/^\s*:/,!1)?(P(ue),_(Wr)):($=="variable"&&(D.marked="property"),$=="spread"?_(Ye):$=="}"?E():$=="["?_(De,Q("]"),Q(":"),kn):_(Q(":"),Ye,Wr))}function ci(){return E(Ye,Wr)}function Wr($,ue){if(ue=="=")return _(pe)}function Dn($){if($==",")return _(St)}function ur($,ue){if($=="keyword b"&&ue=="else")return _(H("form","else"),U,Z)}function zo($,ue){if(ue=="await")return _(zo);if($=="(")return _(H(")"),Sr,Z)}function Sr($){return $=="var"?_(St,xi):$=="variable"?_(xi):E(xi)}function xi($,ue){return $==")"?_():$==";"?_(xi):ue=="in"||ue=="of"?(D.marked="keyword",_(De,xi)):E(De,xi)}function ea($,ue){if(ue=="*")return D.marked="keyword",_(ea);if($=="variable")return P(ue),_(ea);if($=="(")return _(C,H(")"),xe(Nn,")"),Z,ae,U,O);if(i&&ue=="<")return _(H(">"),xe(Le,">"),Z,ea)}function Bi($,ue){if(ue=="*")return D.marked="keyword",_(Bi);if($=="variable")return P(ue),_(Bi);if($=="(")return _(C,H(")"),xe(Nn,")"),Z,ae,O);if(i&&ue=="<")return _(H(">"),xe(Le,">"),Z,Bi)}function dn($,ue){if($=="keyword"||$=="variable")return D.marked="type",_(dn);if(ue=="<")return _(H(">"),xe(Le,">"),Z)}function Nn($,ue){return ue=="@"&&_(De,Nn),$=="spread"?_(Nn):i&&V(ue)?(D.marked="keyword",_(Nn)):i&&$=="this"?_(Ht,Wr):E(Ye,Ht,Wr)}function wi($,ue){return $=="variable"?Kr($,ue):Bn($,ue)}function Kr($,ue){if($=="variable")return P(ue),_(Bn)}function Bn($,ue){if(ue=="<")return _(H(">"),xe(Le,">"),Z,Bn);if(ue=="extends"||ue=="implements"||i&&$==",")return ue=="implements"&&(D.marked="keyword"),_(i?ge:De,Bn);if($=="{")return _(H("}"),hn,Z)}function hn($,ue){if($=="async"||$=="variable"&&(ue=="static"||ue=="get"||ue=="set"||i&&V(ue))&&D.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return D.marked="keyword",_(hn);if($=="variable"||D.style=="keyword")return D.marked="property",_(_i,hn);if($=="number"||$=="string")return _(_i,hn);if($=="[")return _(De,Ht,Q("]"),_i,hn);if(ue=="*")return D.marked="keyword",_(hn);if(i&&$=="(")return E(Bi,hn);if($==";"||$==",")return _(hn);if($=="}")return _();if(ue=="@")return _(De,hn)}function _i($,ue){if(ue=="!"||ue=="?")return _(_i);if($==":")return _(ge,Wr);if(ue=="=")return _(pe);var Ve=D.state.lexical.prev,at=Ve&&Ve.info=="interface";return E(at?Bi:ea)}function rc($,ue){return ue=="*"?(D.marked="keyword",_(ba,Q(";"))):ue=="default"?(D.marked="keyword",_(De,Q(";"))):$=="{"?_(xe(Fu,"}"),ba,Q(";")):E(U)}function Fu($,ue){if(ue=="as")return D.marked="keyword",_(Q("variable"));if($=="variable")return E(pe,Fu)}function uo($){return $=="string"?_():$=="("?E(De):$=="."?E(Me):E(lo,Iu,ba)}function lo($,ue){return $=="{"?ht(lo,"}"):($=="variable"&&P(ue),ue=="*"&&(D.marked="keyword"),_(za))}function Iu($){if($==",")return _(lo,Iu)}function za($,ue){if(ue=="as")return D.marked="keyword",_(lo)}function ba($,ue){if(ue=="from")return D.marked="keyword",_(De)}function Pu($){return $=="]"?_():E(xe(pe,"]"))}function ku(){return E(H("form"),Ye,Q("{"),H("}"),xe(nc,"}"),Z,Z)}function nc(){return E(Ye,Wr)}function ic($,ue){return $.lastType=="operator"||$.lastType==","||u.test(ue.charAt(0))||/[,.]/.test(ue.charAt(0))}function Yr($,ue,Ve){return ue.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(ue.lastType)||ue.lastType=="quasi"&&/\{\s*$/.test($.string.slice(0,$.pos-(Ve||0)))}return{name:n.name,startState:function($){var ue={tokenize:m,lastType:"sof",cc:[],lexical:new w(-$,0,"block",!1),localVars:n.localVars,context:n.localVars&&new z(null,null,!1),indented:0};return n.globalVars&&typeof n.globalVars=="object"&&(ue.globalVars=n.globalVars),ue},token:function($,ue){if($.sol()&&(ue.lexical.hasOwnProperty("align")||(ue.lexical.align=!1),ue.indented=$.indentation(),S($,ue)),ue.tokenize!=d&&$.eatSpace())return null;var Ve=ue.tokenize($,ue);return c=="comment"?Ve:(ue.lastType=c=="operator"&&(f=="++"||f=="--")?"incdec":c,x(ue,Ve,c,f,$))},indent:function($,ue,Ve){if($.tokenize==d||$.tokenize==g)return null;if($.tokenize!=m)return 0;var at=ue&&ue.charAt(0),et=$.lexical,Vt;if(!/^\s*else\b/.test(ue))for(var Ar=$.cc.length-1;Ar>=0;--Ar){var yn=$.cc[Ar];if(yn==Z)et=et.prev;else if(yn!=ur&&yn!=O)break}for(;(et.type=="stat"||et.type=="form")&&(at=="}"||(Vt=$.cc[$.cc.length-1])&&(Vt==Me||Vt==Ee)&&!/^[,\.=+\-*:?[\(]/.test(ue));)et=et.prev;e&&et.type==")"&&et.prev.type=="stat"&&(et=et.prev);var bn=et.type,co=at==bn;return bn=="vardef"?et.indented+($.lastType=="operator"||$.lastType==","?et.info.length+1:0):bn=="form"&&at=="{"?et.indented:bn=="form"?et.indented+Ve.unit:bn=="stat"?et.indented+(ic($,ue)?e||Ve.unit:0):et.info=="switch"&&!co&&n.doubleIndentSwitch!=!1?et.indented+(/^(?:case|default)\b/.test(ue)?Ve.unit:2*Ve.unit):et.align?et.column+(co?0:1):et.indented+(co?0:Ve.unit)},languageData:{indentOnInput:/^\s*(?:case .*?:|default:|\{|\})$/,commentTokens:r?void 0:{line:"//",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]},wordChars:"$"}}}var wf=eg({name:"javascript"}),_rt=eg({name:"json",json:!0}),Srt=eg({name:"json",jsonld:!0}),Art=eg({name:"typescript",typescript:!0});function XU(n){if(!n.settings.enableSyntaxHighlighting)return;window.CodeMirror.defineMode("meta-bind-button",t=>({startState:()=>xf.startState?.(4),blankLine:i=>xf.blankLine?.(i,4),copyState:i=>xf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${xf.token?.(i,a)}`})),window.CodeMirror.defineMode("meta-bind-js-view",t=>({startState:()=>wf.startState?.(4),blankLine:i=>wf.blankLine?.(i,4),copyState:i=>wf.startState?.(4),token:(i,a)=>`line-HyperMD-codeblock ${wf.token?.(i,a)}`}));let e=/^\s*(```+|~~~+)/;window.CodeMirror.defineMode("meta-bind",t=>({startState:()=>({str:void 0,mdrcType:void 0,highlights:void 0,line:1}),token:(i,a)=>{if(a.str===void 0){let s=[i.string],l=1,c=i.lookAhead(l);for(;c!==void 0&&!e.test(c)&&(s.push(c),l+=1,c=i.lookAhead(l),!(l>100)););a.str=s.filter(p=>p.trim()!=="").join(`
`);let f=n.api.isInlineFieldDeclarationAndGetType(a.str.trim());f===void 0?a.highlights=new xo(a.str,[]):(a.fieldType=f,a.highlights=n.api.syntaxHighlighting.highlight(a.str,a.fieldType,!0))}let u=a.highlights.getHighlights().filter(s=>s.range.from.line===a.line).find(s=>s.range.from.column===i.pos+1);return u===void 0?(i.next(),i.eol()&&(a.line+=1),"line-HyperMD-codeblock"):(i.eatWhile(()=>i.pos+1<u.range.to.column)||i.next(),i.eol()&&(a.line+=1),`line-HyperMD-codeblock mb-highlight-${u.tokenClass}`)}}))}var NM=require("@codemirror/language"),Tu=require("@codemirror/view");var on=class extends Error{},_f=class extends Error{};var Kl=function(n){return this instanceof Kl?(this.v=n,this):new Kl(n)},lie=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Kl?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},Ua;(function(n){n[n.SHORTEST=0]="SHORTEST",n[n.LONGEST=1]="LONGEST",n[n.STRICT_EQUAL=2]="STRICT_EQUAL"})(Ua||(Ua={}));function*xM(n,e,...t){if(t.length===0)return;let r=[];for(let i of t)r.push(QU(i));e:for(;;){let i=e8.map(r,s=>s.next()),a=[],o=!0,u=!1;for(let s of i){let l;s.done?(o=!1,l=e):(u=!0,l=s.value),a.push(l)}if(!o&&u)switch(n){case Ua.SHORTEST:break e;case Ua.STRICT_EQUAL:throw new _f("Iterators must have equal lengths")}if(!u)break;yield a}}function wM(n,e,...t){return lie(this,arguments,function*(){if(t.length===0)return yield Kl(void 0);let i=[];for(let a of t)i.push(KU(a));e:for(;;){let a=[];for(let l of i){let c=yield Kl(l.next());a.push(c)}let o=[],u=!0,s=!1;for(let l of a){let c;l.done?(u=!1,c=e):(s=!0,c=l.value),o.push(c)}if(!u&&s)switch(n){case Ua.SHORTEST:break e;case Ua.STRICT_EQUAL:throw new _f("Iterators must have equal lengths")}if(!s)break;yield yield Kl(o)}})}var t8=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},Lo=function(n){return this instanceof Lo?(this.v=n,this):new Lo(n)},r8=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Lo?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*n8(...n){for(let e of xM(Ua.SHORTEST,void 0,...n))yield e}function i8(...n){return r8(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=t8(wM(Ua.SHORTEST,void 0,...n)),s;s=yield Lo(u.next()),t=s.done,!t;){a=s.value,o=!1;try{yield yield Lo(a)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield Lo(i.call(u)))}finally{if(r)throw r.error}}})}function*a8(...n){for(let e of xM(Ua.STRICT_EQUAL,void 0,...n))yield e}function o8(...n){return r8(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=t8(wM(Ua.STRICT_EQUAL,void 0,...n)),s;s=yield Lo(u.next()),t=s.done,!t;){a=s.value,o=!1;try{yield yield Lo(a)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield Lo(i.call(u)))}finally{if(r)throw r.error}}})}var s8=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},cie=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function fie(n,e,t){let r=t;for(let i of Nr(n))r=e(r,i);return r}function pie(n,e,t){var r,i,a,o;return s8(this,void 0,void 0,function*(){let u=t;try{for(var s=!0,l=cie(Tr(n)),c;c=yield l.next(),r=c.done,!r;){o=c.value,s=!1;try{u=yield e(u,o)}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield a.call(l))}finally{if(i)throw i.error}}return u})}function _M(n){switch(!0){case n instanceof Array:return n.length;case oo(n):return n.length;case n instanceof Set:return n.size;case n instanceof Map:return n.size}return fie(n,e=>e+1,0)}function u8(n){return s8(this,void 0,void 0,function*(){switch(!0){case n instanceof Array:case oo(n):case n instanceof Set:case n instanceof Map:return _M(n)}return yield pie(n,e=>e+1,0)})}var qa=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},Vo=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function l8(n,e){for(let t of Nr(n))if(!e(t))return!1;return!0}function c8(n,e){var t,r,i,a;return qa(this,void 0,void 0,function*(){try{for(var o=!0,u=Vo(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(!(yield e(a)))return!1}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!0})}function f8(n){let e=new Set;for(let t of Nr(n)){if(e.has(t))return!1;e.add(t)}return!0}function p8(n){var e,t,r,i;return qa(this,void 0,void 0,function*(){let a=new Set;try{for(var o=!0,u=Vo(Tr(n)),s;s=yield u.next(),e=s.done,!e;){i=s.value,o=!1;try{let l=i;if(a.has(l))return!1;a.add(l)}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=u.return)&&(yield r.call(u))}finally{if(t)throw t.error}}return!0})}function m8(n,e){for(let t of Nr(n))if(e(t))return!0;return!1}function d8(n,e){var t,r,i,a;return qa(this,void 0,void 0,function*(){try{for(var o=!0,u=Vo(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(yield e(a))return!0}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!1})}function h8(n,e,t){if(e<0)return!1;t===void 0&&(t=i=>!!i);let r=0;for(let i of Nr(n))if(t(i)&&(r++,r>e))return!1;return r===e}function g8(n,e,t){var r,i,a,o;return qa(this,void 0,void 0,function*(){if(e<0)return!1;t===void 0&&(t=f=>!!f);let u=0;try{for(var s=!0,l=Vo(Tr(n)),c;c=yield l.next(),r=c.done,!r;){o=c.value,s=!1;try{if((yield t(o))&&(u++,u>e))return!1}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield a.call(l))}finally{if(i)throw i.error}}return u===e})}function v8(n){for(let e of Nr(n))return!1;return!0}function y8(n){var e,t,r,i;return qa(this,void 0,void 0,function*(){try{for(var a=!0,o=Vo(Tr(n)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let s=i;return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function ki(n){return n==null?!1:typeof n[Symbol.iterator]=="function"}function Uo(n){return n==null?!1:typeof n[Symbol.asyncIterator]=="function"}function ya(n){return n==null?!1:n.next!==void 0&&typeof n.next=="function"}function b8(n){for(let[e,t]of Nu(Nr(n)))if(e<t)return!1;return!0}function x8(n){var e,t,r,i;return qa(this,void 0,void 0,function*(){try{for(var a=!0,o=Vo(Af(Tr(n))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[s,l]=i;if(s<l)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function w8(n){for(let[e,t]of Nu(Nr(n)))if(e>t)return!1;return!0}function _8(n){var e,t,r,i;return qa(this,void 0,void 0,function*(){try{for(var a=!0,o=Vo(Af(Tr(n))),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let[s,l]=i;if(s>l)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}return!0})}function oo(n){return typeof n=="string"||n instanceof String}function S8(n,e){for(let t of Nr(n))if(e(t))return!1;return!0}function A8(n,e){var t,r,i,a;return qa(this,void 0,void 0,function*(){try{for(var o=!0,u=Vo(Tr(n)),s;s=yield u.next(),t=s.done,!t;){a=s.value,o=!1;try{if(yield e(a))return!1}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return!0})}function M8(...n){try{for(let e of a8(...n))for(let[t,r]of Nu(e))if(t!==r)return!1}catch{return!1}return!0}function E8(...n){var e,t,r,i;return qa(this,void 0,void 0,function*(){try{try{for(var a=!0,o=Vo(o8(...n)),u;u=yield o.next(),e=u.done,!e;){i=u.value,a=!1;try{let s=i;for(let[l,c]of Nu(s))if(l!==c)return!1}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield r.call(o))}finally{if(t)throw t.error}}}catch{return!1}return!0})}function D8(...n){if(n.length<=1)return!0;let e=n.map(t=>_M(t));return new Set(e).size===1}function N8(...n){return qa(this,void 0,void 0,function*(){if(n.length<=1)return!0;let e=yield tg(n,t=>qa(this,void 0,void 0,function*(){return yield u8(t)}));return new Set(yield Sf(e)).size===1})}var mie=function(n,e,t,r){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function u(c){try{l(r.next(c))}catch(f){o(f)}}function s(c){try{l(r.throw(c))}catch(f){o(f)}}function l(c){c.done?a(c.value):i(c.value).then(u,s)}l((r=r.apply(n,e||[])).next())})},so=function(n){return this instanceof so?(this.v=n,this):new so(n)},SM=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof so?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}},T8=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}};function Nr(n){if(ki(n))return n;if(ya(n))return{[Symbol.iterator](){return n}};if(typeof n=="object"&&n!==null)return function*(){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(yield[e,n[e]])}();throw new on("Given collection is not iterable or iterator.")}function Tr(n){if(Uo(n))return n;if(ya(n))return{[Symbol.asyncIterator](){return SM(this,arguments,function*(){for(;;){let t=yield so(n.next());if(t.done)return yield so(void 0);yield yield so(t.value)}})}};if(typeof n=="object"&&n!==null&&(n=Nr(n)),ki(n))return{[Symbol.asyncIterator](){return SM(this,arguments,function*(){for(let t of n)yield yield so(t)})}};throw new on("Given collection is not async iterable or iterator.")}function QU(n){if(ya(n))return n;if(ki(n))return function*(){for(let e of n)yield e}();throw new on("Given collection is not iterable or iterator.")}function KU(n){if((ya(n)||ki(n))&&(n=Tr(n)),Uo(n))return function(){return SM(this,arguments,function*(){var e,t,r,i;try{for(var a=!0,o=T8(n),u;u=yield so(o.next()),e=u.done,!e;){i=u.value,a=!1;try{yield yield so(i)}finally{a=!0}}}catch(s){t={error:s}}finally{try{!a&&!e&&(r=o.return)&&(yield so(r.call(o)))}finally{if(t)throw t.error}}})}();throw new on("Given collection is not iterable or iterator.")}function AM(n){let e=[];for(let t of Nr(n))e.push(t);return e}function Sf(n){var e,t,r,i;return mie(this,void 0,void 0,function*(){let a=[];try{for(var o=!0,u=T8(Tr(n)),s;s=yield u.next(),e=s.done,!e;){i=s.value,o=!1;try{let l=i;a.push(l)}finally{o=!0}}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=u.return)&&(yield r.call(u))}finally{if(t)throw t.error}}return a})}var Rs=function(n){return this instanceof Rs?(this.v=n,this):new Rs(n)},die=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},hie=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof Rs?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*MM(n,e){let t=new Set;if(n instanceof Map){e===void 0&&(e=r=>r[1]);for(let r of n){let i=e(r);t.has(i)||(yield r,t.add(i))}}else{e===void 0&&(e=r=>r);for(let r of Nr(n)){let i=e(r);t.has(i)||(yield r,t.add(i))}}}function C8(n,e){return hie(this,arguments,function*(){var r,i,a,o;let u=new Set;if(n instanceof Map)for(let f of MM(n,e))yield yield Rs(yield Rs(f));else{e===void 0&&(e=f=>f);try{for(var s=!0,l=die(Tr(n)),c;c=yield Rs(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o,p=e(f);u.has(p)||(yield yield Rs(f),u.add(p))}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield Rs(a.call(l)))}finally{if(i)throw i.error}}}})}var vn=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(a){t[a]=n[a]&&function(o){return new Promise(function(u,s){o=n[a](o),i(u,s,o.done,o.value)})}}function i(a,o,u,s){Promise.resolve(s).then(function(l){a({value:l,done:u})},o)}},st=function(n){return this instanceof st?(this.v=n,this):new st(n)},Pn=function(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(p){r[p]&&(i[p]=function(m){return new Promise(function(h,d){a.push([p,m,h,d])>1||u(p,m)})})}function u(p,m){try{s(r[p](m))}catch(h){f(a[0][3],h)}}function s(p){p.value instanceof st?Promise.resolve(p.value.v).then(l,c):f(a[0][2],p)}function l(p){u("next",p)}function c(p){u("throw",p)}function f(p,m){p(m),a.shift(),a.length&&u(a[0][0],a[0][1])}};function*F8(n,e){for(let t of Nr(n))yield e(t)}function tg(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{yield yield st(yield st(e(o)))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*I8(n,e){for(let[t,r]of n8(n,e))r&&(yield t)}function P8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(i8(n,e)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let[c,f]=o;f&&(yield yield st(c))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*k8(n,e){let t=!0;for(let r of Nr(n)){if(t){if(!e(r)){t=!1,yield r;continue}continue}yield r}}function B8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;let u=!0;try{for(var s=!0,l=vn(Tr(n)),c;c=yield st(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o;if(u){if(!(yield st(e(f)))){u=!1,yield yield st(f);continue}continue}yield yield st(f)}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield st(a.call(l)))}finally{if(i)throw i.error}}})}function*O8(n,e){for(let t of Nr(n))if(e(t))yield t;else break}function R8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let c=o;if(yield st(e(c)))yield yield st(c);else break}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*L8(n,e){if(e<0)throw new on(`Number of repetitions cannot be negative: ${e}`);for(let t=e;t>0;--t)yield n}function V8(n,e){return Pn(this,arguments,function*(){if(e<0)throw new on(`Number of repetitions cannot be negative: ${e}`);let r=yield st(n);for(let i=e;i>0;--i)yield yield st(r)})}function*U8(n,e){for(let t of Nr(n)){let r=e(t,e);if(ki(r))for(let i of Nr(r))yield i;else yield r}}function q8(n,e){return Pn(this,arguments,function*(){var r,i,a,o,u,s,l,c;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),r=m.done,!r;){o=m.value,f=!1;try{let S=yield st(e(o,e));if(ki(S)||Uo(S))try{for(var h=!0,d=(s=void 0,vn(Tr(S))),g;g=yield st(d.next()),u=g.done,!u;){c=g.value,h=!1;try{yield yield st(c)}finally{h=!0}}}catch(b){s={error:b}}finally{try{!h&&!u&&(l=d.return)&&(yield st(l.call(d)))}finally{if(s)throw s.error}}else yield yield st(S)}finally{f=!0}}}catch(y){i={error:y}}finally{try{!f&&!r&&(a=p.return)&&(yield st(a.call(p)))}finally{if(i)throw i.error}}})}function*EM(n,e=1/0){if(e<1){for(let t of Nr(n))n instanceof Map&&(t=t[1]),yield t;return}for(let t of Nr(n))if(n instanceof Map&&(t=t[1]),(ki(t)||ya(t))&&!oo(t))for(let r of EM(t,e-1))yield r;else yield t}function DM(n,e=1/0){return Pn(this,arguments,function*(){var r,i,a,o,u,s,l,c,f,p,m,h;if(e<1){try{for(var d=!0,g=vn(Tr(n)),y;y=yield st(g.next()),r=y.done,!r;){o=y.value,d=!1;try{let E=o;n instanceof Map&&(E=E[1]),yield yield st(E)}finally{d=!0}}}catch(E){i={error:E}}finally{try{!d&&!r&&(a=g.return)&&(yield st(a.call(g)))}finally{if(i)throw i.error}}return yield st(void 0)}try{for(var S=!0,b=vn(Tr(n)),w;w=yield st(b.next()),u=w.done,!u;){c=w.value,S=!1;try{let E=c;if(n instanceof Map&&(E=E[1]),(Uo(E)||ki(E)||ya(E))&&!oo(E))try{for(var A=!0,x=(p=void 0,vn(DM(E,e-1))),D;D=yield st(x.next()),f=D.done,!f;){h=D.value,A=!1;try{yield yield st(h)}finally{A=!0}}}catch(_){p={error:_}}finally{try{!A&&!f&&(m=x.return)&&(yield st(m.call(x)))}finally{if(p)throw p.error}}else yield yield st(E)}finally{S=!0}}}catch(E){s={error:E}}finally{try{!S&&!u&&(l=b.return)&&(yield st(l.call(b)))}finally{if(s)throw s.error}}})}function*z8(n,e){for(let t of Nr(n))e(t)&&(yield t)}function $8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{let c=o;(yield st(e(c)))&&(yield yield st(c))}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*rg(n,e,t,r=!0){if(e<1)throw new on(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new on("Overlap size must be less than chunk size");let i=[],a=!1;for(let o of Nr(n))a=!1,i.push(o),i.length===e&&(yield i,i=i.slice(e-t),a=!0);!a&&i.length>0&&r&&(yield i)}function ng(n,e,t,r=!0){return Pn(this,arguments,function*(){var a,o,u,s;if(e<1)throw new on(`Chunk size must be \u2265 1. Got ${e}`);if(t>=e)throw new on("Overlap size must be less than chunk size");let l=[],c=!1;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),a=m.done,!a;){s=m.value,f=!1;try{let h=s;c=!1,l.push(h),l.length===e&&(yield yield st(l),l=l.slice(e-t),c=!0)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(u=p.return)&&(yield st(u.call(p)))}finally{if(o)throw o.error}}!c&&l.length>0&&r&&(yield yield st(l))})}function*H8(n,e){for(let t of rg(n,e,0))yield t}function G8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;try{for(var u=!0,s=vn(ng(n,e,0)),l;l=yield st(s.next()),r=l.done,!r;){o=l.value,u=!1;try{yield yield st(o)}finally{u=!0}}}catch(c){i={error:c}}finally{try{!u&&!r&&(a=s.return)&&(yield st(a.call(s)))}finally{if(i)throw i.error}}})}function*Nu(n){let e=rg(n,2,1,!1);for(let t of e)yield t}function Af(n){return Pn(this,arguments,function*(){var t,r,i,a;let o=ng(n,2,1,!1);try{for(var u=!0,s=vn(o),l;l=yield st(s.next()),t=l.done,!t;){a=l.value,u=!1;try{yield yield st(a)}finally{u=!0}}}catch(c){r={error:c}}finally{try{!u&&!t&&(i=s.return)&&(yield st(i.call(s)))}finally{if(r)throw r.error}}})}function*W8(n,e){if(e<0)throw new on(`Limit must be \u2265 0. Got ${e}`);let t=0;for(let r of Nr(n)){if(t>=e)return;yield r,++t}}function Y8(n,e){return Pn(this,arguments,function*(){var r,i,a,o;if(e<0)throw new on(`Limit must be \u2265 0. Got ${e}`);let u=0;try{for(var s=!0,l=vn(Tr(n)),c;c=yield st(l.next()),r=c.done,!r;){o=c.value,s=!1;try{let f=o;if(u>=e)return yield st(void 0);yield yield st(f),++u}finally{s=!0}}}catch(f){i={error:f}}finally{try{!s&&!r&&(a=l.return)&&(yield st(a.call(l)))}finally{if(i)throw i.error}}})}function*j8(n){let e=0;for(let t of Nr(n))yield[e++,t]}function Z8(n){return Pn(this,arguments,function*(){var t,r,i,a;let o=0;try{for(var u=!0,s=vn(Tr(n)),l;l=yield st(s.next()),t=l.done,!t;){a=l.value,u=!1;try{let c=a;yield yield st([o++,c])}finally{u=!0}}}catch(c){r={error:c}}finally{try{!u&&!t&&(i=s.return)&&(yield st(i.call(s)))}finally{if(r)throw r.error}}})}function*J8(n,e=0,t,r=1){if(e<0)throw new on("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new on("Parameter 'count' cannot be negative");if(r<=0)throw new on("Parameter 'step' must be positive");let i=0,a=0;for(let o of Nr(n))if(!(i++<e||(i-e-1)%r!==0)){if(a++===t&&t!==void 0)break;yield o}}function X8(n,e=0,t,r=1){return Pn(this,arguments,function*(){var a,o,u,s;if(e<0)throw new on("Parameter 'start' cannot be negative");if(t!==void 0&&t<0)throw new on("Parameter 'count' cannot be negative");if(r<=0)throw new on("Parameter 'step' must be positive");let l=0,c=0;try{for(var f=!0,p=vn(Tr(n)),m;m=yield st(p.next()),a=m.done,!a;){s=m.value,f=!1;try{let h=s;if(l++<e||(l-e-1)%r!==0)continue;if(c++===t&&t!==void 0)break;yield yield st(h)}finally{f=!0}}}catch(h){o={error:h}}finally{try{!f&&!a&&(u=p.return)&&(yield st(u.call(p)))}finally{if(o)throw o.error}}})}function*Q8(n){for(let[e]of Nr(n))yield e}function K8(n){return Pn(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=vn(Tr(n)),s;s=yield st(u.next()),t=s.done,!t;){a=s.value,o=!1;try{let[l]=a;yield yield st(l)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield st(i.call(u)))}finally{if(r)throw r.error}}})}function*e6(n,e,t=0){if(e<0||t<0)throw new on;let r=-t;for(let i of Nr(n))(r<0||r>=e)&&(yield i),++r}function t6(n,e,t=0){return Pn(this,arguments,function*(){var i,a,o,u;if(e<0||t<0)throw new on;let s=-t;try{for(var l=!0,c=vn(Tr(n)),f;f=yield st(c.next()),i=f.done,!i;){u=f.value,l=!1;try{let p=u;(s<0||s>=e)&&(yield yield st(p)),++s}finally{l=!0}}}catch(p){a={error:p}}finally{try{!l&&!i&&(o=c.return)&&(yield st(o.call(c)))}finally{if(a)throw a.error}}})}function*r6(n){for(let[,e]of Nr(n))yield e}function n6(n){return Pn(this,arguments,function*(){var t,r,i,a;try{for(var o=!0,u=vn(Tr(n)),s;s=yield st(u.next()),t=s.done,!t;){a=s.value,o=!1;try{let[,l]=a;yield yield st(l)}finally{o=!0}}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=u.return)&&(yield st(i.call(u)))}finally{if(r)throw r.error}}})}function*i6(n,e,t){let r=new Map,i=a=>{r.has(a)||(t!==void 0?r.set(a,{}):r.set(a,[]))};for(let a of Nr(n)){let o=e(a),u=t!==void 0?t(a):void 0,s=(ki(o)||ya(o))&&!oo(o)?o:[o];for(let l of MM(s))i(l),u===void 0?r.get(l).push(a):r.get(l)[u]=a}for(let a of r)yield a}function a6(n,e,t){return Pn(this,arguments,function*(){var i,a,o,u,s,l,c,f;let p=new Map,m=w=>{p.has(w)||(t!==void 0?p.set(w,{}):p.set(w,[]))};try{for(var h=!0,d=vn(Tr(n)),g;g=yield st(d.next()),i=g.done,!i;){u=g.value,h=!1;try{let w=u,A=yield st(e(w)),x=t!==void 0?yield st(t(w)):void 0,D=(Uo(A)||ki(A)||ya(A))&&!oo(A)?A:[A];try{for(var y=!0,S=(l=void 0,vn(C8(D))),b;b=yield st(S.next()),s=b.done,!s;){f=b.value,y=!1;try{let E=f;m(E),x===void 0?p.get(E).push(w):p.get(E)[x]=w}finally{y=!0}}}catch(E){l={error:E}}finally{try{!y&&!s&&(c=S.return)&&(yield st(c.call(S)))}finally{if(l)throw l.error}}}finally{h=!0}}}catch(w){a={error:w}}finally{try{!h&&!i&&(o=d.return)&&(yield st(o.call(d)))}finally{if(a)throw a.error}}for(let w of p)yield yield st(w)})}function*o6(n,e){let t=AM(n);e!==void 0?t.sort(e):t.sort();for(let r of t)yield r}function s6(n,e){return Pn(this,arguments,function*(){let r=yield st(Sf(n));e!==void 0?r.sort(e):r.sort();for(let i of r)yield yield st(i)})}var e8={chunkwise:H8,chunkwiseOverlap:rg,compress:I8,dropWhile:k8,enumerate:j8,filter:z8,flatMap:U8,flatten:EM,groupBy:i6,keys:Q8,limit:W8,map:F8,pairwise:Nu,repeat:L8,skip:e6,slice:J8,sort:o6,takeWhile:O8,values:r6,chunkwiseAsync:G8,chunkwiseOverlapAsync:ng,compressAsync:P8,dropWhileAsync:B8,enumerateAsync:Z8,filterAsync:$8,flatMapAsync:q8,flattenAsync:DM,groupByAsync:a6,keysAsync:K8,limitAsync:Y8,mapAsync:tg,pairwiseAsync:Af,repeatAsync:V8,skipAsync:t6,sliceAsync:X8,sortAsync:s6,takeWhileAsync:R8,valuesAsync:n6};var u6={allMatch:l8,allUnique:f8,anyMatch:m8,exactlyN:h8,isEmpty:v8,isAsyncIterable:Uo,isIterable:ki,isIterator:ya,isReversed:b8,isSorted:w8,isString:oo,noneMatch:S8,same:M8,sameCount:D8,allMatchAsync:c8,allUniqueAsync:p8,anyMatchAsync:d8,exactlyNAsync:g8,isEmptyAsync:y8,isReversedAsync:x8,isSortedAsync:_8,noneMatchAsync:A8,sameAsync:E8,sameCountAsync:N8};var ig=require("obsidian");var l6=require("obsidian");var qo=class{static checkSelectionOverlap(e,t,r){if(!e)return!1;for(let i of e.ranges)if(i.to>=t&&i.from<=r)return!0;return!1}static checkRangeOverlap(e,t,r,i){return e<=i&&r<=t}static getContent(e,t,r){return e.sliceDoc(t,r)}static getCurrentFile(e){return e.state.field(l6.editorInfoField).file}static existsDecorationBetween(e,t,r){let i=!1;return e.between(t,r,()=>{i=!0}),i}static existsDecorationOfTypeBetween(e,t,r,i){let a=!1;return e.between(r,i,(o,u,s)=>{s.spec.mb_widgetType===t&&(a=!0)}),a}};function c6(n){return Tu.ViewPlugin.fromClass(class{constructor(e){this.component=new ig.Component,this.component.load(),this.decorations=this.renderWidgets(e)??Tu.Decoration.none,e.dom.addEventListener("click",t=>this.handleClick(t))}handleClick(e){if(e.target instanceof HTMLElement){let t=e.target;for(;t!==null;){if(t.classList.contains("mb-input")){e.stopPropagation();break}t=t.parentElement}}}isLivePreview(e){return e.field(ig.editorLivePreviewField)}update(e){this.decorations=this.decorations.map(e.changes),this.updateWidgets(e.view)}updateWidgets(e){this.decorations=this.decorations.update({filter:(t,r,i)=>u6.anyMatch(e.visibleRanges,o=>qo.checkRangeOverlap(t,r,o.from,o.to))?!0:(i.spec.mb_unload?.(),!1)});for(let{from:t,to:r}of e.visibleRanges)(0,NM.syntaxTree)(e.state).iterate({from:t,to:r,enter:i=>{let a=i.node,o=this.getRenderInfo(e,a);o.widgetType===void 0||o.content===void 0||(o.shouldRender?(this.removeDecoration(a,"field"),this.addDecoration(a,e,"field",o.content,o.widgetType)):o.shouldHighlight?(this.removeDecoration(a,"highlight"),this.addDecoration(a,e,"highlight",o.content,o.widgetType)):this.removeDecoration(a))}})}removeDecoration(e,t){this.decorations.between(e.from-1,e.to+1,(r,i,a)=>{this.decorations=this.decorations.update({filterFrom:r,filterTo:i,filter:(o,u,s)=>t&&s.spec.mb_widgetType===t?!0:(s.spec.mb_unload?.(),!1)})})}addDecoration(e,t,r,i,a){let o=e.from-1,u=e.to+1;if(qo.existsDecorationOfTypeBetween(this.decorations,r,o,u))return;let s=qo.getCurrentFile(t);if(!s)return;let l=this.renderWidget(e,a,r,i,s),c=Array.isArray(l)?l:[l];c.length!==0&&(this.decorations=this.decorations.update({add:c}))}getRenderInfo(e,t){let r=new Set(t.type.name?.split("_"));if(r.has("inline-code")&&!r.has("formatting")){let i=e.state.selection,a=qo.checkSelectionOverlap(i,t.from-1,t.to+1),o=this.readNode(e,t.from,t.to),u=this.isLivePreview(e.state);return{shouldRender:!a&&u,shouldHighlight:(a||!u)&&n.settings.enableSyntaxHighlighting,content:o.content,widgetType:o.widgetType}}return{shouldRender:!1,shouldHighlight:!1,content:void 0,widgetType:void 0}}readNode(e,t,r){let i=qo.getContent(e.state,t,r);return{content:i,widgetType:n.api.isInlineFieldDeclarationAndGetType(i)}}renderWidgets(e){let t=qo.getCurrentFile(e);if(!t)return;let r=[];for(let i of e.visibleRanges)(0,NM.syntaxTree)(e.state).iterate({from:i.from,to:i.to,enter:a=>{let o=a.node,u=this.getRenderInfo(e,o);if(!u.widgetType||!u.content)return;let s;u.shouldRender&&(s=this.renderWidget(o,u.widgetType,"field",u.content,t)),u.shouldHighlight&&(s=this.renderWidget(o,u.widgetType,"highlight",u.content,t)),s&&(Array.isArray(s)?r.push(...s):r.push(s))}});return Tu.Decoration.set(r,!0)}renderWidget(e,t,r,i,a){if(r==="field"){let o=n.api.constructMDRCWidget(t,i,a.path,this.component);return Tu.Decoration.replace({widget:o,mb_widgetType:"field",mb_unload:()=>{o.renderChild?.unload()}}).range(e.from-1,e.to+1)}else return n.api.syntaxHighlighting.highlight(i,t,!1).getHighlights().map(u=>Tu.Decoration.mark({class:`mb-highlight-${u.tokenClass}`}).range(e.from+u.range.from.index,e.from+u.range.to.index))}destroy(){this.component.unload()}},{decorations:e=>e.decorations})}var Mf=wr(Ri()),Ef=wr(Ai());var gie=Ef.P.sequenceMap((n,e,t,r)=>{let i=parseInt(n),a=parseInt(e),o=parseInt(t);return new Ki(i,a,o,r)},Mf.P_UTILS.digits().skip(Ef.P.string(".")),Mf.P_UTILS.digits().skip(Ef.P.string(".")),Mf.P_UTILS.digits(),Ef.P.string("-").then(Mf.P_UTILS.remaining()).optional()),Ki=class n{constructor(e,t,r,i){this.major=e,this.minor=t,this.patch=r,this.prerelease=i}static fromString(e){return Tn(gie,e)}static lessThan(e,t){return e.major<t.major?!0:e.major>t.major?!1:e.minor<t.minor?!0:e.minor>t.minor?!1:e.patch<t.patch?!0:e.patch>t.patch||e.prerelease===void 0?!1:t.prerelease===void 0?!0:e.prerelease<t.prerelease}static greaterThan(e,t){return n.lessThan(t,e)}static equals(e,t){return e.major===t.major&&e.minor===t.minor&&e.patch===t.patch&&e.prerelease===t.prerelease}toString(){return`${this.major}.${this.minor}.${this.patch}${this.prerelease===void 0?"":`-${this.prerelease}`}`}};var ag=class{constructor(e,t){this.plugin=e,this.dependencies=t}getDependency(e){let t=this.dependencies.find(r=>r.pluginId===e);if(t===void 0)throw new $s({errorLevel:"CRITICAL",effect:"Dependency Violation Detected",cause:`Attempted to access dependency ${e} which is not a listed dependency. Please report this error.`});return t}getPlugin(e){return this.plugin.app.plugins.getPlugin(e)}throwPluginNotFound(e){throw new $s({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e} is required, but not installed. Please install the plugin.`})}checkDependencyVersion(e,t){if(Ki.lessThan(t,e.minVersion))throw new $s({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is outdated. Required version is at least ${e.minVersion}, installed version is ${t}. Please update the plugin.`});if(e.maxVersion!==void 0&&(Ki.greaterThan(t,e.maxVersion)||Ki.equals(t,e.maxVersion)))throw new $s({errorLevel:"ERROR",effect:"Dependency Violation Detected",cause:`Plugin ${e.pluginId} is too new. Required version is lower than ${e.maxVersion}, installed version is ${t}. Please downgrade the plugin.`})}checkDependency(e){let t=this.getDependency(e),r=this.getPlugin(e);if(r==null)throw this.throwPluginNotFound(e),Error("unreachable");let i=Ki.fromString(r.manifest.version);return this.checkDependencyVersion(t,i),r}checkDependencyOnStartup(e){let t=this.getDependency(e);if(!this.plugin.app.plugins.enabledPlugins.has(e))throw this.throwPluginNotFound(e),Error("unreachable");let r=Ki.fromString(this.plugin.app.plugins.manifests[e].version);this.checkDependencyVersion(t,r)}checkDependenciesOnStartup(){let e=new Gt("Dependency Validation");for(let t of this.dependencies)if(t.checkOnStartup)try{this.checkDependencyOnStartup(t.pluginId)}catch(r){e.add(r)}return e.hasErrors()?(this.plugin.internal.openErrorCollectionViewModal({text:"The following errors were detected during dependency validation. The plugin won't load until these errors have been resolved. Please install the required plugins and restart Obsidian.",errorCollection:e}),!0):!1}};var _6=require("obsidian");function vie(n){let e;return{c(){e=ee("div")},m(t,r){J(t,e,r),n[2](e)},p:Ke,i:Ke,o:Ke,d(t){t&&Y(e),n[2](null)}}}function yie(n,e,t){let{mountable:r}=e,i;zi(()=>{r.mount(i)}),Ys(()=>{r.unmount()});function a(o){Pr[o?"unshift":"push"](()=>{i=o,t(0,i)})}return n.$$set=o=>{"mountable"in o&&t(1,r=o.mountable)},[i,r,a]}var TM=class extends Pe{constructor(e){super(),Be(this,e,yie,vie,ke,{mountable:1})}},Df=TM;function bie(n){let e,t;return e=new Df({props:{mountable:n[0]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p:Ke,i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function xie(n,e,t){let{declaration:r}=e,{plugin:i}=e,a=new rl(i,Ir(),"","block",r);return n.$$set=o=>{"declaration"in o&&t(1,r=o.declaration),"plugin"in o&&t(2,i=o.plugin)},[a,r,i]}var CM=class extends Pe{constructor(e){super(),Be(this,e,xie,bie,ke,{declaration:1,plugin:2})}},f6=CM;function wie(n){let e,t,r=n[0].title+"",i,a,o,u,s,l,c,f=n[0].display+"",p,m;return o=new Df({props:{mountable:n[1]}}),s=new Df({props:{mountable:n[2]}}),{c(){e=ee("div"),t=ee("h3"),i=He(r),a=fe(),be(o.$$.fragment),u=fe(),be(s.$$.fragment),l=fe(),c=ee("code"),p=He(f),q(e,"class","mb-card")},m(h,d){J(h,e,d),K(e,t),K(t,i),K(e,a),ve(o,e,null),K(e,u),ve(s,e,null),K(e,l),K(e,c),K(c,p),m=!0},p(h,[d]){(!m||d&1)&&r!==(r=h[0].title+"")&&yt(i,r),(!m||d&1)&&f!==(f=h[0].display+"")&&yt(p,f)},i(h){m||(j(o.$$.fragment,h),j(s.$$.fragment,h),m=!0)},o(h){ne(o.$$.fragment,h),ne(s.$$.fragment,h),m=!1},d(h){h&&Y(e),ye(o),ye(s)}}}function _ie(n,e,t){let{declaration:r}=e,{plugin:i}=e,a=i.api.createInlineFieldFromString(r.inputField,"",void 0,"block"),o=i.api.createInlineFieldFromString(r.declaration,"",void 0,"block");return n.$$set=u=>{"declaration"in u&&t(0,r=u.declaration),"plugin"in u&&t(3,i=u.plugin)},[r,a,o,i]}var FM=class extends Pe{constructor(e){super(),Be(this,e,_ie,wie,ke,{declaration:0,plugin:3})}},p6=FM;function m6(n,e,t){let r=n.slice();return r[6]=e[t],r}function d6(n,e,t){let r=n.slice();return r[9]=e[t],r}function h6(n,e,t){let r=n.slice();return r[9]=e[t],r}function Sie(n){let e;return{c(){e=He("Docs")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Aie(n){let e;return{c(){e=He("GitHub")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Mie(n){let e;return{c(){e=He("Report Issue")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Eie(n){let e,t,r,i,a,o,u,s,l;return i=new It({props:{variant:"primary",$$slots:{default:[Sie]},$$scope:{ctx:n}}}),i.$on("click",n[3]),o=new It({props:{$$slots:{default:[Aie]},$$scope:{ctx:n}}}),o.$on("click",n[4]),s=new It({props:{$$slots:{default:[Mie]},$$scope:{ctx:n}}}),s.$on("click",n[5]),{c(){e=ee("h1"),e.textContent="Meta Bind Playground",t=fe(),r=ee("span"),be(i.$$.fragment),a=fe(),be(o.$$.fragment),u=fe(),be(s.$$.fragment)},m(c,f){J(c,e,f),J(c,t,f),J(c,r,f),ve(i,r,null),K(r,a),ve(o,r,null),K(r,u),ve(s,r,null),l=!0},p(c,f){let p={};f&16384&&(p.$$scope={dirty:f,ctx:c}),i.$set(p);let m={};f&16384&&(m.$$scope={dirty:f,ctx:c}),o.$set(m);let h={};f&16384&&(h.$$scope={dirty:f,ctx:c}),s.$set(h)},i(c){l||(j(i.$$.fragment,c),j(o.$$.fragment,c),j(s.$$.fragment,c),l=!0)},o(c){ne(i.$$.fragment,c),ne(o.$$.fragment,c),ne(s.$$.fragment,c),l=!1},d(c){c&&(Y(e),Y(t),Y(r)),ye(i),ye(o),ye(s)}}}function g6(n){let e,t;return e=new f6({props:{declaration:n[9][1],plugin:n[0]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.declaration=r[9][1]),i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function v6(n){let e,t;return e=new p6({props:{declaration:n[9],plugin:n[0]}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&1&&(a.plugin=r[0]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function y6(n){let e,t,r=ct(n[6]),i=[];for(let o=0;o<r.length;o+=1)i[o]=v6(d6(n,r,o));let a=o=>ne(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=Er()},m(o,u){for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(o,u);J(o,e,u),t=!0},p(o,u){if(u&1){r=ct(o[6]);let s;for(s=0;s<r.length;s+=1){let l=d6(o,r,s);i[s]?(i[s].p(l,u),j(i[s],1)):(i[s]=v6(l),i[s].c(),j(i[s],1),i[s].m(e.parentNode,e))}for(bt(),s=r.length;s<i.length;s+=1)a(s);xt()}},i(o){if(!t){for(let u=0;u<r.length;u+=1)j(i[u]);t=!0}},o(o){i=i.filter(Boolean);for(let u=0;u<i.length;u+=1)ne(i[u]);t=!1},d(o){o&&Y(e),Qt(i,o)}}}function Die(n){let e,t,r,i,a,o,u,s,l,c,f,p,m,h,d,g,y,S,b,w,A,x,D,E,_,N,P,B,V,z,L,k,C,W,O,H,Z,Q,U,me,De,pe,_e,Ne,Se,Me,Ee,Ce;t=new ks({props:{$$slots:{default:[Eie]},$$scope:{ctx:n}}}),S=new yf({props:{plugin:n[0],settings:{errorCollection:n[1],code:b6}}}),x=new yf({props:{plugin:n[0],settings:{errorCollection:n[2],code:x6}}});let Ge=ct(Rg(n[0])),We=[];for(let re=0;re<Ge.length;re+=1)We[re]=g6(h6(n,Ge,re));let te=re=>ne(We[re],1,1,()=>{We[re]=null}),oe=ct(Object.values(ep)),he=[];for(let re=0;re<oe.length;re+=1)he[re]=y6(m6(n,oe,re));let ie=re=>ne(he[re],1,1,()=>{he[re]=null});return{c(){e=ee("div"),be(t.$$.fragment),r=fe(),i=ee("h2"),i.textContent="Quick Reference",a=fe(),o=ee("h3"),o.textContent="Error Messages",u=fe(),s=ee("p"),l=He("When creating "),c=ee("a"),c.textContent="Input Fields",p=He(` or
		`),m=ee("a"),m.textContent="View Fields",d=fe(),g=ee("strong"),g.textContent="warnings",y=He(` (
		`),be(S.$$.fragment),b=He(`
		) and `),w=ee("strong"),w.textContent="errors",A=He(` (
		`),be(x.$$.fragment),D=He(`
		) can occur. These are `),E=ee("strong"),E.textContent="clickable",_=He(` and will show a modal with detailed information about the error
		when clicked.`),N=fe(),P=ee("h3"),P.textContent="Unloaded Message",B=fe(),V=ee("p"),V.innerHTML=`A message like this <span class="mb-warning">[MB_UNLOADED] ...</span> means that Obsidian told Meta Bind to unload
		the field that was once displayed there. This usually happens when Meta Bind was disabled, such as after a plugin
		update, or when another plugin is interfering with Meta Bind.`,z=fe(),L=ee("p"),L.textContent="Usually reopening the note or restarting Obsidian causes the field to display normally again.",k=fe(),C=ee("h3"),C.textContent="Bind Targets",W=fe(),O=ee("p"),O.innerHTML=`<a href="https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/guides/inputfields/#binding-to-metadata">Bind Targets</a>
		let the plugin know what frontmatter properties to bind
		<a href="${qt.linkToInputFields()}">Input Fields</a>
		and
		<a href="${qt.linkToViewFields()}">View Fields</a> to.`,H=fe(),Z=ee("h2"),Z.textContent="Playground",Q=fe(),U=ee("h3"),U.textContent="Input Fields",me=fe(),De=ee("p"),De.innerHTML=`<a href="${qt.linkToInputFields()}">Input Fields</a> let you change the frontmatter of your notes from inside
		of notes.`,pe=fe();for(let re=0;re<We.length;re+=1)We[re].c();_e=fe(),Ne=ee("h3"),Ne.textContent="View Fields",Se=fe(),Me=ee("p"),Me.innerHTML=`<a href="${qt.linkToViewFields()}">View Fields</a> let you view and perform calculations using the frontmatter
		of your notes from inside of notes. They will update instantly to reflect changes to the frontmatter made by input
		fields and as fast as obsidian allows it for changes from other sources.`,Ee=fe();for(let re=0;re<he.length;re+=1)he[re].c();q(c,"href",f=qt.linkToInputFields()),q(m,"href",h=qt.linkToViewFields()),q(e,"class","mb-faq-view markdown-rendered")},m(re,le){J(re,e,le),ve(t,e,null),K(e,r),K(e,i),K(e,a),K(e,o),K(e,u),K(e,s),K(s,l),K(s,c),K(s,p),K(s,m),K(s,d),K(s,g),K(s,y),ve(S,s,null),K(s,b),K(s,w),K(s,A),ve(x,s,null),K(s,D),K(s,E),K(s,_),K(e,N),K(e,P),K(e,B),K(e,V),K(e,z),K(e,L),K(e,k),K(e,C),K(e,W),K(e,O),K(e,H),K(e,Z),K(e,Q),K(e,U),K(e,me),K(e,De),K(e,pe);for(let Te=0;Te<We.length;Te+=1)We[Te]&&We[Te].m(e,null);K(e,_e),K(e,Ne),K(e,Se),K(e,Me),K(e,Ee);for(let Te=0;Te<he.length;Te+=1)he[Te]&&he[Te].m(e,null);Ce=!0},p(re,[le]){let Te={};le&16384&&(Te.$$scope={dirty:le,ctx:re}),t.$set(Te);let Ie={};le&1&&(Ie.plugin=re[0]),le&2&&(Ie.settings={errorCollection:re[1],code:b6}),S.$set(Ie);let Ze={};if(le&1&&(Ze.plugin=re[0]),le&4&&(Ze.settings={errorCollection:re[2],code:x6}),x.$set(Ze),le&1){Ge=ct(Rg(re[0]));let xe;for(xe=0;xe<Ge.length;xe+=1){let ht=h6(re,Ge,xe);We[xe]?(We[xe].p(ht,le),j(We[xe],1)):(We[xe]=g6(ht),We[xe].c(),j(We[xe],1),We[xe].m(e,_e))}for(bt(),xe=Ge.length;xe<We.length;xe+=1)te(xe);xt()}if(le&1){oe=ct(Object.values(ep));let xe;for(xe=0;xe<oe.length;xe+=1){let ht=m6(re,oe,xe);he[xe]?(he[xe].p(ht,le),j(he[xe],1)):(he[xe]=y6(ht),he[xe].c(),j(he[xe],1),he[xe].m(e,null))}for(bt(),xe=oe.length;xe<he.length;xe+=1)ie(xe);xt()}},i(re){if(!Ce){j(t.$$.fragment,re),j(S.$$.fragment,re),j(x.$$.fragment,re);for(let le=0;le<Ge.length;le+=1)j(We[le]);for(let le=0;le<oe.length;le+=1)j(he[le]);Ce=!0}},o(re){ne(t.$$.fragment,re),ne(S.$$.fragment,re),ne(x.$$.fragment,re),We=We.filter(Boolean);for(let le=0;le<We.length;le+=1)ne(We[le]);he=he.filter(Boolean);for(let le=0;le<he.length;le+=1)ne(he[le]);Ce=!1},d(re){re&&Y(e),ye(t),ye(S),ye(x),Qt(We,re),Qt(he,re)}}}var b6="INPUT[someInputFieldDeclaration]",x6="INPUT[someInputFieldDeclaration]";function Nie(n,e,t){let{plugin:r}=e,i=new Gt("exampleWarningErrorCollection"),a=new Gt("exampleErrorErrorCollection");zi(()=>{i.add(new fc({errorLevel:"WARNING",effect:"some example warning",cause:"some example reason"})),t(1,i),a.add(new fc({errorLevel:"ERROR",effect:"some example error",cause:"some example reason"})),t(2,a)});let o=()=>{qt.open(qt.linkToHome())},u=()=>{qt.open(qt.linkToGithub())},s=()=>{qt.open(qt.linkToIssues())};return n.$$set=l=>{"plugin"in l&&t(0,r=l.plugin)},[r,i,a,o,u,s]}var IM=class extends Pe{constructor(e){super(),Be(this,e,Nie,Die,ke,{plugin:0})}},w6=IM;var Cu="mb-playground-view-type",og=class extends _6.ItemView{constructor(e,t){super(e),this.plugin=t}getViewType(){return Cu}getDisplayText(){return"Meta Bind Playground"}async onOpen(){this.contentEl.empty(),this.component=new w6({target:this.contentEl,props:{plugin:this.plugin}})}async onClose(){this.component?.$destroy()}};var Vn=require("obsidian");var N6=require("obsidian");var ec=require("obsidian");function Tie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"pen-line"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Cie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"copy"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Fie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"x"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Iie(n){let e,t=n[0].id+"",r,i,a,o,u,s,l,c;return a=new It({props:{variant:"primary",tooltip:"Edit",$$slots:{default:[Tie]},$$scope:{ctx:n}}}),a.$on("click",n[5]),u=new It({props:{variant:"default",tooltip:"Copy",$$slots:{default:[Cie]},$$scope:{ctx:n}}}),u.$on("click",n[6]),l=new It({props:{variant:"destructive",tooltip:"Delete",$$slots:{default:[Fie]},$$scope:{ctx:n}}}),l.$on("click",n[7]),{c(){e=ee("span"),r=He(t),i=fe(),be(a.$$.fragment),o=fe(),be(u.$$.fragment),s=fe(),be(l.$$.fragment)},m(f,p){J(f,e,p),K(e,r),J(f,i,p),ve(a,f,p),J(f,o,p),ve(u,f,p),J(f,s,p),ve(l,f,p),c=!0},p(f,p){(!c||p&1)&&t!==(t=f[0].id+"")&&yt(r,t);let m={};p&514&&(m.$$scope={dirty:p,ctx:f}),a.$set(m);let h={};p&514&&(h.$$scope={dirty:p,ctx:f}),u.$set(h);let d={};p&514&&(d.$$scope={dirty:p,ctx:f}),l.$set(d)},i(f){c||(j(a.$$.fragment,f),j(u.$$.fragment,f),j(l.$$.fragment,f),c=!0)},o(f){ne(a.$$.fragment,f),ne(u.$$.fragment,f),ne(l.$$.fragment,f),c=!1},d(f){f&&(Y(e),Y(i),Y(o),Y(s)),ye(a,f),ye(u,f),ye(l,f)}}}function Pie(n){let e,t,r,i,a,o=(0,ec.stringifyYaml)(n[0])+"",u,s;return t=new ks({props:{$$slots:{default:[Iie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),be(t.$$.fragment),r=fe(),i=ee("pre"),a=ee("code"),u=He(o),q(a,"class","mb-none"),q(i,"class","mb-pre"),q(e,"class","mb-card markdown-rendered")},m(l,c){J(l,e,c),ve(t,e,null),K(e,r),K(e,i),K(i,a),K(a,u),s=!0},p(l,[c]){let f={};c&515&&(f.$$scope={dirty:c,ctx:l}),t.$set(f),(!s||c&1)&&o!==(o=(0,ec.stringifyYaml)(l[0])+"")&&yt(u,o)},i(l){s||(j(t.$$.fragment,l),s=!0)},o(l){ne(t.$$.fragment,l),s=!1},d(l){l&&Y(e),ye(t)}}}function kie(n,e,t){let{template:r}=e,{plugin:i}=e,a=js();function o(){a("delete-template",{template:r})}function u(){i.internal.openButtonBuilderModal({submitText:"Submit",config:structuredClone(r),onOkay:p=>{t(0,r=p)}})}function s(){let p=(0,ec.stringifyYaml)(r);navigator.clipboard.writeText(p),new ec.Notice("meta-bind | Copied to Clipboard")}let l=()=>u(),c=()=>s(),f=()=>o();return n.$$set=p=>{"template"in p&&t(0,r=p.template),"plugin"in p&&t(1,i=p.plugin)},[r,i,o,u,s,l,c,f]}var PM=class extends Pe{constructor(e){super(),Be(this,e,kie,Pie,ke,{template:0,plugin:1})}},S6=PM;var Nf=require("obsidian");function A6(n,e,t){let r=n.slice();return r[14]=e[t],r[15]=e,r[16]=t,r}function M6(n){let e,t,r;function i(o){n[8](o,n[14],n[15],n[16])}let a={plugin:n[1].plugin};return n[14]!==void 0&&(a.template=n[14]),e=new S6({props:a}),Pr.push(()=>Kn(e,"template",i)),e.$on("delete-template",n[9]),{c(){be(e.$$.fragment)},m(o,u){ve(e,o,u),r=!0},p(o,u){n=o;let s={};u&2&&(s.plugin=n[1].plugin),!t&&u&1&&(t=!0,s.template=n[14],Qn(()=>t=!1)),e.$set(s)},i(o){r||(j(e.$$.fragment,o),r=!0)},o(o){ne(e.$$.fragment,o),r=!1},d(o){ye(e,o)}}}function Bie(n){let e;return{c(){e=He("Add Template")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Oie(n){let e;return{c(){e=He("Add Template from Clipboard")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function E6(n){let e,t,r,i,a;return i=new Bs({props:{settings:{errorCollection:n[2]}}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Templates Failed to Parse",r=fe(),be(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ve(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.settings={errorCollection:o[2]}),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),ye(i)}}}function Rie(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Lie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Vie(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[Rie]},$$scope:{ctx:n}}}),e.$on("click",n[12]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[Lie]},$$scope:{ctx:n}}}),r.$on("click",n[13]),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,o){let u={};o&131072&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&131072&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function Uie(n){let e,t,r,i,a,o,u,s,l,c,f,p=ct(n[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=M6(A6(n,p,g));let h=g=>ne(m[g],1,1,()=>{m[g]=null});a=new It({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[Bie]},$$scope:{ctx:n}}}),a.$on("click",n[10]),u=new It({props:{variant:"default",tooltip:"Create New Template from YAML in Clipboard",$$slots:{default:[Oie]},$$scope:{ctx:n}}}),u.$on("click",n[11]);let d=n[2]&&E6(n);return c=new io({props:{$$slots:{default:[Vie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("h2"),t.textContent="Meta Bind Button Templates",r=fe();for(let g=0;g<m.length;g+=1)m[g].c();i=fe(),be(a.$$.fragment),o=fe(),be(u.$$.fragment),s=fe(),d&&d.c(),l=fe(),be(c.$$.fragment)},m(g,y){J(g,e,y),K(e,t),K(e,r);for(let S=0;S<m.length;S+=1)m[S]&&m[S].m(e,null);K(e,i),ve(a,e,null),K(e,o),ve(u,e,null),K(e,s),d&&d.m(e,null),K(e,l),ve(c,e,null),f=!0},p(g,[y]){if(y&11){p=ct(g[0]);let A;for(A=0;A<p.length;A+=1){let x=A6(g,p,A);m[A]?(m[A].p(x,y),j(m[A],1)):(m[A]=M6(x),m[A].c(),j(m[A],1),m[A].m(e,i))}for(bt(),A=p.length;A<m.length;A+=1)h(A);xt()}let S={};y&131072&&(S.$$scope={dirty:y,ctx:g}),a.$set(S);let b={};y&131072&&(b.$$scope={dirty:y,ctx:g}),u.$set(b),g[2]?d?(d.p(g,y),y&4&&j(d,1)):(d=E6(g),d.c(),j(d,1),d.m(e,l)):d&&(bt(),ne(d,1,1,()=>{d=null}),xt());let w={};y&131072&&(w.$$scope={dirty:y,ctx:g}),c.$set(w)},i(g){if(!f){for(let y=0;y<p.length;y+=1)j(m[y]);j(a.$$.fragment,g),j(u.$$.fragment,g),j(d),j(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let y=0;y<m.length;y+=1)ne(m[y]);ne(a.$$.fragment,g),ne(u.$$.fragment,g),ne(d),ne(c.$$.fragment,g),f=!1},d(g){g&&Y(e),Qt(m,g),ye(a),ye(u),d&&d.d(),ye(c)}}}function qie(n,e,t){let{buttonConfigs:r}=e,{modal:i}=e,a;function o(y){t(0,r=r.filter(S=>S!==y))}function u(){r.push(i.plugin.api.buttonActionRunner.createDefaultButtonConfig()),t(0,r)}async function s(){let y;try{y=(0,Nf.parseYaml)(await navigator.clipboard.readText())}catch(b){console.warn(b),new Nf.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}let S=jl.safeParse(y);if(!S.success){let b=hf(S.error,{unionSeparator:`
OR `,issueSeparator:" AND ",prefix:null});console.warn(new bo({errorLevel:"ERROR",effect:"can not parse button config",cause:"zod validation failed. Check your button syntax",positionContext:b.message,docs:[qt.linkToButtonConfig()]})),console.warn(b),new Nf.Notice("meta-bind | Can not parse button config. Check your button syntax. See the console for more details.");return}r.push(y),t(0,r)}function l(){t(2,a=i.save(r)),a===void 0&&i.close()}function c(){i.close()}function f(y,S,b,w){b[w]=y,t(0,r)}let p=y=>o(y.detail.template),m=()=>u(),h=()=>s(),d=()=>l(),g=()=>c();return n.$$set=y=>{"buttonConfigs"in y&&t(0,r=y.buttonConfigs),"modal"in y&&t(1,i=y.modal)},[r,i,a,o,u,s,l,c,f,p,m,h,d,g]}var kM=class extends Pe{constructor(e){super(),Be(this,e,qie,Uie,ke,{buttonConfigs:0,modal:1})}},D6=kM;var sg=class extends N6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new D6({target:this.contentEl,props:{buttonConfigs:SE(this.plugin.settings.buttonTemplates),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){let t=this.plugin.api.buttonManager.setButtonTemplates(e);if(t.hasErrors())return t;this.plugin.settings.buttonTemplates=e,this.plugin.saveSettings()}};var P6=require("obsidian");function T6(n,e,t){let r=n.slice();return r[13]=e[t],r[14]=e,r[15]=t,r}function zie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"x"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function C6(n){let e,t,r,i,a,o,u,s,l,c;function f(){n[8].call(r,n[14],n[15])}function p(){return n[9](n[13])}return o=new It({props:{tooltip:"Delete",$$slots:{default:[zie]},$$scope:{ctx:n}}}),o.$on("click",p),{c(){e=ee("tr"),t=ee("td"),r=ee("input"),i=fe(),a=ee("td"),be(o.$$.fragment),u=fe(),q(r,"type","text"),q(r,"placeholder","path/to/folder"),_o(r,"width","100%"),_o(t,"width","100%")},m(m,h){J(m,e,h),K(e,t),K(t,r),je(r,n[13]),K(e,i),K(e,a),ve(o,a,null),K(e,u),s=!0,l||(c=Fe(r,"input",f),l=!0)},p(m,h){n=m,h&1&&r.value!==n[13]&&je(r,n[13]);let d={};h&65538&&(d.$$scope={dirty:h,ctx:n}),o.$set(d)},i(m){s||(j(o.$$.fragment,m),s=!0)},o(m){ne(o.$$.fragment,m),s=!1},d(m){m&&Y(e),ye(o),l=!1,c()}}}function $ie(n){let e;return{c(){e=He("Add Folder")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function F6(n){let e,t,r,i,a;return i=new Bs({props:{settings:{errorCollection:n[2]}}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Folder Paths are invalid",r=fe(),be(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ve(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.settings={errorCollection:o[2]}),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),ye(i)}}}function Hie(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Gie(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function Wie(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[Hie]},$$scope:{ctx:n}}}),e.$on("click",n[11]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[Gie]},$$scope:{ctx:n}}}),r.$on("click",n[12]),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,o){let u={};o&65536&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&65536&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function Yie(n){let e,t,r,i,a,o,u,s,l,c,f,p=ct(n[0]),m=[];for(let g=0;g<p.length;g+=1)m[g]=C6(T6(n,p,g));let h=g=>ne(m[g],1,1,()=>{m[g]=null});u=new It({props:{variant:"primary",tooltip:"Add new excluded Folder",$$slots:{default:[$ie]},$$scope:{ctx:n}}}),u.$on("click",n[10]);let d=n[2]&&F6(n);return c=new io({props:{$$slots:{default:[Wie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("table"),r=ee("thead"),r.innerHTML="<tr><th>Folder Path</th> <th></th></tr>",i=fe(),a=ee("tbody");for(let g=0;g<m.length;g+=1)m[g].c();o=fe(),be(u.$$.fragment),s=fe(),d&&d.c(),l=fe(),be(c.$$.fragment)},m(g,y){J(g,e,y),K(e,t),K(t,r),K(t,i),K(t,a);for(let S=0;S<m.length;S+=1)m[S]&&m[S].m(a,null);K(e,o),ve(u,e,null),K(e,s),d&&d.m(e,null),K(e,l),ve(c,e,null),f=!0},p(g,[y]){if(y&11){p=ct(g[0]);let w;for(w=0;w<p.length;w+=1){let A=T6(g,p,w);m[w]?(m[w].p(A,y),j(m[w],1)):(m[w]=C6(A),m[w].c(),j(m[w],1),m[w].m(a,null))}for(bt(),w=p.length;w<m.length;w+=1)h(w);xt()}let S={};y&65536&&(S.$$scope={dirty:y,ctx:g}),u.$set(S),g[2]?d?(d.p(g,y),y&4&&j(d,1)):(d=F6(g),d.c(),j(d,1),d.m(e,l)):d&&(bt(),ne(d,1,1,()=>{d=null}),xt());let b={};y&65536&&(b.$$scope={dirty:y,ctx:g}),c.$set(b)},i(g){if(!f){for(let y=0;y<p.length;y+=1)j(m[y]);j(u.$$.fragment,g),j(d),j(c.$$.fragment,g),f=!0}},o(g){m=m.filter(Boolean);for(let y=0;y<m.length;y+=1)ne(m[y]);ne(u.$$.fragment,g),ne(d),ne(c.$$.fragment,g),f=!1},d(g){g&&Y(e),Qt(m,g),ye(u),d&&d.d(),ye(c)}}}function jie(n,e,t){let{excludedFolders:r}=e,{modal:i}=e,{plugin:a}=e,o;function u(g){t(0,r=r.filter(y=>y!==g))}function s(){r.push(""),t(0,r)}function l(){t(2,o=i.save(r)),o===void 0&&i.close()}function c(){i.close()}function f(g,y){g[y]=this.value,t(0,r)}let p=g=>u(g),m=()=>s(),h=()=>l(),d=()=>c();return n.$$set=g=>{"excludedFolders"in g&&t(0,r=g.excludedFolders),"modal"in g&&t(7,i=g.modal),"plugin"in g&&t(1,a=g.plugin)},[r,a,o,u,s,l,c,i,f,p,m,h,d]}var BM=class extends Pe{constructor(e){super(),Be(this,e,jie,Yie,ke,{excludedFolders:0,modal:7,plugin:1})}},I6=BM;var ug=class extends P6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new I6({target:this.contentEl,props:{excludedFolders:this.plugin.settings.excludedFolders.slice(),modal:this,plugin:this.plugin}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){for(let t of e)if(t===""){let r=new Gt("Excluded Folders");return r.add(new Error(`Invalid Folder Path '${t}'. Folder path may not be empty.`)),r}this.plugin.settings.excludedFolders=e,this.plugin.saveSettings()}};var V6=require("obsidian");function Zie(n){let e,t;return e=new qr({props:{plugin:n[1],iconName:"x"}}),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Jie(n){let e,t,r,i,a,o;return r=new It({props:{variant:"destructive",tooltip:"Delete Template",$$slots:{default:[Zie]},$$scope:{ctx:n}}}),r.$on("click",n[4]),{c(){e=ee("input"),t=fe(),be(r.$$.fragment),q(e,"type","text"),q(e,"placeholder","template-name")},m(u,s){J(u,e,s),je(e,n[0].name),J(u,t,s),ve(r,u,s),i=!0,a||(o=Fe(e,"input",n[3]),a=!0)},p(u,s){s&1&&e.value!==u[0].name&&je(e,u[0].name);let l={};s&130&&(l.$$scope={dirty:s,ctx:u}),r.$set(l)},i(u){i||(j(r.$$.fragment,u),i=!0)},o(u){ne(r.$$.fragment,u),i=!1},d(u){u&&(Y(e),Y(t)),ye(r,u),a=!1,o()}}}function Xie(n){let e,t,r,i,a,o,u;return t=new ks({props:{$$slots:{default:[Jie]},$$scope:{ctx:n}}}),{c(){e=ee("div"),be(t.$$.fragment),r=fe(),i=ee("textarea"),q(i,"placeholder","INPUT[slider(addLabels)]"),_o(i,"width","100%"),_o(i,"height","100px"),_o(i,"resize","vertical"),q(e,"class","mb-card")},m(s,l){J(s,e,l),ve(t,e,null),K(e,r),K(e,i),je(i,n[0].declaration),a=!0,o||(u=Fe(i,"input",n[5]),o=!0)},p(s,[l]){let c={};l&131&&(c.$$scope={dirty:l,ctx:s}),t.$set(c),l&1&&je(i,s[0].declaration)},i(s){a||(j(t.$$.fragment,s),a=!0)},o(s){ne(t.$$.fragment,s),a=!1},d(s){s&&Y(e),ye(t),o=!1,u()}}}function Qie(n,e,t){let{plugin:r}=e,{template:i}=e,a=js();function o(){a("delete-template",{template:i})}function u(){i.name=this.value,t(0,i)}let s=()=>o();function l(){i.declaration=this.value,t(0,i)}return n.$$set=c=>{"plugin"in c&&t(1,r=c.plugin),"template"in c&&t(0,i=c.template)},[i,r,o,u,s,l]}var OM=class extends Pe{constructor(e){super(),Be(this,e,Qie,Xie,ke,{plugin:1,template:0})}},k6=OM;function B6(n,e,t){let r=n.slice();return r[11]=e[t],r}function O6(n){let e,t;return e=new k6({props:{plugin:n[1].plugin,template:n[11]}}),e.$on("delete-template",n[7]),{c(){be(e.$$.fragment)},m(r,i){ve(e,r,i),t=!0},p(r,i){let a={};i&2&&(a.plugin=r[1].plugin),i&1&&(a.template=r[11]),e.$set(a)},i(r){t||(j(e.$$.fragment,r),t=!0)},o(r){ne(e.$$.fragment,r),t=!1},d(r){ye(e,r)}}}function Kie(n){let e;return{c(){e=He("Add Template")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function R6(n){let e,t,r,i,a;return i=new Bs({props:{settings:{errorCollection:n[2]}}}),{c(){e=ee("div"),t=ee("h3"),t.textContent="Some Templates Failed to Parse",r=fe(),be(i.$$.fragment),q(t,"class","mod-error")},m(o,u){J(o,e,u),K(e,t),K(e,r),ve(i,e,null),a=!0},p(o,u){let s={};u&4&&(s.settings={errorCollection:o[2]}),i.$set(s)},i(o){a||(j(i.$$.fragment,o),a=!0)},o(o){ne(i.$$.fragment,o),a=!1},d(o){o&&Y(e),ye(i)}}}function eae(n){let e;return{c(){e=He("Save")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function tae(n){let e;return{c(){e=He("Cancel")},m(t,r){J(t,e,r)},d(t){t&&Y(e)}}}function rae(n){let e,t,r,i;return e=new It({props:{variant:"primary",tooltip:"Save Changes",$$slots:{default:[eae]},$$scope:{ctx:n}}}),e.$on("click",n[9]),r=new It({props:{tooltip:"Revert Changes",$$slots:{default:[tae]},$$scope:{ctx:n}}}),r.$on("click",n[10]),{c(){be(e.$$.fragment),t=fe(),be(r.$$.fragment)},m(a,o){ve(e,a,o),J(a,t,o),ve(r,a,o),i=!0},p(a,o){let u={};o&16384&&(u.$$scope={dirty:o,ctx:a}),e.$set(u);let s={};o&16384&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(j(e.$$.fragment,a),j(r.$$.fragment,a),i=!0)},o(a){ne(e.$$.fragment,a),ne(r.$$.fragment,a),i=!1},d(a){a&&Y(t),ye(e,a),ye(r,a)}}}function nae(n){let e,t,r,i,a,o,u,s,l,c=ct(n[0]),f=[];for(let h=0;h<c.length;h+=1)f[h]=O6(B6(n,c,h));let p=h=>ne(f[h],1,1,()=>{f[h]=null});a=new It({props:{variant:"primary",tooltip:"Create New Template",$$slots:{default:[Kie]},$$scope:{ctx:n}}}),a.$on("click",n[8]);let m=n[2]&&R6(n);return s=new io({props:{$$slots:{default:[rae]},$$scope:{ctx:n}}}),{c(){e=ee("div"),t=ee("h2"),t.textContent="Meta Bind Input Field Templates",r=fe();for(let h=0;h<f.length;h+=1)f[h].c();i=fe(),be(a.$$.fragment),o=fe(),m&&m.c(),u=fe(),be(s.$$.fragment)},m(h,d){J(h,e,d),K(e,t),K(e,r);for(let g=0;g<f.length;g+=1)f[g]&&f[g].m(e,null);K(e,i),ve(a,e,null),K(e,o),m&&m.m(e,null),K(e,u),ve(s,e,null),l=!0},p(h,[d]){if(d&11){c=ct(h[0]);let S;for(S=0;S<c.length;S+=1){let b=B6(h,c,S);f[S]?(f[S].p(b,d),j(f[S],1)):(f[S]=O6(b),f[S].c(),j(f[S],1),f[S].m(e,i))}for(bt(),S=c.length;S<f.length;S+=1)p(S);xt()}let g={};d&16384&&(g.$$scope={dirty:d,ctx:h}),a.$set(g),h[2]?m?(m.p(h,d),d&4&&j(m,1)):(m=R6(h),m.c(),j(m,1),m.m(e,u)):m&&(bt(),ne(m,1,1,()=>{m=null}),xt());let y={};d&16384&&(y.$$scope={dirty:d,ctx:h}),s.$set(y)},i(h){if(!l){for(let d=0;d<c.length;d+=1)j(f[d]);j(a.$$.fragment,h),j(m),j(s.$$.fragment,h),l=!0}},o(h){f=f.filter(Boolean);for(let d=0;d<f.length;d+=1)ne(f[d]);ne(a.$$.fragment,h),ne(m),ne(s.$$.fragment,h),l=!1},d(h){h&&Y(e),Qt(f,h),ye(a),m&&m.d(),ye(s)}}}function iae(n,e,t){let{inputFieldTemplates:r}=e,{modal:i}=e,a;function o(h){t(0,r=r.filter(d=>d!==h))}function u(){r.push({name:"",declaration:""}),t(0,r)}function s(){t(2,a=i.save(r)),a===void 0&&i.close()}function l(){i.close()}let c=h=>o(h.detail.template),f=()=>u(),p=()=>s(),m=()=>l();return n.$$set=h=>{"inputFieldTemplates"in h&&t(0,r=h.inputFieldTemplates),"modal"in h&&t(1,i=h.modal)},[r,i,a,o,u,s,l,c,f,p,m]}var RM=class extends Pe{constructor(e){super(),Be(this,e,iae,nae,ke,{inputFieldTemplates:0,modal:1})}},L6=RM;var lg=class extends V6.Modal{constructor(e,t){super(e),this.plugin=t}onOpen(){this.contentEl.empty(),this.component&&this.component.$destroy(),this.component=new L6({target:this.contentEl,props:{inputFieldTemplates:JSON.parse(JSON.stringify(this.plugin.settings.inputFieldTemplates)),modal:this}})}onClose(){this.contentEl.empty(),this.component&&this.component.$destroy()}save(e){let t=this.plugin.api.inputFieldParser.parseTemplates(e);if(t.hasErrors())return t;this.plugin.settings.inputFieldTemplates=e,this.plugin.saveSettings()}};var cg=class extends Vn.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;if(e.empty(),this.plugin.build==="dev"||this.plugin.build==="canary"){e.createEl("p",{text:`You are using a ${this.plugin.build} build (${this.plugin.manifest.version}). This build is not intended for production use. Use at your own risk.`,cls:"mb-error"});let t=new Vn.ButtonComponent(e);t.setButtonText("Learn About Canary Builds"),t.setCta(),t.onClick(()=>{qt.open(qt.linkToCanaryBuilds())})}new Vn.Setting(e).setName("Quick access").addButton(t=>{t.setCta(),t.setButtonText("Docs"),t.onClick(()=>{qt.open(qt.linkToHome())})}).addButton(t=>{t.setButtonText("Open FAQ"),t.onClick(()=>{this.plugin.activateView(Cu)})}).addButton(t=>{t.setButtonText("GitHub"),t.onClick(()=>{qt.open(qt.linkToGithub())})}).addButton(t=>{t.setButtonText("Report Issue"),t.onClick(()=>{qt.open(qt.linkToIssues())})}),e.createEl("h2",{text:"General Settings"}),new Vn.Setting(e).setName("Enable Syntax Highlighting").setDesc("Enable syntax highlighting for meta bind syntax. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableSyntaxHighlighting),t.onChange(r=>{this.plugin.settings.enableSyntaxHighlighting=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("Enable Editor Right Click Menu").setDesc("Enable a meta bind menu section in the editor right click menu. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableEditorRightClickMenu),t.onChange(r=>{this.plugin.settings.enableEditorRightClickMenu=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("Input Field Templates").setDesc("You can specify input field templates here, and access them using `INPUT[template_name][overrides (optional)]` in your notes.").addButton(t=>{t.setButtonText("Edit Templates"),t.onClick(()=>{new lg(this.app,this.plugin).open()})}),new Vn.Setting(e).setName("Button Templates").setDesc("You can specify button field templates here, and access them in inline buttons.").addButton(t=>{t.setButtonText("Edit Templates"),t.onClick(()=>{new sg(this.app,this.plugin).open()})}),new Vn.Setting(e).setName("Excluded Folders").setDesc("You can specify excluded folders here. The plugin will not work within excluded folders.").addButton(t=>{t.setButtonText("Edit Excluded Folders"),t.onClick(()=>{new ug(this.app,this.plugin).open()})}),new Vn.Setting(e).setName("View Fields display null as empty").setDesc("Display nothing instead of null, if the frontmatter value is empty, in text view fields.").addToggle(t=>{t.setValue(this.plugin.settings.viewFieldDisplayNullAsEmpty),t.onChange(r=>{this.plugin.settings.viewFieldDisplayNullAsEmpty=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("Enable JavaScript").setDesc("Enable features that run user written JavaScript. This is potentially DANGEROUS, thus it's disabled by default. RESTART REQUIRED.").addToggle(t=>{t.setValue(this.plugin.settings.enableJs),t.onChange(r=>{this.plugin.settings.enableJs=r,this.plugin.saveSettings()})}),e.createEl("h2",{text:"Date and Time Settings"}),new Vn.Setting(e).setName("Date format").setDesc("The date format to be used by this plugin. Changing this setting will break the parsing of existing date inputs. Here is a list of all available date tokes https://momentjs.com/docs/#/displaying/.").addText(t=>{t.setValue(this.plugin.settings.preferredDateFormat),t.onChange(r=>{this.plugin.settings.preferredDateFormat=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("First Weekday").setDesc("Specify the first weekday for the datepicker.").addDropdown(t=>{for(let r of Us)t.addOption(r.name,r.name);t.setValue(this.plugin.settings.firstWeekday.name),t.onChange(r=>{this.plugin.settings.firstWeekday=Us.find(i=>i.name===r),this.plugin.saveSettings()})}),e.createEl("h2",{text:"Advanced Settings"}),new Vn.Setting(e).setName("Dev Mode").setDesc("Enable dev mode. Not recommended unless you want to debug this plugin.").addToggle(t=>{t.setValue(this.plugin.settings.devMode),t.onChange(r=>{this.plugin.settings.devMode=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("Disable Code Block Restrictions").setDesc("Disable restrictions on which input fields can be created in which code blocks. Not recommended unless you know what you are doing.").addToggle(t=>{t.setValue(this.plugin.settings.ignoreCodeBlockRestrictions),t.onChange(r=>{this.plugin.settings.ignoreCodeBlockRestrictions=r,this.plugin.saveSettings()})}),new Vn.Setting(e).setName("Sync interval").setDesc(`The interval in milli-seconds between disk writes. Changing this number is not recommended except if your hard drive is exceptionally slow. Standard: ${wa.syncInterval}; Minimum: ${wa.minSyncInterval}; Maximum: ${wa.maxSyncInterval}`).addText(t=>{t.setValue(this.plugin.settings.syncInterval.toString()),t.onChange(r=>{this.plugin.settings.syncInterval=Number.parseInt(r),Number.isNaN(this.plugin.settings.syncInterval)&&(this.plugin.settings.syncInterval=wa.syncInterval),this.plugin.settings.syncInterval<wa.minSyncInterval&&(this.plugin.settings.syncInterval=wa.minSyncInterval),this.plugin.settings.syncInterval>wa.maxSyncInterval&&(this.plugin.settings.syncInterval=wa.maxSyncInterval),this.plugin.saveSettings()})})}};var Tf=class extends jo{constructor(e,t){super(void 0),this.ctx=e,this.element=t}getPosition(){let e=this.ctx.getSectionInfo(this.element);if(e)return{lineStart:e.lineStart,lineEnd:e.lineEnd}}};var LM=(r=>(r.DEV="dev",r.CANARY="canary",r.RELEASE="release",r))(LM||{}),fg=class extends tc.Plugin{async onload(){console.log("meta-bind | Main >> load"),this.build=this.determineBuild(),await this.loadSettings(),this.addSettingTab(new cg(this.app,this)),this.dependencyManager=new ag(this,[{name:"Dataview",pluginId:"dataview",minVersion:new Ki(0,5,64)},{name:"JS Engine",pluginId:"js-engine",minVersion:new Ki(0,1,0)},{name:"Templater",pluginId:"templater-obsidian",minVersion:new Ki(2,2,3)}]),!this.dependencyManager.checkDependenciesOnStartup()&&(this.api=new Vh(this),this.internal=new Qh(this),this.mountableManager=new rp,this.setUpMetadataManager(),this.loadTemplates(),this.addPostProcessors(),this.registerEditorExtension(c6(this)),this.addCommands(),XU(this),this.registerView(Cu,e=>new og(e,this)),this.addStatusBarBuildIndicator(),this.settings.enableEditorRightClickMenu&&this.registerEvent(this.app.workspace.on("editor-menu",(e,t)=>{OE(e,t,this)})),await(0,tc.loadPrism)())}onunload(){console.log("meta-bind | Main >> unload"),this.mountableManager.unload()}determineBuild(){return this.manifest.version.includes("canary")?"canary":"release"}setUpMetadataManager(){this.metadataManager=new Kf,this.metadataManager.registerSource(new Kh(this,"frontmatter",this.metadataManager)),this.metadataManager.registerSource(new Gf("memory",this.metadataManager)),this.metadataManager.registerSource(new Wf("globalMemory",this.metadataManager)),this.metadataManager.registerSource(new Yf("scope",this.metadataManager)),this.metadataManager.setDefaultSource("frontmatter"),this.registerEvent(this.app.vault.on("rename",(e,t)=>{this.mountableManager.unloadFile(t),this.metadataManager.onStoragePathRenamed(t,e.path)})),this.registerEvent(this.app.vault.on("delete",e=>{this.mountableManager.unloadFile(e.path),this.metadataManager.onStoragePathDeleted(e.path)})),this.registerInterval(window.setInterval(()=>this.metadataManager.cycle(),this.settings.syncInterval))}addPostProcessors(){this.registerMarkdownPostProcessor((e,t)=>{let r=e.querySelectorAll("code"),i=t.sourcePath;for(let a=0;a<r.length;a++){let o=r.item(a);if(o.hasClass("mb-none"))continue;let u=o.innerText,s=this.api.isInlineFieldDeclarationAndGetType(u);if(s===void 0)continue;let l=this.api.createInlineFieldOfTypeFromString(s,u,i,void 0);this.api.wrapInMDRC(l,o,t)}},1),this.registerMarkdownCodeBlockProcessor("meta-bind",(e,t,r)=>{let i=t,a=e.trim(),o=r.sourcePath,u=this.api.isInlineFieldDeclarationAndGetType(a);if(u===void 0)return;let s=this.api.createInlineFieldOfTypeFromString(u,a,o,void 0,"block",new Tf(r,t));this.api.wrapInMDRC(s,i,r)}),this.registerMarkdownCodeBlockProcessor("meta-bind-js-view",(e,t,r)=>{let i=this.api.createJsViewFieldMountable(r.sourcePath,{declaration:e});this.api.wrapInMDRC(i,t,r)}),this.registerMarkdownCodeBlockProcessor("meta-bind-embed",(e,t,r)=>{let i=this.api.createEmbedMountable(r.sourcePath,{content:e,depth:0});this.api.wrapInMDRC(i,t,r)});for(let e=1;e<=$f;e++)this.registerMarkdownCodeBlockProcessor(`meta-bind-embed-internal-${e}`,(t,r,i)=>{let a=this.api.createEmbedMountable(i.sourcePath,{content:t,depth:e});this.api.wrapInMDRC(a,r,i)});this.registerMarkdownCodeBlockProcessor("meta-bind-button",(e,t,r)=>{let i=this.api.createButtonMountable(r.sourcePath,{declaration:e,isPreview:!1,position:new Tf(r,t)});this.api.wrapInMDRC(i,t,r)})}addCommands(){this.addCommand({id:"open-docs",name:"Open Meta Bind Docs",callback:()=>{window.open("https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/","_blank")}}),this.addCommand({id:"open-playground",name:"Open Meta Bind Playground",callback:()=>{this.activateView(Cu)}}),this.addCommand({id:"open-help",name:"Open Meta Bind Help",callback:()=>{this.activateView(Cu)}}),this.addCommand({id:"open-button-builder",name:"Open Button Builder",callback:()=>{this.internal.openButtonBuilderModal({onOkay:e=>{window.navigator.clipboard.writeText(`\`\`\`meta-bind-button
${(0,tc.stringifyYaml)(e)}
\`\`\``)},submitText:"Copy to Clipboard"})}}),this.addCommand({id:"copy-command-id",name:"Select and Copy Command ID",callback:()=>{this.internal.openCommandSelectModal(e=>{window.navigator.clipboard.writeText(e.id)})}})}addStatusBarBuildIndicator(){if(this.build==="dev"){let e=this.addStatusBarItem();e.setText("Meta Bind Dev Build"),e.addClass("mb-error"),this.register(()=>e.remove())}if(this.build==="canary"){let e=this.addStatusBarItem();e.setText(`Meta Bind Canary Build (${this.manifest.version})`),e.addClass("mb-error"),this.register(()=>e.remove())}}loadTemplates(){if(!this.api)return;let e=this.api.inputFieldParser.parseTemplates(this.settings.inputFieldTemplates);e.hasErrors()&&console.warn("meta-bind | failed to parse input field templates",e);let t=this.api.buttonManager.setButtonTemplates(this.settings.buttonTemplates);t.hasErrors()&&console.warn("meta-bind | failed to parse button templates",t)}async loadSettings(){console.log("meta-bind | Main >> settings load");let e=await this.loadData()??{};typeof e=="object"&&e!=null&&(delete e.inputTemplates,delete e.useUsDateInputOrder),this.settings=Object.assign({},wa,e),jf(e,this.settings)||await this.saveSettings()}async saveSettings(){console.log("meta-bind | Main >> settings save"),this.updateInternalSettings(),await this.saveData(this.settings)}updateInternalSettings(){jn.dateFormat=this.settings.preferredDateFormat,NE(this.settings.firstWeekday),this.loadTemplates()}async onExternalSettingsChange(){await this.loadSettings()}async activateView(e){let{workspace:t}=this.app,r,i=t.getLeavesOfType(e);i.length>0?r=i[0]:(r=t.getLeaf("tab"),await r.setViewState({type:e,active:!0})),t.revealLeaf(r)}};
/*! Bundled license information:

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

complex.js/complex.js:
  (**
   * @license Complex.js v2.1.1 12/05/2020
   *
   * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
   * Dual licensed under the MIT or GPL Version 2 licenses.
   **)

fraction.js/fraction.js:
  (**
   * @license Fraction.js v4.3.0 20/08/2023
   * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
   *
   * Copyright (c) 2023, Robert Eisele (robert@raw.org)
   * Dual licensed under the MIT or GPL Version 2 licenses.
   **)

decimal.js/decimal.mjs:
  (*!
   *  decimal.js v10.4.3
   *  An arbitrary-precision Decimal type for JavaScript.
   *  https://github.com/MikeMcl/decimal.js
   *  Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
   *  MIT Licence
   *)
*/
