@ohif/extension-dicom-microscopy 3.14.0-beta.47 → 3.14.0-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@cornerstonejs/core"),require("@ohif/i18n"),require("dcmjs"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","@ohif/i18n","dcmjs","@ohif/core","@ohif/ui-next","@ohif/extension-default"],t):"object"==typeof exports?exports["ohif-extension-dicom-microscopy"]=t(require("@cornerstonejs/core"),require("@ohif/i18n"),require("dcmjs"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):e["ohif-extension-dicom-microscopy"]=t(e["@cornerstonejs/core"],e["@ohif/i18n"],e.dcmjs,e["@ohif/core"],e["@ohif/ui-next"],e["@ohif/extension-default"])}(globalThis,(e,t,r,n,i,o)=>(()=>{var u={683(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>A});var n=r(184),i=r(326),o=r(438),u=r(530),s=r.n(u);let a=e=>{let{list:t,itemGenerator:r}=e;if(t)return t.map(t=>{if(!t)return;let n=t.generator||r;if(!n)throw Error(`No generator for ${t}`);return n({...e,item:t})})};var c=r(55),l=r(867),f=r.n(l);function h(e,t){if(null!==e)return parseFloat(e).toFixed(t)}function d(e,t="HH:mm:ss"){return f()(e,"HH:mm:ss").format(t)}r(557);var p=r(2),m=r(870);let{formatPN:D}=p.utils,g=e=>{let{item:t}=e,{title:r,value:n,condition:i,contents:o}=t;if(e.image={...e.image,...e.metadata},e.formatDate=c.formatDICOMDate,e.formatTime=d,e.formatPN=D,e.formatNumberPrecision=h,i&&!i(e)||!o&&!n)return null;let u=n&&n(e),s=o&&o(e)||[{className:"mr-1",value:r},{classname:"mr-1 font-light",value:u}];return(0,m.jsx)("div",{className:"flex flex-row",children:s.map((e,t)=>(0,m.jsx)("span",{className:e.className,children:e.value},t))},t.id)},y=({config:e,overlayData:t,...r})=>{let{topLeft:n=[],topRight:i=[],bottomLeft:o=[],bottomRight:u=[]}=t??{},c="absolute pointer-events-none microscopy-viewport-overlay";return(0,m.jsxs)(m.Fragment,{children:[n&&n.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-top-left",className:s()(c,"top-viewport left-viewport text-highlight"),children:a({...r,list:n,itemGenerator:g})}),i&&i.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-top-right",className:s()(c,"top-viewport right-viewport-scrollbar text-highlight"),children:a({...r,list:i,itemGenerator:g})}),u&&u.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-bottom-right",className:s()(c,"bottom-viewport right-viewport-scrollbar text-highlight"),children:a({...r,list:u,itemGenerator:g})}),o&&o.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-bottom-left",className:s()(c,"bottom-viewport left-viewport text-highlight"),children:a({...r,list:o,itemGenerator:g})})]})};var v=r(427),w=r(111),_=r.n(w);let E=i.memo(e=>{let t,r,u,s,a,c,l,f,h,d,D,g,w,E,A,b,C,x,S=(0,n.c)(51),{activeViewportId:M,setViewportActive:N,displaySets:O,viewportId:B,dataSource:T,resizeRef:k}=e,{servicesManager:I,extensionManager:R}=(0,p.useSystem)(),[P,j]=(0,i.useState)(!1),[Y,U]=(0,i.useState)(null),[z,V]=(0,i.useState)(null),L=(0,i.useRef)(void 0),H=(0,i.useRef)(void 0),{microscopyService:q,customizationService:W}=I.services;S[0]!==W?(t=W.getCustomization("microscopyViewport.overlay"),S[0]=W,S[1]=t):t=S[1];let G=t;S[2]!==T||S[3]!==R||S[4]!==q||S[5]!==I||S[6]!==B?(r=async(e,t)=>{let r=async r=>{let{viewer:n,metadata:i}=await q.importDicomMicroscopyViewer(),u=n.VolumeImageViewer,s=(0,v.A)({extensionManager:R,servicesManager:I}),a=[];r.forEach(e=>{e.ImageType="string"==typeof e.ImageType?e.ImageType.split("\\"):e.ImageType;let t=(0,o.cleanDenaturalizedDataset)(_().data.DicomMetaDictionary.denaturalizeDataset(e),{StudyInstanceUID:e.StudyInstanceUID,SeriesInstanceUID:e.SeriesInstanceUID,dataSourceConfig:T.getConfig()});t["00480105"]||(t["00480105"]={vr:"SQ",Value:[{"00480106":{vr:"SH",Value:["1"]}}]});let r=new i.VLWholeSlideMicroscopyImage({metadata:t}),n=r.ImageType[2];("VOLUME"===n||"THUMBNAIL"===n)&&a.push(r)});let c=new u({client:s,metadata:a,retrieveRendered:!1,controls:["overview","position"]});L&&L.current&&c.addViewportOverlay&&c.addViewportOverlay({element:L.current,coordinates:[0,0],navigate:!0,className:"OpenLayersOverlay"}),c.render({container:e});let{StudyInstanceUID:l,SeriesInstanceUID:f}=t,h=q.addViewer(c,B,e,l,f);h.addContextMenuCallback(F),U(c),V(h)};q.clearAnnotations();let n=t;if(t.isOverlayDisplaySet&&(n=t.getSourceDisplaySet()),console.log("Loading viewer metadata",n),await r(n.others),t.isOverlayDisplaySet&&!t.isLoaded&&!t.isLoading){let e=t.getSourceDisplaySet();t.load(e)}},S[2]=T,S[3]=R,S[4]=q,S[5]=I,S[6]=B,S[7]=r):r=S[7];let Z=r;S[8]!==O[0]||S[9]!==Z||S[10]!==q||S[11]!==Y?(u=()=>{if(!Y){let e=O[0];Z(H.current,e).then(()=>{j(!0)})}return()=>{Y&&q.removeViewer(Y)}},S[8]=O[0],S[9]=Z,S[10]=q,S[11]=Y,S[12]=u):u=S[12],S[13]!==Y?(s=[Y],S[13]=Y,S[14]=s):s=S[14],(0,i.useEffect)(u,s),S[15]!==O[0]||S[16]!==q?(a=()=>{let e=O[0];if(q.clearAnnotations(),e.isOverlayDisplaySet&&!e.isLoaded&&!e.isLoading){let t=e.getSourceDisplaySet();e.load(t)}},S[15]=O[0],S[16]=q,S[17]=a):a=S[17],S[18]!==O||S[19]!==z||S[20]!==q?(c=[z,O,q],S[18]=O,S[19]=z,S[20]=q,S[21]=c):c=S[21],(0,i.useEffect)(a,c),S[22]===Symbol.for("react.memo_cache_sentinel")?(l={width:"100%",height:"100%"},S[22]=l):l=S[22];let $=l,J=O[0],Q=J.firstInstance||J.instance;S[23]!==W?(f=W.getCustomization("ui.loadingIndicatorProgress"),S[23]=W,S[24]=f):f=S[24];let X=f;return S[25]!==M||S[26]!==N||S[27]!==B?(h=()=>{B!==M&&N(B)},S[25]=M,S[26]=N,S[27]=B,S[28]=h):h=S[28],S[29]===Symbol.for("react.memo_cache_sentinel")?(d={...$,display:"none"},D={...$},S[29]=d,S[30]=D):(d=S[29],D=S[30]),S[31]===Symbol.for("react.memo_cache_sentinel")?(g={position:"relative",height:"100%",width:"100%"},S[31]=g):g=S[31],S[32]!==J||S[33]!==Q||S[34]!==G?(w=J&&Q.imageId&&(0,m.jsx)(y,{overlayData:G,displaySet:J,instance:J.instance,metadata:J.metadata}),S[32]=J,S[33]=Q,S[34]=G,S[35]=w):w=S[35],S[36]!==w?(E=(0,m.jsx)("div",{style:d,children:(0,m.jsx)("div",{style:D,ref:L,children:(0,m.jsx)("div",{style:g,children:w})})}),S[36]=w,S[37]=E):E=S[37],S[38]!==k?(A=e=>{H.current=e,k.current=e},S[38]=k,S[39]=A):A=S[39],S[40]!==A||S[41]!==B?(b=(0,m.jsx)("div",{style:$,"data-viewportid":B,ref:A}),S[40]=A,S[41]=B,S[42]=b):b=S[42],S[43]!==X||S[44]!==P?(C=P?null:(0,m.jsx)(X,{className:"h-full w-full bg-black"}),S[43]=X,S[44]=P,S[45]=C):C=S[45],S[46]!==E||S[47]!==b||S[48]!==C||S[49]!==h?(x=(0,m.jsxs)("div",{className:"DicomMicroscopyViewer",style:$,onClick:h,children:[E,b,C]}),S[46]=E,S[47]=b,S[48]=C,S[49]=h,S[50]=x):x=S[50],x},function(e,t){if(e.setViewportActive!==t.setViewportActive||e.resizeRef!==t.resizeRef||e.viewportId!==t.viewportId||e.activeViewportId!==t.activeViewportId||e.dataSource!==t.dataSource)return!1;let r=e.displaySets,n=t.displaySets;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n.find(e=>e.displaySetInstanceUID===t.displaySetInstanceUID);if(!i||i.images?.length!==t.images?.length)return!1;if(i.images?.length){for(let e=0;e<i.images.length;e++)if(i.images[e].imageId!==t.images[e].imageId)return!1}}return!0});E.displayName="DicomMicroscopyViewport";let A=E;function F(e){}},427(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(2),i=r(438);function o({extensionManager:e,servicesManager:t}){let r=window.config.dataSources.find(t=>t.sourceName===e.activeDataSourceName),{userAuthenticationService:u}=t.services,{wadoRoot:s,staticWado:a,singlepart:c}=r.configuration,l={url:s||"/dicomlocal",staticWado:a,singlepart:c,headers:u.getAuthorizationHeader(),errorInterceptor:n.errorHandler.getHTTPErrorHandler()},f=new i.StaticWadoClient(l);return f.wadoURL=l.url,"dicomlocal"===e.activeDataSourceName&&(f.retrieveInstanceFrames=async e=>{if(!("studyInstanceUID"in e))throw Error("Study Instance UID is required for retrieval of instance frames");if(!("seriesInstanceUID"in e))throw Error("Series Instance UID is required for retrieval of instance frames");if(!("sopInstanceUID"in e))throw Error("SOP Instance UID is required for retrieval of instance frames");if(!("frameNumbers"in e))throw Error("frame numbers are required for retrieval of instance frames");console.log(`retrieve frames ${e.frameNumbers.toString()} of instance ${e.sopInstanceUID}`);let t=n.DicomMetadataStore.getInstance(e.studyInstanceUID,e.seriesInstanceUID,e.sopInstanceUID);return(Array.isArray(e.frameNumbers)?e.frameNumbers:e.frameNumbers.split(",")).map(e=>Array.isArray(t.PixelData)?t.PixelData[e-1]:t.PixelData)}),f}},42(e){!function(){"use strict";var t={s:1,n:0,d:1};function r(e,t){if(isNaN(e=parseInt(e,10)))throw c();return e*t}function n(e,t){if(0===t)throw a();var r=Object.create(s.prototype);r.s=e<0?-1:1;var n=u(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function i(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var o=function(e,n){var i,o=0,u=1,s=1,f=0,h=0,d=0,p=1,m=1,D=0,g=1,y=1,v=1;if(null==e);else if(void 0!==n){if(s=(o=e)*(u=n),o%1!=0||u%1!=0)throw l()}else switch(typeof e){case"object":if("d"in e&&"n"in e)o=e.n,u=e.d,"s"in e&&(o*=e.s);else if(0 in e)o=e[0],1 in e&&(u=e[1]);else throw c();s=o*u;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)o=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);g<=1e7&&v<=1e7;){if(e===(i=(D+y)/(g+v))){g+v<=1e7?(o=D+y,u=g+v):v>g?(o=y,u=v):(o=D,u=g);break}e>i?(D+=y,g+=v):(y+=D,v+=g),g>1e7?(o=y,u=v):(o=D,u=g)}o*=m}else(isNaN(e)||isNaN(n))&&(u=o=NaN);break;case"string":if(null===(g=e.match(/\d+|./g)))throw c();if("-"===g[D]?(s=-1,D++):"+"===g[D]&&D++,g.length===D+1?h=r(g[D++],s):"."===g[D+1]||"."===g[D]?("."!==g[D]&&(f=r(g[D++],s)),(++D+1===g.length||"("===g[D+1]&&")"===g[D+3]||"'"===g[D+1]&&"'"===g[D+3])&&(h=r(g[D],s),p=Math.pow(10,g[D].length),D++),("("===g[D]&&")"===g[D+2]||"'"===g[D]&&"'"===g[D+2])&&(d=r(g[D+1],s),m=Math.pow(10,g[D+1].length)-1,D+=3)):"/"===g[D+1]||":"===g[D+1]?(h=r(g[D],s),p=r(g[D+2],1),D+=3):"/"===g[D+3]&&" "===g[D+1]&&(f=r(g[D],s),h=r(g[D+2],s),p=r(g[D+4],1),D+=5),g.length<=D){s=o=d+(u=p*m)*f+m*h;break}default:throw c()}if(0===u)throw a();t.s=s<0?-1:1,t.n=Math.abs(o),t.d=Math.abs(u)};function u(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function s(e,r){if(o(e,r),!(this instanceof s))return n(t.s*t.n,t.d);e=u(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var a=function(){return Error("Division by Zero")},c=function(){return Error("Invalid argument")},l=function(){return Error("Parameters must be integer")};s.prototype={s:1,n:0,d:1,abs:function(){return n(this.n,this.d)},neg:function(){return n(-this.s*this.n,this.d)},add:function(e,r){return o(e,r),n(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),n(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return n(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new s(NaN);if(void 0===e)return n(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw a();return n(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),n(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(e,r){return(o(e,r),0===t.n&&0===this.n)?n(0,1):n(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s(NaN):n(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 s(NaN):n(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 s(NaN):n(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return n(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)if(t.s<0)return n(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n));else return n(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var u=i(this.n),s=i(this.d),a=1,c=1;for(var l in u)if("1"!==l){if("0"===l){a=0;break}if(u[l]*=t.n,u[l]%t.d!=0)return null;u[l]/=t.d,a*=Math.pow(l,u[l])}for(var l in s)if("1"!==l){if(s[l]*=t.n,s[l]%t.d!=0)return null;s[l]/=t.d,c*=Math.pow(l,s[l])}return t.s<0?n(c,a):n(a,c)},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 t=this.abs(),r=t.toContinued(),i=1;i<r.length;i++){for(var o=n(r[i-1],1),u=i-2;u>=0;u--)o=o.inverse().add(r[u]);if(Math.abs(o.sub(t).valueOf())<e)return o.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 t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t)return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,r=1;1!==t;r++)if(t=10*t%e,r>2e3)return 0;return r}(r),i=function(e,t){for(var r=1,n=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,t,e),i=0;i<300;i++){if(r===n)return i;r=10*r%e,n=10*n%e}return 0}(r,n),o=this.s<0?"-":"";if(o+=t/r|0,t%=r,(t*=10)&&(o+="."),n){for(var u=i;u--;)o+=t/r|0,t%=r,t*=10;o+="(";for(var u=n;u--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(var u=e;t&&u--;)o+=t/r|0,t%=r,t*=10;return o}},Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Fraction=s,e.exports=s}()},51(e,t,r){var n=0/0,i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,c="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,m=function(){return f.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==h.call(t))return n;if(D(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=D(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var c=u.test(e);return c||s.test(e)?a(e.slice(2),c?2:8):o.test(e)?n:+e}e.exports=function(e,t,r){var n,i,o,u,s,a,c=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=n,o=i;return n=i=void 0,c=t,u=e.apply(o,r)}function v(e){var r=e-a,n=e-c;return void 0===a||r>=t||r<0||f&&n>=o}function w(){var e,r,n,i=m();if(v(i))return _(i);s=setTimeout(w,(e=i-a,r=i-c,n=t-e,f?p(n,o-r):n))}function _(e){return(s=void 0,h&&n)?y(e):(n=i=void 0,u)}function E(){var e,r=m(),o=v(r);if(n=arguments,i=this,a=r,o){if(void 0===s)return c=e=a,s=setTimeout(w,t),l?y(e):u;if(f)return s=setTimeout(w,t),y(a)}return void 0===s&&(s=setTimeout(w,t)),u}return t=g(t)||0,D(r)&&(l=!!r.leading,o=(f="maxWait"in r)?d(g(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h),E.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=a=i=s=void 0},E.flush=function(){return void 0===s?u:_(m())},E}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return z.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(o(e,t))return!1;return!0}function s(e){return void 0===e}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function f(e,t){for(var r in t)o(t,r)&&(e[r]=t[r]);return o(t,"toString")&&(e.toString=t.toString),o(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,r,n){return to(e,t,r,n,!0).utc()}function d(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=d(e),r=V.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function m(e){var t=h(NaN);return null!=e?f(d(t),e):d(t).userInvalidated=!0,t}V=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var D,g,y=t.momentProperties=[],v=!1;function w(e,t){var r,n,i,o=y.length;if(s(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),s(t._i)||(e._i=t._i),s(t._f)||(e._f=t._f),s(t._l)||(e._l=t._l),s(t._strict)||(e._strict=t._strict),s(t._tzm)||(e._tzm=t._tzm),s(t._isUTC)||(e._isUTC=t._isUTC),s(t._offset)||(e._offset=t._offset),s(t._pf)||(e._pf=d(t)),s(t._locale)||(e._locale=t._locale),o>0)for(r=0;r<o;r++)s(i=t[n=y[r]])||(e[n]=i);return e}function _(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function E(e){return e instanceof _||null!=e&&null!=e._isAMomentObject}function A(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function F(e,r){var n=!0;return f(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,u,s,a=[],c=arguments.length;for(u=0;u<c;u++){if(i="","object"==typeof arguments[u]){for(s in i+="\n["+u+"] ",arguments[0])o(arguments[0],s)&&(i+=s+": "+arguments[0][s]+", ");i=i.slice(0,-2)}else i=arguments[u];a.push(i)}A(e+"\nArguments: "+Array.prototype.slice.call(a).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var b={};function C(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),b[e]||(A(r),b[e]=!0)}function x(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function S(e,t){var r,n=f({},e);for(r in t)o(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},f(n[r],e[r]),f(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)o(e,r)&&!o(t,r)&&i(e[r])&&(n[r]=f({},n[r]));return n}function M(e){null!=e&&this.set(e)}function N(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,T={},k={};function I(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(k[e]=i),t&&(k[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),r&&(k[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function R(e,t){return e.isValid()?(T[t=P(t,e.localeData())]=T[t]||function(e){var t,r,n,i=e.match(O);for(r=0,n=i.length;r<n;r++)k[i[r]]?i[r]=k[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,o="";for(r=0;r<n;r++)o+=x(i[r])?i[r].call(t,e):i[r];return o}}(t),T[t](e)):e.localeData().invalidDate()}function P(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(B.lastIndex=0;r>=0&&B.test(e);)e=e.replace(B,n),B.lastIndex=0,r-=1;return e}var j={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Y(e){return"string"==typeof e?j[e]||j[e.toLowerCase()]:void 0}function U(e){var t,r,n={};for(r in e)o(e,r)&&(t=Y(r))&&(n[t]=e[r]);return n}var z,V,L,H={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},q=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)o(e,t)&&r.push(t);return r},W=/\d/,G=/\d\d/,Z=/\d{3}/,$=/\d{4}/,J=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,eo=/Z|[+-]\d\d:?\d\d/gi,eu=/Z|[+-]\d\d(?::?\d\d)?/gi,es=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ea=/^[1-9]\d?/,ec=/^([1-9]\d|\d)/;function el(e,t,r){L[e]=x(t)?t:function(e,n){return e&&r?r:t}}function ef(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function eh(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ed(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=eh(t)),r}L={};var ep={};function em(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),a(t)&&(i=function(e,r){r[t]=ed(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function eD(e,t){em(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function eg(e){return e%4==0&&e%100!=0||e%400==0}function ey(e){return eg(e)?366:365}I("Y",0,0,function(){var e=this.year();return e<=9999?N(e,4):"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),el("Y",ei),el("YY",Q,G),el("YYYY",et,$),el("YYYYY",er,J),el("YYYYYY",er,J),em(["YYYYY","YYYYYY"],0),em("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):ed(e)}),em("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),em("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return ed(e)+(ed(e)>68?1900:2e3)};var ev=ew("FullYear",!0);function ew(e,r){return function(n){return null!=n?(eE(this,e,n),t.updateOffset(this,r),this):e_(this,e)}}function e_(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function eE(e,t,r){var n,i,o,u;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=e.month(),u=29!==(u=e.date())||1!==o||eg(r)?u:28,i?n.setUTCFullYear(r,o,u):n.setFullYear(r,o,u)}}function eA(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?eg(e)?29:28:31-r%7%2}eL=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),el("M",Q,ea),el("MM",Q,G),el("MMM",function(e,t){return t.monthsShortRegex(e)}),el("MMMM",function(e,t){return t.monthsRegex(e)}),em(["M","MM"],function(e,t){t[1]=ed(e)-1}),em(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:d(r).invalidMonth=e});var eF="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eb=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eC(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)o=h([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(o,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=eL.call(this._shortMonthsParse,u))?i:null;else return -1!==(i=eL.call(this._longMonthsParse,u))?i:null;return"MMM"===t?-1!==(i=eL.call(this._shortMonthsParse,u))||-1!==(i=eL.call(this._longMonthsParse,u))?i:null:-1!==(i=eL.call(this._longMonthsParse,u))||-1!==(i=eL.call(this._shortMonthsParse,u))?i:null}function ex(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=ed(t);else if(!a(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,eA(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function eS(e){return null!=e?(ex(this,e),t.updateOffset(this,!0),this):e_(this,"Month")}function eM(){function e(e,t){return t.length-e.length}var t,r,n,i,o=[],u=[],s=[];for(t=0;t<12;t++)r=h([2e3,t]),n=ef(this.monthsShort(r,"")),i=ef(this.months(r,"")),o.push(n),u.push(i),s.push(i),s.push(n);o.sort(e),u.sort(e),s.sort(e),this._monthsRegex=RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+u.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+o.join("|")+")","i")}function eN(e,t,r,n,i,o,u){var s;return e<100&&e>=0?isFinite((s=new Date(e+400,t,r,n,i,o,u)).getFullYear())&&s.setFullYear(e):s=new Date(e,t,r,n,i,o,u),s}function eO(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eB(e,t,r){var n=7+t-r;return-((7+eO(e,0,n).getUTCDay()-t)%7)+n-1}function eT(e,t,r,n,i){var o,u,s=1+7*(t-1)+(7+r-n)%7+eB(e,n,i);return s<=0?u=ey(o=e-1)+s:s>ey(e)?(o=e+1,u=s-ey(e)):(o=e,u=s),{year:o,dayOfYear:u}}function ek(e,t,r){var n,i,o=eB(e.year(),t,r),u=Math.floor((e.dayOfYear()-o-1)/7)+1;return u<1?n=u+eI(i=e.year()-1,t,r):u>eI(e.year(),t,r)?(n=u-eI(e.year(),t,r),i=e.year()+1):(i=e.year(),n=u),{week:n,year:i}}function eI(e,t,r){var n=eB(e,t,r),i=eB(e+1,t,r);return(ey(e)-n+i)/7}function eR(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),el("w",Q,ea),el("ww",Q,G),el("W",Q,ea),el("WW",Q,G),eD(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=ed(e)}),I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),el("d",Q),el("e",Q),el("E",Q),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),eD(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:d(r).invalidWeekday=e}),eD(["d","e","E"],function(e,t,r,n){t[n]=ed(e)});var eP="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function ej(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=h([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=eL.call(this._weekdaysParse,u))?i:null;else if("ddd"===t)return -1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null;else return -1!==(i=eL.call(this._minWeekdaysParse,u))?i:null;return"dddd"===t?-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:"ddd"===t?-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:-1!==(i=eL.call(this._minWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null}function eY(){function e(e,t){return t.length-e.length}var t,r,n,i,o,u=[],s=[],a=[],c=[];for(t=0;t<7;t++)r=h([2e3,1]).day(t),n=ef(this.weekdaysMin(r,"")),i=ef(this.weekdaysShort(r,"")),o=ef(this.weekdays(r,"")),u.push(n),s.push(i),a.push(o),c.push(n),c.push(i),c.push(o);u.sort(e),s.sort(e),a.sort(e),c.sort(e),this._weekdaysRegex=RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+u.join("|")+")","i")}function eU(){return this.hours()%12||12}function ez(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eV(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,eU),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)}),I("hmmss",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),ez("a",!0),ez("A",!1),el("a",eV),el("A",eV),el("H",Q,ec),el("h",Q,ea),el("k",Q,ea),el("HH",Q,G),el("hh",Q,G),el("kk",Q,G),el("hmm",X),el("hmmss",K),el("Hmm",X),el("Hmmss",K),em(["H","HH"],3),em(["k","kk"],function(e,t,r){var n=ed(e);t[3]=24===n?0:n}),em(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),em(["h","hh"],function(e,t,r){t[3]=ed(e),d(r).bigHour=!0}),em("hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n)),d(r).bigHour=!0}),em("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i)),d(r).bigHour=!0}),em("Hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n))}),em("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i))});var eL,eH,eq=ew("Hours",!0),eW={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eF,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eP,meridiemParse:/[ap]\.?m?\.?/i},eG={},eZ={};function e$(e){return e?e.toLowerCase().replace("_","-"):e}function eJ(t){var n=null;if(void 0===eG[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eH._abbr,r(118)("./locale/"+t),eQ(n)}catch(e){eG[t]=null}return eG[t]}function eQ(e,t){var r;return e&&((r=s(t)?eK(e):eX(e,t))?eH=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eH._abbr}function eX(e,t){if(null===t)return delete eG[e],null;var r,n=eW;if(t.abbr=e,null!=eG[e])C("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eG[e]._config;else if(null!=t.parentLocale)if(null!=eG[t.parentLocale])n=eG[t.parentLocale]._config;else{if(null==(r=eJ(t.parentLocale)))return eZ[t.parentLocale]||(eZ[t.parentLocale]=[]),eZ[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eG[e]=new M(S(n,t)),eZ[e]&&eZ[e].forEach(function(e){eX(e.name,e.config)}),eQ(e),eG[e]}function eK(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eH;if(!n(e)){if(t=eJ(e))return t;e=[e]}return function(e){for(var t,r,n,i,o=0;o<e.length;){for(t=(i=e$(e[o]).split("-")).length,r=(r=e$(e[o+1]))?r.split("-"):null;t>0;){if(n=eJ(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}o++}return eH}(e)}function e0(e){var t,r=e._a;return r&&-2===d(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>eA(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,d(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),d(e)._overflowWeeks&&-1===t&&(t=7),d(e)._overflowWeekday&&-1===t&&(t=8),d(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e3=/Z|[+-]\d\d(?::?\d\d)?/,e8=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e4=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e5=/^\/?Date\((-?\d+)/i,e6=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,o,u,s=e._i,a=e1.exec(s)||e2.exec(s),c=e8.length,l=e4.length;if(a){for(d(e).iso=!0,t=0,r=c;t<r;t++)if(e8[t][1].exec(a[1])){i=e8[t][0],n=!1!==e8[t][2];break}if(null==i){e._isValid=!1;return}if(a[3]){for(t=0,r=l;t<r;t++)if(e4[t][1].exec(a[3])){o=(a[2]||" ")+e4[t][0];break}if(null==o){e._isValid=!1;return}}if(!n&&null!=o){e._isValid=!1;return}if(a[4])if(e3.exec(a[4]))u="Z";else{e._isValid=!1;return}e._f=i+(o||"")+(u||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,o,u,s,a,c,l,f,h=e6.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(h){if(o=h[4],u=h[3],s=h[2],a=h[5],c=h[6],l=h[7],f=[(t=parseInt(o,10))<=49?2e3+t:t<=999?1900+t:t,eF.indexOf(u),parseInt(s,10),parseInt(a,10),parseInt(c,10)],l&&f.push(parseInt(l,10)),r=h[1],n=f,i=e,r&&eP.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(d(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=f,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(h[8],h[9],h[10]),e._d=eO.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),d(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,o,u,s,a,c,l,f,h,p,m,D,g,y,v=[];if(!e._d){for(h=new Date(t.now()),D=e._useUTC?[h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()]:[h.getFullYear(),h.getMonth(),h.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(s=1,a=4,i=tt(n.GG,r._a[0],ek(tu(),1,4).year),o=tt(n.W,1),((u=tt(n.E,1))<1||u>7)&&(l=!0)):(s=r._locale._week.dow,a=r._locale._week.doy,f=ek(tu(),s,a),i=tt(n.gg,r._a[0],f.year),o=tt(n.w,f.week),null!=n.d?((u=n.d)<0||u>6)&&(l=!0):null!=n.e?(u=n.e+s,(n.e<0||n.e>6)&&(l=!0)):u=s),o<1||o>eI(i,s,a)?d(r)._overflowWeeks=!0:null!=l?d(r)._overflowWeekday=!0:(c=eT(i,o,u,s,a),r._a[0]=c.year,r._dayOfYear=c.dayOfYear)),null!=e._dayOfYear&&(y=tt(e._a[0],D[0]),(e._dayOfYear>ey(y)||0===e._dayOfYear)&&(d(e)._overflowDayOfYear=!0),m=eO(y,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=v[p]=D[p];for(;p<7;p++)e._a[p]=v[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eO:eN).apply(null,v),g=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==g&&(d(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],d(e).empty=!0;var r,n,i,u,s,a,c,l,f,h,p,m=""+e._i,D=m.length,g=0;for(p=(c=P(e._f,e._locale).match(O)||[]).length,s=0;s<p;s++)if(l=c[s],(a=(m.match(!o(L,l)?new RegExp(ef(l.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):L[l](e._strict,e._locale))||[])[0])&&((f=m.substr(0,m.indexOf(a))).length>0&&d(e).unusedInput.push(f),m=m.slice(m.indexOf(a)+a.length),g+=a.length),k[l])a?d(e).empty=!1:d(e).unusedTokens.push(l),null!=a&&o(ep,l)&&ep[l](a,e._a,e,l);else e._strict&&!a&&d(e).unusedTokens.push(l);d(e).charsLeftOver=D-g,m.length>0&&d(e).unusedInput.push(m),e._a[3]<=12&&!0===d(e).bigHour&&e._a[3]>0&&(d(e).bigHour=void 0),d(e).parsedDateParts=e._a.slice(0),d(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((u=r.isPM(i))&&n<12&&(n+=12),u||12!==n||(n=0)),n)),null!==(h=d(e).era)&&(e._a[0]=e._locale.erasConvertYear(h,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,o=e._f;return(e._locale=e._locale||eK(e._l),null===r||void 0===o&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),E(r))?new _(e0(r)):(c(r)?e._d=r:n(o)?!function(e){var t,r,n,i,o,u,s=!1,a=e._f.length;if(0===a){d(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<a;i++)o=0,u=!1,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(u=!0),o+=d(t).charsLeftOver,o+=10*d(t).unusedTokens.length,d(t).score=o,s?o<n&&(n=o,r=t):(null==n||o<n||u)&&(n=o,r=t,u&&(s=!0));f(e,r||t)}(e):o?tn(e):function(e){var r=e._i;if(s(r))e._d=new Date(t.now());else if(c(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e5.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=l(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var o=U(e._i),u=void 0===o.day?o.date:o.day;e._a=l([o.year,o.month,u,o.hour,o.minute,o.second,o.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else a(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function to(e,t,r,o,s){var a,c={};return(!0===t||!1===t)&&(o=t,t=void 0),(!0===r||!1===r)&&(o=r,r=void 0),(i(e)&&u(e)||n(e)&&0===e.length)&&(e=void 0),c._isAMomentObject=!0,c._useUTC=c._isUTC=s,c._l=r,c._i=e,c._f=t,c._strict=o,(a=new _(e0(ti(c))))._nextDay&&(a.add(1,"d"),a._nextDay=void 0),a}function tu(e,t,r,n){return to(e,t,r,n,!1)}t.createFromInputFallback=F("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ts=F("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),ta=F("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()});function tc(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tu();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tl=["year","quarter","month","week","day","hour","minute","second","millisecond"];function tf(e){var t=U(e),r=t.year||0,n=t.quarter||0,i=t.month||0,u=t.week||t.isoWeek||0,s=t.day||0,a=t.hour||0,c=t.minute||0,l=t.second||0,f=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tl.length;for(t in e)if(o(e,t)&&!(-1!==eL.call(tl,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tl[r]]){if(n)return!1;parseFloat(e[tl[r]])!==ed(e[tl[r]])&&(n=!0)}return!0}(t),this._milliseconds=+f+1e3*l+6e4*c+1e3*a*3600,this._days=+s+7*u,this._months=+i+3*n+12*r,this._data={},this._locale=eK(),this._bubble()}function th(e){return e instanceof tf}function td(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){I(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+N(~~(e/60),2)+t+N(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),el("Z",eu),el("ZZ",eu),em(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tD(eu,e)});var tm=/([\+\-]|\d\d)/gi;function tD(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tm)||["-",0,0])[1])+ed(r[2]))?0:"+"===r[0]?n:-n}function tg(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(E(e)||c(e)?e.valueOf():tu(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):tu(e).local()}function ty(e){return-Math.round(e._d.getTimezoneOffset())}function tv(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tw=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,t_=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function tE(e,t){var r,n,i,u,s,c,l=e,f=null;return th(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:a(e)||!isNaN(+e)?(l={},t?l[t]=+e:l.milliseconds=+e):(f=tw.exec(e))?(u="-"===f[1]?-1:1,l={y:0,d:ed(f[2])*u,h:ed(f[3])*u,m:ed(f[4])*u,s:ed(f[5])*u,ms:ed(td(1e3*f[6]))*u}):(f=t_.exec(e))?(u="-"===f[1]?-1:1,l={y:tA(f[2],u),M:tA(f[3],u),w:tA(f[4],u),d:tA(f[5],u),h:tA(f[6],u),m:tA(f[7],u),s:tA(f[8],u)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=tu(l.from),n=tu(l.to),c=r.isValid()&&n.isValid()?(n=tg(n,r),r.isBefore(n)?i=tF(r,n):((i=tF(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(l={}).ms=c.milliseconds,l.M=c.months),s=new tf(l),th(e)&&o(e,"_locale")&&(s._locale=e._locale),th(e)&&o(e,"_isValid")&&(s._isValid=e._isValid),s}function tA(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function tF(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tb(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(C(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tC(this,tE(r,n),e),this}}function tC(e,r,n,i){var o=r._milliseconds,u=td(r._days),s=td(r._months);e.isValid()&&(i=null==i||i,s&&ex(e,e_(e,"Month")+s*n),u&&eE(e,"Date",e_(e,"Date")+u*n),o&&e._d.setTime(e._d.valueOf()+o*n),i&&t.updateOffset(e,u||s))}tE.fn=tf.prototype,tE.invalid=function(){return tE(NaN)};var tx=tb(1,"add"),tS=tb(-1,"subtract");function tM(e){return"string"==typeof e||e instanceof String}function tN(e,t){if(e.date()<t.date())return-tN(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tO(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eK(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tB=F("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tT(){return this._locale}function tk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tI(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tR(e,t){return t.erasAbbrRegex(e)}function tP(){var e,t,r,n,i,o=[],u=[],s=[],a=[],c=this.eras();for(e=0,t=c.length;e<t;++e)r=ef(c[e].name),n=ef(c[e].abbr),i=ef(c[e].narrow),u.push(r),o.push(n),s.push(i),a.push(r),a.push(n),a.push(i);this._erasRegex=RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=RegExp("^("+u.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+s.join("|")+")","i")}function tj(e,t){I(0,[e,e.length],0,t)}function tY(e,t,r,n,i){var o;return null==e?ek(this,n,i).year:(t>(o=eI(e,n,i))&&(t=o),tU.call(this,e,t,r,n,i))}function tU(e,t,r,n,i){var o=eT(e,t,r,n,i),u=eO(o.year,0,o.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}I("N",0,0,"eraAbbr"),I("NN",0,0,"eraAbbr"),I("NNN",0,0,"eraAbbr"),I("NNNN",0,0,"eraName"),I("NNNNN",0,0,"eraNarrow"),I("y",["y",1],"yo","eraYear"),I("y",["yy",2],0,"eraYear"),I("y",["yyy",3],0,"eraYear"),I("y",["yyyy",4],0,"eraYear"),el("N",tR),el("NN",tR),el("NNN",tR),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?d(r).era=i:d(r).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tj("gggg","weekYear"),tj("ggggg","weekYear"),tj("GGGG","isoWeekYear"),tj("GGGGG","isoWeekYear"),el("G",ei),el("g",ei),el("GG",Q,G),el("gg",Q,G),el("GGGG",et,$),el("gggg",et,$),el("GGGGG",er,J),el("ggggg",er,J),eD(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=ed(e)}),eD(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),el("Q",W),em("Q",function(e,t){t[1]=(ed(e)-1)*3}),I("D",["DD",2],"Do","date"),el("D",Q,ea),el("DD",Q,G),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ed(e.match(Q)[0])});var tz=ew("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",ee),el("DDDD",Z),em(["DDD","DDDD"],function(e,t,r){r._dayOfYear=ed(e)}),I("m",["mm",2],0,"minute"),el("m",Q,ec),el("mm",Q,G),em(["m","mm"],4);var tV=ew("Minutes",!1);I("s",["ss",2],0,"second"),el("s",Q,ec),el("ss",Q,G),em(["s","ss"],5);var tL=ew("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",ee,W),el("SS",ee,G),el("SSS",ee,Z),D="SSSS";D.length<=9;D+="S")el(D,en);function tH(e,t){t[6]=ed(("0."+e)*1e3)}for(D="S";D.length<=9;D+="S")em(D,tH);g=ew("Milliseconds",!1),I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var tq=_.prototype;function tW(e){return e}tq.add=tx,tq.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var s,l,f,h;if(s=arguments[0],E(s)||c(s)||tM(s)||a(s)||(f=n(l=s),h=!1,f&&(h=0===l.filter(function(e){return!a(e)&&tM(l)}).length),f&&h)||function(e){var t,r,n=i(e)&&!u(e),s=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=a.length;for(t=0;t<c;t+=1)r=a[t],s=s||o(e,r);return n&&s}(s)||null==s)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!u(e),s=!1,a=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<a.length;t+=1)r=a[t],s=s||o(e,r);return n&&s})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var d=e||tu(),p=tg(d,this).startOf("day"),m=t.calendarFormat(this,p)||"sameElse",D=r&&(x(r[m])?r[m].call(this,d):r[m]);return this.format(D||this.localeData().calendar(m,this,tu(d)))},tq.clone=function(){return new _(this)},tq.diff=function(e,t,r){var n,i,o;if(!this.isValid()||!(n=tg(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Y(t)){case"year":o=tN(this,n)/12;break;case"month":o=tN(this,n);break;case"quarter":o=tN(this,n)/3;break;case"second":o=(this-n)/1e3;break;case"minute":o=(this-n)/6e4;break;case"hour":o=(this-n)/36e5;break;case"day":o=(this-n-i)/864e5;break;case"week":o=(this-n-i)/6048e5;break;default:o=this-n}return r?o:eh(o)},tq.endOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tq.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=R(this,e);return this.localeData().postformat(r)},tq.from=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||tu(e).isValid())?tE({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tq.fromNow=function(e){return this.from(tu(),e)},tq.to=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||tu(e).isValid())?tE({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tq.toNow=function(e){return this.to(tu(),e)},tq.get=function(e){return x(this[e=Y(e)])?this[e]():this},tq.invalidAt=function(){return d(this).overflow},tq.isAfter=function(e,t){var r=E(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tq.isBefore=function(e,t){var r=E(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tq.isBetween=function(e,t,r,n){var i=E(e)?e:tu(e),o=E(t)?t:tu(t);return!!(this.isValid()&&i.isValid()&&o.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(o,r):!this.isAfter(o,r))},tq.isSame=function(e,t){var r,n=E(e)?e:tu(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tq.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tq.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tq.isValid=function(){return p(this)},tq.lang=tB,tq.locale=tO,tq.localeData=tT,tq.max=ta,tq.min=ts,tq.parsingFlags=function(){return f({},d(this))},tq.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)o(e,t)&&r.push({unit:t,priority:H[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=U(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(x(this[e=Y(e)]))return this[e](t);return this},tq.startOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tq.subtract=tS,tq.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tq.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tq.toDate=function(){return new Date(this.valueOf())},tq.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return R(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(x(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",R(r,"Z"));return R(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tq.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tq[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tq.toJSON=function(){return this.isValid()?this.toISOString():null},tq.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tq.unix=function(){return Math.floor(this.valueOf()/1e3)},tq.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tq.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tq.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tq.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tq.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tq.eraYear=function(){var e,r,n,i,o=this.localeData().eras();for(e=0,r=o.length;e<r;++e)if(n=o[e].since<=o[e].until?1:-1,i=this.clone().startOf("day").valueOf(),o[e].since<=i&&i<=o[e].until||o[e].until<=i&&i<=o[e].since)return(this.year()-t(o[e].since).year())*n+o[e].offset;return this.year()},tq.year=ev,tq.isLeapYear=function(){return eg(this.year())},tq.weekYear=function(e){return tY.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tq.isoWeekYear=function(e){return tY.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tq.quarter=tq.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tq.month=eS,tq.daysInMonth=function(){return eA(this.year(),this.month())},tq.week=tq.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tq.isoWeek=tq.isoWeeks=function(e){var t=ek(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tq.weeksInYear=function(){var e=this.localeData()._week;return eI(this.year(),e.dow,e.doy)},tq.weeksInWeekYear=function(){var e=this.localeData()._week;return eI(this.weekYear(),e.dow,e.doy)},tq.isoWeeksInYear=function(){return eI(this.year(),1,4)},tq.isoWeeksInISOWeekYear=function(){return eI(this.isoWeekYear(),1,4)},tq.date=tz,tq.day=tq.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=e_(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tq.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tq.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tq.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tq.hour=tq.hours=eq,tq.minute=tq.minutes=tV,tq.second=tq.seconds=tL,tq.millisecond=tq.milliseconds=g,tq.utcOffset=function(e,r,n){var i,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?o:ty(this);if("string"==typeof e){if(null===(e=tD(eu,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=ty(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==e&&(!r||this._changeInProgress?tC(this,tE(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tq.utc=function(e){return this.utcOffset(0,e)},tq.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(ty(this),"m")),this},tq.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tD(eo,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tq.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tu(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tq.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tq.isLocal=function(){return!!this.isValid()&&!this._isUTC},tq.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tq.isUtc=tv,tq.isUTC=tv,tq.zoneAbbr=function(){return this._isUTC?"UTC":""},tq.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tq.dates=F("dates accessor is deprecated. Use date instead.",tz),tq.months=F("months accessor is deprecated. Use month instead",eS),tq.years=F("years accessor is deprecated. Use year instead",ev),tq.zone=F("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tq.isDSTShifted=F("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=ti(t))._a?(e=t._isUTC?h(t._a):tu(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),o=0;for(r=0;r<n;r++)ed(e[r])!==ed(t[r])&&o++;return o+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tG=M.prototype;function tZ(e,t,r,n){var i=eK(),o=h().set(n,t);return i[r](o,e)}function t$(e,t,r){if(a(e)&&(t=e,e=void 0),e=e||"",null!=t)return tZ(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tZ(e,n,r,"month");return i}function tJ(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),a(t)&&(r=t,t=void 0),t=t||"";var i,o=eK(),u=e?o._week.dow:0,s=[];if(null!=r)return tZ(t,(r+u)%7,n,"day");for(i=0;i<7;i++)s[i]=tZ(t,(i+u)%7,n,"day");return s}tG.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return x(n)?n.call(t,r):n},tG.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(O).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tG.invalidDate=function(){return this._invalidDate},tG.ordinal=function(e){return this._ordinal.replace("%d",e)},tG.preparse=tW,tG.postformat=tW,tG.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return x(i)?i(e,t,r,n):i.replace(/%d/i,e)},tG.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return x(r)?r(t):r.replace(/%s/i,t)},tG.set=function(e){var t,r;for(r in e)o(e,r)&&(x(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tG.eras=function(e,r){var n,i,o,u=this._eras||eK("en")._eras;for(n=0,i=u.length;n<i;++n)switch("string"==typeof u[n].since&&(o=t(u[n].since).startOf("day"),u[n].since=o.valueOf()),typeof u[n].until){case"undefined":u[n].until=Infinity;break;case"string":o=t(u[n].until).startOf("day").valueOf(),u[n].until=o.valueOf()}return u},tG.erasParse=function(e,t,r){var n,i,o,u,s,a=this.eras();for(e=e.toUpperCase(),n=0,i=a.length;n<i;++n)if(o=a[n].name.toUpperCase(),u=a[n].abbr.toUpperCase(),s=a[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(u===e)return a[n];break;case"NNNN":if(o===e)return a[n];break;case"NNNNN":if(s===e)return a[n]}else if([o,u,s].indexOf(e)>=0)return a[n]},tG.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tG.erasAbbrRegex=function(e){return o(this,"_erasAbbrRegex")||tP.call(this),e?this._erasAbbrRegex:this._erasRegex},tG.erasNameRegex=function(e){return o(this,"_erasNameRegex")||tP.call(this),e?this._erasNameRegex:this._erasRegex},tG.erasNarrowRegex=function(e){return o(this,"_erasNarrowRegex")||tP.call(this),e?this._erasNarrowRegex:this._erasRegex},tG.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eb).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tG.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eb.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tG.monthsParse=function(e,t,r){var n,i,o;if(this._monthsParseExact)return eC.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=h([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(o.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tG.monthsRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(o(this,"_monthsRegex")||(this._monthsRegex=es),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tG.monthsShortRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(o(this,"_monthsShortRegex")||(this._monthsShortRegex=es),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tG.week=function(e){return ek(e,this._week.dow,this._week.doy).week},tG.firstDayOfYear=function(){return this._week.doy},tG.firstDayOfWeek=function(){return this._week.dow},tG.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eR(r,this._week.dow):e?r[e.day()]:r},tG.weekdaysMin=function(e){return!0===e?eR(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tG.weekdaysShort=function(e){return!0===e?eR(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tG.weekdaysParse=function(e,t,r){var n,i,o;if(this._weekdaysParseExact)return ej.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=h([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(o.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tG.weekdaysRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(o(this,"_weekdaysRegex")||(this._weekdaysRegex=es),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tG.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=es),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tG.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=es),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tG.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tG.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eQ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===ed(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=F("moment.lang is deprecated. Use moment.locale instead.",eQ),t.langData=F("moment.langData is deprecated. Use moment.localeData instead.",eK);var tQ=Math.abs;function tX(e,t,r,n){var i=tE(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tK(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t3=t2("ms"),t8=t2("s"),t4=t2("m"),t5=t2("h"),t6=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ro=rr("minutes"),ru=rr("hours"),rs=rr("days"),ra=rr("months"),rc=rr("years"),rl=Math.round,rf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rh(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rd=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,o,u,s,a=rd(this._milliseconds)/1e3,c=rd(this._days),l=rd(this._months),f=this.asSeconds();return f?(e=eh(a/60),t=eh(e/60),a%=60,e%=60,r=eh(l/12),l%=12,n=a?a.toFixed(3).replace(/\.?0+$/,""):"",i=f<0?"-":"",o=rp(this._months)!==rp(f)?"-":"",u=rp(this._days)!==rp(f)?"-":"",s=rp(this._milliseconds)!==rp(f)?"-":"",i+"P"+(r?o+r+"Y":"")+(l?o+l+"M":"")+(c?u+c+"D":"")+(t||e||a?"T":"")+(t?s+t+"H":"")+(e?s+e+"M":"")+(a?s+n+"S":"")):"P0D"}var rD=tf.prototype;return rD.isValid=function(){return this._isValid},rD.abs=function(){var e=this._data;return this._milliseconds=tQ(this._milliseconds),this._days=tQ(this._days),this._months=tQ(this._months),e.milliseconds=tQ(e.milliseconds),e.seconds=tQ(e.seconds),e.minutes=tQ(e.minutes),e.hours=tQ(e.hours),e.months=tQ(e.months),e.years=tQ(e.years),this},rD.add=function(e,t){return tX(this,e,t,1)},rD.subtract=function(e,t){return tX(this,e,t,-1)},rD.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=Y(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rD.asMilliseconds=t3,rD.asSeconds=t8,rD.asMinutes=t4,rD.asHours=t5,rD.asDays=t6,rD.asWeeks=t7,rD.asMonths=t9,rD.asQuarters=re,rD.asYears=rt,rD.valueOf=t3,rD._bubble=function(){var e,t,r,n,i,o=this._milliseconds,u=this._days,s=this._months,a=this._data;return o>=0&&u>=0&&s>=0||o<=0&&u<=0&&s<=0||(o+=864e5*tK(t1(s)+u),u=0,s=0),a.milliseconds=o%1e3,a.seconds=(e=eh(o/1e3))%60,a.minutes=(t=eh(e/60))%60,a.hours=(r=eh(t/60))%24,u+=eh(r/24),s+=i=eh(t0(u)),u-=tK(t1(i)),n=eh(s/12),s%=12,a.days=u,a.months=s,a.years=n,this},rD.clone=function(){return tE(this)},rD.get=function(e){return e=Y(e),this.isValid()?this[e+"s"]():NaN},rD.milliseconds=rn,rD.seconds=ri,rD.minutes=ro,rD.hours=ru,rD.days=rs,rD.weeks=function(){return eh(this.days()/7)},rD.months=ra,rD.years=rc,rD.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,o,u,s,a,c,l,f,h,d,p,m=!1,D=rf;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(m=e),"object"==typeof t&&(D=Object.assign({},rf,t),null!=t.s&&null==t.ss&&(D.ss=t.s-1)),d=this.localeData(),r=!m,n=D,i=tE(this).abs(),o=rl(i.as("s")),u=rl(i.as("m")),s=rl(i.as("h")),a=rl(i.as("d")),c=rl(i.as("M")),l=rl(i.as("w")),f=rl(i.as("y")),h=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||u<=1&&["m"]||u<n.m&&["mm",u]||s<=1&&["h"]||s<n.h&&["hh",s]||a<=1&&["d"]||a<n.d&&["dd",a],null!=n.w&&(h=h||l<=1&&["w"]||l<n.w&&["ww",l]),(h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f])[2]=r,h[3]=+this>0,h[4]=d,p=rh.apply(null,h),m&&(p=d.pastFuture(+this,p)),d.postformat(p)},rD.toISOString=rm,rD.toString=rm,rD.toJSON=rm,rD.locale=tO,rD.localeData=tT,rD.toIsoString=F("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rm),rD.lang=tB,I("X",0,0,"unix"),I("x",0,0,"valueOf"),el("x",ei),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,r){r._d=new Date(ed(e))}),t.version="2.30.1",z=tu,t.fn=tq,t.min=function(){var e=[].slice.call(arguments,0);return tc("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tc("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=h,t.unix=function(e){return tu(1e3*e)},t.months=function(e,t){return t$(e,t,"months")},t.isDate=c,t.locale=eQ,t.invalid=m,t.duration=tE,t.isMoment=E,t.weekdays=function(e,t,r){return tJ(e,t,r,"weekdays")},t.parseZone=function(){return tu.apply(null,arguments).parseZone()},t.localeData=eK,t.isDuration=th,t.monthsShort=function(e,t){return t$(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tJ(e,t,r,"weekdaysMin")},t.defineLocale=eX,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eW;null!=eG[e]&&null!=eG[e].parentLocale?eG[e].set(S(eG[e]._config,t)):(null!=(n=eJ(e))&&(i=n._config),t=S(i,t),null==n&&(t.abbr=e),(r=new M(t)).parentLocale=eG[e],eG[e]=r),eQ(e)}else null!=eG[e]&&(null!=eG[e].parentLocale?(eG[e]=eG[e].parentLocale,e===eQ()&&eQ(e)):null!=eG[e]&&delete eG[e]);return eG[e]},t.locales=function(){return q(eG)},t.weekdaysShort=function(e,t,r){return tJ(e,t,r,"weekdaysShort")},t.normalizeUnits=Y,t.relativeTimeRounding=function(e){return void 0===e?rl:"function"==typeof e&&(rl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rf[e]&&(void 0===t?rf[e]:(rf[e]=t,"s"===e&&(rf.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tq,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},76(e,t,r){"use strict";var n=r(326).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;t.c=function(e){return n.H.useMemoCache(e)}},60(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:i,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},391(e,t){"use strict";var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=(Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.consumer")),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),a=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),l=(Symbol.for("react.activity"),Symbol.iterator),f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,d={};function p(e,t,r){this.props=e,this.context=t,this.refs=d,this.updater=r||f}function m(){}function D(e,t,r){this.props=e,this.context=t,this.refs=d,this.updater=r||f}p.prototype.isReactComponent={},p.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},m.prototype=p.prototype;var g=D.prototype=new m;g.constructor=D,h(g,p.prototype),g.isPureReactComponent=!0;var y={H:null,A:null,T:null,S:null},v=Object.prototype.hasOwnProperty;function w(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function _(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}"function"==typeof reportError&&reportError,t.Suspense=s,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,t.createContext=function(e){return(e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:i,_context:e},e},t.createElement=function(e,t,r){var n,i={},o=null;if(null!=t)for(n in void 0!==t.key&&(o=""+t.key),t)v.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var u=arguments.length-2;if(1===u)i.children=r;else if(1<u){for(var s=Array(u),a=0;a<u;a++)s[a]=arguments[a+2];i.children=s}if(e&&e.defaultProps)for(n in u=e.defaultProps)void 0===i[n]&&(i[n]=u[n]);return w(e,o,i)},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:_}},t.memo=function(e,t){return{$$typeof:a,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return y.H.useCallback(e,t)},t.useContext=function(e){return y.H.useContext(e)},t.useEffect=function(e,t){return y.H.useEffect(e,t)},t.useMemo=function(e,t){return y.H.useMemo(e,t)},t.useRef=function(e){return y.H.useRef(e)},t.useState=function(e){return y.H.useState(e)}},184(e,t,r){"use strict";e.exports=r(76)},326(e,t,r){"use strict";e.exports=r(391)},870(e,t,r){"use strict";e.exports=r(60)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},557(t){"use strict";t.exports=e},2(e){"use strict";e.exports=n},438(e){"use strict";e.exports=o},545(e){"use strict";e.exports=t},55(e){"use strict";e.exports=i},111(e){"use strict";e.exports=r},530(e){!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var e="",i=0;i<arguments.length;i++){var o=arguments[i];o&&(e=n(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var o in e)t.call(e,o)&&e[o]&&(i=n(i,o));return i}(o)))}return e}function n(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return r}):window.classNames=r}()}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return u[e].call(r.exports,r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var c={};return(()=>{"use strict";a.r(c),a.d(c,{default:()=>iY});var e=a(184);let t=JSON.parse('{"UU":"@ohif/extension-dicom-microscopy"}').UU;var r=a(326),n=a(55),i=a(438),o=a(2),u=a.n(o);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=s(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}a(741),Object.create(null);var f=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,h={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},d=function(e){return h[e]},p={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(f,d)}},m=(0,r.createContext)(),D=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,u,s=[],a=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}var _={};function E(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&_[t[0]]||("string"==typeof t[0]&&(_[t[0]]=new Date),w.apply(void 0,t))}var A=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function F(e,t,r){e.loadNamespaces(t,A(e,r))}function b(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,A(e,n))}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){v(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var S=function(e,t){var n=(0,r.useRef)();return(0,r.useEffect)(function(){n.current=t?n.current:e},[e,t]),n.current},M=["forwardedRef"];function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach(function(t){v(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function B(){return(B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}var T={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},k=function(e){if(e)throw 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(T)};B(k,T,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var I,R,P,j="0123456789abcdef",Y="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",U="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",z={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},V=!0,L="[DecimalError] ",H=L+"Invalid argument: ",q=L+"Precision limit exceeded",W=L+"crypto unavailable",G="[object Decimal]",Z=Math.floor,$=Math.pow,J=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Q=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,X=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,K=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ee=Y.length-1,et=U.length-1,er={toStringTag:G};function en(e){var t,r,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=ep(r)),o+=n;(r=7-(n=(u=e[t])+"").length)&&(o+=ep(r))}else if(0===u)return"0";for(;u%10==0;)u/=10;return o+u}function ei(e,t,r){if(e!==~~e||e<t||e>r)throw Error(H+e)}function eo(e,t,r,n){var i,o,u,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=$(10,7-t),s=e[i]%o|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),u=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):u=(r<4&&s+1==o||r>3&&s+1==o/2)&&(e[i+1]/o/100|0)==$(10,t-2)-1||(s==o/2||0==s)&&(e[i+1]/o/100|0)==0:t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),u=(n||r<4)&&9999==s||!n&&r>3&&4999==s):u=((n||r<4)&&s+1==o||!n&&r>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==$(10,t-3)-1,u}function eu(e,t,r){for(var n,i,o=[0],u=0,s=e.length;u<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=j.indexOf(e.charAt(u++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}er.absoluteValue=er.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),ea(e)},er.ceil=function(){return ea(new this.constructor(this),this.e+1,2)},er.clampedTo=er.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(H+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},er.comparedTo=er.cmp=function(e){var t,r,n,i,o=this.d,u=(e=new this.constructor(e)).d,s=this.s,a=e.s;if(!o||!u)return s&&a?s!==a?s:o===u?0:!o^s<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?s:u[0]?-a:0;if(s!==a)return s;if(this.e!==e.e)return this.e>e.e^s<0?1:-1;for(n=o.length,t=0,r=n<(i=u.length)?n:i;t<r;++t)if(o[t]!==u[t])return o[t]>u[t]^s<0?1:-1;return n===i?0:n>i^s<0?1:-1},er.cosine=er.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/eA(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=eE(e,1,t.times(i),new e(1));for(var o=r;o--;){var u=t.times(t);t=u.times(u).minus(u).times(8).plus(1)}return e.precision-=r,t}(n,eF(n,r)),n.precision=e,n.rounding=t,ea(2==P||3==P?r.neg():r,e,t,!0)):new n(1):new n(NaN)},er.cubeRoot=er.cbrt=function(){var e,t,r,n,i,o,u,s,a,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(V=!1,(o=this.s*$(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new l(o.toString()):(r=en(this.d),(o=((e=this.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=$(r,1/3),e=Z((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),u=(e=l.precision)+3;;)if(n=es((c=(a=(s=n).times(s).times(s)).plus(this)).plus(this).times(s),c.plus(a),u+2,1),en(s.d).slice(0,u)===(r=en(n.d)).slice(0,u)){if("9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(ea(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(ea(s,e+1,0),s.times(s).times(s).eq(this))){n=s;break}u+=4,i=1}return V=!0,ea(n,e,l.rounding,t)},er.decimalPlaces=er.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-Z(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},er.dividedBy=er.div=function(e){return es(this,new this.constructor(e))},er.dividedToIntegerBy=er.divToInt=function(e){var t=this.constructor;return ea(es(this,new t(e),0,1,1),t.precision,t.rounding)},er.equals=er.eq=function(e){return 0===this.cmp(e)},er.floor=function(){return ea(new this.constructor(this),this.e+1,3)},er.greaterThan=er.gt=function(e){return this.cmp(e)>0},er.greaterThanOrEqualTo=er.gte=function(e){var t=this.cmp(e);return 1==t||0===t},er.hyperbolicCosine=er.cosh=function(){var e,t,r,n,i,o=this,u=o.constructor,s=new u(1);if(!o.isFinite())return new u(o.s?1/0:NaN);if(o.isZero())return s;r=u.precision,n=u.rounding,u.precision=r+Math.max(o.e,o.sd())+4,u.rounding=1,(i=o.d.length)<32?t=(1/eA(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=eE(u,1,o.times(t),new u(1),!0);for(var a,c=e,l=new u(8);c--;)a=o.times(o),o=s.minus(a.times(l.minus(a.times(l))));return ea(o,u.precision=r,u.rounding=n,!0)},er.hyperbolicSine=er.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=eE(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=eE(o,2,i=i.times(1/eA(5,e)),i,!0);for(var u,s=new o(5),a=new o(16),c=new o(20);e--;)u=i.times(i),i=i.times(s.plus(u.times(a.times(u).plus(c))))}return o.precision=t,o.rounding=r,ea(i,t,r,!0)},er.hyperbolicTangent=er.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,es(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},er.inverseCosine=er.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?eh(t,n,i):new t(0):new t(NaN):e.isZero()?eh(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},er.inverseHyperbolicCosine=er.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,V=!1,r=r.times(r).minus(1).sqrt().plus(r),V=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},er.inverseHyperbolicSine=er.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,V=!1,r=r.times(r).plus(1).sqrt().plus(r),V=!0,n.precision=e,n.rounding=t,r.ln())},er.inverseHyperbolicTangent=er.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?ea(new o(i),e,t,!0):(o.precision=r=n-i.e,i=es(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},er.inverseSine=er.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t)?0===t?((e=eh(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},er.inverseTangent=er.atan=function(){var e,t,r,n,i,o,u,s,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=et)return(u=eh(l,f+4,h).times(.25)).s=c.s,u}else{if(!c.s)return new l(NaN);if(f+4<=et)return(u=eh(l,f+4,h).times(.5)).s=c.s,u}for(l.precision=s=f+10,l.rounding=1,e=r=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(V=!1,t=Math.ceil(s/7),n=1,a=c.times(c),u=new l(c),i=c;-1!==e;)if(i=i.times(a),o=u.minus(i.div(n+=2)),i=i.times(a),void 0!==(u=o.plus(i.div(n+=2))).d[t])for(e=t;u.d[e]===o.d[e]&&e--;);return r&&(u=u.times(2<<r-1)),V=!0,ea(u,l.precision=f,l.rounding=h,!0)},er.isFinite=function(){return!!this.d},er.isInteger=er.isInt=function(){return!!this.d&&Z(this.e/7)>this.d.length-2},er.isNaN=function(){return!this.s},er.isNegative=er.isNeg=function(){return this.s<0},er.isPositive=er.isPos=function(){return this.s>0},er.isZero=function(){return!!this.d&&0===this.d[0]},er.lessThan=er.lt=function(e){return 0>this.cmp(e)},er.lessThanOrEqualTo=er.lte=function(e){return 1>this.cmp(e)},er.logarithm=er.log=function(e){var t,r,n,i,o,u,s,a=this.constructor,c=a.precision,l=a.rounding;if(null==e)e=new a(10),t=!0;else{if(r=(e=new a(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new a(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new a(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(V=!1,eo((s=es(o=ev(this,u=c+5),t?ef(a,u+10):ev(e,u),u,1)).d,n=c,l))do if(u+=10,s=es(o=ev(this,u),t?ef(a,u+10):ev(e,u),u,1),!i){+en(s.d).slice(n+1,n+15)+1==1e14&&(s=ea(s,c+1,0));break}while(eo(s.d,n+=10,l))return V=!0,ea(s,c,l)},er.minus=er.sub=function(e){var t,r,n,i,o,u,s,a,c,l,f,h,d=this.constructor;if(e=new d(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new d(e.d||this.s!==e.s?this:NaN):e=new d(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,h=e.d,s=d.precision,a=d.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new d(3===a?-0:0);e=new d(this)}return V?ea(e,s,a):e}if(r=Z(e.e/7),l=Z(this.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,u=h.length):(t=h,r=l,u=c.length),o>(n=Math.max(Math.ceil(s/7),u)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(u=h.length))&&(u=n),n=0;n<u;n++)if(c[n]!=h[n]){f=c[n]<h[n];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),u=c.length,n=h.length-u;n>0;--n)c[u++]=0;for(n=h.length;n>o;){if(c[--n]<h[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=h[n]}for(;0===c[--u];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=el(c,r),V?ea(e,s,a):e):new d(3===a?-0:0)},er.modulo=er.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(V=!1,9==r.modulo?(t=es(this,e.abs(),0,3,1),t.s*=e.s):t=es(this,e,0,r.modulo,1),t=t.times(e),V=!0,this.minus(t)):ea(new r(this),r.precision,r.rounding):new r(NaN)},er.naturalExponential=er.exp=function(){return ey(this)},er.naturalLogarithm=er.ln=function(){return ev(this)},er.negated=er.neg=function(){var e=new this.constructor(this);return e.s=-e.s,ea(e)},er.plus=er.add=function(e){var t,r,n,i,o,u,s,a,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,s=f.precision,a=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),V?ea(e,s,a):e;if(o=Z(this.e/7),n=Z(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,u=l.length):(r=l,n=o,u=c.length),i>(u=(o=Math.ceil(s/7))>u?o+1:u+1)&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((u=c.length)-(i=l.length)<0&&(i=u,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),u=c.length;0==c[--u];)c.pop();return e.d=c,e.e=el(c,n),V?ea(e,s,a):e},er.precision=er.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(H+e);return this.d?(t=ed(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},er.round=function(){var e=this.constructor;return ea(new e(this),this.e+1,e.rounding)},er.sine=er.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:eE(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=eE(e,2,t=t.times(1/eA(5,r)),t);for(var i,o=new e(5),u=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(u.times(i).minus(s))));return t}(n,eF(n,r)),n.precision=e,n.rounding=t,ea(P>2?r.neg():r,e,t,!0)):new n(NaN)},er.squareRoot=er.sqrt=function(){var e,t,r,n,i,o,u=this.d,s=this.e,a=this.s,c=this.constructor;if(1!==a||!u||!u[0])return new c(!a||a<0&&(!u||u[0])?NaN:u?this:1/0);for(V=!1,0==(a=Math.sqrt(+this))||a==1/0?(((t=en(u)).length+s)%2==0&&(t+="0"),a=Math.sqrt(t),s=Z((s+1)/2)-(s<0||s%2),n=new c(t=a==1/0?"5e"+s:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+s)):n=new c(a.toString()),r=(s=c.precision)+3;;)if(n=(o=n).plus(es(this,o,r+2,1)).times(.5),en(o.d).slice(0,r)===(t=en(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(ea(n,s+1,1),e=!n.times(n).eq(this));break}if(!i&&(ea(o,s+1,0),o.times(o).eq(this))){n=o;break}r+=4,i=1}return V=!0,ea(n,s,c.rounding,e)},er.tangent=er.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=es(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,ea(2==P||4==P?r.neg():r,e,t,!0)):new n(NaN)},er.times=er.mul=function(e){var t,r,n,i,o,u,s,a,c,l=this.constructor,f=this.d,h=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!h||!h[0])return new l(!e.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?e.s/0:0*e.s);for(r=Z(this.e/7)+Z(e.e/7),(a=f.length)<(c=h.length)&&(o=f,f=h,h=o,u=a,a=c,c=u),o=[],n=u=a+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=a+n;i>n;)s=o[i]+h[n]*f[i-n-1]+t,o[i--]=s%1e7|0,t=s/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--u];)o.pop();return t?++r:o.shift(),e.d=o,e.e=el(o,r),V?ea(e,l.precision,l.rounding):e},er.toBinary=function(e,t){return eb(this,2,e,t)},er.toDecimalPlaces=er.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(ei(e,0,1e9),void 0===t?t=n.rounding:ei(t,0,8),ea(r,e+r.e+1,t))},er.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=ec(n,!0):(ei(e,0,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},er.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=ec(this):(ei(e,0,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},er.toFraction=function(e){var t,r,n,i,o,u,s,a,c,l,f,h,d=this.d,p=this.constructor;if(!d)return new p(this);if(c=r=new p(1),n=a=new p(0),u=(o=(t=new p(n)).e=ed(d)-this.e-1)%7,t.d[0]=$(10,u<0?7+u:u),null==e)e=o>0?t:c;else{if(!(s=new p(e)).isInt()||s.lt(c))throw Error(H+s);e=s.gt(t)?o>0?t:c:s}for(V=!1,s=new p(en(d)),l=p.precision,p.precision=o=7*d.length*2;f=es(s,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=s.minus(f.times(i)),s=i;return i=es(e.minus(r),n,0,1,1),a=a.plus(i.times(c)),r=r.plus(i.times(n)),a.s=c.s=this.s,h=1>es(c,n,o,1).minus(this).abs().cmp(es(a,r,o,1).minus(this).abs())?[c,n]:[a,r],p.precision=l,V=!0,h},er.toHexadecimal=er.toHex=function(e,t){return eb(this,16,e,t)},er.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:ei(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(V=!1,r=es(r,e,0,t,1).times(e),V=!0,ea(r)):(e.s=r.s,r=e),r},er.toNumber=function(){return+this},er.toOctal=function(e,t){return eb(this,8,e,t)},er.toPower=er.pow=function(e){var t,r,n,i,o,u,s=this,a=s.constructor,c=+(e=new a(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new a($(+s,c));if((s=new a(s)).eq(1))return s;if(n=a.precision,o=a.rounding,e.eq(1))return ea(s,n,o);if((t=Z(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=em(a,s,r,n),e.s<0?new a(1).div(i):ea(i,n,o);if((u=s.s)<0){if(t<e.d.length-1)return new a(NaN);if((1&e.d[t])==0&&(u=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=u,s}return(t=0!=(r=$(+s,c))&&isFinite(r)?new a(r+"").e:Z(c*(Math.log("0."+en(s.d))/Math.LN10+s.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?u/0:0):(V=!1,a.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=ey(e.times(ev(s,n+r)),n)).d&&eo((i=ea(i,n+5,1)).d,n,o)&&(t=n+10,+en((i=ea(ey(e.times(ev(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=ea(i,n+1,0))),i.s=u,V=!0,a.rounding=o,ea(i,n,o))},er.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=ec(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(ei(e,1,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},er.toSignificantDigits=er.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(ei(e,1,1e9),void 0===t?t=r.rounding:ei(t,0,8)),ea(new r(this),e,t)},er.toString=function(){var e=this.constructor,t=ec(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},er.truncated=er.trunc=function(){return ea(new this.constructor(this),this.e+1,1)},er.valueOf=er.toJSON=function(){var e=this.constructor,t=ec(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var es=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u,s,a){var c,l,f,h,d,p,m,D,g,y,v,w,_,E,A,F,b,C,x,S,M=n.constructor,N=n.s==i.s?1:-1,O=n.d,B=i.d;if(!O||!O[0]||!B||!B[0])return new M(!n.s||!i.s||(O?B&&O[0]==B[0]:!B)?NaN:O&&0==O[0]||!B?0*N:N/0);for(a?(d=1,l=n.e-i.e):(a=1e7,d=7,l=Z(n.e/d)-Z(i.e/d)),x=B.length,b=O.length,y=(g=new M(N)).d=[],f=0;B[f]==(O[f]||0);f++);if(B[f]>(O[f]||0)&&l--,null==o?(E=o=M.precision,u=M.rounding):E=s?o+(n.e-i.e)+1:o,E<0)y.push(1),p=!0;else{if(E=E/d+2|0,f=0,1==x){for(h=0,B=B[0],E++;(f<b||h)&&E--;f++)A=h*a+(O[f]||0),y[f]=A/B|0,h=A%B|0;p=h||f<b}else{for((h=a/(B[0]+1)|0)>1&&(B=e(B,h,a),O=e(O,h,a),x=B.length,b=O.length),F=x,w=(v=O.slice(0,x)).length;w<x;)v[w++]=0;(S=B.slice()).unshift(0),C=B[0],B[1]>=a/2&&++C;do h=0,(c=t(B,v,x,w))<0?(_=v[0],x!=w&&(_=_*a+(v[1]||0)),(h=_/C|0)>1?(h>=a&&(h=a-1),D=(m=e(B,h,a)).length,w=v.length,1==(c=t(m,v,D,w))&&(h--,r(m,x<D?S:B,D,a))):(0==h&&(c=h=1),m=B.slice()),(D=m.length)<w&&m.unshift(0),r(v,m,w,a),-1==c&&(w=v.length,(c=t(B,v,x,w))<1&&(h++,r(v,x<w?S:B,w,a))),w=v.length):0===c&&(h++,v=[0]),y[f++]=h,c&&v[0]?v[w++]=O[F]||0:(v=[O[F]],w=1);while((F++<b||void 0!==v[0])&&E--)p=void 0!==v[0]}y[0]||y.shift()}if(1==d)g.e=l,R=p;else{for(f=1,h=y[0];h>=10;h/=10)f++;g.e=f+l*d-1,ea(g,s?o+g.e+1:o,u,p)}return g}}();function ea(e,t,r,n){var i,o,u,s,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,u=t,a=(l=f[h=0])/$(10,i-u-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(s=f.length))if(n){for(;s++<=h;)f.push(0);l=a=0,i=1,o%=7,u=o-7+1}else break e;else{for(l=s=f[h],i=1;s>=10;s/=10)i++;o%=7,a=(u=o-7+i)<0?0:l/$(10,i-u-1)%10|0}if(n=n||t<0||void 0!==f[h+1]||(u<0?l:l%$(10,i-u-1)),c=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):a>5||5==a&&(4==r||n||6==r&&(o>0?u>0?l/$(10,i-u):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=$(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,s=1,h--):(f.length=h+1,s=$(10,7-o),f[h]=u>0?(l/$(10,i-u)%$(10,u)|0)*s:0),c)for(;;)if(0==h){for(o=1,u=f[0];u>=10;u/=10)o++;for(u=f[0]+=s,s=1;u>=10;u/=10)s++;o!=s&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[h]+=s,1e7!=f[h])break;f[h--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return V&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function ec(e,t,r){if(!e.isFinite())return ew(e);var n,i=e.e,o=en(e.d),u=o.length;return t?(r&&(n=r-u)>0?o=o.charAt(0)+"."+o.slice(1)+ep(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+ep(-i-1)+o,r&&(n=r-u)>0&&(o+=ep(n))):i>=u?(o+=ep(i+1-u),r&&(n=r-i-1)>0&&(o=o+"."+ep(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-u)>0&&(i+1===u&&(o+="."),o+=ep(n))),o}function el(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function ef(e,t,r){if(t>ee)throw V=!0,r&&(e.precision=r),Error(q);return ea(new e(Y),t,1,!0)}function eh(e,t,r){if(t>et)throw Error(q);return ea(new e(U),t,r,!0)}function ed(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ep(e){for(var t="";e--;)t+="0";return t}function em(e,t,r,n){var i,o=new e(1),u=Math.ceil(n/7+4);for(V=!1;;){if(r%2&&eC((o=o.times(t)).d,u)&&(i=!0),0===(r=Z(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}eC((t=t.times(t)).d,u)}return V=!0,o}function eD(e){return 1&e.d[e.d.length-1]}function eg(e,t,r){for(var n,i,o=new e(t[0]),u=0;++u<t.length;){if(!(i=new e(t[u])).s){o=i;break}((n=o.cmp(i))===r||0===n&&o.s===r)&&(o=i)}return o}function ey(e,t){var r,n,i,o,u,s,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(V=!1,a=p):a=t,s=new h(.03125);e.e>-2;)e=e.times(s),f+=5;for(a+=n=Math.log($(2,f))/Math.LN10*2+5|0,r=o=u=new h(1),h.precision=a;;){if(o=ea(o.times(e),a,1),r=r.times(++l),en((s=u.plus(es(o,r,a,1))).d).slice(0,a)===en(u.d).slice(0,a)){for(i=f;i--;)u=ea(u.times(u),a,1);if(null!=t)return h.precision=p,u;if(!(c<3&&eo(u.d,a-n,d,c)))return ea(u,h.precision=p,d,V=!0);h.precision=a+=10,r=o=s=new h(1),l=0,c++}u=s}}function ev(e,t){var r,n,i,o,u,s,a,c,l,f,h,d=1,p=e,m=p.d,D=p.constructor,g=D.rounding,y=D.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new D(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(V=!1,l=y):l=t,D.precision=l+=10,n=(r=en(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return c=ef(D,l+2,y).times(o+""),p=ev(new D(n+"."+r.slice(1)),l-10).plus(c),D.precision=y,null==t?ea(p,y,g,V=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=en((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,n>1?(p=new D("0."+r),o++):p=new D(n+"."+r.slice(1)),f=p,a=u=p=es(p.minus(1),p.plus(1),l,1),h=ea(p.times(p),l,1),i=3;;){if(u=ea(u.times(h),l,1),en((c=a.plus(es(u,new D(i),l,1))).d).slice(0,l)===en(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(ef(D,l+2,y).times(o+""))),a=es(a,new D(d),l,1),null!=t)return D.precision=y,a;if(!eo(a.d,l-10,g,s))return ea(a,D.precision=y,g,V=!0);D.precision=l+=10,c=u=p=es(f.minus(1),f.plus(1),l,1),h=ea(p.times(p),l,1),i=s=1}a=c,i+=2}}function ew(e){return String(e.s*e.s/0)}function e_(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),V&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function eE(e,t,r,n,i){var o,u,s,a,c=e.precision,l=Math.ceil(c/7);for(V=!1,a=r.times(r),s=new e(n);;){if(u=es(s.times(a),new e(t++*t++),c,1),s=i?n.plus(u):n.minus(u),n=es(u.times(a),new e(t++*t++),c,1),void 0!==(u=s.plus(n)).d[l]){for(o=l;u.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=n,n=u,u=o}return V=!0,u.d.length=l+1,u}function eA(e,t){for(var r=e;--t;)r*=e;return r}function eF(e,t){var r,n=t.s<0,i=eh(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return P=n?4:1,t;if((r=t.divToInt(i)).isZero())P=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return P=eD(r)?n?2:3:n?4:1,t;P=eD(r)?n?1:4:n?3:2}return t.minus(i).abs()}function eb(e,t,r,n){var i,o,u,s,a,c,l,f,h,d=e.constructor,p=void 0!==r;if(p?(ei(r,1,1e9),void 0===n?n=d.rounding:ei(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(u=(l=ec(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,u>=0&&(l=l.replace(".",""),(h=new d(1)).e=l.length-u,h.d=eu(ec(h),10,i),h.e=h.d.length),o=a=(f=eu(l,10,i)).length;0==f[--a];)f.pop();if(f[0]){if(u<0?o--:((e=new d(e)).d=f,e.e=o,f=(e=es(e,h,r,n,0,i)).d,o=e.e,c=R),u=f[r],s=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==u||c)&&(0===n||n===(e.s<0?3:2)):u>s||u===s&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(a=f.length;!f[a-1];--a);for(u=0,l="";u<a;u++)l+=j.charAt(f[u]);if(p){if(a>1)if(16==t||8==t){for(u=16==t?4:3,--a;a%u;a++)l+="0";for(a=(f=eu(l,i,t)).length;!f[a-1];--a);for(u=1,l="1.";u<a;u++)l+=j.charAt(f[u])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>a)for(o-=a;o--;)l+="0";else o<a&&(l=l.slice(0,o)+"."+l.slice(o))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=ew(e);return e.s<0?"-"+l:l}function eC(e,t){if(e.length>t)return e.length=t,!0}function ex(e){return new this(e).abs()}function eS(e){return new this(e).acos()}function eM(e){return new this(e).acosh()}function eN(e,t){return new this(e).plus(t)}function eO(e){return new this(e).asin()}function eB(e){return new this(e).asinh()}function eT(e){return new this(e).atan()}function ek(e){return new this(e).atanh()}function eI(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?eh(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=eh(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(es(e,t,o,1)),t=eh(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(es(e,t,o,1)):(r=eh(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function eR(e){return new this(e).cbrt()}function eP(e){return ea(e=new this(e),e.e+1,2)}function ej(e,t,r){return new this(e).clamp(t,r)}function eY(e){if(!e||"object"!=typeof e)throw Error(L+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=z[r]),void 0!==(n=e[r]))if(Z(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(H+r+": "+n);if(r="crypto",i&&(this[r]=z[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(W);else this[r]=!1;else throw Error(H+r+": "+n);return this}function eU(e){return new this(e).cos()}function ez(e){return new this(e).cosh()}function eV(e,t){return new this(e).div(t)}function eL(e){return new this(e).exp()}function eH(e){return ea(e=new this(e),e.e+1,3)}function eq(){var e,t,r=new this(0);for(e=0,V=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return V=!0,new this(1/0);r=t}return V=!0,r.sqrt()}function eW(e){return e instanceof tn||e&&e.toStringTag===G||!1}function eG(e){return new this(e).ln()}function eZ(e,t){return new this(e).log(t)}function e$(e){return new this(e).log(2)}function eJ(e){return new this(e).log(10)}function eQ(){return eg(this,arguments,-1)}function eX(){return eg(this,arguments,1)}function eK(e,t){return new this(e).mod(t)}function e0(e,t){return new this(e).mul(t)}function e1(e,t){return new this(e).pow(t)}function e2(e){var t,r,n,i,o=0,u=new this(1),s=[];if(void 0===e?e=this.precision:ei(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=n/4}else throw Error(W);else for(;o<n;)s[o++]=1e7*Math.random()|0;for(n=s[--o],e%=7,n&&e&&(i=$(10,7-e),s[o]=(n/i|0)*i);0===s[o];o--)s.pop();if(o<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return u.e=r,u.d=s,u}function e3(e){return ea(e=new this(e),e.e+1,this.rounding)}function e8(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function e4(e){return new this(e).sin()}function e5(e){return new this(e).sinh()}function e6(e){return new this(e).sqrt()}function e7(e,t){return new this(e).sub(t)}function e9(){var e=0,t=arguments,r=new this(t[0]);for(V=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return V=!0,ea(r,this.precision,this.rounding)}function te(e){return new this(e).tan()}function tt(e){return new this(e).tanh()}function tr(e){return ea(e=new this(e),e.e+1,1)}er[Symbol.for("nodejs.util.inspect.custom")]=er.toString,er[Symbol.toStringTag]="Decimal";var tn=er.constructor=function e(t){var r,n,i;function o(e){var t,r,n;if(!(this instanceof o))return new o(e);if(this.constructor=o,eW(e)){this.s=e.s,V?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;V?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return e_(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),K.test(e)?e_(this,e):function(e,t){var r,n,i,o,u,s,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),K.test(t))return e_(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Q.test(t))r=16,t=t.toLowerCase();else if(J.test(t))r=2;else if(X.test(t))r=8;else throw Error(H+t);for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),u=(o=t.indexOf("."))>=0,n=e.constructor,u&&(o=(s=(t=t.replace(".","")).length)-o,i=em(n,new n(r),o,2*o)),o=l=(c=eu(t,r,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=el(c,l),e.d=c,V=!1,u&&(e=es(e,i,4*s)),a&&(e=e.times(54>Math.abs(a)?$(2,a):tn.pow(2,a))),V=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,e_(this,e.toString());throw Error(H+e)}if(o.prototype=er,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=eY,o.clone=e,o.isDecimal=eW,o.abs=ex,o.acos=eS,o.acosh=eM,o.add=eN,o.asin=eO,o.asinh=eB,o.atan=eT,o.atanh=ek,o.atan2=eI,o.cbrt=eR,o.ceil=eP,o.clamp=ej,o.cos=eU,o.cosh=ez,o.div=eV,o.exp=eL,o.floor=eH,o.hypot=eq,o.ln=eG,o.log=eZ,o.log10=eJ,o.log2=e$,o.max=eQ,o.min=eX,o.mod=eK,o.mul=e0,o.pow=e1,o.random=e2,o.round=e3,o.sign=e8,o.sin=e4,o.sinh=e5,o.sqrt=e6,o.sub=e7,o.sum=e9,o.tan=te,o.tanh=tt,o.trunc=tr,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(z);function ti(e){return"number"==typeof e}function to(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 tu(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function ts(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function ta(e){return e&&!0===e.constructor.prototype.isUnit||!1}function tc(e){return"string"==typeof e}Y=new tn(Y),U=new tn(U);var tl=Array.isArray;function tf(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function th(e){return Array.isArray(e)||tf(e)}function td(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tp(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tm(e){return e&&!0===e.constructor.prototype.isRange||!1}function tD(e){return e&&!0===e.constructor.prototype.isIndex||!1}function tg(e){return"boolean"==typeof e}function ty(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function tv(e){return e&&!0===e.constructor.prototype.isHelp||!1}function tw(e){return"function"==typeof e}function t_(e){return e instanceof Date}function tE(e){return e instanceof RegExp}function tA(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!tu(e)&&!ts(e))}function tF(e){return null===e}function tb(e){return void 0===e}function tC(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function tx(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function tS(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tM(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function tN(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function tO(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function tB(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tT(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function tk(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function tI(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function tR(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function tP(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function tj(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function tY(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function tU(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function tz(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function tV(e){return e&&!0===e.constructor.prototype.isChain||!1}function tL(e){var t=typeof e;return"object"===t?null===e?"null":to(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function tH(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return tH(e)});if(e instanceof Date)return new Date(e.valueOf());if(to(e))return e;if(tA(e)){var r=e,n=tH,i={};for(var o in r)tW(r,o)&&(i[o]=n(r[o]));return i}throw TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function tq(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!tq(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!tq(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function tW(e,t){return e&&Object.hasOwnProperty.call(e,t)}function tG(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(tZ));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function tZ(e){return e&&"?"===e[0]?e.slice(1):e}var t$=tG("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=tn.clone({precision:r.precision,modulo:tn.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0});let tJ=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},tQ=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},tX=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},tK=function(){throw SyntaxError("Invalid Param")};function t0(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let t1={re:0,im:0},t2=function(e,t){if(null==e)t1.re=t1.im=0;else if(void 0!==t)t1.re=e,t1.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)t1.re=e.re,t1.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return t3.INFINITY;t1.re=e.abs*Math.cos(e.arg),t1.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return t3.INFINITY;t1.re=e.r*Math.cos(e.phi),t1.im=e.r*Math.sin(e.phi)}else 2===e.length?(t1.re=e[0],t1.im=e[1]):tK();break;case"string":t1.im=t1.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&tK();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&tK()," "===r[e+1]||isNaN(r[e+1])?t1.im+=parseFloat((i%2?"-":"")+"1"):(t1.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&tK(),"i"===r[e+1]||"I"===r[e+1]?(t1.im+=parseFloat((i%2?"-":"")+t),e++):t1.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&tK();break;case"number":t1.im=0,t1.re=e;break;default:tK()}return isNaN(t1.re)||isNaN(t1.im),t1};function t3(e,t){if(!(this instanceof t3))return new t3(e,t);let r=t2(e,t);this.re=r.re,this.im=r.im}function t8(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}t3.prototype={re:0,im:0,sign:function(){let e=tX(this.re,this.im);return new t3(this.re/e,this.im/e)},add:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t3.NAN:t3.INFINITY:new t3(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t3.NAN:t3.INFINITY:new t3(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;return n&&u||i&&o?t3.NAN:n||i?t3.INFINITY:0===r.im&&0===this.im?new t3(this.re*r.re,0):new t3(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;if(o&&u||n&&i)return t3.NAN;if(u||n)return t3.INFINITY;if(o||i)return t3.ZERO;if(0===r.im)return new t3(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new t3((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new t3((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=t2(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return t3.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new t3(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new t3(Math.pow(this.im,r.re),0);case 1:return new t3(0,Math.pow(this.im,r.re));case 2:return new t3(-Math.pow(this.im,r.re),0);case 3:return new t3(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return t3.ZERO;let i=Math.atan2(this.im,this.re),o=t0(this.re,this.im),u=Math.exp(r.re*o-r.im*i),s=r.im*o+r.re*i;return new t3(u*Math.cos(s),u*Math.sin(s))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new t3(Math.sqrt(e),0);else return new t3(0,Math.sqrt(-e));let r=Math.sqrt(.5*(tX(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new t3(r,t<0?-n:n):new t3(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new t3(e,0):new t3(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e,t=this.re,r=this.im;return new t3(Math.expm1(t)*Math.cos(r)+-2*(e=Math.sin(.5*r))*e,Math.exp(t)*Math.sin(r))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new t3(Math.log(e),0):new t3(t0(e,t),Math.atan2(t,e))},abs:function(){return tX(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new t3(Math.sin(e)*tJ(t),Math.cos(e)*tQ(t))},cos:function(){let e=this.re,t=this.im;return new t3(Math.cos(e)*tJ(t),-Math.sin(e)*tQ(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+tJ(t);return new t3(Math.sin(e)/r,tQ(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-tJ(t);return new t3(-Math.sin(e)/r,tQ(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*tJ(2*t)+.5*Math.cos(2*e);return new t3(Math.cos(e)*tJ(t)/r,Math.sin(e)*tQ(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*tJ(2*t)-.5*Math.cos(2*e);return new t3(Math.sin(e)*tJ(t)/r,-Math.cos(e)*tQ(t)/r)},asin:function(){let e=this.re,t=this.im,r=new t3(t*t-e*e+1,-2*e*t).sqrt(),n=new t3(r.re-t,r.im+e).log();return new t3(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new t3(t*t-e*e+1,-2*e*t).sqrt(),n=new t3(r.re-t,r.im+e).log();return new t3(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new t3(0,1/0);if(-1===t)return new t3(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new t3((1-t*t-e*e)/r,-2*e/r).log();return new t3(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new t3(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).atan():new t3(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(0,1/0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).acos():new t3(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).asin():new t3(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new t3(tQ(e)*Math.cos(t),tJ(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new t3(tJ(e)*Math.cos(t),tQ(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=tJ(e)+Math.cos(t);return new t3(tQ(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=tJ(e)-Math.cos(t);return new t3(tQ(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-tJ(2*e);return new t3(-2*tQ(e)*Math.cos(t)/r,2*tJ(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+tJ(2*e);return new t3(2*tJ(e)*Math.cos(t)/r,-2*tQ(e)*Math.sin(t)/r)},asinh:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t3(0,0);let t=Math.abs(e),r=Math.log(t+Math.sqrt(t*t+1));return new t3(e<0?-r:r,0)}let r=new t3(e*e-t*t+1,2*e*t).sqrt();return new t3(e+r.re,t+r.im).log()},acosh:function(){let e=this.re,t=this.im;if(0===t){if(e>1)return new t3(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new t3(Math.log(-e+t),Math.PI)}return new t3(0,Math.acos(e))}let r=new t3(e-1,t).sqrt(),n=new t3(e+1,t).sqrt();return new t3(e+r.re*n.re-r.im*n.im,t+r.re*n.im+r.im*n.re).log()},atanh:function(){let e=this.re,t=this.im;if(0===t)return 0===e?new t3(0,0):1===e?new t3(1/0,0):-1===e?new t3(-1/0,0):-1<e&&e<1?new t3(.5*Math.log((1+e)/(1-e)),0):e>1?new t3(.5*Math.log((e+1)/(e-1)),-Math.PI/2):new t3(.5*Math.log(-((1+e)/(1-e))),Math.PI/2);let r=1-e,n=1+e,i=r*r+t*t;if(0===i)return new t3(-1!==e?e/0:0,0!==t?t/0:0);let o=(n*r-t*t)/i,u=(t*r+n*t)/i;return new t3(t0(o,u)/2,Math.atan2(u,o)/2)},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).atanh():new t3(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t3(1/0,0);let t=1/e;return new t3(Math.log(t+Math.sqrt(t*t+1)),0)}let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).asinh():new t3(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return t3.INFINITY;let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).acosh():new t3(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return t3.INFINITY;if(this.isInfinite())return t3.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new t3(e/r,-t/r)},conjugate:function(){return new t3(this.re,-this.im)},neg:function(){return new t3(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new t3(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new t3(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new t3(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=t2(e,t);return Math.abs(r.re-this.re)<=t3.EPSILON&&Math.abs(r.im-this.im)<=t3.EPSILON},clone:function(){return new t3(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<t3.EPSILON&&(e=0),Math.abs(t)<t3.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},t3.ZERO=new t3(0,0),t3.ONE=new t3(1,0),t3.I=new t3(0,1),t3.PI=new t3(Math.PI,0),t3.E=new t3(Math.E,0),t3.INFINITY=new t3(1/0,1/0),t3.NAN=new t3(NaN,NaN),t3.EPSILON=1e-15;function t4(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t8(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function t5(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=t6(t);switch(r){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t7(e),n="number"==typeof t?re(r,r.exponent+1+t):r,i=n.coefficients,o=n.exponent+1,u=o+(t||0);return i.length<u&&(i=i.concat(rt(u-i.length))),o<0&&(i=rt(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(e,n);case"exponential":return t9(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=re(t7(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(ti(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else for(var u=Math.abs(n-o)-(i.length-1),s=0;s<u;s++)i.push(0);for(var a=Math.abs(n-o),c=1;a>0;)c++,a--;var l=i.slice(c).join(""),f=ti(t)&&l.length||l.match(/[1-9]/)?"."+l:"",h=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+o.toString();return r.sign+h}(e,n);case"bin":return t4(e,2,i);case"oct":return t4(e,8,i);case"hex":return t4(e,16,i);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=ro(null==r?void 0:r.lowerExp,-3),i=ro(null==r?void 0:r.upperExp,5),o=t7(e),u=t?re(o,t):o;if(u.exponent<n||u.exponent>=i)return t9(e,t);var s=u.coefficients,a=u.exponent;s.length<t&&(s=s.concat(rt(t-s.length))),s=s.concat(rt(a-s.length+1+(s.length<t?t-s.length:0))),s=rt(-a).concat(s);var c=a>0?a:0;return c<s.length-1&&s.splice(c+1,0,"."),u.sign+s.join("")})(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function t6(e){var t,r,n="auto";if(void 0!==e)if(ti(e))t=e;else if(to(e))t=e.toNumber();else if(tA(e))void 0!==e.precision&&(t=ri(e.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(r=ri(e.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:t,wordSize:r}}function t7(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===u.length&&(u.push(0),i++),{sign:r,coefficients:u,exponent:i}}function t9(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t7(e),n=t?re(r,t):r,i=n.coefficients,o=n.exponent;i.length<t&&(i=i.concat(rt(t-i.length)));var u=i.shift();return n.sign+u+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function re(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function rt(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var rr=Number.EPSILON||2220446049250313e-31;function rn(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<=rr||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function ri(e,t){return ti(e)?e:to(e)?e.toNumber():void t()}function ro(e,t){return ti(e)?e:to(e)?e.toNumber():t}var ru=tG("Complex",[],()=>(Object.defineProperty(t3,"name",{value:"Complex"}),t3.prototype.constructor=t3,t3.prototype.type="Complex",t3.prototype.isComplex=!0,t3.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},t3.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},t3.prototype.format=function(e){var t=this.im,r=this.re,n=t5(this.re,e),i=t5(this.im,e),o=ti(e)?e:e?e.precision:null;if(null!==o){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},t3.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return t3(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(ti(r)){if(ta(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),ti(n))return new t3({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},t3.prototype.valueOf=t3.prototype.toString,t3.fromJSON=function(e){return new t3(e)},t3.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},t3),{isClass:!0}),rs=a(42),ra=tG("Fraction",[],()=>(Object.defineProperty(rs,"name",{value:"Fraction"}),rs.prototype.constructor=rs,rs.prototype.type="Fraction",rs.prototype.isFraction=!0,rs.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},rs.fromJSON=function(e){return new rs(e)},rs),{isClass:!0}),rc=tG("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function rl(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function rf(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function rh(e,t){return ti(e)?e:to(e)?e.toNumber():t}function rd(e,t){var r=function(e,t){var r;if("number"==typeof e)return t5(e,t);if(to(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i,o,u,s,a,{notation:c,precision:l,wordSize:f}=t6(t);switch(c){case"fixed":return r=e,n=l,r.toFixed(n);case"exponential":return rf(e,l);case"engineering":return i=e,o=l,s=(u=i.e)%3==0?u:u<0?u-3-u%3:u-u%3,(a=i.mul(Math.pow(10,-s)).toPrecision(o)).includes("e")&&(a=new i.constructor(a).toFixed()),a+"e"+(u>=0?"+":"")+s.toString();case"bin":return rl(e,2,f);case"oct":return rl(e,8,f);case"hex":return rl(e,16,f);case"auto":var h=rh(null==t?void 0:t.lowerExp,-3),d=rh(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";var p=e.toSignificantDigits(l),m=p.e;return(m>=h&&m<d?p.toFixed():rf(e,l)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return rd(t,r);for(var n="[",i=t.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=e(t[o],r);return n+"]"}(e,t);if(tc(e))return rp(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>rp(r)+": "+rd(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function rp(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);r+=i in rm?rm[i]:i,n++}return'"'+r+'"'}var rm={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function rD(e,t,r){if(!(this instanceof rD))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function rg(e,t,r){if(!(this instanceof rg))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function ry(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function rv(e,t){if(0===t.length){if(Array.isArray(e))throw new rD(e.length,0)}else!function e(t,r,n){var i,o=t.length;if(o!==r[n])throw new rD(o,r[n]);if(n<r.length-1){var u=n+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new rD(r.length-1,r.length,"<");e(t[i],r,u)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new rD(r.length+1,r.length,">")}(e,t,0)}function rw(e,t){if(void 0!==e){if(!ti(e)||!t8(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new rg(e,t)}}function r_(e,t,r){if(!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!ti(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rd(t)+")")}),(ti(e)||to(e))&&(e=[e]),function e(t,r,n,i){var o,u,s=t.length,a=r[n],c=Math.min(s,a);if(t.length=a,n<r.length-1){var l=n+1;for(o=0;o<c;o++)Array.isArray(u=t[o])||(u=[u],t[o]=u),e(u,r,l,i);for(o=c;o<a;o++)u=[],t[o]=u,e(u,r,l,i)}else{for(o=0;o<c;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=c;o<a;o++)t[o]=i}}(e,t,0,void 0!==r?r:0),e}function rE(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new rD(0,n,"!=");var i=rF(t=rA(t,n));if(n!==i)throw new rD(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var o=t[i];r=[];for(var u=n.length/o,s=0;s<u;s++)r.push(n.slice(s*o,(s+1)*o));n=r}return n}(r,t)}catch(e){if(e instanceof rD)throw new rD(i,n,"!=");throw e}}function rA(e,t){var r=rF(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function rF(e){return e.reduce((e,t)=>e*t,1)}function rb(e,t,r,n){var i=n||ry(e);if(r)for(var o=0;o<r;o++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,o;if(Array.isArray(t)){var u=n+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],r,u)}else for(var s=n;s<r;s++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function rC(e,t){for(var r,n=0,i=0;i<e.length;i++){var o=e[i],u=Array.isArray(o);if(0===i&&u&&(n=o.length),u&&o.length!==n)return;var s=u?rC(o,t):t(o);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function rx(e,t){for(var r=t.length,n=e.length,i=0;i<n;i++){var o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[o]))}}function rS(e,t){var r,n,i,o=ry(e);if(tq(o,t))return e;rx(o,t);var u=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(e=>e.length),i=Math.max(...n),o=Array(i).fill(null),u=0;u<t.length;u++)for(var s=t[u],a=n[u],c=0;c<a;c++){var l=i-a+c;s[c]>o[l]&&(o[l]=s[c])}for(var f=0;f<t.length;f++)rx(t[f],o);return o}(o,t),s=u.length,a=[...Array(s-o.length).fill(1),...o],c=B([],e);o.length<s&&(o=ry(c=rE(c,a)));for(var l=0;l<s;l++){o[l]<u[l]&&(o=ry((r=c,n=u[l],i=l,c=function(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,r){return function e(t,r,n,i){if(!(i<n))return t.concat(r);if(t.length!==r.length)throw new rD(t.length,r.length);for(var o=[],u=0;u<t.length;u++)o[u]=e(t[u],r[u],n,i+1);return o}(e,r,t,0)},e[0]);throw Error("Wrong number of arguments in function concat")}(...Array(n).fill(r),i))))}return c}function rM(e){return Object.keys(e.signatures||{}).reduce(function(e,t){return Math.max(e,(t.match(/,/g)||[]).length+1)},-1)}rD.prototype=RangeError(),rD.prototype.constructor=RangeError,rD.prototype.name="DimensionError",rD.prototype.isDimensionError=!0,rg.prototype=RangeError(),rg.prototype.constructor=RangeError,rg.prototype.name="IndexError",rg.prototype.isIndexError=!0;var rN=tG("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!tc(t))throw Error("Invalid datatype: "+t);if(tf(e))"DenseMatrix"===e.type?(this._data=tH(e._data),this._size=tH(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&tl(e.data)&&tl(e.size))this._data=e.data,this._size=e.size,rv(this._data,this._size),this._datatype=t||e.datatype;else if(tl(e))this._data=function e(t){return tf(t)?e(t.valueOf()):tl(t)?t.map(e):t}(e),this._size=ry(this._data),rv(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+tL(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;tl(n);)n=n[0];return n}return e._size=t.slice(0),e._data=r_(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var u=0,s=t.length;u<s;u++)t[u]>i[u]&&(i[u]=t[u],o=!0);o&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return rC(this._data,tL)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!tD(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new rD(n.length,e._size.length);for(var i=t.min(),o=t.max(),u=0,s=e._size.length;u<s;u++)rw(i[u],e._size[u]),rw(o[u],e._size[u]);return new r(function e(t,r,n,i){var o=i===n-1,u=r.dimension(i);return o?u.map(function(e){return rw(e,t.length),t[e]}).valueOf():u.map(function(o){return rw(o,t.length),e(t[o],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,u=t.size(),s=t.isScalar();if(tf(r)?(o=r.size(),r=r.valueOf()):o=ry(r),s){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!tq(o,u))try{r=0===o.length?rS([r],u):rS(r,u),o=ry(r)}catch(e){}if(u.length<e._size.length)throw new rD(u.length,e._size.length,"<");if(o.length<u.length){for(var a=0,c=0;1===u[a]&&1===o[a];)a++;for(;1===u[a];)c++,a++;r=rb(r,u.length,c,o)}if(!tq(u,o))throw new rD(u,o,">");i(e,t.max().map(function(e){return e+1}),n);var l=u.length;!function e(t,r,n,i,o){var u=o===i-1,s=r.dimension(o);u?s.forEach(function(e,r){rw(e),t[e]=n[r[0]]}):s.forEach(function(u,s){rw(u),e(t[u],r,n[s[0]],i,o+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);for(var t=0;t<e.length;t++)rw(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var o=e[n];rw(o,r.length),r=r[o]}return r},r.prototype.set=function(e,t,r){if(!tl(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new rD(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,o,u,s=this._data;for(n=0,o=e.length-1;n<o;n++)rw(u=e[n],s.length),s=s[u];return rw(u=e[e.length-1],s.length),s[u]=t,this},r.prototype.resize=function(e,t,r){if(!th(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=rE(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=rA(e,n),r},r.prototype.clone=function(){return new r({data:tH(this._data),size:tH(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=rM(e),i=function r(i,o){return tl(i)?i.map(function(e,t){return r(e,o.concat(t))}):1===n?e(i):2===n?e(i,o):e(i,o,t)}(this._data,[]),o=void 0!==this._datatype?rC(i,tL):void 0;return new r(i,o)},r.prototype.forEach=function(e){var t=this;!function r(n,i){tl(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(tl(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(e=>[e[n]]);t.push(new r(o,e._datatype))},u=0;u<n[1];u++)o(u);return t},r.prototype.toArray=function(){return tH(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return rd(this._data,e)},r.prototype.toString=function(){return rd(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),o=[],u=0;u<i;u++)o[u]=this._data[u+n][u+t];return new r({data:o,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!tl(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(to(n)&&(n=n.toNumber()),!ti(n)||!t8(n))throw TypeError("The parameter k must be an integer number")}else n=0;var o,u=n>0?n:0,s=n<0?-n:0,a=e[0],c=e[1],l=Math.min(a-s,c-u);if(tl(t)){if(t.length!==l)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(tf(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=to(o(0))?o(0).mul(0):0);var h=[];if(e.length>0){h=r_(h,e,i);for(var d=0;d<l;d++)h[d+s][d+u]=o(d)}return new r({data:h,size:[a,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!ti(e)||!t8(e)||!ti(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rw(e,this._size[0]),rw(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0});function rO(){return!0}function rB(){return!1}function rT(){}let rk="Argument is not a typed-function.",rI=function e(){let t,r;function n(e){return"object"==typeof e&&null!==e&&e.constructor===Object}let i=[{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:n},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:rO,isAny:!0},u=0,s={createCount:0};function a(e){let n,i=t.get(e);if(i)return i;let o='Unknown type "'+e+'"',u=e.toLowerCase();for(n of r)if(n.toLowerCase()===u){o+='. Did you mean "'+n+'" ?';break}throw TypeError(o)}function c(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=n?a(n).index:r.length,o=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let n=e[r].name;if(t.has(n))throw TypeError('Duplicate type name "'+n+'"');o.push(n),t.set(n,{name:n,test:e[r].test,isAny:e[r].isAny,index:i+r,conversionsTo:[]})}let u=r.slice(i);r=r.slice(0,i).concat(o).concat(u);for(let e=i+o.length;e<r.length;++e)t.get(r[e]).index=e}function l(){t=new Map,r=[],u=0,c([o],!1)}function f(e){let n=r.filter(r=>{let n=t.get(r);return!n.isAny&&n.test(e)});return n.length?n:["any"]}function h(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function d(e,t,r){let n,i;if(!h(e))throw TypeError(rk);let o=r&&r.exact,u=g(Array.isArray(t)?t.join(","):t),s=p(u);if(!o||s in e.signatures){let t=e._typedFunctionData.signatureMap.get(s);if(t)return t}let a=u.length;if(o){let t;for(t in n=[],e.signatures)n.push(e._typedFunctionData.signatureMap.get(t))}else n=e._typedFunctionData.signatures;for(let e=0;e<a;++e){let t,r=u[e],i=[];for(t of n){let n=w(t.params,e);if(n&&(!r.restParam||n.restParam)){if(!n.hasAny){let e=D(n);if(r.types.some(t=>!e.has(t.name)))continue}i.push(t)}}if(0===(n=i).length)break}for(i of n)if(i.params.length<=a)return i;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+p(u,", ")+"))")}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map(e=>e.name).join(t)}function m(e){let t=function(e){if(0===e.length)return[];let t=e.map(a);if(1===e.length)return t[0].conversionsTo;let r=new Set(e),n=new Set;for(let e=0;e<t.length;++e)for(let i of t[e].conversionsTo)r.has(i.from)||n.add(i.from);let i=[];for(let e of n){let r=u+1,n=null;for(let i=0;i<t.length;++i)for(let o of t[i].conversionsTo)o.from===e&&o.index<r&&(r=o.index,n=o);i.push(n)}return i}(e.types.map(e=>e.name)),r=e.hasAny,n=e.name,i=t.map(function(e){let t=a(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach(t=>e.typeSet.add(t.name))),e.typeSet}function g(e){let t=[];if("string"!=typeof e)throw TypeError("Signatures must be strings");let r=e.trim();if(""===r)return t;let n=r.split(",");for(let e=0;e<n.length;++e){let r=function(e){let t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map(e=>a(e.trim())),n=!1,i=t?"...":"";return{types:r.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:t}}(n[e].trim());if(r.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function y(e){let t=O(e);return!!t&&t.restParam}function v(e){if(!e||0===e.types.length)return rO;if(1===e.types.length)return a(e.types[0].name).test;if(2===e.types.length){let t=a(e.types[0].name).test,r=a(e.types[1].name).test;return function(e){return t(e)||r(e)}}{let t=e.types.map(function(e){return a(e.name).test});return function(e){for(let r=0;r<t.length;r++)if(t[r](e))return!0;return!1}}}function w(e,t){return t<e.length?e[t]:y(e)?O(e):null}function _(e,t){let r=w(e,t);return r?D(r):new Set}function E(e){return null===e.conversion||void 0===e.conversion}function A(e,t){let r=new Set;return e.forEach(e=>{let n;for(n of _(e.params,t))r.add(n)}),r.has("any")?["any"]:Array.from(r)}function F(e,t,r){let n,i,o,u=e||"unnamed",s=r;for(o=0;o<t.length;o++){let e=[];if(s.forEach(r=>{let n=v(w(r.params,o));(o<r.params.length||y(r.params))&&n(t[o])&&e.push(r)}),0===e.length){if((i=A(s,o)).length>0){let e=f(t[o]);return(n=TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:e,expected:i},n}}else s=e}let a=s.map(function(e){return y(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,a))return(n=TypeError("Too few arguments in function "+u+" (expected: "+(i=A(s,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:u,index:t.length,expected:i},n;let c=Math.max.apply(null,a);if(t.length>c)return(n=TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:c},n;let l=[];for(let e=0;e<t.length;++e)l.push(f(t[e]).join("|"));return(n=TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+u+".")).data={category:"mismatch",actual:l},n}function b(e){let t=r.length+1;for(let r=0;r<e.types.length;r++)t=Math.min(t,e.types[r].typeIndex);return t}function C(e){let t=u+1;for(let r=0;r<e.types.length;r++)E(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function x(e,t){let r,n,i=e.params,o=t.params,u=O(i),s=O(o),a=y(i),c=y(o);if(a&&u.hasAny){if(!c||!s.hasAny)return 1e7}else if(c&&s.hasAny)return -1e7;let l=0,f=0;for(r of i)r.hasAny&&++l,r.hasConversion&&++f;let h=0,d=0;for(r of o)r.hasAny&&++h,r.hasConversion&&++d;if(l!==h)return(l-h)*1e6;if(a&&u.hasConversion){if(!c||!s.hasConversion)return 1e5}else if(c&&s.hasConversion)return -1e5;if(f!==d)return(f-d)*1e4;if(a){if(!c)return 1e3}else if(c)return -1e3;let p=(i.length-o.length)*(a?-100:100);if(0!==p)return p;let m=[],D=0;for(let e=0;e<i.length;++e){let t=function(e,t){if(e.hasAny){if(!t.hasAny)return .1}else if(t.hasAny)return -.1;if(e.restParam){if(!t.restParam)return .01}else if(t.restParam)return -.01;let r=b(e)-b(t);if(r<0)return -.001;if(r>0)return .001;let n=C(e),i=C(t);if(e.hasConversion){if(!t.hasConversion)return(1+n)*1e-6}else if(t.hasConversion)return-(1e-6*(1+i));let o=n-i;return o<0?-1e-7:1e-7*(o>0)}(i[e],o[e]);m.push(t),D+=t}if(0!==D)return(D<0?-10:10)+D;let g=9,v=9/(m.length+1);for(n of m){if(0!==n)return(n<0?-g:g)+n;g-=v}return 0}function S(e){let t,r,n,i,o=[],u=[],s="";e.types.forEach(function(e){e.conversion&&(s+=e.conversion.from+"~>"+e.conversion.to+",",o.push(a(e.conversion.from).test),u.push(e.conversion.convert))}),s=s?s.slice(0,-1):"pass";let c=e=>e;switch(u.length){case 0:break;case 1:t=o[0],n=u[0],c=function(e){return t(e)?n(e):e};break;case 2:t=o[0],r=o[1],n=u[0],i=u[1],c=function(e){return t(e)?n(e):r(e)?i(e):e};break;default:c=function(e){for(let t=0;t<u.length;t++)if(o[t](e))return u[t](e);return e}}return Object.defineProperty(c,"name",{value:s}),c}function M(e,t,r){throw F(e,t,r)}function N(e){return B(e,0,e.length-1)}function O(e){return e[e.length-1]}function B(e,t,r){return Array.prototype.slice.call(e,t,r)}function T(e,t){return{referTo:{references:e,callback:t}}}function k(e){if("function"!=typeof e)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function I(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function R(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function P(e,t){if(!e)return t;if(t&&t!==e){let r=Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}l(),c(i);let j=s;function Y(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(s=function(e){let t="string"==typeof e,r=+!!t,i=t?e:"",o={};for(let e=r;e<arguments.length;++e){let r,u=arguments[e],s={};if("function"==typeof u?(r=u.name,"string"==typeof u.signature?s[u.signature]=u:h(u)&&(s=u.signatures)):n(u)&&(s=u,t||(r=function(e){let t;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(h(e[r])||"string"==typeof e[r].signature)&&(t=P(t,e[r].name));return t}(u))),0===Object.keys(s).length){let t=TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:u},t}t||(i=P(i,r)),function(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){let n=Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}(o,s)}return function(e,t){let r,n,i;if(s.createCount++,0===Object.keys(t).length)throw SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&(i=/\bthis(\(|\.signatures\b)/,Object.keys(t).forEach(e=>{let r=t[e];if(i.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}));let o=[],u=[],a={},c=[];for(r in t){let e;if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=g(r);if(!n)continue;o.forEach(function(e){if(function(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let r,i=_(e,n),o=_(t,n),u=!1;for(r of o)if(i.has(r)){u=!0;break}if(!u)return!1}let n=e.length,i=t.length,o=y(e),u=y(t);return o?u?n===i:i>=n:u?n>=i:n===i}(e,n))throw TypeError('Conflicting signatures "'+p(e)+'" and "'+p(n)+'".')}),o.push(n);let i=u.length;for(e of(u.push(t[r]),function e(t,r,n){if(!(r<t.length))return[n];{var i,o;let u=t[r],s=[];if(u.restParam){let e=u.types.filter(E);e.length<u.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(u)}else s=u.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return i=s,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}}(n.map(m),0,[]))){let t=p(e);c.push({params:e,name:t,fn:i}),e.every(e=>!e.hasConversion)&&(a[t]=i)}}c.sort(x);let l=function(e,t,r){let n=e.map(e=>R(e)?k(e.referToSelf.callback):I(e)?T(e.referTo.references,e.referTo.callback):e),i=Array(n.length).fill(!1),o=!0;for(;o;){o=!1;let e=!0;for(let u=0;u<n.length;++u){if(i[u])continue;let s=n[u];if(R(s))n[u]=s.referToSelf.callback(r),n[u].referToSelf=s.referToSelf,i[u]=!0,e=!1;else if(I(s)){let r=function(e,t,r){let n,i=[];for(n of e){let e=r[n];if("number"!=typeof e)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(e=t[e]))return!1;i.push(e)}return i}(s.referTo.references,n,t);r?(n[u]=s.referTo.callback.apply(this,r),n[u].referTo=s.referTo,i[u]=!0,e=!1):o=!0}}if(e&&o)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(u,a,el);for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(a[n]=l[a[n]]);let f=[],h=new Map;for(n of c)h.has(n.name)||(n.fn=l[n.fn],f.push(n),h.set(n.name,n));let d=f[0]&&f[0].params.length<=2&&!y(f[0].params),D=f[1]&&f[1].params.length<=2&&!y(f[1].params),w=f[2]&&f[2].params.length<=2&&!y(f[2].params),A=f[3]&&f[3].params.length<=2&&!y(f[3].params),F=f[4]&&f[4].params.length<=2&&!y(f[4].params),b=f[5]&&f[5].params.length<=2&&!y(f[5].params);for(let e=0;e<f.length;++e)f[e].test=function(e){let t,r,n;if(y(e)){let r=(t=N(e).map(v)).length,n=v(O(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=v(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=v(e[0]),n=v(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(v),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(f[e].params);let C=d?v(f[0].params[0]):rB,M=D?v(f[1].params[0]):rB,P=w?v(f[2].params[0]):rB,j=A?v(f[3].params[0]):rB,Y=F?v(f[4].params[0]):rB,U=b?v(f[5].params[0]):rB,z=d?v(f[0].params[1]):rB,V=D?v(f[1].params[1]):rB,L=w?v(f[2].params[1]):rB,H=A?v(f[3].params[1]):rB,q=F?v(f[4].params[1]):rB,W=b?v(f[5].params[1]):rB;for(let e=0;e<f.length;++e)f[e].implementation=function(e,t){let r=t,n="";if(e.some(e=>e.hasConversion)){let i=y(e),o=e.map(S);n=o.map(e=>e.name).join(";"),r=function(){let e=[],r=i?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=o[t](arguments[t]);return i&&(e[r]=arguments[r].map(o[r])),t.apply(this,e)}}let i=r;if(y(e)){let t=e.length-1;i=function(){return r.apply(this,B(arguments,0,t).concat([B(arguments,t)]))}}return n&&Object.defineProperty(i,"name",{value:n}),i}(f[e].params,f[e].fn);let G=d?f[0].implementation:rT,Z=D?f[1].implementation:rT,$=w?f[2].implementation:rT,J=A?f[3].implementation:rT,Q=F?f[4].implementation:rT,X=b?f[5].implementation:rT,K=d?f[0].params.length:-1,ee=D?f[1].params.length:-1,et=w?f[2].params.length:-1,er=A?f[3].params.length:-1,en=F?f[4].params.length:-1,ei=b?f[5].params.length:-1,eo=6*!!(d&&D&&w&&A&&F&&b),eu=f.length,es=f.map(e=>e.test),ea=f.map(e=>e.implementation),ec=function(){for(let e=eo;e<eu;e++)if(es[e](arguments))return ea[e].apply(this,arguments);return s.onMismatch(e,arguments,f)};function el(e,t){return arguments.length===K&&C(e)&&z(t)?G.apply(this,arguments):arguments.length===ee&&M(e)&&V(t)?Z.apply(this,arguments):arguments.length===et&&P(e)&&L(t)?$.apply(this,arguments):arguments.length===er&&j(e)&&H(t)?J.apply(this,arguments):arguments.length===en&&Y(e)&&q(t)?Q.apply(this,arguments):arguments.length===ei&&U(e)&&W(t)?X.apply(this,arguments):ec.apply(this,arguments)}try{Object.defineProperty(el,"name",{value:e})}catch(e){}return el.signatures=a,el._typedFunctionData={signatures:f,signatureMap:h},el}(i||"",o)}).create=e,s.createCount=j.createCount,s.onMismatch=M,s.throwMismatchError=M,s.createError=F,s.clear=l,s.clearConversions=function(){let e;for(e of r)t.get(e).conversionsTo=[];u=0},s.addTypes=c,s._findType=a,s.referTo=function(){let e=N(arguments).map(e=>p(g(e))),t=O(arguments);if("function"!=typeof t)throw TypeError("Callback function expected as last argument");return T(e,t)},s.referToSelf=k,s.convert=function(e,t){let r=a(t);if(r.test(e))return e;let n=r.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(a(n[t].from).test(e))return n[t].convert(e);throw Error("Cannot convert "+e+" to "+t)},s.findSignature=d,s.find=function(e,t,r){return d(e,t,r).implementation},s.isTypedFunction=h,s.warnAgainstDeprecatedThis=!0,s.addType=function(e,r){let n="any";!1!==r&&t.has("Object")&&(n="Object"),s.addTypes([e],n)},s.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};Y(e);let r=a(e.to),n=r.conversionsTo.find(t=>t.from===e.from);if(n)if(t&&t.override)s.removeConversion({from:n.from,to:e.to,convert:n.convert});else throw Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');r.conversionsTo.push({from:e.from,to:r.name,convert:e.convert,index:u++})},s.addConversions=function(e,t){e.forEach(e=>s.addConversion(e,t))},s.removeConversion=function(e){Y(e);let t=a(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,t=>t.from===e.from);if(!r)throw Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw Error("Conversion to remove does not match existing conversion");let n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},s.resolve=function(e,t){if(!h(e))throw TypeError(rk);let r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},s}();function rR(e,t){return!!e&&"object"==typeof e&&(!!tW(rj,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function rP(e){return"object"==typeof e&&e&&e.constructor===Object}var rj={length:!0,name:!0},rY={toString:!0,valueOf:!0,toLocaleString:!0};class rU{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){var t,r,n=this.wrappedObject;if(rP(n)&&rR(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||tW(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(tW(rY,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(rP(e)&&rR(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}entries(){var e,t;return e=this.keys(),t=e=>[e,this.get(e)],{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function rz(e){return!!e&&(e instanceof Map||e instanceof rU||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var rV=function(){return rV=rI.create,rI},rL=tG("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,o=rV();return o.clear(),o.addTypes([{name:"number",test:ti},{name:"Complex",test:tu},{name:"BigNumber",test:to},{name:"Fraction",test:ts},{name:"Unit",test:ta},{name:"identifier",test:e=>tc&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:tc},{name:"Chain",test:tV},{name:"Array",test:tl},{name:"Matrix",test:tf},{name:"DenseMatrix",test:td},{name:"SparseMatrix",test:tp},{name:"Range",test:tm},{name:"Index",test:tD},{name:"boolean",test:tg},{name:"ResultSet",test:ty},{name:"Help",test:tv},{name:"function",test:tw},{name:"Date",test:t_},{name:"RegExp",test:tE},{name:"null",test:tF},{name:"undefined",test:tb},{name:"AccessorNode",test:tC},{name:"ArrayNode",test:tx},{name:"AssignmentNode",test:tS},{name:"BlockNode",test:tM},{name:"ConditionalNode",test:tN},{name:"ConstantNode",test:tO},{name:"FunctionNode",test:tT},{name:"FunctionAssignmentNode",test:tB},{name:"IndexNode",test:tk},{name:"Node",test:tI},{name:"ObjectNode",test:tR},{name:"OperatorNode",test:tP},{name:"ParenthesisNode",test:tj},{name:"RangeNode",test:tY},{name:"RelationalNode",test:tU},{name:"SymbolNode",test:tz},{name:"Map",test:rz},{name:"Object",test:tA}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||rH(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||rq(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||rq(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||rq(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||rW(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||rH(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||rW(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||rq(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||rH(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||rW(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&th(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&th(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o});function rH(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function rq(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function rW(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}function rG(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return rG(e,t,r)}):t(e)}var rZ="number",r$="number, number";function rJ(e){return Math.abs(e)}function rQ(e,t){return e+t}function rX(e,t){return e-t}function rK(e,t){return e*t}function r0(e){return-e}rJ.signature=rZ,rQ.signature=r$,rX.signature=r$,rK.signature=r$,r0.signature=rZ;var r1=tG("abs",["typed"],e=>{var{typed:t}=e;return t("abs",{number:rJ,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e,!0))})}),r2="addScalar",r3=tG(r2,["typed"],e=>{var{typed:t}=e;return t(r2,{"number, number":rQ,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),r8=tG("bignumber",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw SyntaxError('String "'.concat(e,'" is out of range'));var u=new r(2).pow(Number(n)-1);return i.gte(u)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),r4="conj",r5=tG(r4,["typed"],e=>{var{typed:t}=e;return t(r4,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),r6=tG("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),r7="equalScalar",r9=tG(r7,["typed","config"],e=>{var{typed:t,config:r}=e,n=r6({typed:t});return t(r7,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return rn(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,rn(e.re,t.re,n)&&rn(e.im,t.im,n)}},n)});tG(r7,["typed","config"],e=>{var{typed:t,config:r}=e;return t(r7,{"number, number":function(e,t){return rn(e,t,r.epsilon)}})});function ne(e){return 0===e}ne.signature="number";var nt="isZero",nr=tG(nt,["typed"],e=>{var{typed:t}=e;return t(nt,{number:ne,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),nn=tG("multiplyScalar",["typed"],e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":rK,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),ni=tG("number",["typed"],e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=function(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!t)return null;var r={"0b":2,"0o":8,"0x":16}[t[1]];return{input:e,radix:r,integerPart:t[2],fractionalPart:t[3]}}(e);if(t){for(var r=parseInt(t.integerPart,t.radix),n=0,i=0;i<t.fractionalPart.length;i++)n+=parseInt(t.fractionalPart[i],t.radix)/Math.pow(t.radix,i+1);var o=r+n;if(isNaN(o))throw SyntaxError('String "'+t.input+'" is not a valid number');return o}var u=0,s=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(u=Number(s[2]),e=s[1]);var a=Number(e);if(isNaN(a))throw SyntaxError('String "'+e+'" is not a valid number');if(s){if(a>2**u-1)throw SyntaxError('String "'.concat(e,'" is out of range'));a>=2**(u-1)&&(a-=2**u)}return a},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))});return r.fromJSON=function(e){return parseFloat(e.value)},r}),no=tG("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!tc(t))throw Error("Invalid datatype: "+t);if(tf(e)){var r,n,u;r=this,n=e,u=t,"SparseMatrix"===n.type?(r._values=n._values?tH(n._values):void 0,r._index=tH(n._index),r._ptr=tH(n._ptr),r._size=tH(n._size),r._datatype=u||n._datatype):o(r,n.valueOf(),u||n._datatype)}else if(e&&tl(e.index)&&tl(e.ptr)&&tl(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(tl(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+tL(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=n.length,u=0,s=r,a=0;if(tc(i)&&(s=t.find(r,[i,i])||r,a=t.convert(0,i)),o>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<o;l++){var f=n[l];if(tl(f)){if(0===c&&u<f.length&&(u=f.length),c<f.length){var h=f[c];s(h,a)||(e._values.push(h),e._index.push(l))}}else 0===c&&u<1&&(u=1),s(f,a)||(e._values.push(f),e._index.push(l))}c++}while(c<u)}e._ptr.push(e._index.length),e._size=[o,u]}function u(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function s(e,t,r,n,i,o,u){i.splice(e,0,n),o.splice(e,0,t);for(var s=r+1;s<u.length;s++)u[s]++}function a(e,n,i,o){var u,s,a,c=o||0,l=r,f=0;tc(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var h=!l(c,f),d=e._size[0],p=e._size[1];if(i>p){for(s=p;s<i;s++)if(e._ptr[s]=e._values.length,h)for(u=0;u<d;u++)e._values.push(c),e._index.push(u);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>d){if(h){var m=0;for(s=0;s<p;s++){e._ptr[s]=e._ptr[s]+m,a=e._ptr[s+1]+m;var D=0;for(u=d;u<n;u++,D++)e._values.splice(a+D,0,c),e._index.splice(a+D,0,u),m++}e._ptr[p]=e._values.length}}else if(n<d){var g=0;for(s=0;s<p;s++){e._ptr[s]=e._ptr[s]-g;var y=e._ptr[s],v=e._ptr[s+1]-g;for(a=y;a<v;a++)(u=e._index[a])>n-1&&(e._values.splice(a,1),e._index.splice(a,1),g++)}e._ptr[s]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var o,u,s=n[0],a=n[1],c=[];for(o=0;o<s;o++)for(c[o]=[],u=0;u<a;u++)c[o][u]=0;for(u=0;u<a;u++)for(var l=r[u],f=r[u+1],h=l;h<f;h++)c[o=t[h]][u]=e?i?tH(e[h]):e[h]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return rC(this._values,tL)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!tD(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,o,u,s=t.size();if(s.length!==e._size.length)throw new rD(s.length,e._size.length);var a=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)rw(a[r],e._size[r]),rw(c[r],e._size[r]);var l=e._values,f=e._index,h=e._ptr,d=t.dimension(0),p=t.dimension(1),m=[],D=[];d.forEach(function(e,t){D[e]=t[0],m[e]=!0});var g=l?[]:void 0,y=[],v=[];return p.forEach(function(e){for(v.push(y.length),o=h[e],u=h[e+1];o<u;o++)!0===m[r=f[o]]&&(y.push(D[r]),g&&g.push(l[o]))}),v.push(y.length),new i({values:g,index:y,ptr:v,size:s,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),u=t.isScalar();if(tf(r)?(i=r.size(),r=r.toArray()):i=ry(r),u){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new rD(o.length,e._size.length,"<");if(i.length<o.length){for(var s=0,a=0;1===o[s]&&1===i[s];)s++;for(;1===o[s];)a++,s++;r=rb(r,o.length,a,i)}if(!tq(o,i))throw new rD(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){rw(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){rw(t),l.forEach(function(o,u){rw(o),e.set([t,o],r[i[0]][u[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];rw(t,this._size[0]),rw(r,this._size[1]);var n=u(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],c=e[1],l=this._size[0],f=this._size[1],h=r,d=0;tc(this._datatype)&&(h=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(a(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),rw(o,l),rw(c,f);var p=u(o,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===o?h(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:h(n,d)||s(p,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!th(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!ti(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rd(n)+")")}),a(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!tl(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!ti(t)||!t8(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+rd(e)+")")});var r=this._size[0]*this._size[1],n=(e=rA(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],a=0;a<i._ptr.length;a++)for(var c=0;c<i._ptr[a+1]-i._ptr[a];c++)o.push(a);for(var l=i._values.slice(),f=i._index.slice(),h=0;h<i._index.length;h++){var d=f[h],p=o[h],m=d*i._size[1]+p;o[h]=m%e[1],f[h]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var D=0;D<i._ptr.length;D++)i._ptr[D]=0;for(var g=0;g<l.length;g++){var y=f[g],v=o[g],w=l[g];s(u(y,i._ptr[v],i._ptr[v+1],i._index),y,v,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?tH(this._values):void 0,index:tH(this._index),ptr:tH(this._ptr),size:tH(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this,u=this._size[0],s=this._size[1],a=rM(e);return function(e,n,o,u,s){var a=[],c=[],l=[],f=r,h=0;tc(e._datatype)&&(f=t.find(r,[e._datatype,e._datatype])||r,h=t.convert(0,e._datatype));for(var d=function(e,t,r){e=u(e,t,r),f(e,h)||(a.push(e),c.push(t))},p=0;p<=o;p++){l.push(a.length);var m=e._ptr[p],D=e._ptr[p+1];if(s)for(var g=m;g<D;g++){var y=e._index[g];y>=0&&y<=n&&d(e._values[g],y-0,p-0)}else{for(var v={},w=m;w<D;w++)v[e._index[w]]=e._values[w];for(var _=0;_<=n;_++)d(_ in v?v[_]:0,_-0,p-0)}}return l.push(a.length),new i({values:a,index:c,ptr:l,size:[n-0+1,o-0+1]})}(this,u-1,s-1,function(t,r,n){return 1===a?e(t):2===a?e(t,[r,n]):e(t,[r,n],o)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],u=this._ptr[i+1];if(t)for(var s=o;s<u;s++){var a=this._index[s];e(this._values[s],[a,i],this)}else{for(var c={},l=o;l<u;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+rd(t,e)+" x "+rd(r,e)+"] density: "+rd(n,e)+"\n",o=0;o<r;o++)for(var u=this._ptr[o],s=this._ptr[o+1],a=u;a<s;a++)i+="\n ("+rd(this._index[a],e)+", "+rd(o,e)+") ==> "+(this._values?rd(this._values[a],e):"X");return i},i.prototype.toString=function(){return rd(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],u=Math.min(n-r,o-t),s=[],a=[],c=[];c[0]=0;for(var l=t;l<o&&s.length<u;l++)for(var f=this._ptr[l],h=this._ptr[l+1],d=f;d<h;d++){var p=this._index[d];if(p===l-t+r){s.push(this._values[d]),a[s.length-1]=p-r;break}}return c.push(s.length),new i({values:s,index:a,ptr:c,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,u,s){if(!tl(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(to(o)&&(o=o.toNumber()),!ti(o)||!t8(o))throw TypeError("The parameter k must be an integer number")}else o=0;var a,c=r,l=0;tc(s)&&(c=t.find(r,[s,s])||r,l=t.convert(0,s));var f=o>0?o:0,h=o<0?-o:0,d=e[0],p=e[1],m=Math.min(d-h,p-f);if(tl(n)){if(n.length!==m)throw Error("Invalid value array length");a=function(e){return n[e]}}else if(tf(n)){var D=n.size();if(1!==D.length||D[0]!==m)throw Error("Invalid matrix length");a=function(e){return n.get([e])}}else a=function(){return n};for(var g=[],y=[],v=[],w=0;w<p;w++){v.push(g.length);var _=w-f;if(_>=0&&_<m){var E=a(_);c(E,l)||(y.push(_+h),g.push(E))}}return v.push(g.length),new i({values:g,index:y,ptr:v,size:[d,p]})},i.prototype.swapRows=function(e,t){if(!ti(e)||!t8(e)||!ti(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rw(e,this._size[0]),rw(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var o=n[e],u=n[e+1],s=o;s<u;s++)i(r[s],t[s])},i._swapRows=function(e,t,r,n,i,o){for(var s=0;s<r;s++){var a=o[s],c=o[s+1],l=u(e,a,c,i),f=u(t,a,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var h=n[l];n[l]=n[f],n[f]=h}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var d=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,d),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),nu="subtractScalar",ns=tG(nu,["typed"],e=>{var{typed:t}=e;return t(nu,{"number, number":rX,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),na="unaryMinus",nc=tG(na,["typed"],e=>{var{typed:t}=e;return t(na,{number:r0,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e,!0))})}),nl=tG("fraction",["typed","Fraction"],e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),nf="matrix",nh=tG(nf,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(nf,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}});function nd(){throw Error('No "bignumber" implementation available')}function np(){throw Error('No "fraction" implementation available')}var nm=tG("numeric",["number","?bignumber","?fraction"],e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):nd,Fraction:n?e=>n(e):np};return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=arguments.length>2?arguments[2]:void 0;if(void 0!==r)throw SyntaxError("numeric() takes one or two arguments");var n=tL(e);if(!(n in i))throw TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}}),nD="size",ng=tG(nD,["typed","config","?matrix"],e=>{var{typed:t,config:r,matrix:n}=e;return t(nD,{Matrix:function(e){return e.create(e.size())},Array:ry,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):function(){throw Error('No "matrix" implementation available')}()}})}),ny="divideScalar",nv=tG(ny,["typed","numeric"],e=>{var{typed:t,numeric:r}=e;return t(ny,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),nw="identity",n_=tG(nw,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:u}=e;return t(nw,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return a(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return a(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return a(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return a(e,t,r)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return a(e[0],e[0],t);case 2:return a(e[0],e[1],t);default:throw Error("Vector containing two values expected")}}function a(e,t,r){var n=to(e)||to(t)?i:null;if(to(e)&&(e=e.toNumber()),to(t)&&(t=t.toNumber()),!t8(e)||e<1||!t8(t)||t<1)throw Error("Parameters in function identity must be positive integers");var s=n?new i(1):1,a=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return u.diagonal(c,s,0,a);if("dense"===r)return o.diagonal(c,s,0,a);throw TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=r_([],c,a),f=e<t?e:t,h=0;h<f;h++)l[h][h]=s;return l}}),nE=tG("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){var a=u(e,o),c=tf(e)?e._data:e,l=tf(e)?e._datatype||e.getDataType():void 0,f=tf(o)?o._data:o,h=tf(o)?o._datatype||o.getDataType():void 0,d=2===s(e).length,p=2===s(o).length,m=r,D=n;if(l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(m=t.find(r,[l,l]),D=t.find(n,[l,l])),!d&&!p){for(var g=D(i(c[0]),f[0]),y=1;y<a;y++)g=m(g,D(i(c[y]),f[y]));return g}if(!d&&p){for(var v=D(i(c[0]),f[0][0]),w=1;w<a;w++)v=m(v,D(i(c[w]),f[w][0]));return v}if(d&&!p){for(var _=D(i(c[0][0]),f[0]),E=1;E<a;E++)_=m(_,D(i(c[E][0]),f[E]));return _}if(d&&p){for(var A=D(i(c[0][0]),f[0][0]),F=1;F<a;F++)A=m(A,D(i(c[F][0]),f[F][0]));return A}},"SparseMatrix, SparseMatrix":function(e,t){u(e,t);for(var i=e._index,o=e._values,s=t._index,a=t._values,c=0,l=0,f=0;l<i.length&&f<s.length;){var h=i[l],d=s[f];if(h<d){l++;continue}if(h>d){f++;continue}h===d&&(c=r(c,n(o[l],a[f])),l++,f++)}return c}});function u(e,t){var r,n,i=s(e),o=s(t);if(1===i.length)r=i[0];else if(2===i.length&&1===i[1])r=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===o.length)n=o[0];else if(2===o.length&&1===o[1])n=o[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+o.join(", ")+")");if(r!==n)throw RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw RangeError("Cannot calculate the dot product of empty vectors");return r}function s(e){return tf(e)?e.size():o(e)}}),nA=tG("matAlgo11xS0s",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,o){var u,s=e._values,a=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!s)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=l[0],d=l[1],p=r,m=0,D=i;"string"==typeof f&&(u=f,p=t.find(r,[u,u]),m=t.convert(0,u),n=t.convert(n,u),D=t.find(i,[u,u]));for(var g=[],y=[],v=[],w=0;w<d;w++){v[w]=y.length;for(var _=c[w],E=c[w+1],A=_;A<E;A++){var F=a[A],b=o?D(n,s[A]):D(s[A],n);p(b,m)||(y.push(F),g.push(b))}}return v[d]=y.length,e.createSparseMatrix({values:g,index:y,ptr:v,size:[h,d],datatype:u})}}),nF=tG("matAlgo14xDs",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var o,u=e._data,s=e._size,a=e._datatype,c=n;"string"==typeof a&&(o=a,r=t.convert(r,o),c=t.find(n,[o,o]));var l=s.length>0?function e(t,r,n,i,o,u,s){var a=[];if(r===n.length-1)for(var c=0;c<i;c++)a[c]=s?t(u,o[c]):t(o[c],u);else for(var l=0;l<i;l++)a[l]=e(t,r+1,n,n[r+1],o[l],u,s);return a}(c,0,s,s[0],u,r,i):[];return e.createDenseMatrix({data:l,size:tH(s),datatype:o})}}),nb="multiply",nC=tG(nb,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:u}=e,s=nA({typed:t,equalScalar:o}),a=nF({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._datatype||r.getDataType(),f=s[0],h=s[1],d=n,p=i;a&&l&&a===l&&"string"==typeof a&&"mixed"!==a&&(o=a,d=t.find(n,[o,o]),p=t.find(i,[o,o]));for(var m=[],D=0;D<f;D++){for(var g=u[D],y=p(g[0],c[0]),v=1;v<h;v++)y=d(y,p(g[v],c[v]));m[D]=y}return e.createDenseMatrix({data:m,size:[f],datatype:a===e._datatype&&l===r._datatype?o:void 0})},"SparseMatrix, any":function(e,r){var u,s=e._values,a=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=[],D=[],g=[],y=n,v=i,w=o,_=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,y=t.find(n,[u,u]),v=t.find(i,[u,u]),w=t.find(o,[u,u]),_=t.convert(0,u));var E=[],A=[];g[0]=0;for(var F=0;F<p;F++){var b=f[F];if(!w(b,_))for(var C=c[F],x=c[F+1],S=C;S<x;S++){var M=a[S];A[M]?E[M]=y(E[M],v(b,s[S])):(A[M]=!0,D.push(M),E[M]=v(b,s[S]))}}for(var N=D.length,O=0;O<N;O++){var B=D[O];m[O]=E[B]}return g[1]=D.length,e.createSparseMatrix({values:m,index:D,ptr:g,size:[d,1],datatype:l===e._datatype&&h===r._datatype?u:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=s[0],d=s[1],p=l[1],m=n,D=i;a&&f&&a===f&&"string"==typeof a&&"mixed"!==a&&"mixed"!==a&&(o=a,m=t.find(n,[o,o]),D=t.find(i,[o,o]));for(var g=[],y=0;y<h;y++){var v=u[y];g[y]=[];for(var w=0;w<p;w++){for(var _=D(v[0],c[0][w]),E=1;E<d;E++)_=m(_,D(v[E],c[E][w]));g[y][w]=_}}return e.createDenseMatrix({data:g,size:[h,p],datatype:a===e._datatype&&f===r._datatype?o:void 0})},"DenseMatrix, SparseMatrix":function(e,r){var u,s=e._data,a=e._size,c=e._datatype||e.getDataType(),l=r._values,f=r._index,h=r._ptr,d=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!l)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var m=a[0],D=d[1],g=n,y=i,v=o,w=0;c&&p&&c===p&&"string"==typeof c&&"mixed"!==c&&(u=c,g=t.find(n,[u,u]),y=t.find(i,[u,u]),v=t.find(o,[u,u]),w=t.convert(0,u));for(var _=[],E=[],A=[],F=r.createSparseMatrix({values:_,index:E,ptr:A,size:[m,D],datatype:c===e._datatype&&p===r._datatype?u:void 0}),b=0;b<D;b++){A[b]=E.length;var C=h[b],x=h[b+1];if(x>C)for(var S=0,M=0;M<m;M++){for(var N=M+1,O=void 0,B=C;B<x;B++){var T=f[B];S!==N?(O=y(s[M][T],l[B]),S=N):O=g(O,y(s[M][T],l[B]))}S!==N||v(O,w)||(E.push(M),_.push(O))}}return A[D]=E.length,F},"SparseMatrix, DenseMatrix":function(e,r){var u,s=e._values,a=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=r._size[1],D=n,g=i,y=o,v=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,D=t.find(n,[u,u]),g=t.find(i,[u,u]),y=t.find(o,[u,u]),v=t.convert(0,u));for(var w=[],_=[],E=[],A=e.createSparseMatrix({values:w,index:_,ptr:E,size:[d,m],datatype:l===e._datatype&&h===r._datatype?u:void 0}),F=[],b=[],C=0;C<m;C++){E[C]=_.length;for(var x=C+1,S=0;S<p;S++){var M=f[S][C];if(!y(M,v))for(var N=c[S],O=c[S+1],B=N;B<O;B++){var T=a[B];b[T]!==x?(b[T]=x,_.push(T),F[T]=g(M,s[B])):F[T]=D(F[T],g(M,s[B]))}}for(var k=E[C],I=_.length,R=k;R<I;R++){var P=_[R];w[R]=F[P]}}return E[m]=_.length,A},"SparseMatrix, SparseMatrix":function(e,r){var o,u,s,a,c,l,f,h,d,p=e._values,m=e._index,D=e._ptr,g=e._datatype||void 0===e._data?e._datatype:e.getDataType(),y=r._values,v=r._index,w=r._ptr,_=r._datatype||void 0===r._data?r._datatype:r.getDataType(),E=e._size[0],A=r._size[1],F=p&&y,b=n,C=i;g&&_&&g===_&&"string"==typeof g&&"mixed"!==g&&(o=g,b=t.find(n,[o,o]),C=t.find(i,[o,o]));for(var x=F?[]:void 0,S=[],M=[],N=e.createSparseMatrix({values:x,index:S,ptr:M,size:[E,A],datatype:g===e._datatype&&_===r._datatype?o:void 0}),O=F?[]:void 0,B=[],T=0;T<A;T++){M[T]=S.length;var k=T+1;for(l=w[T],f=w[T+1],c=l;c<f;c++)if(d=v[c],F)for(s=D[d],a=D[d+1],u=s;u<a;u++)B[h=m[u]]!==k?(B[h]=k,S.push(h),O[h]=C(y[c],p[u])):O[h]=b(O[h],C(y[c],p[u]));else for(s=D[d],a=D[d+1],u=s;u<a;u++)B[h=m[u]]!==k&&(B[h]=k,S.push(h));if(F)for(var I=M[T],R=S.length,P=I;P<R;P++){var j=S[P];x[P]=O[j]}}return M[A]=S.length,N}});return t(nb,i,{"Array, Array":t.referTo("Matrix, Matrix",e=>(t,n)=>{c(ry(t),ry(n));var i=e(r(t),r(n));return tf(i)?i.valueOf():i}),"Matrix, Matrix":function(e,r){var o=e.size(),s=r.size();if(c(o,s),1===o.length){if(1===s.length){if(0===o[0])throw Error("Cannot multiply two empty vectors");return u(e,r)}if("dense"!==r.storage())throw Error("Support for SparseMatrix not implemented");return function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=s[0],d=l[1],p=n,m=i;a&&f&&a===f&&"string"==typeof a&&"mixed"!==a&&(o=a,p=t.find(n,[o,o]),m=t.find(i,[o,o]));for(var D=[],g=0;g<d;g++){for(var y=m(u[0],c[0][g]),v=1;v<h;v++)y=p(y,m(u[v],c[v][g]));D[g]=y}return e.createDenseMatrix({data:D,size:[d],datatype:a===e._datatype&&f===r._datatype?o:void 0})}(e,r)}return 1===s.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",e=>(t,n)=>e(t,r(n))),"Array, Matrix":t.referToSelf(e=>(t,n)=>e(r(t,n.storage()),n)),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return a(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return a(t,e,i,!0)},"Array, any":function(e,t){return a(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return a(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,r,n)=>{for(var i=e(t,r),o=0;o<n.length;o++)i=e(i,n[o]);return i})})}),nx=tG("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:u,unaryMinus:s}=e;return t("det",{any:function(e){return tH(e)},"Array | Matrix":function(e){var t;switch((t=tf(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return tH(e);case 1:if(1===t[0])return tH(e.valueOf()[0]);if(0===t[0])return 1;throw RangeError("Matrix must be square (size: "+rd(t)+")");case 2:var a=t[0],c=t[1];if(a===c)return function(e,t){if(1===t)return tH(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var r=!1,a=Array(t).fill(0).map((e,t)=>t),c=0;c<t;c++){var l=a[c];if(u(e[l][c])){var f=void 0;for(f=c+1;f<t;f++)if(!u(e[a[f]][c])){l=a[f],a[f]=a[c],a[c]=l,r=!r;break}if(f===t)return e[l][c]}for(var h=e[l][c],d=0===c?1:e[a[c-1]][c-1],p=c+1;p<t;p++)for(var m=a[p],D=c+1;D<t;D++)e[m][D]=o(n(i(e[m][D],h),i(e[m][c],e[l][D])),d)}var g=e[a[t-1]][t-1];return r?s(g):g}(e.clone().valueOf(),a);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+rd(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rd(t)+")")}}})}),nS=tG("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:u,det:s,identity:a,abs:c}=e;return t("inv",{"Array | Matrix":function(e){var t=tf(e)?e.size():ry(e);switch(t.length){case 1:if(1===t[0])if(tf(e))return r([n(1,e.valueOf()[0])]);else return[n(1,e[0])];throw RangeError("Matrix must be square (size: "+rd(t)+")");case 2:var i=t[0],o=t[1];if(i===o)if(tf(e))return r(l(e.valueOf(),i,o),e.storage());else return l(e,i,o);throw RangeError("Matrix must be square (size: "+rd(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rd(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){if(1===t){if(0===(d=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,d)]]}if(2===t){var l,f,h,d,p,m=s(e);if(0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],m),n(u(e[0][1]),m)],[n(u(e[1][0]),m),n(e[0][0],m)]]}var D=e.concat();for(l=0;l<t;l++)D[l]=D[l].concat();for(var g=a(t).valueOf(),y=0;y<r;y++){var v=c(D[y][y]),w=y;for(l=y+1;l<t;)c(D[l][y])>v&&(v=c(D[l][y]),w=l),l++;if(0===v)throw Error("Cannot calculate inverse, determinant is zero");(l=w)!==y&&(p=D[y],D[y]=D[l],D[l]=p,p=g[y],g[y]=g[l],g[l]=p);var _=D[y],E=g[y];for(l=0;l<t;l++){var A=D[l],F=g[l];if(l!==y){if(0!==A[y]){for(h=n(u(A[y]),_[y]),f=y;f<r;f++)A[f]=i(A[f],o(h,_[f]));for(f=0;f<r;f++)F[f]=i(F[f],o(h,E[f]))}}else{for(h=_[y],f=y;f<r;f++)A[f]=n(A[f],h);for(f=0;f<r;f++)F[f]=n(F[f],h)}}}return g}}),nM=t$({config:k}),nN=ru({}),nO=ra({}),nB=rc({}),nT=rN({Matrix:nB}),nk=rL({BigNumber:nM,Complex:nN,DenseMatrix:nT,Fraction:nO}),nI=r1({typed:nk}),nR=r3({typed:nk}),nP=r8({BigNumber:nM,typed:nk}),nj=r5({typed:nk}),nY=r9({config:k,typed:nk}),nU=nr({typed:nk}),nz=nn({typed:nk}),nV=ni({typed:nk}),nL=no({Matrix:nB,equalScalar:nY,typed:nk}),nH=ns({typed:nk}),nq=nc({typed:nk}),nW=nl({Fraction:nO,typed:nk}),nG=nh({DenseMatrix:nT,Matrix:nB,SparseMatrix:nL,typed:nk}),nZ=nm({bignumber:nP,fraction:nW,number:nV}),n$=ng({matrix:nG,config:k,typed:nk}),nJ=nv({numeric:nZ,typed:nk}),nQ=n_({BigNumber:nM,DenseMatrix:nT,SparseMatrix:nL,config:k,matrix:nG,typed:nk}),nX=nE({addScalar:nR,conj:nj,multiplyScalar:nz,size:n$,typed:nk}),nK=nC({addScalar:nR,dot:nX,equalScalar:nY,matrix:nG,multiplyScalar:nz,typed:nk}),n0=nS({abs:nI,addScalar:nR,det:nx({divideScalar:nJ,isZero:nU,matrix:nG,multiply:nK,subtractScalar:nH,typed:nk,unaryMinus:nq}),divideScalar:nJ,identity:nQ,matrix:nG,multiply:nK,typed:nk,unaryMinus:nq});function n1(e,t){var r;let n=!1;Array.isArray(e[0])||(e=[e],n=!0);let i=t[t.length-1],o=i.ImageOrientationSlide,u=(r=i).PixelSpacing?r.PixelSpacing:r.SharedFunctionalGroupsSequence[0].PixelMeasuresSequence[0].PixelSpacing,s=i.TotalPixelMatrixOriginSequence[0],a=[Number(s.XOffsetInSlideCoordinateSystem),Number(s.YOffsetInSlideCoordinateSystem)];return(e=e.map(e=>{let t=function(e){if(!("offset"in e))throw Error('Option "offset" is required.');if(!Array.isArray(e.offset))throw Error('Option "offset" must be an array.');if(2!==e.offset.length)throw Error('Option "offset" must be an array with 2 elements.');let t=e.offset;if(!("orientation"in e))throw Error('Option "orientation" is required.');if(!Array.isArray(e.orientation))throw Error('Option "orientation" must be an array.');if(6!==e.orientation.length)throw Error('Option "orientation" must be an array with 6 elements.');let r=e.orientation;if(!("spacing"in e))throw Error('Option "spacing" is required.');if(!Array.isArray(e.spacing))throw Error('Option "spacing" must be an array.');if(2!==e.spacing.length)throw Error('Option "spacing" must be an array with 2 elements.');let n=e.spacing;if(!("point"in e))throw Error('Option "point" is required.');if(!Array.isArray(e.point))throw Error('Option "point" must be an array.');if(2!==e.point.length)throw Error('Option "point" must be an array with 2 elements.');let i=e.point,o=nK(n0([[r[0]*n[1],r[3]*n[0],t[0]],[r[1]*n[1],r[4]*n[0],t[1]],[0,0,1]]),[[i[0]],[i[1]],[1]]),u=Number(o[1][0].toFixed(4));return[Number(o[0][0].toFixed(4)),u]}({offset:a,orientation:o,spacing:u,point:[e[0],e[1]]});return[t[0],-(t[1]+1),0]}),n)?e[0]:e}let n2={color:"rgba(255,255,255,0.4)"},n3={color:"rgba(255,255,255,0.0)"},n8={color:"rgb(0,255,0)",width:1.5},n4={color:"rgb(255,255,0)",width:1.5},n5={image:{circle:{fill:n2,stroke:n4,radius:5}},fill:n2,stroke:n4},n6={image:{circle:{fill:n3,stroke:n8,radius:5}},fill:n3,stroke:n8},n7="dicommicroscopyviewer_roi_added",n9="dicommicroscopyviewer_roi_modified",ie="dicommicroscopyviewer_roi_removed",it="dicommicroscopyviewer_roi_selected",ir={ADDED:"added",MODIFIED:"modified",REMOVED:"removed",UPDATED:"updated",SELECTED:"selected"};class ii extends o.PubSubService{constructor(e,t,r,n,i){super(ir),this.viewer=e,this.viewportId=t,this.container=r,this.studyInstanceUID=n,this.seriesInstanceUID=i,this.onRoiAdded=this.roiAddedHandler.bind(this),this.onRoiModified=this.roiModifiedHandler.bind(this),this.onRoiRemoved=this.roiRemovedHandler.bind(this),this.onRoiSelected=this.roiSelectedHandler.bind(this),this.contextMenuCallback=()=>{};const o=Object.getOwnPropertySymbols(this.viewer);this._drawingSource=o.find(e=>"drawingSource"===e.description),this._pyramid=o.find(e=>"pyramid"===e.description),this._map=o.find(e=>"map"===e.description),this._affine=o.find(e=>"affine"===e.description),this.registerEvents(),this.activateDefaultInteractions()}addContextMenuCallback(e){this.contextMenuCallback=e}destroy(){this.unregisterEvents()}publish(e,t){this._broadcastEvent(e,{roiGraphic:t,managedViewer:this})}registerEvents(){this.container.addEventListener(n7,this.onRoiAdded),this.container.addEventListener(n9,this.onRoiModified),this.container.addEventListener(ie,this.onRoiRemoved),this.container.addEventListener(it,this.onRoiSelected)}unregisterEvents(){this.container.removeEventListener(n7,this.onRoiAdded),this.container.removeEventListener(n9,this.onRoiModified),this.container.removeEventListener(ie,this.onRoiRemoved),this.container.removeEventListener(it,this.onRoiSelected)}roiAddedHandler(e){let t=e.detail.payload;this.publish(ir.ADDED,t),this.publish(ir.UPDATED,t)}roiModifiedHandler(e){let t=e.detail.payload;this.publish(ir.MODIFIED,t),this.publish(ir.UPDATED,t)}roiRemovedHandler(e){let t=e.detail.payload;this.publish(ir.REMOVED,t),this.publish(ir.UPDATED,t)}roiSelectedHandler(e){let t=e.detail.payload;this.publish(ir.SELECTED,t)}runSilently(e){this.unregisterEvents(),e(),this.registerEvents()}clearRoiGraphics(){this.runSilently(()=>this.viewer.removeAllROIs())}showROIs(){this.viewer.showROIs()}hideROIs(){this.viewer.hideROIs()}addRoiGraphic(e){this.runSilently(()=>this.viewer.addROI(e,n6))}addRoiGraphicWithLabel(e,t){this.runSilently(()=>this.viewer.addROI(e,n6)),this._broadcastEvent(ir.ADDED,{roiGraphic:e,managedViewer:this,label:t})}setROIStyle(e,t){this.viewer.setROIStyle(e,t)}removeRoiGraphic(e){this.viewer.removeROI(e)}updateROIProperties({uid:e,properties:t}){this.viewer.updateROI({uid:e,properties:t})}toggleOverviewMap(){this.viewer.toggleOverviewMap()}activateDefaultInteractions(){document.querySelector(".DicomMicroscopyViewer").addEventListener("contextmenu",e=>{e.preventDefault()},!1),this.activateInteractions([["dragPan",{bindings:{mouseButtons:["middle"]}}],["dragZoom",{bindings:{mouseButtons:["right"]}}],["modify",{}]])}activateInteractions(e){let t={draw:e=>e?"activateDrawInteraction":"deactivateDrawInteraction",modify:e=>e?"activateModifyInteraction":"deactivateModifyInteraction",translate:e=>e?"activateTranslateInteraction":"deactivateTranslateInteraction",snap:e=>e?"activateSnapInteraction":"deactivateSnapInteraction",dragPan:e=>e?"activateDragPanInteraction":"deactivateDragPanInteraction",dragZoom:e=>e?"activateDragZoomInteraction":"deactivateDragZoomInteraction",select:e=>e?"activateSelectInteraction":"deactivateSelectInteraction"};Object.keys(t).forEach(r=>{let n=e.find(e=>e[0]===r);if(n){let[e,r]=n,i=t[e](!0);this.viewer[i](r)}else{let e=t[r](!1);this.viewer[e]()}})}_getMapView(){return this._getMap().getView()}_getMap(){let e=Object.getOwnPropertySymbols(this.viewer).find(e=>"Symbol(map)"===String(e));return window.map=this.viewer[e],this.viewer[e]}getViewState(){let e=this._getMapView();return{center:e.getCenter(),resolution:e.getResolution(),zoom:e.getZoom()}}setViewState(e){let t=this._getMapView();t.setZoom(e.zoom),t.setResolution(e.resolution),t.setCenter(e.center)}setViewStateByExtent(e){let t=e.getCoordinates();Array.isArray(t[0])&&!t[2]?this._jumpToPolyline(t):Array.isArray(t[0])?this._jumpToPolygonOrEllipse(t):this._jumpToPoint(t)}_jumpToPoint(e){let t=n1(e,this.viewer[this._pyramid].metadata);this._getMapView().setCenter(t)}_jumpToPolyline(e){let t=n1(e,this.viewer[this._pyramid].metadata),r=this._getMapView(),n=t[0],i=t[1],o=(n[0]+i[0])/2,u=(n[1]+i[1])/2;r.setCenter([o,u])}_jumpToPolygonOrEllipse(e){let t=this.viewer[this._pyramid].metadata,r=1/0,n=-1/0,i=1/0,o=-1/0;e.forEach(e=>{let[u,s]=n1(e,t);u<r?r=u:u>n&&(n=u),s<i?i=s:s>o&&(o=s)});let u=n-r,s=o-i;r-=.5*u,n+=.5*u,i-=.5*s,o+=.5*s;let a=this._getMap();a.getView().fit([r,i,n,o],a.getSize())}}var io=a(545),iu=a.n(io);let is={LABEL_UPDATED:"labelUpdated",GRAPHIC_UPDATED:"graphicUpdated",VIEW_UPDATED:"viewUpdated",REMOVED:"removed"};class ia extends o.PubSubService{constructor(e,t,r,n="",i=null){super(is),this.uid=e.uid,this.roiGraphic=e,this.studyInstanceUID=t,this.seriesInstanceUID=r,this.label=n,this.viewState=i,this.setMeasurements(e)}getScoord3d(){let e=this.roiGraphic,t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(scoord3d)"===String(e));return e[t]}getCoordinates(){let e=this.getScoord3d(),t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(coordinates)"===String(e));return e[t]}destroy(){this._broadcastEvent(is.REMOVED,this)}setRoiGraphic(e){this.roiGraphic=e,this.setMeasurements(),this._broadcastEvent(is.GRAPHIC_UPDATED,this)}setMeasurements(){let e=this.roiGraphic.scoord3d.graphicType,t=this.roiGraphic.scoord3d.graphicData;switch(e){case"ELLIPSE":let r=t[0],n=t[1],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o;let u=Math.sqrt(i+o),s=u/2,a=Math.PI*s*s;this._area=a,this._length=void 0;break;case"POLYGON":let c=function(e){let t=e.length,r=0,n=t-1;for(let i=0;i<t;i++)r+=(e[n][0]+e[i][0])*(e[n][1]-e[i][1]),n=i;return Math.abs(r/2)}(t);this._area=c,this._length=void 0;break;case"POINT":this._area=void 0,this._length=void 0;break;case"POLYLINE":let l=0;for(let e=1;e<t.length;e++){let r=t[e-1],n=t[e],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o,l+=Math.sqrt(i+o)}this._area=void 0,this._length=l}}setViewState(e){this.viewState=e,this._broadcastEvent(is.VIEW_UPDATED,this)}setLabel(e,t){this.label=e||t&&t.CodeMeaning,this.finding=t||{CodingSchemeDesignator:"@ohif/extension-dicom-microscopy",CodeValue:e,CodeMeaning:e},this._broadcastEvent(is.LABEL_UPDATED,this)}getLabel(){return this.label?`${this.label}`:""}getDetailedLabel(){let e=iu()?.t("MeasurementTable:empty")||"(empty)";return this.label?`${this.label}`:e}getLength(){return this._length}getArea(){return this._area}}let ic={ANNOTATION_UPDATED:"annotationUpdated",ANNOTATION_SELECTED:"annotationSelected",ANNOTATION_REMOVED:"annotationRemoved",RELABEL:"relabel",DELETE:"delete"};class il extends o.PubSubService{constructor({servicesManager:e,extensionManager:t}){super(ic),this.servicesManager=void 0,this.managedViewers=new Set,this.roiUids=new Set,this.annotations={},this.selectedAnnotation=null,this.pendingFocus=!1,this.servicesManager=e,this.peerImport=t.appConfig.peerImport,this._onRoiAdded=this._onRoiAdded.bind(this),this._onRoiModified=this._onRoiModified.bind(this),this._onRoiRemoved=this._onRoiRemoved.bind(this),this._onRoiUpdated=this._onRoiUpdated.bind(this),this._onRoiSelected=this._onRoiSelected.bind(this),this.isROIsVisible=!0}clear(){for(let e in this.managedViewers.forEach(e=>e.destroy()),this.managedViewers.clear(),this.annotations)delete this.annotations[e];this.roiUids.clear(),this.selectedAnnotation=null,this.pendingFocus=!1}clearAnnotations(){Object.keys(this.annotations).forEach(e=>{this.removeAnnotation(this.annotations[e])})}importDicomMicroscopyViewer(){return this.peerImport("dicom-microscopy-viewer")}_onRoiAdded(e){let{roiGraphic:t,managedViewer:r,label:n}=e,{studyInstanceUID:i,seriesInstanceUID:o}=r,u=new ia(t,i,o,"",r.getViewState());this.roiUids.add(t.uid),this.annotations[t.uid]=u,u.subscribe(is.LABEL_UPDATED,()=>{this._broadcastEvent(ic.ANNOTATION_UPDATED,u)}),void 0!==n?u.setLabel(n):this.triggerRelabel(u,!0,e=>r.updateROIProperties({uid:t.uid,properties:{label:e.label,finding:e.finding}}))}_onRoiModified(e){let{roiGraphic:t,managedViewer:r}=e,n=this.getAnnotation(t.uid);n&&(n.setRoiGraphic(t),n.setViewState(r.getViewState()))}_onRoiRemoved(e){let{roiGraphic:t}=e;this.roiUids.delete(t.uid),this.annotations[t.uid].destroy(),delete this.annotations[t.uid],this._broadcastEvent(ic.ANNOTATION_REMOVED,t)}_onRoiUpdated(e){let{roiGraphic:t,managedViewer:r}=e;this.synchronizeViewers(r),this._broadcastEvent(ic.ANNOTATION_UPDATED,this.getAnnotation(t.uid))}_onRoiSelected(e){let{roiGraphic:t}=e,r=this.getAnnotation(t.uid);r&&r!==this.getSelectedAnnotation()&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=r,this._broadcastEvent(ic.ANNOTATION_SELECTED,r))}_addManagedViewerSubscriptions(e){e._roiAddedSubscription=e.subscribe(ir.ADDED,this._onRoiAdded),e._roiModifiedSubscription=e.subscribe(ir.MODIFIED,this._onRoiModified),e._roiRemovedSubscription=e.subscribe(ir.REMOVED,this._onRoiRemoved),e._roiUpdatedSubscription=e.subscribe(ir.UPDATED,this._onRoiUpdated),e._roiSelectedSubscription=e.subscribe(ir.UPDATED,this._onRoiSelected)}_removeManagedViewerSubscriptions(e){e._roiAddedSubscription&&e._roiAddedSubscription.unsubscribe(),e._roiModifiedSubscription&&e._roiModifiedSubscription.unsubscribe(),e._roiRemovedSubscription&&e._roiRemovedSubscription.unsubscribe(),e._roiUpdatedSubscription&&e._roiUpdatedSubscription.unsubscribe(),e._roiSelectedSubscription&&e._roiSelectedSubscription.unsubscribe(),e._roiAddedSubscription=null,e._roiModifiedSubscription=null,e._roiRemovedSubscription=null,e._roiUpdatedSubscription=null,e._roiSelectedSubscription=null}_getManagedViewersForSeries(e,t){return Array.from(this.managedViewers).filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getManagedViewersForStudy(e){return Array.from(this.managedViewers).filter(t=>t.studyInstanceUID===e)}getManagedViewersForViewport(e){return Array.from(this.managedViewers).filter(t=>t.viewportId===e)}_restoreAnnotations(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e;this.getAnnotationsForSeries(t,r).forEach(t=>{e.addRoiGraphic(t.roiGraphic)})}addViewer(e,t,r,n,i){let o=Array.from(this.managedViewers).find(e=>e.viewportId===t);o&&this.removeViewer(o.viewer);let u=new ii(e,t,r,n,i);return this._restoreAnnotations(u),e._manager=u,this.managedViewers.add(u),this._addManagedViewerSubscriptions(u),this.pendingFocus&&(this.pendingFocus=!1,this.focusAnnotation(this.selectedAnnotation,t)),u}_potentiallyLoadSR(e,t){let r=o.DicomMetadataStore.getStudy(e),n=t.find(e=>"SM"===e.Modality),{FrameOfReferenceUID:i,othersFrameOfReferenceUID:u}=n;if(!r)return;let s=i?t.filter(e=>e.ReferencedFrameOfReferenceUID===i||u.includes(e.ReferencedFrameOfReferenceUID)):[];if(!s.length||(s=s.filter(e=>"SR"===e.Modality)).some(e=>!0===e.isLoaded))return;let a=0,c=s[0];s.forEach(e=>{let t=Number(`${e.SeriesDate}${e.SeriesTime}`);t>a&&(a=t,c=e)}),c.isLoading||(c.isLoading=!0,c.load(n))}removeViewer(e){let t=e._manager;this._removeManagedViewerSubscriptions(t),t.destroy(),this.managedViewers.delete(t)}toggleROIsVisibility(){this.isROIsVisible?this.hideROIs():this.showROIs,this.isROIsVisible=!this.isROIsVisible}hideROIs(){this.managedViewers.forEach(e=>e.hideROIs())}showROIs(){this.managedViewers.forEach(e=>e.showROIs())}getAnnotation(e){return this.annotations[e]}getAnnotations(){let e=[];return Object.keys(this.annotations).forEach(t=>{e.push(this.getAnnotation(t))}),e}getAnnotationsForStudy(e){return this.getAnnotations().filter(t=>t.studyInstanceUID===e)}getAnnotationsForSeries(e,t){return this.getAnnotations().filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getSelectedAnnotation(){return this.selectedAnnotation}clearSelection(){this.selectedAnnotation&&this.setROIStyle(this.selectedAnnotation.uid,{stroke:{color:"#00ff00"}}),this.selectedAnnotation=null}selectAnnotation(e){this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this._broadcastEvent(ic.ANNOTATION_SELECTED,e),this.setROIStyle(e.uid,n5)}toggleOverviewMap(e){let t=Array.from(this.managedViewers).find(t=>t.viewportId===e);t&&t.toggleOverviewMap()}removeAnnotation(e){let{uid:t,studyInstanceUID:r,seriesInstanceUID:n}=e;Array.from(this.managedViewers).filter(e=>e.studyInstanceUID===r&&e.seriesInstanceUID===n).forEach(e=>e.removeRoiGraphic(t)),this.annotations[t]&&(this.roiUids.delete(t),this.annotations[t].destroy(),delete this.annotations[t],this._broadcastEvent(ic.ANNOTATION_REMOVED,e))}focusAnnotation(e,t){let r=Array.from(this.managedViewers).find(e=>e.viewportId===t);r?r.setViewStateByExtent(e):this.pendingFocus=!0}synchronizeViewers(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e,n=this._getManagedViewersForSeries(t,r);n.forEach(e=>this._removeManagedViewerSubscriptions(e)),n.forEach(n=>{if(n===e)return;let i=this.getAnnotationsForSeries(t,r);n.clearRoiGraphics(),i.forEach(e=>{n.addRoiGraphic(e.roiGraphic)})}),n.forEach(e=>this._addManagedViewerSubscriptions(e))}activateInteractions(e){this.managedViewers.forEach(t=>t.activateInteractions(e)),this.activeInteractions=e}getActiveInteractions(){return this.activeInteractions}triggerRelabel(e,t=!1,r){r||(r=({label:t})=>this.managedViewers.forEach(r=>r.updateROIProperties({uid:e.uid,properties:{label:t}}))),this._broadcastEvent(ic.RELABEL,{roiAnnotation:e,deleteCallback:()=>this.removeAnnotation(e),successCallback:r,newAnnotation:t})}triggerDelete(e){this._broadcastEvent(ic.DELETE,e)}setROIStyle(e,t){this.managedViewers.forEach(r=>r.setROIStyle(e,t))}getAllManagedViewers(){return Array.from(this.managedViewers)}}il.REGISTRATION=e=>({name:"microscopyService",altName:"MicroscopyService",create:e=>new il(e)});var ih=a(111),id=a.n(ih),ip=a(870);let{downloadDicom:im}=o.utils,{datasetToBuffer:iD}=id().data,ig=(e,t)=>{let r=1;if("km"==t||!t&&e>1e6)t="km",r=1e-6;else if("m"==t||!t&&e>1e3)t="m",r=.001;else if("μm"==t||!t&&e<1)t="μm",r=1e3;else if(t&&"mm"!=t)throw Error(`Unknown length unit ${t}`);else t="mm";return`${(e*r).toFixed(2)} ${t}`};function iy(){}function iv(){}function iw(){}let i_=(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,u=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(i,M),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,i=(0,r.useContext)(m)||{},o=i.i18n,u=i.defaultNS,a=n||o||I;if(a&&!a.reportNamespaces&&(a.reportNamespaces=new D),!a){E("You will need to pass in an i18next instance by using initReactI18next");var c=function(e,t){return"string"==typeof t?t:t&&"object"===s(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},l=[c,{},!1];return l.t=c,l.i18n={},l.ready=!1,l}a.options.react&&void 0!==a.options.react.wait&&E("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=x(x(x({},p),a.options.react),t),h=f.useSuspense,d=f.keyPrefix,g=e||u||a.options&&a.options.defaultNS;g="string"==typeof g?[g]:g||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(g);var v=(a.isInitialized||a.initializedStoreOnce)&&g.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var u=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!u(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||u(n,e)&&(!i||u(o,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(E("i18n.languages were undefined or empty",t.languages),!0)}(e,a,f)});function w(){return a.getFixedT(t.lng||null,"fallback"===f.nsMode?g:g[0],d)}var _=y((0,r.useState)(w),2),A=_[0],C=_[1],M=g.join();t.lng&&(M="".concat(t.lng).concat(M));var N=S(M),O=(0,r.useRef)(!0);(0,r.useEffect)(function(){var e=f.bindI18n,r=f.bindI18nStore;function n(){O.current&&C(w)}return O.current=!0,v||h||(t.lng?b(a,t.lng,g,function(){O.current&&C(w)}):F(a,g,function(){O.current&&C(w)})),v&&N&&N!==M&&O.current&&C(w),e&&a&&a.on(e,n),r&&a&&a.store.on(r,n),function(){O.current=!1,e&&a&&e.split(" ").forEach(function(e){return a.off(e,n)}),r&&a&&r.split(" ").forEach(function(e){return a.store.off(e,n)})}},[a,M]);var B=(0,r.useRef)(!0);(0,r.useEffect)(function(){O.current&&!B.current&&C(w),B.current=!1},[a,d]);var T=[A,a,v];if(T.t=A,T.i18n=a,T.ready=v,v||!v&&!h)return T;throw new Promise(function(e){t.lng?b(a,t.lng,g,function(){return e()}):F(a,g,function(){return e()})})}(e,O(O({},u),{},{keyPrefix:t.keyPrefix})),c=y(a,3),l=c[0],f=c[1],h=c[2],d=O(O({},u),{},{t:l,i18n:f,tReady:h});return t.withRef&&o?d.ref=o:!t.withRef&&o&&(d.forwardedRef=o),(0,r.createElement)(n,d)}return i.displayName="withI18nextTranslation(".concat(n.displayName||n.name||("string"==typeof n&&n.length>0?n:"Unknown"),")"),i.WrappedComponent=n,t.withRef?(0,r.forwardRef)(function(e,t){return(0,r.createElement)(i,Object.assign({},e,{forwardedRef:t}))}):i}})(["MicroscopyTable","Common"])(function(t){let i,o,u,s,a,c,l,f,h,d,p,m,D,g,y=(0,e.c)(42),{microscopyService:v}=t.servicesManager.services,[w,_]=(0,r.useState)(null);y[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],y[0]=i):i=y[0];let[E,A]=(0,r.useState)(i),[F,b]=(0,r.useState)(null),{servicesManager:C,extensionManager:x}=t,{displaySetService:S}=C.services;y[1]!==S||y[2]!==t.activeViewportId||y[3]!==t.viewports?(o=()=>{let e=t.viewports.get(t.activeViewportId);if(e?.displaySetInstanceUIDs[0]){let t=S.getDisplaySetByUID(e.displaySetInstanceUIDs[0]);t&&_(t.StudyInstanceUID)}},y[1]=S,y[2]=t.activeViewportId,y[3]=t.viewports,y[4]=o):o=y[4],y[5]!==t.activeViewportId||y[6]!==t.viewports?(u=[t.viewports,t.activeViewportId],y[5]=t.activeViewportId,y[6]=t.viewports,y[7]=u):u=y[7],(0,r.useEffect)(o,u),y[8]!==v||y[9]!==w?(s=()=>{let e=()=>{A(v.getAnnotationsForStudy(w))},t=()=>{b(v.getSelectedAnnotation())},{unsubscribe:r}=v.subscribe(ic.ANNOTATION_UPDATED,e),{unsubscribe:n}=v.subscribe(ic.ANNOTATION_SELECTED,t),{unsubscribe:i}=v.subscribe(ic.ANNOTATION_REMOVED,()=>{e()});return e(),t(),()=>{r(),n(),i()}},y[8]=v,y[9]=w,y[10]=s):s=y[10],y[11]!==w?(a=[w],y[11]=w,y[12]=a):a=y[12],(0,r.useEffect)(s,a),y[13]!==v||y[14]!==t.activeViewportId?(c=e=>{let{uid:r}=e,n=v.getAnnotation(r);v.selectAnnotation(n),v.focusAnnotation(n,t.activeViewportId)},y[13]=v,y[14]=t.activeViewportId,y[15]=c):c=y[15];let M=c;y[16]!==t.commandsManager?(l=e=>{let{uid:r}=e;t.commandsManager.runCommand("setLabel",{uid:r},"MICROSCOPY")},y[16]=t.commandsManager,y[17]=l):l=y[17];let N=l;y[18]!==v?(f=e=>{let{uid:t}=e,r=v.getAnnotation(t);v.removeAnnotation(r)},y[18]=v,y[19]=f):f=y[19];let O=f;if(y[20]!==O||y[21]!==M||y[22]!==N||y[23]!==E||y[24]!==F){let e,t;y[29]!==F?(e=(e,t)=>{let r=e.getDetailedLabel(),n=e.getArea(),i=e.getLength(),o=e.roiGraphic.properties.shortAxisLength,u=F===e,{uid:s}=e,a=[];if(void 0!==n){let e,t;a.push((e=1,t="mm",n>1e6?(t="m",e=1e-6):n<1&&(t="μm",e=1e6),`${(n*e).toFixed(2)} ${t}\xb2`))}else void 0!==i&&a.push(o?`${ig(i,"μm")} x ${ig(o,"μm")}`:`${ig(i,"μm")}`);return{uid:s,index:t,label:r,isActive:u,displayText:a,roiAnnotation:e}},y[29]=F,y[30]=e):e=y[30];let r=E.map(e);h="ohif-scrollbar overflow-y-auto overflow-x-hidden",d="measurements-panel",p="flex flex-col",y[31]!==O||y[32]!==M||y[33]!==N?(t=e=>(0,ip.jsx)(n.DataRow,{number:e.index+1,title:e.label,isSelected:e.isActive,onSelect:()=>M({uid:e.uid}),details:{primary:e.displayText,secondary:[]},isVisible:!0,onToggleVisibility:iw,isLocked:!1,onToggleLocked:iv,onRename:()=>N({uid:e.uid,isActive:e.isActive}),onDelete:()=>O({uid:e.uid,isActive:e.isActive}),onColor:iy,disableEditing:!1,description:e.displayText.join(", ")},e.uid),y[31]=O,y[32]=M,y[33]=N,y[34]=t):t=y[34],m=r.map(t),y[20]=O,y[21]=M,y[22]=N,y[23]=E,y[24]=F,y[25]=h,y[26]=d,y[27]=p,y[28]=m}else h=y[25],d=y[26],p=y[27],m=y[28];return y[35]!==p||y[36]!==m?(D=(0,ip.jsx)("div",{className:p,children:m}),y[35]=p,y[36]=m,y[37]=D):D=y[37],y[38]!==h||y[39]!==d||y[40]!==D?(g=(0,ip.jsx)(ip.Fragment,{children:(0,ip.jsx)("div",{className:h,"data-cy":d,children:D})}),y[38]=h,y[39]=d,y[40]=D,y[41]=g):g=y[41],g}),iE="126010",iA="125007",iF="111030",ib="112039";function iC(e){return Array.isArray(e)?e:[e]}let ix=id().adapters.DICOMMicroscopyViewer.MeasurementReport;async function iS(e,t,r){let n=t.metadata,{StudyInstanceUID:i,FrameOfReferenceUID:o}=r,u=e.getManagedViewersForStudy(i);if(!u||!u.length)return;t.isLoaded=!0;let{rois:s,labels:a}=await iM(e,n,o),c=u[0];for(let e=0;e<s.length;e++){let t=s[e],r=Object.getOwnPropertySymbols(t).find(e=>"properties"===e.description);t[r].evaluations=[],c.addRoiGraphicWithLabel(t,a[e])}}async function iM(e,t,r){let n=ix.generateToolState(t),i=Object.getOwnPropertyNames(n),o=await e.importDicomMicroscopyViewer(),u=function(e){let{ContentSequence:t}=e;return iC(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iE).ContentSequence).filter(e=>e.ConceptNameCodeSequence.CodeValue===iA)}(t),s=[],a=[];return i.forEach(e=>{let t,i=n[e],c=e.toUpperCase(),l=u.filter(e=>iC(e.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iF).GraphicType===c);i.forEach((n,i)=>{let u={},c={coordinates:n,frameOfReferenceUID:r};if("Polygon"===e)t=new o.scoord3d.Polygon(c);else if("Polyline"===e)t=new o.scoord3d.Polyline(c);else if("Point"===e)t=new o.scoord3d.Point(c);else if("Ellipse"===e)t=new o.scoord3d.Ellipse(c);else throw Error("Unsupported tool type");let f=l[i],h=iC(f.ContentSequence).find(e=>"121071"===e.ConceptNameCodeSequence.CodeValue),d=iC(f.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===ib);if(d){let e=/\(([^)]+)\)/.exec(d.TextValue);e&&e[1]&&(u.presentationState=JSON.parse(e[1]),u.marker=u.presentationState.marker)}let p=iC(f.ContentSequence).filter(e=>["410668003","42798000","G-A186","G-A185","G-D7FE"].includes(e.ConceptNameCodeSequence.CodeValue)),m=iC(f.ContentSequence).filter(e=>[ib].includes(e.ConceptNameCodeSequence.CodeValue));m=m.map(e=>{let t={...e};return t.ConceptNameCodeSequence=iC(t.ConceptNameCodeSequence),t}),(p=p.map(e=>{let t={...e};return t.ConceptNameCodeSequence=iC(t.ConceptNameCodeSequence),t}))&&p.length&&(u.measurements=p,console.log("[SR] retrieving measurements...",p)),m&&m.length&&(u.evaluations=m,console.log("[SR] retrieving evaluations...",m));let D=new o.roi.ROI({scoord3d:t,properties:u});s.push(D),h?a.push(h.ConceptCodeSequence.CodeValue):a.push("")})}),{rois:s,labels:a}}function iN(e,t){let{ReferencedFrameOfReferenceUID:r,metadata:n}=t;if(n.ReferencedSeriesSequence){let{ReferencedSeriesSequence:t}=n,{SeriesInstanceUID:r}=t[0];return e.filter(e=>e.SeriesInstanceUID===r)[0]}let i=e.filter(e=>e.displaySetInstanceUID!==t.displaySetInstanceUID),o=i.find(e=>"SM"===e.Modality&&(e.FrameOfReferenceUID===r||e.othersFrameOfReferenceUID.includes(r)));return!o&&i.length>=1?(console.warn("No display set with FrameOfReferenceUID",r,"single series, assuming data error, defaulting to only series."),i.find(e=>"SM"===e.Modality)):o}let{utils:iO}=u();var iB=a(427);let{utils:iT}=u();function ik(e,t=0,r={}){let n;"object"!=typeof r&&(r={});let{leading:i=!1,trailing:o=!0,maxWait:u}=r,s=[,,];i&&(s[0]="leading"),o&&(s[1]="trailing");let a=null,c=function(e,t,{signal:r,edges:n}={}){let i,o=null,u=null!=n&&n.includes("leading"),s=null==n||n.includes("trailing"),a=()=>{null!==o&&(e.apply(i,o),i=void 0,o=null)},c=null,l=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&a(),f()},t)},f=()=>{null!==c&&(clearTimeout(c),c=null),i=void 0,o=null},h=function(...e){if(r?.aborted)return;i=this,o=e;let t=null==c;l(),u&&t&&a()};return h.schedule=l,h.cancel=f,h.flush=()=>{a()},r?.addEventListener("abort",f,{once:!0}),h}(function(...t){n=e.apply(this,t),a=null},t,{edges:s}),l=function(...t){return null!=u&&(null===a&&(a=Date.now()),Date.now()-a>=u)?((i||o)&&(n=e.apply(this,t)),a=Date.now(),c.cancel(),c.schedule(),n):(c.apply(this,t),n)};return l.cancel=c.cancel,l.flush=()=>(c.flush(),n),l}var iI=a(51),iR=a.n(iI);let iP=r.lazy(()=>Promise.resolve().then(a.bind(a,683))),ij=t=>{let n,i,o=(0,e.c)(3);return o[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,ip.jsx)("div",{children:"Loading..."}),o[0]=n):n=o[0],o[1]!==t?(i=(0,ip.jsx)(r.Suspense,{fallback:n,children:(0,ip.jsx)(iP,{...t})}),o[1]=t,o[2]=i):i=o[2],i},iY={id:t,async preRegistration({servicesManager:e}){e.registerService(il.REGISTRATION(e))},getViewportModule({servicesManager:t}){let i=iR()(()=>{let{microscopyService:e}=t.services,r=e.getAllManagedViewers();r&&r.length>0&&r[0].viewer.resize()},100);return[{name:"microscopy-dicom",component:t=>{let o,u,s,a,c=(0,e.c)(12),{viewportOptions:l}=t,[f,h]=(0,n.useViewportGrid)(),{activeViewportId:d}=f;c[0]!==t.displaySets?(o=t.displaySets.map(iU).join("-"),c[0]=t.displaySets,c[1]=o):o=c[1];let p=o;c[2]===Symbol.for("react.memo_cache_sentinel")?(u={onResize:i,handleHeight:!0,handleWidth:!0},c[2]=u):u=c[2];let{ref:m}=function({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:i,handleWidth:o=!0,handleHeight:u=!0,targetRef:s,observerOptions:a,onResize:c,disableRerender:l=!1}={}){let f,h=(0,r.useRef)(e),d=(f=r.useRef(c),r.useEffect(()=>{f.current=c}),r.useMemo(()=>(...e)=>{var t;return null==(t=f.current)?void 0:t.call(f,...e)},[])),[p,m]=(0,r.useState)({width:void 0,height:void 0}),D=(0,r.useRef)({width:void 0,height:void 0}),{refProxy:g,refElement:y}=(e=>{let[t,n]=r.useState((null==e?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:r.useMemo(()=>new Proxy(e=>{e!==t&&n(e)},{get:(e,r)=>"current"===r?t:e[r],set:(e,t,r)=>("current"===t?n(r):e[t]=r,!0)}),[t]),refElement:t,setRefElement:n}})(s),{box:v}=a||{},w=(0,r.useCallback)(e=>{if(!o&&!u)return;if(h.current){h.current=!1;return}let t=(e,t)=>o&&e.width!==t.width||u&&e.height!==t.height;e.forEach(e=>{var r,n;let i,o,u=(i=null==(r=e.borderBoxSize)?void 0:r[0],o=null==(n=e.contentBoxSize)?void 0:n[0],"border-box"===v&&i?{width:i.inlineSize,height:i.blockSize}:"content-box"===v&&o?{width:o.inlineSize,height:o.blockSize}:{width:e.contentRect.width,height:e.contentRect.height});l?t(D.current,u)&&(D.current.width=u.width,D.current.height=u.height,null==d||d({width:u.width,height:u.height,entry:e})):m(r=>t(r,u)?(null==d||d({width:u.width,height:u.height,entry:e}),u):r)})},[o,u,h,v,l]),_=(0,r.useCallback)(((e,t,r,n)=>{switch(t){case"debounce":return ik(e,r,n);case"throttle":return function(e,t=0,r={}){let{leading:n=!0,trailing:i=!0}=r;return ik(e,t,{leading:n,maxWait:t,trailing:i})}(e,r,n);default:return e}})(w,t,n,i),[w,t,n,i]);return(0,r.useEffect)(()=>{let e;if(y)try{(e=new window.ResizeObserver(_)).observe(y,a)}catch(e){console.warn("ResizeObserver not supported or failed to initialize:",e)}else(p.width||p.height)&&(null==d||d({width:null,height:null,entry:null}),D.current.width=void 0,D.current.height=void 0,l||m({width:void 0,height:void 0}));return()=>{var t,r;null==(t=null==e?void 0:e.disconnect)||t.call(e),null==(r=_.cancel)||r.call(_)}},[_,y]),Object.assign({ref:g},l?D.current:p)}(u);c[3]!==h?(s=e=>{h.setActiveViewportId(e)},c[3]=h,c[4]=s):s=c[4];let D=s;return c[5]!==d||c[6]!==p||c[7]!==t||c[8]!==m||c[9]!==D||c[10]!==l?(a=(0,ip.jsx)(ij,{activeViewportId:d,setViewportActive:D,viewportData:l,resizeRef:m,...t},p),c[5]=d,c[6]=p,c[7]=t,c[8]=m,c[9]=D,c[10]=l,c[11]=a):a=c[11],a}}]},getToolbarModule:({servicesManager:e})=>[{name:"evaluate.microscopyTool",evaluate:({button:t})=>{let{microscopyService:r}=e.services,n=r.getActiveInteractions();if(!n)return!1;let i=n.find(e=>!!e[1].bindings.mouseButtons.includes("left")&&("draw"!==e[0]?e[0]===t.id:e[1].geometryType===t.id));return{disabled:!1,className:i?"!text-black bg-highlight":"!text-foreground/80 hover:!bg-muted hover:!text-highlight",isActive:i}}}],getSopClassHandlerModule:e=>[function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopySRSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.88.34"],getDisplaySetsFromSeries:t=>(function(e,t){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:r,microscopyService:n}=t.services,i=e[0],u=o.DicomMetadataStore.getSeries(i.StudyInstanceUID,i.SeriesInstanceUID).instances[0],s=function(e){let{ContentSequence:t}=e,r=iC(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iE).ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iA);return iC(r.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iF).ReferencedFrameOfReferenceUID}(u),{FrameOfReferenceUID:a,SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=i,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"SR",altImageText:"Microscopy SR",displaySetInstanceUID:iO.guid(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,ReferencedFrameOfReferenceUID:s,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:i,metadata:u,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(e){return iS(n,g,e).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return o.DicomMetadataStore.getStudy(d).series.forEach(t=>{let n=r.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(n)}),iN(e,g)},[g]})(t,e)}}(e),function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopyANNSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.91.1"],getDisplaySetsFromSeries:r=>(function(e,t,r){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:n,microscopyService:i}=t.services,u=[...e].sort((e,t)=>{let r=`${e.ContentDate}${e.ContentTime}`,n=`${t.ContentDate}${t.ContentTime}`;return r.localeCompare(n)}),s=u[u.length-1],a=o.DicomMetadataStore.getSeries(s.StudyInstanceUID,s.SeriesInstanceUID).instances[0],{SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=s,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"ANN",thumbnailSrc:null,altImageText:"Microscopy Annotation",displaySetInstanceUID:iT.uuidv4(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:s,metadata:a,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(){return(function({microscopyService:e,displaySet:t,extensionManager:r,servicesManager:n}){let{uiNotificationService:i}=n.services;return new Promise(async(o,u)=>{try{t.isLoading=!0;let{metadata:u}=t,s=await e.importDicomMicroscopyViewer(),a=(0,iB.A)({extensionManager:r,servicesManager:n}),c=n.services.viewportGridService.getActiveViewportId(),l=e.getManagedViewersForViewport(c)[0];a.retrieveSeriesMetadata({studyInstanceUID:u.StudyInstanceUID,seriesInstanceUID:u.SeriesInstanceUID}).then(async e=>{let r=e.map(e=>new s.metadata.MicroscopyBulkSimpleAnnotations({metadata:e}));i.show({message:"Loading annotations...",type:"info"}),await Promise.all(r.map(async e=>{try{await l.viewer.addAnnotationGroups(e),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.setAnnotationGroupStyle(t,{color:[255,234,0]})}),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.showAnnotationGroup(t)})}catch(e){console.error("failed to add annotation groups:",e),i.show({title:"Error loading annotations",message:e.message,type:"error"})}})),t.isLoaded=!0,t.isLoading=!1,o(t)})}catch(e){console.error("Error loading annotation:",e),u(e)}})})({microscopyService:i,displaySet:g,extensionManager:r,servicesManager:t}).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return o.DicomMetadataStore.getStudy(d).series.forEach(t=>{let r=n.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(r)}),iN(e,g)},[g]})(r,e,t)}}(e)],getPanelModule:function({commandsManager:e,extensionManager:t,servicesManager:r}){return[{name:"measure",iconName:"tab-linear",iconLabel:"Measure",label:"Measurements",secondaryLabel:"Measurements",component:({})=>{let[{activeViewportId:i,viewports:o}]=(0,n.useViewportGrid)();return(0,ip.jsx)(i_,{viewports:o,activeViewportId:i,onSaveComplete:()=>{},onRejectComplete:()=>{},commandsManager:e,servicesManager:r,extensionManager:t})}}]},getCommandsModule:function({servicesManager:e,commandsManager:t,extensionManager:r}){let{viewportGridService:n,uiDialogService:o,microscopyService:u}=e.services,s={deleteMeasurement:({uid:e})=>{if(e){let t=u.getAnnotation(e);t&&u.removeAnnotation(t)}},setLabel:async({uid:e})=>{let t=u.getAnnotation(e);if(!t)return;let r=await (0,i.callInputDialog)({uiDialogService:o,title:iu().t("Tools:Edit Measurement Label"),placeholder:t.label||iu().t("Tools:Enter new label"),defaultValue:t.label});null!=r&&(t.setLabel(r),u.triggerRelabel(t))},setToolActive:({toolName:e,toolGroupId:t="MICROSCOPY"})=>{let r=["dragPan",{bindings:{mouseButtons:["middle"]}}],n=["dragZoom",{bindings:{mouseButtons:["right"]}}];if(["line","box","circle","point","polygon","freehandpolygon","freehandline"].indexOf(e)>=0){let t={geometryType:e,vertexEnabled:!0,styleOptions:n6,bindings:{mouseButtons:["left"]}};"line"===e?(t.minPoints=2,t.maxPoints=2):"point"===e&&(delete t.styleOptions,delete t.vertexEnabled),u.activateInteractions([["draw",t],r,n])}else"dragPan"==e?u.activateInteractions([["dragPan",{bindings:{mouseButtons:["left","middle"]}}],n]):u.activateInteractions([[e,{bindings:{mouseButtons:["left"]}}],r,n])},toggleOverlays:()=>{let e=document.getElementsByClassName("microscopy-viewport-overlay");for(let t=0;t<e.length;t++)0===t&&e.item(0).classList.contains("hidden"),e.item(t).classList.toggle("hidden");let{activeViewportId:t}=n.getState();u.toggleOverviewMap(t)},toggleAnnotations:()=>{u.toggleROIsVisibility()}},a={deleteMeasurement:{commandFn:s.deleteMeasurement},setLabel:{commandFn:s.setLabel},setToolActive:{commandFn:s.setToolActive},toggleOverlays:{commandFn:s.toggleOverlays},toggleAnnotations:{commandFn:s.toggleAnnotations}};return{actions:s,definitions:a,defaultContext:"MICROSCOPY"}},getCustomizationModule:function(){return[]}};function iU(e){return e.displaySetInstanceUID}})(),c})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@cornerstonejs/core"),require("@ohif/i18n"),require("dcmjs"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","@ohif/i18n","dcmjs","@ohif/core","@ohif/ui-next","@ohif/extension-default"],t):"object"==typeof exports?exports["ohif-extension-dicom-microscopy"]=t(require("@cornerstonejs/core"),require("@ohif/i18n"),require("dcmjs"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):e["ohif-extension-dicom-microscopy"]=t(e["@cornerstonejs/core"],e["@ohif/i18n"],e.dcmjs,e["@ohif/core"],e["@ohif/ui-next"],e["@ohif/extension-default"])}(globalThis,(e,t,r,n,i,o)=>(()=>{var u={683(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>A});var n=r(184),i=r(326),o=r(438),u=r(530),s=r.n(u);let a=e=>{let{list:t,itemGenerator:r}=e;if(t)return t.map(t=>{if(!t)return;let n=t.generator||r;if(!n)throw Error(`No generator for ${t}`);return n({...e,item:t})})};var c=r(55),l=r(867),f=r.n(l);function h(e,t){if(null!==e)return parseFloat(e).toFixed(t)}function d(e,t="HH:mm:ss"){return f()(e,"HH:mm:ss").format(t)}r(557);var p=r(2),m=r(870);let{formatPN:D}=p.utils,g=e=>{let{item:t}=e,{title:r,value:n,condition:i,contents:o}=t;if(e.image={...e.image,...e.metadata},e.formatDate=c.formatDICOMDate,e.formatTime=d,e.formatPN=D,e.formatNumberPrecision=h,i&&!i(e)||!o&&!n)return null;let u=n&&n(e),s=o&&o(e)||[{className:"mr-1",value:r},{classname:"mr-1 font-light",value:u}];return(0,m.jsx)("div",{className:"flex flex-row",children:s.map((e,t)=>(0,m.jsx)("span",{className:e.className,children:e.value},t))},t.id)},y=({config:e,overlayData:t,...r})=>{let{topLeft:n=[],topRight:i=[],bottomLeft:o=[],bottomRight:u=[]}=t??{},c="absolute pointer-events-none microscopy-viewport-overlay";return(0,m.jsxs)(m.Fragment,{children:[n&&n.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-top-left",className:s()(c,"top-viewport left-viewport text-highlight"),children:a({...r,list:n,itemGenerator:g})}),i&&i.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-top-right",className:s()(c,"top-viewport right-viewport-scrollbar text-highlight"),children:a({...r,list:i,itemGenerator:g})}),u&&u.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-bottom-right",className:s()(c,"bottom-viewport right-viewport-scrollbar text-highlight"),children:a({...r,list:u,itemGenerator:g})}),o&&o.length>0&&(0,m.jsx)("div",{"data-cy":"viewport-overlay-bottom-left",className:s()(c,"bottom-viewport left-viewport text-highlight"),children:a({...r,list:o,itemGenerator:g})})]})};var v=r(427),w=r(111),_=r.n(w);let E=i.memo(e=>{let t,r,u,s,a,c,l,f,h,d,D,g,w,E,A,b,C,x,S=(0,n.c)(51),{activeViewportId:M,setViewportActive:N,displaySets:O,viewportId:B,dataSource:T,resizeRef:k}=e,{servicesManager:I,extensionManager:R}=(0,p.useSystem)(),[P,j]=(0,i.useState)(!1),[Y,U]=(0,i.useState)(null),[z,V]=(0,i.useState)(null),L=(0,i.useRef)(void 0),H=(0,i.useRef)(void 0),{microscopyService:q,customizationService:W}=I.services;S[0]!==W?(t=W.getCustomization("microscopyViewport.overlay"),S[0]=W,S[1]=t):t=S[1];let G=t;S[2]!==T||S[3]!==R||S[4]!==q||S[5]!==I||S[6]!==B?(r=async(e,t)=>{let r=async r=>{let{viewer:n,metadata:i}=await q.importDicomMicroscopyViewer(),u=n.VolumeImageViewer,s=(0,v.A)({extensionManager:R,servicesManager:I}),a=[];r.forEach(e=>{e.ImageType="string"==typeof e.ImageType?e.ImageType.split("\\"):e.ImageType;let t=(0,o.cleanDenaturalizedDataset)(_().data.DicomMetaDictionary.denaturalizeDataset(e),{StudyInstanceUID:e.StudyInstanceUID,SeriesInstanceUID:e.SeriesInstanceUID,dataSourceConfig:T.getConfig()});t["00480105"]||(t["00480105"]={vr:"SQ",Value:[{"00480106":{vr:"SH",Value:["1"]}}]});let r=new i.VLWholeSlideMicroscopyImage({metadata:t}),n=r.ImageType[2];("VOLUME"===n||"THUMBNAIL"===n)&&a.push(r)});let c=new u({client:s,metadata:a,retrieveRendered:!1,controls:["overview","position"]});L&&L.current&&c.addViewportOverlay&&c.addViewportOverlay({element:L.current,coordinates:[0,0],navigate:!0,className:"OpenLayersOverlay"}),c.render({container:e});let{StudyInstanceUID:l,SeriesInstanceUID:f}=t,h=q.addViewer(c,B,e,l,f);h.addContextMenuCallback(F),U(c),V(h)};q.clearAnnotations();let n=t;if(t.isOverlayDisplaySet&&(n=t.getSourceDisplaySet()),console.log("Loading viewer metadata",n),await r(n.others),t.isOverlayDisplaySet&&!t.isLoaded&&!t.isLoading){let e=t.getSourceDisplaySet();t.load(e)}},S[2]=T,S[3]=R,S[4]=q,S[5]=I,S[6]=B,S[7]=r):r=S[7];let Z=r;S[8]!==O[0]||S[9]!==Z||S[10]!==q||S[11]!==Y?(u=()=>{if(!Y){let e=O[0];Z(H.current,e).then(()=>{j(!0)})}return()=>{Y&&q.removeViewer(Y)}},S[8]=O[0],S[9]=Z,S[10]=q,S[11]=Y,S[12]=u):u=S[12],S[13]!==Y?(s=[Y],S[13]=Y,S[14]=s):s=S[14],(0,i.useEffect)(u,s),S[15]!==O[0]||S[16]!==q?(a=()=>{let e=O[0];if(q.clearAnnotations(),e.isOverlayDisplaySet&&!e.isLoaded&&!e.isLoading){let t=e.getSourceDisplaySet();e.load(t)}},S[15]=O[0],S[16]=q,S[17]=a):a=S[17],S[18]!==O||S[19]!==z||S[20]!==q?(c=[z,O,q],S[18]=O,S[19]=z,S[20]=q,S[21]=c):c=S[21],(0,i.useEffect)(a,c),S[22]===Symbol.for("react.memo_cache_sentinel")?(l={width:"100%",height:"100%"},S[22]=l):l=S[22];let $=l,J=O[0],Q=J.firstInstance||J.instance;S[23]!==W?(f=W.getCustomization("ui.loadingIndicatorProgress"),S[23]=W,S[24]=f):f=S[24];let X=f;return S[25]!==M||S[26]!==N||S[27]!==B?(h=()=>{B!==M&&N(B)},S[25]=M,S[26]=N,S[27]=B,S[28]=h):h=S[28],S[29]===Symbol.for("react.memo_cache_sentinel")?(d={...$,display:"none"},D={...$},S[29]=d,S[30]=D):(d=S[29],D=S[30]),S[31]===Symbol.for("react.memo_cache_sentinel")?(g={position:"relative",height:"100%",width:"100%"},S[31]=g):g=S[31],S[32]!==J||S[33]!==Q||S[34]!==G?(w=J&&Q.imageId&&(0,m.jsx)(y,{overlayData:G,displaySet:J,instance:J.instance,metadata:J.metadata}),S[32]=J,S[33]=Q,S[34]=G,S[35]=w):w=S[35],S[36]!==w?(E=(0,m.jsx)("div",{style:d,children:(0,m.jsx)("div",{style:D,ref:L,children:(0,m.jsx)("div",{style:g,children:w})})}),S[36]=w,S[37]=E):E=S[37],S[38]!==k?(A=e=>{H.current=e,k.current=e},S[38]=k,S[39]=A):A=S[39],S[40]!==A||S[41]!==B?(b=(0,m.jsx)("div",{style:$,"data-viewportid":B,ref:A}),S[40]=A,S[41]=B,S[42]=b):b=S[42],S[43]!==X||S[44]!==P?(C=P?null:(0,m.jsx)(X,{className:"h-full w-full bg-black"}),S[43]=X,S[44]=P,S[45]=C):C=S[45],S[46]!==E||S[47]!==b||S[48]!==C||S[49]!==h?(x=(0,m.jsxs)("div",{className:"DicomMicroscopyViewer",style:$,onClick:h,children:[E,b,C]}),S[46]=E,S[47]=b,S[48]=C,S[49]=h,S[50]=x):x=S[50],x},function(e,t){if(e.setViewportActive!==t.setViewportActive||e.resizeRef!==t.resizeRef||e.viewportId!==t.viewportId||e.activeViewportId!==t.activeViewportId||e.dataSource!==t.dataSource)return!1;let r=e.displaySets,n=t.displaySets;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n.find(e=>e.displaySetInstanceUID===t.displaySetInstanceUID);if(!i||i.images?.length!==t.images?.length)return!1;if(i.images?.length){for(let e=0;e<i.images.length;e++)if(i.images[e].imageId!==t.images[e].imageId)return!1}}return!0});E.displayName="DicomMicroscopyViewport";let A=E;function F(e){}},427(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(2),i=r(438);function o({extensionManager:e,servicesManager:t}){let r=window.config.dataSources.find(t=>t.sourceName===e.activeDataSourceName),{userAuthenticationService:u}=t.services,{wadoRoot:s,staticWado:a,singlepart:c}=r.configuration,l={url:s||"/dicomlocal",staticWado:a,singlepart:c,headers:u.getAuthorizationHeader(),errorInterceptor:n.errorHandler.getHTTPErrorHandler()},f=new i.StaticWadoClient(l);return f.wadoURL=l.url,"dicomlocal"===e.activeDataSourceName&&(f.retrieveInstanceFrames=async e=>{if(!("studyInstanceUID"in e))throw Error("Study Instance UID is required for retrieval of instance frames");if(!("seriesInstanceUID"in e))throw Error("Series Instance UID is required for retrieval of instance frames");if(!("sopInstanceUID"in e))throw Error("SOP Instance UID is required for retrieval of instance frames");if(!("frameNumbers"in e))throw Error("frame numbers are required for retrieval of instance frames");console.log(`retrieve frames ${e.frameNumbers.toString()} of instance ${e.sopInstanceUID}`);let t=n.DicomMetadataStore.getInstance(e.studyInstanceUID,e.seriesInstanceUID,e.sopInstanceUID);return(Array.isArray(e.frameNumbers)?e.frameNumbers:e.frameNumbers.split(",")).map(e=>Array.isArray(t.PixelData)?t.PixelData[e-1]:t.PixelData)}),f}},42(e){!function(){"use strict";var t={s:1,n:0,d:1};function r(e,t){if(isNaN(e=parseInt(e,10)))throw c();return e*t}function n(e,t){if(0===t)throw a();var r=Object.create(s.prototype);r.s=e<0?-1:1;var n=u(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function i(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var o=function(e,n){var i,o=0,u=1,s=1,f=0,h=0,d=0,p=1,m=1,D=0,g=1,y=1,v=1;if(null==e);else if(void 0!==n){if(s=(o=e)*(u=n),o%1!=0||u%1!=0)throw l()}else switch(typeof e){case"object":if("d"in e&&"n"in e)o=e.n,u=e.d,"s"in e&&(o*=e.s);else if(0 in e)o=e[0],1 in e&&(u=e[1]);else throw c();s=o*u;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)o=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);g<=1e7&&v<=1e7;){if(e===(i=(D+y)/(g+v))){g+v<=1e7?(o=D+y,u=g+v):v>g?(o=y,u=v):(o=D,u=g);break}e>i?(D+=y,g+=v):(y+=D,v+=g),g>1e7?(o=y,u=v):(o=D,u=g)}o*=m}else(isNaN(e)||isNaN(n))&&(u=o=NaN);break;case"string":if(null===(g=e.match(/\d+|./g)))throw c();if("-"===g[D]?(s=-1,D++):"+"===g[D]&&D++,g.length===D+1?h=r(g[D++],s):"."===g[D+1]||"."===g[D]?("."!==g[D]&&(f=r(g[D++],s)),(++D+1===g.length||"("===g[D+1]&&")"===g[D+3]||"'"===g[D+1]&&"'"===g[D+3])&&(h=r(g[D],s),p=Math.pow(10,g[D].length),D++),("("===g[D]&&")"===g[D+2]||"'"===g[D]&&"'"===g[D+2])&&(d=r(g[D+1],s),m=Math.pow(10,g[D+1].length)-1,D+=3)):"/"===g[D+1]||":"===g[D+1]?(h=r(g[D],s),p=r(g[D+2],1),D+=3):"/"===g[D+3]&&" "===g[D+1]&&(f=r(g[D],s),h=r(g[D+2],s),p=r(g[D+4],1),D+=5),g.length<=D){s=o=d+(u=p*m)*f+m*h;break}default:throw c()}if(0===u)throw a();t.s=s<0?-1:1,t.n=Math.abs(o),t.d=Math.abs(u)};function u(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function s(e,r){if(o(e,r),!(this instanceof s))return n(t.s*t.n,t.d);e=u(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var a=function(){return Error("Division by Zero")},c=function(){return Error("Invalid argument")},l=function(){return Error("Parameters must be integer")};s.prototype={s:1,n:0,d:1,abs:function(){return n(this.n,this.d)},neg:function(){return n(-this.s*this.n,this.d)},add:function(e,r){return o(e,r),n(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),n(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return n(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new s(NaN);if(void 0===e)return n(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw a();return n(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),n(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(e,r){return(o(e,r),0===t.n&&0===this.n)?n(0,1):n(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new s(NaN):n(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 s(NaN):n(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 s(NaN):n(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return n(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)if(t.s<0)return n(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n));else return n(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var u=i(this.n),s=i(this.d),a=1,c=1;for(var l in u)if("1"!==l){if("0"===l){a=0;break}if(u[l]*=t.n,u[l]%t.d!=0)return null;u[l]/=t.d,a*=Math.pow(l,u[l])}for(var l in s)if("1"!==l){if(s[l]*=t.n,s[l]%t.d!=0)return null;s[l]/=t.d,c*=Math.pow(l,s[l])}return t.s<0?n(c,a):n(a,c)},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 t=this.abs(),r=t.toContinued(),i=1;i<r.length;i++){for(var o=n(r[i-1],1),u=i-2;u>=0;u--)o=o.inverse().add(r[u]);if(Math.abs(o.sub(t).valueOf())<e)return o.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 t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t)return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,r=1;1!==t;r++)if(t=10*t%e,r>2e3)return 0;return r}(r),i=function(e,t){for(var r=1,n=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,t,e),i=0;i<300;i++){if(r===n)return i;r=10*r%e,n=10*n%e}return 0}(r,n),o=this.s<0?"-":"";if(o+=t/r|0,t%=r,(t*=10)&&(o+="."),n){for(var u=i;u--;)o+=t/r|0,t%=r,t*=10;o+="(";for(var u=n;u--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(var u=e;t&&u--;)o+=t/r|0,t%=r,t*=10;return o}},Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Fraction=s,e.exports=s}()},51(e,t,r){var n=0/0,i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,c="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,m=function(){return f.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==h.call(t))return n;if(D(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=D(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var c=u.test(e);return c||s.test(e)?a(e.slice(2),c?2:8):o.test(e)?n:+e}e.exports=function(e,t,r){var n,i,o,u,s,a,c=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=n,o=i;return n=i=void 0,c=t,u=e.apply(o,r)}function v(e){var r=e-a,n=e-c;return void 0===a||r>=t||r<0||f&&n>=o}function w(){var e,r,n,i=m();if(v(i))return _(i);s=setTimeout(w,(e=i-a,r=i-c,n=t-e,f?p(n,o-r):n))}function _(e){return(s=void 0,h&&n)?y(e):(n=i=void 0,u)}function E(){var e,r=m(),o=v(r);if(n=arguments,i=this,a=r,o){if(void 0===s)return c=e=a,s=setTimeout(w,t),l?y(e):u;if(f)return s=setTimeout(w,t),y(a)}return void 0===s&&(s=setTimeout(w,t)),u}return t=g(t)||0,D(r)&&(l=!!r.leading,o=(f="maxWait"in r)?d(g(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h),E.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=a=i=s=void 0},E.flush=function(){return void 0===s?u:_(m())},E}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return z.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(o(e,t))return!1;return!0}function s(e){return void 0===e}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function f(e,t){for(var r in t)o(t,r)&&(e[r]=t[r]);return o(t,"toString")&&(e.toString=t.toString),o(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,r,n){return to(e,t,r,n,!0).utc()}function d(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=d(e),r=V.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function m(e){var t=h(NaN);return null!=e?f(d(t),e):d(t).userInvalidated=!0,t}V=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var D,g,y=t.momentProperties=[],v=!1;function w(e,t){var r,n,i,o=y.length;if(s(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),s(t._i)||(e._i=t._i),s(t._f)||(e._f=t._f),s(t._l)||(e._l=t._l),s(t._strict)||(e._strict=t._strict),s(t._tzm)||(e._tzm=t._tzm),s(t._isUTC)||(e._isUTC=t._isUTC),s(t._offset)||(e._offset=t._offset),s(t._pf)||(e._pf=d(t)),s(t._locale)||(e._locale=t._locale),o>0)for(r=0;r<o;r++)s(i=t[n=y[r]])||(e[n]=i);return e}function _(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function E(e){return e instanceof _||null!=e&&null!=e._isAMomentObject}function A(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function F(e,r){var n=!0;return f(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,u,s,a=[],c=arguments.length;for(u=0;u<c;u++){if(i="","object"==typeof arguments[u]){for(s in i+="\n["+u+"] ",arguments[0])o(arguments[0],s)&&(i+=s+": "+arguments[0][s]+", ");i=i.slice(0,-2)}else i=arguments[u];a.push(i)}A(e+"\nArguments: "+Array.prototype.slice.call(a).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var b={};function C(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),b[e]||(A(r),b[e]=!0)}function x(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function S(e,t){var r,n=f({},e);for(r in t)o(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},f(n[r],e[r]),f(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)o(e,r)&&!o(t,r)&&i(e[r])&&(n[r]=f({},n[r]));return n}function M(e){null!=e&&this.set(e)}function N(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,T={},k={};function I(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(k[e]=i),t&&(k[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),r&&(k[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function R(e,t){return e.isValid()?(T[t=P(t,e.localeData())]=T[t]||function(e){var t,r,n,i=e.match(O);for(r=0,n=i.length;r<n;r++)k[i[r]]?i[r]=k[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,o="";for(r=0;r<n;r++)o+=x(i[r])?i[r].call(t,e):i[r];return o}}(t),T[t](e)):e.localeData().invalidDate()}function P(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(B.lastIndex=0;r>=0&&B.test(e);)e=e.replace(B,n),B.lastIndex=0,r-=1;return e}var j={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Y(e){return"string"==typeof e?j[e]||j[e.toLowerCase()]:void 0}function U(e){var t,r,n={};for(r in e)o(e,r)&&(t=Y(r))&&(n[t]=e[r]);return n}var z,V,L,H={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},q=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)o(e,t)&&r.push(t);return r},W=/\d/,G=/\d\d/,Z=/\d{3}/,$=/\d{4}/,J=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,eo=/Z|[+-]\d\d:?\d\d/gi,eu=/Z|[+-]\d\d(?::?\d\d)?/gi,es=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ea=/^[1-9]\d?/,ec=/^([1-9]\d|\d)/;function el(e,t,r){L[e]=x(t)?t:function(e,n){return e&&r?r:t}}function ef(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function eh(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ed(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=eh(t)),r}L={};var ep={};function em(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),a(t)&&(i=function(e,r){r[t]=ed(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function eD(e,t){em(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function eg(e){return e%4==0&&e%100!=0||e%400==0}function ey(e){return eg(e)?366:365}I("Y",0,0,function(){var e=this.year();return e<=9999?N(e,4):"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),el("Y",ei),el("YY",Q,G),el("YYYY",et,$),el("YYYYY",er,J),el("YYYYYY",er,J),em(["YYYYY","YYYYYY"],0),em("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):ed(e)}),em("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),em("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return ed(e)+(ed(e)>68?1900:2e3)};var ev=ew("FullYear",!0);function ew(e,r){return function(n){return null!=n?(eE(this,e,n),t.updateOffset(this,r),this):e_(this,e)}}function e_(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function eE(e,t,r){var n,i,o,u;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=e.month(),u=29!==(u=e.date())||1!==o||eg(r)?u:28,i?n.setUTCFullYear(r,o,u):n.setFullYear(r,o,u)}}function eA(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?eg(e)?29:28:31-r%7%2}eL=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),el("M",Q,ea),el("MM",Q,G),el("MMM",function(e,t){return t.monthsShortRegex(e)}),el("MMMM",function(e,t){return t.monthsRegex(e)}),em(["M","MM"],function(e,t){t[1]=ed(e)-1}),em(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:d(r).invalidMonth=e});var eF="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eb=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eC(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)o=h([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(o,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=eL.call(this._shortMonthsParse,u))?i:null;else return -1!==(i=eL.call(this._longMonthsParse,u))?i:null;return"MMM"===t?-1!==(i=eL.call(this._shortMonthsParse,u))||-1!==(i=eL.call(this._longMonthsParse,u))?i:null:-1!==(i=eL.call(this._longMonthsParse,u))||-1!==(i=eL.call(this._shortMonthsParse,u))?i:null}function ex(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=ed(t);else if(!a(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,eA(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function eS(e){return null!=e?(ex(this,e),t.updateOffset(this,!0),this):e_(this,"Month")}function eM(){function e(e,t){return t.length-e.length}var t,r,n,i,o=[],u=[],s=[];for(t=0;t<12;t++)r=h([2e3,t]),n=ef(this.monthsShort(r,"")),i=ef(this.months(r,"")),o.push(n),u.push(i),s.push(i),s.push(n);o.sort(e),u.sort(e),s.sort(e),this._monthsRegex=RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+u.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+o.join("|")+")","i")}function eN(e,t,r,n,i,o,u){var s;return e<100&&e>=0?isFinite((s=new Date(e+400,t,r,n,i,o,u)).getFullYear())&&s.setFullYear(e):s=new Date(e,t,r,n,i,o,u),s}function eO(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eB(e,t,r){var n=7+t-r;return-((7+eO(e,0,n).getUTCDay()-t)%7)+n-1}function eT(e,t,r,n,i){var o,u,s=1+7*(t-1)+(7+r-n)%7+eB(e,n,i);return s<=0?u=ey(o=e-1)+s:s>ey(e)?(o=e+1,u=s-ey(e)):(o=e,u=s),{year:o,dayOfYear:u}}function ek(e,t,r){var n,i,o=eB(e.year(),t,r),u=Math.floor((e.dayOfYear()-o-1)/7)+1;return u<1?n=u+eI(i=e.year()-1,t,r):u>eI(e.year(),t,r)?(n=u-eI(e.year(),t,r),i=e.year()+1):(i=e.year(),n=u),{week:n,year:i}}function eI(e,t,r){var n=eB(e,t,r),i=eB(e+1,t,r);return(ey(e)-n+i)/7}function eR(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),el("w",Q,ea),el("ww",Q,G),el("W",Q,ea),el("WW",Q,G),eD(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=ed(e)}),I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),el("d",Q),el("e",Q),el("E",Q),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),eD(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:d(r).invalidWeekday=e}),eD(["d","e","E"],function(e,t,r,n){t[n]=ed(e)});var eP="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function ej(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=h([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=eL.call(this._weekdaysParse,u))?i:null;else if("ddd"===t)return -1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null;else return -1!==(i=eL.call(this._minWeekdaysParse,u))?i:null;return"dddd"===t?-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:"ddd"===t?-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:-1!==(i=eL.call(this._minWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null}function eY(){function e(e,t){return t.length-e.length}var t,r,n,i,o,u=[],s=[],a=[],c=[];for(t=0;t<7;t++)r=h([2e3,1]).day(t),n=ef(this.weekdaysMin(r,"")),i=ef(this.weekdaysShort(r,"")),o=ef(this.weekdays(r,"")),u.push(n),s.push(i),a.push(o),c.push(n),c.push(i),c.push(o);u.sort(e),s.sort(e),a.sort(e),c.sort(e),this._weekdaysRegex=RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+u.join("|")+")","i")}function eU(){return this.hours()%12||12}function ez(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eV(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,eU),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)}),I("hmmss",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),ez("a",!0),ez("A",!1),el("a",eV),el("A",eV),el("H",Q,ec),el("h",Q,ea),el("k",Q,ea),el("HH",Q,G),el("hh",Q,G),el("kk",Q,G),el("hmm",X),el("hmmss",K),el("Hmm",X),el("Hmmss",K),em(["H","HH"],3),em(["k","kk"],function(e,t,r){var n=ed(e);t[3]=24===n?0:n}),em(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),em(["h","hh"],function(e,t,r){t[3]=ed(e),d(r).bigHour=!0}),em("hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n)),d(r).bigHour=!0}),em("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i)),d(r).bigHour=!0}),em("Hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n))}),em("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i))});var eL,eH,eq=ew("Hours",!0),eW={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eF,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eP,meridiemParse:/[ap]\.?m?\.?/i},eG={},eZ={};function e$(e){return e?e.toLowerCase().replace("_","-"):e}function eJ(t){var n=null;if(void 0===eG[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eH._abbr,r(118)("./locale/"+t),eQ(n)}catch(e){eG[t]=null}return eG[t]}function eQ(e,t){var r;return e&&((r=s(t)?eK(e):eX(e,t))?eH=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eH._abbr}function eX(e,t){if(null===t)return delete eG[e],null;var r,n=eW;if(t.abbr=e,null!=eG[e])C("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eG[e]._config;else if(null!=t.parentLocale)if(null!=eG[t.parentLocale])n=eG[t.parentLocale]._config;else{if(null==(r=eJ(t.parentLocale)))return eZ[t.parentLocale]||(eZ[t.parentLocale]=[]),eZ[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eG[e]=new M(S(n,t)),eZ[e]&&eZ[e].forEach(function(e){eX(e.name,e.config)}),eQ(e),eG[e]}function eK(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eH;if(!n(e)){if(t=eJ(e))return t;e=[e]}return function(e){for(var t,r,n,i,o=0;o<e.length;){for(t=(i=e$(e[o]).split("-")).length,r=(r=e$(e[o+1]))?r.split("-"):null;t>0;){if(n=eJ(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}o++}return eH}(e)}function e0(e){var t,r=e._a;return r&&-2===d(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>eA(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,d(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),d(e)._overflowWeeks&&-1===t&&(t=7),d(e)._overflowWeekday&&-1===t&&(t=8),d(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e3=/Z|[+-]\d\d(?::?\d\d)?/,e8=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e4=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e5=/^\/?Date\((-?\d+)/i,e6=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,o,u,s=e._i,a=e1.exec(s)||e2.exec(s),c=e8.length,l=e4.length;if(a){for(d(e).iso=!0,t=0,r=c;t<r;t++)if(e8[t][1].exec(a[1])){i=e8[t][0],n=!1!==e8[t][2];break}if(null==i){e._isValid=!1;return}if(a[3]){for(t=0,r=l;t<r;t++)if(e4[t][1].exec(a[3])){o=(a[2]||" ")+e4[t][0];break}if(null==o){e._isValid=!1;return}}if(!n&&null!=o){e._isValid=!1;return}if(a[4])if(e3.exec(a[4]))u="Z";else{e._isValid=!1;return}e._f=i+(o||"")+(u||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,o,u,s,a,c,l,f,h=e6.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(h){if(o=h[4],u=h[3],s=h[2],a=h[5],c=h[6],l=h[7],f=[(t=parseInt(o,10))<=49?2e3+t:t<=999?1900+t:t,eF.indexOf(u),parseInt(s,10),parseInt(a,10),parseInt(c,10)],l&&f.push(parseInt(l,10)),r=h[1],n=f,i=e,r&&eP.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(d(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=f,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(h[8],h[9],h[10]),e._d=eO.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),d(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,o,u,s,a,c,l,f,h,p,m,D,g,y,v=[];if(!e._d){for(h=new Date(t.now()),D=e._useUTC?[h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()]:[h.getFullYear(),h.getMonth(),h.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(s=1,a=4,i=tt(n.GG,r._a[0],ek(tu(),1,4).year),o=tt(n.W,1),((u=tt(n.E,1))<1||u>7)&&(l=!0)):(s=r._locale._week.dow,a=r._locale._week.doy,f=ek(tu(),s,a),i=tt(n.gg,r._a[0],f.year),o=tt(n.w,f.week),null!=n.d?((u=n.d)<0||u>6)&&(l=!0):null!=n.e?(u=n.e+s,(n.e<0||n.e>6)&&(l=!0)):u=s),o<1||o>eI(i,s,a)?d(r)._overflowWeeks=!0:null!=l?d(r)._overflowWeekday=!0:(c=eT(i,o,u,s,a),r._a[0]=c.year,r._dayOfYear=c.dayOfYear)),null!=e._dayOfYear&&(y=tt(e._a[0],D[0]),(e._dayOfYear>ey(y)||0===e._dayOfYear)&&(d(e)._overflowDayOfYear=!0),m=eO(y,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=v[p]=D[p];for(;p<7;p++)e._a[p]=v[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eO:eN).apply(null,v),g=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==g&&(d(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],d(e).empty=!0;var r,n,i,u,s,a,c,l,f,h,p,m=""+e._i,D=m.length,g=0;for(p=(c=P(e._f,e._locale).match(O)||[]).length,s=0;s<p;s++)if(l=c[s],(a=(m.match(!o(L,l)?new RegExp(ef(l.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):L[l](e._strict,e._locale))||[])[0])&&((f=m.substr(0,m.indexOf(a))).length>0&&d(e).unusedInput.push(f),m=m.slice(m.indexOf(a)+a.length),g+=a.length),k[l])a?d(e).empty=!1:d(e).unusedTokens.push(l),null!=a&&o(ep,l)&&ep[l](a,e._a,e,l);else e._strict&&!a&&d(e).unusedTokens.push(l);d(e).charsLeftOver=D-g,m.length>0&&d(e).unusedInput.push(m),e._a[3]<=12&&!0===d(e).bigHour&&e._a[3]>0&&(d(e).bigHour=void 0),d(e).parsedDateParts=e._a.slice(0),d(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((u=r.isPM(i))&&n<12&&(n+=12),u||12!==n||(n=0)),n)),null!==(h=d(e).era)&&(e._a[0]=e._locale.erasConvertYear(h,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,o=e._f;return(e._locale=e._locale||eK(e._l),null===r||void 0===o&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),E(r))?new _(e0(r)):(c(r)?e._d=r:n(o)?!function(e){var t,r,n,i,o,u,s=!1,a=e._f.length;if(0===a){d(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<a;i++)o=0,u=!1,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(u=!0),o+=d(t).charsLeftOver,o+=10*d(t).unusedTokens.length,d(t).score=o,s?o<n&&(n=o,r=t):(null==n||o<n||u)&&(n=o,r=t,u&&(s=!0));f(e,r||t)}(e):o?tn(e):function(e){var r=e._i;if(s(r))e._d=new Date(t.now());else if(c(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e5.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=l(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var o=U(e._i),u=void 0===o.day?o.date:o.day;e._a=l([o.year,o.month,u,o.hour,o.minute,o.second,o.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else a(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function to(e,t,r,o,s){var a,c={};return(!0===t||!1===t)&&(o=t,t=void 0),(!0===r||!1===r)&&(o=r,r=void 0),(i(e)&&u(e)||n(e)&&0===e.length)&&(e=void 0),c._isAMomentObject=!0,c._useUTC=c._isUTC=s,c._l=r,c._i=e,c._f=t,c._strict=o,(a=new _(e0(ti(c))))._nextDay&&(a.add(1,"d"),a._nextDay=void 0),a}function tu(e,t,r,n){return to(e,t,r,n,!1)}t.createFromInputFallback=F("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ts=F("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),ta=F("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()});function tc(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tu();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tl=["year","quarter","month","week","day","hour","minute","second","millisecond"];function tf(e){var t=U(e),r=t.year||0,n=t.quarter||0,i=t.month||0,u=t.week||t.isoWeek||0,s=t.day||0,a=t.hour||0,c=t.minute||0,l=t.second||0,f=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tl.length;for(t in e)if(o(e,t)&&!(-1!==eL.call(tl,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tl[r]]){if(n)return!1;parseFloat(e[tl[r]])!==ed(e[tl[r]])&&(n=!0)}return!0}(t),this._milliseconds=+f+1e3*l+6e4*c+1e3*a*3600,this._days=+s+7*u,this._months=+i+3*n+12*r,this._data={},this._locale=eK(),this._bubble()}function th(e){return e instanceof tf}function td(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){I(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+N(~~(e/60),2)+t+N(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),el("Z",eu),el("ZZ",eu),em(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tD(eu,e)});var tm=/([\+\-]|\d\d)/gi;function tD(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tm)||["-",0,0])[1])+ed(r[2]))?0:"+"===r[0]?n:-n}function tg(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(E(e)||c(e)?e.valueOf():tu(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):tu(e).local()}function ty(e){return-Math.round(e._d.getTimezoneOffset())}function tv(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tw=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,t_=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function tE(e,t){var r,n,i,u,s,c,l=e,f=null;return th(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:a(e)||!isNaN(+e)?(l={},t?l[t]=+e:l.milliseconds=+e):(f=tw.exec(e))?(u="-"===f[1]?-1:1,l={y:0,d:ed(f[2])*u,h:ed(f[3])*u,m:ed(f[4])*u,s:ed(f[5])*u,ms:ed(td(1e3*f[6]))*u}):(f=t_.exec(e))?(u="-"===f[1]?-1:1,l={y:tA(f[2],u),M:tA(f[3],u),w:tA(f[4],u),d:tA(f[5],u),h:tA(f[6],u),m:tA(f[7],u),s:tA(f[8],u)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=tu(l.from),n=tu(l.to),c=r.isValid()&&n.isValid()?(n=tg(n,r),r.isBefore(n)?i=tF(r,n):((i=tF(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(l={}).ms=c.milliseconds,l.M=c.months),s=new tf(l),th(e)&&o(e,"_locale")&&(s._locale=e._locale),th(e)&&o(e,"_isValid")&&(s._isValid=e._isValid),s}function tA(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function tF(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tb(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(C(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tC(this,tE(r,n),e),this}}function tC(e,r,n,i){var o=r._milliseconds,u=td(r._days),s=td(r._months);e.isValid()&&(i=null==i||i,s&&ex(e,e_(e,"Month")+s*n),u&&eE(e,"Date",e_(e,"Date")+u*n),o&&e._d.setTime(e._d.valueOf()+o*n),i&&t.updateOffset(e,u||s))}tE.fn=tf.prototype,tE.invalid=function(){return tE(NaN)};var tx=tb(1,"add"),tS=tb(-1,"subtract");function tM(e){return"string"==typeof e||e instanceof String}function tN(e,t){if(e.date()<t.date())return-tN(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tO(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eK(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tB=F("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tT(){return this._locale}function tk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tI(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tR(e,t){return t.erasAbbrRegex(e)}function tP(){var e,t,r,n,i,o=[],u=[],s=[],a=[],c=this.eras();for(e=0,t=c.length;e<t;++e)r=ef(c[e].name),n=ef(c[e].abbr),i=ef(c[e].narrow),u.push(r),o.push(n),s.push(i),a.push(r),a.push(n),a.push(i);this._erasRegex=RegExp("^("+a.join("|")+")","i"),this._erasNameRegex=RegExp("^("+u.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+s.join("|")+")","i")}function tj(e,t){I(0,[e,e.length],0,t)}function tY(e,t,r,n,i){var o;return null==e?ek(this,n,i).year:(t>(o=eI(e,n,i))&&(t=o),tU.call(this,e,t,r,n,i))}function tU(e,t,r,n,i){var o=eT(e,t,r,n,i),u=eO(o.year,0,o.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}I("N",0,0,"eraAbbr"),I("NN",0,0,"eraAbbr"),I("NNN",0,0,"eraAbbr"),I("NNNN",0,0,"eraName"),I("NNNNN",0,0,"eraNarrow"),I("y",["y",1],"yo","eraYear"),I("y",["yy",2],0,"eraYear"),I("y",["yyy",3],0,"eraYear"),I("y",["yyyy",4],0,"eraYear"),el("N",tR),el("NN",tR),el("NNN",tR),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?d(r).era=i:d(r).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tj("gggg","weekYear"),tj("ggggg","weekYear"),tj("GGGG","isoWeekYear"),tj("GGGGG","isoWeekYear"),el("G",ei),el("g",ei),el("GG",Q,G),el("gg",Q,G),el("GGGG",et,$),el("gggg",et,$),el("GGGGG",er,J),el("ggggg",er,J),eD(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=ed(e)}),eD(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),el("Q",W),em("Q",function(e,t){t[1]=(ed(e)-1)*3}),I("D",["DD",2],"Do","date"),el("D",Q,ea),el("DD",Q,G),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ed(e.match(Q)[0])});var tz=ew("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",ee),el("DDDD",Z),em(["DDD","DDDD"],function(e,t,r){r._dayOfYear=ed(e)}),I("m",["mm",2],0,"minute"),el("m",Q,ec),el("mm",Q,G),em(["m","mm"],4);var tV=ew("Minutes",!1);I("s",["ss",2],0,"second"),el("s",Q,ec),el("ss",Q,G),em(["s","ss"],5);var tL=ew("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",ee,W),el("SS",ee,G),el("SSS",ee,Z),D="SSSS";D.length<=9;D+="S")el(D,en);function tH(e,t){t[6]=ed(("0."+e)*1e3)}for(D="S";D.length<=9;D+="S")em(D,tH);g=ew("Milliseconds",!1),I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var tq=_.prototype;function tW(e){return e}tq.add=tx,tq.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var s,l,f,h;if(s=arguments[0],E(s)||c(s)||tM(s)||a(s)||(f=n(l=s),h=!1,f&&(h=0===l.filter(function(e){return!a(e)&&tM(l)}).length),f&&h)||function(e){var t,r,n=i(e)&&!u(e),s=!1,a=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=a.length;for(t=0;t<c;t+=1)r=a[t],s=s||o(e,r);return n&&s}(s)||null==s)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!u(e),s=!1,a=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<a.length;t+=1)r=a[t],s=s||o(e,r);return n&&s})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var d=e||tu(),p=tg(d,this).startOf("day"),m=t.calendarFormat(this,p)||"sameElse",D=r&&(x(r[m])?r[m].call(this,d):r[m]);return this.format(D||this.localeData().calendar(m,this,tu(d)))},tq.clone=function(){return new _(this)},tq.diff=function(e,t,r){var n,i,o;if(!this.isValid()||!(n=tg(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Y(t)){case"year":o=tN(this,n)/12;break;case"month":o=tN(this,n);break;case"quarter":o=tN(this,n)/3;break;case"second":o=(this-n)/1e3;break;case"minute":o=(this-n)/6e4;break;case"hour":o=(this-n)/36e5;break;case"day":o=(this-n-i)/864e5;break;case"week":o=(this-n-i)/6048e5;break;default:o=this-n}return r?o:eh(o)},tq.endOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tq.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=R(this,e);return this.localeData().postformat(r)},tq.from=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||tu(e).isValid())?tE({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tq.fromNow=function(e){return this.from(tu(),e)},tq.to=function(e,t){return this.isValid()&&(E(e)&&e.isValid()||tu(e).isValid())?tE({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tq.toNow=function(e){return this.to(tu(),e)},tq.get=function(e){return x(this[e=Y(e)])?this[e]():this},tq.invalidAt=function(){return d(this).overflow},tq.isAfter=function(e,t){var r=E(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tq.isBefore=function(e,t){var r=E(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tq.isBetween=function(e,t,r,n){var i=E(e)?e:tu(e),o=E(t)?t:tu(t);return!!(this.isValid()&&i.isValid()&&o.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(o,r):!this.isAfter(o,r))},tq.isSame=function(e,t){var r,n=E(e)?e:tu(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tq.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tq.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tq.isValid=function(){return p(this)},tq.lang=tB,tq.locale=tO,tq.localeData=tT,tq.max=ta,tq.min=ts,tq.parsingFlags=function(){return f({},d(this))},tq.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)o(e,t)&&r.push({unit:t,priority:H[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=U(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(x(this[e=Y(e)]))return this[e](t);return this},tq.startOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tq.subtract=tS,tq.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tq.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tq.toDate=function(){return new Date(this.valueOf())},tq.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return R(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(x(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",R(r,"Z"));return R(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tq.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tq[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tq.toJSON=function(){return this.isValid()?this.toISOString():null},tq.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tq.unix=function(){return Math.floor(this.valueOf()/1e3)},tq.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tq.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tq.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tq.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tq.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tq.eraYear=function(){var e,r,n,i,o=this.localeData().eras();for(e=0,r=o.length;e<r;++e)if(n=o[e].since<=o[e].until?1:-1,i=this.clone().startOf("day").valueOf(),o[e].since<=i&&i<=o[e].until||o[e].until<=i&&i<=o[e].since)return(this.year()-t(o[e].since).year())*n+o[e].offset;return this.year()},tq.year=ev,tq.isLeapYear=function(){return eg(this.year())},tq.weekYear=function(e){return tY.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tq.isoWeekYear=function(e){return tY.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tq.quarter=tq.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tq.month=eS,tq.daysInMonth=function(){return eA(this.year(),this.month())},tq.week=tq.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tq.isoWeek=tq.isoWeeks=function(e){var t=ek(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tq.weeksInYear=function(){var e=this.localeData()._week;return eI(this.year(),e.dow,e.doy)},tq.weeksInWeekYear=function(){var e=this.localeData()._week;return eI(this.weekYear(),e.dow,e.doy)},tq.isoWeeksInYear=function(){return eI(this.year(),1,4)},tq.isoWeeksInISOWeekYear=function(){return eI(this.isoWeekYear(),1,4)},tq.date=tz,tq.day=tq.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=e_(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tq.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tq.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tq.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tq.hour=tq.hours=eq,tq.minute=tq.minutes=tV,tq.second=tq.seconds=tL,tq.millisecond=tq.milliseconds=g,tq.utcOffset=function(e,r,n){var i,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?o:ty(this);if("string"==typeof e){if(null===(e=tD(eu,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=ty(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==e&&(!r||this._changeInProgress?tC(this,tE(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tq.utc=function(e){return this.utcOffset(0,e)},tq.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(ty(this),"m")),this},tq.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tD(eo,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tq.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tu(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tq.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tq.isLocal=function(){return!!this.isValid()&&!this._isUTC},tq.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tq.isUtc=tv,tq.isUTC=tv,tq.zoneAbbr=function(){return this._isUTC?"UTC":""},tq.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tq.dates=F("dates accessor is deprecated. Use date instead.",tz),tq.months=F("months accessor is deprecated. Use month instead",eS),tq.years=F("years accessor is deprecated. Use year instead",ev),tq.zone=F("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tq.isDSTShifted=F("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=ti(t))._a?(e=t._isUTC?h(t._a):tu(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),o=0;for(r=0;r<n;r++)ed(e[r])!==ed(t[r])&&o++;return o+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tG=M.prototype;function tZ(e,t,r,n){var i=eK(),o=h().set(n,t);return i[r](o,e)}function t$(e,t,r){if(a(e)&&(t=e,e=void 0),e=e||"",null!=t)return tZ(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tZ(e,n,r,"month");return i}function tJ(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),a(t)&&(r=t,t=void 0),t=t||"";var i,o=eK(),u=e?o._week.dow:0,s=[];if(null!=r)return tZ(t,(r+u)%7,n,"day");for(i=0;i<7;i++)s[i]=tZ(t,(i+u)%7,n,"day");return s}tG.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return x(n)?n.call(t,r):n},tG.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(O).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tG.invalidDate=function(){return this._invalidDate},tG.ordinal=function(e){return this._ordinal.replace("%d",e)},tG.preparse=tW,tG.postformat=tW,tG.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return x(i)?i(e,t,r,n):i.replace(/%d/i,e)},tG.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return x(r)?r(t):r.replace(/%s/i,t)},tG.set=function(e){var t,r;for(r in e)o(e,r)&&(x(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tG.eras=function(e,r){var n,i,o,u=this._eras||eK("en")._eras;for(n=0,i=u.length;n<i;++n)switch("string"==typeof u[n].since&&(o=t(u[n].since).startOf("day"),u[n].since=o.valueOf()),typeof u[n].until){case"undefined":u[n].until=Infinity;break;case"string":o=t(u[n].until).startOf("day").valueOf(),u[n].until=o.valueOf()}return u},tG.erasParse=function(e,t,r){var n,i,o,u,s,a=this.eras();for(e=e.toUpperCase(),n=0,i=a.length;n<i;++n)if(o=a[n].name.toUpperCase(),u=a[n].abbr.toUpperCase(),s=a[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(u===e)return a[n];break;case"NNNN":if(o===e)return a[n];break;case"NNNNN":if(s===e)return a[n]}else if([o,u,s].indexOf(e)>=0)return a[n]},tG.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tG.erasAbbrRegex=function(e){return o(this,"_erasAbbrRegex")||tP.call(this),e?this._erasAbbrRegex:this._erasRegex},tG.erasNameRegex=function(e){return o(this,"_erasNameRegex")||tP.call(this),e?this._erasNameRegex:this._erasRegex},tG.erasNarrowRegex=function(e){return o(this,"_erasNarrowRegex")||tP.call(this),e?this._erasNarrowRegex:this._erasRegex},tG.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eb).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tG.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eb.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tG.monthsParse=function(e,t,r){var n,i,o;if(this._monthsParseExact)return eC.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=h([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(o.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tG.monthsRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(o(this,"_monthsRegex")||(this._monthsRegex=es),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tG.monthsShortRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(o(this,"_monthsShortRegex")||(this._monthsShortRegex=es),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tG.week=function(e){return ek(e,this._week.dow,this._week.doy).week},tG.firstDayOfYear=function(){return this._week.doy},tG.firstDayOfWeek=function(){return this._week.dow},tG.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eR(r,this._week.dow):e?r[e.day()]:r},tG.weekdaysMin=function(e){return!0===e?eR(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tG.weekdaysShort=function(e){return!0===e?eR(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tG.weekdaysParse=function(e,t,r){var n,i,o;if(this._weekdaysParseExact)return ej.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=h([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(o.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tG.weekdaysRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(o(this,"_weekdaysRegex")||(this._weekdaysRegex=es),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tG.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=es),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tG.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=es),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tG.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tG.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eQ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===ed(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=F("moment.lang is deprecated. Use moment.locale instead.",eQ),t.langData=F("moment.langData is deprecated. Use moment.localeData instead.",eK);var tQ=Math.abs;function tX(e,t,r,n){var i=tE(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tK(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t3=t2("ms"),t8=t2("s"),t4=t2("m"),t5=t2("h"),t6=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ro=rr("minutes"),ru=rr("hours"),rs=rr("days"),ra=rr("months"),rc=rr("years"),rl=Math.round,rf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rh(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rd=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,o,u,s,a=rd(this._milliseconds)/1e3,c=rd(this._days),l=rd(this._months),f=this.asSeconds();return f?(e=eh(a/60),t=eh(e/60),a%=60,e%=60,r=eh(l/12),l%=12,n=a?a.toFixed(3).replace(/\.?0+$/,""):"",i=f<0?"-":"",o=rp(this._months)!==rp(f)?"-":"",u=rp(this._days)!==rp(f)?"-":"",s=rp(this._milliseconds)!==rp(f)?"-":"",i+"P"+(r?o+r+"Y":"")+(l?o+l+"M":"")+(c?u+c+"D":"")+(t||e||a?"T":"")+(t?s+t+"H":"")+(e?s+e+"M":"")+(a?s+n+"S":"")):"P0D"}var rD=tf.prototype;return rD.isValid=function(){return this._isValid},rD.abs=function(){var e=this._data;return this._milliseconds=tQ(this._milliseconds),this._days=tQ(this._days),this._months=tQ(this._months),e.milliseconds=tQ(e.milliseconds),e.seconds=tQ(e.seconds),e.minutes=tQ(e.minutes),e.hours=tQ(e.hours),e.months=tQ(e.months),e.years=tQ(e.years),this},rD.add=function(e,t){return tX(this,e,t,1)},rD.subtract=function(e,t){return tX(this,e,t,-1)},rD.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=Y(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rD.asMilliseconds=t3,rD.asSeconds=t8,rD.asMinutes=t4,rD.asHours=t5,rD.asDays=t6,rD.asWeeks=t7,rD.asMonths=t9,rD.asQuarters=re,rD.asYears=rt,rD.valueOf=t3,rD._bubble=function(){var e,t,r,n,i,o=this._milliseconds,u=this._days,s=this._months,a=this._data;return o>=0&&u>=0&&s>=0||o<=0&&u<=0&&s<=0||(o+=864e5*tK(t1(s)+u),u=0,s=0),a.milliseconds=o%1e3,a.seconds=(e=eh(o/1e3))%60,a.minutes=(t=eh(e/60))%60,a.hours=(r=eh(t/60))%24,u+=eh(r/24),s+=i=eh(t0(u)),u-=tK(t1(i)),n=eh(s/12),s%=12,a.days=u,a.months=s,a.years=n,this},rD.clone=function(){return tE(this)},rD.get=function(e){return e=Y(e),this.isValid()?this[e+"s"]():NaN},rD.milliseconds=rn,rD.seconds=ri,rD.minutes=ro,rD.hours=ru,rD.days=rs,rD.weeks=function(){return eh(this.days()/7)},rD.months=ra,rD.years=rc,rD.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,o,u,s,a,c,l,f,h,d,p,m=!1,D=rf;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(m=e),"object"==typeof t&&(D=Object.assign({},rf,t),null!=t.s&&null==t.ss&&(D.ss=t.s-1)),d=this.localeData(),r=!m,n=D,i=tE(this).abs(),o=rl(i.as("s")),u=rl(i.as("m")),s=rl(i.as("h")),a=rl(i.as("d")),c=rl(i.as("M")),l=rl(i.as("w")),f=rl(i.as("y")),h=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||u<=1&&["m"]||u<n.m&&["mm",u]||s<=1&&["h"]||s<n.h&&["hh",s]||a<=1&&["d"]||a<n.d&&["dd",a],null!=n.w&&(h=h||l<=1&&["w"]||l<n.w&&["ww",l]),(h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f])[2]=r,h[3]=+this>0,h[4]=d,p=rh.apply(null,h),m&&(p=d.pastFuture(+this,p)),d.postformat(p)},rD.toISOString=rm,rD.toString=rm,rD.toJSON=rm,rD.locale=tO,rD.localeData=tT,rD.toIsoString=F("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rm),rD.lang=tB,I("X",0,0,"unix"),I("x",0,0,"valueOf"),el("x",ei),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,r){r._d=new Date(ed(e))}),t.version="2.30.1",z=tu,t.fn=tq,t.min=function(){var e=[].slice.call(arguments,0);return tc("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tc("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=h,t.unix=function(e){return tu(1e3*e)},t.months=function(e,t){return t$(e,t,"months")},t.isDate=c,t.locale=eQ,t.invalid=m,t.duration=tE,t.isMoment=E,t.weekdays=function(e,t,r){return tJ(e,t,r,"weekdays")},t.parseZone=function(){return tu.apply(null,arguments).parseZone()},t.localeData=eK,t.isDuration=th,t.monthsShort=function(e,t){return t$(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tJ(e,t,r,"weekdaysMin")},t.defineLocale=eX,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eW;null!=eG[e]&&null!=eG[e].parentLocale?eG[e].set(S(eG[e]._config,t)):(null!=(n=eJ(e))&&(i=n._config),t=S(i,t),null==n&&(t.abbr=e),(r=new M(t)).parentLocale=eG[e],eG[e]=r),eQ(e)}else null!=eG[e]&&(null!=eG[e].parentLocale?(eG[e]=eG[e].parentLocale,e===eQ()&&eQ(e)):null!=eG[e]&&delete eG[e]);return eG[e]},t.locales=function(){return q(eG)},t.weekdaysShort=function(e,t,r){return tJ(e,t,r,"weekdaysShort")},t.normalizeUnits=Y,t.relativeTimeRounding=function(e){return void 0===e?rl:"function"==typeof e&&(rl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rf[e]&&(void 0===t?rf[e]:(rf[e]=t,"s"===e&&(rf.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tq,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},76(e,t,r){"use strict";var n=r(326).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;t.c=function(e){return n.H.useMemoCache(e)}},60(e,t){"use strict";var r=Symbol.for("react.transitional.element");function n(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return{$$typeof:r,type:e,key:i,ref:void 0!==(t=n.ref)?t:null,props:n}}t.Fragment=Symbol.for("react.fragment"),t.jsx=n,t.jsxs=n},391(e,t){"use strict";var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=(Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.consumer")),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),a=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),l=(Symbol.for("react.activity"),Symbol.iterator),f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,d={};function p(e,t,r){this.props=e,this.context=t,this.refs=d,this.updater=r||f}function m(){}function D(e,t,r){this.props=e,this.context=t,this.refs=d,this.updater=r||f}p.prototype.isReactComponent={},p.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},m.prototype=p.prototype;var g=D.prototype=new m;g.constructor=D,h(g,p.prototype),g.isPureReactComponent=!0;var y={H:null,A:null,T:null,S:null},v=Object.prototype.hasOwnProperty;function w(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function _(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}"function"==typeof reportError&&reportError,t.Suspense=s,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,t.createContext=function(e){return(e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:i,_context:e},e},t.createElement=function(e,t,r){var n,i={},o=null;if(null!=t)for(n in void 0!==t.key&&(o=""+t.key),t)v.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var u=arguments.length-2;if(1===u)i.children=r;else if(1<u){for(var s=Array(u),a=0;a<u;a++)s[a]=arguments[a+2];i.children=s}if(e&&e.defaultProps)for(n in u=e.defaultProps)void 0===i[n]&&(i[n]=u[n]);return w(e,o,i)},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:_}},t.memo=function(e,t){return{$$typeof:a,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return y.H.useCallback(e,t)},t.useContext=function(e){return y.H.useContext(e)},t.useEffect=function(e,t){return y.H.useEffect(e,t)},t.useMemo=function(e,t){return y.H.useMemo(e,t)},t.useRef=function(e){return y.H.useRef(e)},t.useState=function(e){return y.H.useState(e)}},184(e,t,r){"use strict";e.exports=r(76)},326(e,t,r){"use strict";e.exports=r(391)},870(e,t,r){"use strict";e.exports=r(60)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},557(t){"use strict";t.exports=e},2(e){"use strict";e.exports=n},438(e){"use strict";e.exports=o},545(e){"use strict";e.exports=t},55(e){"use strict";e.exports=i},111(e){"use strict";e.exports=r},530(e){!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var e="",i=0;i<arguments.length;i++){var o=arguments[i];o&&(e=n(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var o in e)t.call(e,o)&&e[o]&&(i=n(i,o));return i}(o)))}return e}function n(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return r}):window.classNames=r}()}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return u[e].call(r.exports,r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var c={};return(()=>{"use strict";a.r(c),a.d(c,{default:()=>iY});var e=a(184);let t=JSON.parse('{"UU":"@ohif/extension-dicom-microscopy"}').UU;var r=a(326),n=a(55),i=a(438),o=a(2),u=a.n(o);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=s(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}a(741),Object.create(null);var f=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,h={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},d=function(e){return h[e]},p={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(f,d)}},m=(0,r.createContext)(),D=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,u,s=[],a=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}var _={};function E(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&_[t[0]]||("string"==typeof t[0]&&(_[t[0]]=new Date),w.apply(void 0,t))}var A=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function F(e,t,r){e.loadNamespaces(t,A(e,r))}function b(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,A(e,n))}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){v(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var S=function(e,t){var n=(0,r.useRef)();return(0,r.useEffect)(function(){n.current=t?n.current:e},[e,t]),n.current},M=["forwardedRef"];function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach(function(t){v(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function B(){return(B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}var T={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},k=function(e){if(e)throw 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(T)};B(k,T,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var I,R,P,j="0123456789abcdef",Y="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",U="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",z={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},V=!0,L="[DecimalError] ",H=L+"Invalid argument: ",q=L+"Precision limit exceeded",W=L+"crypto unavailable",G="[object Decimal]",Z=Math.floor,$=Math.pow,J=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Q=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,X=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,K=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ee=Y.length-1,et=U.length-1,er={toStringTag:G};function en(e){var t,r,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=ep(r)),o+=n;(r=7-(n=(u=e[t])+"").length)&&(o+=ep(r))}else if(0===u)return"0";for(;u%10==0;)u/=10;return o+u}function ei(e,t,r){if(e!==~~e||e<t||e>r)throw Error(H+e)}function eo(e,t,r,n){var i,o,u,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=$(10,7-t),s=e[i]%o|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),u=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):u=(r<4&&s+1==o||r>3&&s+1==o/2)&&(e[i+1]/o/100|0)==$(10,t-2)-1||(s==o/2||0==s)&&(e[i+1]/o/100|0)==0:t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),u=(n||r<4)&&9999==s||!n&&r>3&&4999==s):u=((n||r<4)&&s+1==o||!n&&r>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==$(10,t-3)-1,u}function eu(e,t,r){for(var n,i,o=[0],u=0,s=e.length;u<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=j.indexOf(e.charAt(u++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}er.absoluteValue=er.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),ea(e)},er.ceil=function(){return ea(new this.constructor(this),this.e+1,2)},er.clampedTo=er.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(H+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},er.comparedTo=er.cmp=function(e){var t,r,n,i,o=this.d,u=(e=new this.constructor(e)).d,s=this.s,a=e.s;if(!o||!u)return s&&a?s!==a?s:o===u?0:!o^s<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?s:u[0]?-a:0;if(s!==a)return s;if(this.e!==e.e)return this.e>e.e^s<0?1:-1;for(n=o.length,t=0,r=n<(i=u.length)?n:i;t<r;++t)if(o[t]!==u[t])return o[t]>u[t]^s<0?1:-1;return n===i?0:n>i^s<0?1:-1},er.cosine=er.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/eA(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=eE(e,1,t.times(i),new e(1));for(var o=r;o--;){var u=t.times(t);t=u.times(u).minus(u).times(8).plus(1)}return e.precision-=r,t}(n,eF(n,r)),n.precision=e,n.rounding=t,ea(2==P||3==P?r.neg():r,e,t,!0)):new n(1):new n(NaN)},er.cubeRoot=er.cbrt=function(){var e,t,r,n,i,o,u,s,a,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(V=!1,(o=this.s*$(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new l(o.toString()):(r=en(this.d),(o=((e=this.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=$(r,1/3),e=Z((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),u=(e=l.precision)+3;;)if(n=es((c=(a=(s=n).times(s).times(s)).plus(this)).plus(this).times(s),c.plus(a),u+2,1),en(s.d).slice(0,u)===(r=en(n.d)).slice(0,u)){if("9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(ea(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(ea(s,e+1,0),s.times(s).times(s).eq(this))){n=s;break}u+=4,i=1}return V=!0,ea(n,e,l.rounding,t)},er.decimalPlaces=er.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-Z(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},er.dividedBy=er.div=function(e){return es(this,new this.constructor(e))},er.dividedToIntegerBy=er.divToInt=function(e){var t=this.constructor;return ea(es(this,new t(e),0,1,1),t.precision,t.rounding)},er.equals=er.eq=function(e){return 0===this.cmp(e)},er.floor=function(){return ea(new this.constructor(this),this.e+1,3)},er.greaterThan=er.gt=function(e){return this.cmp(e)>0},er.greaterThanOrEqualTo=er.gte=function(e){var t=this.cmp(e);return 1==t||0===t},er.hyperbolicCosine=er.cosh=function(){var e,t,r,n,i,o=this,u=o.constructor,s=new u(1);if(!o.isFinite())return new u(o.s?1/0:NaN);if(o.isZero())return s;r=u.precision,n=u.rounding,u.precision=r+Math.max(o.e,o.sd())+4,u.rounding=1,(i=o.d.length)<32?t=(1/eA(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=eE(u,1,o.times(t),new u(1),!0);for(var a,c=e,l=new u(8);c--;)a=o.times(o),o=s.minus(a.times(l.minus(a.times(l))));return ea(o,u.precision=r,u.rounding=n,!0)},er.hyperbolicSine=er.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=eE(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=eE(o,2,i=i.times(1/eA(5,e)),i,!0);for(var u,s=new o(5),a=new o(16),c=new o(20);e--;)u=i.times(i),i=i.times(s.plus(u.times(a.times(u).plus(c))))}return o.precision=t,o.rounding=r,ea(i,t,r,!0)},er.hyperbolicTangent=er.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,es(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},er.inverseCosine=er.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?eh(t,n,i):new t(0):new t(NaN):e.isZero()?eh(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},er.inverseHyperbolicCosine=er.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,V=!1,r=r.times(r).minus(1).sqrt().plus(r),V=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},er.inverseHyperbolicSine=er.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,V=!1,r=r.times(r).plus(1).sqrt().plus(r),V=!0,n.precision=e,n.rounding=t,r.ln())},er.inverseHyperbolicTangent=er.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?ea(new o(i),e,t,!0):(o.precision=r=n-i.e,i=es(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},er.inverseSine=er.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t)?0===t?((e=eh(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},er.inverseTangent=er.atan=function(){var e,t,r,n,i,o,u,s,a,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=et)return(u=eh(l,f+4,h).times(.25)).s=c.s,u}else{if(!c.s)return new l(NaN);if(f+4<=et)return(u=eh(l,f+4,h).times(.5)).s=c.s,u}for(l.precision=s=f+10,l.rounding=1,e=r=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(V=!1,t=Math.ceil(s/7),n=1,a=c.times(c),u=new l(c),i=c;-1!==e;)if(i=i.times(a),o=u.minus(i.div(n+=2)),i=i.times(a),void 0!==(u=o.plus(i.div(n+=2))).d[t])for(e=t;u.d[e]===o.d[e]&&e--;);return r&&(u=u.times(2<<r-1)),V=!0,ea(u,l.precision=f,l.rounding=h,!0)},er.isFinite=function(){return!!this.d},er.isInteger=er.isInt=function(){return!!this.d&&Z(this.e/7)>this.d.length-2},er.isNaN=function(){return!this.s},er.isNegative=er.isNeg=function(){return this.s<0},er.isPositive=er.isPos=function(){return this.s>0},er.isZero=function(){return!!this.d&&0===this.d[0]},er.lessThan=er.lt=function(e){return 0>this.cmp(e)},er.lessThanOrEqualTo=er.lte=function(e){return 1>this.cmp(e)},er.logarithm=er.log=function(e){var t,r,n,i,o,u,s,a=this.constructor,c=a.precision,l=a.rounding;if(null==e)e=new a(10),t=!0;else{if(r=(e=new a(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new a(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new a(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(V=!1,eo((s=es(o=ev(this,u=c+5),t?ef(a,u+10):ev(e,u),u,1)).d,n=c,l))do if(u+=10,s=es(o=ev(this,u),t?ef(a,u+10):ev(e,u),u,1),!i){+en(s.d).slice(n+1,n+15)+1==1e14&&(s=ea(s,c+1,0));break}while(eo(s.d,n+=10,l))return V=!0,ea(s,c,l)},er.minus=er.sub=function(e){var t,r,n,i,o,u,s,a,c,l,f,h,d=this.constructor;if(e=new d(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new d(e.d||this.s!==e.s?this:NaN):e=new d(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,h=e.d,s=d.precision,a=d.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new d(3===a?-0:0);e=new d(this)}return V?ea(e,s,a):e}if(r=Z(e.e/7),l=Z(this.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,u=h.length):(t=h,r=l,u=c.length),o>(n=Math.max(Math.ceil(s/7),u)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(u=h.length))&&(u=n),n=0;n<u;n++)if(c[n]!=h[n]){f=c[n]<h[n];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),u=c.length,n=h.length-u;n>0;--n)c[u++]=0;for(n=h.length;n>o;){if(c[--n]<h[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=h[n]}for(;0===c[--u];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=el(c,r),V?ea(e,s,a):e):new d(3===a?-0:0)},er.modulo=er.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(V=!1,9==r.modulo?(t=es(this,e.abs(),0,3,1),t.s*=e.s):t=es(this,e,0,r.modulo,1),t=t.times(e),V=!0,this.minus(t)):ea(new r(this),r.precision,r.rounding):new r(NaN)},er.naturalExponential=er.exp=function(){return ey(this)},er.naturalLogarithm=er.ln=function(){return ev(this)},er.negated=er.neg=function(){var e=new this.constructor(this);return e.s=-e.s,ea(e)},er.plus=er.add=function(e){var t,r,n,i,o,u,s,a,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,s=f.precision,a=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),V?ea(e,s,a):e;if(o=Z(this.e/7),n=Z(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,u=l.length):(r=l,n=o,u=c.length),i>(u=(o=Math.ceil(s/7))>u?o+1:u+1)&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((u=c.length)-(i=l.length)<0&&(i=u,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),u=c.length;0==c[--u];)c.pop();return e.d=c,e.e=el(c,n),V?ea(e,s,a):e},er.precision=er.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(H+e);return this.d?(t=ed(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},er.round=function(){var e=this.constructor;return ea(new e(this),this.e+1,e.rounding)},er.sine=er.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:eE(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=eE(e,2,t=t.times(1/eA(5,r)),t);for(var i,o=new e(5),u=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(u.times(i).minus(s))));return t}(n,eF(n,r)),n.precision=e,n.rounding=t,ea(P>2?r.neg():r,e,t,!0)):new n(NaN)},er.squareRoot=er.sqrt=function(){var e,t,r,n,i,o,u=this.d,s=this.e,a=this.s,c=this.constructor;if(1!==a||!u||!u[0])return new c(!a||a<0&&(!u||u[0])?NaN:u?this:1/0);for(V=!1,0==(a=Math.sqrt(+this))||a==1/0?(((t=en(u)).length+s)%2==0&&(t+="0"),a=Math.sqrt(t),s=Z((s+1)/2)-(s<0||s%2),n=new c(t=a==1/0?"5e"+s:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+s)):n=new c(a.toString()),r=(s=c.precision)+3;;)if(n=(o=n).plus(es(this,o,r+2,1)).times(.5),en(o.d).slice(0,r)===(t=en(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(ea(n,s+1,1),e=!n.times(n).eq(this));break}if(!i&&(ea(o,s+1,0),o.times(o).eq(this))){n=o;break}r+=4,i=1}return V=!0,ea(n,s,c.rounding,e)},er.tangent=er.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=es(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,ea(2==P||4==P?r.neg():r,e,t,!0)):new n(NaN)},er.times=er.mul=function(e){var t,r,n,i,o,u,s,a,c,l=this.constructor,f=this.d,h=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!h||!h[0])return new l(!e.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?e.s/0:0*e.s);for(r=Z(this.e/7)+Z(e.e/7),(a=f.length)<(c=h.length)&&(o=f,f=h,h=o,u=a,a=c,c=u),o=[],n=u=a+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=a+n;i>n;)s=o[i]+h[n]*f[i-n-1]+t,o[i--]=s%1e7|0,t=s/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--u];)o.pop();return t?++r:o.shift(),e.d=o,e.e=el(o,r),V?ea(e,l.precision,l.rounding):e},er.toBinary=function(e,t){return eb(this,2,e,t)},er.toDecimalPlaces=er.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(ei(e,0,1e9),void 0===t?t=n.rounding:ei(t,0,8),ea(r,e+r.e+1,t))},er.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=ec(n,!0):(ei(e,0,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},er.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=ec(this):(ei(e,0,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},er.toFraction=function(e){var t,r,n,i,o,u,s,a,c,l,f,h,d=this.d,p=this.constructor;if(!d)return new p(this);if(c=r=new p(1),n=a=new p(0),u=(o=(t=new p(n)).e=ed(d)-this.e-1)%7,t.d[0]=$(10,u<0?7+u:u),null==e)e=o>0?t:c;else{if(!(s=new p(e)).isInt()||s.lt(c))throw Error(H+s);e=s.gt(t)?o>0?t:c:s}for(V=!1,s=new p(en(d)),l=p.precision,p.precision=o=7*d.length*2;f=es(s,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=a.plus(f.times(i)),a=i,i=t,t=s.minus(f.times(i)),s=i;return i=es(e.minus(r),n,0,1,1),a=a.plus(i.times(c)),r=r.plus(i.times(n)),a.s=c.s=this.s,h=1>es(c,n,o,1).minus(this).abs().cmp(es(a,r,o,1).minus(this).abs())?[c,n]:[a,r],p.precision=l,V=!0,h},er.toHexadecimal=er.toHex=function(e,t){return eb(this,16,e,t)},er.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:ei(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(V=!1,r=es(r,e,0,t,1).times(e),V=!0,ea(r)):(e.s=r.s,r=e),r},er.toNumber=function(){return+this},er.toOctal=function(e,t){return eb(this,8,e,t)},er.toPower=er.pow=function(e){var t,r,n,i,o,u,s=this,a=s.constructor,c=+(e=new a(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new a($(+s,c));if((s=new a(s)).eq(1))return s;if(n=a.precision,o=a.rounding,e.eq(1))return ea(s,n,o);if((t=Z(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=em(a,s,r,n),e.s<0?new a(1).div(i):ea(i,n,o);if((u=s.s)<0){if(t<e.d.length-1)return new a(NaN);if((1&e.d[t])==0&&(u=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=u,s}return(t=0!=(r=$(+s,c))&&isFinite(r)?new a(r+"").e:Z(c*(Math.log("0."+en(s.d))/Math.LN10+s.e+1)))>a.maxE+1||t<a.minE-1?new a(t>0?u/0:0):(V=!1,a.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=ey(e.times(ev(s,n+r)),n)).d&&eo((i=ea(i,n+5,1)).d,n,o)&&(t=n+10,+en((i=ea(ey(e.times(ev(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=ea(i,n+1,0))),i.s=u,V=!0,a.rounding=o,ea(i,n,o))},er.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=ec(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(ei(e,1,1e9),void 0===t?t=i.rounding:ei(t,0,8),r=ec(n=ea(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},er.toSignificantDigits=er.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(ei(e,1,1e9),void 0===t?t=r.rounding:ei(t,0,8)),ea(new r(this),e,t)},er.toString=function(){var e=this.constructor,t=ec(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},er.truncated=er.trunc=function(){return ea(new this.constructor(this),this.e+1,1)},er.valueOf=er.toJSON=function(){var e=this.constructor,t=ec(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var es=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u,s,a){var c,l,f,h,d,p,m,D,g,y,v,w,_,E,A,F,b,C,x,S,M=n.constructor,N=n.s==i.s?1:-1,O=n.d,B=i.d;if(!O||!O[0]||!B||!B[0])return new M(!n.s||!i.s||(O?B&&O[0]==B[0]:!B)?NaN:O&&0==O[0]||!B?0*N:N/0);for(a?(d=1,l=n.e-i.e):(a=1e7,d=7,l=Z(n.e/d)-Z(i.e/d)),x=B.length,b=O.length,y=(g=new M(N)).d=[],f=0;B[f]==(O[f]||0);f++);if(B[f]>(O[f]||0)&&l--,null==o?(E=o=M.precision,u=M.rounding):E=s?o+(n.e-i.e)+1:o,E<0)y.push(1),p=!0;else{if(E=E/d+2|0,f=0,1==x){for(h=0,B=B[0],E++;(f<b||h)&&E--;f++)A=h*a+(O[f]||0),y[f]=A/B|0,h=A%B|0;p=h||f<b}else{for((h=a/(B[0]+1)|0)>1&&(B=e(B,h,a),O=e(O,h,a),x=B.length,b=O.length),F=x,w=(v=O.slice(0,x)).length;w<x;)v[w++]=0;(S=B.slice()).unshift(0),C=B[0],B[1]>=a/2&&++C;do h=0,(c=t(B,v,x,w))<0?(_=v[0],x!=w&&(_=_*a+(v[1]||0)),(h=_/C|0)>1?(h>=a&&(h=a-1),D=(m=e(B,h,a)).length,w=v.length,1==(c=t(m,v,D,w))&&(h--,r(m,x<D?S:B,D,a))):(0==h&&(c=h=1),m=B.slice()),(D=m.length)<w&&m.unshift(0),r(v,m,w,a),-1==c&&(w=v.length,(c=t(B,v,x,w))<1&&(h++,r(v,x<w?S:B,w,a))),w=v.length):0===c&&(h++,v=[0]),y[f++]=h,c&&v[0]?v[w++]=O[F]||0:(v=[O[F]],w=1);while((F++<b||void 0!==v[0])&&E--)p=void 0!==v[0]}y[0]||y.shift()}if(1==d)g.e=l,R=p;else{for(f=1,h=y[0];h>=10;h/=10)f++;g.e=f+l*d-1,ea(g,s?o+g.e+1:o,u,p)}return g}}();function ea(e,t,r,n){var i,o,u,s,a,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,u=t,a=(l=f[h=0])/$(10,i-u-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(s=f.length))if(n){for(;s++<=h;)f.push(0);l=a=0,i=1,o%=7,u=o-7+1}else break e;else{for(l=s=f[h],i=1;s>=10;s/=10)i++;o%=7,a=(u=o-7+i)<0?0:l/$(10,i-u-1)%10|0}if(n=n||t<0||void 0!==f[h+1]||(u<0?l:l%$(10,i-u-1)),c=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):a>5||5==a&&(4==r||n||6==r&&(o>0?u>0?l/$(10,i-u):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=$(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,s=1,h--):(f.length=h+1,s=$(10,7-o),f[h]=u>0?(l/$(10,i-u)%$(10,u)|0)*s:0),c)for(;;)if(0==h){for(o=1,u=f[0];u>=10;u/=10)o++;for(u=f[0]+=s,s=1;u>=10;u/=10)s++;o!=s&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[h]+=s,1e7!=f[h])break;f[h--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return V&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function ec(e,t,r){if(!e.isFinite())return ew(e);var n,i=e.e,o=en(e.d),u=o.length;return t?(r&&(n=r-u)>0?o=o.charAt(0)+"."+o.slice(1)+ep(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+ep(-i-1)+o,r&&(n=r-u)>0&&(o+=ep(n))):i>=u?(o+=ep(i+1-u),r&&(n=r-i-1)>0&&(o=o+"."+ep(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-u)>0&&(i+1===u&&(o+="."),o+=ep(n))),o}function el(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function ef(e,t,r){if(t>ee)throw V=!0,r&&(e.precision=r),Error(q);return ea(new e(Y),t,1,!0)}function eh(e,t,r){if(t>et)throw Error(q);return ea(new e(U),t,r,!0)}function ed(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ep(e){for(var t="";e--;)t+="0";return t}function em(e,t,r,n){var i,o=new e(1),u=Math.ceil(n/7+4);for(V=!1;;){if(r%2&&eC((o=o.times(t)).d,u)&&(i=!0),0===(r=Z(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}eC((t=t.times(t)).d,u)}return V=!0,o}function eD(e){return 1&e.d[e.d.length-1]}function eg(e,t,r){for(var n,i,o=new e(t[0]),u=0;++u<t.length;){if(!(i=new e(t[u])).s){o=i;break}((n=o.cmp(i))===r||0===n&&o.s===r)&&(o=i)}return o}function ey(e,t){var r,n,i,o,u,s,a,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(V=!1,a=p):a=t,s=new h(.03125);e.e>-2;)e=e.times(s),f+=5;for(a+=n=Math.log($(2,f))/Math.LN10*2+5|0,r=o=u=new h(1),h.precision=a;;){if(o=ea(o.times(e),a,1),r=r.times(++l),en((s=u.plus(es(o,r,a,1))).d).slice(0,a)===en(u.d).slice(0,a)){for(i=f;i--;)u=ea(u.times(u),a,1);if(null!=t)return h.precision=p,u;if(!(c<3&&eo(u.d,a-n,d,c)))return ea(u,h.precision=p,d,V=!0);h.precision=a+=10,r=o=s=new h(1),l=0,c++}u=s}}function ev(e,t){var r,n,i,o,u,s,a,c,l,f,h,d=1,p=e,m=p.d,D=p.constructor,g=D.rounding,y=D.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new D(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(V=!1,l=y):l=t,D.precision=l+=10,n=(r=en(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return c=ef(D,l+2,y).times(o+""),p=ev(new D(n+"."+r.slice(1)),l-10).plus(c),D.precision=y,null==t?ea(p,y,g,V=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=en((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,n>1?(p=new D("0."+r),o++):p=new D(n+"."+r.slice(1)),f=p,a=u=p=es(p.minus(1),p.plus(1),l,1),h=ea(p.times(p),l,1),i=3;;){if(u=ea(u.times(h),l,1),en((c=a.plus(es(u,new D(i),l,1))).d).slice(0,l)===en(a.d).slice(0,l)){if(a=a.times(2),0!==o&&(a=a.plus(ef(D,l+2,y).times(o+""))),a=es(a,new D(d),l,1),null!=t)return D.precision=y,a;if(!eo(a.d,l-10,g,s))return ea(a,D.precision=y,g,V=!0);D.precision=l+=10,c=u=p=es(f.minus(1),f.plus(1),l,1),h=ea(p.times(p),l,1),i=s=1}a=c,i+=2}}function ew(e){return String(e.s*e.s/0)}function e_(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),V&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function eE(e,t,r,n,i){var o,u,s,a,c=e.precision,l=Math.ceil(c/7);for(V=!1,a=r.times(r),s=new e(n);;){if(u=es(s.times(a),new e(t++*t++),c,1),s=i?n.plus(u):n.minus(u),n=es(u.times(a),new e(t++*t++),c,1),void 0!==(u=s.plus(n)).d[l]){for(o=l;u.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=n,n=u,u=o}return V=!0,u.d.length=l+1,u}function eA(e,t){for(var r=e;--t;)r*=e;return r}function eF(e,t){var r,n=t.s<0,i=eh(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return P=n?4:1,t;if((r=t.divToInt(i)).isZero())P=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return P=eD(r)?n?2:3:n?4:1,t;P=eD(r)?n?1:4:n?3:2}return t.minus(i).abs()}function eb(e,t,r,n){var i,o,u,s,a,c,l,f,h,d=e.constructor,p=void 0!==r;if(p?(ei(r,1,1e9),void 0===n?n=d.rounding:ei(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(u=(l=ec(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,u>=0&&(l=l.replace(".",""),(h=new d(1)).e=l.length-u,h.d=eu(ec(h),10,i),h.e=h.d.length),o=a=(f=eu(l,10,i)).length;0==f[--a];)f.pop();if(f[0]){if(u<0?o--:((e=new d(e)).d=f,e.e=o,f=(e=es(e,h,r,n,0,i)).d,o=e.e,c=R),u=f[r],s=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==u||c)&&(0===n||n===(e.s<0?3:2)):u>s||u===s&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(a=f.length;!f[a-1];--a);for(u=0,l="";u<a;u++)l+=j.charAt(f[u]);if(p){if(a>1)if(16==t||8==t){for(u=16==t?4:3,--a;a%u;a++)l+="0";for(a=(f=eu(l,i,t)).length;!f[a-1];--a);for(u=1,l="1.";u<a;u++)l+=j.charAt(f[u])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>a)for(o-=a;o--;)l+="0";else o<a&&(l=l.slice(0,o)+"."+l.slice(o))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=ew(e);return e.s<0?"-"+l:l}function eC(e,t){if(e.length>t)return e.length=t,!0}function ex(e){return new this(e).abs()}function eS(e){return new this(e).acos()}function eM(e){return new this(e).acosh()}function eN(e,t){return new this(e).plus(t)}function eO(e){return new this(e).asin()}function eB(e){return new this(e).asinh()}function eT(e){return new this(e).atan()}function ek(e){return new this(e).atanh()}function eI(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?eh(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=eh(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(es(e,t,o,1)),t=eh(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(es(e,t,o,1)):(r=eh(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function eR(e){return new this(e).cbrt()}function eP(e){return ea(e=new this(e),e.e+1,2)}function ej(e,t,r){return new this(e).clamp(t,r)}function eY(e){if(!e||"object"!=typeof e)throw Error(L+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=z[r]),void 0!==(n=e[r]))if(Z(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(H+r+": "+n);if(r="crypto",i&&(this[r]=z[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(W);else this[r]=!1;else throw Error(H+r+": "+n);return this}function eU(e){return new this(e).cos()}function ez(e){return new this(e).cosh()}function eV(e,t){return new this(e).div(t)}function eL(e){return new this(e).exp()}function eH(e){return ea(e=new this(e),e.e+1,3)}function eq(){var e,t,r=new this(0);for(e=0,V=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return V=!0,new this(1/0);r=t}return V=!0,r.sqrt()}function eW(e){return e instanceof tn||e&&e.toStringTag===G||!1}function eG(e){return new this(e).ln()}function eZ(e,t){return new this(e).log(t)}function e$(e){return new this(e).log(2)}function eJ(e){return new this(e).log(10)}function eQ(){return eg(this,arguments,-1)}function eX(){return eg(this,arguments,1)}function eK(e,t){return new this(e).mod(t)}function e0(e,t){return new this(e).mul(t)}function e1(e,t){return new this(e).pow(t)}function e2(e){var t,r,n,i,o=0,u=new this(1),s=[];if(void 0===e?e=this.precision:ei(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=n/4}else throw Error(W);else for(;o<n;)s[o++]=1e7*Math.random()|0;for(n=s[--o],e%=7,n&&e&&(i=$(10,7-e),s[o]=(n/i|0)*i);0===s[o];o--)s.pop();if(o<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return u.e=r,u.d=s,u}function e3(e){return ea(e=new this(e),e.e+1,this.rounding)}function e8(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function e4(e){return new this(e).sin()}function e5(e){return new this(e).sinh()}function e6(e){return new this(e).sqrt()}function e7(e,t){return new this(e).sub(t)}function e9(){var e=0,t=arguments,r=new this(t[0]);for(V=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return V=!0,ea(r,this.precision,this.rounding)}function te(e){return new this(e).tan()}function tt(e){return new this(e).tanh()}function tr(e){return ea(e=new this(e),e.e+1,1)}er[Symbol.for("nodejs.util.inspect.custom")]=er.toString,er[Symbol.toStringTag]="Decimal";var tn=er.constructor=function e(t){var r,n,i;function o(e){var t,r,n;if(!(this instanceof o))return new o(e);if(this.constructor=o,eW(e)){this.s=e.s,V?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;V?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return e_(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),K.test(e)?e_(this,e):function(e,t){var r,n,i,o,u,s,a,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),K.test(t))return e_(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Q.test(t))r=16,t=t.toLowerCase();else if(J.test(t))r=2;else if(X.test(t))r=8;else throw Error(H+t);for((o=t.search(/p/i))>0?(a=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),u=(o=t.indexOf("."))>=0,n=e.constructor,u&&(o=(s=(t=t.replace(".","")).length)-o,i=em(n,new n(r),o,2*o)),o=l=(c=eu(t,r,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=el(c,l),e.d=c,V=!1,u&&(e=es(e,i,4*s)),a&&(e=e.times(54>Math.abs(a)?$(2,a):tn.pow(2,a))),V=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,e_(this,e.toString());throw Error(H+e)}if(o.prototype=er,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=eY,o.clone=e,o.isDecimal=eW,o.abs=ex,o.acos=eS,o.acosh=eM,o.add=eN,o.asin=eO,o.asinh=eB,o.atan=eT,o.atanh=ek,o.atan2=eI,o.cbrt=eR,o.ceil=eP,o.clamp=ej,o.cos=eU,o.cosh=ez,o.div=eV,o.exp=eL,o.floor=eH,o.hypot=eq,o.ln=eG,o.log=eZ,o.log10=eJ,o.log2=e$,o.max=eQ,o.min=eX,o.mod=eK,o.mul=e0,o.pow=e1,o.random=e2,o.round=e3,o.sign=e8,o.sin=e4,o.sinh=e5,o.sqrt=e6,o.sub=e7,o.sum=e9,o.tan=te,o.tanh=tt,o.trunc=tr,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(z);function ti(e){return"number"==typeof e}function to(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 tu(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function ts(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function ta(e){return e&&!0===e.constructor.prototype.isUnit||!1}function tc(e){return"string"==typeof e}Y=new tn(Y),U=new tn(U);var tl=Array.isArray;function tf(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function th(e){return Array.isArray(e)||tf(e)}function td(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tp(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tm(e){return e&&!0===e.constructor.prototype.isRange||!1}function tD(e){return e&&!0===e.constructor.prototype.isIndex||!1}function tg(e){return"boolean"==typeof e}function ty(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function tv(e){return e&&!0===e.constructor.prototype.isHelp||!1}function tw(e){return"function"==typeof e}function t_(e){return e instanceof Date}function tE(e){return e instanceof RegExp}function tA(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!tu(e)&&!ts(e))}function tF(e){return null===e}function tb(e){return void 0===e}function tC(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function tx(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function tS(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tM(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function tN(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function tO(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function tB(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tT(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function tk(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function tI(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function tR(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function tP(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function tj(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function tY(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function tU(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function tz(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function tV(e){return e&&!0===e.constructor.prototype.isChain||!1}function tL(e){var t=typeof e;return"object"===t?null===e?"null":to(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function tH(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return tH(e)});if(e instanceof Date)return new Date(e.valueOf());if(to(e))return e;if(tA(e)){var r=e,n=tH,i={};for(var o in r)tW(r,o)&&(i[o]=n(r[o]));return i}throw TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function tq(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!tq(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!tq(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function tW(e,t){return e&&Object.hasOwnProperty.call(e,t)}function tG(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(tZ));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function tZ(e){return e&&"?"===e[0]?e.slice(1):e}var t$=tG("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=tn.clone({precision:r.precision,modulo:tn.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0});let tJ=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},tQ=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},tX=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},tK=function(){throw SyntaxError("Invalid Param")};function t0(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let t1={re:0,im:0},t2=function(e,t){if(null==e)t1.re=t1.im=0;else if(void 0!==t)t1.re=e,t1.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)t1.re=e.re,t1.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return t3.INFINITY;t1.re=e.abs*Math.cos(e.arg),t1.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return t3.INFINITY;t1.re=e.r*Math.cos(e.phi),t1.im=e.r*Math.sin(e.phi)}else 2===e.length?(t1.re=e[0],t1.im=e[1]):tK();break;case"string":t1.im=t1.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&tK();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&tK()," "===r[e+1]||isNaN(r[e+1])?t1.im+=parseFloat((i%2?"-":"")+"1"):(t1.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&tK(),"i"===r[e+1]||"I"===r[e+1]?(t1.im+=parseFloat((i%2?"-":"")+t),e++):t1.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&tK();break;case"number":t1.im=0,t1.re=e;break;default:tK()}return isNaN(t1.re)||isNaN(t1.im),t1};function t3(e,t){if(!(this instanceof t3))return new t3(e,t);let r=t2(e,t);this.re=r.re,this.im=r.im}function t8(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}t3.prototype={re:0,im:0,sign:function(){let e=tX(this.re,this.im);return new t3(this.re/e,this.im/e)},add:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t3.NAN:t3.INFINITY:new t3(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t3.NAN:t3.INFINITY:new t3(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;return n&&u||i&&o?t3.NAN:n||i?t3.INFINITY:0===r.im&&0===this.im?new t3(this.re*r.re,0):new t3(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=t2(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;if(o&&u||n&&i)return t3.NAN;if(u||n)return t3.INFINITY;if(o||i)return t3.ZERO;if(0===r.im)return new t3(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new t3((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new t3((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=t2(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return t3.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new t3(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new t3(Math.pow(this.im,r.re),0);case 1:return new t3(0,Math.pow(this.im,r.re));case 2:return new t3(-Math.pow(this.im,r.re),0);case 3:return new t3(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return t3.ZERO;let i=Math.atan2(this.im,this.re),o=t0(this.re,this.im),u=Math.exp(r.re*o-r.im*i),s=r.im*o+r.re*i;return new t3(u*Math.cos(s),u*Math.sin(s))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new t3(Math.sqrt(e),0);else return new t3(0,Math.sqrt(-e));let r=Math.sqrt(.5*(tX(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new t3(r,t<0?-n:n):new t3(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new t3(e,0):new t3(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e,t=this.re,r=this.im;return new t3(Math.expm1(t)*Math.cos(r)+-2*(e=Math.sin(.5*r))*e,Math.exp(t)*Math.sin(r))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new t3(Math.log(e),0):new t3(t0(e,t),Math.atan2(t,e))},abs:function(){return tX(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new t3(Math.sin(e)*tJ(t),Math.cos(e)*tQ(t))},cos:function(){let e=this.re,t=this.im;return new t3(Math.cos(e)*tJ(t),-Math.sin(e)*tQ(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+tJ(t);return new t3(Math.sin(e)/r,tQ(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-tJ(t);return new t3(-Math.sin(e)/r,tQ(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*tJ(2*t)+.5*Math.cos(2*e);return new t3(Math.cos(e)*tJ(t)/r,Math.sin(e)*tQ(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*tJ(2*t)-.5*Math.cos(2*e);return new t3(Math.sin(e)*tJ(t)/r,-Math.cos(e)*tQ(t)/r)},asin:function(){let e=this.re,t=this.im,r=new t3(t*t-e*e+1,-2*e*t).sqrt(),n=new t3(r.re-t,r.im+e).log();return new t3(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new t3(t*t-e*e+1,-2*e*t).sqrt(),n=new t3(r.re-t,r.im+e).log();return new t3(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new t3(0,1/0);if(-1===t)return new t3(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new t3((1-t*t-e*e)/r,-2*e/r).log();return new t3(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new t3(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).atan():new t3(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(0,1/0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).acos():new t3(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).asin():new t3(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new t3(tQ(e)*Math.cos(t),tJ(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new t3(tJ(e)*Math.cos(t),tQ(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=tJ(e)+Math.cos(t);return new t3(tQ(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=tJ(e)-Math.cos(t);return new t3(tQ(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-tJ(2*e);return new t3(-2*tQ(e)*Math.cos(t)/r,2*tJ(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+tJ(2*e);return new t3(2*tJ(e)*Math.cos(t)/r,-2*tQ(e)*Math.sin(t)/r)},asinh:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t3(0,0);let t=Math.abs(e),r=Math.log(t+Math.sqrt(t*t+1));return new t3(e<0?-r:r,0)}let r=new t3(e*e-t*t+1,2*e*t).sqrt();return new t3(e+r.re,t+r.im).log()},acosh:function(){let e=this.re,t=this.im;if(0===t){if(e>1)return new t3(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new t3(Math.log(-e+t),Math.PI)}return new t3(0,Math.acos(e))}let r=new t3(e-1,t).sqrt(),n=new t3(e+1,t).sqrt();return new t3(e+r.re*n.re-r.im*n.im,t+r.re*n.im+r.im*n.re).log()},atanh:function(){let e=this.re,t=this.im;if(0===t)return 0===e?new t3(0,0):1===e?new t3(1/0,0):-1===e?new t3(-1/0,0):-1<e&&e<1?new t3(.5*Math.log((1+e)/(1-e)),0):e>1?new t3(.5*Math.log((e+1)/(e-1)),-Math.PI/2):new t3(.5*Math.log(-((1+e)/(1-e))),Math.PI/2);let r=1-e,n=1+e,i=r*r+t*t;if(0===i)return new t3(-1!==e?e/0:0,0!==t?t/0:0);let o=(n*r-t*t)/i,u=(t*r+n*t)/i;return new t3(t0(o,u)/2,Math.atan2(u,o)/2)},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t3(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).atanh():new t3(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t3(1/0,0);let t=1/e;return new t3(Math.log(t+Math.sqrt(t*t+1)),0)}let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).asinh():new t3(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return t3.INFINITY;let r=e*e+t*t;return 0!==r?new t3(e/r,-t/r).acosh():new t3(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return t3.INFINITY;if(this.isInfinite())return t3.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new t3(e/r,-t/r)},conjugate:function(){return new t3(this.re,-this.im)},neg:function(){return new t3(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new t3(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new t3(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new t3(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=t2(e,t);return Math.abs(r.re-this.re)<=t3.EPSILON&&Math.abs(r.im-this.im)<=t3.EPSILON},clone:function(){return new t3(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<t3.EPSILON&&(e=0),Math.abs(t)<t3.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},t3.ZERO=new t3(0,0),t3.ONE=new t3(1,0),t3.I=new t3(0,1),t3.PI=new t3(Math.PI,0),t3.E=new t3(Math.E,0),t3.INFINITY=new t3(1/0,1/0),t3.NAN=new t3(NaN,NaN),t3.EPSILON=1e-15;function t4(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t8(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function t5(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=t6(t);switch(r){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t7(e),n="number"==typeof t?re(r,r.exponent+1+t):r,i=n.coefficients,o=n.exponent+1,u=o+(t||0);return i.length<u&&(i=i.concat(rt(u-i.length))),o<0&&(i=rt(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(e,n);case"exponential":return t9(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=re(t7(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(ti(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else for(var u=Math.abs(n-o)-(i.length-1),s=0;s<u;s++)i.push(0);for(var a=Math.abs(n-o),c=1;a>0;)c++,a--;var l=i.slice(c).join(""),f=ti(t)&&l.length||l.match(/[1-9]/)?"."+l:"",h=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+o.toString();return r.sign+h}(e,n);case"bin":return t4(e,2,i);case"oct":return t4(e,8,i);case"hex":return t4(e,16,i);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=ro(null==r?void 0:r.lowerExp,-3),i=ro(null==r?void 0:r.upperExp,5),o=t7(e),u=t?re(o,t):o;if(u.exponent<n||u.exponent>=i)return t9(e,t);var s=u.coefficients,a=u.exponent;s.length<t&&(s=s.concat(rt(t-s.length))),s=s.concat(rt(a-s.length+1+(s.length<t?t-s.length:0))),s=rt(-a).concat(s);var c=a>0?a:0;return c<s.length-1&&s.splice(c+1,0,"."),u.sign+s.join("")})(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function t6(e){var t,r,n="auto";if(void 0!==e)if(ti(e))t=e;else if(to(e))t=e.toNumber();else if(tA(e))void 0!==e.precision&&(t=ri(e.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(r=ri(e.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:t,wordSize:r}}function t7(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===u.length&&(u.push(0),i++),{sign:r,coefficients:u,exponent:i}}function t9(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t7(e),n=t?re(r,t):r,i=n.coefficients,o=n.exponent;i.length<t&&(i=i.concat(rt(t-i.length)));var u=i.shift();return n.sign+u+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function re(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function rt(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var rr=Number.EPSILON||2220446049250313e-31;function rn(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<=rr||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function ri(e,t){return ti(e)?e:to(e)?e.toNumber():void t()}function ro(e,t){return ti(e)?e:to(e)?e.toNumber():t}var ru=tG("Complex",[],()=>(Object.defineProperty(t3,"name",{value:"Complex"}),t3.prototype.constructor=t3,t3.prototype.type="Complex",t3.prototype.isComplex=!0,t3.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},t3.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},t3.prototype.format=function(e){var t=this.im,r=this.re,n=t5(this.re,e),i=t5(this.im,e),o=ti(e)?e:e?e.precision:null;if(null!==o){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},t3.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return t3(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(ti(r)){if(ta(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),ti(n))return new t3({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},t3.prototype.valueOf=t3.prototype.toString,t3.fromJSON=function(e){return new t3(e)},t3.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},t3),{isClass:!0}),rs=a(42),ra=tG("Fraction",[],()=>(Object.defineProperty(rs,"name",{value:"Fraction"}),rs.prototype.constructor=rs,rs.prototype.type="Fraction",rs.prototype.isFraction=!0,rs.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},rs.fromJSON=function(e){return new rs(e)},rs),{isClass:!0}),rc=tG("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function rl(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function rf(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function rh(e,t){return ti(e)?e:to(e)?e.toNumber():t}function rd(e,t){var r=function(e,t){var r;if("number"==typeof e)return t5(e,t);if(to(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i,o,u,s,a,{notation:c,precision:l,wordSize:f}=t6(t);switch(c){case"fixed":return r=e,n=l,r.toFixed(n);case"exponential":return rf(e,l);case"engineering":return i=e,o=l,s=(u=i.e)%3==0?u:u<0?u-3-u%3:u-u%3,(a=i.mul(Math.pow(10,-s)).toPrecision(o)).includes("e")&&(a=new i.constructor(a).toFixed()),a+"e"+(u>=0?"+":"")+s.toString();case"bin":return rl(e,2,f);case"oct":return rl(e,8,f);case"hex":return rl(e,16,f);case"auto":var h=rh(null==t?void 0:t.lowerExp,-3),d=rh(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";var p=e.toSignificantDigits(l),m=p.e;return(m>=h&&m<d?p.toFixed():rf(e,l)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return rd(t,r);for(var n="[",i=t.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=e(t[o],r);return n+"]"}(e,t);if(tc(e))return rp(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>rp(r)+": "+rd(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function rp(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);r+=i in rm?rm[i]:i,n++}return'"'+r+'"'}var rm={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function rD(e,t,r){if(!(this instanceof rD))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function rg(e,t,r){if(!(this instanceof rg))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function ry(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function rv(e,t){if(0===t.length){if(Array.isArray(e))throw new rD(e.length,0)}else!function e(t,r,n){var i,o=t.length;if(o!==r[n])throw new rD(o,r[n]);if(n<r.length-1){var u=n+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new rD(r.length-1,r.length,"<");e(t[i],r,u)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new rD(r.length+1,r.length,">")}(e,t,0)}function rw(e,t){if(void 0!==e){if(!ti(e)||!t8(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new rg(e,t)}}function r_(e,t,r){if(!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!ti(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rd(t)+")")}),(ti(e)||to(e))&&(e=[e]),function e(t,r,n,i){var o,u,s=t.length,a=r[n],c=Math.min(s,a);if(t.length=a,n<r.length-1){var l=n+1;for(o=0;o<c;o++)Array.isArray(u=t[o])||(u=[u],t[o]=u),e(u,r,l,i);for(o=c;o<a;o++)u=[],t[o]=u,e(u,r,l,i)}else{for(o=0;o<c;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=c;o<a;o++)t[o]=i}}(e,t,0,void 0!==r?r:0),e}function rE(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new rD(0,n,"!=");var i=rF(t=rA(t,n));if(n!==i)throw new rD(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var o=t[i];r=[];for(var u=n.length/o,s=0;s<u;s++)r.push(n.slice(s*o,(s+1)*o));n=r}return n}(r,t)}catch(e){if(e instanceof rD)throw new rD(i,n,"!=");throw e}}function rA(e,t){var r=rF(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function rF(e){return e.reduce((e,t)=>e*t,1)}function rb(e,t,r,n){var i=n||ry(e);if(r)for(var o=0;o<r;o++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,o;if(Array.isArray(t)){var u=n+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],r,u)}else for(var s=n;s<r;s++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function rC(e,t){for(var r,n=0,i=0;i<e.length;i++){var o=e[i],u=Array.isArray(o);if(0===i&&u&&(n=o.length),u&&o.length!==n)return;var s=u?rC(o,t):t(o);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function rx(e,t){for(var r=t.length,n=e.length,i=0;i<n;i++){var o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[o]))}}function rS(e,t){var r,n,i,o=ry(e);if(tq(o,t))return e;rx(o,t);var u=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(e=>e.length),i=Math.max(...n),o=Array(i).fill(null),u=0;u<t.length;u++)for(var s=t[u],a=n[u],c=0;c<a;c++){var l=i-a+c;s[c]>o[l]&&(o[l]=s[c])}for(var f=0;f<t.length;f++)rx(t[f],o);return o}(o,t),s=u.length,a=[...Array(s-o.length).fill(1),...o],c=B([],e);o.length<s&&(o=ry(c=rE(c,a)));for(var l=0;l<s;l++){o[l]<u[l]&&(o=ry((r=c,n=u[l],i=l,c=function(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,r){return function e(t,r,n,i){if(!(i<n))return t.concat(r);if(t.length!==r.length)throw new rD(t.length,r.length);for(var o=[],u=0;u<t.length;u++)o[u]=e(t[u],r[u],n,i+1);return o}(e,r,t,0)},e[0]);throw Error("Wrong number of arguments in function concat")}(...Array(n).fill(r),i))))}return c}function rM(e){return Object.keys(e.signatures||{}).reduce(function(e,t){return Math.max(e,(t.match(/,/g)||[]).length+1)},-1)}rD.prototype=RangeError(),rD.prototype.constructor=RangeError,rD.prototype.name="DimensionError",rD.prototype.isDimensionError=!0,rg.prototype=RangeError(),rg.prototype.constructor=RangeError,rg.prototype.name="IndexError",rg.prototype.isIndexError=!0;var rN=tG("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!tc(t))throw Error("Invalid datatype: "+t);if(tf(e))"DenseMatrix"===e.type?(this._data=tH(e._data),this._size=tH(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&tl(e.data)&&tl(e.size))this._data=e.data,this._size=e.size,rv(this._data,this._size),this._datatype=t||e.datatype;else if(tl(e))this._data=function e(t){return tf(t)?e(t.valueOf()):tl(t)?t.map(e):t}(e),this._size=ry(this._data),rv(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+tL(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;tl(n);)n=n[0];return n}return e._size=t.slice(0),e._data=r_(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var u=0,s=t.length;u<s;u++)t[u]>i[u]&&(i[u]=t[u],o=!0);o&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return rC(this._data,tL)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!tD(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new rD(n.length,e._size.length);for(var i=t.min(),o=t.max(),u=0,s=e._size.length;u<s;u++)rw(i[u],e._size[u]),rw(o[u],e._size[u]);return new r(function e(t,r,n,i){var o=i===n-1,u=r.dimension(i);return o?u.map(function(e){return rw(e,t.length),t[e]}).valueOf():u.map(function(o){return rw(o,t.length),e(t[o],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,u=t.size(),s=t.isScalar();if(tf(r)?(o=r.size(),r=r.valueOf()):o=ry(r),s){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!tq(o,u))try{r=0===o.length?rS([r],u):rS(r,u),o=ry(r)}catch(e){}if(u.length<e._size.length)throw new rD(u.length,e._size.length,"<");if(o.length<u.length){for(var a=0,c=0;1===u[a]&&1===o[a];)a++;for(;1===u[a];)c++,a++;r=rb(r,u.length,c,o)}if(!tq(u,o))throw new rD(u,o,">");i(e,t.max().map(function(e){return e+1}),n);var l=u.length;!function e(t,r,n,i,o){var u=o===i-1,s=r.dimension(o);u?s.forEach(function(e,r){rw(e),t[e]=n[r[0]]}):s.forEach(function(u,s){rw(u),e(t[u],r,n[s[0]],i,o+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);for(var t=0;t<e.length;t++)rw(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var o=e[n];rw(o,r.length),r=r[o]}return r},r.prototype.set=function(e,t,r){if(!tl(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new rD(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,o,u,s=this._data;for(n=0,o=e.length-1;n<o;n++)rw(u=e[n],s.length),s=s[u];return rw(u=e[e.length-1],s.length),s[u]=t,this},r.prototype.resize=function(e,t,r){if(!th(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=rE(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=rA(e,n),r},r.prototype.clone=function(){return new r({data:tH(this._data),size:tH(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=rM(e),i=function r(i,o){return tl(i)?i.map(function(e,t){return r(e,o.concat(t))}):1===n?e(i):2===n?e(i,o):e(i,o,t)}(this._data,[]),o=void 0!==this._datatype?rC(i,tL):void 0;return new r(i,o)},r.prototype.forEach=function(e){var t=this;!function r(n,i){tl(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(tl(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(e=>[e[n]]);t.push(new r(o,e._datatype))},u=0;u<n[1];u++)o(u);return t},r.prototype.toArray=function(){return tH(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return rd(this._data,e)},r.prototype.toString=function(){return rd(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),o=[],u=0;u<i;u++)o[u]=this._data[u+n][u+t];return new r({data:o,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!tl(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(to(n)&&(n=n.toNumber()),!ti(n)||!t8(n))throw TypeError("The parameter k must be an integer number")}else n=0;var o,u=n>0?n:0,s=n<0?-n:0,a=e[0],c=e[1],l=Math.min(a-s,c-u);if(tl(t)){if(t.length!==l)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(tf(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=to(o(0))?o(0).mul(0):0);var h=[];if(e.length>0){h=r_(h,e,i);for(var d=0;d<l;d++)h[d+s][d+u]=o(d)}return new r({data:h,size:[a,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!ti(e)||!t8(e)||!ti(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rw(e,this._size[0]),rw(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0});function rO(){return!0}function rB(){return!1}function rT(){}let rk="Argument is not a typed-function.",rI=function e(){let t,r;function n(e){return"object"==typeof e&&null!==e&&e.constructor===Object}let i=[{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:n},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:rO,isAny:!0},u=0,s={createCount:0};function a(e){let n,i=t.get(e);if(i)return i;let o='Unknown type "'+e+'"',u=e.toLowerCase();for(n of r)if(n.toLowerCase()===u){o+='. Did you mean "'+n+'" ?';break}throw TypeError(o)}function c(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=n?a(n).index:r.length,o=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let n=e[r].name;if(t.has(n))throw TypeError('Duplicate type name "'+n+'"');o.push(n),t.set(n,{name:n,test:e[r].test,isAny:e[r].isAny,index:i+r,conversionsTo:[]})}let u=r.slice(i);r=r.slice(0,i).concat(o).concat(u);for(let e=i+o.length;e<r.length;++e)t.get(r[e]).index=e}function l(){t=new Map,r=[],u=0,c([o],!1)}function f(e){let n=r.filter(r=>{let n=t.get(r);return!n.isAny&&n.test(e)});return n.length?n:["any"]}function h(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function d(e,t,r){let n,i;if(!h(e))throw TypeError(rk);let o=r&&r.exact,u=g(Array.isArray(t)?t.join(","):t),s=p(u);if(!o||s in e.signatures){let t=e._typedFunctionData.signatureMap.get(s);if(t)return t}let a=u.length;if(o){let t;for(t in n=[],e.signatures)n.push(e._typedFunctionData.signatureMap.get(t))}else n=e._typedFunctionData.signatures;for(let e=0;e<a;++e){let t,r=u[e],i=[];for(t of n){let n=w(t.params,e);if(n&&(!r.restParam||n.restParam)){if(!n.hasAny){let e=D(n);if(r.types.some(t=>!e.has(t.name)))continue}i.push(t)}}if(0===(n=i).length)break}for(i of n)if(i.params.length<=a)return i;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+p(u,", ")+"))")}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map(e=>e.name).join(t)}function m(e){let t=function(e){if(0===e.length)return[];let t=e.map(a);if(1===e.length)return t[0].conversionsTo;let r=new Set(e),n=new Set;for(let e=0;e<t.length;++e)for(let i of t[e].conversionsTo)r.has(i.from)||n.add(i.from);let i=[];for(let e of n){let r=u+1,n=null;for(let i=0;i<t.length;++i)for(let o of t[i].conversionsTo)o.from===e&&o.index<r&&(r=o.index,n=o);i.push(n)}return i}(e.types.map(e=>e.name)),r=e.hasAny,n=e.name,i=t.map(function(e){let t=a(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach(t=>e.typeSet.add(t.name))),e.typeSet}function g(e){let t=[];if("string"!=typeof e)throw TypeError("Signatures must be strings");let r=e.trim();if(""===r)return t;let n=r.split(",");for(let e=0;e<n.length;++e){let r=function(e){let t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map(e=>a(e.trim())),n=!1,i=t?"...":"";return{types:r.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:t}}(n[e].trim());if(r.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function y(e){let t=O(e);return!!t&&t.restParam}function v(e){if(!e||0===e.types.length)return rO;if(1===e.types.length)return a(e.types[0].name).test;if(2===e.types.length){let t=a(e.types[0].name).test,r=a(e.types[1].name).test;return function(e){return t(e)||r(e)}}{let t=e.types.map(function(e){return a(e.name).test});return function(e){for(let r=0;r<t.length;r++)if(t[r](e))return!0;return!1}}}function w(e,t){return t<e.length?e[t]:y(e)?O(e):null}function _(e,t){let r=w(e,t);return r?D(r):new Set}function E(e){return null===e.conversion||void 0===e.conversion}function A(e,t){let r=new Set;return e.forEach(e=>{let n;for(n of _(e.params,t))r.add(n)}),r.has("any")?["any"]:Array.from(r)}function F(e,t,r){let n,i,o,u=e||"unnamed",s=r;for(o=0;o<t.length;o++){let e=[];if(s.forEach(r=>{let n=v(w(r.params,o));(o<r.params.length||y(r.params))&&n(t[o])&&e.push(r)}),0===e.length){if((i=A(s,o)).length>0){let e=f(t[o]);return(n=TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:e,expected:i},n}}else s=e}let a=s.map(function(e){return y(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,a))return(n=TypeError("Too few arguments in function "+u+" (expected: "+(i=A(s,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:u,index:t.length,expected:i},n;let c=Math.max.apply(null,a);if(t.length>c)return(n=TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:c},n;let l=[];for(let e=0;e<t.length;++e)l.push(f(t[e]).join("|"));return(n=TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+u+".")).data={category:"mismatch",actual:l},n}function b(e){let t=r.length+1;for(let r=0;r<e.types.length;r++)t=Math.min(t,e.types[r].typeIndex);return t}function C(e){let t=u+1;for(let r=0;r<e.types.length;r++)E(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function x(e,t){let r,n,i=e.params,o=t.params,u=O(i),s=O(o),a=y(i),c=y(o);if(a&&u.hasAny){if(!c||!s.hasAny)return 1e7}else if(c&&s.hasAny)return -1e7;let l=0,f=0;for(r of i)r.hasAny&&++l,r.hasConversion&&++f;let h=0,d=0;for(r of o)r.hasAny&&++h,r.hasConversion&&++d;if(l!==h)return(l-h)*1e6;if(a&&u.hasConversion){if(!c||!s.hasConversion)return 1e5}else if(c&&s.hasConversion)return -1e5;if(f!==d)return(f-d)*1e4;if(a){if(!c)return 1e3}else if(c)return -1e3;let p=(i.length-o.length)*(a?-100:100);if(0!==p)return p;let m=[],D=0;for(let e=0;e<i.length;++e){let t=function(e,t){if(e.hasAny){if(!t.hasAny)return .1}else if(t.hasAny)return -.1;if(e.restParam){if(!t.restParam)return .01}else if(t.restParam)return -.01;let r=b(e)-b(t);if(r<0)return -.001;if(r>0)return .001;let n=C(e),i=C(t);if(e.hasConversion){if(!t.hasConversion)return(1+n)*1e-6}else if(t.hasConversion)return-(1e-6*(1+i));let o=n-i;return o<0?-1e-7:1e-7*(o>0)}(i[e],o[e]);m.push(t),D+=t}if(0!==D)return(D<0?-10:10)+D;let g=9,v=9/(m.length+1);for(n of m){if(0!==n)return(n<0?-g:g)+n;g-=v}return 0}function S(e){let t,r,n,i,o=[],u=[],s="";e.types.forEach(function(e){e.conversion&&(s+=e.conversion.from+"~>"+e.conversion.to+",",o.push(a(e.conversion.from).test),u.push(e.conversion.convert))}),s=s?s.slice(0,-1):"pass";let c=e=>e;switch(u.length){case 0:break;case 1:t=o[0],n=u[0],c=function(e){return t(e)?n(e):e};break;case 2:t=o[0],r=o[1],n=u[0],i=u[1],c=function(e){return t(e)?n(e):r(e)?i(e):e};break;default:c=function(e){for(let t=0;t<u.length;t++)if(o[t](e))return u[t](e);return e}}return Object.defineProperty(c,"name",{value:s}),c}function M(e,t,r){throw F(e,t,r)}function N(e){return B(e,0,e.length-1)}function O(e){return e[e.length-1]}function B(e,t,r){return Array.prototype.slice.call(e,t,r)}function T(e,t){return{referTo:{references:e,callback:t}}}function k(e){if("function"!=typeof e)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function I(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function R(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function P(e,t){if(!e)return t;if(t&&t!==e){let r=Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}l(),c(i);let j=s;function Y(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(s=function(e){let t="string"==typeof e,r=+!!t,i=t?e:"",o={};for(let e=r;e<arguments.length;++e){let r,u=arguments[e],s={};if("function"==typeof u?(r=u.name,"string"==typeof u.signature?s[u.signature]=u:h(u)&&(s=u.signatures)):n(u)&&(s=u,t||(r=function(e){let t;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(h(e[r])||"string"==typeof e[r].signature)&&(t=P(t,e[r].name));return t}(u))),0===Object.keys(s).length){let t=TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:u},t}t||(i=P(i,r)),function(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){let n=Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}(o,s)}return function(e,t){let r,n,i;if(s.createCount++,0===Object.keys(t).length)throw SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&(i=/\bthis(\(|\.signatures\b)/,Object.keys(t).forEach(e=>{let r=t[e];if(i.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}));let o=[],u=[],a={},c=[];for(r in t){let e;if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=g(r);if(!n)continue;o.forEach(function(e){if(function(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let r,i=_(e,n),o=_(t,n),u=!1;for(r of o)if(i.has(r)){u=!0;break}if(!u)return!1}let n=e.length,i=t.length,o=y(e),u=y(t);return o?u?n===i:i>=n:u?n>=i:n===i}(e,n))throw TypeError('Conflicting signatures "'+p(e)+'" and "'+p(n)+'".')}),o.push(n);let i=u.length;for(e of(u.push(t[r]),function e(t,r,n){if(!(r<t.length))return[n];{var i,o;let u=t[r],s=[];if(u.restParam){let e=u.types.filter(E);e.length<u.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(u)}else s=u.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return i=s,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}}(n.map(m),0,[]))){let t=p(e);c.push({params:e,name:t,fn:i}),e.every(e=>!e.hasConversion)&&(a[t]=i)}}c.sort(x);let l=function(e,t,r){let n=e.map(e=>R(e)?k(e.referToSelf.callback):I(e)?T(e.referTo.references,e.referTo.callback):e),i=Array(n.length).fill(!1),o=!0;for(;o;){o=!1;let e=!0;for(let u=0;u<n.length;++u){if(i[u])continue;let s=n[u];if(R(s))n[u]=s.referToSelf.callback(r),n[u].referToSelf=s.referToSelf,i[u]=!0,e=!1;else if(I(s)){let r=function(e,t,r){let n,i=[];for(n of e){let e=r[n];if("number"!=typeof e)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(e=t[e]))return!1;i.push(e)}return i}(s.referTo.references,n,t);r?(n[u]=s.referTo.callback.apply(this,r),n[u].referTo=s.referTo,i[u]=!0,e=!1):o=!0}}if(e&&o)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(u,a,el);for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(a[n]=l[a[n]]);let f=[],h=new Map;for(n of c)h.has(n.name)||(n.fn=l[n.fn],f.push(n),h.set(n.name,n));let d=f[0]&&f[0].params.length<=2&&!y(f[0].params),D=f[1]&&f[1].params.length<=2&&!y(f[1].params),w=f[2]&&f[2].params.length<=2&&!y(f[2].params),A=f[3]&&f[3].params.length<=2&&!y(f[3].params),F=f[4]&&f[4].params.length<=2&&!y(f[4].params),b=f[5]&&f[5].params.length<=2&&!y(f[5].params);for(let e=0;e<f.length;++e)f[e].test=function(e){let t,r,n;if(y(e)){let r=(t=N(e).map(v)).length,n=v(O(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=v(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=v(e[0]),n=v(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(v),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(f[e].params);let C=d?v(f[0].params[0]):rB,M=D?v(f[1].params[0]):rB,P=w?v(f[2].params[0]):rB,j=A?v(f[3].params[0]):rB,Y=F?v(f[4].params[0]):rB,U=b?v(f[5].params[0]):rB,z=d?v(f[0].params[1]):rB,V=D?v(f[1].params[1]):rB,L=w?v(f[2].params[1]):rB,H=A?v(f[3].params[1]):rB,q=F?v(f[4].params[1]):rB,W=b?v(f[5].params[1]):rB;for(let e=0;e<f.length;++e)f[e].implementation=function(e,t){let r=t,n="";if(e.some(e=>e.hasConversion)){let i=y(e),o=e.map(S);n=o.map(e=>e.name).join(";"),r=function(){let e=[],r=i?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=o[t](arguments[t]);return i&&(e[r]=arguments[r].map(o[r])),t.apply(this,e)}}let i=r;if(y(e)){let t=e.length-1;i=function(){return r.apply(this,B(arguments,0,t).concat([B(arguments,t)]))}}return n&&Object.defineProperty(i,"name",{value:n}),i}(f[e].params,f[e].fn);let G=d?f[0].implementation:rT,Z=D?f[1].implementation:rT,$=w?f[2].implementation:rT,J=A?f[3].implementation:rT,Q=F?f[4].implementation:rT,X=b?f[5].implementation:rT,K=d?f[0].params.length:-1,ee=D?f[1].params.length:-1,et=w?f[2].params.length:-1,er=A?f[3].params.length:-1,en=F?f[4].params.length:-1,ei=b?f[5].params.length:-1,eo=6*!!(d&&D&&w&&A&&F&&b),eu=f.length,es=f.map(e=>e.test),ea=f.map(e=>e.implementation),ec=function(){for(let e=eo;e<eu;e++)if(es[e](arguments))return ea[e].apply(this,arguments);return s.onMismatch(e,arguments,f)};function el(e,t){return arguments.length===K&&C(e)&&z(t)?G.apply(this,arguments):arguments.length===ee&&M(e)&&V(t)?Z.apply(this,arguments):arguments.length===et&&P(e)&&L(t)?$.apply(this,arguments):arguments.length===er&&j(e)&&H(t)?J.apply(this,arguments):arguments.length===en&&Y(e)&&q(t)?Q.apply(this,arguments):arguments.length===ei&&U(e)&&W(t)?X.apply(this,arguments):ec.apply(this,arguments)}try{Object.defineProperty(el,"name",{value:e})}catch(e){}return el.signatures=a,el._typedFunctionData={signatures:f,signatureMap:h},el}(i||"",o)}).create=e,s.createCount=j.createCount,s.onMismatch=M,s.throwMismatchError=M,s.createError=F,s.clear=l,s.clearConversions=function(){let e;for(e of r)t.get(e).conversionsTo=[];u=0},s.addTypes=c,s._findType=a,s.referTo=function(){let e=N(arguments).map(e=>p(g(e))),t=O(arguments);if("function"!=typeof t)throw TypeError("Callback function expected as last argument");return T(e,t)},s.referToSelf=k,s.convert=function(e,t){let r=a(t);if(r.test(e))return e;let n=r.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(a(n[t].from).test(e))return n[t].convert(e);throw Error("Cannot convert "+e+" to "+t)},s.findSignature=d,s.find=function(e,t,r){return d(e,t,r).implementation},s.isTypedFunction=h,s.warnAgainstDeprecatedThis=!0,s.addType=function(e,r){let n="any";!1!==r&&t.has("Object")&&(n="Object"),s.addTypes([e],n)},s.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};Y(e);let r=a(e.to),n=r.conversionsTo.find(t=>t.from===e.from);if(n)if(t&&t.override)s.removeConversion({from:n.from,to:e.to,convert:n.convert});else throw Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');r.conversionsTo.push({from:e.from,to:r.name,convert:e.convert,index:u++})},s.addConversions=function(e,t){e.forEach(e=>s.addConversion(e,t))},s.removeConversion=function(e){Y(e);let t=a(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,t=>t.from===e.from);if(!r)throw Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw Error("Conversion to remove does not match existing conversion");let n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},s.resolve=function(e,t){if(!h(e))throw TypeError(rk);let r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},s}();function rR(e,t){return!!e&&"object"==typeof e&&(!!tW(rj,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function rP(e){return"object"==typeof e&&e&&e.constructor===Object}var rj={length:!0,name:!0},rY={toString:!0,valueOf:!0,toLocaleString:!0};class rU{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){var t,r,n=this.wrappedObject;if(rP(n)&&rR(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||tW(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(tW(rY,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(rP(e)&&rR(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}entries(){var e,t;return e=this.keys(),t=e=>[e,this.get(e)],{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function rz(e){return!!e&&(e instanceof Map||e instanceof rU||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var rV=function(){return rV=rI.create,rI},rL=tG("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,o=rV();return o.clear(),o.addTypes([{name:"number",test:ti},{name:"Complex",test:tu},{name:"BigNumber",test:to},{name:"Fraction",test:ts},{name:"Unit",test:ta},{name:"identifier",test:e=>tc&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:tc},{name:"Chain",test:tV},{name:"Array",test:tl},{name:"Matrix",test:tf},{name:"DenseMatrix",test:td},{name:"SparseMatrix",test:tp},{name:"Range",test:tm},{name:"Index",test:tD},{name:"boolean",test:tg},{name:"ResultSet",test:ty},{name:"Help",test:tv},{name:"function",test:tw},{name:"Date",test:t_},{name:"RegExp",test:tE},{name:"null",test:tF},{name:"undefined",test:tb},{name:"AccessorNode",test:tC},{name:"ArrayNode",test:tx},{name:"AssignmentNode",test:tS},{name:"BlockNode",test:tM},{name:"ConditionalNode",test:tN},{name:"ConstantNode",test:tO},{name:"FunctionNode",test:tT},{name:"FunctionAssignmentNode",test:tB},{name:"IndexNode",test:tk},{name:"Node",test:tI},{name:"ObjectNode",test:tR},{name:"OperatorNode",test:tP},{name:"ParenthesisNode",test:tj},{name:"RangeNode",test:tY},{name:"RelationalNode",test:tU},{name:"SymbolNode",test:tz},{name:"Map",test:rz},{name:"Object",test:tA}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||rH(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||rq(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||rq(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||rq(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||rW(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||rH(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||rW(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||rq(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||rH(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||rW(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&th(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&th(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o});function rH(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function rq(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function rW(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}function rG(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return rG(e,t,r)}):t(e)}var rZ="number",r$="number, number";function rJ(e){return Math.abs(e)}function rQ(e,t){return e+t}function rX(e,t){return e-t}function rK(e,t){return e*t}function r0(e){return-e}rJ.signature=rZ,rQ.signature=r$,rX.signature=r$,rK.signature=r$,r0.signature=rZ;var r1=tG("abs",["typed"],e=>{var{typed:t}=e;return t("abs",{number:rJ,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e,!0))})}),r2="addScalar",r3=tG(r2,["typed"],e=>{var{typed:t}=e;return t(r2,{"number, number":rQ,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),r8=tG("bignumber",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw SyntaxError('String "'.concat(e,'" is out of range'));var u=new r(2).pow(Number(n)-1);return i.gte(u)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),r4="conj",r5=tG(r4,["typed"],e=>{var{typed:t}=e;return t(r4,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),r6=tG("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),r7="equalScalar",r9=tG(r7,["typed","config"],e=>{var{typed:t,config:r}=e,n=r6({typed:t});return t(r7,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return rn(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,rn(e.re,t.re,n)&&rn(e.im,t.im,n)}},n)});tG(r7,["typed","config"],e=>{var{typed:t,config:r}=e;return t(r7,{"number, number":function(e,t){return rn(e,t,r.epsilon)}})});function ne(e){return 0===e}ne.signature="number";var nt="isZero",nr=tG(nt,["typed"],e=>{var{typed:t}=e;return t(nt,{number:ne,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),nn=tG("multiplyScalar",["typed"],e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":rK,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),ni=tG("number",["typed"],e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=function(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!t)return null;var r={"0b":2,"0o":8,"0x":16}[t[1]];return{input:e,radix:r,integerPart:t[2],fractionalPart:t[3]}}(e);if(t){for(var r=parseInt(t.integerPart,t.radix),n=0,i=0;i<t.fractionalPart.length;i++)n+=parseInt(t.fractionalPart[i],t.radix)/Math.pow(t.radix,i+1);var o=r+n;if(isNaN(o))throw SyntaxError('String "'+t.input+'" is not a valid number');return o}var u=0,s=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(u=Number(s[2]),e=s[1]);var a=Number(e);if(isNaN(a))throw SyntaxError('String "'+e+'" is not a valid number');if(s){if(a>2**u-1)throw SyntaxError('String "'.concat(e,'" is out of range'));a>=2**(u-1)&&(a-=2**u)}return a},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))});return r.fromJSON=function(e){return parseFloat(e.value)},r}),no=tG("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!tc(t))throw Error("Invalid datatype: "+t);if(tf(e)){var r,n,u;r=this,n=e,u=t,"SparseMatrix"===n.type?(r._values=n._values?tH(n._values):void 0,r._index=tH(n._index),r._ptr=tH(n._ptr),r._size=tH(n._size),r._datatype=u||n._datatype):o(r,n.valueOf(),u||n._datatype)}else if(e&&tl(e.index)&&tl(e.ptr)&&tl(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(tl(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+tL(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=n.length,u=0,s=r,a=0;if(tc(i)&&(s=t.find(r,[i,i])||r,a=t.convert(0,i)),o>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<o;l++){var f=n[l];if(tl(f)){if(0===c&&u<f.length&&(u=f.length),c<f.length){var h=f[c];s(h,a)||(e._values.push(h),e._index.push(l))}}else 0===c&&u<1&&(u=1),s(f,a)||(e._values.push(f),e._index.push(l))}c++}while(c<u)}e._ptr.push(e._index.length),e._size=[o,u]}function u(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function s(e,t,r,n,i,o,u){i.splice(e,0,n),o.splice(e,0,t);for(var s=r+1;s<u.length;s++)u[s]++}function a(e,n,i,o){var u,s,a,c=o||0,l=r,f=0;tc(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var h=!l(c,f),d=e._size[0],p=e._size[1];if(i>p){for(s=p;s<i;s++)if(e._ptr[s]=e._values.length,h)for(u=0;u<d;u++)e._values.push(c),e._index.push(u);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>d){if(h){var m=0;for(s=0;s<p;s++){e._ptr[s]=e._ptr[s]+m,a=e._ptr[s+1]+m;var D=0;for(u=d;u<n;u++,D++)e._values.splice(a+D,0,c),e._index.splice(a+D,0,u),m++}e._ptr[p]=e._values.length}}else if(n<d){var g=0;for(s=0;s<p;s++){e._ptr[s]=e._ptr[s]-g;var y=e._ptr[s],v=e._ptr[s+1]-g;for(a=y;a<v;a++)(u=e._index[a])>n-1&&(e._values.splice(a,1),e._index.splice(a,1),g++)}e._ptr[s]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var o,u,s=n[0],a=n[1],c=[];for(o=0;o<s;o++)for(c[o]=[],u=0;u<a;u++)c[o][u]=0;for(u=0;u<a;u++)for(var l=r[u],f=r[u+1],h=l;h<f;h++)c[o=t[h]][u]=e?i?tH(e[h]):e[h]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return rC(this._values,tL)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!tD(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,o,u,s=t.size();if(s.length!==e._size.length)throw new rD(s.length,e._size.length);var a=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)rw(a[r],e._size[r]),rw(c[r],e._size[r]);var l=e._values,f=e._index,h=e._ptr,d=t.dimension(0),p=t.dimension(1),m=[],D=[];d.forEach(function(e,t){D[e]=t[0],m[e]=!0});var g=l?[]:void 0,y=[],v=[];return p.forEach(function(e){for(v.push(y.length),o=h[e],u=h[e+1];o<u;o++)!0===m[r=f[o]]&&(y.push(D[r]),g&&g.push(l[o]))}),v.push(y.length),new i({values:g,index:y,ptr:v,size:s,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),u=t.isScalar();if(tf(r)?(i=r.size(),r=r.toArray()):i=ry(r),u){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new rD(o.length,e._size.length,"<");if(i.length<o.length){for(var s=0,a=0;1===o[s]&&1===i[s];)s++;for(;1===o[s];)a++,s++;r=rb(r,o.length,a,i)}if(!tq(o,i))throw new rD(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){rw(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){rw(t),l.forEach(function(o,u){rw(o),e.set([t,o],r[i[0]][u[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];rw(t,this._size[0]),rw(r,this._size[1]);var n=u(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!tl(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rD(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],c=e[1],l=this._size[0],f=this._size[1],h=r,d=0;tc(this._datatype)&&(h=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(a(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),rw(o,l),rw(c,f);var p=u(o,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===o?h(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:h(n,d)||s(p,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!th(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!ti(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rd(n)+")")}),a(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!tl(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!ti(t)||!t8(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+rd(e)+")")});var r=this._size[0]*this._size[1],n=(e=rA(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],a=0;a<i._ptr.length;a++)for(var c=0;c<i._ptr[a+1]-i._ptr[a];c++)o.push(a);for(var l=i._values.slice(),f=i._index.slice(),h=0;h<i._index.length;h++){var d=f[h],p=o[h],m=d*i._size[1]+p;o[h]=m%e[1],f[h]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var D=0;D<i._ptr.length;D++)i._ptr[D]=0;for(var g=0;g<l.length;g++){var y=f[g],v=o[g],w=l[g];s(u(y,i._ptr[v],i._ptr[v+1],i._index),y,v,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?tH(this._values):void 0,index:tH(this._index),ptr:tH(this._ptr),size:tH(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this,u=this._size[0],s=this._size[1],a=rM(e);return function(e,n,o,u,s){var a=[],c=[],l=[],f=r,h=0;tc(e._datatype)&&(f=t.find(r,[e._datatype,e._datatype])||r,h=t.convert(0,e._datatype));for(var d=function(e,t,r){e=u(e,t,r),f(e,h)||(a.push(e),c.push(t))},p=0;p<=o;p++){l.push(a.length);var m=e._ptr[p],D=e._ptr[p+1];if(s)for(var g=m;g<D;g++){var y=e._index[g];y>=0&&y<=n&&d(e._values[g],y-0,p-0)}else{for(var v={},w=m;w<D;w++)v[e._index[w]]=e._values[w];for(var _=0;_<=n;_++)d(_ in v?v[_]:0,_-0,p-0)}}return l.push(a.length),new i({values:a,index:c,ptr:l,size:[n-0+1,o-0+1]})}(this,u-1,s-1,function(t,r,n){return 1===a?e(t):2===a?e(t,[r,n]):e(t,[r,n],o)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],u=this._ptr[i+1];if(t)for(var s=o;s<u;s++){var a=this._index[s];e(this._values[s],[a,i],this)}else{for(var c={},l=o;l<u;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+rd(t,e)+" x "+rd(r,e)+"] density: "+rd(n,e)+"\n",o=0;o<r;o++)for(var u=this._ptr[o],s=this._ptr[o+1],a=u;a<s;a++)i+="\n ("+rd(this._index[a],e)+", "+rd(o,e)+") ==> "+(this._values?rd(this._values[a],e):"X");return i},i.prototype.toString=function(){return rd(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],u=Math.min(n-r,o-t),s=[],a=[],c=[];c[0]=0;for(var l=t;l<o&&s.length<u;l++)for(var f=this._ptr[l],h=this._ptr[l+1],d=f;d<h;d++){var p=this._index[d];if(p===l-t+r){s.push(this._values[d]),a[s.length-1]=p-r;break}}return c.push(s.length),new i({values:s,index:a,ptr:c,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,u,s){if(!tl(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(to(e)&&(e=e.toNumber()),!ti(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(to(o)&&(o=o.toNumber()),!ti(o)||!t8(o))throw TypeError("The parameter k must be an integer number")}else o=0;var a,c=r,l=0;tc(s)&&(c=t.find(r,[s,s])||r,l=t.convert(0,s));var f=o>0?o:0,h=o<0?-o:0,d=e[0],p=e[1],m=Math.min(d-h,p-f);if(tl(n)){if(n.length!==m)throw Error("Invalid value array length");a=function(e){return n[e]}}else if(tf(n)){var D=n.size();if(1!==D.length||D[0]!==m)throw Error("Invalid matrix length");a=function(e){return n.get([e])}}else a=function(){return n};for(var g=[],y=[],v=[],w=0;w<p;w++){v.push(g.length);var _=w-f;if(_>=0&&_<m){var E=a(_);c(E,l)||(y.push(_+h),g.push(E))}}return v.push(g.length),new i({values:g,index:y,ptr:v,size:[d,p]})},i.prototype.swapRows=function(e,t){if(!ti(e)||!t8(e)||!ti(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rw(e,this._size[0]),rw(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var o=n[e],u=n[e+1],s=o;s<u;s++)i(r[s],t[s])},i._swapRows=function(e,t,r,n,i,o){for(var s=0;s<r;s++){var a=o[s],c=o[s+1],l=u(e,a,c,i),f=u(t,a,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var h=n[l];n[l]=n[f],n[f]=h}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var d=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,d),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),nu="subtractScalar",ns=tG(nu,["typed"],e=>{var{typed:t}=e;return t(nu,{"number, number":rX,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),na="unaryMinus",nc=tG(na,["typed"],e=>{var{typed:t}=e;return t(na,{number:r0,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>t=>rG(t,e,!0))})}),nl=tG("fraction",["typed","Fraction"],e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf(e=>t=>rG(t,e))})}),nf="matrix",nh=tG(nf,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(nf,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}});function nd(){throw Error('No "bignumber" implementation available')}function np(){throw Error('No "fraction" implementation available')}var nm=tG("numeric",["number","?bignumber","?fraction"],e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):nd,Fraction:n?e=>n(e):np};return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=arguments.length>2?arguments[2]:void 0;if(void 0!==r)throw SyntaxError("numeric() takes one or two arguments");var n=tL(e);if(!(n in i))throw TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}}),nD="size",ng=tG(nD,["typed","config","?matrix"],e=>{var{typed:t,config:r,matrix:n}=e;return t(nD,{Matrix:function(e){return e.create(e.size())},Array:ry,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):function(){throw Error('No "matrix" implementation available')}()}})}),ny="divideScalar",nv=tG(ny,["typed","numeric"],e=>{var{typed:t,numeric:r}=e;return t(ny,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),nw="identity",n_=tG(nw,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:u}=e;return t(nw,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return a(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return a(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return a(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return a(e,t,r)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return a(e[0],e[0],t);case 2:return a(e[0],e[1],t);default:throw Error("Vector containing two values expected")}}function a(e,t,r){var n=to(e)||to(t)?i:null;if(to(e)&&(e=e.toNumber()),to(t)&&(t=t.toNumber()),!t8(e)||e<1||!t8(t)||t<1)throw Error("Parameters in function identity must be positive integers");var s=n?new i(1):1,a=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return u.diagonal(c,s,0,a);if("dense"===r)return o.diagonal(c,s,0,a);throw TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=r_([],c,a),f=e<t?e:t,h=0;h<f;h++)l[h][h]=s;return l}}),nE=tG("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){var a=u(e,o),c=tf(e)?e._data:e,l=tf(e)?e._datatype||e.getDataType():void 0,f=tf(o)?o._data:o,h=tf(o)?o._datatype||o.getDataType():void 0,d=2===s(e).length,p=2===s(o).length,m=r,D=n;if(l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(m=t.find(r,[l,l]),D=t.find(n,[l,l])),!d&&!p){for(var g=D(i(c[0]),f[0]),y=1;y<a;y++)g=m(g,D(i(c[y]),f[y]));return g}if(!d&&p){for(var v=D(i(c[0]),f[0][0]),w=1;w<a;w++)v=m(v,D(i(c[w]),f[w][0]));return v}if(d&&!p){for(var _=D(i(c[0][0]),f[0]),E=1;E<a;E++)_=m(_,D(i(c[E][0]),f[E]));return _}if(d&&p){for(var A=D(i(c[0][0]),f[0][0]),F=1;F<a;F++)A=m(A,D(i(c[F][0]),f[F][0]));return A}},"SparseMatrix, SparseMatrix":function(e,t){u(e,t);for(var i=e._index,o=e._values,s=t._index,a=t._values,c=0,l=0,f=0;l<i.length&&f<s.length;){var h=i[l],d=s[f];if(h<d){l++;continue}if(h>d){f++;continue}h===d&&(c=r(c,n(o[l],a[f])),l++,f++)}return c}});function u(e,t){var r,n,i=s(e),o=s(t);if(1===i.length)r=i[0];else if(2===i.length&&1===i[1])r=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===o.length)n=o[0];else if(2===o.length&&1===o[1])n=o[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+o.join(", ")+")");if(r!==n)throw RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw RangeError("Cannot calculate the dot product of empty vectors");return r}function s(e){return tf(e)?e.size():o(e)}}),nA=tG("matAlgo11xS0s",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,o){var u,s=e._values,a=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!s)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=l[0],d=l[1],p=r,m=0,D=i;"string"==typeof f&&(u=f,p=t.find(r,[u,u]),m=t.convert(0,u),n=t.convert(n,u),D=t.find(i,[u,u]));for(var g=[],y=[],v=[],w=0;w<d;w++){v[w]=y.length;for(var _=c[w],E=c[w+1],A=_;A<E;A++){var F=a[A],b=o?D(n,s[A]):D(s[A],n);p(b,m)||(y.push(F),g.push(b))}}return v[d]=y.length,e.createSparseMatrix({values:g,index:y,ptr:v,size:[h,d],datatype:u})}}),nF=tG("matAlgo14xDs",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var o,u=e._data,s=e._size,a=e._datatype,c=n;"string"==typeof a&&(o=a,r=t.convert(r,o),c=t.find(n,[o,o]));var l=s.length>0?function e(t,r,n,i,o,u,s){var a=[];if(r===n.length-1)for(var c=0;c<i;c++)a[c]=s?t(u,o[c]):t(o[c],u);else for(var l=0;l<i;l++)a[l]=e(t,r+1,n,n[r+1],o[l],u,s);return a}(c,0,s,s[0],u,r,i):[];return e.createDenseMatrix({data:l,size:tH(s),datatype:o})}}),nb="multiply",nC=tG(nb,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:u}=e,s=nA({typed:t,equalScalar:o}),a=nF({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._datatype||r.getDataType(),f=s[0],h=s[1],d=n,p=i;a&&l&&a===l&&"string"==typeof a&&"mixed"!==a&&(o=a,d=t.find(n,[o,o]),p=t.find(i,[o,o]));for(var m=[],D=0;D<f;D++){for(var g=u[D],y=p(g[0],c[0]),v=1;v<h;v++)y=d(y,p(g[v],c[v]));m[D]=y}return e.createDenseMatrix({data:m,size:[f],datatype:a===e._datatype&&l===r._datatype?o:void 0})},"SparseMatrix, any":function(e,r){var u,s=e._values,a=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=[],D=[],g=[],y=n,v=i,w=o,_=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,y=t.find(n,[u,u]),v=t.find(i,[u,u]),w=t.find(o,[u,u]),_=t.convert(0,u));var E=[],A=[];g[0]=0;for(var F=0;F<p;F++){var b=f[F];if(!w(b,_))for(var C=c[F],x=c[F+1],S=C;S<x;S++){var M=a[S];A[M]?E[M]=y(E[M],v(b,s[S])):(A[M]=!0,D.push(M),E[M]=v(b,s[S]))}}for(var N=D.length,O=0;O<N;O++){var B=D[O];m[O]=E[B]}return g[1]=D.length,e.createSparseMatrix({values:m,index:D,ptr:g,size:[d,1],datatype:l===e._datatype&&h===r._datatype?u:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=s[0],d=s[1],p=l[1],m=n,D=i;a&&f&&a===f&&"string"==typeof a&&"mixed"!==a&&"mixed"!==a&&(o=a,m=t.find(n,[o,o]),D=t.find(i,[o,o]));for(var g=[],y=0;y<h;y++){var v=u[y];g[y]=[];for(var w=0;w<p;w++){for(var _=D(v[0],c[0][w]),E=1;E<d;E++)_=m(_,D(v[E],c[E][w]));g[y][w]=_}}return e.createDenseMatrix({data:g,size:[h,p],datatype:a===e._datatype&&f===r._datatype?o:void 0})},"DenseMatrix, SparseMatrix":function(e,r){var u,s=e._data,a=e._size,c=e._datatype||e.getDataType(),l=r._values,f=r._index,h=r._ptr,d=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!l)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var m=a[0],D=d[1],g=n,y=i,v=o,w=0;c&&p&&c===p&&"string"==typeof c&&"mixed"!==c&&(u=c,g=t.find(n,[u,u]),y=t.find(i,[u,u]),v=t.find(o,[u,u]),w=t.convert(0,u));for(var _=[],E=[],A=[],F=r.createSparseMatrix({values:_,index:E,ptr:A,size:[m,D],datatype:c===e._datatype&&p===r._datatype?u:void 0}),b=0;b<D;b++){A[b]=E.length;var C=h[b],x=h[b+1];if(x>C)for(var S=0,M=0;M<m;M++){for(var N=M+1,O=void 0,B=C;B<x;B++){var T=f[B];S!==N?(O=y(s[M][T],l[B]),S=N):O=g(O,y(s[M][T],l[B]))}S!==N||v(O,w)||(E.push(M),_.push(O))}}return A[D]=E.length,F},"SparseMatrix, DenseMatrix":function(e,r){var u,s=e._values,a=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=r._size[1],D=n,g=i,y=o,v=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,D=t.find(n,[u,u]),g=t.find(i,[u,u]),y=t.find(o,[u,u]),v=t.convert(0,u));for(var w=[],_=[],E=[],A=e.createSparseMatrix({values:w,index:_,ptr:E,size:[d,m],datatype:l===e._datatype&&h===r._datatype?u:void 0}),F=[],b=[],C=0;C<m;C++){E[C]=_.length;for(var x=C+1,S=0;S<p;S++){var M=f[S][C];if(!y(M,v))for(var N=c[S],O=c[S+1],B=N;B<O;B++){var T=a[B];b[T]!==x?(b[T]=x,_.push(T),F[T]=g(M,s[B])):F[T]=D(F[T],g(M,s[B]))}}for(var k=E[C],I=_.length,R=k;R<I;R++){var P=_[R];w[R]=F[P]}}return E[m]=_.length,A},"SparseMatrix, SparseMatrix":function(e,r){var o,u,s,a,c,l,f,h,d,p=e._values,m=e._index,D=e._ptr,g=e._datatype||void 0===e._data?e._datatype:e.getDataType(),y=r._values,v=r._index,w=r._ptr,_=r._datatype||void 0===r._data?r._datatype:r.getDataType(),E=e._size[0],A=r._size[1],F=p&&y,b=n,C=i;g&&_&&g===_&&"string"==typeof g&&"mixed"!==g&&(o=g,b=t.find(n,[o,o]),C=t.find(i,[o,o]));for(var x=F?[]:void 0,S=[],M=[],N=e.createSparseMatrix({values:x,index:S,ptr:M,size:[E,A],datatype:g===e._datatype&&_===r._datatype?o:void 0}),O=F?[]:void 0,B=[],T=0;T<A;T++){M[T]=S.length;var k=T+1;for(l=w[T],f=w[T+1],c=l;c<f;c++)if(d=v[c],F)for(s=D[d],a=D[d+1],u=s;u<a;u++)B[h=m[u]]!==k?(B[h]=k,S.push(h),O[h]=C(y[c],p[u])):O[h]=b(O[h],C(y[c],p[u]));else for(s=D[d],a=D[d+1],u=s;u<a;u++)B[h=m[u]]!==k&&(B[h]=k,S.push(h));if(F)for(var I=M[T],R=S.length,P=I;P<R;P++){var j=S[P];x[P]=O[j]}}return M[A]=S.length,N}});return t(nb,i,{"Array, Array":t.referTo("Matrix, Matrix",e=>(t,n)=>{c(ry(t),ry(n));var i=e(r(t),r(n));return tf(i)?i.valueOf():i}),"Matrix, Matrix":function(e,r){var o=e.size(),s=r.size();if(c(o,s),1===o.length){if(1===s.length){if(0===o[0])throw Error("Cannot multiply two empty vectors");return u(e,r)}if("dense"!==r.storage())throw Error("Support for SparseMatrix not implemented");return function(e,r){var o,u=e._data,s=e._size,a=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=s[0],d=l[1],p=n,m=i;a&&f&&a===f&&"string"==typeof a&&"mixed"!==a&&(o=a,p=t.find(n,[o,o]),m=t.find(i,[o,o]));for(var D=[],g=0;g<d;g++){for(var y=m(u[0],c[0][g]),v=1;v<h;v++)y=p(y,m(u[v],c[v][g]));D[g]=y}return e.createDenseMatrix({data:D,size:[d],datatype:a===e._datatype&&f===r._datatype?o:void 0})}(e,r)}return 1===s.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",e=>(t,n)=>e(t,r(n))),"Array, Matrix":t.referToSelf(e=>(t,n)=>e(r(t,n.storage()),n)),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return a(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return a(t,e,i,!0)},"Array, any":function(e,t){return a(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return a(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,r,n)=>{for(var i=e(t,r),o=0;o<n.length;o++)i=e(i,n[o]);return i})})}),nx=tG("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:u,unaryMinus:s}=e;return t("det",{any:function(e){return tH(e)},"Array | Matrix":function(e){var t;switch((t=tf(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return tH(e);case 1:if(1===t[0])return tH(e.valueOf()[0]);if(0===t[0])return 1;throw RangeError("Matrix must be square (size: "+rd(t)+")");case 2:var a=t[0],c=t[1];if(a===c)return function(e,t){if(1===t)return tH(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var r=!1,a=Array(t).fill(0).map((e,t)=>t),c=0;c<t;c++){var l=a[c];if(u(e[l][c])){var f=void 0;for(f=c+1;f<t;f++)if(!u(e[a[f]][c])){l=a[f],a[f]=a[c],a[c]=l,r=!r;break}if(f===t)return e[l][c]}for(var h=e[l][c],d=0===c?1:e[a[c-1]][c-1],p=c+1;p<t;p++)for(var m=a[p],D=c+1;D<t;D++)e[m][D]=o(n(i(e[m][D],h),i(e[m][c],e[l][D])),d)}var g=e[a[t-1]][t-1];return r?s(g):g}(e.clone().valueOf(),a);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+rd(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rd(t)+")")}}})}),nS=tG("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:u,det:s,identity:a,abs:c}=e;return t("inv",{"Array | Matrix":function(e){var t=tf(e)?e.size():ry(e);switch(t.length){case 1:if(1===t[0])if(tf(e))return r([n(1,e.valueOf()[0])]);else return[n(1,e[0])];throw RangeError("Matrix must be square (size: "+rd(t)+")");case 2:var i=t[0],o=t[1];if(i===o)if(tf(e))return r(l(e.valueOf(),i,o),e.storage());else return l(e,i,o);throw RangeError("Matrix must be square (size: "+rd(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rd(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){if(1===t){if(0===(d=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,d)]]}if(2===t){var l,f,h,d,p,m=s(e);if(0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],m),n(u(e[0][1]),m)],[n(u(e[1][0]),m),n(e[0][0],m)]]}var D=e.concat();for(l=0;l<t;l++)D[l]=D[l].concat();for(var g=a(t).valueOf(),y=0;y<r;y++){var v=c(D[y][y]),w=y;for(l=y+1;l<t;)c(D[l][y])>v&&(v=c(D[l][y]),w=l),l++;if(0===v)throw Error("Cannot calculate inverse, determinant is zero");(l=w)!==y&&(p=D[y],D[y]=D[l],D[l]=p,p=g[y],g[y]=g[l],g[l]=p);var _=D[y],E=g[y];for(l=0;l<t;l++){var A=D[l],F=g[l];if(l!==y){if(0!==A[y]){for(h=n(u(A[y]),_[y]),f=y;f<r;f++)A[f]=i(A[f],o(h,_[f]));for(f=0;f<r;f++)F[f]=i(F[f],o(h,E[f]))}}else{for(h=_[y],f=y;f<r;f++)A[f]=n(A[f],h);for(f=0;f<r;f++)F[f]=n(F[f],h)}}}return g}}),nM=t$({config:k}),nN=ru({}),nO=ra({}),nB=rc({}),nT=rN({Matrix:nB}),nk=rL({BigNumber:nM,Complex:nN,DenseMatrix:nT,Fraction:nO}),nI=r1({typed:nk}),nR=r3({typed:nk}),nP=r8({BigNumber:nM,typed:nk}),nj=r5({typed:nk}),nY=r9({config:k,typed:nk}),nU=nr({typed:nk}),nz=nn({typed:nk}),nV=ni({typed:nk}),nL=no({Matrix:nB,equalScalar:nY,typed:nk}),nH=ns({typed:nk}),nq=nc({typed:nk}),nW=nl({Fraction:nO,typed:nk}),nG=nh({DenseMatrix:nT,Matrix:nB,SparseMatrix:nL,typed:nk}),nZ=nm({bignumber:nP,fraction:nW,number:nV}),n$=ng({matrix:nG,config:k,typed:nk}),nJ=nv({numeric:nZ,typed:nk}),nQ=n_({BigNumber:nM,DenseMatrix:nT,SparseMatrix:nL,config:k,matrix:nG,typed:nk}),nX=nE({addScalar:nR,conj:nj,multiplyScalar:nz,size:n$,typed:nk}),nK=nC({addScalar:nR,dot:nX,equalScalar:nY,matrix:nG,multiplyScalar:nz,typed:nk}),n0=nS({abs:nI,addScalar:nR,det:nx({divideScalar:nJ,isZero:nU,matrix:nG,multiply:nK,subtractScalar:nH,typed:nk,unaryMinus:nq}),divideScalar:nJ,identity:nQ,matrix:nG,multiply:nK,typed:nk,unaryMinus:nq});function n1(e,t){var r;let n=!1;Array.isArray(e[0])||(e=[e],n=!0);let i=t[t.length-1],o=i.ImageOrientationSlide,u=(r=i).PixelSpacing?r.PixelSpacing:r.SharedFunctionalGroupsSequence[0].PixelMeasuresSequence[0].PixelSpacing,s=i.TotalPixelMatrixOriginSequence[0],a=[Number(s.XOffsetInSlideCoordinateSystem),Number(s.YOffsetInSlideCoordinateSystem)];return(e=e.map(e=>{let t=function(e){if(!("offset"in e))throw Error('Option "offset" is required.');if(!Array.isArray(e.offset))throw Error('Option "offset" must be an array.');if(2!==e.offset.length)throw Error('Option "offset" must be an array with 2 elements.');let t=e.offset;if(!("orientation"in e))throw Error('Option "orientation" is required.');if(!Array.isArray(e.orientation))throw Error('Option "orientation" must be an array.');if(6!==e.orientation.length)throw Error('Option "orientation" must be an array with 6 elements.');let r=e.orientation;if(!("spacing"in e))throw Error('Option "spacing" is required.');if(!Array.isArray(e.spacing))throw Error('Option "spacing" must be an array.');if(2!==e.spacing.length)throw Error('Option "spacing" must be an array with 2 elements.');let n=e.spacing;if(!("point"in e))throw Error('Option "point" is required.');if(!Array.isArray(e.point))throw Error('Option "point" must be an array.');if(2!==e.point.length)throw Error('Option "point" must be an array with 2 elements.');let i=e.point,o=nK(n0([[r[0]*n[1],r[3]*n[0],t[0]],[r[1]*n[1],r[4]*n[0],t[1]],[0,0,1]]),[[i[0]],[i[1]],[1]]),u=Number(o[1][0].toFixed(4));return[Number(o[0][0].toFixed(4)),u]}({offset:a,orientation:o,spacing:u,point:[e[0],e[1]]});return[t[0],-(t[1]+1),0]}),n)?e[0]:e}let n2={color:"rgba(255,255,255,0.4)"},n3={color:"rgba(255,255,255,0.0)"},n8={color:"rgb(0,255,0)",width:1.5},n4={color:"rgb(255,255,0)",width:1.5},n5={image:{circle:{fill:n2,stroke:n4,radius:5}},fill:n2,stroke:n4},n6={image:{circle:{fill:n3,stroke:n8,radius:5}},fill:n3,stroke:n8},n7="dicommicroscopyviewer_roi_added",n9="dicommicroscopyviewer_roi_modified",ie="dicommicroscopyviewer_roi_removed",it="dicommicroscopyviewer_roi_selected",ir={ADDED:"added",MODIFIED:"modified",REMOVED:"removed",UPDATED:"updated",SELECTED:"selected"};class ii extends o.PubSubService{constructor(e,t,r,n,i){super(ir),this.viewer=e,this.viewportId=t,this.container=r,this.studyInstanceUID=n,this.seriesInstanceUID=i,this.onRoiAdded=this.roiAddedHandler.bind(this),this.onRoiModified=this.roiModifiedHandler.bind(this),this.onRoiRemoved=this.roiRemovedHandler.bind(this),this.onRoiSelected=this.roiSelectedHandler.bind(this),this.contextMenuCallback=()=>{};const o=Object.getOwnPropertySymbols(this.viewer);this._drawingSource=o.find(e=>"drawingSource"===e.description),this._pyramid=o.find(e=>"pyramid"===e.description),this._map=o.find(e=>"map"===e.description),this._affine=o.find(e=>"affine"===e.description),this.registerEvents(),this.activateDefaultInteractions()}addContextMenuCallback(e){this.contextMenuCallback=e}destroy(){this.unregisterEvents()}publish(e,t){this._broadcastEvent(e,{roiGraphic:t,managedViewer:this})}registerEvents(){this.container.addEventListener(n7,this.onRoiAdded),this.container.addEventListener(n9,this.onRoiModified),this.container.addEventListener(ie,this.onRoiRemoved),this.container.addEventListener(it,this.onRoiSelected)}unregisterEvents(){this.container.removeEventListener(n7,this.onRoiAdded),this.container.removeEventListener(n9,this.onRoiModified),this.container.removeEventListener(ie,this.onRoiRemoved),this.container.removeEventListener(it,this.onRoiSelected)}roiAddedHandler(e){let t=e.detail.payload;this.publish(ir.ADDED,t),this.publish(ir.UPDATED,t)}roiModifiedHandler(e){let t=e.detail.payload;this.publish(ir.MODIFIED,t),this.publish(ir.UPDATED,t)}roiRemovedHandler(e){let t=e.detail.payload;this.publish(ir.REMOVED,t),this.publish(ir.UPDATED,t)}roiSelectedHandler(e){let t=e.detail.payload;this.publish(ir.SELECTED,t)}runSilently(e){this.unregisterEvents(),e(),this.registerEvents()}clearRoiGraphics(){this.runSilently(()=>this.viewer.removeAllROIs())}showROIs(){this.viewer.showROIs()}hideROIs(){this.viewer.hideROIs()}addRoiGraphic(e){this.runSilently(()=>this.viewer.addROI(e,n6))}addRoiGraphicWithLabel(e,t){this.runSilently(()=>this.viewer.addROI(e,n6)),this._broadcastEvent(ir.ADDED,{roiGraphic:e,managedViewer:this,label:t})}setROIStyle(e,t){this.viewer.setROIStyle(e,t)}removeRoiGraphic(e){this.viewer.removeROI(e)}updateROIProperties({uid:e,properties:t}){this.viewer.updateROI({uid:e,properties:t})}toggleOverviewMap(){this.viewer.toggleOverviewMap()}activateDefaultInteractions(){document.querySelector(".DicomMicroscopyViewer").addEventListener("contextmenu",e=>{e.preventDefault()},!1),this.activateInteractions([["dragPan",{bindings:{mouseButtons:["middle"]}}],["dragZoom",{bindings:{mouseButtons:["right"]}}],["modify",{}]])}activateInteractions(e){let t={draw:e=>e?"activateDrawInteraction":"deactivateDrawInteraction",modify:e=>e?"activateModifyInteraction":"deactivateModifyInteraction",translate:e=>e?"activateTranslateInteraction":"deactivateTranslateInteraction",snap:e=>e?"activateSnapInteraction":"deactivateSnapInteraction",dragPan:e=>e?"activateDragPanInteraction":"deactivateDragPanInteraction",dragZoom:e=>e?"activateDragZoomInteraction":"deactivateDragZoomInteraction",select:e=>e?"activateSelectInteraction":"deactivateSelectInteraction"};Object.keys(t).forEach(r=>{let n=e.find(e=>e[0]===r);if(n){let[e,r]=n,i=t[e](!0);this.viewer[i](r)}else{let e=t[r](!1);this.viewer[e]()}})}_getMapView(){return this._getMap().getView()}_getMap(){let e=Object.getOwnPropertySymbols(this.viewer).find(e=>"Symbol(map)"===String(e));return window.map=this.viewer[e],this.viewer[e]}getViewState(){let e=this._getMapView();return{center:e.getCenter(),resolution:e.getResolution(),zoom:e.getZoom()}}setViewState(e){let t=this._getMapView();t.setZoom(e.zoom),t.setResolution(e.resolution),t.setCenter(e.center)}setViewStateByExtent(e){let t=e.getCoordinates();Array.isArray(t[0])&&!t[2]?this._jumpToPolyline(t):Array.isArray(t[0])?this._jumpToPolygonOrEllipse(t):this._jumpToPoint(t)}_jumpToPoint(e){let t=n1(e,this.viewer[this._pyramid].metadata);this._getMapView().setCenter(t)}_jumpToPolyline(e){let t=n1(e,this.viewer[this._pyramid].metadata),r=this._getMapView(),n=t[0],i=t[1],o=(n[0]+i[0])/2,u=(n[1]+i[1])/2;r.setCenter([o,u])}_jumpToPolygonOrEllipse(e){let t=this.viewer[this._pyramid].metadata,r=1/0,n=-1/0,i=1/0,o=-1/0;e.forEach(e=>{let[u,s]=n1(e,t);u<r?r=u:u>n&&(n=u),s<i?i=s:s>o&&(o=s)});let u=n-r,s=o-i;r-=.5*u,n+=.5*u,i-=.5*s,o+=.5*s;let a=this._getMap();a.getView().fit([r,i,n,o],a.getSize())}}var io=a(545),iu=a.n(io);let is={LABEL_UPDATED:"labelUpdated",GRAPHIC_UPDATED:"graphicUpdated",VIEW_UPDATED:"viewUpdated",REMOVED:"removed"};class ia extends o.PubSubService{constructor(e,t,r,n="",i=null){super(is),this.uid=e.uid,this.roiGraphic=e,this.studyInstanceUID=t,this.seriesInstanceUID=r,this.label=n,this.viewState=i,this.setMeasurements(e)}getScoord3d(){let e=this.roiGraphic,t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(scoord3d)"===String(e));return e[t]}getCoordinates(){let e=this.getScoord3d(),t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(coordinates)"===String(e));return e[t]}destroy(){this._broadcastEvent(is.REMOVED,this)}setRoiGraphic(e){this.roiGraphic=e,this.setMeasurements(),this._broadcastEvent(is.GRAPHIC_UPDATED,this)}setMeasurements(){let e=this.roiGraphic.scoord3d.graphicType,t=this.roiGraphic.scoord3d.graphicData;switch(e){case"ELLIPSE":let r=t[0],n=t[1],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o;let u=Math.sqrt(i+o),s=u/2,a=Math.PI*s*s;this._area=a,this._length=void 0;break;case"POLYGON":let c=function(e){let t=e.length,r=0,n=t-1;for(let i=0;i<t;i++)r+=(e[n][0]+e[i][0])*(e[n][1]-e[i][1]),n=i;return Math.abs(r/2)}(t);this._area=c,this._length=void 0;break;case"POINT":this._area=void 0,this._length=void 0;break;case"POLYLINE":let l=0;for(let e=1;e<t.length;e++){let r=t[e-1],n=t[e],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o,l+=Math.sqrt(i+o)}this._area=void 0,this._length=l}}setViewState(e){this.viewState=e,this._broadcastEvent(is.VIEW_UPDATED,this)}setLabel(e,t){this.label=e||t&&t.CodeMeaning,this.finding=t||{CodingSchemeDesignator:"@ohif/extension-dicom-microscopy",CodeValue:e,CodeMeaning:e},this._broadcastEvent(is.LABEL_UPDATED,this)}getLabel(){return this.label?`${this.label}`:""}getDetailedLabel(){let e=iu()?.t("MeasurementTable:empty")||"(empty)";return this.label?`${this.label}`:e}getLength(){return this._length}getArea(){return this._area}}let ic={ANNOTATION_UPDATED:"annotationUpdated",ANNOTATION_SELECTED:"annotationSelected",ANNOTATION_REMOVED:"annotationRemoved",RELABEL:"relabel",DELETE:"delete"};class il extends o.PubSubService{constructor({servicesManager:e,extensionManager:t}){super(ic),this.servicesManager=void 0,this.managedViewers=new Set,this.roiUids=new Set,this.annotations={},this.selectedAnnotation=null,this.pendingFocus=!1,this.servicesManager=e,this.peerImport=t.appConfig.peerImport,this._onRoiAdded=this._onRoiAdded.bind(this),this._onRoiModified=this._onRoiModified.bind(this),this._onRoiRemoved=this._onRoiRemoved.bind(this),this._onRoiUpdated=this._onRoiUpdated.bind(this),this._onRoiSelected=this._onRoiSelected.bind(this),this.isROIsVisible=!0}clear(){for(let e in this.managedViewers.forEach(e=>e.destroy()),this.managedViewers.clear(),this.annotations)delete this.annotations[e];this.roiUids.clear(),this.selectedAnnotation=null,this.pendingFocus=!1}clearAnnotations(){Object.keys(this.annotations).forEach(e=>{this.removeAnnotation(this.annotations[e])})}importDicomMicroscopyViewer(){return this.peerImport("dicom-microscopy-viewer")}_onRoiAdded(e){let{roiGraphic:t,managedViewer:r,label:n}=e,{studyInstanceUID:i,seriesInstanceUID:o}=r,u=new ia(t,i,o,"",r.getViewState());this.roiUids.add(t.uid),this.annotations[t.uid]=u,u.subscribe(is.LABEL_UPDATED,()=>{this._broadcastEvent(ic.ANNOTATION_UPDATED,u)}),void 0!==n?u.setLabel(n):this.triggerRelabel(u,!0,e=>r.updateROIProperties({uid:t.uid,properties:{label:e.label,finding:e.finding}}))}_onRoiModified(e){let{roiGraphic:t,managedViewer:r}=e,n=this.getAnnotation(t.uid);n&&(n.setRoiGraphic(t),n.setViewState(r.getViewState()))}_onRoiRemoved(e){let{roiGraphic:t}=e;this.roiUids.delete(t.uid),this.annotations[t.uid].destroy(),delete this.annotations[t.uid],this._broadcastEvent(ic.ANNOTATION_REMOVED,t)}_onRoiUpdated(e){let{roiGraphic:t,managedViewer:r}=e;this.synchronizeViewers(r),this._broadcastEvent(ic.ANNOTATION_UPDATED,this.getAnnotation(t.uid))}_onRoiSelected(e){let{roiGraphic:t}=e,r=this.getAnnotation(t.uid);r&&r!==this.getSelectedAnnotation()&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=r,this._broadcastEvent(ic.ANNOTATION_SELECTED,r))}_addManagedViewerSubscriptions(e){e._roiAddedSubscription=e.subscribe(ir.ADDED,this._onRoiAdded),e._roiModifiedSubscription=e.subscribe(ir.MODIFIED,this._onRoiModified),e._roiRemovedSubscription=e.subscribe(ir.REMOVED,this._onRoiRemoved),e._roiUpdatedSubscription=e.subscribe(ir.UPDATED,this._onRoiUpdated),e._roiSelectedSubscription=e.subscribe(ir.UPDATED,this._onRoiSelected)}_removeManagedViewerSubscriptions(e){e._roiAddedSubscription&&e._roiAddedSubscription.unsubscribe(),e._roiModifiedSubscription&&e._roiModifiedSubscription.unsubscribe(),e._roiRemovedSubscription&&e._roiRemovedSubscription.unsubscribe(),e._roiUpdatedSubscription&&e._roiUpdatedSubscription.unsubscribe(),e._roiSelectedSubscription&&e._roiSelectedSubscription.unsubscribe(),e._roiAddedSubscription=null,e._roiModifiedSubscription=null,e._roiRemovedSubscription=null,e._roiUpdatedSubscription=null,e._roiSelectedSubscription=null}_getManagedViewersForSeries(e,t){return Array.from(this.managedViewers).filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getManagedViewersForStudy(e){return Array.from(this.managedViewers).filter(t=>t.studyInstanceUID===e)}getManagedViewersForViewport(e){return Array.from(this.managedViewers).filter(t=>t.viewportId===e)}_restoreAnnotations(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e;this.getAnnotationsForSeries(t,r).forEach(t=>{e.addRoiGraphic(t.roiGraphic)})}addViewer(e,t,r,n,i){let o=Array.from(this.managedViewers).find(e=>e.viewportId===t);o&&this.removeViewer(o.viewer);let u=new ii(e,t,r,n,i);return this._restoreAnnotations(u),e._manager=u,this.managedViewers.add(u),this._addManagedViewerSubscriptions(u),this.pendingFocus&&(this.pendingFocus=!1,this.focusAnnotation(this.selectedAnnotation,t)),u}_potentiallyLoadSR(e,t){let r=o.DicomMetadataStore.getStudy(e),n=t.find(e=>"SM"===e.Modality),{FrameOfReferenceUID:i,othersFrameOfReferenceUID:u}=n;if(!r)return;let s=i?t.filter(e=>e.ReferencedFrameOfReferenceUID===i||u.includes(e.ReferencedFrameOfReferenceUID)):[];if(!s.length||(s=s.filter(e=>"SR"===e.Modality)).some(e=>!0===e.isLoaded))return;let a=0,c=s[0];s.forEach(e=>{let t=Number(`${e.SeriesDate}${e.SeriesTime}`);t>a&&(a=t,c=e)}),c.isLoading||(c.isLoading=!0,c.load(n))}removeViewer(e){let t=e._manager;this._removeManagedViewerSubscriptions(t),t.destroy(),this.managedViewers.delete(t)}toggleROIsVisibility(){this.isROIsVisible?this.hideROIs():this.showROIs(),this.isROIsVisible=!this.isROIsVisible}hideROIs(){this.managedViewers.forEach(e=>e.hideROIs())}showROIs(){this.managedViewers.forEach(e=>e.showROIs())}getAnnotation(e){return this.annotations[e]}getAnnotations(){let e=[];return Object.keys(this.annotations).forEach(t=>{e.push(this.getAnnotation(t))}),e}getAnnotationsForStudy(e){return this.getAnnotations().filter(t=>t.studyInstanceUID===e)}getAnnotationsForSeries(e,t){return this.getAnnotations().filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getSelectedAnnotation(){return this.selectedAnnotation}clearSelection(){this.selectedAnnotation&&this.setROIStyle(this.selectedAnnotation.uid,{stroke:{color:"#00ff00"}}),this.selectedAnnotation=null}selectAnnotation(e){this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this._broadcastEvent(ic.ANNOTATION_SELECTED,e),this.setROIStyle(e.uid,n5)}toggleOverviewMap(e){let t=Array.from(this.managedViewers).find(t=>t.viewportId===e);t&&t.toggleOverviewMap()}removeAnnotation(e){let{uid:t,studyInstanceUID:r,seriesInstanceUID:n}=e;Array.from(this.managedViewers).filter(e=>e.studyInstanceUID===r&&e.seriesInstanceUID===n).forEach(e=>e.removeRoiGraphic(t)),this.annotations[t]&&(this.roiUids.delete(t),this.annotations[t].destroy(),delete this.annotations[t],this._broadcastEvent(ic.ANNOTATION_REMOVED,e))}focusAnnotation(e,t){let r=Array.from(this.managedViewers).find(e=>e.viewportId===t);r?r.setViewStateByExtent(e):this.pendingFocus=!0}synchronizeViewers(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e,n=this._getManagedViewersForSeries(t,r);n.forEach(e=>this._removeManagedViewerSubscriptions(e)),n.forEach(n=>{if(n===e)return;let i=this.getAnnotationsForSeries(t,r);n.clearRoiGraphics(),i.forEach(e=>{n.addRoiGraphic(e.roiGraphic)})}),n.forEach(e=>this._addManagedViewerSubscriptions(e))}activateInteractions(e){this.managedViewers.forEach(t=>t.activateInteractions(e)),this.activeInteractions=e}getActiveInteractions(){return this.activeInteractions}triggerRelabel(e,t=!1,r){r||(r=({label:t})=>this.managedViewers.forEach(r=>r.updateROIProperties({uid:e.uid,properties:{label:t}}))),this._broadcastEvent(ic.RELABEL,{roiAnnotation:e,deleteCallback:()=>this.removeAnnotation(e),successCallback:r,newAnnotation:t})}triggerDelete(e){this._broadcastEvent(ic.DELETE,e)}setROIStyle(e,t){this.managedViewers.forEach(r=>r.setROIStyle(e,t))}getAllManagedViewers(){return Array.from(this.managedViewers)}}il.REGISTRATION=e=>({name:"microscopyService",altName:"MicroscopyService",create:e=>new il(e)});var ih=a(111),id=a.n(ih),ip=a(870);let{downloadDicom:im}=o.utils,{datasetToBuffer:iD}=id().data,ig=(e,t)=>{let r=1;if("km"==t||!t&&e>1e6)t="km",r=1e-6;else if("m"==t||!t&&e>1e3)t="m",r=.001;else if("μm"==t||!t&&e<1)t="μm",r=1e3;else if(t&&"mm"!=t)throw Error(`Unknown length unit ${t}`);else t="mm";return`${(e*r).toFixed(2)} ${t}`};function iy(){}function iv(){}function iw(){}let i_=(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,u=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(i,M),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,i=(0,r.useContext)(m)||{},o=i.i18n,u=i.defaultNS,a=n||o||I;if(a&&!a.reportNamespaces&&(a.reportNamespaces=new D),!a){E("You will need to pass in an i18next instance by using initReactI18next");var c=function(e,t){return"string"==typeof t?t:t&&"object"===s(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},l=[c,{},!1];return l.t=c,l.i18n={},l.ready=!1,l}a.options.react&&void 0!==a.options.react.wait&&E("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=x(x(x({},p),a.options.react),t),h=f.useSuspense,d=f.keyPrefix,g=e||u||a.options&&a.options.defaultNS;g="string"==typeof g?[g]:g||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(g);var v=(a.isInitialized||a.initializedStoreOnce)&&g.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var u=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!u(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||u(n,e)&&(!i||u(o,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(E("i18n.languages were undefined or empty",t.languages),!0)}(e,a,f)});function w(){return a.getFixedT(t.lng||null,"fallback"===f.nsMode?g:g[0],d)}var _=y((0,r.useState)(w),2),A=_[0],C=_[1],M=g.join();t.lng&&(M="".concat(t.lng).concat(M));var N=S(M),O=(0,r.useRef)(!0);(0,r.useEffect)(function(){var e=f.bindI18n,r=f.bindI18nStore;function n(){O.current&&C(w)}return O.current=!0,v||h||(t.lng?b(a,t.lng,g,function(){O.current&&C(w)}):F(a,g,function(){O.current&&C(w)})),v&&N&&N!==M&&O.current&&C(w),e&&a&&a.on(e,n),r&&a&&a.store.on(r,n),function(){O.current=!1,e&&a&&e.split(" ").forEach(function(e){return a.off(e,n)}),r&&a&&r.split(" ").forEach(function(e){return a.store.off(e,n)})}},[a,M]);var B=(0,r.useRef)(!0);(0,r.useEffect)(function(){O.current&&!B.current&&C(w),B.current=!1},[a,d]);var T=[A,a,v];if(T.t=A,T.i18n=a,T.ready=v,v||!v&&!h)return T;throw new Promise(function(e){t.lng?b(a,t.lng,g,function(){return e()}):F(a,g,function(){return e()})})}(e,O(O({},u),{},{keyPrefix:t.keyPrefix})),c=y(a,3),l=c[0],f=c[1],h=c[2],d=O(O({},u),{},{t:l,i18n:f,tReady:h});return t.withRef&&o?d.ref=o:!t.withRef&&o&&(d.forwardedRef=o),(0,r.createElement)(n,d)}return i.displayName="withI18nextTranslation(".concat(n.displayName||n.name||("string"==typeof n&&n.length>0?n:"Unknown"),")"),i.WrappedComponent=n,t.withRef?(0,r.forwardRef)(function(e,t){return(0,r.createElement)(i,Object.assign({},e,{forwardedRef:t}))}):i}})(["MicroscopyTable","Common"])(function(t){let i,o,u,s,a,c,l,f,h,d,p,m,D,g,y=(0,e.c)(42),{microscopyService:v}=t.servicesManager.services,[w,_]=(0,r.useState)(null);y[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],y[0]=i):i=y[0];let[E,A]=(0,r.useState)(i),[F,b]=(0,r.useState)(null),{servicesManager:C,extensionManager:x}=t,{displaySetService:S}=C.services;y[1]!==S||y[2]!==t.activeViewportId||y[3]!==t.viewports?(o=()=>{let e=t.viewports.get(t.activeViewportId);if(e?.displaySetInstanceUIDs[0]){let t=S.getDisplaySetByUID(e.displaySetInstanceUIDs[0]);t&&_(t.StudyInstanceUID)}},y[1]=S,y[2]=t.activeViewportId,y[3]=t.viewports,y[4]=o):o=y[4],y[5]!==t.activeViewportId||y[6]!==t.viewports?(u=[t.viewports,t.activeViewportId],y[5]=t.activeViewportId,y[6]=t.viewports,y[7]=u):u=y[7],(0,r.useEffect)(o,u),y[8]!==v||y[9]!==w?(s=()=>{let e=()=>{A(v.getAnnotationsForStudy(w))},t=()=>{b(v.getSelectedAnnotation())},{unsubscribe:r}=v.subscribe(ic.ANNOTATION_UPDATED,e),{unsubscribe:n}=v.subscribe(ic.ANNOTATION_SELECTED,t),{unsubscribe:i}=v.subscribe(ic.ANNOTATION_REMOVED,()=>{e()});return e(),t(),()=>{r(),n(),i()}},y[8]=v,y[9]=w,y[10]=s):s=y[10],y[11]!==w?(a=[w],y[11]=w,y[12]=a):a=y[12],(0,r.useEffect)(s,a),y[13]!==v||y[14]!==t.activeViewportId?(c=e=>{let{uid:r}=e,n=v.getAnnotation(r);v.selectAnnotation(n),v.focusAnnotation(n,t.activeViewportId)},y[13]=v,y[14]=t.activeViewportId,y[15]=c):c=y[15];let M=c;y[16]!==t.commandsManager?(l=e=>{let{uid:r}=e;t.commandsManager.runCommand("setLabel",{uid:r},"MICROSCOPY")},y[16]=t.commandsManager,y[17]=l):l=y[17];let N=l;y[18]!==v?(f=e=>{let{uid:t}=e,r=v.getAnnotation(t);v.removeAnnotation(r)},y[18]=v,y[19]=f):f=y[19];let O=f;if(y[20]!==O||y[21]!==M||y[22]!==N||y[23]!==E||y[24]!==F){let e,t;y[29]!==F?(e=(e,t)=>{let r=e.getDetailedLabel(),n=e.getArea(),i=e.getLength(),o=e.roiGraphic.properties.shortAxisLength,u=F===e,{uid:s}=e,a=[];if(void 0!==n){let e,t;a.push((e=1,t="mm",n>1e6?(t="m",e=1e-6):n<1&&(t="μm",e=1e6),`${(n*e).toFixed(2)} ${t}\xb2`))}else void 0!==i&&a.push(o?`${ig(i,"μm")} x ${ig(o,"μm")}`:`${ig(i,"μm")}`);return{uid:s,index:t,label:r,isActive:u,displayText:a,roiAnnotation:e}},y[29]=F,y[30]=e):e=y[30];let r=E.map(e);h="ohif-scrollbar overflow-y-auto overflow-x-hidden",d="measurements-panel",p="flex flex-col",y[31]!==O||y[32]!==M||y[33]!==N?(t=e=>(0,ip.jsx)(n.DataRow,{number:e.index+1,title:e.label,isSelected:e.isActive,onSelect:()=>M({uid:e.uid}),details:{primary:e.displayText,secondary:[]},isVisible:!0,onToggleVisibility:iw,isLocked:!1,onToggleLocked:iv,onRename:()=>N({uid:e.uid,isActive:e.isActive}),onDelete:()=>O({uid:e.uid,isActive:e.isActive}),onColor:iy,disableEditing:!1,description:e.displayText.join(", ")},e.uid),y[31]=O,y[32]=M,y[33]=N,y[34]=t):t=y[34],m=r.map(t),y[20]=O,y[21]=M,y[22]=N,y[23]=E,y[24]=F,y[25]=h,y[26]=d,y[27]=p,y[28]=m}else h=y[25],d=y[26],p=y[27],m=y[28];return y[35]!==p||y[36]!==m?(D=(0,ip.jsx)("div",{className:p,children:m}),y[35]=p,y[36]=m,y[37]=D):D=y[37],y[38]!==h||y[39]!==d||y[40]!==D?(g=(0,ip.jsx)(ip.Fragment,{children:(0,ip.jsx)("div",{className:h,"data-cy":d,children:D})}),y[38]=h,y[39]=d,y[40]=D,y[41]=g):g=y[41],g}),iE="126010",iA="125007",iF="111030",ib="112039";function iC(e){return Array.isArray(e)?e:[e]}let ix=id().adapters.DICOMMicroscopyViewer.MeasurementReport;async function iS(e,t,r){let n=t.metadata,{StudyInstanceUID:i,FrameOfReferenceUID:o}=r,u=e.getManagedViewersForStudy(i);if(!u||!u.length)return;t.isLoaded=!0;let{rois:s,labels:a}=await iM(e,n,o),c=u[0];for(let e=0;e<s.length;e++){let t=s[e],r=Object.getOwnPropertySymbols(t).find(e=>"properties"===e.description);t[r].evaluations=[],c.addRoiGraphicWithLabel(t,a[e])}}async function iM(e,t,r){let n=ix.generateToolState(t),i=Object.getOwnPropertyNames(n),o=await e.importDicomMicroscopyViewer(),u=function(e){let{ContentSequence:t}=e;return iC(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iE).ContentSequence).filter(e=>e.ConceptNameCodeSequence.CodeValue===iA)}(t),s=[],a=[];return i.forEach(e=>{let t,i=n[e],c=e.toUpperCase(),l=u.filter(e=>iC(e.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iF).GraphicType===c);i.forEach((n,i)=>{let u={},c={coordinates:n,frameOfReferenceUID:r};if("Polygon"===e)t=new o.scoord3d.Polygon(c);else if("Polyline"===e)t=new o.scoord3d.Polyline(c);else if("Point"===e)t=new o.scoord3d.Point(c);else if("Ellipse"===e)t=new o.scoord3d.Ellipse(c);else throw Error("Unsupported tool type");let f=l[i],h=iC(f.ContentSequence).find(e=>"121071"===e.ConceptNameCodeSequence.CodeValue),d=iC(f.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===ib);if(d){let e=/\(([^)]+)\)/.exec(d.TextValue);e&&e[1]&&(u.presentationState=JSON.parse(e[1]),u.marker=u.presentationState.marker)}let p=iC(f.ContentSequence).filter(e=>["410668003","42798000","G-A186","G-A185","G-D7FE"].includes(e.ConceptNameCodeSequence.CodeValue)),m=iC(f.ContentSequence).filter(e=>[ib].includes(e.ConceptNameCodeSequence.CodeValue));m=m.map(e=>{let t={...e};return t.ConceptNameCodeSequence=iC(t.ConceptNameCodeSequence),t}),(p=p.map(e=>{let t={...e};return t.ConceptNameCodeSequence=iC(t.ConceptNameCodeSequence),t}))&&p.length&&(u.measurements=p,console.log("[SR] retrieving measurements...",p)),m&&m.length&&(u.evaluations=m,console.log("[SR] retrieving evaluations...",m));let D=new o.roi.ROI({scoord3d:t,properties:u});s.push(D),h?a.push(h.ConceptCodeSequence.CodeValue):a.push("")})}),{rois:s,labels:a}}function iN(e,t){let{ReferencedFrameOfReferenceUID:r,metadata:n}=t;if(n.ReferencedSeriesSequence){let{ReferencedSeriesSequence:t}=n,{SeriesInstanceUID:r}=t[0];return e.filter(e=>e.SeriesInstanceUID===r)[0]}let i=e.filter(e=>e.displaySetInstanceUID!==t.displaySetInstanceUID),o=i.find(e=>"SM"===e.Modality&&(e.FrameOfReferenceUID===r||e.othersFrameOfReferenceUID.includes(r)));return!o&&i.length>=1?(console.warn("No display set with FrameOfReferenceUID",r,"single series, assuming data error, defaulting to only series."),i.find(e=>"SM"===e.Modality)):o}let{utils:iO}=u();var iB=a(427);let{utils:iT}=u();function ik(e,t=0,r={}){let n;"object"!=typeof r&&(r={});let{leading:i=!1,trailing:o=!0,maxWait:u}=r,s=[,,];i&&(s[0]="leading"),o&&(s[1]="trailing");let a=null,c=function(e,t,{signal:r,edges:n}={}){let i,o=null,u=null!=n&&n.includes("leading"),s=null==n||n.includes("trailing"),a=()=>{null!==o&&(e.apply(i,o),i=void 0,o=null)},c=null,l=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&a(),f()},t)},f=()=>{null!==c&&(clearTimeout(c),c=null),i=void 0,o=null},h=function(...e){if(r?.aborted)return;i=this,o=e;let t=null==c;l(),u&&t&&a()};return h.schedule=l,h.cancel=f,h.flush=()=>{a()},r?.addEventListener("abort",f,{once:!0}),h}(function(...t){n=e.apply(this,t),a=null},t,{edges:s}),l=function(...t){return null!=u&&(null===a&&(a=Date.now()),Date.now()-a>=u)?((i||o)&&(n=e.apply(this,t)),a=Date.now(),c.cancel(),c.schedule(),n):(c.apply(this,t),n)};return l.cancel=c.cancel,l.flush=()=>(c.flush(),n),l}var iI=a(51),iR=a.n(iI);let iP=r.lazy(()=>Promise.resolve().then(a.bind(a,683))),ij=t=>{let n,i,o=(0,e.c)(3);return o[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,ip.jsx)("div",{children:"Loading..."}),o[0]=n):n=o[0],o[1]!==t?(i=(0,ip.jsx)(r.Suspense,{fallback:n,children:(0,ip.jsx)(iP,{...t})}),o[1]=t,o[2]=i):i=o[2],i},iY={id:t,async preRegistration({servicesManager:e}){e.registerService(il.REGISTRATION(e))},getViewportModule({servicesManager:t}){let i=iR()(()=>{let{microscopyService:e}=t.services,r=e.getAllManagedViewers();r&&r.length>0&&r[0].viewer.resize()},100);return[{name:"microscopy-dicom",component:t=>{let o,u,s,a,c=(0,e.c)(12),{viewportOptions:l}=t,[f,h]=(0,n.useViewportGrid)(),{activeViewportId:d}=f;c[0]!==t.displaySets?(o=t.displaySets.map(iU).join("-"),c[0]=t.displaySets,c[1]=o):o=c[1];let p=o;c[2]===Symbol.for("react.memo_cache_sentinel")?(u={onResize:i,handleHeight:!0,handleWidth:!0},c[2]=u):u=c[2];let{ref:m}=function({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:i,handleWidth:o=!0,handleHeight:u=!0,targetRef:s,observerOptions:a,onResize:c,disableRerender:l=!1}={}){let f,h=(0,r.useRef)(e),d=(f=r.useRef(c),r.useEffect(()=>{f.current=c}),r.useMemo(()=>(...e)=>{var t;return null==(t=f.current)?void 0:t.call(f,...e)},[])),[p,m]=(0,r.useState)({width:void 0,height:void 0}),D=(0,r.useRef)({width:void 0,height:void 0}),{refProxy:g,refElement:y}=(e=>{let[t,n]=r.useState((null==e?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:r.useMemo(()=>new Proxy(e=>{e!==t&&n(e)},{get:(e,r)=>"current"===r?t:e[r],set:(e,t,r)=>("current"===t?n(r):e[t]=r,!0)}),[t]),refElement:t,setRefElement:n}})(s),{box:v}=a||{},w=(0,r.useCallback)(e=>{if(!o&&!u)return;if(h.current){h.current=!1;return}let t=(e,t)=>o&&e.width!==t.width||u&&e.height!==t.height;e.forEach(e=>{var r,n;let i,o,u=(i=null==(r=e.borderBoxSize)?void 0:r[0],o=null==(n=e.contentBoxSize)?void 0:n[0],"border-box"===v&&i?{width:i.inlineSize,height:i.blockSize}:"content-box"===v&&o?{width:o.inlineSize,height:o.blockSize}:{width:e.contentRect.width,height:e.contentRect.height});l?t(D.current,u)&&(D.current.width=u.width,D.current.height=u.height,null==d||d({width:u.width,height:u.height,entry:e})):m(r=>t(r,u)?(null==d||d({width:u.width,height:u.height,entry:e}),u):r)})},[o,u,h,v,l]),_=(0,r.useCallback)(((e,t,r,n)=>{switch(t){case"debounce":return ik(e,r,n);case"throttle":return function(e,t=0,r={}){let{leading:n=!0,trailing:i=!0}=r;return ik(e,t,{leading:n,maxWait:t,trailing:i})}(e,r,n);default:return e}})(w,t,n,i),[w,t,n,i]);return(0,r.useEffect)(()=>{let e;if(y)try{(e=new window.ResizeObserver(_)).observe(y,a)}catch(e){console.warn("ResizeObserver not supported or failed to initialize:",e)}else(p.width||p.height)&&(null==d||d({width:null,height:null,entry:null}),D.current.width=void 0,D.current.height=void 0,l||m({width:void 0,height:void 0}));return()=>{var t,r;null==(t=null==e?void 0:e.disconnect)||t.call(e),null==(r=_.cancel)||r.call(_)}},[_,y]),Object.assign({ref:g},l?D.current:p)}(u);c[3]!==h?(s=e=>{h.setActiveViewportId(e)},c[3]=h,c[4]=s):s=c[4];let D=s;return c[5]!==d||c[6]!==p||c[7]!==t||c[8]!==m||c[9]!==D||c[10]!==l?(a=(0,ip.jsx)(ij,{activeViewportId:d,setViewportActive:D,viewportData:l,resizeRef:m,...t},p),c[5]=d,c[6]=p,c[7]=t,c[8]=m,c[9]=D,c[10]=l,c[11]=a):a=c[11],a}}]},getToolbarModule:({servicesManager:e})=>[{name:"evaluate.microscopyTool",evaluate:({button:t})=>{let{microscopyService:r}=e.services,n=r.getActiveInteractions();if(!n)return!1;let i=n.find(e=>!!e[1].bindings.mouseButtons.includes("left")&&("draw"!==e[0]?e[0]===t.id:e[1].geometryType===t.id));return{disabled:!1,className:i?"!text-black bg-highlight":"!text-foreground/80 hover:!bg-muted hover:!text-highlight",isActive:i}}}],getSopClassHandlerModule:e=>[function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopySRSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.88.34"],getDisplaySetsFromSeries:t=>(function(e,t){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:r,microscopyService:n}=t.services,i=e[0],u=o.DicomMetadataStore.getSeries(i.StudyInstanceUID,i.SeriesInstanceUID).instances[0],s=function(e){let{ContentSequence:t}=e,r=iC(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iE).ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iA);return iC(r.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iF).ReferencedFrameOfReferenceUID}(u),{FrameOfReferenceUID:a,SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=i,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"SR",altImageText:"Microscopy SR",displaySetInstanceUID:iO.guid(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,ReferencedFrameOfReferenceUID:s,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:i,metadata:u,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(e){return iS(n,g,e).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return o.DicomMetadataStore.getStudy(d).series.forEach(t=>{let n=r.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(n)}),iN(e,g)},[g]})(t,e)}}(e),function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopyANNSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.91.1"],getDisplaySetsFromSeries:r=>(function(e,t,r){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:n,microscopyService:i}=t.services,u=[...e].sort((e,t)=>{let r=`${e.ContentDate}${e.ContentTime}`,n=`${t.ContentDate}${t.ContentTime}`;return r.localeCompare(n)}),s=u[u.length-1],a=o.DicomMetadataStore.getSeries(s.StudyInstanceUID,s.SeriesInstanceUID).instances[0],{SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=s,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"ANN",thumbnailSrc:null,altImageText:"Microscopy Annotation",displaySetInstanceUID:iT.uuidv4(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:s,metadata:a,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(){return(function({microscopyService:e,displaySet:t,extensionManager:r,servicesManager:n}){let{uiNotificationService:i}=n.services;return new Promise(async(o,u)=>{try{t.isLoading=!0;let{metadata:u}=t,s=await e.importDicomMicroscopyViewer(),a=(0,iB.A)({extensionManager:r,servicesManager:n}),c=n.services.viewportGridService.getActiveViewportId(),l=e.getManagedViewersForViewport(c)[0];a.retrieveSeriesMetadata({studyInstanceUID:u.StudyInstanceUID,seriesInstanceUID:u.SeriesInstanceUID}).then(async e=>{let r=e.map(e=>new s.metadata.MicroscopyBulkSimpleAnnotations({metadata:e}));i.show({message:"Loading annotations...",type:"info"}),await Promise.all(r.map(async e=>{try{await l.viewer.addAnnotationGroups(e),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.setAnnotationGroupStyle(t,{color:[255,234,0]})}),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.showAnnotationGroup(t)})}catch(e){console.error("failed to add annotation groups:",e),i.show({title:"Error loading annotations",message:e.message,type:"error"})}})),t.isLoaded=!0,t.isLoading=!1,o(t)})}catch(e){console.error("Error loading annotation:",e),u(e)}})})({microscopyService:i,displaySet:g,extensionManager:r,servicesManager:t}).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return o.DicomMetadataStore.getStudy(d).series.forEach(t=>{let r=n.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(r)}),iN(e,g)},[g]})(r,e,t)}}(e)],getPanelModule:function({commandsManager:e,extensionManager:t,servicesManager:r}){return[{name:"measure",iconName:"tab-linear",iconLabel:"Measure",label:"Measurements",secondaryLabel:"Measurements",component:({})=>{let[{activeViewportId:i,viewports:o}]=(0,n.useViewportGrid)();return(0,ip.jsx)(i_,{viewports:o,activeViewportId:i,onSaveComplete:()=>{},onRejectComplete:()=>{},commandsManager:e,servicesManager:r,extensionManager:t})}}]},getCommandsModule:function({servicesManager:e,commandsManager:t,extensionManager:r}){let{viewportGridService:n,uiDialogService:o,microscopyService:u}=e.services,s={deleteMeasurement:({uid:e})=>{if(e){let t=u.getAnnotation(e);t&&u.removeAnnotation(t)}},setLabel:async({uid:e})=>{let t=u.getAnnotation(e);if(!t)return;let r=await (0,i.callInputDialog)({uiDialogService:o,title:iu().t("Tools:Edit Measurement Label"),placeholder:t.label||iu().t("Tools:Enter new label"),defaultValue:t.label});null!=r&&(t.setLabel(r),u.triggerRelabel(t))},setToolActive:({toolName:e,toolGroupId:t="MICROSCOPY"})=>{let r=["dragPan",{bindings:{mouseButtons:["middle"]}}],n=["dragZoom",{bindings:{mouseButtons:["right"]}}];if(["line","box","circle","point","polygon","freehandpolygon","freehandline"].indexOf(e)>=0){let t={geometryType:e,vertexEnabled:!0,styleOptions:n6,bindings:{mouseButtons:["left"]}};"line"===e?(t.minPoints=2,t.maxPoints=2):"point"===e&&(delete t.styleOptions,delete t.vertexEnabled),u.activateInteractions([["draw",t],r,n])}else"dragPan"==e?u.activateInteractions([["dragPan",{bindings:{mouseButtons:["left","middle"]}}],n]):u.activateInteractions([[e,{bindings:{mouseButtons:["left"]}}],r,n])},toggleOverlays:()=>{let e=document.getElementsByClassName("microscopy-viewport-overlay");for(let t=0;t<e.length;t++)0===t&&e.item(0).classList.contains("hidden"),e.item(t).classList.toggle("hidden");let{activeViewportId:t}=n.getState();u.toggleOverviewMap(t)},toggleAnnotations:()=>{u.toggleROIsVisibility()}},a={deleteMeasurement:{commandFn:s.deleteMeasurement},setLabel:{commandFn:s.setLabel},setToolActive:{commandFn:s.setToolActive},toggleOverlays:{commandFn:s.toggleOverlays},toggleAnnotations:{commandFn:s.toggleAnnotations}};return{actions:s,definitions:a,defaultContext:"MICROSCOPY"}},getCustomizationModule:function(){return[]}};function iU(e){return e.displaySetInstanceUID}})(),c})());