@perses-dev/table-plugin 0.6.0

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.
Files changed (198) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/2341.cbbd94a8.css +1 -0
  4. package/__mf/css/async/5263.cbbd94a8.css +1 -0
  5. package/__mf/css/async/6759.cbbd94a8.css +1 -0
  6. package/__mf/css/async/8433.cbbd94a8.css +1 -0
  7. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  8. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  9. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  10. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  11. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  12. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  13. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  14. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  18. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  19. package/__mf/js/6487.f255ba88.js +5 -0
  20. package/__mf/js/Table.510470af.js +5 -0
  21. package/__mf/js/async/1620.ed8d9b3d.js +2 -0
  22. package/__mf/js/async/1620.ed8d9b3d.js.LICENSE.txt +9 -0
  23. package/__mf/js/async/1640.ff18956a.js +1 -0
  24. package/__mf/js/async/1722.586085f2.js +1 -0
  25. package/__mf/js/async/1964.979a7101.js +2 -0
  26. package/__mf/js/async/1964.979a7101.js.LICENSE.txt +9 -0
  27. package/__mf/js/async/1996.e0e5fb2a.js +2 -0
  28. package/__mf/js/async/1996.e0e5fb2a.js.LICENSE.txt +24 -0
  29. package/__mf/js/async/232.ab228ab3.js +1 -0
  30. package/__mf/js/async/2399.8ceb88c6.js +23 -0
  31. package/__mf/js/async/2641.78a9e888.js +1 -0
  32. package/__mf/js/async/2651.7c8030f0.js +1 -0
  33. package/__mf/js/async/3001.51d0062c.js +1 -0
  34. package/__mf/js/async/3224.fbb884ab.js +1 -0
  35. package/__mf/js/async/3598.66df4cef.js +1 -0
  36. package/__mf/js/async/3660.4a5855e1.js +23 -0
  37. package/__mf/js/async/3893.f1c71cae.js +1 -0
  38. package/__mf/js/async/3960.c992ac30.js +2 -0
  39. package/__mf/js/async/3960.c992ac30.js.LICENSE.txt +8 -0
  40. package/__mf/js/async/4062.0dd7dc24.js +1 -0
  41. package/__mf/js/async/4075.4fb81a28.js +1 -0
  42. package/__mf/js/async/4238.e22a8e1b.js +1 -0
  43. package/__mf/js/async/4446.9a215492.js +1 -0
  44. package/__mf/js/async/468.cca77551.js +110 -0
  45. package/__mf/js/async/468.cca77551.js.LICENSE.txt +27 -0
  46. package/__mf/js/async/4741.ceabfbaa.js +38 -0
  47. package/__mf/js/async/52.77f8a241.js +2 -0
  48. package/__mf/js/async/52.77f8a241.js.LICENSE.txt +37 -0
  49. package/__mf/js/async/5214.19ee9ad8.js +1 -0
  50. package/__mf/js/async/5377.05ab91aa.js +1 -0
  51. package/__mf/js/async/5409.3c667e6d.js +1 -0
  52. package/__mf/js/async/5662.d6ae2721.js +1 -0
  53. package/__mf/js/async/5767.6be60775.js +1 -0
  54. package/__mf/js/async/5912.b68e4631.js +1 -0
  55. package/__mf/js/async/5981.95116879.js +2 -0
  56. package/__mf/js/async/5981.95116879.js.LICENSE.txt +8 -0
  57. package/__mf/js/async/5998.ac755fc8.js +73 -0
  58. package/__mf/js/async/5998.ac755fc8.js.LICENSE.txt +19 -0
  59. package/__mf/js/async/6292.20be7eae.js +1 -0
  60. package/__mf/js/async/6333.35401612.js +2 -0
  61. package/__mf/js/async/6333.35401612.js.LICENSE.txt +9 -0
  62. package/__mf/js/async/654.fd64ef4b.js +1 -0
  63. package/__mf/js/async/6757.5675a614.js +7 -0
  64. package/__mf/js/async/6757.5675a614.js.LICENSE.txt +21 -0
  65. package/__mf/js/async/6770.84690346.js +1 -0
  66. package/__mf/js/async/6884.5426473f.js +1 -0
  67. package/__mf/js/async/694.4b146780.js +1 -0
  68. package/__mf/js/async/738.e2fbbd72.js +1 -0
  69. package/__mf/js/async/7606.4ba8e3ec.js +1 -0
  70. package/__mf/js/async/7740.dcade8b6.js +1 -0
  71. package/__mf/js/async/8444.d0d247d8.js +1 -0
  72. package/__mf/js/async/8488.d5eddfc6.js +1 -0
  73. package/__mf/js/async/8807.f0e4209b.js +1 -0
  74. package/__mf/js/async/894.1c4bbdb5.js +1 -0
  75. package/__mf/js/async/9010.8332598b.js +1 -0
  76. package/__mf/js/async/9173.00408de3.js +2 -0
  77. package/__mf/js/async/9173.00408de3.js.LICENSE.txt +19 -0
  78. package/__mf/js/async/9509.e6075bf0.js +1 -0
  79. package/__mf/js/async/__federation_expose_Table.0b081d4a.js +1 -0
  80. package/__mf/js/async/lib-router.d60ae988.js +2 -0
  81. package/__mf/js/async/lib-router.d60ae988.js.LICENSE.txt +32 -0
  82. package/__mf/js/main.fa5edfce.js +1 -0
  83. package/lib/CellsEditor/CellEditor.d.ts +10 -0
  84. package/lib/CellsEditor/CellEditor.d.ts.map +1 -0
  85. package/lib/CellsEditor/CellEditor.js +372 -0
  86. package/lib/CellsEditor/CellEditor.js.map +1 -0
  87. package/lib/CellsEditor/CellsEditor.d.ts +8 -0
  88. package/lib/CellsEditor/CellsEditor.d.ts.map +1 -0
  89. package/lib/CellsEditor/CellsEditor.js +123 -0
  90. package/lib/CellsEditor/CellsEditor.js.map +1 -0
  91. package/lib/CellsEditor/index.d.ts +3 -0
  92. package/lib/CellsEditor/index.d.ts.map +1 -0
  93. package/lib/CellsEditor/index.js +16 -0
  94. package/lib/CellsEditor/index.js.map +1 -0
  95. package/lib/ColumnsEditor/ColumnEditor.d.ts +11 -0
  96. package/lib/ColumnsEditor/ColumnEditor.d.ts.map +1 -0
  97. package/lib/ColumnsEditor/ColumnEditor.js +213 -0
  98. package/lib/ColumnsEditor/ColumnEditor.js.map +1 -0
  99. package/lib/ColumnsEditor/ColumnEditorContainer.d.ts +11 -0
  100. package/lib/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -0
  101. package/lib/ColumnsEditor/ColumnEditorContainer.js +139 -0
  102. package/lib/ColumnsEditor/ColumnEditorContainer.js.map +1 -0
  103. package/lib/ColumnsEditor/ColumnsEditor.d.ts +8 -0
  104. package/lib/ColumnsEditor/ColumnsEditor.d.ts.map +1 -0
  105. package/lib/ColumnsEditor/ColumnsEditor.js +95 -0
  106. package/lib/ColumnsEditor/ColumnsEditor.js.map +1 -0
  107. package/lib/ColumnsEditor/index.d.ts +4 -0
  108. package/lib/ColumnsEditor/index.d.ts.map +1 -0
  109. package/lib/ColumnsEditor/index.js +17 -0
  110. package/lib/ColumnsEditor/index.js.map +1 -0
  111. package/lib/EmbeddedPanel.d.ts +10 -0
  112. package/lib/EmbeddedPanel.d.ts.map +1 -0
  113. package/lib/EmbeddedPanel.js +39 -0
  114. package/lib/EmbeddedPanel.js.map +1 -0
  115. package/lib/Table.d.ts +8 -0
  116. package/lib/Table.d.ts.map +1 -0
  117. package/lib/Table.js +48 -0
  118. package/lib/Table.js.map +1 -0
  119. package/lib/TableCellsEditor.d.ts +6 -0
  120. package/lib/TableCellsEditor.d.ts.map +1 -0
  121. package/lib/TableCellsEditor.js +28 -0
  122. package/lib/TableCellsEditor.js.map +1 -0
  123. package/lib/TableColumnsEditor.d.ts +6 -0
  124. package/lib/TableColumnsEditor.d.ts.map +1 -0
  125. package/lib/TableColumnsEditor.js +28 -0
  126. package/lib/TableColumnsEditor.js.map +1 -0
  127. package/lib/TablePanel.d.ts +10 -0
  128. package/lib/TablePanel.d.ts.map +1 -0
  129. package/lib/TablePanel.js +325 -0
  130. package/lib/TablePanel.js.map +1 -0
  131. package/lib/TableSettingsEditor.d.ts +4 -0
  132. package/lib/TableSettingsEditor.d.ts.map +1 -0
  133. package/lib/TableSettingsEditor.js +108 -0
  134. package/lib/TableSettingsEditor.js.map +1 -0
  135. package/lib/TableTransformsEditor.d.ts +4 -0
  136. package/lib/TableTransformsEditor.d.ts.map +1 -0
  137. package/lib/TableTransformsEditor.js +28 -0
  138. package/lib/TableTransformsEditor.js.map +1 -0
  139. package/lib/bootstrap.d.ts +2 -0
  140. package/lib/bootstrap.d.ts.map +1 -0
  141. package/lib/bootstrap.js +19 -0
  142. package/lib/bootstrap.js.map +1 -0
  143. package/lib/cjs/CellsEditor/CellEditor.js +385 -0
  144. package/lib/cjs/CellsEditor/CellsEditor.js +136 -0
  145. package/lib/cjs/CellsEditor/index.js +31 -0
  146. package/lib/cjs/ColumnsEditor/ColumnEditor.js +221 -0
  147. package/lib/cjs/ColumnsEditor/ColumnEditorContainer.js +152 -0
  148. package/lib/cjs/ColumnsEditor/ColumnsEditor.js +108 -0
  149. package/lib/cjs/ColumnsEditor/index.js +32 -0
  150. package/lib/cjs/EmbeddedPanel.js +52 -0
  151. package/lib/cjs/Table.js +54 -0
  152. package/lib/cjs/TableCellsEditor.js +36 -0
  153. package/lib/cjs/TableColumnsEditor.js +36 -0
  154. package/lib/cjs/TablePanel.js +341 -0
  155. package/lib/cjs/TableSettingsEditor.js +116 -0
  156. package/lib/cjs/TableTransformsEditor.js +36 -0
  157. package/lib/cjs/bootstrap.js +26 -0
  158. package/lib/cjs/env.d.js +14 -0
  159. package/lib/cjs/getPluginModule.js +27 -0
  160. package/lib/cjs/index-federation.js +55 -0
  161. package/lib/cjs/index.js +34 -0
  162. package/lib/cjs/model.js +4 -0
  163. package/lib/cjs/setup-tests.js +19 -0
  164. package/lib/cjs/table-model.js +27 -0
  165. package/lib/cjs/test/mock-query-results.js +417 -0
  166. package/lib/env.d.js +15 -0
  167. package/lib/env.d.js.map +1 -0
  168. package/lib/getPluginModule.d.ts +6 -0
  169. package/lib/getPluginModule.d.ts.map +1 -0
  170. package/lib/getPluginModule.js +16 -0
  171. package/lib/getPluginModule.js.map +1 -0
  172. package/lib/index-federation.d.ts +1 -0
  173. package/lib/index-federation.d.ts.map +1 -0
  174. package/lib/index-federation.js +15 -0
  175. package/lib/index-federation.js.map +1 -0
  176. package/lib/index.d.ts +12 -0
  177. package/lib/index.d.ts.map +1 -0
  178. package/lib/index.js +13 -0
  179. package/lib/index.js.map +1 -0
  180. package/lib/model.d.ts +6 -0
  181. package/lib/model.d.ts.map +1 -0
  182. package/lib/model.js +3 -0
  183. package/lib/model.js.map +1 -0
  184. package/lib/setup-tests.d.ts +2 -0
  185. package/lib/setup-tests.d.ts.map +1 -0
  186. package/lib/setup-tests.js +17 -0
  187. package/lib/setup-tests.js.map +1 -0
  188. package/lib/table-model.d.ts +92 -0
  189. package/lib/table-model.d.ts.map +1 -0
  190. package/lib/table-model.js +21 -0
  191. package/lib/table-model.js.map +1 -0
  192. package/lib/test/mock-query-results.d.ts +136 -0
  193. package/lib/test/mock-query-results.d.ts.map +1 -0
  194. package/lib/test/mock-query-results.js +389 -0
  195. package/lib/test/mock-query-results.js.map +1 -0
  196. package/mf-manifest.json +491 -0
  197. package/mf-stats.json +554 -0
  198. package/package.json +60 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 52.77f8a241.js.LICENSE.txt */
2
+ (self.webpackChunkTable=self.webpackChunkTable||[]).push([["52"],{74638:function(e,t,r){"use strict";r.d(t,{Z:()=>G});var n,i,s,a,o,u,c,l,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{};function h(){if(a)return s;a=1;let e=[{key:"ZiB",factor:11805916207174113e5},{key:"ZB",factor:1e21},{key:"YiB",factor:12089258196146292e8},{key:"YB",factor:1e24},{key:"TiB",factor:0x10000000000},{key:"TB",factor:1e12},{key:"PiB",factor:0x4000000000000},{key:"PB",factor:1e15},{key:"MiB",factor:1048576},{key:"MB",factor:1e6},{key:"KiB",factor:1024},{key:"KB",factor:1e3},{key:"GiB",factor:0x40000000},{key:"GB",factor:1e9},{key:"EiB",factor:0x1000000000000000},{key:"EB",factor:1e18},{key:"B",factor:1}];function t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}return s={unformat:function(r,n){let i;let s=m(),a=s.currentDelimiters(),o=s.currentCurrency().symbol,u=s.currentOrdinal(),c=s.getZeroFormat(),l=s.currentAbbreviations();if("string"==typeof r){if(function(e,t){if(!(e.indexOf(":")&&":"!==t.thousands))return!1;let r=e.split(":");if(3!==r.length)return!1;let n=+r[0],i=+r[1],s=+r[2];return!isNaN(n)&&!isNaN(i)&&!isNaN(s)}(r,a)){let e,t,n;t=+(e=r.split(":"))[0],n=+e[1],i=+e[2]+60*n+3600*t}else i=function(r,n,i="",s,a,o,u){let c;if(""!==r)return r===a?0:function r(n,i,s,a,o,u,c){if(!isNaN(+n))return+n;let l="",f=n.replace(/(^[^(]*)\((.*)\)([^)]*$)/,"$1$2$3");if(f!==n)return -1*r(f,i,s,a,o,u);for(let t=0;t<e.length;t++){let c=e[t];if((l=n.replace(RegExp(`([0-9 ])(${c.key})$`),"$1"))!==n)return r(l,i,s,a,o,u)*c.factor}if((l=n.replace("%",""))!==n)return r(l,i,s,a,o,u)/100;let h=parseFloat(n);if(isNaN(h))return;let d=a(h);if(d&&"."!==d&&(l=n.replace(RegExp(`${t(d)}$`),""))!==n)return r(l,i,s,a,o,u);let p={};Object.keys(u).forEach(e=>{p[u[e]]=e});let m=Object.keys(p).sort().reverse(),g=m.length;for(let e=0;e<g;e++){let t=m[e],c=p[t];if((l=n.replace(t,""))!==n){let e;switch(c){case"thousand":e=1e3;break;case"million":e=1e6;break;case"billion":e=1e9;break;case"trillion":e=1e12}return r(l,i,s,a,o,u)*e}}}(r.replace(i,"").replace(RegExp(`([0-9])${t(n.thousands)}([0-9])`,"g"),"$1$2").replace(n.decimal,"."),n,i,s,a,o)}(r,a,o,u,c,l)}else{if("number"!=typeof r)return;i=r}if(void 0!==i)return i}}}function d(){if(u)return o;u=1;let e=h(),t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,r={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},n={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function i(t){return void 0!==e.unformat(t)}function s(e,t,n,i=!1){let a=Object.keys(e).map(i=>{if(!t[i])return console.error(`${n} Invalid key: ${i}`),!1;let a=e[i],o=t[i];if("string"==typeof o&&(o={type:o}),"format"===o.type){if(!s(a,r,`[Validate ${i}]`,!0))return!1}else if(typeof a!==o.type)return console.error(`${n} ${i} type mismatched: "${o.type}" expected, "${typeof a}" provided`),!1;if(o.restrictions&&o.restrictions.length){let t=o.restrictions.length;for(let r=0;r<t;r++){let{restriction:t,message:s}=o.restrictions[r];if(!t(a,e))return console.error(`${n} ${i} invalid value: ${s}`),!1}}return o.restriction&&!o.restriction(a,e)?(console.error(`${n} ${i} invalid value: ${o.message}`),!1):o.validValues&&-1===o.validValues.indexOf(a)?(console.error(`${n} ${i} invalid value: must be among ${JSON.stringify(o.validValues)}, "${a}" provided`),!1):!o.children||!!s(a,o.children,`[Validate ${i}]`)});return i||a.push(...Object.keys(t).map(r=>{let i=t[r];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[r])return console.error(`${n} Missing mandatory key "${r}"`),!1}return!0})),a.reduce((e,t)=>e&&t,!0)}function a(e){return s(e,r,"[Validate format]")}return o={validate:function(e,t){let r=i(e),n=a(t);return r&&n},validateFormat:a,validateInput:i,validateLanguage:function(e){return s(e,n,"[Validate language]")}}}var p={parseFormat:function(e,t={}){var r,n,i,s,a;let o,u,c,l;return"string"!=typeof e?e:(!function(e,t){if(-1!==e.indexOf("$")){t.output="currency";return}if(-1!==e.indexOf("%")){t.output="percent";return}if(-1!==e.indexOf("bd")){t.output="byte",t.base="general";return}if(-1!==e.indexOf("b")){t.output="byte",t.base="binary";return}if(-1!==e.indexOf("d")){t.output="byte",t.base="decimal";return}if(-1!==e.indexOf(":")){t.output="time";return}-1!==e.indexOf("o")&&(t.output="ordinal")}(e=(u=(n=e=(o=(r=e).match(/^{([^}]*)}/))?(t.prefix=o[1],r.slice(o[0].length)):r).match(/{([^}]*)}$/))?(t.postfix=u[1],n.slice(0,-u[0].length)):n,t),(c=e.match(/[1-9]+[0-9]*/))&&(t.totalLength=+c[0]),(l=e.split(".")[0].match(/0+/))&&(t.characteristic=l[0].length),!function(e,t){if(-1!==e.indexOf(".")){let r=e.split(".")[0];t.optionalCharacteristic=-1===r.indexOf("0")}}(e,t),-1!==e.indexOf("a")&&(t.average=!0),-1!==(i=e).indexOf("K")?t.forceAverage="thousand":-1!==i.indexOf("M")?t.forceAverage="million":-1!==i.indexOf("B")?t.forceAverage="billion":-1!==i.indexOf("T")&&(t.forceAverage="trillion"),!function(e,t){let r=e.split(".")[1];if(r){let e=r.match(/0+/);e&&(t.mantissa=e[0].length)}}(e,t),(s=e).match(/\[\.]/)?t.optionalMantissa=!0:s.match(/\./)&&(t.optionalMantissa=!1),!function(e,t){let r=e.split(".")[1];r&&(t.trimMantissa=-1!==r.indexOf("["))}(e,t),-1!==e.indexOf(",")&&(t.thousandSeparated=!0),-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0)),(a=e).match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),a.match(/^\+?-/)&&(t.negative="sign"),e.match(/^\+/)&&(t.forceSign=!0),t)}};function m(){let e;if(l)return c;l=1;let t=i?n:(i=1,n={languageTag:"en-US",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},spaceSeparated:!1,ordinal:function(e){let t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},bytes:{binarySuffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],decimalSuffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},currency:{symbol:"$",position:"prefix",code:"USD"},currencyFormat:{thousandSeparated:!0,totalLength:4,spaceSeparated:!0,spaceSeparatedCurrency:!0},formats:{fourDigits:{totalLength:4,spaceSeparated:!0},fullWithTwoDecimals:{output:"currency",thousandSeparated:!0,mantissa:2},fullWithTwoDecimalsNoCurrency:{thousandSeparated:!0,mantissa:2},fullWithNoDecimals:{output:"currency",thousandSeparated:!0,mantissa:0}}}),r=d(),s={},a={},o=null,u={};function f(){return a[e]}return s.languages=()=>Object.assign({},a),s.currentLanguage=()=>e,s.currentBytes=()=>f().bytes||{},s.currentCurrency=()=>f().currency,s.currentAbbreviations=()=>f().abbreviations,s.currentDelimiters=()=>f().delimiters,s.currentOrdinal=()=>f().ordinal,s.currentDefaults=()=>Object.assign({},f().defaults,u),s.currentOrdinalDefaultFormat=()=>Object.assign({},s.currentDefaults(),f().ordinalFormat),s.currentByteDefaultFormat=()=>Object.assign({},s.currentDefaults(),f().byteFormat),s.currentPercentageDefaultFormat=()=>Object.assign({},s.currentDefaults(),f().percentageFormat),s.currentCurrencyDefaultFormat=()=>Object.assign({},s.currentDefaults(),f().currencyFormat),s.currentTimeDefaultFormat=()=>Object.assign({},s.currentDefaults(),f().timeFormat),s.setDefaults=e=>{e=p.parseFormat(e),r.validateFormat(e)&&(u=e)},s.getZeroFormat=()=>o,s.setZeroFormat=e=>o="string"==typeof e?e:null,s.hasZeroFormat=()=>null!==o,s.languageData=e=>{if(e){if(a[e])return a[e];throw Error(`Unknown tag "${e}"`)}return f()},s.registerLanguage=(t,n=!1)=>{if(!r.validateLanguage(t))throw Error("Invalid language data");a[t.languageTag]=t,n&&(e=t.languageTag)},s.setLanguage=(r,n=t.languageTag)=>{if(!a[r]){let t=r.split("-")[0],i=Object.keys(a).find(e=>e.split("-")[0]===t);if(!a[i]){e=n;return}e=i;return}e=r},s.registerLanguage(t),e=t.languageTag,c=s}var g={exports:{}};!function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",o=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function u(e){var t=0|e;return e>0||e===t?t:t-1}function c(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function l(e,t){var r,n,i=e.c,s=t.c,a=e.s,o=t.s,u=e.e,c=t.e;if(!a||!o)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-o:a;if(a!=o)return a;if(r=a<0,n=u==c,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=0,o=(u=i.length)<(c=s.length)?u:c;a<o;a++)if(i[a]!=s[a])return i[a]>s[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function f(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function h(e){var t=e.c.length-1;return u(e.e/14)==t&&e.c[t]%2!=0}function d(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function p(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(t=function e(t){var m,g,v,y,_,w,b,x,N,E=P.prototype={constructor:P,toString:null,valueOf:null},k=new P(1),M=20,O=4,S=-7,A=21,T=-1e7,C=1e7,j=!1,I=1,F=0,Z={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",D=!0;function P(e,t){var n,s,o,u,c,l,h,d,p=this;if(!(p instanceof P))return new P(e,t);if(null==t){if(e&&!0===e._isBigNumber){p.s=e.s,!e.c||e.e>C?p.c=p.e=null:e.e<T?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice());return}if((l="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);u>C?p.c=p.e=null:(p.e=u,p.c=[e]);return}d=String(e)}else{if(!r.test(d=String(e)))return N(p,d,l);p.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(u=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(u<0&&(u=c),u+=+d.slice(c+1),d=d.substring(0,c)):u<0&&(u=d.length)}else{if(f(t,2,z.length,"Base"),10==t&&D)return L(p=new P(e),M+p.e+1,O);if(d=String(e),l="number"==typeof e){if(0*e!=0)return N(p,d,l,t);if(p.s=1/e<0?(d=d.slice(1),-1):1,P.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else p.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(n=z.slice(0,t),u=c=0,h=d.length;c<h;c++)if(0>n.indexOf(s=d.charAt(c))){if("."==s){if(c>u){u=h;continue}}else if(!o&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){o=!0,c=-1,u=0;continue}return N(p,String(e),l,t)}l=!1,(u=(d=x(d,t,10,p.s)).indexOf("."))>-1?d=d.replace(".",""):u=d.length}for(c=0;48===d.charCodeAt(c);c++);for(h=d.length;48===d.charCodeAt(--h););if(d=d.slice(c,++h)){if(h-=c,l&&P.DEBUG&&h>15&&(e>0x1fffffffffffff||e!==i(e)))throw Error(a+p.s*e);if((u=u-c-1)>C)p.c=p.e=null;else if(u<T)p.c=[p.e=0];else{if(p.e=u,p.c=[],c=(u+1)%14,u<0&&(c+=14),c<h){for(c&&p.c.push(+d.slice(0,c)),h-=14;c<h;)p.c.push(+d.slice(c,c+=14));c=14-(d=d.slice(c)).length}else c-=h;for(;c--;d+="0");p.c.push(+d)}}else p.c=[p.e=0]}function R(e,t,r,n){var i,s,a,o,u;if(null==r?r=O:f(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)u=c(e.c),u=1==n||2==n&&(a<=S||a>=A)?d(u,a):p(u,a,"0");else if(s=(e=L(new P(e),t,r)).e,o=(u=c(e.c)).length,1==n||2==n&&(t<=s||s<=S)){for(;o<t;u+="0",o++);u=d(u,s)}else if(t-=a,u=p(u,s,"0"),s+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-o)>0)for(s+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function $(e,t){for(var r,n,i=1,s=new P(e[0]);i<e.length;i++)(n=new P(e[i])).s&&(r=l(s,n))!==t&&(0!==r||s.s!==t)||(s=n);return s}function B(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>C?e.c=e.e=null:r<T?e.c=[e.e=0]:(e.e=r,e.c=t),e}function L(e,t,r,s){var a,u,c,l,f,h,d,p=e.c;if(p){e:{for(a=1,l=p[0];l>=10;l/=10,a++);if((u=t-a)<0)u+=14,c=t,d=i((f=p[h=0])/o[a-c-1]%10);else if((h=n((u+1)/14))>=p.length){if(s){for(;p.length<=h;p.push(0));f=d=0,a=1,u%=14,c=u-14+1}else break e}else{for(a=1,f=l=p[h];l>=10;l/=10,a++);u%=14,d=(c=u-14+a)<0?0:i(f/o[a-c-1]%10)}if(s=s||t<0||null!=p[h+1]||(c<0?f:f%o[a-c-1]),s=r<4?(d||s)&&(0==r||r==(e.s<0?3:2)):d>5||5==d&&(4==r||s||6==r&&(u>0?c>0?f/o[a-c]:0:p[h-1])%10&1||r==(e.s<0?8:7)),t<1||!p[0])return p.length=0,s?(t-=e.e+1,p[0]=o[(14-t%14)%14],e.e=-t||0):p[0]=e.e=0,e;if(0==u?(p.length=h,l=1,h--):(p.length=h+1,l=o[14-u],p[h]=c>0?i(f/o[a-c]%o[c])*l:0),s)for(;;){if(0==h){for(u=1,c=p[0];c>=10;c/=10,u++);for(c=p[0]+=l,l=1;c>=10;c/=10,l++);u!=l&&(e.e++,1e14==p[0]&&(p[0]=1));break}if(p[h]+=l,1e14!=p[h])break;p[h--]=0,l=1}for(u=p.length;0===p[--u];p.pop());}e.e>C?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function U(e){var t,r=e.e;return null===r?e.toString():(t=c(e.c),t=r<=S||r>=A?d(t,r):p(t,r,"0"),e.s<0?"-"+t:t)}return P.clone=e,P.ROUND_UP=0,P.ROUND_DOWN=1,P.ROUND_CEIL=2,P.ROUND_FLOOR=3,P.ROUND_HALF_UP=4,P.ROUND_HALF_DOWN=5,P.ROUND_HALF_EVEN=6,P.ROUND_HALF_CEIL=7,P.ROUND_HALF_FLOOR=8,P.EUCLID=9,P.config=P.set=function(e){var t,r;if(null!=e){if("object"==typeof e){if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(f(r=e[t],0,1e9,t),M=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(f(r=e[t],0,8,t),O=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(f(r[0],-1e9,0,t),f(r[1],0,1e9,t),S=r[0],A=r[1]):(f(r,-1e9,1e9,t),S=-(A=r<0?-r:r))),e.hasOwnProperty(t="RANGE")){if((r=e[t])&&r.pop)f(r[0],-1e9,-1,t),f(r[1],1,1e9,t),T=r[0],C=r[1];else if(f(r,-1e9,1e9,t),r)T=-(C=r<0?-r:r);else throw Error(s+t+" cannot be zero: "+r)}if(e.hasOwnProperty(t="CRYPTO")){if(!!(r=e[t])===r){if(r){if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))j=r;else throw j=!r,Error(s+"crypto unavailable")}else j=r}else throw Error(s+t+" not true or false: "+r)}if(e.hasOwnProperty(t="MODULO_MODE")&&(f(r=e[t],0,9,t),I=r),e.hasOwnProperty(t="POW_PRECISION")&&(f(r=e[t],0,1e9,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"==typeof(r=e[t]))Z=r;else throw Error(s+t+" not an object: "+r)}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);D="0123456789"==r.slice(0,10),z=r}}else throw Error(s+"Object expected: "+e)}return{DECIMAL_PLACES:M,ROUNDING_MODE:O,EXPONENTIAL_AT:[S,A],RANGE:[T,C],CRYPTO:j,MODULO_MODE:I,POW_PRECISION:F,FORMAT:Z,ALPHABET:z}},P.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!P.DEBUG)return!0;var t,r,n=e.c,a=e.e,o=e.s;e:if("[object Array]"==({}).toString.call(n)){if((1===o||-1===o)&&a>=-1e9&&a<=1e9&&a===i(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=1e14||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===a&&(null===o||1===o||-1===o))return!0;throw Error(s+"Invalid BigNumber: "+e)},P.maximum=P.max=function(){return $(arguments,-1)},P.minimum=P.min=function(){return $(arguments,1)},P.random=(m=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},function(e){var t,r,a,u,c,l=0,h=[],d=new P(k);if(null==e?e=M:f(e,0,1e9),u=n(e/14),j){if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));l<u;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(h.push(c%1e14),l+=2);l=u/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(u*=7);l<u;)(c=(31&t[l])*0x1000000000000+0x10000000000*t[l+1]+0x100000000*t[l+2]+0x1000000*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(h.push(c%1e14),l+=7);l=u/7}else throw j=!1,Error(s+"crypto unavailable")}if(!j)for(;l<u;)(c=m())<9e15&&(h[l++]=c%1e14);for(u=h[--l],e%=14,u&&e&&(c=o[14-e],h[l]=i(u/c)*c);0===h[l];h.pop(),l--);if(l<0)h=[a=0];else{for(a=-1;0===h[0];h.splice(0,1),a-=14);for(l=1,c=h[0];c>=10;c/=10,l++);l<14&&(a-=14-l)}return d.e=a,d.c=h,d}),P.sum=function(){for(var e=1,t=arguments,r=new P(t[0]);e<t.length;)r=r.plus(t[e++]);return r},x=function(){var e="0123456789";function t(e,t,r,n){for(var i,s,a=[0],o=0,u=e.length;o<u;){for(s=a.length;s--;a[s]*=t);for(a[0]+=n.indexOf(e.charAt(o++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(r,n,i,s,a){var o,u,l,f,h,d,m,g,v=r.indexOf("."),y=M,_=O;for(v>=0&&(f=F,F=0,r=r.replace(".",""),d=(g=new P(n)).pow(r.length-v),F=f,g.c=t(p(c(d.c),d.e,"0"),10,i,e),g.e=g.c.length),l=f=(m=t(r,n,i,a?(o=z,e):(o=e,z))).length;0==m[--f];m.pop());if(!m[0])return o.charAt(0);if(v<0?--l:(d.c=m,d.e=l,d.s=s,m=(d=b(d,g,y,_,i)).c,h=d.r,l=d.e),v=m[u=l+y+1],f=i/2,h=h||u<0||null!=m[u+1],h=_<4?(null!=v||h)&&(0==_||_==(d.s<0?3:2)):v>f||v==f&&(4==_||h||6==_&&1&m[u-1]||_==(d.s<0?8:7)),u<1||!m[0])r=h?p(o.charAt(1),-y,o.charAt(0)):o.charAt(0);else{if(m.length=u,h)for(--i;++m[--u]>i;)m[u]=0,u||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(v=0,r="";v<=f;r+=o.charAt(m[v++]));r=p(r,l,o.charAt(0))}return r}}(),b=function(){function e(e,t,r){var n,i,s,a,o=0,u=e.length,c=t%1e7,l=t/1e7|0;for(e=e.slice();u--;)n=l*(s=e[u]%1e7)+(a=e[u]/1e7|0)*c,o=((i=c*s+n%1e7*1e7+o)/r|0)+(n/1e7|0)+l*a,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}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.splice(0,1));}return function(n,s,a,o,c){var l,f,h,d,p,m,g,v,y,_,w,b,x,N,E,k,M,O=n.s==s.s?1:-1,S=n.c,A=s.c;if(!S||!S[0]||!A||!A[0])return new P(n.s&&s.s&&(S?!A||S[0]!=A[0]:A)?S&&0==S[0]||!A?0*O:O/0:NaN);for(y=(v=new P(O)).c=[],O=a+(f=n.e-s.e)+1,c||(c=1e14,f=u(n.e/14)-u(s.e/14),O=O/14|0),h=0;A[h]==(S[h]||0);h++);if(A[h]>(S[h]||0)&&f--,O<0)y.push(1),d=!0;else{for(N=S.length,k=A.length,h=0,O+=2,(p=i(c/(A[0]+1)))>1&&(A=e(A,p,c),S=e(S,p,c),k=A.length,N=S.length),x=k,w=(_=S.slice(0,k)).length;w<k;_[w++]=0);M=[0].concat(M=A.slice()),E=A[0],A[1]>=c/2&&E++;do{if(p=0,(l=t(A,_,k,w))<0){if(b=_[0],k!=w&&(b=b*c+(_[1]||0)),(p=i(b/E))>1)for(p>=c&&(p=c-1),g=(m=e(A,p,c)).length,w=_.length;1==t(m,_,g,w);)p--,r(m,k<g?M:A,g,c),g=m.length,l=1;else 0==p&&(l=p=1),g=(m=A.slice()).length;if(g<w&&(m=[0].concat(m)),r(_,m,w,c),w=_.length,-1==l)for(;1>t(A,_,k,w);)p++,r(_,k<w?M:A,w,c),w=_.length}else 0===l&&(p++,_=[0]);y[h++]=p,_[0]?_[w++]=S[x]||0:(_=[S[x]],w=1)}while((x++<N||null!=_[0])&&O--);d=null!=_[0],y[0]||y.splice(0,1)}if(1e14==c){for(h=1,O=y[0];O>=10;O/=10,h++);L(v,a+(v.e=h+14*f-1)+1,o,d)}else v.e=f,v.r=+d;return v}}(),g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,y=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g,N=function(e,t,r,n){var i,a=r?t:t.replace(w,"");if(_.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(g,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,a=a.replace(v,"$1").replace(y,"0.$1")),t!=a))return new P(a,i);if(P.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},E.absoluteValue=E.abs=function(){var e=new P(this);return e.s<0&&(e.s=1),e},E.comparedTo=function(e,t){return l(this,new P(e,t))},E.decimalPlaces=E.dp=function(e,t){var r,n,i;if(null!=e)return f(e,0,1e9),null==t?t=O:f(t,0,8),L(new P(this),e+this.e+1,t);if(!(r=this.c))return null;if(n=((i=r.length-1)-u(this.e/14))*14,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},E.dividedBy=E.div=function(e,t){return b(this,new P(e,t),M,O)},E.dividedToIntegerBy=E.idiv=function(e,t){return b(this,new P(e,t),0,1)},E.exponentiatedBy=E.pow=function(e,t){var r,a,o,u,c,l,f,d,p,m=this;if((e=new P(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+U(e));if(null!=t&&(t=new P(t)),l=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return p=new P(Math.pow(+U(m),l?e.s*(2-h(e)):+U(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new P(NaN);(a=!f&&m.isInteger()&&t.isInteger())&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||l&&m.c[1]>=24e7:m.c[0]<8e13||l&&m.c[0]<=9999975e7)))return u=m.s<0&&h(e)?-0:0,m.e>-1&&(u=1/u),new P(f?1/u:u);F&&(u=n(F/14+2))}for(l?(r=new P(.5),f&&(e.s=1),d=h(e)):d=(o=Math.abs(+U(e)))%2,p=new P(k);;){if(d){if(!(p=p.times(m)).c)break;u?p.c.length>u&&(p.c.length=u):a&&(p=p.mod(t))}if(o){if(0===(o=i(o/2)))break;d=o%2}else if(L(e=e.times(r),e.e+1,1),e.e>14)d=h(e);else{if(0==(o=+U(e)))break;d=o%2}m=m.times(m),u?m.c&&m.c.length>u&&(m.c.length=u):a&&(m=m.mod(t))}return a?p:(f&&(p=k.div(p)),t?p.mod(t):u?L(p,F,O,c):p)},E.integerValue=function(e){var t=new P(this);return null==e?e=O:f(e,0,8),L(t,t.e+1,e)},E.isEqualTo=E.eq=function(e,t){return 0===l(this,new P(e,t))},E.isFinite=function(){return!!this.c},E.isGreaterThan=E.gt=function(e,t){return l(this,new P(e,t))>0},E.isGreaterThanOrEqualTo=E.gte=function(e,t){return 1===(t=l(this,new P(e,t)))||0===t},E.isInteger=function(){return!!this.c&&u(this.e/14)>this.c.length-2},E.isLessThan=E.lt=function(e,t){return 0>l(this,new P(e,t))},E.isLessThanOrEqualTo=E.lte=function(e,t){return -1===(t=l(this,new P(e,t)))||0===t},E.isNaN=function(){return!this.s},E.isNegative=function(){return this.s<0},E.isPositive=function(){return this.s>0},E.isZero=function(){return!!this.c&&0==this.c[0]},E.minus=function(e,t){var r,n,i,s,a=this.s;if(t=(e=new P(e,t)).s,!a||!t)return new P(NaN);if(a!=t)return e.s=-t,this.plus(e);var o=this.e/14,c=e.e/14,l=this.c,f=e.c;if(!o||!c){if(!l||!f)return l?(e.s=-t,e):new P(f?this:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new P(l[0]?this:3==O?-0:0)}if(o=u(o),c=u(c),l=l.slice(),a=o-c){for((s=a<0)?(a=-a,i=l):(c=o,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(s=(a=l.length)<(t=f.length))?a:t,a=t=0;t<n;t++)if(l[t]!=f[t]){s=l[t]<f[t];break}if(s&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=1e14-1;n>a;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=1e14}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?B(e,l,c):(e.s=3==O?-1:1,e.c=[e.e=0],e)},E.modulo=E.mod=function(e,t){var r,n;return(e=new P(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==I?(n=e.s,e.s=1,r=b(this,e,0,3),e.s=n,r.s*=n):r=b(this,e,0,I),(e=this.minus(r.times(e))).c[0]||1!=I||(e.s=this.s),e):new P(this):new P(NaN)},E.multipliedBy=E.times=function(e,t){var r,n,i,s,a,o,c,l,f,h,d,p,m,g=this.c,v=(e=new P(e,t)).c;if(!g||!v||!g[0]||!v[0])return this.s&&e.s&&(!g||g[0]||v)&&(!v||v[0]||g)?(e.s*=this.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null):e.c=e.e=e.s=null,e;for(n=u(this.e/14)+u(e.e/14),e.s*=this.s,(c=g.length)<(h=v.length)&&(m=g,g=v,v=m,i=c,c=h,h=i),i=c+h,m=[];i--;m.push(0));for(i=h;--i>=0;){for(r=0,d=v[i]%1e7,p=v[i]/1e7|0,s=i+(a=c);s>i;)o=p*(l=g[--a]%1e7)+(f=g[a]/1e7|0)*d,r=((l=d*l+o%1e7*1e7+m[s]+r)/1e14|0)+(o/1e7|0)+p*f,m[s--]=l%1e14;m[s]=r}return r?++n:m.splice(0,1),B(e,m,n)},E.negated=function(){var e=new P(this);return e.s=-e.s||null,e},E.plus=function(e,t){var r,n=this.s;if(t=(e=new P(e,t)).s,!n||!t)return new P(NaN);if(n!=t)return e.s=-t,this.minus(e);var i=this.e/14,s=e.e/14,a=this.c,o=e.c;if(!i||!s){if(!a||!o)return new P(n/0);if(!a[0]||!o[0])return o[0]?e:new P(a[0]?this:0*n)}if(i=u(i),s=u(s),a=a.slice(),n=i-s){for(n>0?(s=i,r=o):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=o.length)<0&&(r=o,o=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+o[t]+n)/1e14|0,a[t]=1e14===a[t]?0:a[t]%1e14;return n&&(a=[n].concat(a),++s),B(e,a,s)},E.precision=E.sd=function(e,t){var r,n,i;if(null!=e&&!!e!==e)return f(e,1,1e9),null==t?t=O:f(t,0,8),L(new P(this),e,t);if(!(r=this.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&this.e+1>n&&(n=this.e+1),n},E.shiftedBy=function(e){return f(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},E.squareRoot=E.sqrt=function(){var e,t,r,n,i,s=this.c,a=this.s,o=this.e,l=M+4,f=new P("0.5");if(1!==a||!s||!s[0])return new P(!a||a<0&&(!s||s[0])?NaN:s?this:1/0);if(0==(a=Math.sqrt(+U(this)))||a==1/0?(((t=c(s)).length+o)%2==0&&(t+="0"),a=Math.sqrt(+t),o=u((o+1)/2)-(o<0||o%2),r=new P(t=a==1/0?"5e"+o:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+o)):r=new P(a+""),r.c[0]){for((a=(o=r.e)+l)<3&&(a=0);;)if(i=r,r=f.times(i.plus(b(this,i,l,1))),c(i.c).slice(0,a)===(t=c(r.c)).slice(0,a)){if(r.e<o&&--a,"9999"!=(t=t.slice(a-3,a+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(L(r,r.e+M+2,1),e=!r.times(r).eq(this));break}if(!n&&(L(i,i.e+M+2,0),i.times(i).eq(this))){r=i;break}l+=4,a+=4,n=1}}return L(r,r.e+M+1,O,e)},E.toExponential=function(e,t){return null!=e&&(f(e,0,1e9),e++),R(this,e,t,1)},E.toFixed=function(e,t){return null!=e&&(f(e,0,1e9),e=e+this.e+1),R(this,e,t)},E.toFormat=function(e,t,r){var n;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=Z;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=this.toFixed(e,t),this.c){var i,a=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,c=r.groupSeparator||"",l=a[0],f=a[1],h=this.s<0,d=h?l.slice(1):l,p=d.length;if(u&&(i=o,o=u,u=i,p-=i),o>0&&p>0){for(i=p%o||o,l=d.substr(0,i);i<p;i+=o)l+=c+d.substr(i,o);u>0&&(l+=c+d.slice(i)),h&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},E.toFraction=function(e){var t,r,n,i,a,u,l,f,h,d,p,m,g=this.c;if(null!=e&&(!(l=new P(e)).isInteger()&&(l.c||1!==l.s)||l.lt(k)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+U(l));if(!g)return new P(this);for(t=new P(k),h=r=new P(k),n=f=new P(k),m=c(g),a=t.e=m.length-this.e-1,t.c[0]=o[(u=a%14)<0?14+u:u],e=!e||l.comparedTo(t)>0?a>0?t:h:l,u=C,C=1/0,l=new P(m),f.c[0]=0;d=b(l,t,0,1),1!=(i=r.plus(d.times(n))).comparedTo(e);)r=n,n=i,h=f.plus(d.times(i=h)),f=i,t=l.minus(d.times(i=t)),l=i;return i=b(e.minus(r),n,0,1),f=f.plus(i.times(h)),r=r.plus(i.times(n)),f.s=h.s=this.s,a*=2,p=1>b(h,n,a,O).minus(this).abs().comparedTo(b(f,r,a,O).minus(this).abs())?[h,n]:[f,r],C=u,p},E.toNumber=function(){return+U(this)},E.toPrecision=function(e,t){return null!=e&&f(e,1,1e9),R(this,e,t,2)},E.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=S||i>=A?d(c(r.c),i):p(c(r.c),i,"0"):10===e&&D?t=p(c((r=L(new P(r),M+i+1,O)).c),r.e,"0"):(f(e,2,z.length,"Base"),t=x(p(c(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},E.valueOf=E.toJSON=function(){return U(this)},E._isBigNumber=!0,null!=t&&P.set(t),P}()).default=t.BigNumber=t,g.exports?g.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)}(f);var v=g.exports;let y=m(),_=d(),w={trillion:1e12,billion:1e9,million:1e6,thousand:1e3},b={totalLength:0,characteristic:0,forceAverage:!1,average:!1,mantissa:-1,optionalMantissa:!0,thousandSeparated:!1,spaceSeparated:!1,negative:"sign",forceSign:!1,roundingFunction:Math.round,spaceSeparatedAbbreviation:!1},{binarySuffixes:x,decimalSuffixes:N}=y.currentBytes(),E={scale:1024,suffixes:N,marker:"bd"},k={scale:1024,suffixes:x,marker:"b"},M={scale:1e3,suffixes:N,marker:"d"};function O(e,t,r){let n=t[0],i=Math.abs(e);if(i>=r){for(let s=1;s<t.length;++s){let a=Math.pow(r,s),o=Math.pow(r,s+1);if(i>=a&&i<o){n=t[s],e/=a;break}}n===t[0]&&(e/=Math.pow(r,t.length-1),n=t[t.length-1])}return{value:e,suffix:n}}function S(e){let t="";for(let r=0;r<e;r++)t+="0";return t}function A({instance:e,providedFormat:t,state:r=y,decimalSeparator:n,defaults:i=r.currentDefaults()}){let s=e._value;if(0===s&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(s))return s.toString();let a=Object.assign({},b,i,t),o=a.totalLength,u=o?0:a.characteristic,c=a.optionalCharacteristic,l=a.forceAverage,f=a.lowPrecision,h=!!o||!!l||a.average,d=o?-1:h&&void 0===t.mantissa?0:a.mantissa,p=!o&&(void 0===t.optionalMantissa?-1===d:a.optionalMantissa),m=a.trimMantissa,g=a.thousandSeparated,_=a.spaceSeparated,x=a.negative,N=a.forceSign,E=a.exponential,k=a.roundingFunction,M="";if(h){let e=function({value:e,forceAverage:t,lowPrecision:r=!0,abbreviations:n,spaceSeparated:i=!1,totalLength:s=0,roundingFunction:a=Math.round}){let o="",u=Math.abs(e),c=-1;if(t&&n[t]&&w[t]?(o=n[t],e/=w[t]):u>=w.trillion||r&&1===a(u/w.trillion)?(o=n.trillion,e/=w.trillion):u<w.trillion&&u>=w.billion||r&&1===a(u/w.billion)?(o=n.billion,e/=w.billion):u<w.billion&&u>=w.million||r&&1===a(u/w.million)?(o=n.million,e/=w.million):(u<w.million&&u>=w.thousand||r&&1===a(u/w.thousand))&&(o=n.thousand,e/=w.thousand),o&&(o=(i?" ":"")+o),s){let t=e<0,r=e.toString().split(".")[0];c=Math.max(s-(t?r.length-1:r.length),0)}return{value:e,abbreviation:o,mantissaPrecision:c}}({value:s,forceAverage:l,lowPrecision:f,abbreviations:r.currentAbbreviations(),spaceSeparated:_,roundingFunction:k,totalLength:o});s=e.value,M+=e.abbreviation,o&&(d=e.mantissaPrecision)}if(E){let e=function({value:e,characteristicPrecision:t}){let[r,n]=e.toExponential().split("e"),i=+r;return t&&1<t&&(i*=Math.pow(10,t-1),n=(n=+n-(t-1))>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}}({value:s,characteristicPrecision:u});s=e.value,M=e.abbreviation+M}let O=function(e,t,r,n,i,s){if(-1===n)return e;let a=function(e,t,r=Math.round){return -1!==e.toString().indexOf("e")?function(e,t){let r=e.toString(),[n,i]=r.split("e"),[s,a=""]=n.split(".");if(+i>0)r=s+a+S(i-a.length);else{let e=".";e=0>+s?`-0${e}`:`0${e}`;let n=(S(-i-1)+Math.abs(s)+a).substr(0,t);n.length<t&&(n+=S(t-n.length)),r=e+n}return+i>0&&t>0&&(r+=`.${S(t)}`),r}(e,t):new v(r(+`${e}e+${t}`)/Math.pow(10,t)).toFixed(t)}(t,n,s),[o,u=""]=a.toString().split(".");if(u.match(/^0+$/)&&(r||i))return o;let c=u.match(/0+$/);return i&&c?`${o}.${u.toString().slice(0,c.index)}`:a.toString()}(s.toString(),s,p,d,m,k);if(O=function(e,t,r,n,i){let s=n.currentDelimiters(),a=s.thousands;i=i||s.decimal;let o=s.thousandsSize||3,u=e.toString(),c=u.split(".")[0],l=u.split(".")[1],f=t<0&&0===c.indexOf("-");return r&&(f&&(c=c.slice(1)),(function(e,t){let r=[],n=0;for(let i=e;i>0;i--)n===t&&(r.unshift(i),n=0),n++;return r})(c.length,o).forEach((e,t)=>{c=c.slice(0,e+t)+a+c.slice(e+t)}),f&&(c=`-${c}`)),u=l?c+i+l:c}(O=function(e,t,r,n){let i=e,[s,a]=i.toString().split(".");if(s.match(/^-?0$/)&&r)return a?`${s.replace("0","")}.${a}`:s.replace("0","");let o=t<0&&0===s.indexOf("-");if(o&&(s=s.slice(1),i=i.slice(1)),s.length<n){let e=n-s.length;for(let t=0;t<e;t++)i=`0${i}`}return o&&(i=`-${i}`),i.toString()}(O,s,c,u),s,g,r,n),(h||E)&&(O+=M),N||s<0){var A,T;A=O,O=0===(T=s)?A:0==+A?A.replace("-",""):T>0?`+${A}`:"sign"===x?A:`(${A.replace("-","")})`}return O}function T(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}function C(e,t,r){let n=new v(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new v(i),e._value=n.minus(i).toNumber(),e}let j=m(),I=d(),F=h(),Z=(...e)=>(function(e,t={},r){if("string"==typeof t&&(t=p.parseFormat(t)),!_.validateFormat(t))return"ERROR: invalid format";let n=t.prefix||"",i=t.postfix||"",s=function(e,t,r){var n,i;switch(t.output){case"currency":return function(e,t,r){let n;let i=r.currentCurrency(),s=Object.assign({},t),a=Object.assign({},b,s),o="",u=!!a.totalLength||!!a.forceAverage||a.average,c=s.currencyPosition||i.position,l=s.currencySymbol||i.symbol,f=void 0!==a.spaceSeparatedCurrency?a.spaceSeparatedCurrency:a.spaceSeparated;void 0===s.lowPrecision&&(s.lowPrecision=!1),f&&(o=" "),"infix"===c&&(n=o+l+o);let h=A({instance:e,providedFormat:s,state:r,decimalSeparator:n});return"prefix"===c&&(h=e._value<0&&"sign"===a.negative?`-${o}${l}${h.slice(1)}`:e._value>0&&a.forceSign?`+${o}${l}${h.slice(1)}`:l+o+h),c&&"postfix"!==c||(h=h+(o=!a.spaceSeparatedAbbreviation&&u?"":o)+l),h}(e,t=T(t,y.currentCurrencyDefaultFormat()),y);case"percent":let s,a,o;return s=(n=t=T(t,y.currentPercentageDefaultFormat())).prefixSymbol,a=A({instance:r(100*e._value),providedFormat:n,state:y}),o=Object.assign({},b,n),s?`%${o.spaceSeparated?" ":""}${a}`:`${a}${o.spaceSeparated?" ":""}%`;case"byte":return function(e,t,r,n){let i=t.base||"binary",s=Object.assign({},b,t),{binarySuffixes:a,decimalSuffixes:o}=r.currentBytes(),u={general:{scale:1024,suffixes:o||N,marker:"bd"},binary:{scale:1024,suffixes:a||x,marker:"b"},decimal:{scale:1e3,suffixes:o||N,marker:"d"}}[i],{value:c,suffix:l}=O(e._value,u.suffixes,u.scale),f=A({instance:n(c),providedFormat:t,state:r,defaults:r.currentByteDefaultFormat()});return`${f}${s.spaceSeparated?" ":""}${l}`}(e,t=T(t,y.currentByteDefaultFormat()),y,r);case"time":let u,c,l;return t=T(t,y.currentTimeDefaultFormat()),u=Math.floor(e._value/60/60),c=Math.floor((e._value-3600*u)/60),l=Math.round(e._value-3600*u-60*c),`${u}:${c<10?"0":""}${c}:${l<10?"0":""}${l}`;case"ordinal":let f,h,d,p;return i=t=T(t,y.currentOrdinalDefaultFormat()),f=y.currentOrdinal(),h=Object.assign({},b,i),d=A({instance:e,providedFormat:i,state:y}),p=f(e._value),`${d}${h.spaceSeparated?" ":""}${p}`;default:return A({instance:e,providedFormat:t,numbro:r})}}(e,t,r);return(s=n+s)+i})(...e,K),z=(...e)=>(function(e){return O(e._value,E.suffixes,E.scale).suffix})(...e,K),D=(...e)=>(function(e){return O(e._value,k.suffixes,k.scale).suffix})(...e,K),P=(...e)=>(function(e){return O(e._value,M.suffixes,M.scale).suffix})(...e,K),R=T,$=(e,t)=>{let r,n;return r=new v(e._value),n=t,K.isNumbro(t)&&(n=t._value),n=new v(n),e._value=r.plus(n).toNumber(),e},B=(e,t)=>C(e,t,K),L=(e,t)=>{let r,n;return r=new v(e._value),n=t,K.isNumbro(t)&&(n=t._value),n=new v(n),e._value=r.times(n).toNumber(),e},U=(e,t)=>{let r,n;return r=new v(e._value),n=t,K.isNumbro(t)&&(n=t._value),n=new v(n),e._value=r.dividedBy(n).toNumber(),e},q=(e,t)=>{let r;return r=t,K.isNumbro(t)&&(r=t._value),e._value=r,e},V=(e,t)=>{let r;return C(r=K(e._value),t,K),Math.abs(r._value)},W=v;class J{constructor(e){this._value=e}clone(){return K(this._value)}format(e={}){return Z(this,e)}formatCurrency(e){return"string"==typeof e&&(e=p.parseFormat(e)),(e=R(e,j.currentCurrencyDefaultFormat())).output="currency",Z(this,e)}formatTime(e={}){return e.output="time",Z(this,e)}binaryByteUnits(){return D(this)}decimalByteUnits(){return P(this)}byteUnits(){return z(this)}difference(e){return V(this,e)}add(e){return $(this,e)}subtract(e){return B(this,e)}multiply(e){return L(this,e)}divide(e){return U(this,e)}set(e){return q(this,H(e))}value(){return this._value}valueOf(){return this._value}}function H(e){let t=e;return K.isNumbro(e)?t=e._value:"string"==typeof e?t=K.unformat(e):isNaN(e)&&(t=NaN),t}function K(e){return new J(H(e))}K.version="2.5.0",K.isNumbro=function(e){return e instanceof J},K.language=j.currentLanguage,K.registerLanguage=j.registerLanguage,K.setLanguage=j.setLanguage,K.languages=j.languages,K.languageData=j.languageData,K.zeroFormat=j.setZeroFormat,K.defaultFormat=j.currentDefaults,K.setDefaults=j.setDefaults,K.defaultCurrencyFormat=j.currentCurrencyDefaultFormat,K.validate=I.validate,K.loadLanguagesInNode=e=>(function(e,t){e.forEach(e=>{let r;try{r=function(e){throw Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}r&&t.registerLanguage(r)})})(e,K),K.unformat=F.unformat,K.BigNumber=W;var G=K&&K.__esModule&&Object.prototype.hasOwnProperty.call(K,"default")?K.default:K},8317:function(e){function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var s=0,a=n.length;s<a;s++)n[s].fn!==t&&n[s].fn._!==t&&i.push(n[s]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},27554:function(e){"use strict";var t;t=function(){function e(){return!0}function t(){return!1}function r(){}return function n(){var 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:function(e){return"object"==typeof e&&null!==e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e},a=[],o=[],u={types:i,conversions:o,ignore:a};function c(e){var t=z(u.types,function(t){return t.name===e});if(t)return t;if("any"===e)return s;var r=z(u.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw TypeError('Unknown type "'+e+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function l(e){return e===s?999:u.types.indexOf(e)}function f(e){var t=z(u.types,function(t){return t.test(e)});if(t)return t.name;throw TypeError("Value has unknown type. Value: "+e)}function h(e){return e.map(function(e){var t=e.types.map(y);return(e.restParam?"...":"")+t.join("|")}).join(",")}function d(e){var t=F(e);return!!t&&t.restParam}function p(e){return e.types.some(function(e){return null!=e.conversion})}function m(t){if(!t||0===t.types.length)return e;if(1===t.types.length)return c(t.types[0].name).test;if(2===t.types.length){var r=c(t.types[0].name).test,n=c(t.types[1].name).test;return function(e){return r(e)||n(e)}}var i=t.types.map(function(e){return c(e.name).test});return function(e){for(var t=0;t<i.length;t++)if(i[t](e))return!0;return!1}}function g(e,t){return t<e.params.length?e.params[t]:d(e.params)?F(e.params):null}function v(e,t,r){var n=g(e,t);return(n?r?n.types.filter(_):n.types:[]).map(y)}function y(e){return e.name}function _(e){return null===e.conversion||void 0===e.conversion}function w(e,t){var r=function(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return Object.keys(t)}(D(e,function(e){return v(e,t,!1)}));return -1!==r.indexOf("any")?["any"]:r}function b(e,t,r){var n,i,s,a=e||"unnamed",o=r;for(s=0;s<t.length;s++){var u=o.filter(function(e){var r=m(g(e,s));return(s<e.params.length||d(e.params))&&r(t[s])});if(0===u.length){if((i=w(o,s)).length>0){var c=f(t[s]);return(n=TypeError("Unexpected type of argument in function "+a+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+s+")")).data={category:"wrongType",fn:a,index:s,actual:c,expected:i},n}}else o=u}var l=o.map(function(e){return d(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,l))return(n=TypeError("Too few arguments in function "+a+" (expected: "+(i=w(o,s)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:a,index:t.length,expected:i},n;var h=Math.max.apply(null,l);return t.length>h?(n=TypeError("Too many arguments in function "+a+" (expected: "+h+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:a,index:t.length,expectedLength:h}:(n=TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:t.map(f)},n}function x(e){for(var t=999,r=0;r<e.types.length;r++)_(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function N(e){for(var t=999,r=0;r<e.types.length;r++)_(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function E(e,t){var r,n,i=Math.min(e.params.length,t.params.length);if(0!=(n=e.params.some(p)-t.params.some(p)))return n;for(r=0;r<i;r++)if(0!=(n=p(e.params[r])-p(t.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=function(e,t){var r;return 0!=(r=e.restParam-t.restParam)||0!=(r=p(e)-p(t))||0!=(r=x(e)-x(t))?r:N(e)-N(t)}(e.params[r],t.params[r])))return n;return e.params.length-t.params.length}function k(e){var t,r,n,i,s=[],a=[];switch(e.types.forEach(function(e){e.conversion&&(s.push(c(e.conversion.from).test),a.push(e.conversion.convert))}),a.length){case 0:return function(e){return e};case 1:return t=s[0],n=a[0],function(e){return t(e)?n(e):e};case 2:return t=s[0],r=s[1],n=a[0],i=a[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(var t=0;t<a.length;t++)if(s[t](e))return a[t](e);return e}}}function M(e,t){return function e(r,n,i){if(!(n<r.length))return[i.map(function(e,t){return{types:e,restParam:t===r.length-1&&d(r)}})];var s,a=r[n],o=t?a.types.filter(_):a.types;if(a.restParam){var u=o.filter(_);s=u.length<o.length?[u,o]:[o]}else s=o.map(function(e){return[e]});return D(s,function(t){return e(r,n+1,i.concat([t]))})}(e,0,[])}function O(e,n){if(0===Object.keys(n).length)throw SyntaxError("No signatures provided");var i,s=[];Object.keys(n).map(function(e){var t,r,i;return t=n[e],r=u.conversions,i=[],(""!==e.trim()&&(i=e.split(",").map(T).map(function(e,t,n){var i,s,a,o,u,f,h,d,p=(i=r,s=u=((o=0===e.indexOf("..."))?e.length>3?e.slice(3):"any":e).split("|").map(T).filter(C).filter(A),a={},i.forEach(function(e){-1!==s.indexOf(e.from)||-1===s.indexOf(e.to)||a[e.from]||(a[e.from]=e)}),f=Object.keys(a).map(function(e){return a[e]}),h=u.map(function(e){var t=c(e);return{name:e,typeIndex:l(t),test:t.test,conversion:null,conversionIndex:-1}}),d=f.map(function(e){var t=c(e.from);return{name:e.from,typeIndex:l(t),test:t.test,conversion:e,conversionIndex:r.indexOf(e)}}),{types:h.concat(d),restParam:o});if(p.restParam&&t!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return p})),i.some(I))?null:{params:i,fn:t}}).filter(j).forEach(function(e){var t=z(s,function(t){return function(e,t){for(var r=Math.max(e.params.length,t.params.length),n=0;n<r;n++)if(!function(e,t){for(var r,n=0;n<e.length;n++)if(r=e[n],-1!==t.indexOf(r))return!0;return!1}(v(e,n,!0),v(t,n,!0)))return!1;var i=e.params.length,s=t.params.length,a=d(e.params),o=d(t.params);return a?o?i===s:s>=i:o?i>=s:i===s}(t,e)});if(t)throw TypeError('Conflicting signatures "'+h(t.params)+'" and "'+h(e.params)+'".');s.push(e)});var a=D(s,function(e){return(e?M(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(j);a.sort(E);var o=a[0]&&a[0].params.length<=2&&!d(a[0].params),f=a[1]&&a[1].params.length<=2&&!d(a[1].params),g=a[2]&&a[2].params.length<=2&&!d(a[2].params),y=a[3]&&a[3].params.length<=2&&!d(a[3].params),_=a[4]&&a[4].params.length<=2&&!d(a[4].params),w=a[5]&&a[5].params.length<=2&&!d(a[5].params),b=a.map(function(e){return function(e){var t,r,n;if(d(e)){var i,s=(t=(i=e).slice(0,i.length-1).map(m)).length,a=m(F(e)),o=function(e){for(var t=s;t<e.length;t++)if(!a(e[t]))return!1;return!0};return function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return o(e)&&e.length>=s+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=m(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=m(e[0]),n=m(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(m),function(e){for(var r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(e.params)}),x=o?m(a[0].params[0]):t,N=f?m(a[1].params[0]):t,O=g?m(a[2].params[0]):t,S=y?m(a[3].params[0]):t,P=_?m(a[4].params[0]):t,R=w?m(a[5].params[0]):t,$=o?m(a[0].params[1]):t,B=f?m(a[1].params[1]):t,L=g?m(a[2].params[1]):t,U=y?m(a[3].params[1]):t,q=_?m(a[4].params[1]):t,V=w?m(a[5].params[1]):t,W=a.map(function(e){return function(e,t){var r=t;if(e.some(p)){var n=d(e),i=e.map(k);r=function(){for(var e=[],r=n?arguments.length-1:arguments.length,s=0;s<r;s++)e[s]=i[s](arguments[s]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}var s=r;if(d(e)){var a=e.length-1;s=function(){return r.apply(this,Z(arguments,0,a).concat([Z(arguments,a)]))}}return s}(e.params,e.fn)}),J=o?W[0]:r,H=f?W[1]:r,K=g?W[2]:r,G=y?W[3]:r,Y=_?W[4]:r,X=w?W[5]:r,Q=o?a[0].params.length:-1,ee=f?a[1].params.length:-1,et=g?a[2].params.length:-1,er=y?a[3].params.length:-1,en=_?a[4].params.length:-1,ei=w?a[5].params.length:-1,es=6*!!(o&&f&&g&&y&&_&&w),ea=a.length,eo=function(){for(var t=es;t<ea;t++)if(b[t](arguments))return W[t].apply(this,arguments);return u.onMismatch(e,arguments,a)},eu=function e(t,r){return arguments.length===Q&&x(t)&&$(r)?J.apply(e,arguments):arguments.length===ee&&N(t)&&B(r)?H.apply(e,arguments):arguments.length===et&&O(t)&&L(r)?K.apply(e,arguments):arguments.length===er&&S(t)&&U(r)?G.apply(e,arguments):arguments.length===en&&P(t)&&q(r)?Y.apply(e,arguments):arguments.length===ei&&R(t)&&V(r)?X.apply(e,arguments):eo.apply(e,arguments)};try{Object.defineProperty(eu,"name",{value:e})}catch(e){}return eu.signatures=(i={},a.forEach(function(e){e.params.some(p)||M(e.params,!0).forEach(function(t){i[h(t)]=e.fn})}),i),eu}function S(e,t,r){throw b(e,t,r)}function A(e){return -1===u.ignore.indexOf(e)}function T(e){return e.trim()}function C(e){return!!e}function j(e){return null!==e}function I(e){return 0===e.types.length}function F(e){return e[e.length-1]}function Z(e,t,r){return Array.prototype.slice.call(e,t,r)}function z(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function D(e,t){return Array.prototype.concat.apply([],e.map(t))}function P(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name){if(""===t)t=n.name;else if(t!==n.name){var i=Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}}return t}function R(e){var t,r={};function n(e,n){if(r.hasOwnProperty(e)&&n!==r[e])throw(t=Error('Signature "'+e+'" is defined twice')).data={signature:e},t}for(var i=0;i<e.length;i++){var s=e[i];if("object"==typeof s.signatures)for(var a in s.signatures)s.signatures.hasOwnProperty(a)&&(n(a,s.signatures[a]),r[a]=s.signatures[a]);else if("string"==typeof s.signature)n(s.signature,s),r[s.signature]=s;else throw(t=TypeError("Function is no typed-function (index: "+i+")")).data={index:i},t}return r}return(u=O("typed",{"string, Object":O,Object:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return O(P(t),e)},"...Function":function(e){return O(P(e),R(e))},"string, ...Function":function(e,t){return O(e,R(t))}})).create=n,u.types=i,u.conversions=o,u.ignore=a,u.onMismatch=S,u.throwMismatchError=S,u.createError=b,u.convert=function(e,t){var r=f(e);if(t===r)return e;for(var n=0;n<u.conversions.length;n++){var i=u.conversions[n];if(i.from===r&&i.to===t)return i.convert(e)}throw Error("Cannot convert from "+r+" to "+t)},u.find=function(e,t){if(!e.signatures)throw TypeError("Function is no typed-function");if("string"==typeof t){r=t.split(",");for(var r,n=0;n<r.length;n++)r[n]=r[n].trim()}else if(Array.isArray(t))r=t;else throw TypeError("String array or a comma separated string expected");var i=r.join(","),s=e.signatures[i];if(s)return s;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+r.join(", ")+"))")},u.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw TypeError("Object with properties {name: string, test: function} expected");if(!1!==t){for(var r=0;r<u.types.length;r++)if("Object"===u.types[r].name){u.types.splice(r,0,e);return}}u.types.push(e)},u.addConversion=function(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");u.conversions.push(e)},u}()},"function"==typeof define&&define.amd?define([],t):e.exports=t()},15539:function(e,t,r){"use strict";r.d(t,{U:()=>g});var n=r(70252),i=r(43842),s=r(8317),a=r(30713),o=r(89719),u=r(99926);function c(e,t,r,n){if(!(this instanceof c))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}c.prototype=Error(),c.prototype.constructor=Error,c.prototype.name="ArgumentsError",c.prototype.isArgumentsError=!0;var l={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},f=["Matrix","Array"],h=["number","BigNumber","Fraction"];function d(e,t,r){var n;void 0!==e[t]&&(n=e[t],-1===r.indexOf(n))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(e=>JSON.stringify(e)).join(", ")+".")}var p=r(10281),m=r(53965);function g(e,t){var r,v,y=(0,n.Z)({},l,t);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var _=(r={isNumber:a.hj,isComplex:a.Mc,isBigNumber:a.l9,isFraction:a.yQ,isUnit:a.wr,isString:a.HD,isArray:a.kJ,isMatrix:a.SW,isCollection:a.uZ,isDenseMatrix:a.jH,isSparseMatrix:a.sA,isRange:a.bR,isIndex:a.dh,isBoolean:a.jn,isResultSet:a.cB,isHelp:a.x1,isFunction:a.mf,isDate:a.J_,isRegExp:a.Kj,isObject:a.Kn,isNull:a.Ft,isUndefined:a.o8,isAccessorNode:a.Yz,isArrayNode:a.j0,isAssignmentNode:a.Bp,isBlockNode:a.zh,isConditionalNode:a.tS,isConstantNode:a.nu,isFunctionAssignmentNode:a.l7,isFunctionNode:a.VO,isIndexNode:a.Cl,isNode:a.UG,isObjectNode:a.Lr,isOperatorNode:a.bV,isParenthesisNode:a.Ig,isRangeNode:a.ex,isSymbolNode:a.FG,isChain:a.qg},v=new s,r.on=v.on.bind(v),r.off=v.off.bind(v),r.once=v.once.bind(v),r.emit=v.emit.bind(v),r);_.config=function(e,t){function r(r){if(!r)return(0,i.Xc)(e,i.d9);var n=(0,i.Xc)(e,i.d9);d(r,"matrix",f),d(r,"number",h),(0,i.ZB)(e,r);var s=(0,i.Xc)(e,i.d9);return t("config",s,n,(0,i.Xc)(r,i.d9)),s}return r.MATRIX_OPTIONS=f,r.NUMBER_OPTIONS=h,Object.keys(l).forEach(t=>{Object.defineProperty(r,t,{get:()=>e[t],enumerable:!0,configurable:!0})}),r}(y,_.emit),_.expression={transform:{},mathWithTransform:{config:_.config}};var w={},b=function(e,t,r,n){function s(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,f(e)&&(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],f(e)&&(r.expression.mathWithTransform[e]=t))}function l(e){return"function"==typeof e&&"object"==typeof e.signatures}function f(e){return!(0,i.nr)(d,e)}function h(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction}var d={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(t,p){var m=arguments.length;if(1!==m&&2!==m)throw new c("import",m,1,2);p||(p={});var g={};for(var v in!function e(t,r,n){if(Array.isArray(r))r.forEach(r=>e(t,r));else if("object"==typeof r)for(var s in r)(0,i.nr)(r,s)&&e(t,r[s],s);else if((0,o.gS)(r)||void 0!==n){var a=(0,o.gS)(r)?h(r)?r.fn+".transform":r.fn:n;if((0,i.nr)(t,a)&&t[a]!==r&&!p.silent)throw Error('Cannot import "'+a+'" twice');t[a]=r}else if(!p.silent)throw TypeError("Factory, Object, or Array expected")}(g,t),g)if((0,i.nr)(g,v)){var y,_=g[v];if((0,o.gS)(_))!function(t,s){var a,c,p=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if((0,u.r3)(p,"."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(p));var m=h(t)?r.expression.transform:r,g=p in r.expression.transform,v=(0,i.nr)(m,p)?m[p]:void 0,y=function(){var n={};t.dependencies.map(o.PI).forEach(e=>{if((0,u.r3)(e,"."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]});var i=t(n);if(i&&"function"==typeof i.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===v||s.override)return i;if(l(v)&&l(i))return e(v,i);if(s.silent)return v;throw Error('Cannot import "'+p+'": already exists')};t.meta&&!1===t.meta.lazy?m[p]=y():(0,i.Vo)(m,p,y),v&&g?(a=p,delete r.expression.transform[a],f(a)?r.expression.mathWithTransform[a]=r[a]:delete r.expression.mathWithTransform[a]):!h(t)&&(-1!==(c=t).fn.indexOf(".")||(0,i.nr)(d,c.fn)||c.meta&&c.meta.isClass)||(0,i.Vo)(r.expression.mathWithTransform,p,()=>m[p]),n[p]=t,r.emit("import",p,y)}(_,p);else{if("function"==typeof(y=_)||"number"==typeof y||"string"==typeof y||"boolean"==typeof y||null===y||(0,a.wr)(y)||(0,a.Mc)(y)||(0,a.l9)(y)||(0,a.yQ)(y)||(0,a.SW)(y)||Array.isArray(y))!function(t,i,a){var o;if(a.wrap&&"function"==typeof i&&(i=function(e){var t=function(){for(var t=[],n=0,i=arguments.length;n<i;n++){var s=arguments[n];t[n]=s&&s.valueOf()}return e.apply(r,t)};return e.transform&&(t.transform=e.transform),t}(i)),"function"==typeof(o=i)&&"string"==typeof o.signature&&(i=e(t,{[i.signature]:i})),l(r[t])&&l(i)){i=a.override?e(t,i.signatures):e(r[t],i),r[t]=i,delete n[t],s(t,i),r.emit("import",t,function(){return i});return}if(void 0===r[t]||a.override){r[t]=i,delete n[t],s(t,i),r.emit("import",t,function(){return i});return}if(!a.silent)throw Error('Cannot import "'+t+'": already exists')}(v,_,p);else if(!p.silent)throw TypeError("Factory, Object, or Array expected")}}}}(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _.typed.apply(_.typed,t)},0,_,w);return _.import=b,_.on("config",()=>{(0,i.VO)(w).forEach(e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&b(e,{override:!0})})}),_.create=g.bind(null,e),_.factory=o.d5,_.import((0,i.VO)((0,i.oO)(e))),_.ArgumentsError=c,_.DimensionError=p.m,_.IndexError=m.c,_}},70590:function(e,t,r){"use strict";r.d(t,{e:()=>tM});var n,i,s="0123456789abcdef",a="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",o="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",u={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},c=!0,l="[DecimalError] ",f=l+"Invalid argument: ",h=l+"Precision limit exceeded",d=l+"crypto unavailable",p="[object Decimal]",m=Math.floor,g=Math.pow,v=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,y=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,_=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,w=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,b=a.length-1,x=o.length-1,N={toStringTag:p};function E(e){var t,r,n,i=e.length-1,s="",a=e[0];if(i>0){for(s+=a,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(s+=Z(r)),s+=n;(r=7-(n=(a=e[t])+"").length)&&(s+=Z(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return s+a}function k(e,t,r){if(e!==~~e||e<t||e>r)throw Error(f+e)}function M(e,t,r,n){var i,s,a,o;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),s=g(10,7-t),o=e[i]%s|0,null==n?t<3?(0==t?o=o/100|0:1==t&&(o=o/10|0),a=r<4&&99999==o||r>3&&49999==o||5e4==o||0==o):a=(r<4&&o+1==s||r>3&&o+1==s/2)&&(e[i+1]/s/100|0)==g(10,t-2)-1||(o==s/2||0==o)&&(e[i+1]/s/100|0)==0:t<4?(0==t?o=o/1e3|0:1==t?o=o/100|0:2==t&&(o=o/10|0),a=(n||r<4)&&9999==o||!n&&r>3&&4999==o):a=((n||r<4)&&o+1==s||!n&&r>3&&o+1==s/2)&&(e[i+1]/s/1e3|0)==g(10,t-3)-1,a}function O(e,t,r){for(var n,i,a=[0],o=0,u=e.length;o<u;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=s.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}N.absoluteValue=N.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),A(e)},N.ceil=function(){return A(new this.constructor(this),this.e+1,2)},N.clampedTo=N.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(f+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},N.comparedTo=N.cmp=function(e){var t,r,n,i,s=this.d,a=(e=new this.constructor(e)).d,o=this.s,u=e.s;if(!s||!a)return o&&u?o!==u?o:s===a?0:!s^o<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?o:a[0]?-u:0;if(o!==u)return o;if(this.e!==e.e)return this.e>e.e^o<0?1:-1;for(t=0,r=(n=s.length)<(i=a.length)?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^o<0?1:-1;return n===i?0:n>i^o<0?1:-1},N.cosine=N.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/q(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=U(e,1,t.times(i),new e(1));for(var s=r;s--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=r,t}(n,V(n,r)),n.precision=e,n.rounding=t,A(2==i||3==i?r.neg():r,e,t,!0)):new n(1):new n(NaN)},N.cubeRoot=N.cbrt=function(){var e,t,r,n,i,s,a,o,u,l,f=this.constructor;if(!this.isFinite()||this.isZero())return new f(this);for(c=!1,(s=this.s*g(this.s*this,1/3))&&Math.abs(s)!=1/0?n=new f(s.toString()):(r=E(this.d),(s=((e=this.e)-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=g(r,1/3),e=m((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(r=s==1/0?"5e"+e:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),a=(e=f.precision)+3;;)if(n=S((l=(u=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),l.plus(u),a+2,1),E(o.d).slice(0,a)===(r=E(n.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(A(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(A(o,e+1,0),o.times(o).times(o).eq(this))){n=o;break}a+=4,i=1}return c=!0,A(n,e,f.rounding,t)},N.decimalPlaces=N.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-m(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},N.dividedBy=N.div=function(e){return S(this,new this.constructor(e))},N.dividedToIntegerBy=N.divToInt=function(e){var t=this.constructor;return A(S(this,new t(e),0,1,1),t.precision,t.rounding)},N.equals=N.eq=function(e){return 0===this.cmp(e)},N.floor=function(){return A(new this.constructor(this),this.e+1,3)},N.greaterThan=N.gt=function(e){return this.cmp(e)>0},N.greaterThanOrEqualTo=N.gte=function(e){var t=this.cmp(e);return 1==t||0===t},N.hyperbolicCosine=N.cosh=function(){var e,t,r,n,i,s=this,a=s.constructor,o=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return o;r=a.precision,n=a.rounding,a.precision=r+Math.max(s.e,s.sd())+4,a.rounding=1,(i=s.d.length)<32?t=(1/q(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),s=U(a,1,s.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=s.times(s),s=o.minus(u.times(l.minus(u.times(l))));return A(s,a.precision=r,a.rounding=n,!0)},N.hyperbolicSine=N.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,(n=i.d.length)<3)i=U(s,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=U(s,2,i=i.times(1/q(5,e)),i,!0);for(var a,o=new s(5),u=new s(16),c=new s(20);e--;)a=i.times(i),i=i.times(o.plus(a.times(u.times(a).plus(c))))}return s.precision=t,s.rounding=r,A(i,t,r,!0)},N.hyperbolicTangent=N.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,S(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},N.inverseCosine=N.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()?I(t,n,i):new t(0):new t(NaN):e.isZero()?I(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))},N.inverseHyperbolicCosine=N.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,c=!1,r=r.times(r).minus(1).sqrt().plus(r),c=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},N.inverseHyperbolicSine=N.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,c=!1,r=r.times(r).plus(1).sqrt().plus(r),c=!0,n.precision=e,n.rounding=t,r.ln())},N.inverseHyperbolicTangent=N.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?A(new s(i),e,t,!0):(s.precision=r=n-i.e,i=S(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5)):new s(NaN)},N.inverseSine=N.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,-1!==t)?0===t?((e=I(s,r+4,n).times(.5)).s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2))},N.inverseTangent=N.atan=function(){var e,t,r,n,i,s,a,o,u,l=this,f=l.constructor,h=f.precision,d=f.rounding;if(l.isFinite()){if(l.isZero())return new f(l);if(l.abs().eq(1)&&h+4<=x)return(a=I(f,h+4,d).times(.25)).s=l.s,a}else{if(!l.s)return new f(NaN);if(h+4<=x)return(a=I(f,h+4,d).times(.5)).s=l.s,a}for(f.precision=o=h+10,f.rounding=1,e=r=Math.min(28,o/7+2|0);e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(c=!1,t=Math.ceil(o/7),n=1,u=l.times(l),a=new f(l),i=l;-1!==e;)if(i=i.times(u),s=a.minus(i.div(n+=2)),i=i.times(u),void 0!==(a=s.plus(i.div(n+=2))).d[t])for(e=t;a.d[e]===s.d[e]&&e--;);return r&&(a=a.times(2<<r-1)),c=!0,A(a,f.precision=h,f.rounding=d,!0)},N.isFinite=function(){return!!this.d},N.isInteger=N.isInt=function(){return!!this.d&&m(this.e/7)>this.d.length-2},N.isNaN=function(){return!this.s},N.isNegative=N.isNeg=function(){return this.s<0},N.isPositive=N.isPos=function(){return this.s>0},N.isZero=function(){return!!this.d&&0===this.d[0]},N.lessThan=N.lt=function(e){return 0>this.cmp(e)},N.lessThanOrEqualTo=N.lte=function(e){return 1>this.cmp(e)},N.logarithm=N.log=function(e){var t,r,n,i,s,a,o,u,l=this.constructor,f=l.precision,h=l.rounding;if(null==e)e=new l(10),t=!0;else{if(r=(e=new l(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new l(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t){if(r.length>1)s=!0;else{for(i=r[0];i%10==0;)i/=10;s=1!==i}}if(c=!1,M((u=S(a=$(this,o=f+5),t?j(l,o+10):$(e,o),o,1)).d,i=f,h))do if(o+=10,u=S(a=$(this,o),t?j(l,o+10):$(e,o),o,1),!s){+E(u.d).slice(i+1,i+15)+1==1e14&&(u=A(u,f+1,0));break}while(M(u.d,i+=10,h));return c=!0,A(u,f,h)},N.minus=N.sub=function(e){var t,r,n,i,s,a,o,u,l,f,h,d,p=this.constructor;if(e=new p(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new p(e.d||this.s!==e.s?this:NaN):e=new p(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(l=this.d,d=e.d,o=p.precision,u=p.rounding,!l[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!l[0])return new p(3===u?-0:0);e=new p(this)}return c?A(e,o,u):e}if(r=m(e.e/7),f=m(this.e/7),l=l.slice(),s=f-r){for((h=s<0)?(t=l,s=-s,a=d.length):(t=d,r=f,a=l.length),s>(n=Math.max(Math.ceil(o/7),a)+2)&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for((h=(n=l.length)<(a=d.length))&&(a=n),n=0;n<a;n++)if(l[n]!=d[n]){h=l[n]<d[n];break}s=0}for(h&&(t=l,l=d,d=t,e.s=-e.s),a=l.length,n=d.length-a;n>0;--n)l[a++]=0;for(n=d.length;n>s;){if(l[--n]<d[n]){for(i=n;i&&0===l[--i];)l[i]=1e7-1;--l[i],l[n]+=1e7}l[n]-=d[n]}for(;0===l[--a];)l.pop();for(;0===l[0];l.shift())--r;return l[0]?(e.d=l,e.e=C(l,r),c?A(e,o,u):e):new p(3===u?-0:0)},N.modulo=N.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])?(c=!1,9==r.modulo?(t=S(this,e.abs(),0,3,1),t.s*=e.s):t=S(this,e,0,r.modulo,1),t=t.times(e),c=!0,this.minus(t)):A(new r(this),r.precision,r.rounding):new r(NaN)},N.naturalExponential=N.exp=function(){return R(this)},N.naturalLogarithm=N.ln=function(){return $(this)},N.negated=N.neg=function(){var e=new this.constructor(this);return e.s=-e.s,A(e)},N.plus=N.add=function(e){var t,r,n,i,s,a,o,u,l,f,h=this.constructor;if(e=new h(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new h(e.d||this.s===e.s?this:NaN)):e=new h(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(l=this.d,f=e.d,o=h.precision,u=h.rounding,!l[0]||!f[0])return f[0]||(e=new h(this)),c?A(e,o,u):e;if(s=m(this.e/7),n=m(e.e/7),l=l.slice(),i=s-n){for(i<0?(r=l,i=-i,a=f.length):(r=f,n=s,a=l.length),i>(a=(s=Math.ceil(o/7))>a?s+1:a+1)&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=l.length)-(i=f.length)<0&&(i=a,r=f,f=l,l=r),t=0;i;)t=(l[--i]=l[i]+f[i]+t)/1e7|0,l[i]%=1e7;for(t&&(l.unshift(t),++n),a=l.length;0==l[--a];)l.pop();return e.d=l,e.e=C(l,n),c?A(e,o,u):e},N.precision=N.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(f+e);return this.d?(t=F(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},N.round=function(){var e=this.constructor;return A(new e(this),this.e+1,e.rounding)},N.sine=N.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:U(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=U(e,2,t=t.times(1/q(5,r)),t);for(var i,s=new e(5),a=new e(16),o=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(a.times(i).minus(o))));return t}(n,V(n,r)),n.precision=e,n.rounding=t,A(i>2?r.neg():r,e,t,!0)):new n(NaN)},N.squareRoot=N.sqrt=function(){var e,t,r,n,i,s,a=this.d,o=this.e,u=this.s,l=this.constructor;if(1!==u||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?this:1/0);for(c=!1,0==(u=Math.sqrt(+this))||u==1/0?(((t=E(a)).length+o)%2==0&&(t+="0"),u=Math.sqrt(t),o=m((o+1)/2)-(o<0||o%2),n=new l(t=u==1/0?"5e"+o:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+o)):n=new l(u.toString()),r=(o=l.precision)+3;;)if(n=(s=n).plus(S(this,s,r+2,1)).times(.5),E(s.d).slice(0,r)===(t=E(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))||(A(n,o+1,1),e=!n.times(n).eq(this));break}if(!i&&(A(s,o+1,0),s.times(s).eq(this))){n=s;break}r+=4,i=1}return c=!0,A(n,o,l.rounding,e)},N.tangent=N.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=S(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,A(2==i||4==i?r.neg():r,e,t,!0)):new n(NaN)},N.times=N.mul=function(e){var t,r,n,i,s,a,o,u,l,f=this.constructor,h=this.d,d=(e=new f(e)).d;if(e.s*=this.s,!h||!h[0]||!d||!d[0])return new f(e.s&&(!h||h[0]||d)&&(!d||d[0]||h)?h&&d?0*e.s:e.s/0:NaN);for(r=m(this.e/7)+m(e.e/7),(u=h.length)<(l=d.length)&&(s=h,h=d,d=s,a=u,u=l,l=a),s=[],n=a=u+l;n--;)s.push(0);for(n=l;--n>=0;){for(t=0,i=u+n;i>n;)o=s[i]+d[n]*h[i-n-1]+t,s[i--]=o%1e7|0,t=o/1e7|0;s[i]=(s[i]+t)%1e7|0}for(;!s[--a];)s.pop();return t?++r:s.shift(),e.d=s,e.e=C(s,r),c?A(e,f.precision,f.rounding):e},N.toBinary=function(e,t){return W(this,2,e,t)},N.toDecimalPlaces=N.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(k(e,0,1e9),void 0===t?t=n.rounding:k(t,0,8),A(r,e+r.e+1,t))},N.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=T(n,!0):(k(e,0,1e9),void 0===t?t=i.rounding:k(t,0,8),r=T(n=A(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},N.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=T(this):(k(e,0,1e9),void 0===t?t=i.rounding:k(t,0,8),r=T(n=A(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},N.toFraction=function(e){var t,r,n,i,s,a,o,u,l,h,d,p,m=this.d,v=this.constructor;if(!m)return new v(this);if(l=r=new v(1),n=u=new v(0),a=(s=(t=new v(n)).e=F(m)-this.e-1)%7,t.d[0]=g(10,a<0?7+a:a),null==e)e=s>0?t:l;else{if(!(o=new v(e)).isInt()||o.lt(l))throw Error(f+o);e=o.gt(t)?s>0?t:l:o}for(c=!1,o=new v(E(m)),h=v.precision,v.precision=s=14*m.length;d=S(o,t,0,1,1),1!=(i=r.plus(d.times(n))).cmp(e);)r=n,n=i,i=l,l=u.plus(d.times(i)),u=i,i=t,t=o.minus(d.times(i)),o=i;return i=S(e.minus(r),n,0,1,1),u=u.plus(i.times(l)),r=r.plus(i.times(n)),u.s=l.s=this.s,p=1>S(l,n,s,1).minus(this).abs().cmp(S(u,r,s,1).minus(this).abs())?[l,n]:[u,r],v.precision=h,c=!0,p},N.toHexadecimal=N.toHex=function(e,t){return W(this,16,e,t)},N.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:k(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]?(c=!1,r=S(r,e,0,t,1).times(e),c=!0,A(r)):(e.s=r.s,r=e),r},N.toNumber=function(){return+this},N.toOctal=function(e,t){return W(this,8,e,t)},N.toPower=N.pow=function(e){var t,r,n,i,s,a,o=this,u=o.constructor,l=+(e=new u(e));if(!o.d||!e.d||!o.d[0]||!e.d[0])return new u(g(+o,l));if((o=new u(o)).eq(1))return o;if(n=u.precision,s=u.rounding,e.eq(1))return A(o,n,s);if((t=m(e.e/7))>=e.d.length-1&&(r=l<0?-l:l)<=0x1fffffffffffff)return i=z(u,o,r,n),e.s<0?new u(1).div(i):A(i,n,s);if((a=o.s)<0){if(t<e.d.length-1)return new u(NaN);if((1&e.d[t])==0&&(a=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=a,o}return(t=0!=(r=g(+o,l))&&isFinite(r)?new u(r+"").e:m(l*(Math.log("0."+E(o.d))/Math.LN10+o.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?a/0:0):(c=!1,u.rounding=o.s=1,r=Math.min(12,(t+"").length),(i=R(e.times($(o,n+r)),n)).d&&M((i=A(i,n+5,1)).d,n,s)&&(t=n+10,+E((i=A(R(e.times($(o,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=A(i,n+1,0))),i.s=a,c=!0,u.rounding=s,A(i,n,s))},N.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=T(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(k(e,1,1e9),void 0===t?t=i.rounding:k(t,0,8),r=T(n=A(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},N.toSignificantDigits=N.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(k(e,1,1e9),void 0===t?t=r.rounding:k(t,0,8)),A(new r(this),e,t)},N.toString=function(){var e=this.constructor,t=T(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},N.truncated=N.trunc=function(){return A(new this.constructor(this),this.e+1,1)},N.valueOf=N.toJSON=function(){var e=this.constructor,t=T(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var S=function(){function e(e,t,r){var n,i=0,s=e.length;for(e=e.slice();s--;)n=e[s]*t+i,e[s]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}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(i,s,a,o,u,c){var l,f,h,d,p,g,v,y,_,w,b,x,N,E,k,M,O,S,T,C,j=i.constructor,I=i.s==s.s?1:-1,F=i.d,Z=s.d;if(!F||!F[0]||!Z||!Z[0])return new j(i.s&&s.s&&(F?!Z||F[0]!=Z[0]:Z)?F&&0==F[0]||!Z?0*I:I/0:NaN);for(c?(p=1,f=i.e-s.e):(c=1e7,p=7,f=m(i.e/p)-m(s.e/p)),T=Z.length,O=F.length,w=(_=new j(I)).d=[],h=0;Z[h]==(F[h]||0);h++);if(Z[h]>(F[h]||0)&&f--,null==a?(E=a=j.precision,o=j.rounding):E=u?a+(i.e-s.e)+1:a,E<0)w.push(1),g=!0;else{if(E=E/p+2|0,h=0,1==T){for(d=0,Z=Z[0],E++;(h<O||d)&&E--;h++)k=d*c+(F[h]||0),w[h]=k/Z|0,d=k%Z|0;g=d||h<O}else{for((d=c/(Z[0]+1)|0)>1&&(Z=e(Z,d,c),F=e(F,d,c),T=Z.length,O=F.length),M=T,x=(b=F.slice(0,T)).length;x<T;)b[x++]=0;(C=Z.slice()).unshift(0),S=Z[0],Z[1]>=c/2&&++S;do d=0,(l=t(Z,b,T,x))<0?(N=b[0],T!=x&&(N=N*c+(b[1]||0)),(d=N/S|0)>1?(d>=c&&(d=c-1),y=(v=e(Z,d,c)).length,x=b.length,1==(l=t(v,b,y,x))&&(d--,r(v,T<y?C:Z,y,c))):(0==d&&(l=d=1),v=Z.slice()),(y=v.length)<x&&v.unshift(0),r(b,v,x,c),-1==l&&(x=b.length,(l=t(Z,b,T,x))<1&&(d++,r(b,T<x?C:Z,x,c))),x=b.length):0===l&&(d++,b=[0]),w[h++]=d,l&&b[0]?b[x++]=F[M]||0:(b=[F[M]],x=1);while((M++<O||void 0!==b[0])&&E--);g=void 0!==b[0]}w[0]||w.shift()}if(1==p)_.e=f,n=g;else{for(h=1,d=w[0];d>=10;d/=10)h++;_.e=h+f*p-1,A(_,u?a+_.e+1:a,o,g)}return _}}();function A(e,t,r,n){var i,s,a,o,u,l,f,h,d,p=e.constructor;e:if(null!=t){if(!(h=e.d))return e;for(i=1,o=h[0];o>=10;o/=10)i++;if((s=t-i)<0)s+=7,a=t,u=(f=h[d=0])/g(10,i-a-1)%10|0;else if((d=Math.ceil((s+1)/7))>=(o=h.length)){if(n){for(;o++<=d;)h.push(0);f=u=0,i=1,s%=7,a=s-7+1}else break e}else{for(i=1,f=o=h[d];o>=10;o/=10)i++;s%=7,u=(a=s-7+i)<0?0:f/g(10,i-a-1)%10|0}if(n=n||t<0||void 0!==h[d+1]||(a<0?f:f%g(10,i-a-1)),l=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(s>0?a>0?f/g(10,i-a):0:h[d-1])%10&1||r==(e.s<0?8:7)),t<1||!h[0])return h.length=0,l?(t-=e.e+1,h[0]=g(10,(7-t%7)%7),e.e=-t||0):h[0]=e.e=0,e;if(0==s?(h.length=d,o=1,d--):(h.length=d+1,o=g(10,7-s),h[d]=a>0?(f/g(10,i-a)%g(10,a)|0)*o:0),l)for(;;){if(0==d){for(s=1,a=h[0];a>=10;a/=10)s++;for(a=h[0]+=o,o=1;a>=10;a/=10)o++;s!=o&&(e.e++,1e7==h[0]&&(h[0]=1));break}if(h[d]+=o,1e7!=h[d])break;h[d--]=0,o=1}for(s=h.length;0===h[--s];)h.pop()}return c&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function T(e,t,r){if(!e.isFinite())return B(e);var n,i=e.e,s=E(e.d),a=s.length;return t?(r&&(n=r-a)>0?s=s.charAt(0)+"."+s.slice(1)+Z(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Z(-i-1)+s,r&&(n=r-a)>0&&(s+=Z(n))):i>=a?(s+=Z(i+1-a),r&&(n=r-i-1)>0&&(s=s+"."+Z(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(s+="."),s+=Z(n))),s}function C(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function j(e,t,r){if(t>b)throw c=!0,r&&(e.precision=r),Error(h);return A(new e(a),t,1,!0)}function I(e,t,r){if(t>x)throw Error(h);return A(new e(o),t,r,!0)}function F(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 Z(e){for(var t="";e--;)t+="0";return t}function z(e,t,r,n){var i,s=new e(1),a=Math.ceil(n/7+4);for(c=!1;;){if(r%2&&J((s=s.times(t)).d,a)&&(i=!0),0===(r=m(r/2))){r=s.d.length-1,i&&0===s.d[r]&&++s.d[r];break}J((t=t.times(t)).d,a)}return c=!0,s}function D(e){return 1&e.d[e.d.length-1]}function P(e,t,r){for(var n,i,s=new e(t[0]),a=0;++a<t.length;){if(!(i=new e(t[a])).s){s=i;break}((n=s.cmp(i))===r||0===n&&s.s===r)&&(s=i)}return s}function R(e,t){var r,n,i,s,a,o,u,l=0,f=0,h=0,d=e.constructor,p=d.rounding,m=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(null==t?(c=!1,u=m):u=t,o=new d(.03125);e.e>-2;)e=e.times(o),h+=5;for(u+=n=Math.log(g(2,h))/Math.LN10*2+5|0,r=s=a=new d(1),d.precision=u;;){if(s=A(s.times(e),u,1),r=r.times(++f),E((o=a.plus(S(s,r,u,1))).d).slice(0,u)===E(a.d).slice(0,u)){for(i=h;i--;)a=A(a.times(a),u,1);if(null!=t)return d.precision=m,a;if(!(l<3&&M(a.d,u-n,p,l)))return A(a,d.precision=m,p,c=!0);d.precision=u+=10,r=s=o=new d(1),f=0,l++}a=o}}function $(e,t){var r,n,i,s,a,o,u,l,f,h,d,p=1,m=e,g=m.d,v=m.constructor,y=v.rounding,_=v.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new v(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(null==t?(c=!1,f=_):f=t,v.precision=f+=10,n=(r=E(g)).charAt(0),!(15e14>Math.abs(s=m.e)))return l=j(v,f+2,_).times(s+""),m=$(new v(n+"."+r.slice(1)),f-10).plus(l),v.precision=_,null==t?A(m,_,y,c=!0):m;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=E((m=m.times(e)).d)).charAt(0),p++;for(s=m.e,n>1?(m=new v("0."+r),s++):m=new v(n+"."+r.slice(1)),h=m,u=a=m=S(m.minus(1),m.plus(1),f,1),d=A(m.times(m),f,1),i=3;;){if(a=A(a.times(d),f,1),E((l=u.plus(S(a,new v(i),f,1))).d).slice(0,f)===E(u.d).slice(0,f)){if(u=u.times(2),0!==s&&(u=u.plus(j(v,f+2,_).times(s+""))),u=S(u,new v(p),f,1),null!=t)return v.precision=_,u;if(!M(u.d,f-10,y,o))return A(u,v.precision=_,y,c=!0);v.precision=f+=10,l=a=m=S(h.minus(1),h.plus(1),f,1),d=A(m.times(m),f,1),i=o=1}u=l,i+=2}}function B(e){return String(e.s*e.s/0)}function L(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),c&&(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 U(e,t,r,n,i){var s,a,o,u,l=e.precision,f=Math.ceil(l/7);for(c=!1,u=r.times(r),o=new e(n);;){if(a=S(o.times(u),new e(t++*t++),l,1),o=i?n.plus(a):n.minus(a),n=S(a.times(u),new e(t++*t++),l,1),void 0!==(a=o.plus(n)).d[f]){for(s=f;a.d[s]===o.d[s]&&s--;);if(-1==s)break}s=o,o=n,n=a,a=s}return c=!0,a.d.length=f+1,a}function q(e,t){for(var r=e;--t;)r*=e;return r}function V(e,t){var r,n=t.s<0,s=I(e,e.precision,1),a=s.times(.5);if((t=t.abs()).lte(a))return i=n?4:1,t;if((r=t.divToInt(s)).isZero())i=n?3:2;else{if((t=t.minus(r.times(s))).lte(a))return i=D(r)?n?2:3:n?4:1,t;i=D(r)?n?1:4:n?3:2}return t.minus(s).abs()}function W(e,t,r,i){var a,o,u,c,l,f,h,d,p,m=e.constructor,g=void 0!==r;if(g?(k(r,1,1e9),void 0===i?i=m.rounding:k(i,0,8)):(r=m.precision,i=m.rounding),e.isFinite()){for(u=(h=T(e)).indexOf("."),g?(a=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):a=t,u>=0&&(h=h.replace(".",""),(p=new m(1)).e=h.length-u,p.d=O(T(p),10,a),p.e=p.d.length),o=l=(d=O(h,10,a)).length;0==d[--l];)d.pop();if(d[0]){if(u<0?o--:((e=new m(e)).d=d,e.e=o,d=(e=S(e,p,r,i,0,a)).d,o=e.e,f=n),u=d[r],c=a/2,f=f||void 0!==d[r+1],f=i<4?(void 0!==u||f)&&(0===i||i===(e.s<0?3:2)):u>c||u===c&&(4===i||f||6===i&&1&d[r-1]||i===(e.s<0?8:7)),d.length=r,f)for(;++d[--r]>a-1;)d[r]=0,r||(++o,d.unshift(1));for(l=d.length;!d[l-1];--l);for(u=0,h="";u<l;u++)h+=s.charAt(d[u]);if(g){if(l>1){if(16==t||8==t){for(u=16==t?4:3,--l;l%u;l++)h+="0";for(l=(d=O(h,a,t)).length;!d[l-1];--l);for(u=1,h="1.";u<l;u++)h+=s.charAt(d[u])}else h=h.charAt(0)+"."+h.slice(1)}h=h+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)h="0"+h;h="0."+h}else if(++o>l)for(o-=l;o--;)h+="0";else o<l&&(h=h.slice(0,o)+"."+h.slice(o))}else h=g?"0p+0":"0";h=(16==t?"0x":2==t?"0b":8==t?"0o":"")+h}else h=B(e);return e.s<0?"-"+h:h}function J(e,t){if(e.length>t)return e.length=t,!0}function H(e){return new this(e).abs()}function K(e){return new this(e).acos()}function G(e){return new this(e).acosh()}function Y(e,t){return new this(e).plus(t)}function X(e){return new this(e).asin()}function Q(e){return new this(e).asinh()}function ee(e){return new this(e).atan()}function et(e){return new this(e).atanh()}function er(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?I(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=I(this,s,1).times(.5)).s=e.s:t.s<0?(this.precision=s,this.rounding=1,r=this.atan(S(e,t,s,1)),t=I(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(S(e,t,s,1)):(r=I(this,s,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function en(e){return new this(e).cbrt()}function ei(e){return A(e=new this(e),e.e+1,2)}function es(e,t,r){return new this(e).clamp(t,r)}function ea(e){if(!e||"object"!=typeof e)throw Error(l+"Object expected");var t,r,n,i=!0===e.defaults,s=["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<s.length;t+=3)if(r=s[t],i&&(this[r]=u[r]),void 0!==(n=e[r])){if(m(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(f+r+": "+n)}if(r="crypto",i&&(this[r]=u[r]),void 0!==(n=e[r])){if(!0===n||!1===n||0===n||1===n){if(n){if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(d)}else this[r]=!1}else throw Error(f+r+": "+n)}return this}function eo(e){return new this(e).cos()}function eu(e){return new this(e).cosh()}function ec(e,t){return new this(e).div(t)}function el(e){return new this(e).exp()}function ef(e){return A(e=new this(e),e.e+1,3)}function eh(){var e,t,r=new this(0);for(e=0,c=!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 c=!0,new this(1/0);r=t}return c=!0,r.sqrt()}function ed(e){return e instanceof eF||e&&e.toStringTag===p||!1}function ep(e){return new this(e).ln()}function em(e,t){return new this(e).log(t)}function eg(e){return new this(e).log(2)}function ev(e){return new this(e).log(10)}function ey(){return P(this,arguments,-1)}function e_(){return P(this,arguments,1)}function ew(e,t){return new this(e).mod(t)}function eb(e,t){return new this(e).mul(t)}function ex(e,t){return new this(e).pow(t)}function eN(e){var t,r,n,i,s=0,a=new this(1),o=[];if(void 0===e?e=this.precision:k(e,1,1e9),n=Math.ceil(e/7),this.crypto){if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)(i=t[s])>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:o[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)(i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((127&t[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,s):(o.push(i%1e7),s+=4);s=n/4}else throw Error(d)}else for(;s<n;)o[s++]=1e7*Math.random()|0;for(n=o[--s],e%=7,n&&e&&(i=g(10,7-e),o[s]=(n/i|0)*i);0===o[s];s--)o.pop();if(s<0)r=0,o=[0];else{for(r=-1;0===o[0];r-=7)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return a.e=r,a.d=o,a}function eE(e){return A(e=new this(e),e.e+1,this.rounding)}function ek(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function eM(e){return new this(e).sin()}function eO(e){return new this(e).sinh()}function eS(e){return new this(e).sqrt()}function eA(e,t){return new this(e).sub(t)}function eT(){var e=0,t=arguments,r=new this(t[0]);for(c=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return c=!0,A(r,this.precision,this.rounding)}function eC(e){return new this(e).tan()}function ej(e){return new this(e).tanh()}function eI(e){return A(e=new this(e),e.e+1,1)}N[Symbol.for("nodejs.util.inspect.custom")]=N.toString,N[Symbol.toStringTag]="Decimal";var eF=N.constructor=function e(t){var r,n,i;function s(e){var t,r,n;if(!(this instanceof s))return new s(e);if(this.constructor=s,ed(e)){this.s=e.s,c?!e.d||e.e>s.maxE?(this.e=NaN,this.d=null):e.e<s.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++;c?t>s.maxE?(this.e=NaN,this.d=null):t<s.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 L(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),w.test(e)?L(this,e):function(e,t){var r,n,i,s,a,o,u,l,h;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),w.test(t))return L(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(y.test(t))r=16,t=t.toLowerCase();else if(v.test(t))r=2;else if(_.test(t))r=8;else throw Error(f+t);for((s=t.search(/p/i))>0?(u=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),a=(s=t.indexOf("."))>=0,n=e.constructor,a&&(s=(o=(t=t.replace(".","")).length)-s,i=z(n,new n(r),s,2*s)),s=h=(l=O(t,r,1e7)).length-1;0===l[s];--s)l.pop();return s<0?new n(0*e.s):(e.e=C(l,h),e.d=l,c=!1,a&&(e=S(e,i,4*o)),u&&(e=e.times(54>Math.abs(u)?g(2,u):eF.pow(2,u))),c=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,L(this,e.toString());throw Error(f+e)}if(s.prototype=N,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=ea,s.clone=e,s.isDecimal=ed,s.abs=H,s.acos=K,s.acosh=G,s.add=Y,s.asin=X,s.asinh=Q,s.atan=ee,s.atanh=et,s.atan2=er,s.cbrt=en,s.ceil=ei,s.clamp=es,s.cos=eo,s.cosh=eu,s.div=ec,s.exp=el,s.floor=ef,s.hypot=eh,s.ln=ep,s.log=em,s.log10=ev,s.log2=eg,s.max=ey,s.min=e_,s.mod=ew,s.mul=eb,s.pow=ex,s.random=eN,s.round=eE,s.sign=ek,s.sin=eM,s.sinh=eO,s.sqrt=eS,s.sub=eA,s.sum=eT,s.tan=eC,s.tanh=ej,s.trunc=eI,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 s.config(t),s}(u);a=new eF(a),o=new eF(o);var eZ=r(89719),ez={createBigNumberClass:(0,eZ.d5)("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=eF.clone({precision:r.precision,modulo:eF.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})},eD={createMatrixClass:(0,eZ.d5)("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})},eP=r(30713),eR=r(99926),e$=r(58676),eB=r(73984),eL=r(43842),eU=r(10281),eq={MatrixDependencies:eD,createDenseMatrixClass:(0,eZ.d5)("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&&!(0,eP.HD)(t))throw Error("Invalid datatype: "+t);if((0,eP.SW)(e))"DenseMatrix"===e.type?(this._data=(0,eL.d9)(e._data),this._size=(0,eL.d9)(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&(0,eP.kJ)(e.data)&&(0,eP.kJ)(e.size))this._data=e.data,this._size=e.size,(0,eR.Gu)(this._data,this._size),this._datatype=t||e.datatype;else if((0,eP.kJ)(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];(0,eP.kJ)(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=(0,eR.aJ)(this._data),(0,eR.Gu)(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+(0,eP.kM)(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;(0,eP.kJ)(n);)n=n[0];return n}return e._size=t.slice(0),e._data=(0,eR.SI)(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),s=!1;i.length<t.length;)i.push(0),s=!0;for(var a=0,o=t.length;a<o;a++)t[a]>i[a]&&(i[a]=t[a],s=!0);s&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return(0,eR.$q)(this._data,eP.kM)},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(!(0,eP.dh)(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 eU.m(n.length,e._size.length);for(var i=t.min(),s=t.max(),a=0,o=e._size.length;a<o;a++)(0,eR.Ls)(i[a],e._size[a]),(0,eR.Ls)(s[a],e._size[a]);return new r(function e(t,r,n,i){var s=i===n-1,a=r.dimension(i);return s?a.map(function(e){return(0,eR.Ls)(e,t.length),t[e]}).valueOf():a.map(function(s){return(0,eR.Ls)(s,t.length),e(t[s],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 s,a=t.size(),o=t.isScalar();if((0,eP.SW)(r)?(s=r.size(),r=r.valueOf()):s=(0,eR.aJ)(r),o){if(0!==s.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(a.length<e._size.length)throw new eU.m(a.length,e._size.length,"<");if(s.length<a.length){for(var u=0,c=0;1===a[u]&&1===s[u];)u++;for(;1===a[u];)c++,u++;r=(0,eR.f4)(r,a.length,c,s)}if(!(0,eL.J5)(a,s))throw new eU.m(a,s,">");i(e,t.max().map(function(e){return e+1}),n);var l=a.length;(function e(t,r,n,i,s){var a=s===i-1,o=r.dimension(s);a?o.forEach(function(e,r){(0,eR.Ls)(e),t[e]=n[r[0]]}):o.forEach(function(a,o){(0,eR.Ls)(a),e(t[a],r,n[o[0]],i,s+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(!(0,eP.kJ)(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new eU.m(e.length,this._size.length);for(var t=0;t<e.length;t++)(0,eR.Ls)(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var s=e[n];(0,eR.Ls)(s,r.length),r=r[s]}return r},r.prototype.set=function(e,t,r){if(!(0,eP.kJ)(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new eU.m(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,s,a,o=this._data;for(n=0,s=e.length-1;n<s;n++)a=e[n],(0,eR.Ls)(a,o.length),o=o[a];return a=e[e.length-1],(0,eR.Ls)(a,o.length),o[a]=t,this},r.prototype.resize=function(e,t,r){if(!(0,eP.uZ)(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=(0,eR.XL)(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=(0,eR.eu)(e,n),r},r.prototype.clone=function(){return new r({data:(0,eL.d9)(this._data),size:(0,eL.d9)(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=function r(n,i){return(0,eP.kJ)(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]),i=void 0!==this._datatype?(0,eR.$q)(n,eP.kM):void 0;return new r(n,i)},r.prototype.forEach=function(e){var t=this;!function r(n,i){(0,eP.kJ)(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((0,eP.kJ)(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,s=function(n){var s=i.map(e=>[e[n]]);t.push(new r(s,e._datatype))},a=0;a<n[1];a++)s(a);return t},r.prototype.toArray=function(){return(0,eL.d9)(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return(0,e$.WU)(this._data,e)},r.prototype.toString=function(){return(0,e$.WU)(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((0,eP.l9)(e)&&(e=e.toNumber()),!(0,eP.hj)(e)||!(0,eB.U)(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),s=[],a=0;a<i;a++)s[a]=this._data[a+n][a+t];return new r({data:s,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!(0,eP.kJ)(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((0,eP.l9)(e)&&(e=e.toNumber()),!(0,eP.hj)(e)||!(0,eB.U)(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if((0,eP.l9)(n)&&(n=n.toNumber()),!(0,eP.hj)(n)||!(0,eB.U)(n))throw TypeError("The parameter k must be an integer number")}else n=0;var s,a=n>0?n:0,o=n<0?-n:0,u=e[0],c=e[1],l=Math.min(u-o,c-a);if((0,eP.kJ)(t)){if(t.length!==l)throw Error("Invalid value array length");s=function(e){return t[e]}}else if((0,eP.SW)(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");s=function(e){return t.get([e])}}else s=function(){return t};i||(i=(0,eP.l9)(s(0))?s(0).mul(0):0);var h=[];if(e.length>0){h=(0,eR.SI)(h,e,i);for(var d=0;d<l;d++)h[d+o][d+a]=s(d)}return new r({data:h,size:[u,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!(0,eP.hj)(e)||!(0,eB.U)(e)||!(0,eP.hj)(t)||!(0,eB.U)(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return(0,eR.Ls)(e,this._size[0]),(0,eR.Ls)(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})};let eV=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},eW=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},eJ=function(e){let t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;let r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},eH=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))},eK=function(){throw SyntaxError("Invalid Param")};function eG(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 eY={re:0,im:0},eX=function(e,t){if(null==e)eY.re=eY.im=0;else if(void 0!==t)eY.re=e,eY.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)eY.re=e.re,eY.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return eQ.INFINITY;eY.re=e.abs*Math.cos(e.arg),eY.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return eQ.INFINITY;eY.re=e.r*Math.cos(e.phi),eY.im=e.r*Math.sin(e.phi)}else 2===e.length?(eY.re=e[0],eY.im=e[1]):eK();break;case"string":eY.im=eY.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&eK();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&&eK()," "===r[e+1]||isNaN(r[e+1])?eY.im+=parseFloat((i%2?"-":"")+"1"):(eY.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&eK(),"i"===r[e+1]||"I"===r[e+1]?(eY.im+=parseFloat((i%2?"-":"")+t),e++):eY.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&eK();break;case"number":eY.im=0,eY.re=e;break;default:eK()}return isNaN(eY.re)||isNaN(eY.im),eY};function eQ(e,t){if(!(this instanceof eQ))return new eQ(e,t);let r=eX(e,t);this.re=r.re,this.im=r.im}eQ.prototype={re:0,im:0,sign:function(){let e=eH(this.re,this.im);return new eQ(this.re/e,this.im/e)},add:function(e,t){let r=eX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?eQ.NAN:eQ.INFINITY:new eQ(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=eX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?eQ.NAN:eQ.INFINITY:new eQ(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=eX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),s=0===this.re&&0===this.im,a=0===r.re&&0===r.im;return n&&a||i&&s?eQ.NAN:n||i?eQ.INFINITY:0===r.im&&0===this.im?new eQ(this.re*r.re,0):new eQ(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=eX(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),s=0===this.re&&0===this.im,a=0===r.re&&0===r.im;if(s&&a||n&&i)return eQ.NAN;if(a||n)return eQ.INFINITY;if(s||i)return eQ.ZERO;if(0===r.im)return new eQ(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 eQ((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 eQ((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=eX(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return eQ.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new eQ(Math.pow(this.re,r.re),0);if(0===this.re)switch((r.re%4+4)%4){case 0:return new eQ(Math.pow(this.im,r.re),0);case 1:return new eQ(0,Math.pow(this.im,r.re));case 2:return new eQ(-Math.pow(this.im,r.re),0);case 3:return new eQ(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return eQ.ZERO;let i=Math.atan2(this.im,this.re),s=eG(this.re,this.im),a=Math.exp(r.re*s-r.im*i),o=r.im*s+r.re*i;return new eQ(a*Math.cos(o),a*Math.sin(o))},sqrt:function(){let e=this.re,t=this.im;if(0===t)return e>=0?new eQ(Math.sqrt(e),0):new eQ(0,Math.sqrt(-e));let r=Math.sqrt(.5*(eH(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new eQ(r,t<0?-n:n):new eQ(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new eQ(e,0):new eQ(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,t=this.im;return new eQ(Math.expm1(e)*Math.cos(t)+eJ(t),Math.exp(e)*Math.sin(t))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new eQ(Math.log(e),0):new eQ(eG(e,t),Math.atan2(t,e))},abs:function(){return eH(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new eQ(Math.sin(e)*eV(t),Math.cos(e)*eW(t))},cos:function(){let e=this.re,t=this.im;return new eQ(Math.cos(e)*eV(t),-Math.sin(e)*eW(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+eV(t);return new eQ(Math.sin(e)/r,eW(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-eV(t);return new eQ(-Math.sin(e)/r,eW(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*eV(2*t)+.5*Math.cos(2*e);return new eQ(Math.cos(e)*eV(t)/r,Math.sin(e)*eW(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*eV(2*t)-.5*Math.cos(2*e);return new eQ(Math.sin(e)*eV(t)/r,-Math.cos(e)*eW(t)/r)},asin:function(){let e=this.re,t=this.im,r=new eQ(t*t-e*e+1,-2*e*t).sqrt(),n=new eQ(r.re-t,r.im+e).log();return new eQ(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new eQ(t*t-e*e+1,-2*e*t).sqrt(),n=new eQ(r.re-t,r.im+e).log();return new eQ(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new eQ(0,1/0);if(-1===t)return new eQ(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new eQ((1-t*t-e*e)/r,-2*e/r).log();return new eQ(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new eQ(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).atan():new eQ(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 eQ(0,1/0);let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).acos():new eQ(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 eQ(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).asin():new eQ(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new eQ(eW(e)*Math.cos(t),eV(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new eQ(eV(e)*Math.cos(t),eW(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=eV(e)+Math.cos(t);return new eQ(eW(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=eV(e)-Math.cos(t);return new eQ(eW(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-eV(2*e);return new eQ(-2*eW(e)*Math.cos(t)/r,2*eV(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+eV(2*e);return new eQ(2*eV(e)*Math.cos(t)/r,-2*eW(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){let e=this.acos();if(e.im<=0){let t=e.re;e.re=-e.im,e.im=t}else{let t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){let e=this.re,t=this.im,r=1-e,n=1+e,i=r*r+t*t,s=0!==i?new eQ((n*r-t*t)/i,(t*r+n*t)/i):new eQ(-1!==e?e/0:0,0!==t?t/0:0),a=s.re;return s.re=eG(s.re,s.im)/2,s.im=Math.atan2(s.im,a)/2,e>1&&0===t&&(s.im=-s.im),s},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new eQ(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).atanh():new eQ(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t)return new eQ(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).asinh():new eQ(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return eQ.INFINITY;let r=e*e+t*t;return 0!==r?new eQ(e/r,-t/r).acosh():new eQ(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return eQ.INFINITY;if(this.isInfinite())return eQ.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new eQ(e/r,-t/r)},conjugate:function(){return new eQ(this.re,-this.im)},neg:function(){return new eQ(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new eQ(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new eQ(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new eQ(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=eX(e,t);return Math.abs(r.re-this.re)<=eQ.EPSILON&&Math.abs(r.im-this.im)<=eQ.EPSILON},clone:function(){return new eQ(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<eQ.EPSILON&&(e=0),Math.abs(t)<eQ.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()}},eQ.ZERO=new eQ(0,0),eQ.ONE=new eQ(1,0),eQ.I=new eQ(0,1),eQ.PI=new eQ(Math.PI,0),eQ.E=new eQ(Math.E,0),eQ.INFINITY=new eQ(1/0,1/0),eQ.NAN=new eQ(NaN,NaN),eQ.EPSILON=1e-15;var e0=(0,eZ.d5)("Complex",[],()=>(eQ.prototype.type="Complex",eQ.prototype.isComplex=!0,eQ.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},eQ.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},eQ.prototype.format=function(e){var t="",r=this.im,n=this.re,i=(0,eB.WU)(this.re,e),s=(0,eB.WU)(this.im,e),a=(0,eP.hj)(e)?e:e?e.precision:null;if(null!==a){var o=Math.pow(10,-a);Math.abs(n/r)<o&&(n=0),Math.abs(r/n)<o&&(r=0)}return 0===r?i:0===n?1===r?"i":-1===r?"-i":s+"i":r<0?-1===r?i+" - i":i+" - "+s.substring(1)+"i":1===r?i+" + i":i+" + "+s+"i"},eQ.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return eQ(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if((0,eP.hj)(r)){if((0,eP.wr)(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),(0,eP.hj)(n))return new eQ({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")}},eQ.prototype.valueOf=eQ.prototype.toString,eQ.fromJSON=function(e){return new eQ(e)},eQ.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},eQ),{isClass:!0}),e1={s:1,n:0,d:1};function e2(e,t){if(isNaN(e=parseInt(e,10)))throw e6();return e*t}function e9(e,t){if(0===t)throw e8();var r=Object.create(e7.prototype);r.s=e<0?-1:1;var n=e3(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function e4(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 e5=function(e,t){var r,n=0,i=1,s=1,a=0,o=0,u=0,c=1,l=1,f=0,h=1,d=1,p=1;if(null==e);else if(void 0!==t){if(s=(n=e)*(i=t),n%1!=0||i%1!=0)throw te()}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,i=e.d,"s"in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(i=e[1]);else throw e6();s=n*i;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(l=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=l);h<=1e7&&p<=1e7;){if(e===(r=(f+d)/(h+p))){h+p<=1e7?(n=f+d,i=h+p):p>h?(n=d,i=p):(n=f,i=h);break}e>r?(f+=d,h+=p):(d+=f,p+=h),h>1e7?(n=d,i=p):(n=f,i=h)}n*=l}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(h=e.match(/\d+|./g)))throw e6();if("-"===h[f]?(s=-1,f++):"+"===h[f]&&f++,h.length===f+1?o=e2(h[f++],s):"."===h[f+1]||"."===h[f]?("."!==h[f]&&(a=e2(h[f++],s)),(++f+1===h.length||"("===h[f+1]&&")"===h[f+3]||"'"===h[f+1]&&"'"===h[f+3])&&(o=e2(h[f],s),c=Math.pow(10,h[f].length),f++),("("===h[f]&&")"===h[f+2]||"'"===h[f]&&"'"===h[f+2])&&(u=e2(h[f+1],s),l=Math.pow(10,h[f+1].length)-1,f+=3)):"/"===h[f+1]||":"===h[f+1]?(o=e2(h[f],s),c=e2(h[f+2],1),f+=3):"/"===h[f+3]&&" "===h[f+1]&&(a=e2(h[f],s),o=e2(h[f+2],s),c=e2(h[f+4],1),f+=5),h.length<=f){s=n=u+(i=c*l)*a+l*o;break}default:throw e6()}if(0===i)throw e8();e1.s=s<0?-1:1,e1.n=Math.abs(n),e1.d=Math.abs(i)};function e3(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function e7(e,t){if(e5(e,t),!(this instanceof e7))return e9(e1.s*e1.n,e1.d);e=e3(e1.d,e1.n),this.s=e1.s,this.n=e1.n/e,this.d=e1.d/e}var e8=function(){return Error("Division by Zero")},e6=function(){return Error("Invalid argument")},te=function(){return Error("Parameters must be integer")};e7.prototype={s:1,n:0,d:1,abs:function(){return e9(this.n,this.d)},neg:function(){return e9(-this.s*this.n,this.d)},add:function(e,t){return e5(e,t),e9(this.s*this.n*e1.d+e1.s*this.d*e1.n,this.d*e1.d)},sub:function(e,t){return e5(e,t),e9(this.s*this.n*e1.d-e1.s*this.d*e1.n,this.d*e1.d)},mul:function(e,t){return e5(e,t),e9(this.s*e1.s*this.n*e1.n,this.d*e1.d)},div:function(e,t){return e5(e,t),e9(this.s*e1.s*this.n*e1.d,this.d*e1.n)},clone:function(){return e9(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new e7(NaN);if(void 0===e)return e9(this.s*this.n%this.d,1);if(e5(e,t),0===e1.n&&0===this.d)throw e8();return e9(this.s*(e1.d*this.n)%(e1.n*this.d),e1.d*this.d)},gcd:function(e,t){return e5(e,t),e9(e3(e1.n,this.n)*e3(e1.d,this.d),e1.d*this.d)},lcm:function(e,t){return(e5(e,t),0===e1.n&&0===this.n)?e9(0,1):e9(e1.n*this.n,e3(e1.n,this.n)*e3(e1.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new e7(NaN):e9(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 e7(NaN):e9(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 e7(NaN):e9(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return e5(e,t),e9(this.s*Math.round(this.n*e1.d/(this.d*e1.n))*e1.n,e1.d)},inverse:function(){return e9(this.s*this.d,this.n)},pow:function(e,t){if(e5(e,t),1===e1.d)return e1.s<0?e9(Math.pow(this.s*this.d,e1.n),Math.pow(this.n,e1.n)):e9(Math.pow(this.s*this.n,e1.n),Math.pow(this.d,e1.n));if(this.s<0)return null;var r=e4(this.n),n=e4(this.d),i=1,s=1;for(var a in r)if("1"!==a){if("0"===a){i=0;break}if(r[a]*=e1.n,r[a]%e1.d!=0)return null;r[a]/=e1.d,i*=Math.pow(a,r[a])}for(var a in n)if("1"!==a){if(n[a]*=e1.n,n[a]%e1.d!=0)return null;n[a]/=e1.d,s*=Math.pow(a,n[a])}return e1.s<0?e9(s,i):e9(i,s)},equals:function(e,t){return e5(e,t),this.s*this.n*e1.d==e1.s*e1.n*this.d},compare:function(e,t){e5(e,t);var r=this.s*this.n*e1.d-e1.s*e1.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var i=e9(r[n-1],1),s=n-2;s>=0;s--)i=i.inverse().add(r[s]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return e5(e,t),!(!(e1.n*this.d)||this.n*e1.d%(e1.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,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=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,r,t),s=0;s<300;s++){if(n===i)return s;n=10*n%t,i=10*i%t}return 0}(0,r,n),s=this.s<0?"-":"";if(s+=t/r|0,t%=r,(t*=10)&&(s+="."),n){for(var a=i;a--;)s+=t/r|0,t%=r,t*=10;s+="(";for(var a=n;a--;)s+=t/r|0,t%=r,t*=10;s+=")"}else for(var a=e;t&&a--;)s+=t/r|0,t%=r,t*=10;return s}};var tt=(0,eZ.d5)("Fraction",[],()=>(e7.prototype.type="Fraction",e7.prototype.isFraction=!0,e7.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},e7.fromJSON=function(e){return new e7(e)},e7),{isClass:!0}),tr=r(27554);function tn(e,t){return!!e&&"object"==typeof e&&(!!(0,eL.nr)(ts,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function ti(e){return"object"==typeof e&&e&&e.constructor===Object}var ts={length:!0,name:!0},ta={toString:!0,valueOf:!0,toLocaleString:!0};class to{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return function(e,t){var r,n;if(ti(e)&&tn(e,t))return e[t];if("function"==typeof e[t]&&(r=e,n=t,!(null==r||"function"!=typeof r[n]||(0,eL.nr)(r,n)&&Object.getPrototypeOf&&n in Object.getPrototypeOf(r))&&((0,eL.nr)(ta,n)||!(n in Object.prototype)&&!(n in Function.prototype))))throw Error('Cannot access method "'+t+'" as a property');throw Error('No access to property "'+t+'"')}(this.wrappedObject,e)}set(e,t){return!function(e,t,r){if(ti(e)&&tn(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}}function tu(e){return!!e&&(e instanceof Map||e instanceof to||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var tc=function(){return tc=tr.create,tr};function tl(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function tf(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function th(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var td={BigNumberDependencies:ez,ComplexDependencies:{createComplexClass:e0},DenseMatrixDependencies:eq,FractionDependencies:{createFractionClass:tt},createTyped:(0,eZ.d5)("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,s=tc();return s.types=[{name:"number",test:eP.hj},{name:"Complex",test:eP.Mc},{name:"BigNumber",test:eP.l9},{name:"Fraction",test:eP.yQ},{name:"Unit",test:eP.wr},{name:"string",test:eP.HD},{name:"Chain",test:eP.qg},{name:"Array",test:eP.kJ},{name:"Matrix",test:eP.SW},{name:"DenseMatrix",test:eP.jH},{name:"SparseMatrix",test:eP.sA},{name:"Range",test:eP.bR},{name:"Index",test:eP.dh},{name:"boolean",test:eP.jn},{name:"ResultSet",test:eP.cB},{name:"Help",test:eP.x1},{name:"function",test:eP.mf},{name:"Date",test:eP.J_},{name:"RegExp",test:eP.Kj},{name:"null",test:eP.Ft},{name:"undefined",test:eP.o8},{name:"AccessorNode",test:eP.Yz},{name:"ArrayNode",test:eP.j0},{name:"AssignmentNode",test:eP.Bp},{name:"BlockNode",test:eP.zh},{name:"ConditionalNode",test:eP.tS},{name:"ConstantNode",test:eP.nu},{name:"FunctionNode",test:eP.VO},{name:"FunctionAssignmentNode",test:eP.l7},{name:"IndexNode",test:eP.Cl},{name:"Node",test:eP.UG},{name:"ObjectNode",test:eP.Lr},{name:"OperatorNode",test:eP.bV},{name:"ParenthesisNode",test:eP.Ig},{name:"RangeNode",test:eP.ex},{name:"SymbolNode",test:eP.FG},{name:"Map",test:tu},{name:"Object",test:eP.Kn}],s.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||tl(e),(0,eB.nz)(e)>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||tf(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||tf(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||tf(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||th(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||tl(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||th(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||tf(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||tl(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||th(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()}}],s})},tp="equalScalar",tm=(0,eZ.d5)(tp,["typed","config"],e=>{var{typed:t,config:r}=e;return t(tp,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return(0,eB.RI)(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,(0,eB.RI)(e.re,t.re,n)&&(0,eB.RI)(e.im,t.im,n)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw Error("Cannot compare units with different base");return this(e.value,t.value)}})});(0,eZ.d5)(tp,["typed","config"],e=>{var{typed:t,config:r}=e;return t(tp,{"number, number":function(e,t){return(0,eB.RI)(e,t,r.epsilon)}})});var tg={typedDependencies:td,createEqualScalar:tm},tv=(0,eZ.d5)("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&&!(0,eP.HD)(t))throw Error("Invalid datatype: "+t);if((0,eP.SW)(e)){var r,n,a;r=this,n=e,a=t,"SparseMatrix"===n.type?(r._values=n._values?(0,eL.d9)(n._values):void 0,r._index=(0,eL.d9)(n._index),r._ptr=(0,eL.d9)(n._ptr),r._size=(0,eL.d9)(n._size),r._datatype=a||n._datatype):s(r,n.valueOf(),a||n._datatype)}else if(e&&(0,eP.kJ)(e.index)&&(0,eP.kJ)(e.ptr)&&(0,eP.kJ)(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((0,eP.kJ)(e))s(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+(0,eP.kM)(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function s(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var s=n.length,a=0,o=r,u=0;if((0,eP.HD)(i)&&(o=t.find(r,[i,i])||r,u=t.convert(0,i)),s>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<s;l++){var f=n[l];if((0,eP.kJ)(f)){if(0===c&&a<f.length&&(a=f.length),c<f.length){var h=f[c];o(h,u)||(e._values.push(h),e._index.push(l))}}else 0===c&&a<1&&(a=1),o(f,u)||(e._values.push(f),e._index.push(l))}c++}while(c<a)}e._ptr.push(e._index.length),e._size=[s,a]}function a(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 o(e,t,r,n,i,s,a){i.splice(e,0,n),s.splice(e,0,t);for(var o=r+1;o<a.length;o++)a[o]++}function u(e,n,i,s){var a,o,u,c=s||0,l=r,f=0;(0,eP.HD)(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(o=p;o<i;o++)if(e._ptr[o]=e._values.length,h)for(a=0;a<d;a++)e._values.push(c),e._index.push(a);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(o=0;o<p;o++){e._ptr[o]=e._ptr[o]+m,u=e._ptr[o+1]+m;var g=0;for(a=d;a<n;a++,g++)e._values.splice(u+g,0,c),e._index.splice(u+g,0,a),m++}e._ptr[p]=e._values.length}}else if(n<d){var v=0;for(o=0;o<p;o++){e._ptr[o]=e._ptr[o]-v;var y=e._ptr[o],_=e._ptr[o+1]-v;for(u=y;u<_;u++)(a=e._index[u])>n-1&&(e._values.splice(u,1),e._index.splice(u,1),v++)}e._ptr[o]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var s,a,o=n[0],u=n[1],c=[];for(s=0;s<o;s++)for(a=0,c[s]=[];a<u;a++)c[s][a]=0;for(a=0;a<u;a++)for(var l=r[a],f=r[a+1],h=l;h<f;h++)c[s=t[h]][a]=e?i?(0,eL.d9)(e[h]):e[h]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return(0,eR.$q)(this._values,eP.kM)},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(!(0,eP.dh)(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,s,a,o=t.size();if(o.length!==e._size.length)throw new eU.m(o.length,e._size.length);var u=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)(0,eR.Ls)(u[r],e._size[r]),(0,eR.Ls)(c[r],e._size[r]);var l=e._values,f=e._index,h=e._ptr,d=t.dimension(0),p=t.dimension(1),m=[],g=[];d.forEach(function(e,t){g[e]=t[0],m[e]=!0});var v=l?[]:void 0,y=[],_=[];return p.forEach(function(e){for(_.push(y.length),s=h[e],a=h[e+1];s<a;s++)!0===m[r=f[s]]&&(y.push(g[r]),v&&v.push(l[s]))}),_.push(y.length),new i({values:v,index:y,ptr:_,size:o,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,s=t.size(),a=t.isScalar();if((0,eP.SW)(r)?(i=r.size(),r=r.toArray()):i=(0,eR.aJ)(r),a){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==s.length&&2!==s.length)throw new eU.m(s.length,e._size.length,"<");if(i.length<s.length){for(var o=0,u=0;1===s[o]&&1===i[o];)o++;for(;1===s[o];)u++,o++;r=(0,eR.f4)(r,s.length,u,i)}if(!(0,eL.J5)(s,i))throw new eU.m(s,i,">");if(1===s.length)t.dimension(0).forEach(function(t,i){(0,eR.Ls)(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){(0,eR.Ls)(t),l.forEach(function(s,a){(0,eR.Ls)(s),e.set([t,s],r[i[0]][a[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!(0,eP.kJ)(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new eU.m(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];(0,eR.Ls)(t,this._size[0]),(0,eR.Ls)(r,this._size[1]);var n=a(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(!(0,eP.kJ)(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new eU.m(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var s=e[0],c=e[1],l=this._size[0],f=this._size[1],h=r,d=0;(0,eP.HD)(this._datatype)&&(h=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(s>l-1||c>f-1)&&(u(this,Math.max(s+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),(0,eR.Ls)(s,l),(0,eR.Ls)(c,f);var p=a(s,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===s?h(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var s=t+1;s<i.length;s++)i[s]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:o(p,s,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!(0,eP.uZ)(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(!(0,eP.hj)(e)||!(0,eB.U)(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+(0,e$.WU)(n)+")")}),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!(0,eP.kJ)(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(!(0,eP.hj)(t)||!(0,eB.U)(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+(0,e$.WU)(e)+")")});var r=this._size[0]*this._size[1],n=(e=(0,eR.eu)(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 s=[],u=0;u<i._ptr.length;u++)for(var c=0;c<i._ptr[u+1]-i._ptr[u];c++)s.push(u);for(var l=i._values.slice(),f=i._index.slice(),h=0;h<i._index.length;h++){var d=f[h],p=s[h],m=d*i._size[1]+p;s[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 g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var v=0;v<l.length;v++){var y=f[v],_=s[v],w=l[v];o(a(y,i._ptr[_],i._ptr[_+1],i._index),y,_,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?(0,eL.d9)(this._values):void 0,index:(0,eL.d9)(this._index),ptr:(0,eL.d9)(this._ptr),size:(0,eL.d9)(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 s=this;return function(e,n,s,a,o,u,c){var l=[],f=[],h=[],d=r,p=0;(0,eP.HD)(e._datatype)&&(d=t.find(r,[e._datatype,e._datatype])||r,p=t.convert(0,e._datatype));for(var m=function(e,t,r){e=u(e,t,r),d(e,p)||(l.push(e),f.push(t))},g=0;g<=o;g++){h.push(l.length);var v=e._ptr[g],y=e._ptr[g+1];if(c)for(var _=v;_<y;_++){var w=e._index[_];w>=0&&w<=s&&m(e._values[_],w-n,g-a)}else{for(var b={},x=v;x<y;x++)b[e._index[x]]=e._values[x];for(var N=n;N<=s;N++)m(N in b?b[N]:0,N-n,g-a)}}return h.push(l.length),new i({values:l,index:f,ptr:h,size:[s-n+1,o-a+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,r,n){return e(t,[r,n],s)},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 s=this._ptr[i],a=this._ptr[i+1];if(t)for(var o=s;o<a;o++){var u=this._index[o];e(this._values[o],[u,i],this)}else{for(var c={},l=s;l<a;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 s=this._index[i];yield{value:this._values[i],index:[s,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 ["+(0,e$.WU)(t,e)+" x "+(0,e$.WU)(r,e)+"] density: "+(0,e$.WU)(n,e)+"\n",s=0;s<r;s++)for(var a=this._ptr[s],o=this._ptr[s+1],u=a;u<o;u++){var c=this._index[u];i+="\n ("+(0,e$.WU)(c,e)+", "+(0,e$.WU)(s,e)+") ==> "+(this._values?(0,e$.WU)(this._values[u],e):"X")}return i},i.prototype.toString=function(){return(0,e$.WU)(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((0,eP.l9)(e)&&(e=e.toNumber()),!(0,eP.hj)(e)||!(0,eB.U)(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],s=this._size[1],a=Math.min(n-r,s-t),o=[],u=[],c=[];c[0]=0;for(var l=t;l<s&&o.length<a;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){o.push(this._values[d]),u[o.length-1]=p-r;break}}return c.push(o.length),new i({values:o,index:u,ptr:c,size:[a,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,s,a,o){if(!(0,eP.kJ)(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((0,eP.l9)(e)&&(e=e.toNumber()),!(0,eP.hj)(e)||!(0,eB.U)(e)||e<1)throw Error("Size values must be positive integers");return e}),s){if((0,eP.l9)(s)&&(s=s.toNumber()),!(0,eP.hj)(s)||!(0,eB.U)(s))throw TypeError("The parameter k must be an integer number")}else s=0;var u,c=r,l=0;(0,eP.HD)(o)&&(c=t.find(r,[o,o])||r,l=t.convert(0,o));var f=s>0?s:0,h=s<0?-s:0,d=e[0],p=e[1],m=Math.min(d-h,p-f);if((0,eP.kJ)(n)){if(n.length!==m)throw Error("Invalid value array length");u=function(e){return n[e]}}else if((0,eP.SW)(n)){var g=n.size();if(1!==g.length||g[0]!==m)throw Error("Invalid matrix length");u=function(e){return n.get([e])}}else u=function(){return n};for(var v=[],y=[],_=[],w=0;w<p;w++){_.push(v.length);var b=w-f;if(b>=0&&b<m){var x=u(b);c(x,l)||(y.push(b+h),v.push(x))}}return _.push(v.length),new i({values:v,index:y,ptr:_,size:[d,p]})},i.prototype.swapRows=function(e,t){if(!(0,eP.hj)(e)||!(0,eB.U)(e)||!(0,eP.hj)(t)||!(0,eB.U)(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return(0,eR.Ls)(e,this._size[0]),(0,eR.Ls)(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 s=n[e],a=n[e+1],o=s;o<a;o++)i(r[o],t[o])},i._swapRows=function(e,t,r,n,i,s){for(var o=0;o<r;o++){var u=s[o],c=s[o+1],l=a(e,u,c,i),f=a(t,u,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}),ty="matrix",t_=(0,eZ.d5)(ty,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(ty,{"":function(){return s([])},string:function(e){return s([],e)},"string, string":function(e,t){return s([],e,t)},Array:function(e){return s(e)},Matrix:function(e){return s(e,e.storage())},"Array | Matrix, string":s,"Array | Matrix, string, string":s});function s(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)+".")}}),tw=(0,eZ.d5)("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var s,a,o=e._data,u=e._size,c=e._datatype,l=r._values,f=r._index,h=r._ptr,d=r._size,p=r._datatype;if(u.length!==d.length)throw new eU.m(u.length,d.length);if(u[0]!==d[0]||u[1]!==d[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+d+")");if(!l)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=u[0],g=u[1],v="string"==typeof c&&c===p?c:void 0,y=v?t.find(n,[v,v]):n,_=[];for(s=0;s<m;s++)_[s]=[];var w=[],b=[];for(a=0;a<g;a++){for(var x=a+1,N=h[a],E=h[a+1],k=N;k<E;k++)w[s=f[k]]=i?y(l[k],o[s][a]):y(o[s][a],l[k]),b[s]=x;for(s=0;s<m;s++)b[s]===x?_[s][a]=w[s]:_[s][a]=o[s][a]}return e.createDenseMatrix({data:_,size:[m,g],datatype:v})}}),tb=(0,eZ.d5)("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var s,a,o,u,c,l,f=e._values,h=e._index,d=e._ptr,p=e._size,m=e._datatype,g=n._values,v=n._index,y=n._ptr,_=n._size,w=n._datatype;if(p.length!==_.length)throw new eU.m(p.length,_.length);if(p[0]!==_[0]||p[1]!==_[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+_+")");var b=p[0],x=p[1],N=r,E=0,k=i;"string"==typeof m&&m===w&&(s=m,N=t.find(r,[s,s]),E=t.convert(0,s),k=t.find(i,[s,s]));var M=f&&g?[]:void 0,O=[],S=[],A=f&&g?[]:void 0,T=f&&g?[]:void 0,C=[],j=[];for(o=0;o<x;o++){S[o]=O.length;var I=o+1;for(c=d[o],l=d[o+1],u=c;u<l;u++)a=h[u],O.push(a),C[a]=I,A&&(A[a]=f[u]);for(c=y[o],l=y[o+1],u=c;u<l;u++)if(C[a=v[u]]===I){if(A){var F=k(A[a],g[u]);N(F,E)?C[a]=null:A[a]=F}}else O.push(a),j[a]=I,T&&(T[a]=g[u]);if(A&&T)for(u=S[o];u<O.length;)C[a=O[u]]===I?(M[u]=A[a],u++):j[a]===I?(M[u]=T[a],u++):O.splice(u,1)}return S[x]=O.length,e.createSparseMatrix({values:M,index:O,ptr:S,size:[b,x],datatype:s})}}),tx=(0,eZ.d5)("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,s){var a,o=e._values,u=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=l[0],d=l[1],p=i;"string"==typeof f&&(a=f,n=t.convert(n,a),p=t.find(i,[a,a]));for(var m=[],g=[],v=[],y=0;y<d;y++){for(var _=y+1,w=c[y],b=c[y+1],x=w;x<b;x++){var N=u[x];g[N]=o[x],v[N]=_}for(var E=0;E<h;E++)0===y&&(m[E]=[]),v[E]===_?m[E][y]=s?p(n,g[E]):p(g[E],n):m[E][y]=n}return new r({data:m,size:[h,d],datatype:a})}}),tN=(0,eZ.d5)("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,r,n){var i,s=e._data,a=e._size,o=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(a.length!==c.length)throw new eU.m(a.length,c.length);for(var h=0;h<a.length;h++){if(a[h]!==c[h])throw RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");f[h]=a[h]}var d=n;"string"==typeof o&&o===l&&(i=o,d=t.find(n,[i,i]));var p=f.length>0?function e(t,r,n,i,s,a){var o=[];if(r===n.length-1)for(var u=0;u<i;u++)o[u]=t(s[u],a[u]);else for(var c=0;c<i;c++)o[c]=e(t,r+1,n,n[r+1],s[c],a[c]);return o}(d,0,f,f[0],s,u):[];return e.createDenseMatrix({data:p,size:f,datatype:i})}}),tE=(0,eZ.d5)("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var s,a=e._data,o=e._size,u=e._datatype,c=n;"string"==typeof u&&(s=u,r=t.convert(r,s),c=t.find(n,[s,s]));var l=o.length>0?function e(t,r,n,i,s,a,o){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=o?t(a,s[c]):t(s[c],a);else for(var l=0;l<i;l++)u[l]=e(t,r+1,n,n[r+1],s[l],a,o);return u}(c,0,o,o[0],a,r,i):[];return e.createDenseMatrix({data:l,size:(0,eL.d9)(o),datatype:s})}});function tk(e,t){var r;if(!(0,eB.U)(e)||!(0,eB.U)(t))throw Error("Parameters in function gcd must be integer numbers");for(;0!==t;)r=e%t,e=t,t=r;return e<0?-e:e}tk.signature="number, number";var tM={BigNumberDependencies:ez,DenseMatrixDependencies:eq,equalScalarDependencies:tg,matrixDependencies:{DenseMatrixDependencies:eq,MatrixDependencies:eD,SparseMatrixDependencies:{MatrixDependencies:eD,equalScalarDependencies:tg,typedDependencies:td,createSparseMatrixClass:tv},typedDependencies:td,createMatrix:t_},typedDependencies:td,createGcd:(0,eZ.d5)("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:s}=e,a=tw({typed:t}),o=tb({typed:t,equalScalar:n}),u=tx({typed:t,DenseMatrix:s}),c=tN({typed:t}),l=tE({typed:t});return t("gcd",{"number, number":tk,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var r=new i(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return l(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return l(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return l(r(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}})})}},10281:function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))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}r.d(t,{m:()=>n}),n.prototype=RangeError(),n.prototype.constructor=RangeError,n.prototype.name="DimensionError",n.prototype.isDimensionError=!0},53965:function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))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}r.d(t,{c:()=>n}),n.prototype=RangeError(),n.prototype.constructor=RangeError,n.prototype.name="IndexError",n.prototype.isIndexError=!0},99926:function(e,t,r){"use strict";r.d(t,{$q:()=>function e(t,r){for(var n,i=0,s=0;s<t.length;s++){var a=t[s],o=Array.isArray(a);if(0===s&&o&&(i=a.length),o&&a.length!==i)return;var u=o?e(a,r):r(a);if(void 0===n)n=u;else if(n!==u)return"mixed"}return n},Gu:()=>c,Ls:()=>l,SI:()=>f,XL:()=>h,aJ:()=>u,eu:()=>d,f4:()=>m,r3:()=>g});var n=r(73984),i=r(30713),s=r(58676),a=r(10281),o=r(53965);function u(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function c(e,t){if(0===t.length){if(Array.isArray(e))throw new a.m(e.length,0)}else!function e(t,r,n){var i,s=t.length;if(s!==r[n])throw new a.m(s,r[n]);if(n<r.length-1){var o=n+1;for(i=0;i<s;i++){if(!Array.isArray(t[i]))throw new a.m(r.length-1,r.length,"<");e(t[i],r,o)}}else for(i=0;i<s;i++)if(Array.isArray(t[i]))throw new a.m(r.length+1,r.length,">")}(e,t,0)}function l(e,t){if(!(0,i.hj)(e)||!(0,n.U)(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new o.c(e,t)}function f(e,t,r){if(!Array.isArray(e)||!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(!(0,i.hj)(e)||!(0,n.U)(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+(0,s.WU)(t)+")")}),function e(t,r,n,i){var s,a,o=t.length,u=r[n],c=Math.min(o,u);if(t.length=u,n<r.length-1){var l=n+1;for(s=0;s<c;s++)Array.isArray(a=t[s])||(a=[a],t[s]=a),e(a,r,l,i);for(s=c;s<u;s++)a=[],t[s]=a,e(a,r,l,i)}else{for(s=0;s<c;s++)for(;Array.isArray(t[s]);)t[s]=t[s][0];for(s=c;s<u;s++)t[s]=i}}(e,t,0,void 0!==r?r:0),e}function h(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 a.m(0,n,"!=");var i=p(t=d(t,n));if(n!==i)throw new a.m(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var s=t[i];r=[];for(var a=n.length/s,o=0;o<a;o++)r.push(n.slice(o*s,(o+1)*s));n=r}return n}(r,t)}catch(e){if(e instanceof a.m)throw new a.m(i,n,"!=");throw e}}function d(e,t){var r=p(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 p(e){return e.reduce((e,t)=>e*t,1)}function m(e,t,r,n){var i=n||u(e);if(r)for(var s=0;s<r;s++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,s;if(Array.isArray(t)){var a=n+1;for(i=0,s=t.length;i<s;i++)t[i]=e(t[i],r,a)}else for(var o=n;o<r;o++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function g(e,t){return -1!==e.indexOf(t)}},89719:function(e,t,r){"use strict";r.d(t,{PI:()=>a,d5:()=>i,gS:()=>s});var n=r(43842);function i(e,t,r,i){function s(i){var s=(0,n.W6)(i,t.map(a));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,i),r(s)}return s.isFactory=!0,s.fn=e,s.dependencies=t.slice().sort(),i&&(s.meta=i),s}function s(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function a(e){return e&&"?"===e[0]?e.slice(1):e}},30713:function(e,t,r){"use strict";function n(e){return"number"==typeof e}function i(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function s(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function a(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function o(e){return e&&!0===e.constructor.prototype.isUnit||!1}function u(e){return"string"==typeof e}r.d(t,{Bp:()=>O,Cl:()=>I,FG:()=>R,Ft:()=>N,HD:()=>u,Ig:()=>D,J_:()=>w,Kj:()=>b,Kn:()=>x,Lr:()=>Z,Mc:()=>s,SW:()=>l,UG:()=>F,VO:()=>j,Yz:()=>k,bR:()=>p,bV:()=>z,cB:()=>v,dh:()=>m,ex:()=>P,hj:()=>n,j0:()=>M,jH:()=>h,jn:()=>g,kJ:()=>c,kM:()=>B,l7:()=>C,l9:()=>i,mf:()=>_,nu:()=>T,o8:()=>E,qg:()=>$,sA:()=>d,tS:()=>A,uZ:()=>f,wr:()=>o,x1:()=>y,yQ:()=>a,zh:()=>S});var c=Array.isArray;function l(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function f(e){return Array.isArray(e)||l(e)}function h(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function d(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function p(e){return e&&!0===e.constructor.prototype.isRange||!1}function m(e){return e&&!0===e.constructor.prototype.isIndex||!1}function g(e){return"boolean"==typeof e}function v(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function y(e){return e&&!0===e.constructor.prototype.isHelp||!1}function _(e){return"function"==typeof e}function w(e){return e instanceof Date}function b(e){return e instanceof RegExp}function x(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!s(e)&&!a(e))}function N(e){return null===e}function E(e){return void 0===e}function k(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function S(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function A(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function C(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function I(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Z(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function D(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function B(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":i(e)?"BigNumber":s(e)?"Complex":a(e)?"Fraction":l(e)?"Matrix":o(e)?"Unit":m(e)?"Index":p(e)?"Range":v(e)?"ResultSet":F(e)?e.type:$(e)?"Chain":y(e)?"Help":"Object":"function"===t?"Function":t}},73984:function(e,t,r){"use strict";r.d(t,{Kr:()=>u,RI:()=>_,U:()=>i,WU:()=>h,Xx:()=>s,eK:()=>c,k3:()=>a,mv:()=>o,nz:()=>v,t$:()=>l});var n=r(30713);function i(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var s=Math.sign||function(e){return e>0?1:e<0?-1:0},a=Math.log2||function(e){return Math.log(e)/Math.LN2},o=Math.log10||function(e){return Math.log(e)/Math.LN10},u=Math.log1p||function(e){return Math.log(e+1)},c=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),isFinite(e)?(t=Math.exp(Math.log(e)/3),t=(e/(t*t)+2*t)/3):t=e,r?-t:t},l=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function f(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!i(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(!i(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var s="";return e<0&&(e=-e,s="-"),"".concat(s).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function h(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 r,i,s="auto";if(t&&(t.notation&&(s=t.notation),(0,n.hj)(t)?r=t:(0,n.hj)(t.precision)&&(r=t.precision),t.wordSize&&"number"!=typeof(i=t.wordSize)))throw Error('Option "wordSize" must be a number');switch(s){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=d(e),n="number"==typeof t?m(r,r.exponent+1+t):r,i=n.coefficients,s=n.exponent+1,a=s+(t||0);return i.length<a&&(i=i.concat(g(a-i.length))),s<0&&(i=g(-s+1).concat(i),s=1),s<i.length&&i.splice(s,0,0===s?"0.":"."),n.sign+i.join("")}(e,r);case"exponential":return p(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=m(d(e),t),i=r.exponent,s=r.coefficients,a=i%3==0?i:i<0?i-3-i%3:i-i%3;if((0,n.hj)(t))for(;t>s.length||i-a+1>s.length;)s.push(0);else for(var o=Math.abs(i-a)-(s.length-1),u=0;u<o;u++)s.push(0);for(var c=Math.abs(i-a),l=1;c>0;)l++,c--;var f=s.slice(l).join(""),h=(0,n.hj)(t)&&f.length||f.match(/[1-9]/)?"."+f:"",p=s.slice(0,l).join("")+h+"e"+(i>=0?"+":"")+a.toString();return r.sign+p}(e,r);case"bin":return f(e,2,i);case"oct":return f(e,8,i);case"hex":return f(e,16,i);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,s=d(e),a=t?m(s,t):s;if(a.exponent<n||a.exponent>=i)return p(e,t);var o=a.coefficients,u=a.exponent;o.length<t&&(o=o.concat(g(t-o.length))),o=o.concat(g(u-o.length+1+(o.length<t?t-o.length:0))),o=g(-u).concat(o);var c=u>0?u:0;return c<o.length-1&&o.splice(c+1,0,"."),a.sign+o.join("")})(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+s+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function d(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"),s=n.indexOf(".");i+=-1!==s?s-1:n.length-1;var a=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===a.length&&(a.push(0),i++),{sign:r,coefficients:a,exponent:i}}function p(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=d(e),n=t?m(r,t):r,i=n.coefficients,s=n.exponent;i.length<t&&(i=i.concat(g(t-i.length)));var a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(s>=0?"+":"")+s}function m(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 g(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}function v(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var y=Number.EPSILON||2220446049250313e-31;function _(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<y||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}},43842:function(e,t,r){"use strict";r.d(t,{J5:()=>function e(t,r){var n,i,s;if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(i=0,s=t.length;i<s;i++)if(!e(t[i],r[i]))return!1;return!0}if("function"==typeof t)return t===r;if(!(t instanceof Object))return t===r;if(Array.isArray(r)||!(r instanceof Object))return!1;for(n in t)if(!(n in r)||!e(t[n],r[n]))return!1;for(n in r)if(!(n in t))return!1;return!0},VO:()=>l,Vo:()=>a,W6:()=>c,Xc:()=>i,Yo:()=>u,ZB:()=>function e(t,r){if(Array.isArray(r))throw TypeError("Arrays are not supported by deepExtend");for(var n in r)if(o(r,n)&&!(n in Object.prototype)&&!(n in Function.prototype)){if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n]&&t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else if(Array.isArray(r[n]))throw TypeError("Arrays are not supported by deepExtend");else t[n]=r[n]}return t},d9:()=>function e(t){var r=typeof t;if("number"===r||"string"===r||"boolean"===r||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return e(t)});if(t instanceof Date)return new Date(t.valueOf());if((0,n.l9)(t))return t;if(t instanceof RegExp)throw TypeError("Cannot clone "+t);return i(t,e)},nr:()=>o,oO:()=>s});var n=r(30713);function i(e,t){var r={};for(var n in e)o(e,n)&&(r[n]=t(e[n]));return r}function s(e){var t={};return function e(t,r){for(var n in t)if(o(t,n)){var i=t[n];"object"==typeof i&&null!==i?e(i,r):r[n]=i}}(e,t),t}function a(e,t,r){var n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function o(e,t){return e&&Object.hasOwnProperty.call(e,t)}function u(e){return e&&"function"==typeof e.factory}function c(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],s=e[i];void 0!==s&&(r[i]=s)}return r}function l(e){return Object.keys(e).map(t=>e[t])}},58676:function(e,t,r){"use strict";r.d(t,{WU:()=>function e(t,r){var o=function(t,r){var o;if("number"==typeof t)return(0,i.WU)(t,r);if((0,n.l9)(t))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="auto";if(void 0!==t&&(t.notation&&(r=t.notation),"number"==typeof t?d=t:t.precision&&(d=t.precision),t.wordSize&&"number"!=typeof(p=t.wordSize)))throw Error('Option "wordSize" must be a number');switch(r){case"fixed":return n=e,i=d,n.toFixed(i);case"exponential":return a(e,d);case"engineering":return o=e,u=d,l=(c=o.e)%3==0?c:c<0?c-3-c%3:c-c%3,-1!==(h=(f=o.mul(Math.pow(10,-l))).toPrecision(u)).indexOf("e")&&(h=f.toString()),h+"e"+(c>=0?"+":"")+l.toString();case"bin":return s(e,2,p);case"oct":return s(e,8,p);case"hex":return s(e,16,p);case"auto":var n,i,o,u,c,l,f,h,d,p,m,g=t&&void 0!==t.lowerExp?t.lowerExp:-3,v=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var y=e.toSignificantDigits(d),_=y.e;return(_>=g&&_<v?y.toFixed():a(e,d)).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.')}}(t,r);return(o=t)&&"object"==typeof o&&"number"==typeof o.s&&"number"==typeof o.n&&"number"==typeof o.d?r&&"decimal"===r.fraction?t.toString():t.s*t.n+"/"+t.d:Array.isArray(t)?function t(r,n){if(!Array.isArray(r))return e(r,n);for(var i="[",s=r.length,a=0;a<s;a++)0!==a&&(i+=", "),i+=t(r[a],n);return i+"]"}(t,r):(0,n.HD)(t)?'"'+t+'"':"function"==typeof t?t.syntax?String(t.syntax):"function":t&&"object"==typeof t?"function"==typeof t.format?t.format(r):t&&t.toString(r)!==({}).toString()?t.toString(r):"{"+Object.keys(t).map(n=>'"'+n+'": '+e(t[n],r)).join(", ")+"}":String(t)}(t,r);return r&&"object"==typeof r&&"truncate"in r&&o.length>r.truncate?o.substring(0,r.truncate-3)+"...":o}});var n=r(30713),i=r(73984);function s(e,t,r){var n=new e.constructor(2),s="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!(0,i.U)(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))),s="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(s);case 8:return"".concat(e.toOctal()).concat(s);case 16:return"".concat(e.toHexadecimal()).concat(s);default:throw Error("Base ".concat(t," not supported "))}}function a(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}},77891:function(e,t,r){"use strict";let n;r.d(t,{z:()=>th}),(tn=ta||(ta={})).assertEqual=e=>e,tn.assertIs=function(e){},tn.assertNever=function(e){throw Error()},tn.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},tn.getValidEnumValues=e=>{let t=tn.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return tn.objectValues(r)},tn.objectValues=e=>tn.objectKeys(e).map(function(t){return e[t]}),tn.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},tn.find=(e,t)=>{for(let r of e)if(t(r))return r},tn.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,tn.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},tn.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(to||(to={})).mergeShapes=(e,t)=>({...e,...t});let i=ta.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),s=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":if(Array.isArray(e))return i.array;if(null===e)return i.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return i.promise;if("undefined"!=typeof Map&&e instanceof Map)return i.map;if("undefined"!=typeof Set&&e instanceof Set)return i.set;if("undefined"!=typeof Date&&e instanceof Date)return i.date;return i.object;default:return i.unknown}},a=ta.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class o extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof o))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ta.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}o.create=e=>new o(e);let u=(e,t)=>{let r;switch(e.code){case a.invalid_type:r=e.received===i.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case a.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ta.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:r=`Unrecognized key(s) in object: ${ta.joinValues(e.keys,", ")}`;break;case a.invalid_union:r="Invalid input";break;case a.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ta.joinValues(e.options)}`;break;case a.invalid_enum_value:r=`Invalid enum value. Expected ${ta.joinValues(e.options)}, received '${e.received}'`;break;case a.invalid_arguments:r="Invalid function arguments";break;case a.invalid_return_type:r="Invalid function return type";break;case a.invalid_date:r="Invalid date";break;case a.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ta.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case a.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case a.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case a.custom:r="Invalid input";break;case a.invalid_intersection_types:r="Intersection results could not be merged";break;case a.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case a.not_finite:r="Number must be finite";break;default:r=t.defaultError,ta.assertNever(e)}return{message:r}},c=u;function l(){return c}let f=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}};function h(e,t){let r=l(),n=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===u?void 0:u].filter(e=>!!e)});e.common.issues.push(n)}class d{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return p;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return d.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let p=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),g=e=>({status:"valid",value:e}),v=e=>"aborted"===e.status,y=e=>"dirty"===e.status,_=e=>"valid"===e.status,w=e=>"undefined"!=typeof Promise&&e instanceof Promise;function b(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function x(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(ti=tu||(tu={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ti.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class N{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let E=(e,t)=>{if(_(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new o(e.common.issues);return this._error=t,this._error}}};function k(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!==(s=null!=o?o:n)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:i.defaultError}},description:i}}class M{get description(){return this._def.description}_getType(e){return s(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d,ctx:{common:e.parent.common,data:e.data,parsedType:s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(w(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:s(e)},i=this._parseSync({data:e,path:n.path,parent:n});return E(n,i)}"~validate"(e){var t,r;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:s(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:n});return _(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(e=>_(e)?{value:e.value}:{issues:n.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:s(e)},n=this._parse({data:e,path:r.path,parent:r});return E(r,await (w(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),s=()=>n.addIssue({code:a.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(s(),!1)):!!i||(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new ew({schema:this,typeName:tf.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return eb.create(this,this._def)}nullable(){return ex.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return en.create(this)}promise(){return e_.create(this,this._def)}or(e){return es.create([this,e],this._def)}and(e){return eu.create(this,e,this._def)}transform(e){return new ew({...k(this._def),schema:this,typeName:tf.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eN({...k(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:tf.ZodDefault})}brand(){return new eO({typeName:tf.ZodBranded,type:this,...k(this._def)})}catch(e){return new eE({...k(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:tf.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eS.create(this,e)}readonly(){return eA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let O=/^c[^\s-]{8,}$/i,S=/^[0-9a-z]+$/,A=/^[0-9A-HJKMNP-TV-Z]{26}$/i,T=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,C=/^[a-z0-9_-]{21}$/i,j=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,D=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,P=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,B="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",L=RegExp(`^${B}$`);function U(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function q(e){let t=`${B}T${U(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class V extends M{_parse(e){var t,r,s,o;let u;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i.string){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.string,received:t.parsedType}),p}let c=new d;for(let i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(h(u=this._getOrReturnCtx(e,u),{code:a.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),c.dirty());else if("max"===i.kind)e.data.length>i.value&&(h(u=this._getOrReturnCtx(e,u),{code:a.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),c.dirty());else if("length"===i.kind){let t=e.data.length>i.value,r=e.data.length<i.value;(t||r)&&(u=this._getOrReturnCtx(e,u),t?h(u,{code:a.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&h(u,{code:a.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),c.dirty())}else if("email"===i.kind)F.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"email",code:a.invalid_string,message:i.message}),c.dirty());else if("emoji"===i.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"emoji",code:a.invalid_string,message:i.message}),c.dirty());else if("uuid"===i.kind)T.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"uuid",code:a.invalid_string,message:i.message}),c.dirty());else if("nanoid"===i.kind)C.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"nanoid",code:a.invalid_string,message:i.message}),c.dirty());else if("cuid"===i.kind)O.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"cuid",code:a.invalid_string,message:i.message}),c.dirty());else if("cuid2"===i.kind)S.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"cuid2",code:a.invalid_string,message:i.message}),c.dirty());else if("ulid"===i.kind)A.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"ulid",code:a.invalid_string,message:i.message}),c.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(t){h(u=this._getOrReturnCtx(e,u),{validation:"url",code:a.invalid_string,message:i.message}),c.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"regex",code:a.invalid_string,message:i.message}),c.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),c.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:{startsWith:i.value},message:i.message}),c.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:{endsWith:i.value},message:i.message}),c.dirty()):"datetime"===i.kind?q(i).test(e.data)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:"datetime",message:i.message}),c.dirty()):"date"===i.kind?L.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:"date",message:i.message}),c.dirty()):"time"===i.kind?RegExp(`^${U(i)}$`).test(e.data)||(h(u=this._getOrReturnCtx(e,u),{code:a.invalid_string,validation:"time",message:i.message}),c.dirty()):"duration"===i.kind?I.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"duration",code:a.invalid_string,message:i.message}),c.dirty()):"ip"===i.kind?(t=e.data,!(("v4"===(r=i.version)||!r)&&Z.test(t)||("v6"===r||!r)&&D.test(t))&&(h(u=this._getOrReturnCtx(e,u),{validation:"ip",code:a.invalid_string,message:i.message}),c.dirty())):"jwt"===i.kind?!function(e,t){if(!j.test(e))return!1;try{let[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if("object"!=typeof i||null===i||!i.typ||!i.alg||t&&i.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,i.alg)&&(h(u=this._getOrReturnCtx(e,u),{validation:"jwt",code:a.invalid_string,message:i.message}),c.dirty()):"cidr"===i.kind?(s=e.data,!(("v4"===(o=i.version)||!o)&&z.test(s)||("v6"===o||!o)&&P.test(s))&&(h(u=this._getOrReturnCtx(e,u),{validation:"cidr",code:a.invalid_string,message:i.message}),c.dirty())):"base64"===i.kind?R.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"base64",code:a.invalid_string,message:i.message}),c.dirty()):"base64url"===i.kind?$.test(e.data)||(h(u=this._getOrReturnCtx(e,u),{validation:"base64url",code:a.invalid_string,message:i.message}),c.dirty()):ta.assertNever(i);return{status:c.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:a.invalid_string,...tu.errToObj(r)})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tu.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tu.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tu.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tu.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tu.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tu.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tu.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tu.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tu.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tu.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tu.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tu.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tu.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tu.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...tu.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tu.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tu.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tu.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tu.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tu.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tu.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tu.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tu.errToObj(t)})}nonempty(e){return this.min(1,tu.errToObj(e))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}V.create=e=>{var t;return new V({checks:[],typeName:tf.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class W extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i.number){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.number,received:t.parsedType}),p}let r=new d;for(let n of this._def.checks)"int"===n.kind?ta.isInteger(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.not_finite,message:n.message}),r.dirty()):ta.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tu.toString(t))}setLimit(e,t,r,n){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tu.toString(n)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tu.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tu.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tu.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tu.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tu.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ta.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}W.create=e=>new W({checks:[],typeName:tf.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class J extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==i.bigint)return this._getInvalidInput(e);let r=new d;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ta.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,tu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tu.toString(t))}setLimit(e,t,r,n){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tu.toString(n)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tu.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}J.create=e=>{var t;return new J({checks:[],typeName:tf.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...k(e)})};class H extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==i.boolean){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.boolean,received:t.parsedType}),p}return g(e.data)}}H.create=e=>new H({typeName:tf.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...k(e)});class K extends M{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i.date){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.date,received:t.parsedType}),p}if(isNaN(e.data.getTime()))return h(this._getOrReturnCtx(e),{code:a.invalid_date}),p;let r=new d;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):ta.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tu.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tu.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}K.create=e=>new K({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:tf.ZodDate,...k(e)});class G extends M{_parse(e){if(this._getType(e)!==i.symbol){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.symbol,received:t.parsedType}),p}return g(e.data)}}G.create=e=>new G({typeName:tf.ZodSymbol,...k(e)});class Y extends M{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.undefined,received:t.parsedType}),p}return g(e.data)}}Y.create=e=>new Y({typeName:tf.ZodUndefined,...k(e)});class X extends M{_parse(e){if(this._getType(e)!==i.null){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.null,received:t.parsedType}),p}return g(e.data)}}X.create=e=>new X({typeName:tf.ZodNull,...k(e)});class Q extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return g(e.data)}}Q.create=e=>new Q({typeName:tf.ZodAny,...k(e)});class ee extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return g(e.data)}}ee.create=e=>new ee({typeName:tf.ZodUnknown,...k(e)});class et extends M{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.never,received:t.parsedType}),p}}et.create=e=>new et({typeName:tf.ZodNever,...k(e)});class er extends M{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.void,received:t.parsedType}),p}return g(e.data)}}er.create=e=>new er({typeName:tf.ZodVoid,...k(e)});class en extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==i.array)return h(t,{code:a.invalid_type,expected:i.array,received:t.parsedType}),p;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(h(t,{code:e?a.too_big:a.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(h(t,{code:a.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(h(t,{code:a.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new N(t,e,t.path,r)))).then(e=>d.mergeArray(r,e));let s=[...t.data].map((e,r)=>n.type._parseSync(new N(t,e,t.path,r)));return d.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new en({...this._def,minLength:{value:e,message:tu.toString(t)}})}max(e,t){return new en({...this._def,maxLength:{value:e,message:tu.toString(t)}})}length(e,t){return new en({...this._def,exactLength:{value:e,message:tu.toString(t)}})}nonempty(e){return this.min(1,e)}}en.create=(e,t)=>new en({type:e,minLength:null,maxLength:null,exactLength:null,typeName:tf.ZodArray,...k(t)});class ei extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=ta.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==i.object){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.object,received:t.parsedType}),p}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof et&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||o.push(e);let u=[];for(let e of s){let t=n[e],i=r.data[e];u.push({key:{status:"valid",value:e},value:t._parse(new N(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof et){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of o)u.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)o.length>0&&(h(r,{code:a.unrecognized_keys,keys:o}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of o){let n=r.data[t];u.push({key:{status:"valid",value:t},value:e._parse(new N(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of u){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>d.mergeObjectSync(t,e)):d.mergeObjectSync(t,u)}get shape(){return this._def.shape()}strict(e){return tu.errToObj,new ei({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,s,a;let o=null!==(s=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=tu.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new ei({...this._def,unknownKeys:"strip"})}passthrough(){return new ei({...this._def,unknownKeys:"passthrough"})}extend(e){return new ei({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ei({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:tf.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ei({...this._def,catchall:e})}pick(e){let t={};return ta.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new ei({...this._def,shape:()=>t})}omit(e){let t={};return ta.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new ei({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ei){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=eb.create(e(i))}return new ei({...t._def,shape:()=>r})}if(t instanceof en)return new en({...t._def,type:e(t.element)});if(t instanceof eb)return eb.create(e(t.unwrap()));if(t instanceof ex)return ex.create(e(t.unwrap()));if(t instanceof ec)return ec.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return ta.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new ei({...this._def,shape:()=>t})}required(e){let t={};return ta.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eb;)e=e._def.innerType;t[r]=e}}),new ei({...this._def,shape:()=>t})}keyof(){return eg(ta.objectKeys(this.shape))}}ei.create=(e,t)=>new ei({shape:()=>e,unknownKeys:"strip",catchall:et.create(),typeName:tf.ZodObject,...k(t)}),ei.strictCreate=(e,t)=>new ei({shape:()=>e,unknownKeys:"strict",catchall:et.create(),typeName:tf.ZodObject,...k(t)}),ei.lazycreate=(e,t)=>new ei({shape:e,unknownKeys:"strip",catchall:et.create(),typeName:tf.ZodObject,...k(t)});class es extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new o(e.ctx.common.issues));return h(t,{code:a.invalid_union,unionErrors:r}),p});{let e;let n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new o(e));return h(t,{code:a.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}es.create=(e,t)=>new es({options:e,typeName:tf.ZodUnion,...k(t)});let ea=e=>{if(e instanceof ep)return ea(e.schema);if(e instanceof ew)return ea(e.innerType());if(e instanceof em)return[e.value];if(e instanceof ev)return e.options;if(e instanceof ey)return ta.objectValues(e.enum);else if(e instanceof eN)return ea(e._def.innerType);else if(e instanceof Y)return[void 0];else if(e instanceof X)return[null];else if(e instanceof eb)return[void 0,...ea(e.unwrap())];else if(e instanceof ex)return[null,...ea(e.unwrap())];else if(e instanceof eO)return ea(e.unwrap());else if(e instanceof eA)return ea(e.unwrap());else if(e instanceof eE)return ea(e._def.innerType);else return[]};class eo extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return h(t,{code:a.invalid_type,expected:i.object,received:t.parsedType}),p;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=ea(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new eo({typeName:tf.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...k(r)})}}class eu extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(v(e)||v(n))return p;let o=function e(t,r){let n=s(t),a=s(r);if(t===r)return{valid:!0,data:t};if(n===i.object&&a===i.object){let n=ta.objectKeys(r),i=ta.objectKeys(t).filter(e=>-1!==n.indexOf(e)),s={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};s[n]=i.data}return{valid:!0,data:s}}if(n===i.array&&a===i.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}if(n===i.date&&a===i.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,n.value);return o.valid?((y(e)||y(n))&&t.dirty(),{status:t.value,value:o.data}):(h(r,{code:a.invalid_intersection_types}),p)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eu.create=(e,t,r)=>new eu({left:e,right:t,typeName:tf.ZodIntersection,...k(r)});class ec extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.array)return h(r,{code:a.invalid_type,expected:i.array,received:r.parsedType}),p;if(r.data.length<this._def.items.length)return h(r,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&r.data.length>this._def.items.length&&(h(r,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new N(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>d.mergeArray(t,e)):d.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ec({...this._def,rest:e})}}ec.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ec({items:e,typeName:tf.ZodTuple,rest:null,...k(t)})};class el extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.object)return h(r,{code:a.invalid_type,expected:i.object,received:r.parsedType}),p;let n=[],s=this._def.keyType,o=this._def.valueType;for(let e in r.data)n.push({key:s._parse(new N(r,e,r.path,e)),value:o._parse(new N(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?d.mergeObjectAsync(t,n):d.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new el(t instanceof M?{keyType:e,valueType:t,typeName:tf.ZodRecord,...k(r)}:{keyType:V.create(),valueType:e,typeName:tf.ZodRecord,...k(t)})}}class ef extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.map)return h(r,{code:a.invalid_type,expected:i.map,received:r.parsedType}),p;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([e,t],i)=>({key:n._parse(new N(r,e,r.path,[i,"key"])),value:s._parse(new N(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of o){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return p;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of o){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return p;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ef.create=(e,t,r)=>new ef({valueType:t,keyType:e,typeName:tf.ZodMap,...k(r)});class eh extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.set)return h(r,{code:a.invalid_type,expected:i.set,received:r.parsedType}),p;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(h(r,{code:a.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(h(r,{code:a.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let s=this._def.valueType;function o(e){let r=new Set;for(let n of e){if("aborted"===n.status)return p;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let u=[...r.data.values()].map((e,t)=>s._parse(new N(r,e,r.path,t)));return r.common.async?Promise.all(u).then(e=>o(e)):o(u)}min(e,t){return new eh({...this._def,minSize:{value:e,message:tu.toString(t)}})}max(e,t){return new eh({...this._def,maxSize:{value:e,message:tu.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eh.create=(e,t)=>new eh({valueType:e,minSize:null,maxSize:null,typeName:tf.ZodSet,...k(t)});class ed extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return h(t,{code:a.invalid_type,expected:i.function,received:t.parsedType}),p;function r(e,r){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter(e=>!!e),issueData:{code:a.invalid_arguments,argumentsError:r}})}function n(e,r){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter(e=>!!e),issueData:{code:a.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof e_){let e=this;return g(async function(...t){let i=new o([]),a=await e._def.args.parseAsync(t,s).catch(e=>{throw i.addIssue(r(t,e)),i}),u=await Reflect.apply(c,this,a);return await e._def.returns._def.type.parseAsync(u,s).catch(e=>{throw i.addIssue(n(u,e)),i})})}{let e=this;return g(function(...t){let i=e._def.args.safeParse(t,s);if(!i.success)throw new o([r(t,i.error)]);let a=Reflect.apply(c,this,i.data),u=e._def.returns.safeParse(a,s);if(!u.success)throw new o([n(a,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ed({...this._def,args:ec.create(e).rest(ee.create())})}returns(e){return new ed({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ed({args:e||ec.create([]).rest(ee.create()),returns:t||ee.create(),typeName:tf.ZodFunction,...k(r)})}}class ep extends M{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ep.create=(e,t)=>new ep({getter:e,typeName:tf.ZodLazy,...k(t)});class em extends M{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:a.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eg(e,t){return new ev({values:e,typeName:tf.ZodEnum,...k(t)})}em.create=(e,t)=>new em({value:e,typeName:tf.ZodLiteral,...k(t)});class ev extends M{constructor(){super(...arguments),tc.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{expected:ta.joinValues(r),received:t.parsedType,code:a.invalid_type}),p}if(b(this,tc,"f")||x(this,tc,new Set(this._def.values),"f"),!b(this,tc,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{received:t.data,code:a.invalid_enum_value,options:r}),p}return g(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ev.create(e,{...this._def,...t})}exclude(e,t=this._def){return ev.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}tc=new WeakMap,ev.create=eg;class ey extends M{constructor(){super(...arguments),tl.set(this,void 0)}_parse(e){let t=ta.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==i.string&&r.parsedType!==i.number){let e=ta.objectValues(t);return h(r,{expected:ta.joinValues(e),received:r.parsedType,code:a.invalid_type}),p}if(b(this,tl,"f")||x(this,tl,new Set(ta.getValidEnumValues(this._def.values)),"f"),!b(this,tl,"f").has(e.data)){let e=ta.objectValues(t);return h(r,{received:r.data,code:a.invalid_enum_value,options:e}),p}return g(e.data)}get enum(){return this._def.values}}tl=new WeakMap,ey.create=(e,t)=>new ey({values:e,typeName:tf.ZodNativeEnum,...k(t)});class e_ extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==i.promise&&!1===t.common.async?(h(t,{code:a.invalid_type,expected:i.promise,received:t.parsedType}),p):g((t.parsedType===i.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e_.create=(e,t)=>new e_({type:e,typeName:tf.ZodPromise,...k(t)});class ew extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===tf.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{h(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return p;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?p:"dirty"===n.status||"dirty"===t.value?m(n.value):n});{if("aborted"===t.value)return p;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?p:"dirty"===n.status||"dirty"===t.value?m(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?p:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?p:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>_(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_(e))return e;let s=n.transform(e.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}ta.assertNever(n)}}ew.create=(e,t,r)=>new ew({schema:e,typeName:tf.ZodEffects,effect:t,...k(r)}),ew.createWithPreprocess=(e,t,r)=>new ew({schema:t,effect:{type:"preprocess",transform:e},typeName:tf.ZodEffects,...k(r)});class eb extends M{_parse(e){return this._getType(e)===i.undefined?g(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eb.create=(e,t)=>new eb({innerType:e,typeName:tf.ZodOptional,...k(t)});class ex extends M{_parse(e){return this._getType(e)===i.null?g(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:tf.ZodNullable,...k(t)});class eN extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===i.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eN.create=(e,t)=>new eN({innerType:e,typeName:tf.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...k(t)});class eE extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return w(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new o(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new o(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eE.create=(e,t)=>new eE({innerType:e,typeName:tf.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...k(t)});class ek extends M{_parse(e){if(this._getType(e)!==i.nan){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}ek.create=e=>new ek({typeName:tf.ZodNaN,...k(e)});let eM=Symbol("zod_brand");class eO extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eS extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eS({in:e,out:t,typeName:tf.ZodPipeline})}}class eA extends M{_parse(e){let t=this._def.innerType._parse(e),r=e=>(_(e)&&(e.value=Object.freeze(e.value)),e);return w(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function eT(e,t){let r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function eC(e,t={},r){return e?Q.create().superRefine((n,i)=>{var s,a;let o=e(n);if(o instanceof Promise)return o.then(e=>{var s,a;if(!e){let e=eT(t,n),o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===a||a;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=eT(t,n),o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===a||a;i.addIssue({code:"custom",...e,fatal:o})}}):Q.create()}eA.create=(e,t)=>new eA({innerType:e,typeName:tf.ZodReadonly,...k(t)});let ej={object:ei.lazycreate};(ts=tf||(tf={})).ZodString="ZodString",ts.ZodNumber="ZodNumber",ts.ZodNaN="ZodNaN",ts.ZodBigInt="ZodBigInt",ts.ZodBoolean="ZodBoolean",ts.ZodDate="ZodDate",ts.ZodSymbol="ZodSymbol",ts.ZodUndefined="ZodUndefined",ts.ZodNull="ZodNull",ts.ZodAny="ZodAny",ts.ZodUnknown="ZodUnknown",ts.ZodNever="ZodNever",ts.ZodVoid="ZodVoid",ts.ZodArray="ZodArray",ts.ZodObject="ZodObject",ts.ZodUnion="ZodUnion",ts.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ts.ZodIntersection="ZodIntersection",ts.ZodTuple="ZodTuple",ts.ZodRecord="ZodRecord",ts.ZodMap="ZodMap",ts.ZodSet="ZodSet",ts.ZodFunction="ZodFunction",ts.ZodLazy="ZodLazy",ts.ZodLiteral="ZodLiteral",ts.ZodEnum="ZodEnum",ts.ZodEffects="ZodEffects",ts.ZodNativeEnum="ZodNativeEnum",ts.ZodOptional="ZodOptional",ts.ZodNullable="ZodNullable",ts.ZodDefault="ZodDefault",ts.ZodCatch="ZodCatch",ts.ZodPromise="ZodPromise",ts.ZodBranded="ZodBranded",ts.ZodPipeline="ZodPipeline",ts.ZodReadonly="ZodReadonly";let eI=V.create,eF=W.create,eZ=ek.create,ez=J.create,eD=H.create,eP=K.create,eR=G.create,e$=Y.create,eB=X.create,eL=Q.create,eU=ee.create,eq=et.create,eV=er.create,eW=en.create,eJ=ei.create,eH=ei.strictCreate,eK=es.create,eG=eo.create,eY=eu.create,eX=ec.create,eQ=el.create,e0=ef.create,e1=eh.create,e2=ed.create,e9=ep.create,e4=em.create,e5=ev.create,e3=ey.create,e7=e_.create,e8=ew.create,e6=eb.create,te=ex.create,tt=ew.createWithPreprocess,tr=eS.create;var tn,ti,ts,ta,to,tu,tc,tl,tf,th=Object.freeze({__proto__:null,defaultErrorMap:u,setErrorMap:function(e){c=e},getErrorMap:l,makeIssue:f,EMPTY_PATH:[],addIssueToContext:h,ParseStatus:d,INVALID:p,DIRTY:m,OK:g,isAborted:v,isDirty:y,isValid:_,isAsync:w,get util(){return ta},get objectUtil(){return to},ZodParsedType:i,getParsedType:s,ZodType:M,datetimeRegex:q,ZodString:V,ZodNumber:W,ZodBigInt:J,ZodBoolean:H,ZodDate:K,ZodSymbol:G,ZodUndefined:Y,ZodNull:X,ZodAny:Q,ZodUnknown:ee,ZodNever:et,ZodVoid:er,ZodArray:en,ZodObject:ei,ZodUnion:es,ZodDiscriminatedUnion:eo,ZodIntersection:eu,ZodTuple:ec,ZodRecord:el,ZodMap:ef,ZodSet:eh,ZodFunction:ed,ZodLazy:ep,ZodLiteral:em,ZodEnum:ev,ZodNativeEnum:ey,ZodPromise:e_,ZodEffects:ew,ZodTransformer:ew,ZodOptional:eb,ZodNullable:ex,ZodDefault:eN,ZodCatch:eE,ZodNaN:ek,BRAND:eM,ZodBranded:eO,ZodPipeline:eS,ZodReadonly:eA,custom:eC,Schema:M,ZodSchema:M,late:ej,get ZodFirstPartyTypeKind(){return tf},coerce:{string:e=>V.create({...e,coerce:!0}),number:e=>W.create({...e,coerce:!0}),boolean:e=>H.create({...e,coerce:!0}),bigint:e=>J.create({...e,coerce:!0}),date:e=>K.create({...e,coerce:!0})},any:eL,array:eW,bigint:ez,boolean:eD,date:eP,discriminatedUnion:eG,effect:e8,enum:e5,function:e2,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>eC(t=>t instanceof e,t),intersection:eY,lazy:e9,literal:e4,map:e0,nan:eZ,nativeEnum:e3,never:eq,null:eB,nullable:te,number:eF,object:eJ,oboolean:()=>eD().optional(),onumber:()=>eF().optional(),optional:e6,ostring:()=>eI().optional(),pipeline:tr,preprocess:tt,promise:e7,record:eQ,set:e1,strictObject:eH,string:eI,symbol:eR,transformer:e8,tuple:eX,undefined:e$,union:eK,unknown:eU,void:eV,NEVER:p,ZodIssueCode:a,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:o})}}]);