UNPKG

dicomweb-proxy

Version:

A proxy to translate between dicomweb and dimse

2 lines 625 kB
/*! For license information please see 2343.bundle.92e4bd57d2649cbf37e9.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([[2343],{75183:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Interaction="Interaction",e.HandlesUpdated="HandlesUpdated",e.StatsUpdated="StatsUpdated",e.InitialSetup="InitialSetup",e.Completed="Completed",e.InterpolationUpdated="InterpolationUpdated",e.History="History",e.MetadataReferenceModified="MetadataReferenceModified",e.LabelChange="LabelChange"}(n||(n={}));const i=n},94021:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",e.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",e.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",e.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",e.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",e.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",e.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",e.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",e.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",e.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",e.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",e.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",e.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",e.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",e.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",e.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",e.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",e.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",e.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",e.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",e.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",e.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",e.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",e.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",e.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",e.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",e.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",e.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",e.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",e.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",e.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",e.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",e.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",e.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",e.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",e.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",e.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",e.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",e.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",e.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",e.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",e.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"}(n||(n={}));const i=n},18682:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Labelmap="Labelmap",e.Contour="Contour",e.Surface="Surface"}(n||(n={}));const i=n},84093:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.OnInteractionStart="onInteractionStart",e.OnInteractionEnd="onInteractionEnd",e.Preview="preview",e.RejectPreview="rejectPreview",e.AcceptPreview="acceptPreview",e.Fill="fill",e.Interpolate="interpolate",e.StrategyFunction="strategyFunction",e.CreateIsInThreshold="createIsInThreshold",e.Initialize="initialize",e.INTERNAL_setValue="setValue",e.AddPreview="addPreview",e.ComputeInnerCircleRadius="computeInnerCircleRadius",e.GetStatistics="getStatistics",e.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",e.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"}(n||(n={}));const i=n},66452:(e,r,t)=>{"use strict";var n,i;t.d(r,{i:()=>n,q:()=>i}),function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Primary_And_Secondary=3]="Primary_And_Secondary",e[e.Auxiliary=4]="Auxiliary",e[e.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",e[e.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",e[e.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",e[e.Fourth_Button=8]="Fourth_Button",e[e.Fifth_Button=16]="Fifth_Button",e[e.Wheel=524288]="Wheel",e[e.Wheel_Primary=524289]="Wheel_Primary"}(n||(n={})),function(e){e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta",e[e.ShiftCtrl=1617]="ShiftCtrl",e[e.ShiftAlt=1618]="ShiftAlt",e[e.ShiftMeta=1691]="ShiftMeta",e[e.CtrlAlt=1718]="CtrlAlt",e[e.CtrlMeta=1791]="CtrlMeta",e[e.AltMeta=1891]="AltMeta"}(i||(i={}))},49892:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Active="Active",e.Passive="Passive",e.Enabled="Enabled",e.Disabled="Disabled"}(n||(n={}));const i=n},10401:(e,r,t)=>{"use strict";var n;t.d(r,{H:()=>n}),function(e){e.UP="UP",e.DOWN="DOWN",e.LEFT="LEFT",e.RIGHT="RIGHT"}(n||(n={}))},99737:(e,r,t)=>{"use strict";t.r(r),t.d(r,{AnnotationStyleStates:()=>o,ChangeTypes:()=>p.A,Events:()=>u.A,KeyboardBindings:()=>i.q,MouseBindings:()=>i.i,SegmentationRepresentations:()=>l.A,StrategyCallbacks:()=>f.A,Swipe:()=>c.H,ToolModes:()=>a.A,WorkerTypes:()=>m});var n,i=t(66452),a=t(49892);!function(e){e.Default="",e.Highlighted="Highlighted",e.Selected="Selected",e.Locked="Locked",e.AutoGenerated="AutoGenerated"}(n||(n={}));const o=n;var s,u=t(94021),l=t(18682),c=t(10401),f=t(84093),p=t(75183);!function(e){e.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",e.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",e.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",e.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",e.SURFACE_CLIPPING="Clipping Surfaces",e.COMPUTE_STATISTICS="Computing Statistics",e.INTERPOLATE_LABELMAP="Interpolating Labelmap",e.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",e.GENERATE_CONTOUR_SETS="Generating Contour Sets"}(s||(s={}));const m=s},2682:e=>{"use strict";var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,t){return r({},e,t)};e.exports=function(e){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.preserveFormatting,s=void 0!==o&&o,u=a.escapeMapFn,l=void 0===u?i:u,c=String(e),f="",p=l(r({},t),s?r({},n):{}),m=Object.keys(p),d=function(){var e=!1;m.forEach((function(r,t){e||c.length>=r.length&&c.slice(0,r.length)===r&&(f+=p[m[t]],c=c.slice(r.length,c.length),e=!0)})),e||(f+=c.slice(0,1),c=c.slice(1,c.length))};c;)d();return f}},67042:function(e){!function(r){"use strict";var t={s:1,n:0,d:1};function n(e,r){if(isNaN(e=parseInt(e,10)))throw c();return e*r}function i(e,r){if(0===r)throw l();var t=Object.create(u.prototype);t.s=e<0?-1:1;var n=s(e=e<0?-e:e,r);return t.n=e/n,t.d=r/n,t}function a(e){for(var r={},t=e,n=2,i=4;i<=t;){for(;t%n==0;)t/=n,r[n]=(r[n]||0)+1;i+=1+2*n++}return t!==e?t>1&&(r[t]=(r[t]||0)+1):r[e]=(r[e]||0)+1,r}var o=function(e,r){var i,a=0,o=1,s=1,u=0,p=0,m=0,d=1,h=1,g=0,y=1,v=1,x=1,b=1e7;if(null==e);else if(void 0!==r){if(s=(a=e)*(o=r),a%1!=0||o%1!=0)throw f()}else switch(typeof e){case"object":if("d"in e&&"n"in e)a=e.n,o=e.d,"s"in e&&(a*=e.s);else{if(!(0 in e))throw c();a=e[0],1 in e&&(o=e[1])}s=a*o;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)a=e;else if(e>0){for(e>=1&&(e/=h=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));y<=b&&x<=b;){if(e===(i=(g+v)/(y+x))){y+x<=b?(a=g+v,o=y+x):x>y?(a=v,o=x):(a=g,o=y);break}e>i?(g+=v,y+=x):(v+=g,x+=y),y>b?(a=v,o=x):(a=g,o=y)}a*=h}else(isNaN(e)||isNaN(r))&&(o=a=NaN);break;case"string":if(null===(y=e.match(/\d+|./g)))throw c();if("-"===y[g]?(s=-1,g++):"+"===y[g]&&g++,y.length===g+1?p=n(y[g++],s):"."===y[g+1]||"."===y[g]?("."!==y[g]&&(u=n(y[g++],s)),(++g+1===y.length||"("===y[g+1]&&")"===y[g+3]||"'"===y[g+1]&&"'"===y[g+3])&&(p=n(y[g],s),d=Math.pow(10,y[g].length),g++),("("===y[g]&&")"===y[g+2]||"'"===y[g]&&"'"===y[g+2])&&(m=n(y[g+1],s),h=Math.pow(10,y[g+1].length)-1,g+=3)):"/"===y[g+1]||":"===y[g+1]?(p=n(y[g],s),d=n(y[g+2],1),g+=3):"/"===y[g+3]&&" "===y[g+1]&&(u=n(y[g],s),p=n(y[g+2],s),d=n(y[g+4],1),g+=5),y.length<=g){s=a=m+(o=d*h)*u+h*p;break}default:throw c()}if(0===o)throw l();t.s=s<0?-1:1,t.n=Math.abs(a),t.d=Math.abs(o)};function s(e,r){if(!e)return r;if(!r)return e;for(;;){if(!(e%=r))return r;if(!(r%=e))return e}}function u(e,r){if(o(e,r),!(this instanceof u))return i(t.s*t.n,t.d);e=s(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var l=function(){return new Error("Division by Zero")},c=function(){return new Error("Invalid argument")},f=function(){return new Error("Parameters must be integer")};u.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(e,r){return o(e,r),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),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(e,r){if(isNaN(this.n)||isNaN(this.d))return new u(NaN);if(void 0===e)return i(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw l();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),i(s(t.n,this.n)*s(t.d,this.d),t.d*this.d)},lcm:function(e,r){return o(e,r),0===t.n&&0===this.n?i(0,1):i(t.n*this.n,s(t.n,this.n)*s(t.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):i(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):i(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):i(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)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 n=a(this.n),s=a(this.d),u=1,l=1;for(var c in n)if("1"!==c){if("0"===c){u=0;break}if(n[c]*=t.n,n[c]%t.d!=0)return null;n[c]/=t.d,u*=Math.pow(c,n[c])}for(var c in s)if("1"!==c){if(s[c]*=t.n,s[c]%t.d!=0)return null;s[c]/=t.d,l*=Math.pow(c,s[c])}return t.s<0?i(l,u):i(u,l)},equals:function(e,r){return o(e,r),this.s*this.n*t.d==t.s*t.n*this.d},compare:function(e,r){o(e,r);var n=this.s*this.n*t.d-t.s*t.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var r=this.abs(),t=r.toContinued(),n=1;n<t.length;n++){for(var a=i(t[n-1],1),o=n-2;o>=0;o--)a=a.inverse().add(t[o]);if(Math.abs(a.sub(r).valueOf())<e)return a.mul(this.s)}return this},divisible:function(e,r){return o(e,r),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var e,r=this.n,t=this.d,n=[];if(isNaN(r)||isNaN(t))return n;do{n.push(Math.floor(r/t)),e=r%t,r=t,t=e}while(1!==r);return n},toString:function(e){var r=this.n,t=this.d;if(isNaN(r)||isNaN(t))return"NaN";e=e||15;var n=function(e,r){for(;r%2==0;r/=2);for(;r%5==0;r/=5);if(1===r)return 0;for(var t=10%r,n=1;1!==t;n++)if(t=10*t%r,n>2e3)return 0;return n}(0,t),i=function(e,r,t){for(var n=1,i=function(e,r,t){for(var n=1;r>0;e=e*e%t,r>>=1)1&r&&(n=n*e%t);return n}(10,t,r),a=0;a<300;a++){if(n===i)return a;n=10*n%r,i=10*i%r}return 0}(0,t,n),a=this.s<0?"-":"";if(a+=r/t|0,r%=t,(r*=10)&&(a+="."),n){for(var o=i;o--;)a+=r/t|0,r%=t,r*=10;a+="(";for(o=n;o--;)a+=r/t|0,r%=t,r*=10;a+=")"}else for(o=e;r&&o--;)a+=r/t|0,r%=t,r*=10;return a}},Object.defineProperty(u,"__esModule",{value:!0}),u.default=u,u.Fraction=u,e.exports=u}()},52794:e=>{e.exports=function e(r,t){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,l=/^0/,c=function(r){return e.insensitive&&(""+r).toLowerCase()||""+r},f=c(r).replace(o,"")||"",p=c(t).replace(o,"")||"",m=f.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||h&&p.match(s)&&Date.parse(p)||null;if(g){if(h<g)return-1;if(h>g)return 1}for(var y=0,v=Math.max(m.length,d.length);y<v;y++){if(n=!(m[y]||"").match(l)&&parseFloat(m[y])||m[y]||0,i=!(d[y]||"").match(l)&&parseFloat(d[y])||d[y]||0,isNaN(n)!==isNaN(i))return isNaN(n)?1:-1;if(typeof n!=typeof i&&(n+="",i+=""),n<i)return-1;if(n>i)return 1}return 0}},45422:e=>{function r(){}r.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function i(){n.off(e,i),r.apply(t,arguments)}return i._=r,this.on(e,i,t)},emit:function(e){for(var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=t.length;n<i;n++)t[n].fn.apply(t[n].ctx,r);return this},off:function(e,r){var t=this.e||(this.e={}),n=t[e],i=[];if(n&&r)for(var a=0,o=n.length;a<o;a++)n[a].fn!==r&&n[a].fn._!==r&&i.push(n[a]);return i.length?t[e]=i:delete t[e],this}},e.exports=r,e.exports.TinyEmitter=r},55807:(e,r,t)=>{"use strict";t.d(r,{WCD:()=>Qw,lwT:()=>mw});var n=t(77940),i={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function a(e){return"number"==typeof e}function o(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function s(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function u(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function l(e){return e&&!0===e.constructor.prototype.isUnit||!1}function c(e){return"string"==typeof e}var f=Array.isArray;function p(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function m(e){return Array.isArray(e)||p(e)}function d(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function h(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function g(e){return e&&!0===e.constructor.prototype.isRange||!1}function y(e){return e&&!0===e.constructor.prototype.isIndex||!1}function v(e){return"boolean"==typeof e}function x(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function b(e){return e&&!0===e.constructor.prototype.isHelp||!1}function w(e){return"function"==typeof e}function N(e){return e instanceof Date}function D(e){return e instanceof RegExp}function E(e){return!(!e||"object"!=typeof e||e.constructor!==Object||s(e)||u(e))}function A(e){return null===e}function S(e){return void 0===e}function C(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function _(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return _(e)||P(e)&&1===e.args.length&&_(e.args[0])&&"-+~".includes(e.op)}function I(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function k(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function G(e){var r=typeof e;return"object"===r?null===e?"null":o(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function V(e){var r=typeof e;if("number"===r||"string"===r||"boolean"===r||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return V(e)}));if(e instanceof Date)return new Date(e.valueOf());if(o(e))return e;if(E(e))return function(e,r){var t={};for(var n in e)Y(e,n)&&(t[n]=r(e[n]));return t}(e,V);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function Z(e,r){for(var t in r)Y(r,t)&&(e[t]=r[t]);return e}function W(e,r){var t,n,i;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!==r.length)return!1;for(n=0,i=e.length;n<i;n++)if(!W(e[n],r[n]))return!1;return!0}if("function"==typeof e)return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(t in e)if(!(t in r)||!W(e[t],r[t]))return!1;for(t in r)if(!(t in e))return!1;return!0}return e===r}function Y(e,r){return e&&Object.hasOwnProperty.call(e,r)}var J=["Matrix","Array"],X=["number","BigNumber","Fraction"];var Q=function(e){if(e)throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};function K(){return!0}function ee(){return!1}function re(){}(0,n.A)(Q,i,{MATRIX_OPTIONS:J,NUMBER_OPTIONS:X});const te="Argument is not a typed-function.";const ne=function e(){function r(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const t=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:r},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],n={name:"any",test:K,isAny:!0};let i,a,o=0,s={createCount:0};function u(e){const r=i.get(e);if(r)return r;let t='Unknown type "'+e+'"';const n=e.toLowerCase();let o;for(o of a)if(o.toLowerCase()===n){t+='. Did you mean "'+o+'" ?';break}throw new TypeError(t)}function l(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const t=r?u(r).index:a.length,n=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw new TypeError("Object with properties {name: string, test: function} expected");const a=e[r].name;if(i.has(a))throw new TypeError('Duplicate type name "'+a+'"');n.push(a),i.set(a,{name:a,test:e[r].test,isAny:e[r].isAny,index:t+r,conversionsTo:[]})}const o=a.slice(t);a=a.slice(0,t).concat(n).concat(o);for(let e=t+n.length;e<a.length;++e)i.get(a[e]).index=e}function c(){i=new Map,a=[],o=0,l([n],!1)}function f(e){const r=a.filter((r=>{const t=i.get(r);return!t.isAny&&t.test(e)}));return r.length?r:["any"]}function p(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function m(e,r,t){if(!p(e))throw new TypeError(te);const n=t&&t.exact,i=v(Array.isArray(r)?r.join(","):r),a=d(i);if(!n||a in e.signatures){const r=e._typedFunctionData.signatureMap.get(a);if(r)return r}const o=i.length;let s,u;if(n){let r;for(r in s=[],e.signatures)s.push(e._typedFunctionData.signatureMap.get(r))}else s=e._typedFunctionData.signatures;for(let e=0;e<o;++e){const r=i[e],t=[];let n;for(n of s){const i=N(n.params,e);if(i&&(!r.restParam||i.restParam)){if(!i.hasAny){const e=y(i);if(r.types.some((r=>!e.has(r.name))))continue}t.push(n)}}if(s=t,0===s.length)break}for(u of s)if(u.params.length<=o)return u;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+d(i,", ")+"))")}function d(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(r)}function h(e){const r=0===e.indexOf("..."),t=(r?e.length>3?e.slice(3):"any":e).split("|").map((e=>u(e.trim())));let n=!1,i=r?"...":"";return{types:t.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:r}}function g(e){const r=function(e){if(0===e.length)return[];const r=e.map(u);e.length>1&&r.sort(((e,r)=>e.index-r.index));let t=r[0].conversionsTo;if(1===e.length)return t;t=t.concat([]);const n=new Set(e);for(let e=1;e<r.length;++e){let i;for(i of r[e].conversionsTo)n.has(i.from)||(t.push(i),n.add(i.from))}return t}(e.types.map((e=>e.name)));let t=e.hasAny,n=e.name;const i=r.map((function(e){const r=u(e.from);return t=r.isAny||t,n+="|"+e.from,{name:e.from,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:n,hasAny:t,hasConversion:i.length>0,restParam:e.restParam}}function y(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((r=>e.typeSet.add(r.name)))),e.typeSet}function v(e){const r=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const t=e.trim();if(""===t)return r;const n=t.split(",");for(let e=0;e<n.length;++e){const t=h(n[e].trim());if(t.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===t.types.length)return null;r.push(t)}return r}function x(e){const r=U(e);return!!r&&r.restParam}function b(e){if(e&&0!==e.types.length){if(1===e.types.length)return u(e.types[0].name).test;if(2===e.types.length){const r=u(e.types[0].name).test,t=u(e.types[1].name).test;return function(e){return r(e)||t(e)}}{const r=e.types.map((function(e){return u(e.name).test}));return function(e){for(let t=0;t<r.length;t++)if(r[t](e))return!0;return!1}}}return K}function w(e){let r,t,n;if(x(e)){r=P(e).map(b);const t=r.length,n=b(U(e)),i=function(e){for(let r=t;r<e.length;r++)if(!n(e[r]))return!1;return!0};return function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return i(e)&&e.length>=t+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(t=b(e[0]),function(e){return t(e[0])&&1===e.length}):2===e.length?(t=b(e[0]),n=b(e[1]),function(e){return t(e[0])&&n(e[1])&&2===e.length}):(r=e.map(b),function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return e.length===r.length})}function N(e,r){return r<e.length?e[r]:x(e)?U(e):null}function D(e,r){const t=N(e,r);return t?y(t):new Set}function E(e){return null===e.conversion||void 0===e.conversion}function A(e,r){const t=new Set;return e.forEach((e=>{const n=D(e.params,r);let i;for(i of n)t.add(i)})),t.has("any")?["any"]:Array.from(t)}function S(e,r,t){let n,i;const a=e||"unnamed";let o,s=t;for(o=0;o<r.length;o++){const e=[];if(s.forEach((t=>{const n=b(N(t.params,o));(o<t.params.length||x(t.params))&&n(r[o])&&e.push(t)})),0===e.length){if(i=A(s,o),i.length>0){const e=f(r[o]);return n=new TypeError("Unexpected type of argument in function "+a+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")"),n.data={category:"wrongType",fn:a,index:o,actual:e,expected:i},n}}else s=e}const u=s.map((function(e){return x(e.params)?1/0:e.params.length}));if(r.length<Math.min.apply(null,u))return i=A(s,o),n=new TypeError("Too few arguments in function "+a+" (expected: "+i.join(" or ")+", index: "+r.length+")"),n.data={category:"tooFewArgs",fn:a,index:r.length,expected:i},n;const l=Math.max.apply(null,u);if(r.length>l)return n=new TypeError("Too many arguments in function "+a+" (expected: "+l+", actual: "+r.length+")"),n.data={category:"tooManyArgs",fn:a,index:r.length,expectedLength:l},n;const c=[];for(let e=0;e<r.length;++e)c.push(f(r[e]).join("|"));return n=new TypeError('Arguments of type "'+c.join(", ")+'" do not match any of the defined signatures of function '+a+"."),n.data={category:"mismatch",actual:c},n}function C(e){let r=a.length+1;for(let t=0;t<e.types.length;t++)E(e.types[t])&&(r=Math.min(r,e.types[t].typeIndex));return r}function M(e){let r=o+1;for(let t=0;t<e.types.length;t++)E(e.types[t])||(r=Math.min(r,e.types[t].conversionIndex));return r}function O(e,r){if(e.hasAny){if(!r.hasAny)return 1}else if(r.hasAny)return-1;if(e.restParam){if(!r.restParam)return 1}else if(r.restParam)return-1;if(e.hasConversion){if(!r.hasConversion)return 1}else if(r.hasConversion)return-1;const t=C(e)-C(r);if(t<0)return-1;if(t>0)return 1;const n=M(e)-M(r);return n<0?-1:n>0?1:0}function T(e,r){const t=e.params,n=r.params,i=U(t),a=U(n),o=x(t),s=x(n);if(o&&i.hasAny){if(!s||!a.hasAny)return 1}else if(s&&a.hasAny)return-1;let u,l=0,c=0;for(u of t)u.hasAny&&++l,u.hasConversion&&++c;let f=0,p=0;for(u of n)u.hasAny&&++f,u.hasConversion&&++p;if(l!==f)return l-f;if(o&&i.hasConversion){if(!s||!a.hasConversion)return 1}else if(s&&a.hasConversion)return-1;if(c!==p)return c-p;if(o){if(!s)return 1}else if(s)return-1;const m=(t.length-n.length)*(o?-1:1);if(0!==m)return m;const d=[];let h,g=0;for(let e=0;e<t.length;++e){const r=O(t[e],n[e]);d.push(r),g+=r}if(0!==g)return g;for(h of d)if(0!==h)return h;return 0}function F(e,r){let t=r;if(e.some((e=>e.hasConversion))){const n=x(e),i=e.map(_);t=function(){const e=[],t=n?arguments.length-1:arguments.length;for(let r=0;r<t;r++)e[r]=i[r](arguments[r]);return n&&(e[t]=arguments[t].map(i[t])),r.apply(this,e)}}let n=t;if(x(e)){const r=e.length-1;n=function(){return t.apply(this,L(arguments,0,r).concat([L(arguments,r)]))}}return n}function _(e){let r,t,n,i;const a=[],o=[];switch(e.types.forEach((function(e){e.conversion&&(a.push(u(e.conversion.from).test),o.push(e.conversion.convert))})),o.length){case 0:return function(e){return e};case 1:return r=a[0],n=o[0],function(e){return r(e)?n(e):e};case 2:return r=a[0],t=a[1],n=o[0],i=o[1],function(e){return r(e)?n(e):t(e)?i(e):e};default:return function(e){for(let r=0;r<o.length;r++)if(a[r](e))return o[r](e);return e}}}function B(e){return function e(r,t,n){if(t<r.length){const o=r[t];let s=[];if(o.restParam){const e=o.types.filter(E);e.length<o.types.length&&s.push({types:e,name:"..."+e.map((e=>e.name)).join("|"),hasAny:e.some((e=>e.isAny)),hasConversion:!1,restParam:!0}),s.push(o)}else s=o.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,a=function(i){return e(r,t+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(a))}return[n];var i,a}(e,0,[])}function I(e,r){const t=Math.max(e.length,r.length);for(let n=0;n<t;n++){const t=D(e,n),i=D(r,n);let a,o=!1;for(a of i)if(t.has(a)){o=!0;break}if(!o)return!1}const n=e.length,i=r.length,a=x(e),o=x(r);return a?o?n===i:i>=n:o?n>=i:n===i}function z(e,r,t){const n=[];let i;for(i of e){let e=t[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=r[e],"function"!=typeof e)return!1;n.push(e)}return n}function q(e,r,t){const n=function(e){return e.map((e=>G(e)?H(e.referToSelf.callback):$(e)?j(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(n.length).fill(!1);let a=!0;for(;a;){a=!1;let e=!0;for(let o=0;o<n.length;++o){if(i[o])continue;const s=n[o];if(G(s))n[o]=s.referToSelf.callback(t),n[o].referToSelf=s.referToSelf,i[o]=!0,e=!1;else if($(s)){const t=z(s.referTo.references,n,r);t?(n[o]=s.referTo.callback.apply(this,t),n[o].referTo=s.referTo,i[o]=!0,e=!1):a=!0}}if(e&&a)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return n}function R(e,r){if(s.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&function(e){const r=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((t=>{const n=e[t];if(r.test(n.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);const t=[],n=[],i={},a=[];let o;for(o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const e=v(o);if(!e)continue;t.forEach((function(r){if(I(r,e))throw new TypeError('Conflicting signatures "'+d(r)+'" and "'+d(e)+'".')})),t.push(e);const s=n.length;n.push(r[o]);const u=e.map(g);let l;for(l of B(u)){const e=d(l);a.push({params:l,name:e,fn:s}),l.every((e=>!e.hasConversion))&&(i[e]=s)}}a.sort(T);const u=q(n,i,se);let l;for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&(i[l]=u[i[l]]);const c=[],f=new Map;for(l of a)f.has(l.name)||(l.fn=u[l.fn],c.push(l),f.set(l.name,l));const p=c[0]&&c[0].params.length<=2&&!x(c[0].params),m=c[1]&&c[1].params.length<=2&&!x(c[1].params),h=c[2]&&c[2].params.length<=2&&!x(c[2].params),y=c[3]&&c[3].params.length<=2&&!x(c[3].params),N=c[4]&&c[4].params.length<=2&&!x(c[4].params),D=c[5]&&c[5].params.length<=2&&!x(c[5].params),E=p&&m&&h&&y&&N&&D;for(let e=0;e<c.length;++e)c[e].test=w(c[e].params);const A=p?b(c[0].params[0]):ee,S=m?b(c[1].params[0]):ee,C=h?b(c[2].params[0]):ee,M=y?b(c[3].params[0]):ee,O=N?b(c[4].params[0]):ee,_=D?b(c[5].params[0]):ee,z=p?b(c[0].params[1]):ee,R=m?b(c[1].params[1]):ee,k=h?b(c[2].params[1]):ee,P=y?b(c[3].params[1]):ee,U=N?b(c[4].params[1]):ee,L=D?b(c[5].params[1]):ee;for(let e=0;e<c.length;++e)c[e].implementation=F(c[e].params,c[e].fn);const j=p?c[0].implementation:re,H=m?c[1].implementation:re,$=h?c[2].implementation:re,G=y?c[3].implementation:re,V=N?c[4].implementation:re,Z=D?c[5].implementation:re,W=p?c[0].params.length:-1,Y=m?c[1].params.length:-1,J=h?c[2].params.length:-1,X=y?c[3].params.length:-1,Q=N?c[4].params.length:-1,K=D?c[5].params.length:-1,te=E?6:0,ne=c.length,ie=c.map((e=>e.test)),ae=c.map((e=>e.implementation)),oe=function(){for(let e=te;e<ne;e++)if(ie[e](arguments))return ae[e].apply(this,arguments);return s.onMismatch(e,arguments,c)};function se(e,r){return arguments.length===W&&A(e)&&z(r)?j.apply(this,arguments):arguments.length===Y&&S(e)&&R(r)?H.apply(this,arguments):arguments.length===J&&C(e)&&k(r)?$.apply(this,arguments):arguments.length===X&&M(e)&&P(r)?G.apply(this,arguments):arguments.length===Q&&O(e)&&U(r)?V.apply(this,arguments):arguments.length===K&&_(e)&&L(r)?Z.apply(this,arguments):oe.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=i,se._typedFunctionData={signatures:c,signatureMap:f},se}function k(e,r,t){throw S(e,r,t)}function P(e){return L(e,0,e.length-1)}function U(e){return e[e.length-1]}function L(e,r,t){return Array.prototype.slice.call(e,r,t)}function j(e,r){return{referTo:{references:e,callback:r}}}function H(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function $(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function G(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function V(e,r){if(!e)return r;if(r&&r!==e){const t=new Error("Function names do not match (expected: "+e+", actual: "+r+")");throw t.data={actual:r,expected:e},t}return e}function Z(e){let r;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(p(e[t])||"string"==typeof e[t].signature)&&(r=V(r,e[t].name));return r}function W(e,r){let t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(t in e&&r[t]!==e[t]){const n=new Error('Signature "'+t+'" is defined twice');throw n.data={signature:t,sourceFunction:r[t],destFunction:e[t]},n}e[t]=r[t]}}c(),l(t);const Y=s;function J(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return s=function(e){const t="string"==typeof e;let n=t?e:"";const i={};for(let e=t?1:0;e<arguments.length;++e){const a=arguments[e];let o,s={};if("function"==typeof a?(o=a.name,"string"==typeof a.signature?s[a.signature]=a:p(a)&&(s=a.signatures)):r(a)&&(s=a,t||(o=Z(a))),0===Object.keys(s).length){const r=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw r.data={index:e,argument:a},r}t||(n=V(n,o)),W(i,s)}return R(n||"",i)},s.create=e,s.createCount=Y.createCount,s.onMismatch=k,s.throwMismatchError=k,s.createError=S,s.clear=c,s.clearConversions=function(){let e;for(e of a)i.get(e).conversionsTo=[];o=0},s.addTypes=l,s._findType=u,s.referTo=function(){const e=P(arguments).map((e=>d(v(e)))),r=U(arguments);if("function"!=typeof r)throw new TypeError("Callback function expected as last argument");return j(e,r)},s.referToSelf=H,s.convert=function(e,r){const t=u(r);if(t.test(e))return e;const n=t.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+r+" defined.");for(let r=0;r<n.length;r++){if(u(n[r].from).test(e))return n[r].convert(e)}throw new Error("Cannot convert "+e+" to "+r)},s.findSignature=m,s.find=function(e,r,t){return m(e,r,t).implementation},s.isTypedFunction=p,s.warnAgainstDeprecatedThis=!0,s.addType=function(e,r){let t="any";!1!==r&&i.has("Object")&&(t="Object"),s.addTypes([e],t)},s.addConversion=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};J(e);const t=u(e.to),n=t.conversionsTo.find((r=>r.from===e.from));if(n){if(!r||!r.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+t.name+'"');s.removeConversion({from:n.from,to:e.to,convert:n.convert})}t.conversionsTo.push({from:e.from,convert:e.convert,index:o++})},s.addConversions=function(e,r){e.forEach((e=>s.addConversion(e,r)))},s.removeConversion=function(e){J(e);const r=u(e.to),t=function(e,r){for(let t=0;t<e.length;t++)if(r(e[t]))return e[t]}(r.conversionsTo,(r=>r.from===e.from));if(!t)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(t.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const n=r.conversionsTo.indexOf(t);r.conversionsTo.splice(n,1)},s.resolve=function(e,r){if(!p(e))throw new TypeError(te);const t=e._typedFunctionData.signatures;for(let e=0;e<t.length;++e)if(t[e].test(r))return t[e];return null},s}();function ie(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var ae=Math.sign||function(e){return e>0?1:e<0?-1:0},oe=Math.log2||function(e){return Math.log(e)/Math.LN2},se=Math.log10||function(e){return Math.log(e)/Math.LN10},ue=Math.log1p||function(e){return Math.log(e+1)},le=Math.cbrt||function(e){if(0===e)return e;var r,t=e<0;return t&&(e=-e),r=isFinite(e)?(e/((r=Math.exp(Math.log(e)/3))*r)+2*r)/3:e,t?-r:r},ce=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function fe(e,r,t){var n={2:"0b",8:"0o",16:"0x"}[r],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ie(t))throw new Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!ie(e))throw new Error("Value must be an integer");e<0&&(e+=2**t),i="i".concat(t)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(r)).concat(i)}function pe(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:t,precision:n,wordSize:i}=me(r);switch(t){case"fixed":return he(e,n);case"exponential":return ge(e,n);case"engineering":return function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n=ye(t,r),i=n.exponent,o=n.coefficients,s=i%3==0?i:i<0?i-3-i%3:i-i%3;if(a(r))for(;r>o.length||i-s+1>o.length;)o.push(0);else for(var u=Math.abs(i-s)-(o.length-1),l=0;l<u;l++)o.push(0);var c=Math.abs(i-s),f=1;for(;c>0;)f++,c--;var p=o.slice(f).join(""),m=a(r)&&p.length||p.match(/[1-9]/)?"."+p:"",d=o.slice(0,f).join("")+m+"e"+(i>=0?"+":"")+s.toString();return n.sign+d}(e,n);case"bin":return fe(e,2,i);case"oct":return fe(e,8,i);case"hex":return fe(e,16,i);case"auto":return function(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=Me(null==t?void 0:t.lowerExp,-3),i=Me(null==t?void 0:t.upperExp,5),a=de(e),o=r?ye(a,r):a;if(o.exponent<n||o.exponent>=i)return ge(e,r);var s=o.coefficients,u=o.exponent;s.length<r&&(s=s.concat(ve(r-s.length))),s=s.concat(ve(u-s.length+1+(s.length<r?r-s.length:0)));var l=u>0?u:0;return l<(s=ve(-u).concat(s)).length-1&&s.splice(l+1,0,"."),o.sign+s.join("")}(e,n,r).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r}));default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function me(e){var r,t,n="auto";if(void 0!==e)if(a(e))r=e;else if(o(e))r=e.toNumber();else{if(!E(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(r=Ce(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(t=Ce(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(n=e.notation)}return{notation:n,precision:r,wordSize:t}}function de(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var t=r[1],n=r[2],i=parseFloat(r[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===o.length&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function he(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n="number"==typeof r?ye(t,t.exponent+1+r):t,i=n.coefficients,a=n.exponent+1,o=a+(r||0);return i.length<o&&(i=i.concat(ve(o-i.length))),a<0&&(i=ve(1-a).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function ge(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n=r?ye(t,r):t,i=n.coefficients,a=n.exponent;i.length<r&&(i=i.concat(ve(r-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ye(e,r){for(var t={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=t.coefficients;r<=0;)n.unshift(0),t.exponent++,r++;if(n.length>r&&n.splice(r,n.length-r)[0]>=5){var i=r-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),t.exponent++,i++),n[--i]++}return t}function ve(e){for(var r=[],t=0;t<e;t++)r.push(0);return r}var xe=Number.EPSILON||2220446049250313e-31;function be(e,r,t){if(null==t)return e===r;if(e===r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var n=Math.abs(e-r);return n<=xe||n<=Math.max(Math.abs(e),Math.abs(r))*t}return!1}var we=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},Ne=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},De=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Ee=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},Ae=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Se=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function Ce(e,r){return a(e)?e:o(e)?e.toNumber():void r()}function Me(e,r){return a(e)?e:o(e)?e.toNumber():r}function Oe(e,r,t,n){function i(n){var i=function(e,r){for(var t={},n=0;n<r.length;n++){var i=r[n],a=e[i];void 0!==a&&(t[i]=a)}return t}(n,r.map(Te));return function(e,r,t){var n=r.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==t[e]));if(!n){var i=r.filter((e=>void 0===t[e]));throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map((e=>'"'.concat(e,'"'))).join(", "),"."))}}(e,r,n),t(i)}return i.isFactory=!0,i.fn=e,i.dependencies=r.slice().sort(),n&&(i.meta=n),i}function Te(e){return e&&"?"===e[0]?e.slice(1):e}function Fe(e,r){if(ze(e)&&Be(e,r))return e[r];if("function"==typeof e[r]&&Ie(e,r))throw new Error('Cannot access method "'+r+'" as a property');throw new Error('No access to property "'+r+'"')}function _e(e,r,t){if(ze(e)&&Be(e,r))return e[r]=t,t;throw new Error('No access to property "'+r+'"')}function Be(e,r){return!(!e||"object"!=typeof e)&&(!!Y(qe,r)||!(r in Object.prototype)&&!(r in Function.prototype))}function Ie(e,r){return null!=e&&"function"==typeof e[r]&&(!(Y(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e))&&(!!Y(Re,r)||!(r in Object.prototype)&&!(r in Function.prototype)))}function ze(e){return"object"==typeof e&&e&&e.constructor===Object}var qe={length:!0,name:!0},Re={toString:!0,valueOf:!0,toLocaleString:!0};class ke{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return Fe(this.wrappedObject,e)}set(e,r){return _e(this.wrappedObject,e,r),this}has(e){return r=this.wrappedObject,e in r;var r}entries(){return Ue(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(var r of this.keys())e(this.get(r),r,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}}class Pe{constructor(e,r,t){this.a=e,this.b=r,this.bKeys=t,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return Ue(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function Ue(e,r){return{next:()=>{var t=e.next();return t.done?t:{value:r(t.value),done:!1}}}}function Le(){return new Map}function je(e){if(!e)return Le();if(He(e))return e;if(E(e))return new ke(e);throw new Error("createMap can create maps from objects or Maps")}function He(e){return!!e&&(e instanceof Map||e instanceof ke||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var $e=function(){return $e=ne.create,ne},Ge=Oe("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){var{BigNumber:r,Complex:t,DenseMatrix:n,Fraction:i}=e,B=$e();return B.clear(),B.addTypes([{name:"number",test:a},{name:"Complex",test:s},{name:"BigNumber",test:o},{name:"Fraction",test:u},{name:"Unit",test:l},{name:"identifier",test:e=>c&&/^(?:[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\u