UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

2 lines 413 kB
/*! For license information please see mathjslab.node.cjs2022.js.LICENSE.txt */ (()=>{var __webpack_modules__={34:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ComplexConfigKeyTable=void 0,e.ComplexConfigKeyTable=["precision","precisionCompare","rounding","toExpPos","minE","maxE","toExpNeg","modulo","crypto"]},109:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FunctionHandle=e.Structure=e.MultiArray=e.Complex=e.CharString=e.stringClass=e.doubleQuoteCharacter=e.singleQuoteCharacter=e.AST=void 0;const i=r(956),n=r(845),s=r(271),a=r(679);class o{static nodeString=i.CharString.create;static nodeNumber=n.Complex.parse;static firstRow=a.MultiArray.firstRow;static appendRow=a.MultiArray.appendRow;static emptyArray=a.MultiArray.emptyArray;static reload=()=>{o.nodeString=i.CharString.create,o.nodeNumber=n.Complex.parse,o.firstRow=a.MultiArray.firstRow,o.appendRow=a.MultiArray.appendRow,o.emptyArray=a.MultiArray.emptyArray};static omitAnswerTable=["=","+=","-=","*=","/=","\\=","^=","**=",".*=","./=",".\\=",".^=",".**=","&=","|=","++_","--_","_++","_--","CMDWLIST","IF"];static omitAnswer=t=>o.omitAnswerTable.includes(t.type)||t.omitAnswer;static nodeLiteral=t=>({type:t});static nodeIdentifier=t=>({type:"IDENT",id:t.replace(/(\r\n|[\n\r])|[\ ]/gm,"")});static nodeCmdWList=(t,e)=>({type:"CMDWLIST",id:t.id,args:e?e.list:[]});static nodeIndexExpr=(t,e=null,r="()")=>({type:"IDX",expr:t,args:e?e.list:[],delim:r});static nodeRange=(t,e,r)=>({type:"RANGE",start_:t,stop_:e,stride_:r??null});static nodeOp=(t,e,r)=>{switch(t){case"+":case"-":case".*":case"*":case"./":case"/":case".\\":case"\\":case".^":case"^":case".**":case"**":case"<":case"<=":case"==":case">=":case">":case"!=":case"~=":case"&":case"|":case"&&":case"||":case"=":case"+=":case"-=":case"*=":case"/=":case"\\=":case"^=":case"**=":case".*=":case"./=":case".\\=":case".^=":case".**=":case"&=":case"|=":return{type:t,left:e,right:r};case"()":case"!":case"~":case"+_":case"-_":case"++_":case"--_":return{type:t,right:e};case".'":case"'":case"_++":case"_--":return{type:t,left:e};default:return{type:`INVALID:${t}`}}};static nodeListFirst=t=>{if(t){const e={type:"LIST",list:[t]};return t.parent=e,e}return{type:"LIST",list:[]}};static appendNodeList=(t,e)=>(e.parent=t,t.list.push(e),t);static nodeList=t=>({type:"LIST",list:t});static nodeFirstRow=(t=null,e)=>t?o.firstRow(t.list,e):o.emptyArray(e);static nodeAppendRow=(t,e=null)=>e?o.appendRow(t,e.list):t;static nodeIndirectRef=(t,e)=>"."===t.type?(t.field.push(e),t):{type:".",obj:t,field:[e]};static nodeReturnList=t=>({type:"RETLIST",selector:t});static nodeFunctionHandle=(t=null,e=null,r=null)=>new s.FunctionHandle(t?t.id:null,!0,e?e.list:[],r);static nodeFunction=(t,e,r,i,n)=>({type:"FCN",id:t.id,return:e.list,parameter:r.list,arguments:i.list,statements:n.list});static nodeArgumentValidation=(t,e,r=null,i,n=null)=>({name:t,size:e.list,class:r,functions:i.list,default:n});static nodeArguments=(t,e)=>({attribute:t,validation:e.list});static nodeDeclarationFirst=t=>({type:t,list:[]});static nodeAppendDeclaration=(t,e)=>(t.list.push(e),t);static nodeIfBegin=(t,e)=>({type:"IF",expression:[t],then:[e],else:null});static nodeIfAppendElse=(t,e)=>(t.else=e.else,t);static nodeIfAppendElseIf=(t,e)=>(t.expression.push(e.expression),t.then.push(e.then),t);static nodeElseIf=(t,e)=>({expression:t,then:e});static nodeElse=t=>({else:t})}e.AST=o,e.default={AST:o};var l=r(956);Object.defineProperty(e,"singleQuoteCharacter",{enumerable:!0,get:function(){return l.singleQuoteCharacter}}),Object.defineProperty(e,"doubleQuoteCharacter",{enumerable:!0,get:function(){return l.doubleQuoteCharacter}}),Object.defineProperty(e,"stringClass",{enumerable:!0,get:function(){return l.stringClass}}),Object.defineProperty(e,"CharString",{enumerable:!0,get:function(){return l.CharString}});var c=r(845);Object.defineProperty(e,"Complex",{enumerable:!0,get:function(){return c.Complex}});var h=r(679);Object.defineProperty(e,"MultiArray",{enumerable:!0,get:function(){return h.MultiArray}});var u=r(212);Object.defineProperty(e,"Structure",{enumerable:!0,get:function(){return u.Structure}});var d=r(271);Object.defineProperty(e,"FunctionHandle",{enumerable:!0,get:function(){return d.FunctionHandle}})},110:function(t,e,r){var i;!function(){"use strict";var n,s,a,o=9e15,l=1e9,c="0123456789abcdef",h="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",u="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",d={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o,maxE:o,crypto:!1},p=!0,m="[DecimalError] ",g=m+"Invalid argument: ",f=m+"Precision limit exceeded",_=m+"crypto unavailable",x="[object Decimal]",E=Math.floor,T=Math.pow,y=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,L=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,A=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,C=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,N=1e7,I=h.length-1,S=u.length-1,R={toStringTag:x};function M(t){var e,r,i,n=t.length-1,s="",a=t[0];if(n>0){for(s+=a,e=1;e<n;e++)(r=7-(i=t[e]+"").length)&&(s+=B(r)),s+=i;(r=7-(i=(a=t[e])+"").length)&&(s+=B(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return s+a}function O(t,e,r){if(t!==~~t||t<e||t>r)throw Error(g+t)}function b(t,e,r,i){var n,s,a,o;for(s=t[0];s>=10;s/=10)--e;return--e<0?(e+=7,n=0):(n=Math.ceil((e+1)/7),e%=7),s=T(10,7-e),o=t[n]%s|0,null==i?e<3?(0==e?o=o/100|0:1==e&&(o=o/10|0),a=r<4&&99999==o||r>3&&49999==o||5e4==o||0==o):a=(r<4&&o+1==s||r>3&&o+1==s/2)&&(t[n+1]/s/100|0)==T(10,e-2)-1||(o==s/2||0==o)&&!(t[n+1]/s/100|0):e<4?(0==e?o=o/1e3|0:1==e?o=o/100|0:2==e&&(o=o/10|0),a=(i||r<4)&&9999==o||!i&&r>3&&4999==o):a=((i||r<4)&&o+1==s||!i&&r>3&&o+1==s/2)&&(t[n+1]/s/1e3|0)==T(10,e-3)-1,a}function w(t,e,r){for(var i,n,s=[0],a=0,o=t.length;a<o;){for(n=s.length;n--;)s[n]*=e;for(s[0]+=c.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(void 0===s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}R.absoluteValue=R.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),F(t)},R.ceil=function(){return F(new this.constructor(this),this.e+1,2)},R.clampedTo=R.clamp=function(t,e){var r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(g+e);return r.cmp(t)<0?t:r.cmp(e)>0?e:new i(r)},R.comparedTo=R.cmp=function(t){var e,r,i,n,s=this,a=s.d,o=(t=new s.constructor(t)).d,l=s.s,c=t.s;if(!a||!o)return l&&c?l!==c?l:a===o?0:!a^l<0?1:-1:NaN;if(!a[0]||!o[0])return a[0]?l:o[0]?-c:0;if(l!==c)return l;if(s.e!==t.e)return s.e>t.e^l<0?1:-1;for(e=0,r=(i=a.length)<(n=o.length)?i:n;e<r;++e)if(a[e]!==o[e])return a[e]>o[e]^l<0?1:-1;return i===n?0:i>n^l<0?1:-1},R.cosine=R.cos=function(){var t,e,r=this,i=r.constructor;return r.d?r.d[0]?(t=i.precision,e=i.rounding,i.precision=t+Math.max(r.e,r.sd())+7,i.rounding=1,r=function(t,e){var r,i,n;if(e.isZero())return e;(i=e.d.length)<32?n=(1/$(4,r=Math.ceil(i/3))).toString():(r=16,n="2.3283064365386962890625e-10"),t.precision+=r,e=K(t,1,e.times(n),new t(1));for(var s=r;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return t.precision-=r,e}(i,J(i,r)),i.precision=t,i.rounding=e,F(2==a||3==a?r.neg():r,t,e,!0)):new i(1):new i(NaN)},R.cubeRoot=R.cbrt=function(){var t,e,r,i,n,s,a,o,l,c,h=this,u=h.constructor;if(!h.isFinite()||h.isZero())return new u(h);for(p=!1,(s=h.s*T(h.s*h,1/3))&&Math.abs(s)!=1/0?i=new u(s.toString()):(r=M(h.d),(s=((t=h.e)-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=T(r,1/3),t=E((t+1)/3)-(t%3==(t<0?-1:2)),(i=new u(r=s==1/0?"5e"+t:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=h.s),a=(t=u.precision)+3;;)if(c=(l=(o=i).times(o).times(o)).plus(h),i=v(c.plus(h).times(o),c.plus(l),a+2,1),M(o.d).slice(0,a)===(r=M(i.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(n||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(F(i,t+1,1),e=!i.times(i).times(i).eq(h));break}if(!n&&(F(o,t+1,0),o.times(o).times(o).eq(h))){i=o;break}a+=4,n=1}return p=!0,F(i,t,u.rounding,e)},R.decimalPlaces=R.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=7*((t=e.length-1)-E(this.e/7)),t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},R.dividedBy=R.div=function(t){return v(this,new this.constructor(t))},R.dividedToIntegerBy=R.divToInt=function(t){var e=this.constructor;return F(v(this,new e(t),0,1,1),e.precision,e.rounding)},R.equals=R.eq=function(t){return 0===this.cmp(t)},R.floor=function(){return F(new this.constructor(this),this.e+1,3)},R.greaterThan=R.gt=function(t){return this.cmp(t)>0},R.greaterThanOrEqualTo=R.gte=function(t){var e=this.cmp(t);return 1==e||0===e},R.hyperbolicCosine=R.cosh=function(){var t,e,r,i,n,s=this,a=s.constructor,o=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return o;r=a.precision,i=a.rounding,a.precision=r+Math.max(s.e,s.sd())+4,a.rounding=1,(n=s.d.length)<32?e=(1/$(4,t=Math.ceil(n/3))).toString():(t=16,e="2.3283064365386962890625e-10"),s=K(a,1,s.times(e),new a(1),!0);for(var l,c=t,h=new a(8);c--;)l=s.times(s),s=o.minus(l.times(h.minus(l.times(h))));return F(s,a.precision=r,a.rounding=i,!0)},R.hyperbolicSine=R.sinh=function(){var t,e,r,i,n=this,s=n.constructor;if(!n.isFinite()||n.isZero())return new s(n);if(e=s.precision,r=s.rounding,s.precision=e+Math.max(n.e,n.sd())+4,s.rounding=1,(i=n.d.length)<3)n=K(s,2,n,n,!0);else{t=(t=1.4*Math.sqrt(i))>16?16:0|t,n=K(s,2,n=n.times(1/$(5,t)),n,!0);for(var a,o=new s(5),l=new s(16),c=new s(20);t--;)a=n.times(n),n=n.times(o.plus(a.times(l.times(a).plus(c))))}return s.precision=e,s.rounding=r,F(n,e,r,!0)},R.hyperbolicTangent=R.tanh=function(){var t,e,r=this,i=r.constructor;return r.isFinite()?r.isZero()?new i(r):(t=i.precision,e=i.rounding,i.precision=t+7,i.rounding=1,v(r.sinh(),r.cosh(),i.precision=t,i.rounding=e)):new i(r.s)},R.inverseCosine=R.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),i=e.precision,n=e.rounding;return-1!==r?0===r?t.isNeg()?U(e,i,n):new e(0):new e(NaN):t.isZero()?U(e,i+4,n).times(.5):(e.precision=i+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=i,e.rounding=n,t.times(2))},R.inverseHyperbolicCosine=R.acosh=function(){var t,e,r=this,i=r.constructor;return r.lte(1)?new i(r.eq(1)?0:NaN):r.isFinite()?(t=i.precision,e=i.rounding,i.precision=t+Math.max(Math.abs(r.e),r.sd())+4,i.rounding=1,p=!1,r=r.times(r).minus(1).sqrt().plus(r),p=!0,i.precision=t,i.rounding=e,r.ln()):new i(r)},R.inverseHyperbolicSine=R.asinh=function(){var t,e,r=this,i=r.constructor;return!r.isFinite()||r.isZero()?new i(r):(t=i.precision,e=i.rounding,i.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,i.rounding=1,p=!1,r=r.times(r).plus(1).sqrt().plus(r),p=!0,i.precision=t,i.rounding=e,r.ln())},R.inverseHyperbolicTangent=R.atanh=function(){var t,e,r,i,n=this,s=n.constructor;return n.isFinite()?n.e>=0?new s(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(t=s.precision,e=s.rounding,i=n.sd(),Math.max(i,t)<2*-n.e-1?F(new s(n),t,e,!0):(s.precision=r=i-n.e,n=v(n.plus(1),new s(1).minus(n),r+t,1),s.precision=t+4,s.rounding=1,n=n.ln(),s.precision=t,s.rounding=e,n.times(.5))):new s(NaN)},R.inverseSine=R.asin=function(){var t,e,r,i,n=this,s=n.constructor;return n.isZero()?new s(n):(e=n.abs().cmp(1),r=s.precision,i=s.rounding,-1!==e?0===e?((t=U(s,r+4,i).times(.5)).s=n.s,t):new s(NaN):(s.precision=r+6,s.rounding=1,n=n.div(new s(1).minus(n.times(n)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=i,n.times(2)))},R.inverseTangent=R.atan=function(){var t,e,r,i,n,s,a,o,l,c=this,h=c.constructor,u=h.precision,d=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&u+4<=S)return(a=U(h,u+4,d).times(.25)).s=c.s,a}else{if(!c.s)return new h(NaN);if(u+4<=S)return(a=U(h,u+4,d).times(.5)).s=c.s,a}for(h.precision=o=u+10,h.rounding=1,t=r=Math.min(28,o/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(p=!1,e=Math.ceil(o/7),i=1,l=c.times(c),a=new h(c),n=c;-1!==t;)if(n=n.times(l),s=a.minus(n.div(i+=2)),n=n.times(l),void 0!==(a=s.plus(n.div(i+=2))).d[e])for(t=e;a.d[t]===s.d[t]&&t--;);return r&&(a=a.times(2<<r-1)),p=!0,F(a,h.precision=u,h.rounding=d,!0)},R.isFinite=function(){return!!this.d},R.isInteger=R.isInt=function(){return!!this.d&&E(this.e/7)>this.d.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isPositive=R.isPos=function(){return this.s>0},R.isZero=function(){return!!this.d&&0===this.d[0]},R.lessThan=R.lt=function(t){return this.cmp(t)<0},R.lessThanOrEqualTo=R.lte=function(t){return this.cmp(t)<1},R.logarithm=R.log=function(t){var e,r,i,n,s,a,o,l,c=this,h=c.constructor,u=h.precision,d=h.rounding;if(null==t)t=new h(10),e=!0;else{if(r=(t=new h(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new h(NaN);e=t.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new h(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(e)if(r.length>1)s=!0;else{for(n=r[0];n%10==0;)n/=10;s=1!==n}if(p=!1,a=W(c,o=u+5),i=e?k(h,o+10):W(t,o),b((l=v(a,i,o,1)).d,n=u,d))do{if(a=W(c,o+=10),i=e?k(h,o+10):W(t,o),l=v(a,i,o,1),!s){+M(l.d).slice(n+1,n+15)+1==1e14&&(l=F(l,u+1,0));break}}while(b(l.d,n+=10,d));return p=!0,F(l,u,d)},R.minus=R.sub=function(t){var e,r,i,n,s,a,o,l,c,h,u,d,m=this,g=m.constructor;if(t=new g(t),!m.d||!t.d)return m.s&&t.s?m.d?t.s=-t.s:t=new g(t.d||m.s!==t.s?m:NaN):t=new g(NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(c=m.d,d=t.d,o=g.precision,l=g.rounding,!c[0]||!d[0]){if(d[0])t.s=-t.s;else{if(!c[0])return new g(3===l?-0:0);t=new g(m)}return p?F(t,o,l):t}if(r=E(t.e/7),h=E(m.e/7),c=c.slice(),s=h-r){for((u=s<0)?(e=c,s=-s,a=d.length):(e=d,r=h,a=c.length),s>(i=Math.max(Math.ceil(o/7),a)+2)&&(s=i,e.length=1),e.reverse(),i=s;i--;)e.push(0);e.reverse()}else{for((u=(i=c.length)<(a=d.length))&&(a=i),i=0;i<a;i++)if(c[i]!=d[i]){u=c[i]<d[i];break}s=0}for(u&&(e=c,c=d,d=e,t.s=-t.s),a=c.length,i=d.length-a;i>0;--i)c[a++]=0;for(i=d.length;i>s;){if(c[--i]<d[i]){for(n=i;n&&0===c[--n];)c[n]=N-1;--c[n],c[i]+=N}c[i]-=d[i]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=P(c,r),p?F(t,o,l):t):new g(3===l?-0:0)},R.modulo=R.mod=function(t){var e,r=this,i=r.constructor;return t=new i(t),!r.d||!t.s||t.d&&!t.d[0]?new i(NaN):!t.d||r.d&&!r.d[0]?F(new i(r),i.precision,i.rounding):(p=!1,9==i.modulo?(e=v(r,t.abs(),0,3,1)).s*=t.s:e=v(r,t,0,i.modulo,1),e=e.times(t),p=!0,r.minus(e))},R.naturalExponential=R.exp=function(){return q(this)},R.naturalLogarithm=R.ln=function(){return W(this)},R.negated=R.neg=function(){var t=new this.constructor(this);return t.s=-t.s,F(t)},R.plus=R.add=function(t){var e,r,i,n,s,a,o,l,c,h,u=this,d=u.constructor;if(t=new d(t),!u.d||!t.d)return u.s&&t.s?u.d||(t=new d(t.d||u.s===t.s?u:NaN)):t=new d(NaN),t;if(u.s!=t.s)return t.s=-t.s,u.minus(t);if(c=u.d,h=t.d,o=d.precision,l=d.rounding,!c[0]||!h[0])return h[0]||(t=new d(u)),p?F(t,o,l):t;if(s=E(u.e/7),i=E(t.e/7),c=c.slice(),n=s-i){for(n<0?(r=c,n=-n,a=h.length):(r=h,i=s,a=c.length),n>(a=(s=Math.ceil(o/7))>a?s+1:a+1)&&(n=a,r.length=1),r.reverse();n--;)r.push(0);r.reverse()}for((a=c.length)-(n=h.length)<0&&(n=a,r=h,h=c,c=r),e=0;n;)e=(c[--n]=c[n]+h[n]+e)/N|0,c[n]%=N;for(e&&(c.unshift(e),++i),a=c.length;0==c[--a];)c.pop();return t.d=c,t.e=P(c,i),p?F(t,o,l):t},R.precision=R.sd=function(t){var e,r=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(g+t);return r.d?(e=H(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e},R.round=function(){var t=this,e=t.constructor;return F(new e(t),t.e+1,e.rounding)},R.sine=R.sin=function(){var t,e,r=this,i=r.constructor;return r.isFinite()?r.isZero()?new i(r):(t=i.precision,e=i.rounding,i.precision=t+Math.max(r.e,r.sd())+7,i.rounding=1,r=function(t,e){var r,i=e.d.length;if(i<3)return e.isZero()?e:K(t,2,e,e);r=(r=1.4*Math.sqrt(i))>16?16:0|r,e=K(t,2,e=e.times(1/$(5,r)),e);for(var n,s=new t(5),a=new t(16),o=new t(20);r--;)n=e.times(e),e=e.times(s.plus(n.times(a.times(n).minus(o))));return e}(i,J(i,r)),i.precision=t,i.rounding=e,F(a>2?r.neg():r,t,e,!0)):new i(NaN)},R.squareRoot=R.sqrt=function(){var t,e,r,i,n,s,a=this,o=a.d,l=a.e,c=a.s,h=a.constructor;if(1!==c||!o||!o[0])return new h(!c||c<0&&(!o||o[0])?NaN:o?a:1/0);for(p=!1,0==(c=Math.sqrt(+a))||c==1/0?(((e=M(o)).length+l)%2==0&&(e+="0"),c=Math.sqrt(e),l=E((l+1)/2)-(l<0||l%2),i=new h(e=c==1/0?"5e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):i=new h(c.toString()),r=(l=h.precision)+3;;)if(i=(s=i).plus(v(a,s,r+2,1)).times(.5),M(s.d).slice(0,r)===(e=M(i.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(n||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(F(i,l+1,1),t=!i.times(i).eq(a));break}if(!n&&(F(s,l+1,0),s.times(s).eq(a))){i=s;break}r+=4,n=1}return p=!0,F(i,l,h.rounding,t)},R.tangent=R.tan=function(){var t,e,r=this,i=r.constructor;return r.isFinite()?r.isZero()?new i(r):(t=i.precision,e=i.rounding,i.precision=t+10,i.rounding=1,(r=r.sin()).s=1,r=v(r,new i(1).minus(r.times(r)).sqrt(),t+10,0),i.precision=t,i.rounding=e,F(2==a||4==a?r.neg():r,t,e,!0)):new i(NaN)},R.times=R.mul=function(t){var e,r,i,n,s,a,o,l,c,h=this,u=h.constructor,d=h.d,m=(t=new u(t)).d;if(t.s*=h.s,!(d&&d[0]&&m&&m[0]))return new u(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:d&&m?0*t.s:t.s/0);for(r=E(h.e/7)+E(t.e/7),(l=d.length)<(c=m.length)&&(s=d,d=m,m=s,a=l,l=c,c=a),s=[],i=a=l+c;i--;)s.push(0);for(i=c;--i>=0;){for(e=0,n=l+i;n>i;)o=s[n]+m[i]*d[n-i-1]+e,s[n--]=o%N|0,e=o/N|0;s[n]=(s[n]+e)%N|0}for(;!s[--a];)s.pop();return e?++r:s.shift(),t.d=s,t.e=P(s,r),p?F(t,u.precision,u.rounding):t},R.toBinary=function(t,e){return Y(this,2,t,e)},R.toDecimalPlaces=R.toDP=function(t,e){var r=this,i=r.constructor;return r=new i(r),void 0===t?r:(O(t,0,l),void 0===e?e=i.rounding:O(e,0,8),F(r,t+r.e+1,e))},R.toExponential=function(t,e){var r,i=this,n=i.constructor;return void 0===t?r=D(i,!0):(O(t,0,l),void 0===e?e=n.rounding:O(e,0,8),r=D(i=F(new n(i),t+1,e),!0,t+1)),i.isNeg()&&!i.isZero()?"-"+r:r},R.toFixed=function(t,e){var r,i,n=this,s=n.constructor;return void 0===t?r=D(n):(O(t,0,l),void 0===e?e=s.rounding:O(e,0,8),r=D(i=F(new s(n),t+n.e+1,e),!1,t+i.e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},R.toFraction=function(t){var e,r,i,n,s,a,o,l,c,h,u,d,m=this,f=m.d,_=m.constructor;if(!f)return new _(m);if(c=r=new _(1),i=l=new _(0),a=(s=(e=new _(i)).e=H(f)-m.e-1)%7,e.d[0]=T(10,a<0?7+a:a),null==t)t=s>0?e:c;else{if(!(o=new _(t)).isInt()||o.lt(c))throw Error(g+o);t=o.gt(e)?s>0?e:c:o}for(p=!1,o=new _(M(f)),h=_.precision,_.precision=s=7*f.length*2;u=v(o,e,0,1,1),1!=(n=r.plus(u.times(i))).cmp(t);)r=i,i=n,n=c,c=l.plus(u.times(n)),l=n,n=e,e=o.minus(u.times(n)),o=n;return n=v(t.minus(r),i,0,1,1),l=l.plus(n.times(c)),r=r.plus(n.times(i)),l.s=c.s=m.s,d=v(c,i,s,1).minus(m).abs().cmp(v(l,r,s,1).minus(m).abs())<1?[c,i]:[l,r],_.precision=h,p=!0,d},R.toHexadecimal=R.toHex=function(t,e){return Y(this,16,t,e)},R.toNearest=function(t,e){var r=this,i=r.constructor;if(r=new i(r),null==t){if(!r.d)return r;t=new i(1),e=i.rounding}else{if(t=new i(t),void 0===e?e=i.rounding:O(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(p=!1,r=v(r,t,0,e,1).times(t),p=!0,F(r)):(t.s=r.s,r=t),r},R.toNumber=function(){return+this},R.toOctal=function(t,e){return Y(this,8,t,e)},R.toPower=R.pow=function(t){var e,r,i,n,s,a,o=this,l=o.constructor,c=+(t=new l(t));if(!(o.d&&t.d&&o.d[0]&&t.d[0]))return new l(T(+o,c));if((o=new l(o)).eq(1))return o;if(i=l.precision,s=l.rounding,t.eq(1))return F(o,i,s);if((e=E(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return n=V(l,o,r,i),t.s<0?new l(1).div(n):F(n,i,s);if((a=o.s)<0){if(e<t.d.length-1)return new l(NaN);if(1&t.d[e]||(a=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=a,o}return(e=0!=(r=T(+o,c))&&isFinite(r)?new l(r+"").e:E(c*(Math.log("0."+M(o.d))/Math.LN10+o.e+1)))>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(p=!1,l.rounding=o.s=1,r=Math.min(12,(e+"").length),(n=q(t.times(W(o,i+r)),i)).d&&b((n=F(n,i+5,1)).d,i,s)&&(e=i+10,+M((n=F(q(t.times(W(o,e+r)),e),e+5,1)).d).slice(i+1,i+15)+1==1e14&&(n=F(n,i+1,0))),n.s=a,p=!0,l.rounding=s,F(n,i,s))},R.toPrecision=function(t,e){var r,i=this,n=i.constructor;return void 0===t?r=D(i,i.e<=n.toExpNeg||i.e>=n.toExpPos):(O(t,1,l),void 0===e?e=n.rounding:O(e,0,8),r=D(i=F(new n(i),t,e),t<=i.e||i.e<=n.toExpNeg,t)),i.isNeg()&&!i.isZero()?"-"+r:r},R.toSignificantDigits=R.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(O(t,1,l),void 0===e?e=r.rounding:O(e,0,8)),F(new r(this),t,e)},R.toString=function(){var t=this,e=t.constructor,r=D(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},R.truncated=R.trunc=function(){return F(new this.constructor(this),this.e+1,1)},R.valueOf=R.toJSON=function(){var t=this,e=t.constructor,r=D(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var v=function(){function t(t,e,r){var i,n=0,s=t.length;for(t=t.slice();s--;)i=t[s]*e+n,t[s]=i%r|0,n=i/r|0;return n&&t.unshift(n),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(t[n]!=e[n]){s=t[n]>e[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]<e[r]?1:0,t[r]=n*i+t[r]-e[r];for(;!t[0]&&t.length>1;)t.shift()}return function(i,n,a,o,l,c){var h,u,d,p,m,g,f,_,x,T,y,L,A,C,I,S,R,M,O,b,w=i.constructor,v=i.s==n.s?1:-1,D=i.d,P=n.d;if(!(D&&D[0]&&P&&P[0]))return new w(i.s&&n.s&&(D?!P||D[0]!=P[0]:P)?D&&0==D[0]||!P?0*v:v/0:NaN);for(c?(m=1,u=i.e-n.e):(c=N,m=7,u=E(i.e/m)-E(n.e/m)),O=P.length,R=D.length,T=(x=new w(v)).d=[],d=0;P[d]==(D[d]||0);d++);if(P[d]>(D[d]||0)&&u--,null==a?(C=a=w.precision,o=w.rounding):C=l?a+(i.e-n.e)+1:a,C<0)T.push(1),g=!0;else{if(C=C/m+2|0,d=0,1==O){for(p=0,P=P[0],C++;(d<R||p)&&C--;d++)I=p*c+(D[d]||0),T[d]=I/P|0,p=I%P|0;g=p||d<R}else{for((p=c/(P[0]+1)|0)>1&&(P=t(P,p,c),D=t(D,p,c),O=P.length,R=D.length),S=O,L=(y=D.slice(0,O)).length;L<O;)y[L++]=0;(b=P.slice()).unshift(0),M=P[0],P[1]>=c/2&&++M;do{p=0,(h=e(P,y,O,L))<0?(A=y[0],O!=L&&(A=A*c+(y[1]||0)),(p=A/M|0)>1?(p>=c&&(p=c-1),1==(h=e(f=t(P,p,c),y,_=f.length,L=y.length))&&(p--,r(f,O<_?b:P,_,c))):(0==p&&(h=p=1),f=P.slice()),(_=f.length)<L&&f.unshift(0),r(y,f,L,c),-1==h&&(h=e(P,y,O,L=y.length))<1&&(p++,r(y,O<L?b:P,L,c)),L=y.length):0===h&&(p++,y=[0]),T[d++]=p,h&&y[0]?y[L++]=D[S]||0:(y=[D[S]],L=1)}while((S++<R||void 0!==y[0])&&C--);g=void 0!==y[0]}T[0]||T.shift()}if(1==m)x.e=u,s=g;else{for(d=1,p=T[0];p>=10;p/=10)d++;x.e=d+u*m-1,F(x,l?a+x.e+1:a,o,g)}return x}}();function F(t,e,r,i){var n,s,a,o,l,c,h,u,d,m=t.constructor;t:if(null!=e){if(!(u=t.d))return t;for(n=1,o=u[0];o>=10;o/=10)n++;if((s=e-n)<0)s+=7,a=e,l=(h=u[d=0])/T(10,n-a-1)%10|0;else if((d=Math.ceil((s+1)/7))>=(o=u.length)){if(!i)break t;for(;o++<=d;)u.push(0);h=l=0,n=1,a=(s%=7)-7+1}else{for(h=o=u[d],n=1;o>=10;o/=10)n++;l=(a=(s%=7)-7+n)<0?0:h/T(10,n-a-1)%10|0}if(i=i||e<0||void 0!==u[d+1]||(a<0?h:h%T(10,n-a-1)),c=r<4?(l||i)&&(0==r||r==(t.s<0?3:2)):l>5||5==l&&(4==r||i||6==r&&(s>0?a>0?h/T(10,n-a):0:u[d-1])%10&1||r==(t.s<0?8:7)),e<1||!u[0])return u.length=0,c?(e-=t.e+1,u[0]=T(10,(7-e%7)%7),t.e=-e||0):u[0]=t.e=0,t;if(0==s?(u.length=d,o=1,d--):(u.length=d+1,o=T(10,7-s),u[d]=a>0?(h/T(10,n-a)%T(10,a)|0)*o:0),c)for(;;){if(0==d){for(s=1,a=u[0];a>=10;a/=10)s++;for(a=u[0]+=o,o=1;a>=10;a/=10)o++;s!=o&&(t.e++,u[0]==N&&(u[0]=1));break}if(u[d]+=o,u[d]!=N)break;u[d--]=0,o=1}for(s=u.length;0===u[--s];)u.pop()}return p&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function D(t,e,r){if(!t.isFinite())return j(t);var i,n=t.e,s=M(t.d),a=s.length;return e?(r&&(i=r-a)>0?s=s.charAt(0)+"."+s.slice(1)+B(i):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(t.e<0?"e":"e+")+t.e):n<0?(s="0."+B(-n-1)+s,r&&(i=r-a)>0&&(s+=B(i))):n>=a?(s+=B(n+1-a),r&&(i=r-n-1)>0&&(s=s+"."+B(i))):((i=n+1)<a&&(s=s.slice(0,i)+"."+s.slice(i)),r&&(i=r-a)>0&&(n+1===a&&(s+="."),s+=B(i))),s}function P(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function k(t,e,r){if(e>I)throw p=!0,r&&(t.precision=r),Error(f);return F(new t(h),e,1,!0)}function U(t,e,r){if(e>S)throw Error(f);return F(new t(u),e,r,!0)}function H(t){var e=t.length-1,r=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function B(t){for(var e="";t--;)e+="0";return e}function V(t,e,r,i){var n,s=new t(1),a=Math.ceil(i/7+4);for(p=!1;;){if(r%2&&Z((s=s.times(e)).d,a)&&(n=!0),0===(r=E(r/2))){r=s.d.length-1,n&&0===s.d[r]&&++s.d[r];break}Z((e=e.times(e)).d,a)}return p=!0,s}function Q(t){return 1&t.d[t.d.length-1]}function G(t,e,r){for(var i,n,s=new t(e[0]),a=0;++a<e.length;){if(!(n=new t(e[a])).s){s=n;break}((i=s.cmp(n))===r||0===i&&s.s===r)&&(s=n)}return s}function q(t,e){var r,i,n,s,a,o,l,c=0,h=0,u=0,d=t.constructor,m=d.rounding,g=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(p=!1,l=g):l=e,o=new d(.03125);t.e>-2;)t=t.times(o),u+=5;for(l+=i=Math.log(T(2,u))/Math.LN10*2+5|0,r=s=a=new d(1),d.precision=l;;){if(s=F(s.times(t),l,1),r=r.times(++h),M((o=a.plus(v(s,r,l,1))).d).slice(0,l)===M(a.d).slice(0,l)){for(n=u;n--;)a=F(a.times(a),l,1);if(null!=e)return d.precision=g,a;if(!(c<3&&b(a.d,l-i,m,c)))return F(a,d.precision=g,m,p=!0);d.precision=l+=10,r=s=o=new d(1),h=0,c++}a=o}}function W(t,e){var r,i,n,s,a,o,l,c,h,u,d,m=1,g=t,f=g.d,_=g.constructor,x=_.rounding,E=_.precision;if(g.s<0||!f||!f[0]||!g.e&&1==f[0]&&1==f.length)return new _(f&&!f[0]?-1/0:1!=g.s?NaN:f?0:g);if(null==e?(p=!1,h=E):h=e,_.precision=h+=10,i=(r=M(f)).charAt(0),!(Math.abs(s=g.e)<15e14))return c=k(_,h+2,E).times(s+""),g=W(new _(i+"."+r.slice(1)),h-10).plus(c),_.precision=E,null==e?F(g,E,x,p=!0):g;for(;i<7&&1!=i||1==i&&r.charAt(1)>3;)i=(r=M((g=g.times(t)).d)).charAt(0),m++;for(s=g.e,i>1?(g=new _("0."+r),s++):g=new _(i+"."+r.slice(1)),u=g,l=a=g=v(g.minus(1),g.plus(1),h,1),d=F(g.times(g),h,1),n=3;;){if(a=F(a.times(d),h,1),M((c=l.plus(v(a,new _(n),h,1))).d).slice(0,h)===M(l.d).slice(0,h)){if(l=l.times(2),0!==s&&(l=l.plus(k(_,h+2,E).times(s+""))),l=v(l,new _(m),h,1),null!=e)return _.precision=E,l;if(!b(l.d,h-10,x,o))return F(l,_.precision=E,x,p=!0);_.precision=h+=10,c=a=g=v(u.minus(1),u.plus(1),h,1),d=F(g.times(g),h,1),n=o=1}l=c,n+=2}}function j(t){return String(t.s*t.s/0)}function z(t,e){var r,i,n;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(i=e.search(/e/i))>0?(r<0&&(r=i),r+=+e.slice(i+1),e=e.substring(0,i)):r<0&&(r=e.length),i=0;48===e.charCodeAt(i);i++);for(n=e.length;48===e.charCodeAt(n-1);--n);if(e=e.slice(i,n)){if(n-=i,t.e=r=r-i-1,t.d=[],i=(r+1)%7,r<0&&(i+=7),i<n){for(i&&t.d.push(+e.slice(0,i)),n-=7;i<n;)t.d.push(+e.slice(i,i+=7));i=7-(e=e.slice(i)).length}else i-=n;for(;i--;)e+="0";t.d.push(+e),p&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function X(t,e){var r,i,s,a,o,l,c,h,u;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),C.test(e))return z(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(L.test(e))r=16,e=e.toLowerCase();else if(y.test(e))r=2;else{if(!A.test(e))throw Error(g+e);r=8}for((a=e.search(/p/i))>0?(c=+e.slice(a+1),e=e.substring(2,a)):e=e.slice(2),o=(a=e.indexOf("."))>=0,i=t.constructor,o&&(a=(l=(e=e.replace(".","")).length)-a,s=V(i,new i(r),a,2*a)),a=u=(h=w(e,r,N)).length-1;0===h[a];--a)h.pop();return a<0?new i(0*t.s):(t.e=P(h,u),t.d=h,p=!1,o&&(t=v(t,s,4*l)),c&&(t=t.times(Math.abs(c)<54?T(2,c):n.pow(2,c))),p=!0,t)}function K(t,e,r,i,n){var s,a,o,l,c=t.precision,h=Math.ceil(c/7);for(p=!1,l=r.times(r),o=new t(i);;){if(a=v(o.times(l),new t(e++*e++),c,1),o=n?i.plus(a):i.minus(a),i=v(a.times(l),new t(e++*e++),c,1),void 0!==(a=o.plus(i)).d[h]){for(s=h;a.d[s]===o.d[s]&&s--;);if(-1==s)break}s=o,o=i,i=a,a=s}return p=!0,a.d.length=h+1,a}function $(t,e){for(var r=t;--e;)r*=t;return r}function J(t,e){var r,i=e.s<0,n=U(t,t.precision,1),s=n.times(.5);if((e=e.abs()).lte(s))return a=i?4:1,e;if((r=e.divToInt(n)).isZero())a=i?3:2;else{if((e=e.minus(r.times(n))).lte(s))return a=Q(r)?i?2:3:i?4:1,e;a=Q(r)?i?1:4:i?3:2}return e.minus(n).abs()}function Y(t,e,r,i){var n,a,o,h,u,d,p,m,g,f=t.constructor,_=void 0!==r;if(_?(O(r,1,l),void 0===i?i=f.rounding:O(i,0,8)):(r=f.precision,i=f.rounding),t.isFinite()){for(_?(n=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):n=e,(o=(p=D(t)).indexOf("."))>=0&&(p=p.replace(".",""),(g=new f(1)).e=p.length-o,g.d=w(D(g),10,n),g.e=g.d.length),a=u=(m=w(p,10,n)).length;0==m[--u];)m.pop();if(m[0]){if(o<0?a--:((t=new f(t)).d=m,t.e=a,m=(t=v(t,g,r,i,0,n)).d,a=t.e,d=s),o=m[r],h=n/2,d=d||void 0!==m[r+1],d=i<4?(void 0!==o||d)&&(0===i||i===(t.s<0?3:2)):o>h||o===h&&(4===i||d||6===i&&1&m[r-1]||i===(t.s<0?8:7)),m.length=r,d)for(;++m[--r]>n-1;)m[r]=0,r||(++a,m.unshift(1));for(u=m.length;!m[u-1];--u);for(o=0,p="";o<u;o++)p+=c.charAt(m[o]);if(_){if(u>1)if(16==e||8==e){for(o=16==e?4:3,--u;u%o;u++)p+="0";for(u=(m=w(p,n,e)).length;!m[u-1];--u);for(o=1,p="1.";o<u;o++)p+=c.charAt(m[o])}else p=p.charAt(0)+"."+p.slice(1);p=p+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)p="0"+p;p="0."+p}else if(++a>u)for(a-=u;a--;)p+="0";else a<u&&(p=p.slice(0,a)+"."+p.slice(a))}else p=_?"0p+0":"0";p=(16==e?"0x":2==e?"0b":8==e?"0o":"")+p}else p=j(t);return t.s<0?"-"+p:p}function Z(t,e){if(t.length>e)return t.length=e,!0}function tt(t){return new this(t).abs()}function et(t){return new this(t).acos()}function rt(t){return new this(t).acosh()}function it(t,e){return new this(t).plus(e)}function nt(t){return new this(t).asin()}function st(t){return new this(t).asinh()}function at(t){return new this(t).atan()}function ot(t){return new this(t).atanh()}function lt(t,e){t=new this(t),e=new this(e);var r,i=this.precision,n=this.rounding,s=i+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?U(this,i,n):new this(0)).s=t.s:!t.d||e.isZero()?(r=U(this,s,1).times(.5)).s=t.s:e.s<0?(this.precision=s,this.rounding=1,r=this.atan(v(t,e,s,1)),e=U(this,s,1),this.precision=i,this.rounding=n,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(v(t,e,s,1)):(r=U(this,s,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function ct(t){return new this(t).cbrt()}function ht(t){return F(t=new this(t),t.e+1,2)}function ut(t,e,r){return new this(t).clamp(e,r)}function dt(t){if(!t||"object"!=typeof t)throw Error(m+"Object expected");var e,r,i,n=!0===t.defaults,s=["precision",1,l,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(r=s[e],n&&(this[r]=d[r]),void 0!==(i=t[r])){if(!(E(i)===i&&i>=s[e+1]&&i<=s[e+2]))throw Error(g+r+": "+i);this[r]=i}if(r="crypto",n&&(this[r]=d[r]),void 0!==(i=t[r])){if(!0!==i&&!1!==i&&0!==i&&1!==i)throw Error(g+r+": "+i);if(i){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(_);this[r]=!0}else this[r]=!1}return this}function pt(t){return new this(t).cos()}function mt(t){return new this(t).cosh()}function gt(t,e){return new this(t).div(e)}function ft(t){return new this(t).exp()}function _t(t){return F(t=new this(t),t.e+1,3)}function xt(){var t,e,r=new this(0);for(p=!1,t=0;t<arguments.length;)if((e=new this(arguments[t++])).d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return p=!0,new this(1/0);r=e}return p=!0,r.sqrt()}function Et(t){return t instanceof n||t&&t.toStringTag===x||!1}function Tt(t){return new this(t).ln()}function yt(t,e){return new this(t).log(e)}function Lt(t){return new this(t).log(2)}function At(t){return new this(t).log(10)}function Ct(){return G(this,arguments,-1)}function Nt(){return G(this,arguments,1)}function It(t,e){return new this(t).mod(e)}function St(t,e){return new this(t).mul(e)}function Rt(t,e){return new this(t).pow(e)}function Mt(t){var e,r,i,n,s=0,a=new this(1),o=[];if(void 0===t?t=this.precision:O(t,1,l),i=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(i));s<i;)(n=e[s])>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:o[s++]=n%1e7;else{if(!crypto.randomBytes)throw Error(_);for(e=crypto.randomBytes(i*=4);s<i;)(n=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((127&e[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,s):(o.push(n%1e7),s+=4);s=i/4}else for(;s<i;)o[s++]=1e7*Math.random()|0;for(t%=7,(i=o[--s])&&t&&(n=T(10,7-t),o[s]=(i/n|0)*n);0===o[s];s--)o.pop();if(s<0)r=0,o=[0];else{for(r=-1;0===o[0];r-=7)o.shift();for(i=1,n=o[0];n>=10;n/=10)i++;i<7&&(r-=7-i)}return a.e=r,a.d=o,a}function Ot(t){return F(t=new this(t),t.e+1,this.rounding)}function bt(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function wt(t){return new this(t).sin()}function vt(t){return new this(t).sinh()}function Ft(t){return new this(t).sqrt()}function Dt(t,e){return new this(t).sub(e)}function Pt(){var t=0,e=arguments,r=new this(e[t]);for(p=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return p=!0,F(r,this.precision,this.rounding)}function kt(t){return new this(t).tan()}function Ut(t){return new this(t).tanh()}function Ht(t){return F(t=new this(t),t.e+1,1)}(n=function t(e){var r,i,n;function s(t){var e,r,i,n=this;if(!(n instanceof s))return new s(t);if(n.constructor=s,Et(t))return n.s=t.s,void(p?!t.d||t.e>s.maxE?(n.e=NaN,n.d=null):t.e<s.minE?(n.e=0,n.d=[0]):(n.e=t.e,n.d=t.d.slice()):(n.e=t.e,n.d=t.d?t.d.slice():t.d));if("number"==(i=typeof t)){if(0===t)return n.s=1/t<0?-1:1,n.e=0,void(n.d=[0]);if(t<0?(t=-t,n.s=-1):n.s=1,t===~~t&&t<1e7){for(e=0,r=t;r>=10;r/=10)e++;return void(p?e>s.maxE?(n.e=NaN,n.d=null):e<s.minE?(n.e=0,n.d=[0]):(n.e=e,n.d=[t]):(n.e=e,n.d=[t]))}return 0*t!=0?(t||(n.s=NaN),n.e=NaN,void(n.d=null)):z(n,t.toString())}if("string"===i)return 45===(r=t.charCodeAt(0))?(t=t.slice(1),n.s=-1):(43===r&&(t=t.slice(1)),n.s=1),C.test(t)?z(n,t):X(n,t);if("bigint"===i)return t<0?(t=-t,n.s=-1):n.s=1,z(n,t.toString());throw Error(g+t)}if(s.prototype=R,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=dt,s.clone=t,s.isDecimal=Et,s.abs=tt,s.acos=et,s.acosh=rt,s.add=it,s.asin=nt,s.asinh=st,s.atan=at,s.atanh=ot,s.atan2=lt,s.cbrt=ct,s.ceil=ht,s.clamp=ut,s.cos=pt,s.cosh=mt,s.div=gt,s.exp=ft,s.floor=_t,s.hypot=xt,s.ln=Tt,s.log=yt,s.log10=At,s.log2=Lt,s.max=Ct,s.min=Nt,s.mod=It,s.mul=St,s.pow=Rt,s.random=Mt,s.round=Ot,s.sign=bt,s.sin=wt,s.sinh=vt,s.sqrt=Ft,s.sub=Dt,s.sum=Pt,s.tan=kt,s.tanh=Ut,s.trunc=Ht,void 0===e&&(e={}),e&&!0!==e.defaults)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<n.length;)e.hasOwnProperty(i=n[r++])||(e[i]=this[i]);return s.config(e),s}(d)).prototype.constructor=n,n.default=n.Decimal=n,h=new n(h),u=new n(u),void 0===(i=function(){return n}.call(e,r,e,t))||(t.exports=i)}()},139:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ComplexInterfaceKeyTable=void 0,e.ComplexInterfaceKeyTable=["re","im","type","parent","unparse","copy","toLogical"]},142:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.signFactory=e.roundFactory=e.floorFactory=e.ceilFactory=e.fixFactory=e.remFactory=e.modFactory=e.conjFactory=e.argFactory=e.hypotFactory=e.absFactory=e.absValueFactory=e.rootFactory=e.powerFactory=e.invFactory=e.rdivFactory=e.mulFactory=e.literalFactory=e.notFactory=e.xorFactory=e.orFactory=e.andFactory=e.logicalFactory=e.comparisonFactory=e.minMaxWiseFactory=e.minMaxFactory=e.minMaxArrayComplexWithIndexFactory=e.minMaxArrayComplexFactory=e.minMaxArrayRealWithIndexFactory=e.minMaxArrayRealFactory=e.cmpFactory=e.equalsFactory=e.epsilonFactory=e.copyFactory=e.toMaxPrecisionFactory=e.unparseMathMLFactory=e.precedenceFactory=e.unparseMathMLValueFactory=e.unparseFactory=e.unparseValueFactory=e.parseFactory=e.createFactory=e.setNumberTypeFactory=e.numberClass=e.moduloName=e.roundingName=e.roundingMode=e.ComplexInterfaceStaticKeyTable=e.ComplexInterfaceKeyTable=e.ComplexConfigKeyTable=void 0,e.twoArgFunctionFactory=e.mapFunctionFactory=e.applyFunctionFactory=e.factorialFactory=e.gammaFactory=e.acothFactory=e.asechFactory=e.acschFactory=e.atanhFactory=e.acoshFactory=e.asinhFactory=e.cothFactory=e.sechFactory=e.cschFactory=e.tanhFactory=e.coshFactory=e.sinhFactory=e.acotdFactory=e.acotFactory=e.asecdFactory=e.asecFactory=e.acscdFactory=e.acscFactory=e.atandFactory=e.atanFactory=e.acosdFactory=e.acosFactory=e.asindFactory=e.asinFactory=e.cotdFactory=e.cotFactory=e.secdFactory=e.secFactory=e.cscdFactory=e.cscFactory=e.tandFactory=e.tanFactory=e.cosdFactory=e.cosFactory=e.sindFactory=e.sinFactory=e.rad2degFactory=e.deg2radFactory=e.log10Factory=e.log2Factory=e.logbFactory=e.logFactory=e.expFactory=e.sqrtFactory=void 0;var i=r(34);Object.defineProperty(e,"ComplexConfigKeyTable",{enumerable:!0,get:function(){return i.ComplexConfigKeyTable}});var n=r(139);Object.defineProperty(e,"ComplexInterfaceKeyTable",{enumerable:!0,get:function(){return n.ComplexInterfaceKeyTable}});var s=r(377);Object.defineProperty(e,"ComplexInterfaceStaticKeyTable",{enumerable:!0,get:function(){return s.ComplexInterfaceStaticKeyTable}}),e.roundingMode={ROUND_UP:0,ROUND_DOWN:1,ROUND_CEIL:2,ROUND_FLOOR:3,ROUND_HALF_UP:4,ROUND_HALF_DOWN:5,ROUND_HALF_EVEN:6,ROUND_HALF_CEIL:7,ROUND_HALF_FLOOR:8,EUCLID:9},e.roundingName=["up","down","ceil","floor","half_up","half_down","half_even","half_ceil","half_floor"],e.moduloName=["up","down",void 0,"floor",void 0,void 0,"half_even",void 0,void 0,"euclid"],e.numberClass={LOGICAL:0,REAL:1,COMPLEX:2},e.setNumberTypeFactory=t=>e=>{t.imagIsZero(e)?(t.realIsZero(e)||t.realEquals(e,1))&&e.type===t.LOGICAL||(e.type=t.REAL):e.type=t.COMPLEX},e.createFactory=t=>(e,r,i,n)=>new t(e,r,i,n),e.parseFactory=t=>e=>{const r="0"!==e[0]||"x"!==e[1]&&"X"!==e[1]?e.replace(/[dD]/,"e"):e.replace("_","");return/[ijIJ]$/.test(r)?t.create(0,r.slice(0,-1)):t.create(r,0)},e.unparseValueFactory=(t,e)=>r=>{if(t.isFinite(r)){const i=t.unparse(r).split("e");return 1===i.length?i[0].slice(0,e.settings.toExpPos):i[0].slice(0,e.settings.toExpPos)+"e"+Number(i[1])}return t.isNaN(r)?"NaN":(t.isNeg(r)?"-":"")+"&infin;"},e.unparseFactory=t=>(e,r=0)=>{if(e.type!==t.LOGICAL){const r=t.toMaxPrecision(e);return t.realIsZero(r)||t.imagIsZero(r)?t.realIsZero(r)?t.imagIsZero(r)?t.realIsNegative(r)||t.imagIsNegative(r)?t.realIsNegative(r)&&t.imagIsNegative(r)?"-0":t.realIsNegative(r)&&!t.imagIsNegative(r)?"(-0+0i)":"(0-0i)":"0":(t.imagEquals(r,1)?"":t.imagEquals(r,-1)?"-":t.unparseValue(r.im))+"i":t.unparseValue(r.re):"("+t.unparseValue(r.re)+(t.imagGreaterThan(r,0)?"+":"")+(t.imagEquals(r,1)?"":t.imagEquals(r,-1)?"-":t.unparseValue(r.im))+"i)"}return t.realIsZero(e)?"false":"true"},e.unparseMathMLValueFactory=(t,e)=>r=>{if(t.isFinite(r)){const i=t.unparse(r).split("e");return 1==i.length?"<mn>"+i[0].slice(0,e.settings.toExpPos)+"</mn>":"<mn>"+i[0].slice(0,e.settings.toExpPos)+"</mn><mo>&sdot;</mo><msup><mrow><mn>10</mn></mrow><mrow><mn>"+Number(i[1])+"</mn></mrow></msup>"}return t.isNaN(r)?"<mi><b>NaN</b></mi>":(t.isNeg(r)?"<mo>-</mo>":"")+"<mi>&infin;</mi>"},e.precedenceFactory=t=>(e,r)=>{if(e.type!==t.LOGICAL){const i=t.toMaxPrecision(e);return t.realIsZero(i)||t.imagIsZero(i)?t.realIsZero(i)?t.imagIsZero(i)?t.realIsNegative(i)||t.imagIsNegative(i)?t.realIsNegative(i)&&t.imagIsNegative(i)?r.precedenceTable["-_"]:r.precedenceTable["+"]:r.precedenceTable["()"]:t.imagIsNegative(i)?r.precedenceTable["-_"]:r.precedenceTable["()"]:t.realIsNegative(i)?r.precedenceTable["-_"]:r.precedenceTable["()"]:r.precedenceTable["+"]}return r.precedenceTable["()"]},e.unparseMathMLFactory=t=>(e,r,i=0)=>{if(e.type!==t.LOGICAL){const n=t.toMaxPrecision(e);if(t.realIsZero(n)||t.imagIsZero(n)){if(t.realIsZero(n)){if(t.imagIsZero(n)){if(t.realIsNegative(n)||t.imagIsNegative(n)){if(t.realIsNegative(n)&&t.imagIsNegative(n)){const t="<mn>-0</mn>";return i>r.precedenceTable["-_"]?`<mo fence="true" stretchy="true">(</mo>${t}<mo fence="true" stretchy="true">)</mo>`:t}if(t.realIsNegative(n)&&!t.imagIsNegative(n)){const t="<mn>-0</mn><mo>+</mo><mn>0</mn><mi>i</mi>";return i>r.precedenceTable["+"]?`<mo fence="true" stretchy="true">(</mo>${t}<mo fence="true" stretchy="true">)</mo>`:t}{const t="<mn>0</mn><mo>-</mo><mn>0</mn><mi>i</mi>";return i>r.precedenceTable["+"]?`<mo fence="true" stretchy="true">(</mo>${t}<mo fence="true" stretchy="true">)</mo>`:t}}{const t="<mn>0</mn>";return i>r.precedenceTable["()"]?`<mo fence="true" stretchy="true">(</mo>${t}<mo fence="true" stretchy="true">)</mo>`:t}}{const e=(t.imagEquals(n,1)?"":t.imagEquals(n,-1)?"<mo>-</mo>":t.unparseMathMLValue(n.im))+"<mi>i</mi>";return i>(t.imagIsNegative(n)?r.precedenceTable["-_"]:r.precedenceTable["()"])?`<mo fence="true" stretchy="true">(</mo>${e}<mo fence="true" stretchy="true">)</mo>`:e}}{const e=t.unparseMathMLValue(n.re);return i>(t.realIsNegative(n)?r.precedenceTable["-_"]:r.precedenceTable["()"])?`<mo fence="true" stretchy="true">(</mo>${e}<mo fence="true" stretchy="true">)</mo>`:e}}{const e=t.unparseMathMLValue(n.re)+(t.imagGreaterThan(n,0)?"<mo>+</mo>":"")+(t.imagEquals(n,1)?"":t.imagEquals(n,-1)?"<mo>-</mo>":t.unparseMathMLValue(n.im))+"<mi>i</mi>";return i>r.precedenceTable["+"]?`<mo fence="true" stretchy="true">(</mo>${e}<mo fence="true" stretchy="true">)</mo>`:e}}return t.realIsZero(e)?"<mi>false</mi>":"<mi>true</mi>"},e.toMaxPrecisionFactory=t=>e=>new t(t.toMaxPrecisionValue(e.re),t.toMaxPrecisionValue(e.im)),e.copyFactory=t=>e=>new t(e.re,e.im,e.type),e.epsilonFactory=t=>()=>new t(t.epsilonValue()),e.equalsFactory=(t,e=!0)=>e?(e,r)=>{const i=t.toMaxPrecision(e),n=t.toMaxPrecision(r);return t.realEquals(i,n.re)&&t.imagEquals(i,n.im)?t.true():t.false()}:(e,r)=>{const i=t.toMaxPrecision(e),n=t.toMaxPrecision(r);return t.realEquals(i,n.re)&&t.imagEquals(i,n.im)?t.false():t.true()},e.cmpFactory=t=>(e,r,i)=>{const n=t.toMaxPrecision(r),s=t.toMaxPrecision(i);if(t.imagIsZero(n)&&t.imagIsZero(s))return t.compareValue(e,n.re,s.re)?t.true():t.false();const a=t.toMaxPrecisionValue(t.abs(r).re),o=t.toMaxPrecisionValue(t.abs(i).re);return t.compareValue("eq",a,o)?t.compareValue(e,t.toMaxPrecisionValue(t.arg(r).re),t.toMaxPrecisionValue(t.arg(i).re))?t.true():t.false():t.compareValue(e,a,o)?t.true():t.false()},e.minMaxArrayRealFactory=t=>(e,...r)=>r.reduce((r,i)=>t.compareValue(e,r.re,i.re)?r:i,r[0]),e.minMaxArrayRealWithIndexFactory=t=>(e,...r)=>{let i=0;return[r.reduceRight((r,n,s)=>t.compareValue(e,r.re,n.re)?r:(i=s,n),r[r.length-1]),i]},e.minMaxArrayComplexFactory=t=>(e,...r)=>r.reduce((r,i)=>{const n=t.abs(r).re,s=t.abs(i).re;return t.compareValue("eq",n,s)?t.compareValue(e,t.arg(r).re,t.arg(i).re)?r:i:t.compareValue(e,n,s)?r:i},r[0]),e.minMaxArrayComplexWithIndexFactory=t=>(e,...r)=>{let i=0;return[r.reduceRight((r,n,s)=>{const a=t.abs(r).re,o=t.abs(n).re;return t.compareValue("eq",a,o)?t.compareValue(e,t.arg(r).re,t.arg(n).re)?r:(i=s,n):t.compareValue(e,a,o)?r:(i=s,n)},r[r.length-1]),i]},e.minMaxFactory=(t,e)=>(r,i)=>{if(t.imagIsZero(r)&&t.imagIsZero(i))return t.compareValue(e,r.re,i.re)?r:i;{const n=t.abs(r).re,s=t.abs(i).re;return t.compareValue("eq",n,s)?t.compareValue(e,t.arg(r).re,t.arg(i).re)?r:i:t.compareValue(e,n,s)?r:i}},e.minMaxWiseFactory=(t,e)=>(r,i)=>{if(r.type<=t.REAL&&r.type<=t.REAL)return t.compareValue(e,r.re,i.re)?r:i;{const n=t.abs(r).re,s=t.abs(i).re;return t.compareValue("eq",n,s)?t.compareValue(e,t.arg(r).re,t.arg(i).re)?r:i:t.compareValue(e,n,s)?r:i}},e.comparisonFactory=(t,e)=>(r,i)=>t.cmp(e,r,i),e.logicalFactory=t=>e=>{const r=t.toMaxPrecision(e);return new t(t.realIsZero(r)&&t.imagIsZero(r)?0:1,0,t.LOGICAL)},e.andFactory=t=>(e,r)=>{const i=t.toMaxPrecision(e),n=t.toMaxPrecision(r);return t.realIsZero(i)&&t.imagIsZero(i)||t.realIsZero(n)&&t.imagIsZero(n)?t.false():t.true()},e.orFactory=t=>(e,r)=>{const i=t.toMaxPrecision(e),n=t.toMaxPrecision(r);return t.realIsZero(i)&&t.imagIsZero(i)&&t.realIsZero(n)&&t.imagIsZero(n)?t.false():t.true()},e.xorFactory=t=>(e,r)=>{const i=t.toMaxPrecision(e),n=t.toMaxPrecision(r);return t.realIsZero(i)&&t.imagIsZero(i)&&(!t.realIsZero(n)||!t.imagIsZero(n))||(!t.realIsZero(i)||!t.imagIsZero(i))&&t.realIsZero(n)&&t.imagIsZero(n)?t.true():t.false()},e.notFactory=t=>e=>{const r=t.toMaxPrecision(e);return t.realIsZero(r)&&t.imagIsZero(r)?t.true():t.false()},e.literalFactory=(t,e,r,i)=>()=>new t(e,r,i),e.mulFactory=(t,e)=>(r,i)=>e.imagIsZero(r)&&e.imagIsZero(i)?new e(t.mul(r.re,i.re),t.ZERO):new e(t.sub(t.mul(r.re,i.re),t.mul(r.im,i.im)),t.add(t.mul(r.re,i.im),t.mul(r.im,i.re))),e.rdivFactory=(t,e)=>(r,i)=>{const n=t.add(t.mul(i.re,i.re),t.mul(i.im,i.im));return t.isFinite(n)?t.isZero(n)?new e(t.mul(r.re,t.INF),e.imagIsZero(r)?t.ZERO:t.mul(r.im,t.INF)):new e(t.div(t.add(t.mul(r.re,i.re),t.mul(r.im,i.im)),n),t.div(t.sub(t.mul(r.im,i.re),t.mul(r.re,i.im)),n)):t.isNaN(n)?(e.realIsFinite(i)||e.realIsNaN(i))&&(e.imagIsFinite(i)||e.imagIsNaN(i))?new e(NaN,0):e.zero():e.realIsFinite(r)&&e.imagIsFinite(r)?e.zero():new e(NaN,0)},e.invFactory=(t,e)=>r=>{const i=t.add(t.mul(r.re,r.re),t.mul(r.im,r.im));return t.isFinite(i)?t.isZero(i)?new e(1/0,0):new e(t.div(r.re,i),t.neg(t.div(r.im,i))):t.isNaN(i)&&(e.realIsFinite(r)||e.realIsNaN(r))&&(e.imagIsFinite(r)||e.imagIsNaN(r))?new e(NaN,0):e.zero()},e.powerFactory=(t,e)=>(r,i)=>{if(e.imagIsZero(r)&&e.imagIsZero(i)&&e.realGreaterThanOrEqualTo(r,0))return new e(t.pow(r.re,i.re),0);{const n=t.atan2(e.imagIsZero(r)?t.ZERO:r.im,e.realIsZero(r)?t.ZERO:r.re),s=t.add(t.mul(r.re,r.re),t.mul(r.im,r.im)),a=t.mul(t.pow(s,t.div(i.re,t.TWO)),t.exp(t.mul(t.mul(t.MINUSONE,i.im),n))),o=t.add(t.mul(i.re,n),t.mul(t.div(i.im,t.TWO),t.ln(s)));return new e(t.mul(a,t.cos(o)),e.imagIsZero(r)&&e.imagIsZero(i)&&(e.realGreaterThanOrEqualTo(i,1)||e.realLessThanOrEqualTo(i,-1))?0:t.mul(a,t.sin(o)))}},e.rootFactory=t=>(e,r)=>t.power(e,t.inv(r)),e.absValueFactory=t=>e=>t.sqrt(t.add(t.mul(e.re,e.re),t.mul(e.im,e.im))),e.absFactory=(t,e)=>r=>e.imagIsZero(r)?new e(t.abs(r.re)):new e(e.absValue(r)),e.hypotFactory=t=>(e,r)=>new t(t.absValue(new t(t.absValue(e),t.absValue(r)))),e.argFactory=(t,e)=>r=>new e(t.atan2(e.imagIsZero(r)?t.ZERO:r.im,r.re),0),e.conjFactory=(t,e)=>r=>new e(r.re,t.neg(r.im)),e.modFactory=(t,e)=>(r,i)=>{if(!e.imagIsZero(r)||!e.imagIsZero(i))throw new Error("mod: not defined for complex numbers");return e.realIsZero(i)?r:new e(t.mod(r.re,i.re))},e.remFactory=(t,e)=>(r,i)=>{if(!e.imagIsZero(r)||!e.imagIsZero(i))throw new Error("rem: not defined for complex numbers");return new e(t.mod(r.re,i.re))},e.fixFactory=(t,e)=>r=>new e(t.trunc(r.re),t.trunc(r.im)),e.ceilFactory=(t,e)=>r=>new e(t.ceil(r.re),t.ceil(r.im)),e.floorFactory=(t,e)=>r=>new e(t.floor(r.re),t.floor(r.im)),e.roundFactory=(t,e)=>r=>new e(t.round(r.re),t.round(r.im)),e.signFactory=(t,e)=>r=>e.realIsZero(r)?e.imagIsZero(r)?e.zero():new e(0,t.div(r.im,e.absValue(r))):e.imagIsZero(r)?new e(t.div(r.re,e.absValue(r)),0):new e(t.div(r.re,e.absValue(r)),t.div(r.im,e.absValue(r))),e.sqrtFactory=(t,e)=>r=>{const i=e.absValue(r),n=t.atan2(e.imagIsZero(r)?t.ZERO:r.im,r.re);return new e(t.mul(t.sqrt(i),t.cos(t.div(n,t.TWO))),t.mul(t.sqrt(i),t.sin(t.div(n,t.TWO))))},e.expFactory=(t,e)=>r=>new e(t.mul(t.exp(r.re),t.cos(r.im)),t.mul(t.exp(r.re),t.sin(r.im))),e.logFactory=(t,e)=>r=>new e(t.ln(e.absValue(r)),t.atan2(e.imagIsZero(r)?t.ZERO:r.im,r.re)),e.logbFactory=(t,e)=>(r,i)=>{const n=e.absValue(r);if(t.isZero(n))return e.zero();{const s=t.atan2(e.imagIsZero(r)?t.ZERO:r.im,r.re),a=e.absValue(i),o=t.atan2(e.imagIsZero(i)?t.ZERO:i.im,i.re),l=t.add(t.mul(t.ln(n),t.ln(n)),t.mul(s,s));return new e(t.div(t.add(t.mul(t.ln(a),t.ln(n)),t.mul(o,s)),l),t.div(t.sub(t.mul(o,t.ln(n)),t.mul(t.ln(a),s)),l))}},e.log2Factory=t=>e=>t.logb(new t(2),e),e.log10Factory=t=>e=>t.logb(new t(10),e),e.deg2radFactory=(t,e)=>r=>new e(t.mul(t.div(t.PI,t.PI_DEG),r.re),t.mul(t.div(t.PI,t.PI_DEG),r.im)),e.rad2degFactory=(t,e)=>r=>new e(t.mul(t.div(t.PI_DEG,t.PI),r.re),t.mul(t.div(t.PI_DEG,t.PI),r.im)),e.sinFactory=(t,e)=>r=>new e(t.mul(t.sin(r.re),t.cosh(r.im)),t.mul(t.cos(r.re),t.sinh(r.im))),e.sindFactory=t=>e=>t.sin(t.deg2rad(e)),e.cosFactory=(t,e)=>r=>new e(t.mul(t.cos(r.re),t.cosh(r.im)),t.mul(t.sin(r.re),t.neg(t.sinh(r.im)))),e.cosdFactory=t=>e=>t.cos(t.deg2rad(e)),e.tanFactory=t=>e=>t.rdiv(t.sin(e),t.cos(e)),e.tandFactory=t=>e=>t.tan(t.deg2rad(e)),e.cscFactory=t=>e=>t.rdiv(t.one(),t.sin(e)),e.cscdFactory=t=>e=>t.csc(t.deg2rad(e)),e.secFactory=t=>e=>t.rdiv(t.one(),t.cos(e)),e.secdFactory=t=>e=>t.sec(t.deg2rad(e)),e.cotFactory=t=>e=>t.rdiv(t.cos(e),t.sin(e)),e.cotdFactory=t=>e=>t.rdiv(t.cos(e),t.sin(e)),e.asinFactory=t=>e=>t.mul(t.onei(),t.log(t.sub(t.sqrt(t.sub(t.one(),t.power(e,t.two()))),t.mul(t.onei(),e)))),e.asindFactory=t=>e=>t.rad2deg(t.asin(e)),e.acosFactory=t=>e=>t.sub(t.pidiv2(),t.asin(e)),e.acosdFactory=t=>e=>t.rad2deg(t.acos(e)),e.ata