diff --git a/DynamicBibleIonic/.editorconfig b/DynamicBibleIonic/.editorconfig index 51873bc7..ed414d74 100644 --- a/DynamicBibleIonic/.editorconfig +++ b/DynamicBibleIonic/.editorconfig @@ -5,7 +5,7 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 # We recommend you to keep these unchanged end_of_line = lf diff --git a/DynamicBibleIonic/DynamicBibleIonic.njsproj b/DynamicBibleIonic/DynamicBibleIonic.njsproj index 772dfdf7..9a713375 100644 --- a/DynamicBibleIonic/DynamicBibleIonic.njsproj +++ b/DynamicBibleIonic/DynamicBibleIonic.njsproj @@ -36,9 +36,14 @@ - + + + + + + @@ -51,6 +56,10 @@ + + + + @@ -72,11 +81,10 @@ - - - + + diff --git a/DynamicBibleIonic/package.json b/DynamicBibleIonic/package.json index 6f60c7d3..dfa72658 100644 --- a/DynamicBibleIonic/package.json +++ b/DynamicBibleIonic/package.json @@ -1,71 +1,75 @@ -{ - "version": "3.0.0", - "name": "dynamicbible", - "author": "Jason Wall", - "homepage": "http://dynamicbible.com/", - "private": true, - "config": { - "ionic_source_map": "source-map" - }, - "scripts": { - "clean": "ionic-app-scripts clean", - "build": "ionic-app-scripts build", - "ionic:build": "ionic-app-scripts build", - "ionic:serve": "ionic-app-scripts serve", - "start": "ionic serve", - "lab": "ionic serve --lab", - "test": "ng test", - "test-coverage": "ng test --code-coverage" - }, - "dependencies": { - "@angular/common": "2.2.1", - "@angular/compiler": "2.2.1", - "@angular/compiler-cli": "2.2.1", - "@angular/core": "2.2.1", - "@angular/forms": "2.2.1", - "@angular/http": "2.2.1", - "@angular/platform-browser": "2.2.1", - "@angular/platform-browser-dynamic": "2.2.1", - "@angular/platform-server": "2.2.1", - "@ionic/storage": "1.1.7", - "@types/jasmine": "^2.5.38", - "ionic-angular": "2.0.0", - "ionic-native": "2.2.11", - "ionicons": "3.0.0", - "rxjs": "5.0.0-beta.12", - "sw-toolbox": "3.4.0", - "zone.js": "0.6.26" - }, - "devDependencies": { - "@ionic/app-scripts": "1.0.0", - "@types/jasmine": "2.5.38", - "@types/node": "6.0.42", - "angular-cli": "1.0.0-beta.24", - "codecov": "1.0.1", - "jasmine-core": "2.5.2", - "jasmine-spec-reporter": "2.7.0", - "karma": "1.3.0", - "karma-chrome-launcher": "2.0.0", - "karma-cli": "1.0.1", - "karma-jasmine": "1.1.0", - "karma-mocha-reporter": "2.2.1", - "karma-remap-istanbul": "0.2.2", - "protractor": "4.0.13", - "protractor-jasmine2-screenshot-reporter": "0.3.2", - "ts-node": "1.7.2", - "tslint": "4.1.1", - "tslint-eslint-rules": "3.2.0", - "typescript": "2.0.9" - }, - "cordovaPlugins": [ - "cordova-plugin-whitelist", - "cordova-plugin-statusbar", - "cordova-plugin-console", - "cordova-plugin-device", - "cordova-plugin-splashscreen", - "ionic-plugin-keyboard" - ], - "cordovaPlatforms": [], - "description": "Dynamic Bible: A bible made for studying scripture" -, "-vs-binding":{"AfterBuild":["ionic:serve"]} -} +{ + "version": "3.0.0", + "name": "dynamicbible", + "author": "Jason Wall", + "homepage": "http://dynamicbible.com/", + "private": true, + "config": { + "ionic_source_map": "source-map" + }, + "scripts": { + "clean": "ionic-app-scripts clean", + "build": "ionic-app-scripts build", + "ionic:build": "ionic-app-scripts build", + "ionic:serve": "ionic-app-scripts serve", + "start": "ionic serve", + "lab": "ionic serve --lab", + "test": "ng test", + "test-coverage": "ng test --code-coverage" + }, + "dependencies": { + "@angular/common": "2.2.1", + "@angular/compiler": "2.2.1", + "@angular/compiler-cli": "2.2.1", + "@angular/core": "2.2.1", + "@angular/forms": "2.2.1", + "@angular/http": "2.2.1", + "@angular/platform-browser": "2.2.1", + "@angular/platform-browser-dynamic": "2.2.1", + "@angular/platform-server": "2.2.1", + "@ionic/storage": "1.1.7", + "@types/jasmine": "^2.5.38", + "ionic-angular": "2.0.0", + "ionic-native": "2.2.11", + "ionicons": "3.0.0", + "rxjs": "5.0.0-beta.12", + "sw-toolbox": "3.4.0", + "zone.js": "0.6.26" + }, + "devDependencies": { + "@ionic/app-scripts": "1.0.0", + "@types/jasmine": "2.5.38", + "@types/node": "6.0.42", + "angular-cli": "1.0.0-beta.24", + "codecov": "1.0.1", + "jasmine-core": "2.5.2", + "jasmine-spec-reporter": "2.7.0", + "karma": "1.3.0", + "karma-chrome-launcher": "2.0.0", + "karma-cli": "1.0.1", + "karma-jasmine": "1.1.0", + "karma-mocha-reporter": "2.2.1", + "karma-remap-istanbul": "0.2.2", + "protractor": "4.0.13", + "protractor-jasmine2-screenshot-reporter": "0.3.2", + "ts-node": "1.7.2", + "tslint": "4.1.1", + "tslint-eslint-rules": "3.2.0", + "typescript": "2.0.9" + }, + "cordovaPlugins": [ + "cordova-plugin-whitelist", + "cordova-plugin-statusbar", + "cordova-plugin-console", + "cordova-plugin-device", + "cordova-plugin-splashscreen", + "ionic-plugin-keyboard" + ], + "cordovaPlatforms": [], + "description": "Dynamic Bible: A bible made for studying scripture", + "-vs-binding": { + "AfterBuild": [ + "ionic:serve" + ] + } +} diff --git a/DynamicBibleIonic/src/components/passage/passage.html b/DynamicBibleIonic/src/components/passage/passage.html index 9f65ebb1..6a1e997a 100644 --- a/DynamicBibleIonic/src/components/passage/passage.html +++ b/DynamicBibleIonic/src/components/passage/passage.html @@ -1,4 +1,4 @@ - + Error:{{data.ref}} \ No newline at end of file + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DynamicBibleIonic/src/components/passage/passage.scss b/DynamicBibleIonic/src/components/passage/passage.scss index 480e2edd..2580672a 100644 --- a/DynamicBibleIonic/src/components/passage/passage.scss +++ b/DynamicBibleIonic/src/components/passage/passage.scss @@ -15,6 +15,12 @@ passage .passage-text { padding-top: 12px; } +passage { + .col-fixed { + width: 120px; + } +} + @media screen and (min-width: 800px) { passage .passage-text { -webkit-column-count: 2; /* Chrome, Safari, Opera */ diff --git a/DynamicBibleIonic/src/components/passage/passage.ts b/DynamicBibleIonic/src/components/passage/passage.ts index 44e29984..8f3d9a34 100644 --- a/DynamicBibleIonic/src/components/passage/passage.ts +++ b/DynamicBibleIonic/src/components/passage/passage.ts @@ -1,11 +1,11 @@ -import { Component, EventEmitter, Output, Input, OnInit, ElementRef } from "@angular/core"; -import { OpenData, CardItem } from "../../pages/search/search"; +import { Component, EventEmitter, Output, Input, OnInit, ElementRef } from '@angular/core'; +import { OpenData, CardItem } from '../../pages/search/search'; import { BiblePassageResult, BibleService } from '../../services/bible-service'; import { Reference } from '../../libs/Reference'; @Component({ - selector: "passage", - templateUrl: "passage.html", + selector: 'passage', + templateUrl: 'passage.html', providers: [BibleService] }) export class Passage implements OnInit @@ -22,15 +22,16 @@ export class Passage implements OnInit versesOnNewLine: boolean; data: BiblePassageResult; + ref: Reference; constructor(private bibleService: BibleService, private elementRef: ElementRef) { } ngOnInit(): void - { - let myref = new Reference(this.cardItem.qry); - this.bibleService.getResultAsPromise(myref.Section).then(data => this.data = data); + { + this.ref = new Reference(this.cardItem.qry); + this.bibleService.getResultAsPromise(this.ref.Section).then(data => this.data = data); } close() @@ -42,7 +43,7 @@ export class Passage implements OnInit fill: 'forwards', duration: d, iterations: 1, - easing: 'ease-in-out', + easing: 'ease-in-out' }); setTimeout(() => { @@ -50,6 +51,75 @@ export class Passage implements OnInit }, d); } + next() + { + this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) + 1).toString(); + this.ref.Section.start.verse = '1'; + this.ref.Section.end.chapter = this.ref.Section.start.chapter; + this.ref.Section.end.verse = '*'; + + this.bibleService.getResultAsPromise(this.ref.Section).then(data => + { + this.data = data; + this.cardItem.qry = data.ref; + this.ref = new Reference(data.ref); + }); + } + + prev() + { + this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) - 1).toString(); + this.ref.Section.start.verse = '1'; + this.ref.Section.end.chapter = this.ref.Section.start.chapter; + this.ref.Section.end.verse = '*'; + + this.bibleService.getResultAsPromise(this.ref.Section).then(data => + { + this.data = data; + this.cardItem.qry = data.ref; + this.ref = new Reference(data.ref); + }); + } + + expand() + { + // if your verse is at the beginning, to go the prev chapter and add 3 verses from that + if (parseInt(this.ref.Section.start.verse) < 3) + { + this.ref.Section.start.chapter = (parseInt(this.ref.Section.start.chapter) - 1).toString(); + this.ref.Section.start.verse = '*-' + (3 - parseInt(this.ref.Section.start.verse)); + if (this.ref.Section.start.chapter === '0') + { + this.ref.Section.start.chapter = '1'; + this.ref.Section.start.verse = '1'; + } + } + else // or go back 3 verses + this.ref.Section.start.verse = (parseInt(this.ref.Section.start.verse) - 3).toString(); + + // if your verse is at the end, go to the next chapter + if (this.ref.Section.end.verse === '*' || parseInt(this.ref.Section.end.verse) + 3 > this.data.lastverse) + { + this.ref.Section.end.chapter = (parseInt(this.ref.Section.end.chapter) + 1).toString(); + this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3 - this.data.lastverse).toString(); + + if (this.ref.Section.end.chapter === (this.ref.Section.end.lastchapter + 1).toString()) + { + this.ref.Section.end.chapter = this.ref.Section.end.lastchapter.toString(); + this.ref.Section.end.verse = this.data.lastverse.toString(); + } + } + else // or add 3 verses + this.ref.Section.end.verse = (parseInt(this.ref.Section.end.verse) + 3).toString(); + + this.bibleService.getResultAsPromise(this.ref.Section).then(data => + { + this.data = data; + this.cardItem.qry = data.ref; + this.ref = new Reference(data.ref); + }); + } + openStrongs(strongs: string) { this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs, from_search_bar: false }); @@ -61,6 +131,6 @@ export class Passage implements OnInit isPunct(c: string) { - return new RegExp('^[\.\,\;\:\?\!]$').test(c) + return new RegExp('^[\.\,\;\:\?\!]$').test(c); } } \ No newline at end of file diff --git a/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts b/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts index 1b7e5a36..d996cc02 100644 --- a/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts +++ b/DynamicBibleIonic/src/components/strongs-modal/strongs-modal.ts @@ -1,4 +1,4 @@ -import { EventEmitter, Component, Output, OnInit } from "@angular/core"; +import { EventEmitter, Component, Output, OnInit } from "@angular/core"; import { Platform, NavParams, ViewController } from 'ionic-angular'; import { Reference } from '../../libs/Reference'; import { StrongsResult, StrongsService } from '../../services/strongs-service'; @@ -28,7 +28,7 @@ export class StrongsModal implements OnInit this.onItemClicked.subscribe(item => { let pg = this.params.get('onItemClicked'); - pg.updateUIwithItems(item, false) + pg.updateUIwithItems(item, false); }); } diff --git a/DynamicBibleIonic/src/components/words/words.ts b/DynamicBibleIonic/src/components/words/words.ts index 14a78e69..d17953fc 100644 --- a/DynamicBibleIonic/src/components/words/words.ts +++ b/DynamicBibleIonic/src/components/words/words.ts @@ -1,4 +1,4 @@ -/// +/// import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked, OnInit, ElementRef } from "@angular/core"; import { Reference } from '../../libs/Reference'; import { OpenData, CardItem } from "../../pages/search/search"; diff --git a/DynamicBibleIonic/src/libs/Reference.ts b/DynamicBibleIonic/src/libs/Reference.ts index 78e83a31..499a7810 100644 --- a/DynamicBibleIonic/src/libs/Reference.ts +++ b/DynamicBibleIonic/src/libs/Reference.ts @@ -1,4 +1,4 @@ -// This code was written by Jeremy and Jason Wall. +// This code was written by Jeremy and Jason Wall. // Feel free to use, and if you can, include a link back to www.walljm.com // Jason@walljm.com // www.walljm.com // Jeremy@marzhillstudios.com // jeremy.marzhillstudios.com @@ -7,17 +7,17 @@ class StringUtils { public static trim(str: string): string { - return str.replace(/^\s+|\s+$/g, ""); + return str.replace(/^\s+|\s+$/g, ''); } public static ltrim(str: string): string { - return str.replace(/^\s+/, ""); + return str.replace(/^\s+/, ''); } public static rtrim(str: string): string { - return str.replace(/\s+$/, ""); + return str.replace(/\s+$/, ''); } } @@ -33,25 +33,25 @@ export class Reference this.Section = { start: { book: -1, - bookname: "", - longbookname: "", + bookname: '', + longbookname: '', lastchapter: -1, - chapter: "", - verse: "" + chapter: '', + verse: '' }, end: { book: -1, - bookname: "", - longbookname: "", + bookname: '', + longbookname: '', lastchapter: -1, - chapter: "", - verse: "" + chapter: '', + verse: '' } }; this.ref = reference.toLowerCase().trim(); this.parseReference(); - if (this.Section.end.book == -1) + if (this.Section.end.book === -1) { this.Section.end.book = this.Section.start.book; this.Section.end.bookname = this.Section.start.bookname; @@ -59,24 +59,24 @@ export class Reference this.Section.end.lastchapter = this.Section.start.lastchapter; } - if (this.Section.end.chapter == "") this.Section.end.chapter = this.Section.start.chapter; + if (this.Section.end.chapter === '') this.Section.end.chapter = this.Section.start.chapter; if ( Number(this.Section.start.verse) > Number(this.Section.end.verse) && - this.Section.start.chapter == this.Section.end.chapter && - this.Section.start.book == this.Section.end.book + this.Section.start.chapter === this.Section.end.chapter && + this.Section.start.book === this.Section.end.book ) this.Section.end.verse = this.Section.start.verse; - if (this.Section.start.verse == "") this.Section.start.verse = "1"; - if (this.Section.end.verse == "") this.Section.end.verse = "*"; + if (this.Section.start.verse === '') this.Section.start.verse = '1'; + if (this.Section.end.verse === '') this.Section.end.verse = '*'; } private parseReference() { this.parseBook(false); this.parseFirstNum(false); - let foundFirstVerse = this.ref.search(/:.*-/) != -1; + let foundFirstVerse = this.ref.search(/:.*-/) !== -1; this.maybeParseSecondNum(false); this.maybeParseRangeSep(); - let foundSecondBook = this.ref.search(/\w\s+\d/i) != -1; + let foundSecondBook = this.ref.search(/\w\s+\d/i) !== -1; this.maybeParseBook(true); this.maybeParseFirstNumOrVerse(foundSecondBook, foundFirstVerse, true); @@ -106,22 +106,22 @@ export class Reference { let c = this.ref.charAt(i); // Grab characters until we hit a non digit. - if ("0".charAt(0) <= c && c <= "9".charAt(0)) + if ('0'.charAt(0) <= c && c <= '9'.charAt(0)) { found = true; thing.chapter = thing.chapter.concat(c); - } + } else { // if the chapter is longer than 3 digits it's an error if (thing.chapter.length > 3) { - this.errAcc = "Chapter too long\"" + thing.chapter + "\"."; + this.errAcc = 'Chapter too long"' + thing.chapter + '".'; return; - } + } else if (!found) { - this.errAcc = "No chapter found" + this.ref; + this.errAcc = 'No chapter found' + this.ref; } this.ref = this.ref.slice(i); return; @@ -137,32 +137,32 @@ export class Reference this.ref = StringUtils.ltrim(this.ref.toLowerCase()); if (!skipColon) { - if (this.ref[0] != ":") + if (this.ref[0] !== ':') { return; } this.ref = this.ref.slice(1); } this.ref = StringUtils.ltrim(this.ref.toLowerCase()); - if (this.ref[0] == "*") + if (this.ref[0] === '*') { - thing.verse = "*"; + thing.verse = '*'; this.ref = this.ref.slice(1); return; } for (var i = 0; i <= this.ref.length; i++) { let c = this.ref.charAt(i); - if ("0".charAt(0) <= c && c <= "9".charAt(0)) + if ('0'.charAt(0) <= c && c <= '9'.charAt(0)) { thing.verse = thing.verse.concat(c); - } + } else { if (thing.verse.length > 3) { - this.errAcc = "Verse too long \"" + thing.verse + "\"."; - return ""; + this.errAcc = 'Verse too long "' + thing.verse + '".'; + return; } this.ref = this.ref.slice(i); return; @@ -174,7 +174,7 @@ export class Reference { return this.maybeDo(() => { - if (this.ref.search(/\w\s+\d/i) == -1) + if (this.ref.search(/\w\s+\d/i) === -1) { this.Section.end.book = this.Section.start.book; this.Section.end.bookname = this.Section.start.bookname; @@ -183,7 +183,7 @@ export class Reference } else { - this.parseBook(isEnd) + this.parseBook(isEnd); } }); }; @@ -201,9 +201,9 @@ export class Reference let self = this; return this.maybeDo(() => { - if (self.Section.end.book == self.Section.start.book) + if (self.Section.end.book === self.Section.start.book) { - if (self.ref.search(/:/) != -1 || foundSecondBook || !foundFirstVerse) + if (self.ref.search(/:/) !== -1 || foundSecondBook || !foundFirstVerse) { self.parseFirstNum(isEnd); } @@ -217,7 +217,7 @@ export class Reference let self = this; return this.maybeDo(() => { - if (self.ref[0] == "-") + if (self.ref[0] === '-') { self.ref = StringUtils.ltrim(self.ref.slice(1)); } @@ -228,7 +228,7 @@ export class Reference { let func = f; this.ref = StringUtils.ltrim(this.ref.toLowerCase()); - if (this.ref != "") + if (this.ref !== '') { func(); } @@ -244,472 +244,472 @@ export class Reference { let thing = { book: 0, - bookname: "", - longbookname: "", + bookname: '', + longbookname: '', lastchapter: 0, - chapter: "", - verse: "" + chapter: '', + verse: '' }; - if (fbook.search(/\b(genesis|gen|ge|gn)\b/i) != -1) + if (fbook.search(/\b(genesis|gen|ge|gn)\b/i) !== -1) { thing.book = 1; - thing.bookname = "Genesis"; - thing.longbookname = "Genesis"; + thing.bookname = 'Genesis'; + thing.longbookname = 'Genesis'; thing.lastchapter = 50; } - if (fbook.search(/\b(exodus|ex|exo|exod|exd)\b/i) != -1) + if (fbook.search(/\b(exodus|ex|exo|exod|exd)\b/i) !== -1) { thing.book = 2; - thing.bookname = "Exodus"; - thing.longbookname = "Exodus"; + thing.bookname = 'Exodus'; + thing.longbookname = 'Exodus'; thing.lastchapter = 40; } - if (fbook.search(/\b(leviticus|lev|le|levi|lv)\b/i) != -1) + if (fbook.search(/\b(leviticus|lev|le|levi|lv)\b/i) !== -1) { thing.book = 3; - thing.bookname = "Leviticus"; - thing.longbookname = "Leviticus"; + thing.bookname = 'Leviticus'; + thing.longbookname = 'Leviticus'; thing.lastchapter = 27; } - if (fbook.search(/\b(numbers|num|nu|numb|number)\b/i) != -1) + if (fbook.search(/\b(numbers|num|nu|numb|number)\b/i) !== -1) { thing.book = 4; - thing.bookname = "Numbers"; - thing.longbookname = "Book_of_Numbers"; + thing.bookname = 'Numbers'; + thing.longbookname = 'Book_of_Numbers'; thing.lastchapter = 36; } - if (fbook.search(/\b(deuteronomy|deut|de|dt|deu)\b/i) != -1) + if (fbook.search(/\b(deuteronomy|deut|de|dt|deu)\b/i) !== -1) { thing.book = 5; - thing.bookname = "Deuteronomy"; - thing.longbookname = "Deuteronomy"; + thing.bookname = 'Deuteronomy'; + thing.longbookname = 'Deuteronomy'; thing.lastchapter = 34; } - if (fbook.search(/\b(joshua|josh|jos)\b/i) != -1) + if (fbook.search(/\b(joshua|josh|jos)\b/i) !== -1) { thing.book = 6; - thing.bookname = "Joshua"; - thing.longbookname = "Book_of_Joshua"; + thing.bookname = 'Joshua'; + thing.longbookname = 'Book_of_Joshua'; thing.lastchapter = 24; } - if (fbook.search(/\b(judges|jud|jdg|judg)\b/i) != -1) + if (fbook.search(/\b(judges|jud|jdg|judg)\b/i) !== -1) { thing.book = 7; - thing.bookname = "Judges"; - thing.longbookname = "Book_of_Judges"; + thing.bookname = 'Judges'; + thing.longbookname = 'Book_of_Judges'; thing.lastchapter = 21; } - if (fbook.search(/\b(ruth|ru)\b/i) != -1) + if (fbook.search(/\b(ruth|ru)\b/i) !== -1) { thing.book = 8; - thing.bookname = "Ruth"; - thing.longbookname = "Book_of_Ruth"; + thing.bookname = 'Ruth'; + thing.longbookname = 'Book_of_Ruth'; thing.lastchapter = 4; } - if (fbook.search(/\b(1|i|1st|first)\s*(samuel|sa|sam|sml)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(samuel|sa|sam|sml)\b/i) !== -1) { thing.book = 9; - thing.bookname = "1 Samuel"; - thing.longbookname = "First_Samuel"; + thing.bookname = '1 Samuel'; + thing.longbookname = 'First_Samuel'; thing.lastchapter = 31; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(samuel|sa|sam|sml)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(samuel|sa|sam|sml)\b/i) !== -1) { thing.book = 10; - thing.bookname = "2 Samuel"; - thing.longbookname = "Second_Samuel"; + thing.bookname = '2 Samuel'; + thing.longbookname = 'Second_Samuel'; thing.lastchapter = 24; } - if (fbook.search(/\b(1|i|1st|first)\s*(kings|king|kgs|kn|k|ki)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(kings|king|kgs|kn|k|ki)\b/i) !== -1) { thing.book = 11; - thing.bookname = "1 Kings"; - thing.longbookname = "First_Kings"; + thing.bookname = '1 Kings'; + thing.longbookname = 'First_Kings'; thing.lastchapter = 22; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(kings|king|kgs|kn|k|ki)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(kings|king|kgs|kn|k|ki)\b/i) !== -1) { thing.book = 12; - thing.bookname = "2 Kings"; - thing.longbookname = "Second_Kings"; + thing.bookname = '2 Kings'; + thing.longbookname = 'Second_Kings'; thing.lastchapter = 25; } - if (fbook.search(/\b(1|i|1st|first)\s*(chronicles|chron|ch|chr)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(chronicles|chron|ch|chr)\b/i) !== -1) { thing.book = 13; - thing.bookname = "1 Chronicles"; - thing.longbookname = "First_Chronicles"; + thing.bookname = '1 Chronicles'; + thing.longbookname = 'First_Chronicles'; thing.lastchapter = 29; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(chronicles|chron|ch|chr)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(chronicles|chron|ch|chr)\b/i) !== -1) { thing.book = 14; - thing.bookname = "2 Chronicles"; - thing.longbookname = "Second_Chronicles"; + thing.bookname = '2 Chronicles'; + thing.longbookname = 'Second_Chronicles'; thing.lastchapter = 36; } - if (fbook.search(/\b(ezra|ezr)\b/i) != -1) + if (fbook.search(/\b(ezra|ezr)\b/i) !== -1) { thing.book = 15; - thing.bookname = "Ezra"; - thing.longbookname = "Book_of_Ezra"; + thing.bookname = 'Ezra'; + thing.longbookname = 'Book_of_Ezra'; thing.lastchapter = 10; } - if (fbook.search(/\b(nehemiah|neh|ne|nehamiah)\b/i) != -1) + if (fbook.search(/\b(nehemiah|neh|ne|nehamiah)\b/i) !== -1) { thing.book = 16; - thing.bookname = "Nehemiah"; - thing.longbookname = "Book_of_Nehemiah"; + thing.bookname = 'Nehemiah'; + thing.longbookname = 'Book_of_Nehemiah'; thing.lastchapter = 13; } - if (fbook.search(/\b(esther|est|es|esth)\b/i) != -1) + if (fbook.search(/\b(esther|est|es|esth)\b/i) !== -1) { thing.book = 17; - thing.bookname = "Esther"; - thing.longbookname = "Book_of_Esther"; + thing.bookname = 'Esther'; + thing.longbookname = 'Book_of_Esther'; thing.lastchapter = 10; } - if (fbook.search(/\b(job|jo|jb)\b/i) != -1) + if (fbook.search(/\b(job|jo|jb)\b/i) !== -1) { thing.book = 18; - thing.bookname = "Job"; - thing.longbookname = "Book_of_Job"; + thing.bookname = 'Job'; + thing.longbookname = 'Book_of_Job'; thing.lastchapter = 42; } - if (fbook.search(/\b(psalms|ps|psa|psalm|psm)\b/i) != -1) + if (fbook.search(/\b(psalms|ps|psa|psalm|psm)\b/i) !== -1) { thing.book = 19; - thing.bookname = "Psalm"; - thing.longbookname = "Psalm"; + thing.bookname = 'Psalm'; + thing.longbookname = 'Psalm'; thing.lastchapter = 150; } - if (fbook.search(/\b(proverbs|prov|pr|pro|proverb|prv|prvbs)\b/i) != -1) + if (fbook.search(/\b(proverbs|prov|pr|pro|proverb|prv|prvbs)\b/i) !== -1) { thing.book = 20; - thing.bookname = "Proverbs"; - thing.longbookname = "Book_of_Proverbs"; + thing.bookname = 'Proverbs'; + thing.longbookname = 'Book_of_Proverbs'; thing.lastchapter = 31; } - if (fbook.search(/\b(ecclesiastes|eccl|ecc|eccles|ec|ecl|ecclesiaste)\b/i) != -1) + if (fbook.search(/\b(ecclesiastes|eccl|ecc|eccles|ec|ecl|ecclesiaste)\b/i) !== -1) { thing.book = 21; - thing.bookname = "Ecclesiastes"; - thing.longbookname = "Ecclesiastes"; + thing.bookname = 'Ecclesiastes'; + thing.longbookname = 'Ecclesiastes'; thing.lastchapter = 12; } - if (fbook.search(/\b(song\sof\ssolomon|song\sof\ssongs|sos|ss|son|so|song|songs)\b/i) != -1) + if (fbook.search(/\b(song\sof\ssolomon|song\sof\ssongs|sos|ss|son|so|song|songs)\b/i) !== -1) { thing.book = 22; - thing.bookname = "Song of Solomon"; - thing.longbookname = "Song_of_Solomon"; + thing.bookname = 'Song of Solomon'; + thing.longbookname = 'Song_of_Solomon'; thing.lastchapter = 8; } - if (fbook.search(/\b(isaiah|is|isah|isai|ia)\b/i) != -1) + if (fbook.search(/\b(isaiah|is|isah|isai|ia)\b/i) !== -1) { thing.book = 23; - thing.bookname = "Isaiah"; - thing.longbookname = "Book_of_Isaiah"; + thing.bookname = 'Isaiah'; + thing.longbookname = 'Book_of_Isaiah'; thing.lastchapter = 66; } - if (fbook.search(/\b(jerimiah|jeremiah|jer|je|jere)\b/i) != -1) + if (fbook.search(/\b(jerimiah|jeremiah|jer|je|jere)\b/i) !== -1) { thing.book = 24; - thing.bookname = "Jeremiah"; - thing.longbookname = "Book_of_Jeremiah"; + thing.bookname = 'Jeremiah'; + thing.longbookname = 'Book_of_Jeremiah'; thing.lastchapter = 52; } - if (fbook.search(/\b(lamentations|lam|la|lamentation)\b/i) != -1) + if (fbook.search(/\b(lamentations|lam|la|lamentation)\b/i) !== -1) { thing.book = 25; - thing.bookname = "Lamentations"; - thing.longbookname = "Book_of_Lamentations"; + thing.bookname = 'Lamentations'; + thing.longbookname = 'Book_of_Lamentations'; thing.lastchapter = 5; } - if (fbook.search(/\b(ezekiel|eze|ezk|ezek)\b/i) != -1) + if (fbook.search(/\b(ezekiel|eze|ezk|ezek)\b/i) !== -1) { thing.book = 26; - thing.bookname = "Ezekiel"; - thing.longbookname = "Book_of_Ezekiel"; + thing.bookname = 'Ezekiel'; + thing.longbookname = 'Book_of_Ezekiel'; thing.lastchapter = 48; } - if (fbook.search(/\b(daniel|dan|dn|dl|da)\b/i) != -1) + if (fbook.search(/\b(daniel|dan|dn|dl|da)\b/i) !== -1) { thing.book = 27; - thing.bookname = "Daniel"; - thing.longbookname = "Book_of_Daniel"; + thing.bookname = 'Daniel'; + thing.longbookname = 'Book_of_Daniel'; thing.lastchapter = 12; } - if (fbook.search(/\b(hosea|hos|ho)\b/i) != -1) + if (fbook.search(/\b(hosea|hos|ho)\b/i) !== -1) { thing.book = 28; - thing.bookname = "Hosea"; - thing.longbookname = "Book_of_Hosea"; + thing.bookname = 'Hosea'; + thing.longbookname = 'Book_of_Hosea'; thing.lastchapter = 14; } - if (fbook.search(/\b(joel|joe|jl)\b/i) != -1) + if (fbook.search(/\b(joel|joe|jl)\b/i) !== -1) { thing.book = 29; - thing.bookname = "Joel"; - thing.longbookname = "Book_of_Joel"; + thing.bookname = 'Joel'; + thing.longbookname = 'Book_of_Joel'; thing.lastchapter = 3; } - if (fbook.search(/\b(amos|am|amo)\b/i) != -1) + if (fbook.search(/\b(amos|am|amo)\b/i) !== -1) { thing.book = 30; - thing.bookname = "Amos"; - thing.longbookname = "Book_of_Amos"; + thing.bookname = 'Amos'; + thing.longbookname = 'Book_of_Amos'; thing.lastchapter = 9; } - if (fbook.search(/\b(obadiah|oba|ob|obad)\b/i) != -1) + if (fbook.search(/\b(obadiah|oba|ob|obad)\b/i) !== -1) { thing.book = 31; - thing.bookname = "Obadiah"; - thing.longbookname = "Book_of_Obadiah"; + thing.bookname = 'Obadiah'; + thing.longbookname = 'Book_of_Obadiah'; thing.lastchapter = 1; } - if (fbook.search(/\b(jonah|jnh|jon)\b/i) != -1) + if (fbook.search(/\b(jonah|jnh|jon)\b/i) !== -1) { thing.book = 32; - thing.bookname = "Jonah"; - thing.longbookname = "Book_of_Jonah"; + thing.bookname = 'Jonah'; + thing.longbookname = 'Book_of_Jonah'; thing.lastchapter = 4; } - if (fbook.search(/\b(micah|mic|mi)\b/i) != -1) + if (fbook.search(/\b(micah|mic|mi)\b/i) !== -1) { thing.book = 33; - thing.bookname = "Micah"; - thing.longbookname = "Book_of_Micah"; + thing.bookname = 'Micah'; + thing.longbookname = 'Book_of_Micah'; thing.lastchapter = 7; } - if (fbook.search(/\b(nahum|nah|na)\b/i) != -1) + if (fbook.search(/\b(nahum|nah|na)\b/i) !== -1) { thing.book = 34; - thing.bookname = "Nahum"; - thing.longbookname = "Book_of_Nahum"; + thing.bookname = 'Nahum'; + thing.longbookname = 'Book_of_Nahum'; thing.lastchapter = 3; } - if (fbook.search(/\b(habakkuk|hab|ha|habakuk)\b/i) != -1) + if (fbook.search(/\b(habakkuk|hab|ha|habakuk)\b/i) !== -1) { thing.book = 35; - thing.bookname = "Habakkuk"; - thing.longbookname = "Book_of_Habakkuk"; + thing.bookname = 'Habakkuk'; + thing.longbookname = 'Book_of_Habakkuk'; thing.lastchapter = 3; } - if (fbook.search(/\b(zephaniah|zeph|zep)\b/i) != -1) + if (fbook.search(/\b(zephaniah|zeph|zep)\b/i) !== -1) { thing.book = 36; - thing.bookname = "Zephaniah"; - thing.longbookname = "Book_of_Zephaniah"; + thing.bookname = 'Zephaniah'; + thing.longbookname = 'Book_of_Zephaniah'; thing.lastchapter = 3; } - if (fbook.search(/\b(haggia|hag|hg|haggai)\b/i) != -1) + if (fbook.search(/\b(haggia|hag|hg|haggai)\b/i) !== -1) { thing.book = 37; - thing.bookname = "Haggai"; - thing.longbookname = "Book_of_Haggai"; + thing.bookname = 'Haggai'; + thing.longbookname = 'Book_of_Haggai'; thing.lastchapter = 2; } - if (fbook.search(/\b(zechariah|zech|zch|zec)\b/i) != -1) + if (fbook.search(/\b(zechariah|zech|zch|zec)\b/i) !== -1) { thing.book = 38; - thing.bookname = "Zechariah"; - thing.longbookname = "Book_of_Zechariah"; + thing.bookname = 'Zechariah'; + thing.longbookname = 'Book_of_Zechariah'; thing.lastchapter = 14; } - if (fbook.search(/\b(malachi|mal)\b/i) != -1) + if (fbook.search(/\b(malachi|mal)\b/i) !== -1) { thing.book = 39; - thing.bookname = "Malachi"; - thing.longbookname = "Book_of_Malachi"; + thing.bookname = 'Malachi'; + thing.longbookname = 'Book_of_Malachi'; thing.lastchapter = 4; } - if (fbook.search(/\b(matthew|mt|matt|mat)\b/i) != -1) + if (fbook.search(/\b(matthew|mt|matt|mat)\b/i) !== -1) { thing.book = 40; - thing.bookname = "Matthew"; - thing.longbookname = "Gospel_of_Matthew"; + thing.bookname = 'Matthew'; + thing.longbookname = 'Gospel_of_Matthew'; thing.lastchapter = 28; } - if (fbook.search(/\b(mark|mrk|mk|mr)\b/i) != -1) + if (fbook.search(/\b(mark|mrk|mk|mr)\b/i) !== -1) { thing.book = 41; - thing.bookname = "Mark"; - thing.longbookname = "Gospel_of_Mark"; + thing.bookname = 'Mark'; + thing.longbookname = 'Gospel_of_Mark'; thing.lastchapter = 16; } - if (fbook.search(/\b(luke|lu|lke|luk|lk)\b/i) != -1) + if (fbook.search(/\b(luke|lu|lke|luk|lk)\b/i) !== -1) { thing.book = 42; - thing.bookname = "Luke"; - thing.longbookname = "Gospel_of_Luke"; + thing.bookname = 'Luke'; + thing.longbookname = 'Gospel_of_Luke'; thing.lastchapter = 24; } - if (fbook.search(/\b(john|jn|jhn)\b/i) != -1) + if (fbook.search(/\b(john|jn|jhn)\b/i) !== -1) { thing.book = 43; - thing.bookname = "John"; - thing.longbookname = "Gospel_of_John"; + thing.bookname = 'John'; + thing.longbookname = 'Gospel_of_John'; thing.lastchapter = 21; } - if (fbook.search(/\b(acts|ac|act)\b/i) != -1) + if (fbook.search(/\b(acts|ac|act)\b/i) !== -1) { thing.book = 44; - thing.bookname = "Acts"; - thing.longbookname = "Acts_of_the_Apostles"; + thing.bookname = 'Acts'; + thing.longbookname = 'Acts_of_the_Apostles'; thing.lastchapter = 28; } - if (fbook.search(/\b(romans|rom|ro|rm|roman)\b/i) != -1) + if (fbook.search(/\b(romans|rom|ro|rm|roman)\b/i) !== -1) { thing.book = 45; - thing.bookname = "Romans"; - thing.longbookname = "Epistle_to_the_Romans"; + thing.bookname = 'Romans'; + thing.longbookname = 'Epistle_to_the_Romans'; thing.lastchapter = 16; } - if (fbook.search(/\b(1|i|1st|first)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) !== -1) { thing.book = 46; - thing.bookname = "1 Corinthians"; - thing.longbookname = "First_Epistle_to_the_Corinthians"; + thing.bookname = '1 Corinthians'; + thing.longbookname = 'First_Epistle_to_the_Corinthians'; thing.lastchapter = 16; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) !== -1) { thing.book = 47; - thing.bookname = "2 Corinthians"; - thing.longbookname = "Second_Epistle_to_the_Corinthians"; + thing.bookname = '2 Corinthians'; + thing.longbookname = 'Second_Epistle_to_the_Corinthians'; thing.lastchapter = 13; } - if (fbook.search(/\b(galatians|galatian|galations|gal|ga|gala|galation|galat)\b/i) != -1) + if (fbook.search(/\b(galatians|galatian|galations|gal|ga|gala|galation|galat)\b/i) !== -1) { thing.book = 48; - thing.bookname = "Galatians"; - thing.longbookname = "Epistle_to_the_Galatians"; + thing.bookname = 'Galatians'; + thing.longbookname = 'Epistle_to_the_Galatians'; thing.lastchapter = 6; } - if (fbook.search(/\b(ephesians|eph|ep|ephes|ephe|ephs)\b/i) != -1) + if (fbook.search(/\b(ephesians|eph|ep|ephes|ephe|ephs)\b/i) !== -1) { thing.book = 49; - thing.bookname = "Ephesians"; - thing.longbookname = "Epistle_to_the_Ephesians"; + thing.bookname = 'Ephesians'; + thing.longbookname = 'Epistle_to_the_Ephesians'; thing.lastchapter = 6; } - if (fbook.search(/\b(philippians|phi|phil|ph|philip)\b/i) != -1) + if (fbook.search(/\b(philippians|phi|phil|ph|philip)\b/i) !== -1) { thing.book = 50; - thing.bookname = "Philippians"; - thing.longbookname = "Epistle_to_the_Philippians"; + thing.bookname = 'Philippians'; + thing.longbookname = 'Epistle_to_the_Philippians'; thing.lastchapter = 4; } - if (fbook.search(/\b(colossians|col|co|colossian|colos|coloss)\b/i) != -1) + if (fbook.search(/\b(colossians|col|co|colossian|colos|coloss)\b/i) !== -1) { thing.book = 51; - thing.bookname = "Colossians"; - thing.longbookname = "Epistle_to_the_Colossians"; + thing.bookname = 'Colossians'; + thing.longbookname = 'Epistle_to_the_Colossians'; thing.lastchapter = 4; } - if (fbook.search(/\b(1|i|1st|first)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) !== -1) { thing.book = 52; - thing.bookname = "1 Thessalonians"; - thing.longbookname = "First_Epistle_to_the_Thessalonians"; + thing.bookname = '1 Thessalonians'; + thing.longbookname = 'First_Epistle_to_the_Thessalonians'; thing.lastchapter = 5; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) !== -1) { thing.book = 53; - thing.bookname = "2 Thessalonians"; - thing.longbookname = "Second_Epistle_to_the_Thessalonians"; + thing.bookname = '2 Thessalonians'; + thing.longbookname = 'Second_Epistle_to_the_Thessalonians'; thing.lastchapter = 3; } - if (fbook.search(/\b(1|i|1st|first)\s*(timothy|tim|ti|timoth|tm)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(timothy|tim|ti|timoth|tm)\b/i) !== -1) { thing.book = 54; - thing.bookname = "1 Timothy"; - thing.longbookname = "First_Epistle_to_Timothy"; + thing.bookname = '1 Timothy'; + thing.longbookname = 'First_Epistle_to_Timothy'; thing.lastchapter = 6; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(timothy|tim|timoth|tm)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(timothy|tim|timoth|tm)\b/i) !== -1) { thing.book = 55; - thing.bookname = "2 Timothy"; - thing.longbookname = "Second_Epistle_to_Timothy"; + thing.bookname = '2 Timothy'; + thing.longbookname = 'Second_Epistle_to_Timothy'; thing.lastchapter = 4; } - if (fbook.search(/\b(titus|tit)\b/i) != -1) + if (fbook.search(/\b(titus|tit)\b/i) !== -1) { thing.book = 56; - thing.bookname = "Titus"; - thing.longbookname = "Epistle_to_Titus"; + thing.bookname = 'Titus'; + thing.longbookname = 'Epistle_to_Titus'; thing.lastchapter = 3; } - if (fbook.search(/\b(philemon|phlmn|phl|phm|phile|philem)\b/i) != -1) + if (fbook.search(/\b(philemon|phlmn|phl|phm|phile|philem)\b/i) !== -1) { thing.book = 57; - thing.bookname = "Philemon"; - thing.longbookname = "Epistle_to_Philemon"; + thing.bookname = 'Philemon'; + thing.longbookname = 'Epistle_to_Philemon'; thing.lastchapter = 1; } - if (fbook.search(/\b(hebrews|heb|he|hebrew)\b/i) != -1) + if (fbook.search(/\b(hebrews|heb|he|hebrew)\b/i) !== -1) { thing.book = 58; - thing.bookname = "Hebrews"; - thing.longbookname = "Epistle_to_the_Hebrews"; + thing.bookname = 'Hebrews'; + thing.longbookname = 'Epistle_to_the_Hebrews'; thing.lastchapter = 13; } - if (fbook.search(/\b(james|jam|ja|jas|jms|jame|jm)\b/i) != -1) + if (fbook.search(/\b(james|jam|ja|jas|jms|jame|jm)\b/i) !== -1) { thing.book = 59; - thing.bookname = "James"; - thing.longbookname = "Epistle_of_James"; + thing.bookname = 'James'; + thing.longbookname = 'Epistle_of_James'; thing.lastchapter = 5; } - if (fbook.search(/\b(1|i|1st|first)\s*(peter|pe|pet|pete|pt|p)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(peter|pe|pet|pete|pt|p)\b/i) !== -1) { thing.book = 60; - thing.bookname = "1 Peter"; - thing.longbookname = "First_Epistle_of_Peter"; + thing.bookname = '1 Peter'; + thing.longbookname = 'First_Epistle_of_Peter'; thing.lastchapter = 5; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(peter|pe|pet|pete|pt|p)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(peter|pe|pet|pete|pt|p)\b/i) !== -1) { thing.book = 61; - thing.bookname = "2 Peter"; - thing.longbookname = "Second_Epistle_of_Peter"; + thing.bookname = '2 Peter'; + thing.longbookname = 'Second_Epistle_of_Peter'; thing.lastchapter = 3; } - if (fbook.search(/\b(1|i|1st|first)\s*(john|jn|jo)\b/i) != -1) + if (fbook.search(/\b(1|i|1st|first)\s*(john|jn|jo)\b/i) !== -1) { thing.book = 62; - thing.bookname = "1 John"; - thing.longbookname = "First_Epistle_of_John"; + thing.bookname = '1 John'; + thing.longbookname = 'First_Epistle_of_John'; thing.lastchapter = 5; } - if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(john|jn|jo)\b/i) != -1) + if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(john|jn|jo)\b/i) !== -1) { thing.book = 63; - thing.bookname = "2 John"; - thing.longbookname = "Second_Epistle_of_John"; + thing.bookname = '2 John'; + thing.longbookname = 'Second_Epistle_of_John'; thing.lastchapter = 1; } - if (fbook.search(/\b(3|iii|3rd|third)\s*(john|jn|jo)\b/i) != -1) + if (fbook.search(/\b(3|iii|3rd|third)\s*(john|jn|jo)\b/i) !== -1) { thing.book = 64; - thing.bookname = "3 John"; - thing.longbookname = "Third_Epistle_of_John"; + thing.bookname = '3 John'; + thing.longbookname = 'Third_Epistle_of_John'; thing.lastchapter = 1; } - if (fbook.search(/\b(jude|ju)\b/i) != -1) + if (fbook.search(/\b(jude|ju)\b/i) !== -1) { thing.book = 65; - thing.bookname = "Jude"; - thing.longbookname = "Epistle_of_Jude"; + thing.bookname = 'Jude'; + thing.longbookname = 'Epistle_of_Jude'; thing.lastchapter = 1; } - if (fbook.search(/\b(revelation|rev|re|revelations|rv)\b/i) != -1) + if (fbook.search(/\b(revelation|rev|re|revelations|rv)\b/i) !== -1) { thing.book = 66; - thing.bookname = "Revelation"; - thing.longbookname = "Book_of_Revelations"; + thing.bookname = 'Revelation'; + thing.longbookname = 'Book_of_Revelations'; thing.lastchapter = 22; } @@ -719,34 +719,34 @@ export class Reference public static toString(section: Section) { // get the starting book, chapter, verse - let ref = section.start.bookname.concat(" "). - concat(section.start.chapter).concat(":"). + let ref = section.start.bookname.concat(' '). + concat(section.start.chapter).concat(':'). concat(section.start.verse); - if (section.start.chapter == section.end.chapter && - section.start.verse == section.end.verse && - section.start.book == section.end.book) + if (section.start.chapter === section.end.chapter && + section.start.verse === section.end.verse && + section.start.book === section.end.book) { return ref; } - if (section.start.chapter == section.end.chapter && - section.start.verse != section.end.verse && - section.start.book == section.end.book) + if (section.start.chapter === section.end.chapter && + section.start.verse !== section.end.verse && + section.start.book === section.end.book) { - return ref.concat(" - ").concat(section.end.verse); + return ref.concat(' - ').concat(section.end.verse); } - if (section.start.book != section.end.book) + if (section.start.book !== section.end.book) { - ref = ref.concat(" - ").concat(section.end.bookname).concat(" "); + ref = ref.concat(' - ').concat(section.end.bookname).concat(' '); } else { - ref = ref.concat(" - "); + ref = ref.concat(' - '); } - ref = ref.concat(section.end.chapter).concat(":"); + ref = ref.concat(section.end.chapter).concat(':'); return ref.concat(section.end.verse); } @@ -754,79 +754,78 @@ export class Reference public static bookName(booknum: number): string { let book = new Array(); - book[0] = ""; - book[1] = "Genesis"; - book[2] = "Exodus"; - book[3] = "Leviticus"; - book[4] = "Numbers"; - book[5] = "Deuteronomy"; - book[6] = "Joshua"; - book[7] = "Judges"; - book[8] = "Ruth"; - book[9] = "1 Samuel"; - book[10] = "2 Samuel"; - book[11] = "1 Kings"; - book[12] = "2 Kings"; - book[13] = "1 Chronicles"; - book[14] = "2 Chronicles"; - book[15] = "Ezra"; - book[16] = "Nehemiah"; - book[17] = "Esther"; - book[18] = "Job"; - book[19] = "Psalm"; - book[20] = "Proverbs"; - book[21] = "Ecclesiastes"; - book[22] = "Song of Songs"; - book[23] = "Isaiah"; - book[24] = "Jeremiah"; - book[25] = "Lamentations"; - book[26] = "Ezekiel"; - book[27] = "Daniel"; - book[28] = "Hosea"; - book[29] = "Joel"; - book[30] = "Amos"; - book[31] = "Obadiah"; - book[32] = "Jonah"; - book[33] = "Micah"; - book[34] = "Nahum"; - book[35] = "Habakkuk"; - book[36] = "Zephaniah"; - book[37] = "Haggai"; - book[38] = "Zechariah"; - book[39] = "Malachi"; - book[40] = "Matthew"; - book[41] = "Mark"; - book[42] = "Luke"; - book[43] = "John"; - book[44] = "Acts"; - book[45] = "Romans"; - book[46] = "1 Corinthians"; - book[47] = "2 Corinthians"; - book[48] = "Galatians"; - book[49] = "Ephesians"; - book[50] = "Philippians"; - book[51] = "Colossians"; - book[52] = "1 Thessalonians"; - book[53] = "2 Thessalonians"; - book[54] = "1 Timothy"; - book[55] = "2 Timothy"; - book[56] = "Titus"; - book[57] = "Philemon"; - book[58] = "Hebrews"; - book[59] = "James"; - book[60] = "1 Peter"; - book[61] = "2 Peter"; - book[62] = "1 John"; - book[63] = "2 John"; - book[64] = "3 John"; - book[65] = "Jude"; - book[66] = "Revelation"; + book[0] = ''; + book[1] = 'Genesis'; + book[2] = 'Exodus'; + book[3] = 'Leviticus'; + book[4] = 'Numbers'; + book[5] = 'Deuteronomy'; + book[6] = 'Joshua'; + book[7] = 'Judges'; + book[8] = 'Ruth'; + book[9] = '1 Samuel'; + book[10] = '2 Samuel'; + book[11] = '1 Kings'; + book[12] = '2 Kings'; + book[13] = '1 Chronicles'; + book[14] = '2 Chronicles'; + book[15] = 'Ezra'; + book[16] = 'Nehemiah'; + book[17] = 'Esther'; + book[18] = 'Job'; + book[19] = 'Psalm'; + book[20] = 'Proverbs'; + book[21] = 'Ecclesiastes'; + book[22] = 'Song of Songs'; + book[23] = 'Isaiah'; + book[24] = 'Jeremiah'; + book[25] = 'Lamentations'; + book[26] = 'Ezekiel'; + book[27] = 'Daniel'; + book[28] = 'Hosea'; + book[29] = 'Joel'; + book[30] = 'Amos'; + book[31] = 'Obadiah'; + book[32] = 'Jonah'; + book[33] = 'Micah'; + book[34] = 'Nahum'; + book[35] = 'Habakkuk'; + book[36] = 'Zephaniah'; + book[37] = 'Haggai'; + book[38] = 'Zechariah'; + book[39] = 'Malachi'; + book[40] = 'Matthew'; + book[41] = 'Mark'; + book[42] = 'Luke'; + book[43] = 'John'; + book[44] = 'Acts'; + book[45] = 'Romans'; + book[46] = '1 Corinthians'; + book[47] = '2 Corinthians'; + book[48] = 'Galatians'; + book[49] = 'Ephesians'; + book[50] = 'Philippians'; + book[51] = 'Colossians'; + book[52] = '1 Thessalonians'; + book[53] = '2 Thessalonians'; + book[54] = '1 Timothy'; + book[55] = '2 Timothy'; + book[56] = 'Titus'; + book[57] = 'Philemon'; + book[58] = 'Hebrews'; + book[59] = 'James'; + book[60] = '1 Peter'; + book[61] = '2 Peter'; + book[62] = '1 John'; + book[63] = '2 John'; + book[64] = '3 John'; + book[65] = 'Jude'; + book[66] = 'Revelation'; return book[booknum]; } } - export type Section = { start: { book: number, @@ -834,7 +833,7 @@ export type Section = { longbookname: string, lastchapter: number, chapter: string, - verse: string + verse: string, }, end: { book: number, @@ -842,6 +841,6 @@ export type Section = { longbookname: string, lastchapter: number, chapter: string, - verse: string + verse: string, } }; \ No newline at end of file diff --git a/DynamicBibleIonic/src/pages/settings/settings.ts b/DynamicBibleIonic/src/pages/settings/settings.ts index 6b4bfae9..b0900ac4 100644 --- a/DynamicBibleIonic/src/pages/settings/settings.ts +++ b/DynamicBibleIonic/src/pages/settings/settings.ts @@ -1,4 +1,4 @@ -/// +/// import { Component } from '@angular/core'; import { NavController, AlertController } from 'ionic-angular'; import { Storage } from '@ionic/storage'; diff --git a/DynamicBibleIonic/src/services/bible-service.ts b/DynamicBibleIonic/src/services/bible-service.ts index 9de24eec..b1d19e19 100644 --- a/DynamicBibleIonic/src/services/bible-service.ts +++ b/DynamicBibleIonic/src/services/bible-service.ts @@ -1,7 +1,8 @@ -/// -import { Injectable } from "@angular/core"; -import { Http } from "@angular/http"; -import { Section, Reference } from "../libs/Reference"; +/// +/// +import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; +import { Section, Reference } from '../libs/Reference'; @Injectable() export class BibleService @@ -25,26 +26,27 @@ export class BibleService try { var self = this; - this.chapters = []; // the verses from the chapter. - this.result = { - cs: [], - testament: "", - ref: Reference.toString(section), - status: 0, - msg: ":)" - }; + this.chapters = []; // the verses from the chapter. + this.result = { + cs: [], + testament: '', + ref: Reference.toString(section), + status: 0, + msg: ':)', + lastverse: 0 + }; if (Number(section.start.chapter) > section.start.lastchapter) { self.result.status = -1; - self.result.msg = "The requested chapter for " + section.start.bookname + " is out of range. Please pick a chapter between 1 and " + section.start.lastchapter + "."; + self.result.msg = 'The requested chapter for ' + section.start.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.start.lastchapter + '.'; return self.result; } if (Number(section.end.chapter) > section.end.lastchapter) { self.result.status = -1; - self.result.msg = "The requested chapter for " + section.end.bookname + " is out of range. Please pick a chapter between 1 and " + section.end.lastchapter + "."; + self.result.msg = 'The requested chapter for ' + section.end.bookname + ' is out of range. Please pick a chapter between 1 and ' + section.end.lastchapter + '.'; return self.result; } @@ -52,26 +54,26 @@ export class BibleService for (let i = Number(section.start.chapter); i <= Number(section.end.chapter); i++) { - const url = "data/bibles/kjv_strongs/" + section.start.book + "-" + i + ".json"; - + const url = 'data/bibles/kjv_strongs/' + section.start.book + '-' + i + '.json'; + $.ajax({ async: false, - type: "GET", + type: 'GET', url: url, - dataType: "json", - success: function (d: BiblePassage, t, x) - { + dataType: 'json', + success(d: BiblePassage, t, x) + { self.chapters.push(d); }, - error: function (request, status, error) + error(request, status, error) { self.result.status = -1; - self.result.msg = "Unable to retrieve bible passage " + self.result.ref + "."; + self.result.msg = 'Unable to retrieve bible passage ' + self.result.ref + '.'; } }); } - if (self.result.status == -1) + if (self.result.status === -1) return self.result; for (let j = 0; j < this.chapters.length; j++) @@ -82,7 +84,21 @@ export class BibleService // figure out the start verse. if (j === 0) - start = parseInt(section.start.verse); + { + if (section.start.verse.indexOf('*') !== -1) // you sometimes use this as a shortcut to the last verse + { + // replace the * with the last verse, then eval the expression. + section.start.verse = section.start.verse.replace('*', (this.chapters[j].vss.length).toString()); + + start = math.eval(section.start.verse); + + // update the section and the ref. + section.start.verse = start.toString(); + this.result.ref = Reference.toString(section); + } + else + start = parseInt(section.start.verse); + } else start = 1; @@ -90,27 +106,29 @@ export class BibleService if ((j + 1) === this.chapters.length) end = section.end.verse; else - end = "*"; + end = '*'; // get the verses requested. const tvs = this.chapters[j].vss.length; - if (end == "*" || parseInt(end) > tvs) + if (end === '*' || parseInt(end) > tvs) end = tvs; // we're using c based indexes here, so the index is 1 less than the verse #. for (let i = start; i <= end; i++) vss.push(this.chapters[j].vss[i - 1]); - this.result.cs.push({ - "ch": this.chapters[j].ch, - "vss": vss - }); + this.result.cs.push({ + "ch": this.chapters[j].ch, + "vss": vss + }); + this.result.lastverse = this.chapters[j].vss.length; } + if (section.start.book >= 40) - this.result.testament = "new"; + this.result.testament = 'new'; else - this.result.testament = "old"; + this.result.testament = 'old'; return this.result; } @@ -127,19 +145,20 @@ export type BiblePassageResult = { testament: string, ref: string, status: number, - msg: string + msg: string, + lastverse: number, } type BiblePassage = { ch: number, - vss: BibleVerse[] + vss: BibleVerse[], } type BibleVerse = { v: number, w: [ { - t: string, s: string + t: string, s: string, } - ] + ], } \ No newline at end of file diff --git a/DynamicBibleIonic/src/services/strongs-service.ts b/DynamicBibleIonic/src/services/strongs-service.ts index 00a95d21..12a0d7ee 100644 --- a/DynamicBibleIonic/src/services/strongs-service.ts +++ b/DynamicBibleIonic/src/services/strongs-service.ts @@ -1,4 +1,4 @@ -/// +/// import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; diff --git a/DynamicBibleIonic/src/services/word-service.ts b/DynamicBibleIonic/src/services/word-service.ts index cb30ca1a..7115d3e1 100644 --- a/DynamicBibleIonic/src/services/word-service.ts +++ b/DynamicBibleIonic/src/services/word-service.ts @@ -1,4 +1,4 @@ -/// +/// import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; @@ -35,7 +35,7 @@ export class WordService for (let w = 0; w < words.length; w++) { // If we are at the end of the array, we want to use a different test. - if (w == 0) + if (w === 0) { if (q <= words[w]) { @@ -56,18 +56,18 @@ export class WordService // Now we need to test results. If there is more than one item in the array, we need to find the set // that is shared by all of them. IF not, we can just return those refs. - if (results.length == 0 || results == null || results == undefined) + if (results.length === 0) return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." }; let shared: string[]; - if (results.length == 1) { + if (results.length === 1) { shared = results[0]; } else { shared = this.findSharedSet(results); } - if (shared == null || shared == undefined || shared.length == 0) + if (shared == null || shared.length === 0) return { word: qry, refs: [], status: -1, msg: "No passages found for query: " + qry + "." }; return { word: qry, refs: shared, status: 0, msg: ":)" }; @@ -89,21 +89,18 @@ export class WordService type: "GET", url: url, dataType: "json", - success: function (d: IndexResult[], t, x) + success(d: IndexResult[], t, x) { r = d; }, - error: function (request, status, error) + error(request, status, error) { console.log(error); } }); // find the right word - let refs = $.grep(r, function (o, i) - { - return o.word == query; - }); + let refs = $.grep(r, (o, i) => o.word === query); if (refs.length > 0) return refs[0].refs; @@ -427,7 +424,7 @@ export class WordService // values that aren't shared between them. while (i < t) { - if (x[i] == y[i]) + if (x[i] === y[i]) i++; if (x[i] < y[i]) @@ -440,10 +437,10 @@ export class WordService // we have to make sure to remove any extra values // at the end of an array when we reach the end of // the other. - if (t == i && t < x.length) + if (t === i && t < x.length) x.splice(i, x.length - i); - if (t == i && t < y.length) + if (t === i && t < y.length) y.splice(i, x.length - i); } // we could return y, because at this time, both arrays @@ -456,7 +453,7 @@ export type WordLookupResult = { refs: string[], word: string, status: number, - msg: string + msg: string, } type IndexResult = { diff --git a/DynamicBibleIonic/src/test.ts b/DynamicBibleIonic/src/test.ts index 10860f21..6b4d4423 100644 --- a/DynamicBibleIonic/src/test.ts +++ b/DynamicBibleIonic/src/test.ts @@ -1,4 +1,4 @@ -/// +/// import './polyfills.ts'; import 'zone.js/dist/long-stack-trace-zone'; diff --git a/DynamicBibleIonic/typings.json b/DynamicBibleIonic/typings.json new file mode 100644 index 00000000..643de04d --- /dev/null +++ b/DynamicBibleIonic/typings.json @@ -0,0 +1,7 @@ +{ + "globalDependencies": { + "es6-shim": "registry:dt/es6-shim#0.31.2+20160726072212", + "jquery": "registry:dt/jquery#1.10.0+20170310222111", + "mathjs": "registry:dt/mathjs#0.0.0+20170126160507" + } +} diff --git a/DynamicBibleIonic/typings/browser.d.ts b/DynamicBibleIonic/typings/browser.d.ts deleted file mode 100644 index 39b21deb..00000000 --- a/DynamicBibleIonic/typings/browser.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/DynamicBibleIonic/typings/globals/es6-shim/index.d.ts b/DynamicBibleIonic/typings/globals/es6-shim/index.d.ts index 1be23ee4..8964601d 100644 --- a/DynamicBibleIonic/typings/globals/es6-shim/index.d.ts +++ b/DynamicBibleIonic/typings/globals/es6-shim/index.d.ts @@ -1,5 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts declare type PropertyKey = string | number | symbol; interface IteratorResult { @@ -663,4 +663,4 @@ declare module "es6-shim" { function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; } -} \ No newline at end of file +} diff --git a/DynamicBibleIonic/typings/globals/es6-shim/typings.json b/DynamicBibleIonic/typings/globals/es6-shim/typings.json index 9a84847e..b94bd88f 100644 --- a/DynamicBibleIonic/typings/globals/es6-shim/typings.json +++ b/DynamicBibleIonic/typings/globals/es6-shim/typings.json @@ -1,8 +1,8 @@ { "resolution": "main", "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts", - "raw": "registry:dt/es6-shim#0.31.2+20160602141504", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts" + "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts", + "raw": "registry:dt/es6-shim#0.31.2+20160726072212", + "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d004be8ba9a0c34e387c249f6873dc68e20ebfa/es6-shim/index.d.ts" } } diff --git a/DynamicBibleIonic/typings/browser/ambient/jquery/index.d.ts b/DynamicBibleIonic/typings/globals/jquery/index.d.ts similarity index 75% rename from DynamicBibleIonic/typings/browser/ambient/jquery/index.d.ts rename to DynamicBibleIonic/typings/globals/jquery/index.d.ts index d8b71605..5030a1ed 100644 --- a/DynamicBibleIonic/typings/browser/ambient/jquery/index.d.ts +++ b/DynamicBibleIonic/typings/globals/jquery/index.d.ts @@ -1,29 +1,5 @@ // Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4cdfbe96b666eec5e1defbb519a62abf04e96764/jquery/jquery.d.ts -// Type definitions for jQuery 1.10.x / 2.0.x -// Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly , Dick van den Brink -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - - -/** - * Interface for the AJAX setting that will configure the AJAX request - */ +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts interface JQueryAjaxSettings { /** * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. @@ -68,7 +44,7 @@ interface JQueryAjaxSettings { */ crossDomain?: boolean; /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). + * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be key-value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). */ data?: any; /** @@ -76,7 +52,7 @@ interface JQueryAjaxSettings { */ dataFilter? (data: any, ty: any): any; /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). + * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). */ dataType?: string; /** @@ -112,7 +88,7 @@ interface JQueryAjaxSettings { */ method?: string; /** - * A mime type to override the XHR mime type. (version added: 1.5.1) + * A MIME type to override the XHR MIME type. (version added: 1.5.1) */ mimeType?: string; /** @@ -140,7 +116,7 @@ interface JQueryAjaxSettings { */ timeout?: number; /** - * Set this to true if you wish to use the traditional style of param serialization. + * Set this to true if you wish to use the traditional style of parameter serialization. */ traditional?: boolean; /** @@ -167,14 +143,15 @@ interface JQueryAjaxSettings { /** * Interface for the jqXHR object + * @see {@link https://api.jquery.com/jQuery.ajax/#jqXHR} */ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). + * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). */ overrideMimeType(mimeType: string): any; /** - * Cancel the request. + * Cancel the request. * * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" */ @@ -182,9 +159,9 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { /** * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; + then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R|JQueryPromise, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; /** - * Property containing the parsed response if the response Content-Type is json + * Property containing the parsed response if the response content type is json */ responseJSON?: any; /** @@ -195,83 +172,97 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { /** * Interface for the JQuery callback + * @see {@link https://api.jquery.com/category/callbacks-object/} */ interface JQueryCallback { /** * Add a callback or a collection of callbacks to a callback list. - * + * * @param callbacks A function, or array of functions, that are to be added to the callback list. + * @see {@link https://api.jquery.com/callbacks.add/} */ add(callbacks: Function): JQueryCallback; /** * Add a callback or a collection of callbacks to a callback list. - * + * * @param callbacks A function, or array of functions, that are to be added to the callback list. + * @see {@link https://api.jquery.com/callbacks.add/} */ add(callbacks: Function[]): JQueryCallback; /** * Disable a callback list from doing anything more. + * @see {@link https://api.jquery.com/callbacks.disable/} */ disable(): JQueryCallback; /** * Determine if the callbacks list has been disabled. + * @see {@link https://api.jquery.com/callbacks.disabled/} */ disabled(): boolean; /** * Remove all of the callbacks from a list. + * @see {@link https://api.jquery.com/callbacks.empty/} */ empty(): JQueryCallback; /** * Call all of the callbacks with the given arguments - * + * * @param arguments The argument or list of arguments to pass back to the callback list. + * @see {@link https://api.jquery.com/callbacks.fire/} */ fire(...arguments: any[]): JQueryCallback; /** * Determine if the callbacks have already been called at least once. + * @see {@link https://api.jquery.com/callbacks.fired/} */ fired(): boolean; /** * Call all callbacks in a list with the given context and arguments. - * + * * @param context A reference to the context in which the callbacks in the list should be fired. * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. + * @see {@link https://api.jquery.com/callbacks.fireWith/} */ fireWith(context?: any, args?: any[]): JQueryCallback; /** * Determine whether a supplied callback is in a list - * + * * @param callback The callback to search for. + * @see {@link https://api.jquery.com/callbacks.has/} */ has(callback: Function): boolean; /** * Lock a callback list in its current state. + * @see {@link https://api.jquery.com/callbacks.lock/} */ lock(): JQueryCallback; /** * Determine if the callbacks list has been locked. + * @see {@link https://api.jquery.com/callbacks.locked/} */ locked(): boolean; /** * Remove a callback or a collection of callbacks from a callback list. - * + * * @param callbacks A function, or array of functions, that are to be removed from the callback list. + * @see {@link https://api.jquery.com/callbacks.remove/} */ remove(callbacks: Function): JQueryCallback; /** * Remove a callback or a collection of callbacks from a callback list. - * + * * @param callbacks A function, or array of functions, that are to be removed from the callback list. + * @see {@link https://api.jquery.com/callbacks.remove/} */ remove(callbacks: Function[]): JQueryCallback; } @@ -282,17 +273,19 @@ interface JQueryCallback { interface JQueryGenericPromise { /** * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * + * * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} */ then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * + * * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} */ then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; } @@ -310,129 +303,158 @@ interface JQueryPromiseOperator { /** * Interface for the JQuery promise, part of callbacks + * @see {@link https://api.jquery.com/category/deferred-object/} */ interface JQueryPromise extends JQueryGenericPromise { /** * Determine the current state of a Deferred object. + * @see {@link https://api.jquery.com/deferred.state/} */ state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * + * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see {@link https://api.jquery.com/deferred.always/} */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * + * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see {@link https://api.jquery.com/deferred.done/} */ done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * + * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.fail/} */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. + * + * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. + * @see {@link https://api.jquery.com/deferred.progress/} */ progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; // Deprecated - given no typings pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; + + /** + * Return a Deferred's Promise object. + * + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/deferred.promise/} + */ + promise(target?: any): JQueryPromise; } /** * Interface for the JQuery deferred, part of callbacks + * @see {@link https://api.jquery.com/category/deferred-object/} */ interface JQueryDeferred extends JQueryGenericPromise { /** * Determine the current state of a Deferred object. + * @see {@link https://api.jquery.com/deferred.state/} */ state(): string; /** * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * + * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see {@link https://api.jquery.com/deferred.always/} */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * + * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see {@link https://api.jquery.com/deferred.done/} */ done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * + * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.fail/} */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. + * + * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. + * @see {@link https://api.jquery.com/deferred.progress/} */ progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. - * + * * @param args Optional arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notify/} */ notify(value?: any, ...args: any[]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given context and args. - * + * * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notifyWith/} */ - notifyWith(context: any, value?: any[]): JQueryDeferred; + notifyWith(context: any, args?: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given args. - * + * * @param args Optional arguments that are passed to the failCallbacks. + * @see {@link https://api.jquery.com/deferred.reject/} */ reject(value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given context and args. - * + * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. + * @see {@link https://api.jquery.com/deferred.rejectWith/} */ - rejectWith(context: any, value?: any[]): JQueryDeferred; + rejectWith(context: any, args?: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given args. - * + * * @param value First argument passed to doneCallbacks. * @param args Optional subsequent arguments that are passed to the doneCallbacks. + * @see {@link https://api.jquery.com/deferred.resolve/} */ resolve(value?: T, ...args: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * + * * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. + * @see {@link https://api.jquery.com/deferred.resolveWith/} */ - resolveWith(context: any, value?: T[]): JQueryDeferred; + resolveWith(context: any, args?: T[]): JQueryDeferred; /** * Return a Deferred's Promise object. - * + * * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/deferred.promise/} */ promise(target?: any): JQueryPromise; @@ -442,24 +464,98 @@ interface JQueryDeferred extends JQueryGenericPromise { /** * Interface of the JQuery extension of the W3C event object + * @see {@link https://api.jquery.com/category/events/event-object/} */ interface BaseJQueryEventObject extends Event { + /** + * The current DOM element within the event bubbling phase. + * @see {@link https://api.jquery.com/event.currentTarget/} + */ + currentTarget: Element; + /** + * An optional object of data passed to an event method when the current executing handler is bound. + * @see {@link https://api.jquery.com/event.data/} + */ data: any; + /** + * The element where the currently-called jQuery event handler was attached. + * @see {@link https://api.jquery.com/event.delegateTarget/} + */ delegateTarget: Element; + /** + * Returns whether event.preventDefault() was ever called on this event object. + * @see {@link https://api.jquery.com/event.isDefaultPrevented/} + */ isDefaultPrevented(): boolean; + /** + * Returns whether event.stopImmediatePropagation() was ever called on this event object. + * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/} + */ isImmediatePropagationStopped(): boolean; + /** + * Returns whether event.stopPropagation() was ever called on this event object. + * @see {@link https://api.jquery.com/event.isPropagationStopped/} + */ isPropagationStopped(): boolean; + /** + * The namespace specified when the event was triggered. + * @see {@link https://api.jquery.com/event.namespace/} + */ namespace: string; + /** + * The browser's original Event object. + * @see {@link https://api.jquery.com/category/events/event-object/} + */ originalEvent: Event; + /** + * If this method is called, the default action of the event will not be triggered. + * @see {@link https://api.jquery.com/event.preventDefault/} + */ preventDefault(): any; + /** + * The other DOM element involved in the event, if any. + * @see {@link https://api.jquery.com/event.relatedTarget/} + */ relatedTarget: Element; + /** + * The last value returned by an event handler that was triggered by this event, unless the value was undefined. + * @see {@link https://api.jquery.com/event.result/} + */ result: any; + /** + * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. + * @see {@link https://api.jquery.com/event.stopImmediatePropagation/} + */ stopImmediatePropagation(): void; + /** + * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. + * @see {@link https://api.jquery.com/event.stopPropagation/} + */ stopPropagation(): void; + /** + * The DOM element that initiated the event. + * @see {@link https://api.jquery.com/event.target/} + */ target: Element; + /** + * The mouse position relative to the left edge of the document. + * @see {@link https://api.jquery.com/event.pageX/} + */ pageX: number; + /** + * The mouse position relative to the top edge of the document. + * @see {@link https://api.jquery.com/event.pageY/} + */ pageY: number; + /** + * For key or mouse events, this property indicates the specific key or button that was pressed. + * @see {@link https://api.jquery.com/event.which/} + */ which: number; + /** + * Indicates whether the META key was pressed when the event fired. + * @see {@link https://api.jquery.com/event.metaKey/} + */ metaKey: boolean; } @@ -492,10 +588,16 @@ interface JQueryKeyEventObject extends JQueryInputEventObject { interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ } -/* - Collection of properties of the current browser -*/ - +/** + * A collection of properties that represent the presence of different browser features or bugs. + * + * Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally + * to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the + * use of an external library such as {@link http://modernizr.com/|Modernizr} instead of dependency on properties + * in jQuery.support. + * + * @deprecated since version 1.9 + */ interface JQuerySupport { ajax?: boolean; boxModel?: boolean; @@ -521,14 +623,14 @@ interface JQuerySupport { interface JQueryParam { /** * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * + * * @param obj An array or object to serialize. */ (obj: any): string; /** * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * + * * @param obj An array or object to serialize. * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. */ @@ -562,47 +664,50 @@ interface JQuerySerializeArrayElement { value: string; } -interface JQueryAnimationOptions { +/** + * @see {@link https://api.jquery.com/animate/} + */ +interface JQueryAnimationOptions { /** * A string or number determining how long the animation will run. */ - duration?: any; + duration?: any; /** * A string indicating which easing function to use for the transition. */ - easing?: string; + easing?: string; /** * A function to call once the animation is complete. */ - complete?: Function; + complete?: Function; /** * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. */ - step?: (now: number, tween: any) => any; + step?: (now: number, tween: any) => any; /** * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; + progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; /** * A function to call when the animation begins. (version added: 1.8) */ - start?: (animation: JQueryPromise) => any; + start?: (animation: JQueryPromise) => any; /** * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; + always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; /** * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. */ - queue?: any; + queue?: any; /** * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) */ @@ -621,6 +726,8 @@ interface JQueryEasingFunctions { /** * Static members of jQuery (those on $ and jQuery themselves) + * + * @see {@link https://api.jquery.com/Types/#jQuery} */ interface JQueryStatic { @@ -628,6 +735,7 @@ interface JQueryStatic { * Perform an asynchronous HTTP (Ajax) request. * * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings} */ ajax(settings: JQueryAjaxSettings): JQueryXHR; /** @@ -635,6 +743,7 @@ interface JQueryStatic { * * @param url A string containing the URL to which the request is sent. * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-url-settings} */ ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; @@ -643,21 +752,33 @@ interface JQueryStatic { * * @param dataTypes An optional string containing one or more space-separated dataTypes * @param handler A handler to set default values for future Ajax requests. + * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} */ ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; /** * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). * * @param handler A handler to set default values for future Ajax requests. + * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} */ ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + /** + * Creates an object that handles the actual transmission of Ajax data. + * + * @param dataType A string identifying the data type to use. + * @param handler A handler to return the new transport object to use with the data type provided in the first argument. + * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} + */ + ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + ajaxSettings: JQueryAjaxSettings; /** * Set default values for future Ajax requests. Its use is not recommended. * * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + * @see {@link https://api.jquery.com/jQuery.ajaxSetup/} */ ajaxSetup(options: JQueryAjaxSettings): void; @@ -667,6 +788,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param success A callback function that is executed if the request succeeds. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} */ get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** @@ -676,12 +798,14 @@ interface JQueryStatic { * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} */ get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP GET request. * * @param settings The JQueryAjaxSettings to be used for the request + * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-settings} */ get(settings : JQueryAjaxSettings): JQueryXHR; /** @@ -689,6 +813,7 @@ interface JQueryStatic { * * @param url A string containing the URL to which the request is sent. * @param success A callback function that is executed if the request succeeds. + * @see {@link https://api.jquery.com/jQuery.getJSON/} */ getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** @@ -697,6 +822,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. + * @see {@link https://api.jquery.com/jQuery.getJSON/} */ getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** @@ -704,11 +830,14 @@ interface JQueryStatic { * * @param url A string containing the URL to which the request is sent. * @param success A callback function that is executed if the request succeeds. + * @see {@link https://api.jquery.com/jQuery.getScript/} */ getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + * + * @see {@link https://api.jquery.com/jQuery.param/} */ param: JQueryParam; @@ -718,6 +847,7 @@ interface JQueryStatic { * @param url A string containing the URL to which the request is sent. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-url-data-success-dataType} */ post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** @@ -727,18 +857,21 @@ interface JQueryStatic { * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-url-data-success-dataType} */ post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP POST request. * * @param settings The JQueryAjaxSettings to be used for the request + * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-settings} */ post(settings : JQueryAjaxSettings): JQueryXHR; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. * * @param flags An optional list of space-separated flags that change how the callback list behaves. + * @see {@link https://api.jquery.com/jQuery.Callbacks/} */ Callbacks(flags?: string): JQueryCallback; @@ -746,6 +879,7 @@ interface JQueryStatic { * Holds or releases the execution of jQuery's ready event. * * @param hold Indicates whether the ready hold is being requested or released + * @see {@link https://api.jquery.com/jQuery.holdReady/} */ holdReady(hold: boolean): void; @@ -754,6 +888,7 @@ interface JQueryStatic { * * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context + * @see {@link https://api.jquery.com/jQuery/#jQuery-selector-context} */ (selector: string, context?: Element|JQuery): JQuery; @@ -761,6 +896,7 @@ interface JQueryStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param element A DOM element to wrap in a jQuery object. + * @see {@link https://api.jquery.com/jQuery/#jQuery-element} */ (element: Element): JQuery; @@ -768,6 +904,7 @@ interface JQueryStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + * @see {@link https://api.jquery.com/jQuery/#jQuery-elementArray} */ (elementArray: Element[]): JQuery; @@ -775,6 +912,7 @@ interface JQueryStatic { * Binds a function to be executed when the DOM has finished loading. * * @param callback A function to execute after the DOM is ready. + * @see {@link https://api.jquery.com/jQuery/#jQuery-callback} */ (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; @@ -782,6 +920,7 @@ interface JQueryStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param object A plain object to wrap in a jQuery object. + * @see {@link https://api.jquery.com/jQuery/#jQuery-object} */ (object: {}): JQuery; @@ -789,11 +928,13 @@ interface JQueryStatic { * Accepts a string containing a CSS selector which is then used to match a set of elements. * * @param object An existing jQuery object to clone. + * @see {@link https://api.jquery.com/jQuery/#jQuery-object} */ (object: JQuery): JQuery; /** * Specify a function to execute when the DOM is fully loaded. + * @see {@link https://api.jquery.com/jQuery/#jQuery} */ (): JQuery; @@ -802,6 +943,7 @@ interface JQueryStatic { * * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. * @param ownerDocument A document in which the new elements will be created. + * @see {@link https://api.jquery.com/jQuery/#jQuery-html-ownerDocument} */ (html: string, ownerDocument?: Document): JQuery; @@ -810,6 +952,7 @@ interface JQueryStatic { * * @param html A string defining a single, standalone, HTML element (e.g.
or
). * @param attributes An object of attributes, events, and methods to call on the newly-created element. + * @see {@link https://api.jquery.com/jQuery/#jQuery-html-attributes} */ (html: string, attributes: Object): JQuery; @@ -817,6 +960,7 @@ interface JQueryStatic { * Relinquish jQuery's control of the $ variable. * * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + * @see {@link https://api.jquery.com/jQuery.noConflict/} */ noConflict(removeAll?: boolean): JQueryStatic; @@ -824,13 +968,20 @@ interface JQueryStatic { * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. * * @param deferreds One or more Deferred objects, or plain JavaScript objects. + * @see {@link https://api.jquery.com/jQuery.when/} */ when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. + * @see {@link https://api.jquery.com/jQuery.cssHooks/} */ cssHooks: { [key: string]: any; }; + + /** + * An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values. + * @see {@link https://api.jquery.com/jQuery.cssNumber/} + */ cssNumber: any; /** @@ -839,6 +990,7 @@ interface JQueryStatic { * @param element The DOM element to associate with the data. * @param key A string naming the piece of data to set. * @param value The new data value. + * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key-value} */ data(element: Element, key: string, value: T): T; /** @@ -846,12 +998,14 @@ interface JQueryStatic { * * @param element The DOM element to associate with the data. * @param key A string naming the piece of data to set. + * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key} */ data(element: Element, key: string): any; /** * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. * * @param element The DOM element to associate with the data. + * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element} */ data(element: Element): any; @@ -860,6 +1014,7 @@ interface JQueryStatic { * * @param element A DOM element from which to remove and execute a queued function. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/jQuery.dequeue/} */ dequeue(element: Element, queueName?: string): void; @@ -867,6 +1022,7 @@ interface JQueryStatic { * Determine whether an element has any jQuery data associated with it. * * @param element A DOM element to be checked for data. + * @see {@link https://api.jquery.com/jQuery.hasData/} */ hasData(element: Element): boolean; @@ -875,6 +1031,7 @@ interface JQueryStatic { * * @param element A DOM element to inspect for an attached queue. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName} */ queue(element: Element, queueName?: string): any[]; /** @@ -883,6 +1040,7 @@ interface JQueryStatic { * @param element A DOM element where the array of queued functions is attached. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param newQueue An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-newQueue} */ queue(element: Element, queueName: string, newQueue: Function[]): JQuery; /** @@ -891,6 +1049,7 @@ interface JQueryStatic { * @param element A DOM element on which to add a queued function. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param callback The new function to add to the queue. + * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-callback} */ queue(element: Element, queueName: string, callback: Function): JQuery; @@ -899,6 +1058,7 @@ interface JQueryStatic { * * @param element A DOM element from which to remove data. * @param name A string naming the piece of data to remove. + * @see {@link https://api.jquery.com/jQuery.removeData/} */ removeData(element: Element, name?: string): JQuery; @@ -906,6 +1066,7 @@ interface JQueryStatic { * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. * * @param beforeStart A function that is called just before the constructor returns. + * @see {@link https://api.jquery.com/jQuery.Deferred/} */ Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; @@ -919,12 +1080,14 @@ interface JQueryStatic { tick: () => void; /** * The rate (in milliseconds) at which animations fire. + * @see {@link https://api.jquery.com/jQuery.fx.interval/} */ interval: number; stop: () => void; speeds: { slow: number; fast: number; }; /** * Globally disable all animations. + * @see {@link https://api.jquery.com/jQuery.fx.off/} */ off: boolean; step: any; @@ -933,17 +1096,19 @@ interface JQueryStatic { /** * Takes a function and returns a new one that will always have a particular context. * - * @param fnction The function whose context will be changed. + * @param func The function whose context will be changed. * @param context The object to which the context (this) of the function should be set. * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + * @see {@link https://api.jquery.com/jQuery.proxy/#jQuery-proxy-function-context-additionalArguments} */ - proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; + proxy(func: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; /** * Takes a function and returns a new one that will always have a particular context. * * @param context The object to which the context (this) of the function should be set. * @param name The name of the function whose context will be changed (should be a property of the context object). * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + * @see {@link https://api.jquery.com/jQuery.proxy/#jQuery-proxy-context-name-additionalArguments} */ proxy(context: Object, name: string, ...additionalArguments: any[]): any; @@ -953,6 +1118,7 @@ interface JQueryStatic { * Takes a string and throws an exception containing it. * * @param message The message to send out. + * @see {@link https://api.jquery.com/jQuery.error/} */ error(message: any): JQuery; @@ -966,33 +1132,39 @@ interface JQueryStatic { /** * Check to see if a DOM element is a descendant of another DOM element. - * + * * @param container The DOM element that may contain the other element. * @param contained The DOM element that may be contained by (a descendant of) the other element. + * @see {@link https://api.jquery.com/jQuery.contains/} */ contains(container: Element, contained: Element): boolean; /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * + * * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. + * @param callback The function that will be executed on every object. Will break the loop by returning false. + * @returns the first argument, the object that is iterated. + * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-array-callback} */ each( collection: T[], - callback: (indexInArray: number, valueOfElement: T) => any - ): any; + callback: (indexInArray: number, valueOfElement: T) => boolean | void + ): T[]; /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * + * * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. + * @param callback The function that will be executed on every object. Will break the loop by returning false. + * @returns the first argument, the object that is iterated. + * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-object-callback} */ - each( - collection: any, - callback: (indexInArray: any, valueOfElement: any) => any - ): any; + each( + collection: T, + // TODO: `(keyInObject: keyof T, valueOfElement: T[keyof T])`, when TypeScript 2.1 allowed in repository + callback: (keyInObject: string, valueOfElement: any) => boolean | void + ): T; /** * Merge the contents of two or more objects together into the first object. @@ -1000,6 +1172,7 @@ interface JQueryStatic { * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. * @param object1 An object containing additional properties to merge in. * @param objectN Additional objects containing properties to merge in. + * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-target-object1-objectN} */ extend(target: any, object1?: any, ...objectN: any[]): any; /** @@ -1009,6 +1182,7 @@ interface JQueryStatic { * @param target The object to extend. It will receive the new properties. * @param object1 An object containing additional properties to merge in. * @param objectN Additional objects containing properties to merge in. + * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-deep-target-object1-objectN} */ extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; @@ -1016,6 +1190,7 @@ interface JQueryStatic { * Execute some JavaScript code globally. * * @param code The JavaScript code to execute. + * @see {@link https://api.jquery.com/jQuery.globalEval/} */ globalEval(code: string): any; @@ -1025,15 +1200,17 @@ interface JQueryStatic { * @param array The array to search through. * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. + * @see {@link https://api.jquery.com/jQuery.grep/} */ - grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; + grep(array: T[], func: (elementOfArray?: T, indexInArray?: number) => boolean, invert?: boolean): T[]; /** * Search for a specified value within an array and return its index (or -1 if not found). * * @param value The value to search for. * @param array An array through which to search. - * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. + * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. + * @see {@link https://api.jquery.com/jQuery.inArray/} */ inArray(value: T, array: T[], fromIndex?: number): number; @@ -1041,89 +1218,103 @@ interface JQueryStatic { * Determine whether the argument is an array. * * @param obj Object to test whether or not it is an array. + * @see {@link https://api.jquery.com/jQuery.isArray/} */ - isArray(obj: any): boolean; + isArray(obj: any): obj is Array; /** * Check to see if an object is empty (contains no enumerable properties). * * @param obj The object that will be checked to see if it's empty. + * @see {@link https://api.jquery.com/jQuery.isEmptyObject/} */ isEmptyObject(obj: any): boolean; /** - * Determine if the argument passed is a Javascript function object. + * Determine if the argument passed is a JavaScript function object. * * @param obj Object to test whether or not it is a function. + * @see {@link https://api.jquery.com/jQuery.isFunction/} */ - isFunction(obj: any): boolean; + isFunction(obj: any): obj is Function; /** * Determines whether its argument is a number. * - * @param obj The value to be tested. + * @param value The value to be tested. + * @see {@link https://api.jquery.com/jQuery.isNumeric/} */ isNumeric(value: any): boolean; /** * Check to see if an object is a plain object (created using "{}" or "new Object"). * * @param obj The object that will be checked to see if it's a plain object. + * @see {@link https://api.jquery.com/jQuery.isPlainObject/} */ isPlainObject(obj: any): boolean; /** * Determine whether the argument is a window. * * @param obj Object to test whether or not it is a window. + * @see {@link https://api.jquery.com/jQuery.isWindow/} */ - isWindow(obj: any): boolean; + isWindow(obj: any): obj is Window; /** * Check to see if a DOM node is within an XML document (or is an XML document). * - * @param node he DOM node that will be checked to see if it's in an XML document. + * @param node The DOM node that will be checked to see if it's in an XML document. + * @see {@link https://api.jquery.com/jQuery.isXMLDoc/} */ isXMLDoc(node: Node): boolean; /** * Convert an array-like object into a true JavaScript array. - * + * * @param obj Any object to turn into a native Array. + * @see {@link https://api.jquery.com/jQuery.makeArray/} */ makeArray(obj: any): any[]; /** * Translate all items in an array or object to new array of items. - * + * * @param array The Array to translate. * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. + * @see {@link https://api.jquery.com/jQuery.map/#jQuery-map-array-callback} */ - map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; + map(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[]; /** * Translate all items in an array or object to new array of items. - * + * * @param arrayOrObject The Array or Object to translate. * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. + * @see {@link https://api.jquery.com/jQuery.map/#jQuery-map-object-callback} */ - map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; + map(arrayOrObject: any, callback: (value?: any, indexOrKey?: any) => any): any; /** * Merge the contents of two arrays together into the first array. - * + * * @param first The first array to merge, the elements of second added. * @param second The second array to merge into the first, unaltered. + * @see {@link https://api.jquery.com/jQuery.merge/} */ merge(first: T[], second: T[]): T[]; /** * An empty function. + * @see {@link https://api.jquery.com/jQuery.noop/} */ noop(): any; /** * Return a number representing the current time. + * @see {@link https://api.jquery.com/jQuery.now/} */ now(): number; /** * Takes a well-formed JSON string and returns the resulting JavaScript object. - * + * * @param json The JSON string to parse. + * @see {@link https://api.jquery.com/jQuery.parseJSON/} */ parseJSON(json: string): any; @@ -1131,29 +1322,33 @@ interface JQueryStatic { * Parses a string into an XML document. * * @param data a well-formed XML string to be parsed + * @see {@link https://api.jquery.com/jQuery.parseXML/} */ parseXML(data: string): XMLDocument; /** * Remove the whitespace from the beginning and end of a string. - * + * * @param str Remove the whitespace from the beginning and end of a string. + * @see {@link https://api.jquery.com/jQuery.trim/} */ trim(str: string): string; /** * Determine the internal JavaScript [[Class]] of an object. - * + * * @param obj Object to get the internal JavaScript [[Class]] of. + * @see {@link https://api.jquery.com/jQuery.type/} */ - type(obj: any): string; + type(obj: any): "array" | "boolean" | "date" | "error" | "function" | "null" | "number" | "object" | "regexp" | "string" | "symbol" | "undefined"; /** * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * + * * @param array The Array of DOM elements. + * @see {@link https://api.jquery.com/jQuery.unique/} */ - unique(array: Element[]): Element[]; + unique(array: T[]): T[]; /** * Parses a string into an array of DOM nodes. @@ -1161,6 +1356,7 @@ interface JQueryStatic { * @param data HTML string to be parsed * @param context DOM element to serve as the context in which the HTML fragment will be created * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + * @see {@link https://api.jquery.com/jQuery.parseHTML/} */ parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; @@ -1170,48 +1366,57 @@ interface JQueryStatic { * @param data HTML string to be parsed * @param context DOM element to serve as the context in which the HTML fragment will be created * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + * @see {@link https://api.jquery.com/jQuery.parseHTML/} */ parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; } /** * The jQuery instance members + * + * @see {@link https://api.jquery.com/Types/#jQuery} */ interface JQuery { /** * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxComplete/} */ ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; /** * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxError/} */ ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; /** * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxSend/} */ ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; /** * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxStart/} */ ajaxStart(handler: () => any): JQuery; /** * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxStop/} */ ajaxStop(handler: () => any): JQuery; /** * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. * * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxSuccess/} */ ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; @@ -1221,15 +1426,18 @@ interface JQuery { * @param url A string containing the URL to which the request is sent. * @param data A plain object or string that is sent to the server with the request. * @param complete A callback function that is executed when the request completes. + * @see {@link https://api.jquery.com/load/} */ load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; /** * Encode a set of form elements as a string for submission. + * @see {@link https://api.jquery.com/serialize/} */ serialize(): string; /** * Encode a set of form elements as an array of names and values. + * @see {@link https://api.jquery.com/serializeArray/} */ serializeArray(): JQuerySerializeArrayElement[]; @@ -1237,17 +1445,20 @@ interface JQuery { * Adds the specified class(es) to each of the set of matched elements. * * @param className One or more space-separated classes to be added to the class attribute of each matched element. + * @see {@link https://api.jquery.com/addClass/#addClass-className} */ addClass(className: string): JQuery; /** * Adds the specified class(es) to each of the set of matched elements. * - * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + * @param func A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/addClass/#addClass-function} */ addClass(func: (index: number, className: string) => string): JQuery; /** * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. + * @see {@link https://api.jquery.com/addBack/} */ addBack(selector?: string): JQuery; @@ -1255,62 +1466,66 @@ interface JQuery { * Get the value of an attribute for the first element in the set of matched elements. * * @param attributeName The name of the attribute to get. + * @see {@link https://api.jquery.com/attr/#attr-attributeName} */ attr(attributeName: string): string; /** * Set one or more attributes for the set of matched elements. * * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. + * @param value A value to set for the attribute. If this is `null`, the attribute will be deleted. + * @see {@link https://api.jquery.com/attr/#attr-attributeName-value} */ - attr(attributeName: string, value: string|number): JQuery; + attr(attributeName: string, value: string|number|null): JQuery; /** * Set one or more attributes for the set of matched elements. * * @param attributeName The name of the attribute to set. * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. + * @see {@link https://api.jquery.com/attr/#attr-attributeName-function} */ attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; /** * Set one or more attributes for the set of matched elements. * * @param attributes An object of attribute-value pairs to set. + * @see {@link https://api.jquery.com/attr/#attr-attributes} */ attr(attributes: Object): JQuery; - + /** * Determine whether any of the matched elements are assigned the given class. * * @param className The class name to search for. + * @see {@link https://api.jquery.com/hasClass/} */ hasClass(className: string): boolean; /** * Get the HTML contents of the first element in the set of matched elements. + * @see {@link https://api.jquery.com/html/#html} */ html(): string; /** * Set the HTML contents of each element in the set of matched elements. * * @param htmlString A string of HTML to set as the content of each matched element. + * @see {@link https://api.jquery.com/html/#html-htmlString} */ html(htmlString: string): JQuery; /** * Set the HTML contents of each element in the set of matched elements. * * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/html/#html-function} */ html(func: (index: number, oldhtml: string) => string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - */ /** * Get the value of a property for the first element in the set of matched elements. * * @param propertyName The name of the property to get. + * @see {@link https://api.jquery.com/prop/#prop-propertyName} */ prop(propertyName: string): any; /** @@ -1318,12 +1533,14 @@ interface JQuery { * * @param propertyName The name of the property to set. * @param value A value to set for the property. + * @see {@link https://api.jquery.com/prop/#prop-propertyName-value} */ prop(propertyName: string, value: string|number|boolean): JQuery; /** * Set one or more properties for the set of matched elements. * * @param properties An object of property-value pairs to set. + * @see {@link https://api.jquery.com/prop/#prop-properties} */ prop(properties: Object): JQuery; /** @@ -1331,6 +1548,7 @@ interface JQuery { * * @param propertyName The name of the property to set. * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. + * @see {@link https://api.jquery.com/prop/#prop-propertyName-function} */ prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; @@ -1338,6 +1556,7 @@ interface JQuery { * Remove an attribute from each element in the set of matched elements. * * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + * @see {@link https://api.jquery.com/removeAttr/} */ removeAttr(attributeName: string): JQuery; @@ -1345,12 +1564,14 @@ interface JQuery { * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. * * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + * @see {@link https://api.jquery.com/removeClass/#removeClass-className} */ removeClass(className?: string): JQuery; /** * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. * - * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + * @param func A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + * @see {@link https://api.jquery.com/removeClass/#removeClass-function} */ removeClass(func: (index: number, className: string) => string): JQuery; @@ -1358,6 +1579,7 @@ interface JQuery { * Remove a property for the set of matched elements. * * @param propertyName The name of the property to remove. + * @see {@link https://api.jquery.com/removeProp/} */ removeProp(propertyName: string): JQuery; @@ -1366,12 +1588,14 @@ interface JQuery { * * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/#toggleClass-className} */ toggleClass(className: string, swtch?: boolean): JQuery; /** * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. * * @param swtch A boolean value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/#toggleClass-state} */ toggleClass(swtch?: boolean): JQuery; /** @@ -1379,31 +1603,35 @@ interface JQuery { * * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. * @param swtch A boolean value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/#toggleClass-function-state} */ toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; /** * Get the current value of the first element in the set of matched elements. + * @see {@link https://api.jquery.com/val/#val} */ val(): any; /** * Set the value of each element in the set of matched elements. * * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. + * @see {@link https://api.jquery.com/val/#val-value} */ val(value: string|string[]|number): JQuery; /** * Set the value of each element in the set of matched elements. * * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + * @see {@link https://api.jquery.com/val/#val-function} */ val(func: (index: number, value: string) => string): JQuery; - /** * Get the value of style properties for the first element in the set of matched elements. * * @param propertyName A CSS property. + * @see {@link https://api.jquery.com/css/#css-propertyName} */ css(propertyName: string): string; /** @@ -1411,6 +1639,7 @@ interface JQuery { * * @param propertyName A CSS property name. * @param value A value to set for the property. + * @see {@link https://api.jquery.com/css/#css-propertyName-value} */ css(propertyName: string, value: string|number): JQuery; /** @@ -1418,34 +1647,40 @@ interface JQuery { * * @param propertyName A CSS property name. * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + * @see {@link https://api.jquery.com/css/#css-propertyName-function} */ css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * * @param properties An object of property-value pairs to set. + * @see {@link https://api.jquery.com/css/#css-properties} */ css(properties: Object): JQuery; /** * Get the current computed height for the first element in the set of matched elements. + * @see {@link https://api.jquery.com/height/#height} */ height(): number; /** * Set the CSS height of every matched element. * * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/height/#height-value} */ height(value: number|string): JQuery; /** * Set the CSS height of every matched element. * * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/height/#height-function} */ height(func: (index: number, height: number) => number|string): JQuery; /** * Get the current computed height for the first element in the set of matched elements, including padding but not border. + * @see {@link https://api.jquery.com/innerHeight/#innerHeight} */ innerHeight(): number; @@ -1453,11 +1688,13 @@ interface JQuery { * Sets the inner height on elements in the set of matched elements, including padding but not border. * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/innerHeight/#innerHeight-value} */ - innerHeight(height: number|string): JQuery; - + innerHeight(value: number|string): JQuery; + /** * Get the current computed width for the first element in the set of matched elements, including padding but not border. + * @see {@link https://api.jquery.com/innerWidth/#innerWidth} */ innerWidth(): number; @@ -1465,23 +1702,27 @@ interface JQuery { * Sets the inner width on elements in the set of matched elements, including padding but not border. * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/innerWidth/#innerWidth-value} */ - innerWidth(width: number|string): JQuery; - + innerWidth(value: number|string): JQuery; + /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. + * @see {@link https://api.jquery.com/offset/#offset} */ offset(): JQueryCoordinates; /** * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. * * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * @see {@link https://api.jquery.com/offset/#offset-coordinates} */ offset(coordinates: JQueryCoordinates): JQuery; /** * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. * * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. + * @see {@link https://api.jquery.com/offset/#offset-function} */ offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; @@ -1489,6 +1730,7 @@ interface JQuery { * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. * * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see {@link https://api.jquery.com/outerHeight/#outerHeight-includeMargin} */ outerHeight(includeMargin?: boolean): number; @@ -1496,13 +1738,15 @@ interface JQuery { * Sets the outer height on elements in the set of matched elements, including padding and border. * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/outerHeight/#outerHeight-value} */ - outerHeight(height: number|string): JQuery; + outerHeight(value: number|string): JQuery; /** * Get the current computed width for the first element in the set of matched elements, including padding and border. * * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see {@link https://api.jquery.com/outerWidth/#outerWidth-includeMargin} */ outerWidth(includeMargin?: boolean): number; @@ -1510,50 +1754,59 @@ interface JQuery { * Sets the outer width on elements in the set of matched elements, including padding and border. * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/outerWidth/#outerWidth-value} */ - outerWidth(width: number|string): JQuery; + outerWidth(value: number|string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + * @see {@link https://api.jquery.com/position/} */ position(): JQueryCoordinates; /** * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. + * @see {@link https://api.jquery.com/scrollLeft/#scrollLeft} */ scrollLeft(): number; /** * Set the current horizontal position of the scroll bar for each of the set of matched elements. * * @param value An integer indicating the new position to set the scroll bar to. + * @see {@link https://api.jquery.com/scrollLeft/#scrollLeft-value} */ scrollLeft(value: number): JQuery; /** * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + * @see {@link https://api.jquery.com/scrollTop/#scrollTop} */ scrollTop(): number; /** * Set the current vertical position of the scroll bar for each of the set of matched elements. * * @param value An integer indicating the new position to set the scroll bar to. + * @see {@link https://api.jquery.com/scrollTop/#scrollTop-value} */ scrollTop(value: number): JQuery; /** * Get the current computed width for the first element in the set of matched elements. + * @see {@link https://api.jquery.com/width/#width} */ width(): number; /** * Set the CSS width of each element in the set of matched elements. * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + * @see {@link https://api.jquery.com/width/#width-value} */ width(value: number|string): JQuery; /** * Set the CSS width of each element in the set of matched elements. * * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/width/#width-function} */ width(func: (index: number, width: number) => number|string): JQuery; @@ -1561,6 +1814,7 @@ interface JQuery { * Remove from the queue all items that have not yet been run. * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/clearQueue/} */ clearQueue(queueName?: string): JQuery; @@ -1568,23 +1822,27 @@ interface JQuery { * Store arbitrary data associated with the matched elements. * * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any Javascript type including Array or Object. + * @param value The new data value; it can be any JavaScript type including Array or Object. + * @see {@link https://api.jquery.com/data/#data-key-value} */ data(key: string, value: any): JQuery; /** * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. * * @param key Name of the data stored. + * @see {@link https://api.jquery.com/data/#data-key} */ data(key: string): any; /** * Store arbitrary data associated with the matched elements. * * @param obj An object of key-value pairs of data to update. + * @see {@link https://api.jquery.com/data/#data-obj} */ data(obj: { [key: string]: any; }): JQuery; /** * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * @see {@link https://api.jquery.com/data/#data} */ data(): any; @@ -1592,6 +1850,7 @@ interface JQuery { * Execute the next function on the queue for the matched elements. * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/dequeue/} */ dequeue(queueName?: string): JQuery; @@ -1599,16 +1858,19 @@ interface JQuery { * Remove a previously-stored piece of data. * * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. + * @see {@link https://api.jquery.com/removeData/#removeData-name} */ removeData(name: string): JQuery; /** * Remove a previously-stored piece of data. * * @param list An array of strings naming the pieces of data to delete. + * @see {@link https://api.jquery.com/removeData/#removeData-list} */ removeData(list: string[]): JQuery; /** * Remove all previously-stored piece of data. + * @see {@link https://api.jquery.com/removeData/} */ removeData(): JQuery; @@ -1617,6 +1879,7 @@ interface JQuery { * * @param type The type of queue that needs to be observed. (default: fx) * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/promise/} */ promise(type?: string, target?: Object): JQueryPromise; @@ -1626,6 +1889,7 @@ interface JQuery { * @param properties An object of CSS properties and values that the animation will move toward. * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} */ animate(properties: Object, duration?: string|number, complete?: Function): JQuery; /** @@ -1635,6 +1899,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. (default: swing) * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} */ animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; /** @@ -1642,6 +1907,7 @@ interface JQuery { * * @param properties An object of CSS properties and values that the animation will move toward. * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/animate/#animate-properties-options} */ animate(properties: Object, options: JQueryAnimationOptions): JQuery; @@ -1650,6 +1916,7 @@ interface JQuery { * * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/delay/} */ delay(duration: number, queueName?: string): JQuery; @@ -1658,6 +1925,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-complete} */ fadeIn(duration?: number|string, complete?: Function): JQuery; /** @@ -1666,12 +1934,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-easing-complete} */ fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeIn/#fadeIn-options} */ fadeIn(options: JQueryAnimationOptions): JQuery; @@ -1680,6 +1950,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-complete} */ fadeOut(duration?: number|string, complete?: Function): JQuery; /** @@ -1688,12 +1959,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-easing-complete} */ fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeOut/#fadeOut-options} */ fadeOut(options: JQueryAnimationOptions): JQuery; @@ -1703,6 +1976,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param opacity A number between 0 and 1 denoting the target opacity. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-complete} */ fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; /** @@ -1712,6 +1986,7 @@ interface JQuery { * @param opacity A number between 0 and 1 denoting the target opacity. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-easing-complete} */ fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; @@ -1720,6 +1995,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} */ fadeToggle(duration?: number|string, complete?: Function): JQuery; /** @@ -1728,12 +2004,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} */ fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-options} */ fadeToggle(options: JQueryAnimationOptions): JQuery; @@ -1741,6 +2019,7 @@ interface JQuery { * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. * * @param queue The name of the queue in which to stop animations. + * @see {@link https://api.jquery.com/finish/} */ finish(queue?: string): JQuery; @@ -1749,6 +2028,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/hide/#hide} */ hide(duration?: number|string, complete?: Function): JQuery; /** @@ -1757,12 +2037,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/hide/#hide-duration-easing-complete} */ hide(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/hide/#hide-options} */ hide(options: JQueryAnimationOptions): JQuery; @@ -1771,6 +2053,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/show/#show} */ show(duration?: number|string, complete?: Function): JQuery; /** @@ -1779,12 +2062,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/show/#show-duration-easing-complete} */ show(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/show/#show-options} */ show(options: JQueryAnimationOptions): JQuery; @@ -1793,6 +2078,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-complete} */ slideDown(duration?: number|string, complete?: Function): JQuery; /** @@ -1801,12 +2087,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-easing-complete} */ slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideDown/#slideDown-options} */ slideDown(options: JQueryAnimationOptions): JQuery; @@ -1815,6 +2103,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-complete} */ slideToggle(duration?: number|string, complete?: Function): JQuery; /** @@ -1823,12 +2112,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-easing-complete} */ slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideToggle/#slideToggle-options} */ slideToggle(options: JQueryAnimationOptions): JQuery; @@ -1837,6 +2128,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-complete} */ slideUp(duration?: number|string, complete?: Function): JQuery; /** @@ -1845,12 +2137,14 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-easing-complete} */ slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideUp/#slideUp-options} */ slideUp(options: JQueryAnimationOptions): JQuery; @@ -1859,6 +2153,7 @@ interface JQuery { * * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see {@link https://api.jquery.com/stop/#stop-clearQueue-jumpToEnd} */ stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; /** @@ -1867,6 +2162,7 @@ interface JQuery { * @param queue The name of the queue in which to stop animations. * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see {@link https://api.jquery.com/stop/#stop-queue-clearQueue-jumpToEnd} */ stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; @@ -1875,6 +2171,7 @@ interface JQuery { * * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/toggle/#toggle-duration-complete} */ toggle(duration?: number|string, complete?: Function): JQuery; /** @@ -1883,66 +2180,76 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. + * @see {@link https://api.jquery.com/toggle/#toggle-duration-easing-complete} */ toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements. * * @param options A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/toggle/#toggle-options} */ toggle(options: JQueryAnimationOptions): JQuery; /** * Display or hide the matched elements. * * @param showOrHide A Boolean indicating whether to show or hide the elements. + * @see {@link https://api.jquery.com/toggle/#toggle-display} */ toggle(showOrHide: boolean): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} */ bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} */ bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param eventData An object containing data that will be passed to the event handler. * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} */ bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} */ bind(eventType: string, preventBubble: boolean): JQuery; /** * Attach a handler to an event for the elements. - * + * * @param events An object containing one or more DOM event types and functions to execute for them. + * @see {@link https://api.jquery.com/bind/#bind-events} */ bind(events: any): JQuery; /** * Trigger the "blur" event on an element + * @see {@link https://api.jquery.com/blur/#blur} */ blur(): JQuery; /** * Bind an event handler to the "blur" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/blur/#blur-handler} */ blur(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -1950,17 +2257,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/blur/#blur-eventData-handler} */ blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "change" event on an element. + * @see {@link https://api.jquery.com/change/#change} */ change(): JQuery; /** * Bind an event handler to the "change" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/change/#change-handler} */ change(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -1968,17 +2278,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/change/#change-eventData-handler} */ change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "click" event on an element. + * @see {@link https://api.jquery.com/click/#click} */ click(): JQuery; /** * Bind an event handler to the "click" JavaScript event * - * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/click/#click-handler} */ click(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -1986,17 +2299,41 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/click/#click-eventData-handler} */ click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Trigger the "contextmenu" event on an element. + * @see {@link https://api.jquery.com/contextmenu/#contextmenu} + */ + contextmenu(): JQuery; + /** + * Bind an event handler to the "contextmenu" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/contextmenu/#contextmenu-handler} + */ + contextmenu(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** + * Bind an event handler to the "contextmenu" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/contextmenu/#contextmenu-eventData-handler} + */ + contextmenu(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; + /** * Trigger the "dblclick" event on an element. + * @see {@link https://api.jquery.com/dblclick/#dblclick} */ dblclick(): JQuery; /** * Bind an event handler to the "dblclick" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/dblclick/#dblclick-handler} */ dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2004,20 +2341,31 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/dblclick/#dblclick-eventData-handler} */ dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. + * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-handler} + */ delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. + * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-eventData-handler} + */ delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "focus" event on an element. + * @see {@link https://api.jquery.com/focus/#focus} */ focus(): JQuery; /** * Bind an event handler to the "focus" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focus/#focus-handler} */ focus(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2025,17 +2373,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focus/#focus-eventData-handler} */ focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "focusin" event on an element. + * @see {@link https://api.jquery.com/focusin/#focusin} */ focusin(): JQuery; /** * Bind an event handler to the "focusin" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusin/#focusin-handler} */ focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2043,17 +2394,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusin/#focusin-eventData-handler} */ focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "focusout" event on an element. + * @see {@link https://api.jquery.com/focusout/#focusout} */ focusout(): JQuery; /** * Bind an event handler to the "focusout" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusout/#focusout-handler} */ focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2061,6 +2415,7 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusout/#focusout-eventData-handler} */ focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; @@ -2069,23 +2424,27 @@ interface JQuery { * * @param handlerIn A function to execute when the mouse pointer enters the element. * @param handlerOut A function to execute when the mouse pointer leaves the element. + * @see {@link https://api.jquery.com/hover/#hover-handlerIn-handlerOut} */ hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery; /** * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. * * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + * @see {@link https://api.jquery.com/hover/#hover-handlerInOut} */ hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "keydown" event on an element. + * @see {@link https://api.jquery.com/keydown/#keydown} */ keydown(): JQuery; /** * Bind an event handler to the "keydown" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keydown/#keydown-handler} */ keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; /** @@ -2093,17 +2452,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keydown/#keydown-eventData-handler} */ keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; /** * Trigger the "keypress" event on an element. + * @see {@link https://api.jquery.com/keypress/#keypress} */ keypress(): JQuery; /** * Bind an event handler to the "keypress" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keypress/#keypress-handler} */ keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; /** @@ -2111,17 +2473,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keypress/#keypress-eventData-handler} */ keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; /** * Trigger the "keyup" event on an element. + * @see {@link https://api.jquery.com/keyup/#keyup} */ keyup(): JQuery; /** * Bind an event handler to the "keyup" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keyup/#keyup-handler} */ keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; /** @@ -2129,6 +2494,7 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keyup/#keyup-eventData-handler} */ keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; @@ -2136,6 +2502,7 @@ interface JQuery { * Bind an event handler to the "load" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/load/} */ load(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2143,17 +2510,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/load/} */ load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "mousedown" event on an element. + * @see {@link https://api.jquery.com/mousedown/#mousedown} */ mousedown(): JQuery; /** * Bind an event handler to the "mousedown" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mousedown/#mousedown-handler} */ mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2161,17 +2531,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mousedown/#mousedown-eventData-handler} */ mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mouseenter" event on an element. + * @see {@link https://api.jquery.com/mouseenter/#mouseenter} */ mouseenter(): JQuery; /** * Bind an event handler to be fired when the mouse enters an element. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseenter/#mouseenter-handler} */ mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2179,17 +2552,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseenter/#mouseenter-eventData-handler} */ mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mouseleave" event on an element. + * @see {@link https://api.jquery.com/mouseleave/#mouseleave} */ mouseleave(): JQuery; /** * Bind an event handler to be fired when the mouse leaves an element. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseleave/#mouseleave-handler} */ mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2197,17 +2573,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseleave/#mouseleave-eventData-handler} */ mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mousemove" event on an element. + * @see {@link https://api.jquery.com/mousemove/#mousemove} */ mousemove(): JQuery; /** * Bind an event handler to the "mousemove" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mousemove/#mousemove-handler} */ mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2215,17 +2594,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mousemove/#mousemove-eventData-handler} */ mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mouseout" event on an element. + * @see {@link https://api.jquery.com/mouseout/#mouseout} */ mouseout(): JQuery; /** * Bind an event handler to the "mouseout" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseout/#mouseout-handler} */ mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2233,17 +2615,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseout/#mouseout-eventData-handler} */ mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mouseover" event on an element. + * @see {@link https://api.jquery.com/mouseover/#mouseover} */ mouseover(): JQuery; /** * Bind an event handler to the "mouseover" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseover/#mouseover-handler} */ mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2251,17 +2636,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseover/#mouseover-eventData-handler} */ mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Trigger the "mouseup" event on an element. + * @see {@link https://api.jquery.com/mouseup/#mouseup} */ mouseup(): JQuery; /** * Bind an event handler to the "mouseup" JavaScript event. * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseup/#mouseup-handler} */ mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** @@ -2269,11 +2657,13 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/mouseup/#mouseup-eventData-handler} */ mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; /** * Remove an event handler. + * @see {@link https://api.jquery.com/off/#off} */ off(): JQuery; /** @@ -2282,6 +2672,7 @@ interface JQuery { * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. * @param handler A handler function previously attached for the event(s), or the special value false. + * @see {@link https://api.jquery.com/off/#off-events-selector-handler} */ off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2289,6 +2680,7 @@ interface JQuery { * * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on(). + * @see {@link https://api.jquery.com/off/#off-events-selector-handler} */ off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; /** @@ -2296,6 +2688,7 @@ interface JQuery { * * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". * @param handler A handler function previously attached for the event(s), or the special value false. + * @see {@link https://api.jquery.com/off/#off-events-selector-handler} */ off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2303,6 +2696,7 @@ interface JQuery { * * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @see {@link https://api.jquery.com/off/#off-events-selector} */ off(events: { [key: string]: any; }, selector?: string): JQuery; @@ -2311,6 +2705,7 @@ interface JQuery { * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} */ on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; /** @@ -2319,6 +2714,7 @@ interface JQuery { * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} */ on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; /** @@ -2327,6 +2723,7 @@ interface JQuery { * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} */ on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; /** @@ -2336,6 +2733,7 @@ interface JQuery { * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} */ on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; /** @@ -2344,6 +2742,7 @@ interface JQuery { * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/on/#on-events-selector-data} */ on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; /** @@ -2351,6 +2750,7 @@ interface JQuery { * * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/on/#on-events-selector-data} */ on(events: { [key: string]: any; }, data?: any): JQuery; @@ -2359,6 +2759,7 @@ interface JQuery { * * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. * @param handler A function to execute at the time the event is triggered. + * @see {@link https://api.jquery.com/one/#one-events-data-handler} */ one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2367,6 +2768,7 @@ interface JQuery { * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. * @param data An object containing data that will be passed to the event handler. * @param handler A function to execute at the time the event is triggered. + * @see {@link https://api.jquery.com/one/#one-events-data-handler} */ one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; @@ -2376,6 +2778,7 @@ interface JQuery { * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} */ one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2385,6 +2788,7 @@ interface JQuery { * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} */ one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; @@ -2394,6 +2798,7 @@ interface JQuery { * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/one/#one-events-selector-data} */ one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; @@ -2402,6 +2807,7 @@ interface JQuery { * * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/one/#one-events-selector-data} */ one(events: { [key: string]: any; }, data?: any): JQuery; @@ -2410,17 +2816,20 @@ interface JQuery { * Specify a function to execute when the DOM is fully loaded. * * @param handler A function to execute after the DOM is ready. + * @see {@link https://api.jquery.com/ready/} */ ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; /** * Trigger the "resize" event on an element. + * @see {@link https://api.jquery.com/resize/#resize} */ resize(): JQuery; /** * Bind an event handler to the "resize" JavaScript event. * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/resize/#resize-handler} */ resize(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2428,17 +2837,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/resize/#resize-eventData-handler} */ resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "scroll" event on an element. + * @see {@link https://api.jquery.com/scroll/#scroll} */ scroll(): JQuery; /** * Bind an event handler to the "scroll" JavaScript event. * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/scroll/#scroll-handler} */ scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2446,17 +2858,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/scroll/#scroll-eventData-handler} */ scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "select" event on an element. + * @see {@link https://api.jquery.com/select/#select} */ select(): JQuery; /** * Bind an event handler to the "select" JavaScript event. * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/select/#select-handler} */ select(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2464,17 +2879,20 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/select/#select-eventData-handler} */ select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Trigger the "submit" event on an element. + * @see {@link https://api.jquery.com/submit/#submit} */ submit(): JQuery; /** * Bind an event handler to the "submit" JavaScript event * * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/submit/#submit-handler} */ submit(handler: (eventObject: JQueryEventObject) => any): JQuery; /** @@ -2482,103 +2900,118 @@ interface JQuery { * * @param eventData An object containing data that will be passed to the event handler. * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/submit/#submit-eventData-handler} */ submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Execute all handlers and behaviors attached to the matched elements for the given event type. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters Additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/trigger/#trigger-eventType-extraParameters} */ trigger(eventType: string, extraParameters?: any[]|Object): JQuery; /** * Execute all handlers and behaviors attached to the matched elements for the given event type. - * + * * @param event A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/trigger/#trigger-event-extraParameters} */ trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; /** * Execute all handlers attached to an element for an event. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters An array of additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters} */ triggerHandler(eventType: string, ...extraParameters: any[]): Object; /** * Execute all handlers attached to an element for an event. - * + * * @param event A jQuery.Event object. * @param extraParameters An array of additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters} */ triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; /** * Remove a previously-attached event handler from the elements. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param handler The function that is to be no longer executed. + * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler} */ unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Remove a previously-attached event handler from the elements. - * + * * @param eventType A string containing a JavaScript event type, such as click or submit. * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). + * @see {@link https://api.jquery.com/unbind/#unbind-eventType-false} */ unbind(eventType: string, fls: boolean): JQuery; /** * Remove a previously-attached event handler from the elements. - * + * * @param evt A JavaScript event object as passed to an event handler. + * @see {@link https://api.jquery.com/unbind/#unbind-event} */ unbind(evt: any): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * @see {@link https://api.jquery.com/undelegate/#undelegate} */ undelegate(): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param selector A selector which will be used to filter the event results. * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" * @param handler A function to execute at the time the event is triggered. + * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-eventType} */ undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param selector A selector which will be used to filter the event results. * @param events An object of one or more event types and previously bound functions to unbind from them. + * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-events} */ undelegate(selector: string, events: Object): JQuery; /** * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * + * * @param namespace A string containing a namespace to unbind all events from. + * @see {@link https://api.jquery.com/undelegate/#undelegate-namespace} */ undelegate(namespace: string): JQuery; /** * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * + * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/unload/#unload-handler} */ unload(handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * + * * @param eventData A plain object of data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/unload/#unload-eventData-handler} */ unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; /** * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) + * @see {@link https://api.jquery.com/context/} */ context: Element; @@ -2586,261 +3019,309 @@ interface JQuery { /** * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * + * * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/error/#error-handler} */ error(handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * + * * @param eventData A plain object of data that will be passed to the event handler. * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/error/#error-eventData-handler} */ error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; /** * Add a collection of DOM elements onto the jQuery stack. - * + * * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @see {@link https://api.jquery.com/pushStack/#pushStack-elements} */ pushStack(elements: any[]): JQuery; /** * Add a collection of DOM elements onto the jQuery stack. - * + * * @param elements An array of elements to push onto the stack and make into a new jQuery object. * @param name The name of a jQuery method that generated the array of elements. * @param arguments The arguments that were passed in to the jQuery method (for serialization). + * @see {@link https://api.jquery.com/pushStack/#pushStack-elements-name-arguments} */ pushStack(elements: any[], name: string, arguments: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. + * + * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. + * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. + * @see {@link https://api.jquery.com/after/#after-content-content} */ - after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * + * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/after/#after-function} */ after(func: (index: number, html: string) => string|Element|JQuery): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. + * + * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. + * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. + * @see {@link https://api.jquery.com/append/#append-content-content} */ - append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + * + * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/append/#append-function} */ append(func: (index: number, html: string) => string|Element|JQuery): JQuery; /** * Insert every element in the set of matched elements to the end of the target. - * + * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/appendTo/} */ appendTo(target: JQuery|any[]|Element|string): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + * + * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. + * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + * @see {@link https://api.jquery.com/before/#before-content-content} */ - before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * + * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/before/#before-function} */ before(func: (index: number, html: string) => string|Element|JQuery): JQuery; /** * Create a deep copy of the set of matched elements. - * - * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). + * + * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. + * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). + * @see {@link https://api.jquery.com/clone/} */ clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; /** * Remove the set of matched elements from the DOM. - * - * param selector A selector expression that filters the set of matched elements to be removed. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + * @see {@link https://api.jquery.com/detach/} */ detach(selector?: string): JQuery; /** * Remove all child nodes of the set of matched elements from the DOM. + * @see {@link https://api.jquery.com/empty/} */ empty(): JQuery; /** * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. + * + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/insertAfter/} */ insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; /** * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. + * + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/insertBefore/} */ insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. + * + * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. + * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. + * @see {@link https://api.jquery.com/prepend/#prepend-content-content} */ - prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + * + * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/prepend/#prepend-function} */ prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; /** * Insert every element in the set of matched elements to the beginning of the target. - * + * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/prependTo/} */ prependTo(target: JQuery|any[]|Element|string): JQuery; /** * Remove the set of matched elements from the DOM. - * + * * @param selector A selector expression that filters the set of matched elements to be removed. + * @see {@link https://api.jquery.com/remove/} */ remove(selector?: string): JQuery; /** * Replace each target element with the set of matched elements. - * + * * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + * @see {@link https://api.jquery.com/replaceAll/} */ replaceAll(target: JQuery|any[]|Element|string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + * + * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + * @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent} */ replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param func A function that returns content with which to replace the set of matched elements. + * + * @param func A function that returns content with which to replace the set of matched elements. + * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function} */ replaceWith(func: () => Element|JQuery): JQuery; /** * Get the combined text contents of each element in the set of matched elements, including their descendants. + * @see {@link https://api.jquery.com/text/#text} */ text(): string; /** * Set the content of each element in the set of matched elements to the specified text. - * + * * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. + * @see {@link https://api.jquery.com/text/#text-text} */ text(text: string|number|boolean): JQuery; /** * Set the content of each element in the set of matched elements to the specified text. - * + * * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. + * @see {@link https://api.jquery.com/text/#text-function} */ text(func: (index: number, text: string) => string): JQuery; /** * Retrieve all the elements contained in the jQuery set, as an array. + * @name toArray + * @see {@link https://api.jquery.com/toArray/} */ - toArray(): any[]; + toArray(): HTMLElement[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + * @see {@link https://api.jquery.com/unwrap/} */ unwrap(): JQuery; /** * Wrap an HTML structure around each element in the set of matched elements. - * + * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + * @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement} */ wrap(wrappingElement: JQuery|Element|string): JQuery; /** * Wrap an HTML structure around each element in the set of matched elements. - * + * * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/wrap/#wrap-function} */ wrap(func: (index: number) => string|JQuery): JQuery; /** * Wrap an HTML structure around all elements in the set of matched elements. - * + * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + * @see {@link https://api.jquery.com/wrapAll/#wrapAll-wrappingElement} */ wrapAll(wrappingElement: JQuery|Element|string): JQuery; + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param func A callback function returning the HTML content or jQuery object to wrap around all the matched elements. Within the function, this refers to the first element in the set. + * @see {@link https://api.jquery.com/wrapAll/#wrapAll-function} + */ wrapAll(func: (index: number) => string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. - * + * * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. + * @see {@link https://api.jquery.com/wrapInner/#wrapInner-wrappingElement} */ wrapInner(wrappingElement: JQuery|Element|string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. - * + * * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/wrapInner/#wrapInner-function} */ wrapInner(func: (index: number) => string): JQuery; /** * Iterate over a jQuery object, executing a function for each matched element. - * - * @param func A function to execute for each matched element. + * + * @param func A function to execute for each matched element. Can stop the loop by returning false. + * @see {@link https://api.jquery.com/each/} */ - each(func: (index: number, elem: Element) => any): JQuery; + each(func: (index: number, elem: Element) => boolean | void): JQuery; /** * Retrieve one of the elements matched by the jQuery object. - * + * * @param index A zero-based integer indicating which element to retrieve. + * @see {@link https://api.jquery.com/get/#get-index} */ get(index: number): HTMLElement; /** * Retrieve the elements matched by the jQuery object. + * @alias toArray + * @see {@link https://api.jquery.com/get/#get} */ - get(): any[]; + get(): HTMLElement[]; /** * Search for a given element from among the matched elements. + * @see {@link https://api.jquery.com/index/#index} */ index(): number; /** * Search for a given element from among the matched elements. - * + * * @param selector A selector representing a jQuery collection in which to look for an element. + * @see {@link https://api.jquery.com/index/#index-selector} */ index(selector: string|JQuery|Element): number; /** * The number of elements in the jQuery object. + * @see {@link https://api.jquery.com/length/} */ length: number; /** * A selector representing selector passed to jQuery(), if any, when creating the original set. * version deprecated: 1.7, removed: 1.9 + * @see {@link https://api.jquery.com/selector/} */ selector: string; [index: string]: any; @@ -2848,371 +3329,426 @@ interface JQuery { /** * Add elements to the set of matched elements. - * + * * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. + * @see {@link https://api.jquery.com/add/#add-selector} */ add(selector: string, context?: Element): JQuery; /** * Add elements to the set of matched elements. - * + * * @param elements One or more elements to add to the set of matched elements. + * @see {@link https://api.jquery.com/add/#add-elements} */ add(...elements: Element[]): JQuery; /** * Add elements to the set of matched elements. - * + * * @param html An HTML fragment to add to the set of matched elements. + * @see {@link https://api.jquery.com/add/#add-html} */ add(html: string): JQuery; /** * Add elements to the set of matched elements. - * + * * @param obj An existing jQuery object to add to the set of matched elements. + * @see {@link https://api.jquery.com/add/#add-selection} */ add(obj: JQuery): JQuery; /** * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/children/} */ children(selector?: string): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/closest/#closest-selector} */ closest(selector: string): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param selector A string containing a selector expression to match elements against. * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + * @see {@link https://api.jquery.com/closest/#closest-selector-context} */ closest(selector: string, context?: Element): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param obj A jQuery object to match elements against. + * @see {@link https://api.jquery.com/closest/#closest-selection} */ closest(obj: JQuery): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * + * * @param element An element to match elements against. + * @see {@link https://api.jquery.com/closest/#closest-element} */ closest(element: Element): JQuery; /** * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * + * * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + * @see {@link https://api.jquery.com/closest/#closest-selectors-context} */ closest(selectors: any, context?: Element): any[]; /** * Get the children of each element in the set of matched elements, including text and comment nodes. + * @see {@link https://api.jquery.com/contents/} */ contents(): JQuery; /** * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. + * @see {@link https://api.jquery.com/end/} */ end(): JQuery; /** * Reduce the set of matched elements to the one at the specified index. - * + * * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * + * @see {@link https://api.jquery.com/eq/} */ eq(index: number): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param selector A string containing a selector expression to match the current set of elements against. + * @see {@link https://api.jquery.com/filter/#filter-selector} */ filter(selector: string): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param func A function used as a test for each element in the set. this is the current DOM element. + * @see {@link https://api.jquery.com/filter/#filter-function} */ - filter(func: (index: number, element: Element) => any): JQuery; + filter(func: (index: number, element: Element) => boolean): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param element An element to match the current set of elements against. + * @see {@link https://api.jquery.com/filter/#filter-elements} */ filter(element: Element): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. - * + * * @param obj An existing jQuery object to match the current set of elements against. + * @see {@link https://api.jquery.com/filter/#filter-selection} */ filter(obj: JQuery): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/find/#find-selector} */ find(selector: string): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param element An element to match elements against. + * @see {@link https://api.jquery.com/find/#find-element} */ find(element: Element): JQuery; /** * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * + * * @param obj A jQuery object to match elements against. + * @see {@link https://api.jquery.com/find/#find-element} */ find(obj: JQuery): JQuery; /** * Reduce the set of matched elements to the first in the set. + * @see {@link https://api.jquery.com/first/} */ first(): JQuery; /** * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/has/#has-selector} */ has(selector: string): JQuery; /** * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * + * * @param contained A DOM element to match elements against. + * @see {@link https://api.jquery.com/has/#has-contained} */ has(contained: Element): JQuery; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/is/#is-selector} */ is(selector: string): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. + * @see {@link https://api.jquery.com/is/#is-function} */ is(func: (index: number, element: Element) => boolean): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param obj An existing jQuery object to match the current set of elements against. + * @see {@link https://api.jquery.com/is/#is-selection} */ is(obj: JQuery): boolean; /** * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * + * * @param elements One or more elements to match the current set of elements against. + * @see {@link https://api.jquery.com/is/#is-elements} */ is(elements: any): boolean; /** * Reduce the set of matched elements to the final one in the set. + * @see {@link https://api.jquery.com/last/} */ last(): JQuery; /** * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - * + * * @param callback A function object that will be invoked for each element in the current set. + * @see {@link https://api.jquery.com/map/} */ map(callback: (index: number, domElement: Element) => any): JQuery; /** * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/next/} */ next(selector?: string): JQuery; /** * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextAll/} */ nextAll(selector?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextUntil/#nextUntil-selector-filter} */ nextUntil(selector?: string, filter?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextUntil/#nextUntil-element-filter} */ nextUntil(element?: Element, filter?: string): JQuery; /** * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextUntil/#nextUntil-element-filter} */ nextUntil(obj?: JQuery, filter?: string): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/not/#not-selector} */ not(selector: string): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param func A function used as a test for each element in the set. this is the current DOM element. + * @see {@link https://api.jquery.com/not/#not-function} */ not(func: (index: number, element: Element) => boolean): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param elements One or more DOM elements to remove from the matched set. + * @see {@link https://api.jquery.com/not/#not-selection} */ not(elements: Element|Element[]): JQuery; /** * Remove elements from the set of matched elements. - * + * * @param obj An existing jQuery object to match the current set of elements against. + * @see {@link https://api.jquery.com/not/#not-selection} */ not(obj: JQuery): JQuery; /** * Get the closest ancestor element that is positioned. + * @see {@link https://api.jquery.com/offsetParent/} */ offsetParent(): JQuery; /** * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parent/} */ parent(selector?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parents/} */ parents(selector?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-selector-filter} */ parentsUntil(selector?: string, filter?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-element-filter} */ parentsUntil(element?: Element, filter?: string): JQuery; /** * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-element-filter} */ parentsUntil(obj?: JQuery, filter?: string): JQuery; /** * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prev/} */ prev(selector?: string): JQuery; /** * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevAll/} */ prevAll(selector?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevUntil/#prevUntil-selector-filter} */ prevUntil(selector?: string, filter?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevUntil/#prevUntil-element-filter} */ prevUntil(element?: Element, filter?: string): JQuery; /** * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * + * * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevUntil/#prevUntil-element-filter} */ prevUntil(obj?: JQuery, filter?: string): JQuery; /** * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * + * * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/siblings/} */ siblings(selector?: string): JQuery; /** * Reduce the set of matched elements to a subset specified by a range of indices. - * + * * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + * @see {@link https://api.jquery.com/slice/} */ slice(start: number, end?: number): JQuery; /** * Show the queue of functions to be executed on the matched elements. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/queue/#queue-queueName} */ queue(queueName?: string): any[]; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param newQueue An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} */ queue(newQueue: Function[]): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} */ queue(callback: Function): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param newQueue An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} */ queue(queueName: string, newQueue: Function[]): JQuery; /** * Manipulate the queue of functions to be executed, once for each matched element. - * + * * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} */ queue(queueName: string, callback: Function): JQuery; } @@ -3220,4 +3756,4 @@ declare module "jquery" { export = $; } declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; \ No newline at end of file +declare var $: JQueryStatic; diff --git a/DynamicBibleIonic/typings/globals/jquery/typings.json b/DynamicBibleIonic/typings/globals/jquery/typings.json new file mode 100644 index 00000000..49e6d39b --- /dev/null +++ b/DynamicBibleIonic/typings/globals/jquery/typings.json @@ -0,0 +1,8 @@ +{ + "resolution": "main", + "tree": { + "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts", + "raw": "registry:dt/jquery#1.10.0+20170310222111", + "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts" + } +} diff --git a/DynamicBibleIonic/typings/globals/mathjs/index.d.ts b/DynamicBibleIonic/typings/globals/mathjs/index.d.ts new file mode 100644 index 00000000..1030ba99 --- /dev/null +++ b/DynamicBibleIonic/typings/globals/mathjs/index.d.ts @@ -0,0 +1,2280 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/11b6a6aecf429fdb7c2f013e5c1fe23a93b1fe0e/mathjs/index.d.ts +declare var math: mathjs.IMathJsStatic; + +declare namespace mathjs { + + type MathArray = number[]|number[][]; + type MathType = number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix; + type MathExpression = string|string[]|MathArray|Matrix; + + export interface IMathJsStatic { + + e: number; + pi: number; + i: number; + Infinity: number; + LN2: number; + LN10: number; + LOG2E: number; + LOG10E: number; + NaN: number; + null: number; + phi: number; + SQRT1_2: number; + SQRT2: number; + tau: number; + + uninitialized: any; + version: string; + + config(options: any): void; + + expression: MathNode; + + /** + * Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix. + * @param L A N x N matrix or array (L) + * @param b A column vector with the b values + * @returns A column vector with the linear system solution (x) + */ + lsolve(L: Matrix|MathArray, b: Matrix|MathArray): Matrix|MathArray; + + /** + * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U) + * and a row permutation vector p where A[p,:] = L * U + * @param A A two dimensional matrix or array for which to get the LUP decomposition. + * @returns The lower triangular matrix, the upper triangular matrix and the permutation matrix. + */ + lup(A?: Matrix|MathArray): MathArray; + + /** + * Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector. + * @param A Invertible Matrix or the Matrix LU decomposition + * @param b Column Vector + * @returns Column vector with the solution to the linear system A * x = b + */ + lusolve(A: Matrix|MathArray|Number, b: Matrix|MathArray): Matrix|MathArray; + + /** + * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in + * two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U + * @param A A two dimensional sparse matrix for which to get the LU decomposition. + * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is + * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic + * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. + * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed + * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with + * more than 10*sqr(columns) entries. + * @param threshold Partial pivoting threshold (1 for partial pivoting) + * @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors. + */ + slu(A: Matrix, order: Number, threshold: Number): any; + + /** + * Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b + * @param U A N x N matrix or array (U) + * @param b A column vector with the b values + * @returns A column vector with the linear system solution (x) + */ + usolve(U: Matrix|MathArray, b:Matrix|MathArray): Matrix|MathArray; + + /** + * Calculate the absolute value of a number. For matrices, the function is evaluated element wise. + * @param x A number or matrix for which to get the absolute value + * @returns Absolute value of x + */ + abs(x: number): number; + abs(x: BigNumber): BigNumber; + abs(x: Fraction): Fraction; + abs(x: Complex): Complex; + abs(x: MathArray): MathArray; + abs(x: Matrix): Matrix; + abs(x: Unit): Unit; + + /** + * Add two values, x + y. For matrices, the function is evaluated element wise. + * @param x First value to add + * @param y Second value to add + * @returns Sum of x and y + */ + add(x: MathType, y: MathType): MathType; + + /** + * Calculate the cubic root of a value. For matrices, the function is evaluated element wise. + * @param x Value for which to calculate the cubic root. + * @param allRoots Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. + * @returns Returns the cubic root of x + */ + cbrt(x: number, allRoots?: boolean): number; + cbrt(x: BigNumber, allRoots?: boolean): BigNumber; + cbrt(x: Fraction, allRoots?: boolean): Fraction; + cbrt(x: Complex, allRoots?: boolean): Complex; + cbrt(x: MathArray, allRoots?: boolean): MathArray; + cbrt(x: Matrix, allRoots?: boolean): Matrix; + cbrt(x: Unit, allRoots?: boolean): Unit; + + /** + * Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise. + * @param x Number to be rounded + * @returns Rounded value + */ + ceil(x: number): number; + ceil(x: BigNumber): BigNumber; + ceil(x: Fraction): Fraction; + ceil(x: Complex): Complex; + ceil(x: MathArray): MathArray; + ceil(x: Matrix): Matrix; + ceil(x: Unit): Unit; + + /** + * Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise. + * @param x Number for which to calculate the cube + * @returns Cube of x + */ + cube(x: number): number; + cube(x: BigNumber): BigNumber; + cube(x: Fraction): Fraction; + cube(x: Complex): Complex; + cube(x: MathArray): MathArray; + cube(x: Matrix): Matrix; + cube(x: Unit): Unit; + + /** + * Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y). + * @param x Numerator + * @param y Denominator + * @returns Quotient, x / y + */ + divide(x: Unit, y: Unit): Unit; + divide(x: number, y: number): number; + divide(x:MathType, y:MathType): MathType; + + /** + * Divide two matrices element wise. The function accepts both matrices and scalar values. + * @param x Numerator + * @param y Denominator + * @returns Quotient, x ./ y + */ + dotDivide(x: MathType, y: MathType): MathType; + + /** + * Multiply two matrices element wise. The function accepts both matrices and scalar values. + * @param x Left hand value + * @param y Right hand value + * @returns Multiplication of x and y + */ + dotMultiply(x: MathType, y: MathType): MathType; + + /** + * Calculates the power of x to y element wise. + * @param x The base + * @param y The exponent + * @returns The value of x to the power y + */ + dotPow(x: MathType, y: MathType): MathType; + + /** + * Calculate the exponent of a value. For matrices, the function is evaluated element wise. + * @param x A number or matrix to exponentiate + * #returns Exponent of x + */ + exp(x: number): number; + exp(x: BigNumber ): BigNumber ; + exp(x: Complex ): Complex ; + exp(x: MathArray ): MathArray ; + exp(x: Matrix): Matrix; + + /** + * Round a value towards zero. For matrices, the function is evaluated element wise. + * @param x Number to be rounded + * @returns Rounded value + */ + fix(x: number): number; + fix(x: BigNumber ): BigNumber ; + fix(x: Fraction ): Fraction ; + fix(x: Complex ): Complex ; + fix(x: MathArray ): MathArray ; + fix(x: Matrix): Matrix; + + /** + * Round a value towards minus infinity. For matrices, the function is evaluated element wise. + * @param Number to be rounded + * @returns Rounded value + */ + floor(x: number): number; + floor(x: BigNumber ): BigNumber ; + floor(x: Fraction ): Fraction ; + floor(x: Complex ): Complex ; + floor(x: MathArray ): MathArray ; + floor(x: Matrix): Matrix; + + /** + * Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise. + */ + gcd(...args: number[]): number; + gcd(...args: BigNumber[]): BigNumber ; + gcd(...args: Fraction[]): Fraction ; + gcd(...args: MathArray[]): MathArray ; + gcd(...args: Matrix[]): Matrix; + + /** + * Calculate the hypotenusa of a list with values. The hypotenusa is defined as: + * hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) + * For matrix input, the hypotenusa is calculated for all values in the matrix. + */ + hypot(...args: number[]): number; + hypot(...args: BigNumber[]): BigNumber; + + /** + * Calculate the least common multiple for two or more values or arrays. lcm is defined as: + * lcm(a, b) = abs(a * b) / gcd(a, b) + * For matrices, the function is evaluated element wise. + */ + lcm(a: number, b: number): number; + lcm(a: BigNumber , b: BigNumber ): BigNumber ; + lcm(a: MathArray, b: MathArray): MathArray; + lcm(a: Matrix, b: Matrix): Matrix; + + /** + * Calculate the logarithm of a value. For matrices, the function is evaluated element wise. + * @param x Value for which to calculate the logarithm. + * @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e. + */ + log(x: number|BigNumber|Complex|MathArray|Matrix, base?: number|BigNumber|Complex): number|BigNumber|Complex|MathArray|Matrix; + + /** + * Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise. + * @param x Value for which to calculate the logarithm. + */ + log10(x: number): number; + log10(x: BigNumber): BigNumber; + log10(x: Complex): Complex; + log10(x: MathArray): MathArray; + log10(x: Matrix): Matrix; + + /** + * Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise. + * The modulus is defined as: + * x - y * floor(x / y) + * See http://en.wikipedia.org/wiki/Modulo_operation. + * @param x Dividend + * @param y Divisor + */ + mod(x: number|BigNumber|Fraction|MathArray|Matrix, y: number|BigNumber|Fraction|MathArray|Matrix): number|BigNumber|Fraction|MathArray|Matrix; + + /** + * Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated. + */ + multiply(x: MathArray|Matrix, y: MathArray|Matrix): Matrix; + multiply(x: MathArray|Matrix, y: MathType): Matrix; + multiply(x: Unit, y: Unit): Unit; + multiply(x: number, y: number): number; + multiply(x: MathType, y: MathType): MathType; + + /** + * Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2. + * @param x Value for which to calculate the norm + * @param p Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2. + * @returns the p-norm + */ + norm(x: number|BigNumber|Complex|MathArray|Matrix, p?: number|BigNumber|string): number|BigNumber; + + /** + * Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation + * x^root = A + * For matrices, the function is evaluated element wise. + * @param a Value for which to calculate the nth root + * @param root The root. Default value: 2. + */ + nthRoot(a: number|BigNumber|MathArray|Matrix|Complex, root?: number|BigNumber): number|Complex|MathArray|Matrix; + + /** + * Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y. + * @param x The base + * @param y The exponent + */ + pow(x: number|BigNumber|Complex|MathArray|Matrix, y: number|BigNumber|Complex): number|BigNumber|Complex|MathArray|Matrix; + + /** + * Round a value towards the nearest integer. For matrices, the function is evaluated element wise. + * @param x Number to be rounded + * @param n Number of decimals Default value: 0. + */ + round(x: number|BigNumber|Fraction|Complex|MathArray|Matrix, n?: number|BigNumber|MathArray): number|BigNumber|Fraction|Complex|MathArray|Matrix; + + /** + * Compute the sign of a value. The sign of a value x is: + * 1 when x > 1 + * -1 when x < 0 + * 0 when x == 0 + * For matrices, the function is evaluated element wise. + */ + sign(x: number): number; + sign(x: BigNumber ): BigNumber; + sign(x: Fraction ): Fraction ; + sign(x: Complex ): Complex ; + sign(x: MathArray): MathArray; + sign(x: Matrix): Matrix; + sign(x: Unit): Unit; + + /** + * Calculate the square root of a value. For matrices, the function is evaluated element wise. + */ + sqrt(x: number): number; + sqrt(x: BigNumber ): BigNumber; + sqrt(x: Complex ): Complex ; + sqrt(x: MathArray): MathArray; + sqrt(x: Matrix): Matrix; + sqrt(x: Unit): Unit; + + /** + * Compute the square of a value, x * x. For matrices, the function is evaluated element wise. + */ + square(x: number): number; + square(x: BigNumber ): BigNumber; + square(x: Fraction ): Fraction ; + square(x: Complex ): Complex ; + square(x: MathArray): MathArray; + square(x: Matrix): Matrix; + square(x: Unit): Unit; + + /** + * Subtract two values, x - y. For matrices, the function is evaluated element wise. + */ + subtract(x: MathType, y: MathType): MathType; + + /** + * Inverse the sign of a value, apply a unary minus operation. + * For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted. + */ + unaryMinus(x: number): number; + unaryMinus(x: BigNumber ): BigNumber; + unaryMinus(x: Fraction ): Fraction ; + unaryMinus(x: Complex ): Complex ; + unaryMinus(x: MathArray): MathArray; + unaryMinus(x: Matrix): Matrix; + unaryMinus(x: Unit): Unit; + + /** + * Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. + * For matrices, the function is evaluated element wise. + */ + unaryPlus(x: number): number; + unaryPlus(x: BigNumber ): BigNumber; + unaryPlus(x: Fraction ): Fraction ; + unaryPlus(x: string): string; + unaryPlus(x: Complex ): Complex ; + unaryPlus(x: MathArray): MathArray; + unaryPlus(x: Matrix): Matrix; + unaryPlus(x: Unit): Unit; + + /** + * Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. + */ + xgcd(a: number|BigNumber, b: number|BigNumber): MathArray; + + /** + * Bitwise AND two values, x & y. For matrices, the function is evaluated element wise. + */ + bitAnd(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; + + /** + * Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + */ + bitNot(x: number): number; + bitNot(x: BigNumber ): BigNumber ; + bitNot(x: MathArray): MathArray; + bitNot(x: Matrix): Matrix; + + /** + * Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base. + */ + bitOr(x: number): number; + bitOr(x: BigNumber ): BigNumber ; + bitOr(x: MathArray): MathArray; + bitOr(x: Matrix): Matrix; + + /** + * Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise. + */ + bitXor(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; + + /** + * Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + leftShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix; + + /** + * Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + rightArithShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix; + + /** + * Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + rightLogShift(x: number|MathArray|Matrix, y: number): number|MathArray|Matrix; + + /** + * The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. The following condition must be enforced: n >= 0 + * @param n Total number of objects in the set + */ + bellNumbers(n: Number): Number; + bellNumbers(n: BigNumber): BigNumber; + + /** + * The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0 + * @pararm n nth Catalan number + */ + catalan(n: Number): Number; + catalan(n: BigNumber): BigNumber; + + /** + * The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n. + * @param n Total number of objects in the set + * @param k Number of objects in the subset + * @returns Returns the composition counts of n into k parts. + */ + composition(n: Number|BigNumber, k: Number|BigNumber): Number|BigNumber + + /** + * The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n. + * If n = k or k = 1, then s(n,k) = 1 + * @param n Total number of objects in the set + * @param k Number of objects in the subset + */ + stirlingS2(n: Number|BigNumber, k: Number|BigNumber): Number|BigNumber; + + /** + * Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise. + * @param x A complex number or array with complex numbers + */ + arg(x: number): number; + arg(x: Complex): number; + arg(x: MathArray): MathArray; + arg(x: Matrix): Matrix; + + /** + * Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise. + * @param x A complex number or array with complex numbers + */ + conj(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|Complex|MathArray|Matrix; + + /** + * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b. + * For matrices, the function is evaluated element wise. + */ + im(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix; + + /** + * Get the real part of a complex number. For a complex number a + bi, the function returns a. + * For matrices, the function is evaluated element wise. + */ + re(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix; + + /** + * Create a BigNumber, which can store numbers with arbitrary precision. When a matrix is provided, all elements will be converted to BigNumber. + */ + bignumber(x?: number|string|MathArray|Matrix|boolean): BigNumber; + + /** + * Create a boolean or convert a string or number to a boolean. In case of a number, true is returned for non-zero numbers, and false in case of zero. Strings can be 'true' or 'false', or can contain a number. When value is a matrix, all elements will be converted to boolean. + */ + boolean(x: string|number|boolean|MathArray|Matrix ): boolean|MathArray|Matrix; + + /** + * Wrap any value in a chain, allowing to perform chained operations on the value. + * All methods available in the math.js library can be called upon the chain, and then will be evaluated with the value itself as first argument. The chain can be closed by executing chain.done(), which returns the final value. + * The chain has a number of special functions: + * done() Finalize the chain and return the chain's value. + * valueOf() The same as done() + * toString() Executes math.format() onto the chain's value, returning a string representation of the value. + */ + chain(value?: any): IMathJsChain; + + /** + * Create a complex value or convert a value to a complex value. + */ + complex(): Complex; + complex(re: number, im: number): Complex; + complex(complex: Complex): Complex; + complex(arg: string): Complex; + complex(array: MathArray): Complex; + complex(obj: IPolarCoordinates): Complex; + + /** + * Create a fraction convert a value to a fraction. + */ + fraction(numerator: number|string|MathArray|Matrix, denominator?: number|string|MathArray|Matrix): Fraction|MathArray|Matrix; + + /** + * Create an index. An Index can store ranges having start, step, and end for multiple dimensions. Matrix.get, Matrix.set, and math.subset accept an Index as input. + */ + index(...ranges: any[]): Index; + + /** + * Create a Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility functions + * to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. Supported + * storage formats are 'dense' and 'sparse'. + */ + matrix(format?: 'sparse'|'dense'): Matrix; + matrix(data: MathArray|Matrix, format?: 'sparse'|'dense', dataType?: string): Matrix; + + /** + * Create a number or convert a string, boolean, or unit to a number. When value is a matrix, all elements will be converted to number. + */ + number(value?: string|number|boolean|MathArray|Matrix|Unit): number|MathArray|Matrix; + number(unit: Unit, valuelessUnit: Unit|string): number|MathArray|Matrix; + + /** + * Create a Sparse Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility + * functions to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. + * @param data A two dimensional array + */ + sparse(data?: MathArray|Matrix, dataType?:string): Matrix; + + /** + * Create a string or convert any object into a string. Elements of Arrays and Matrices are processed element wise. + * @param value A value to convert to a string + */ + string(value: any): string|MathArray|Matrix; + + /** + * Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object. + * When a matrix is provided, all elements will be converted to units. + */ + unit(unit: string): Unit; + unit(value: number, unit: string): Unit; + + /** + * Parse and compile an expression. Returns a an object with a function eval([scope]) to evaluate the compiled expression. + */ + compile(expr: MathExpression): EvalFunction; + compile(exprs: MathExpression[]): EvalFunction[]; + + /** + * Evaluate an expression. + */ + eval(expr: MathExpression, scope?: any): any; + eval(exprs: MathExpression[], scope?: any): any; + + /** + * Retrieve help on a function or data type. Help files are retrieved from the documentation in math.expression.docs. + */ + help(search: any): Help; + + /** + * Parse an expression. Returns a node tree, which can be evaluated by invoking node.eval(); + */ + parse(expr: MathExpression, options?: any): MathNode; + parse(exprs: MathExpression[], options?: any): MathNode[]; + + /** + * Create a parser. The function creates a new math.expression.Parser object. + */ + parser(): Parser; + + /** + * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point + * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When + * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric + * equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c) + */ + distance(x: MathArray|Matrix|any, y: MathArray|Matrix|any): Number | BigNumber; + + /** + * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in + * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions + * return null if the lines do not meet. + * Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0. + * @param w Co-ordinates of first end-point of first line + * @param x Co-ordinates of second end-point of first line + * @param y Co-ordinates of first end-point of second line OR Co-efficients of the plane's equation + * @param z Co-ordinates of second end-point of second line OR null if the calculation is for line and plane + * @returns Returns the point of intersection of lines/lines-planes + */ + intersect(w: MathArray|Matrix, x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): MathArray; + + /** + * Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + and(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; + + /** + * Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise. + */ + not(x: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; + + /** + * Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + or(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; + + /** + * Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + xor(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix; + + /** + * Concatenate two or more matrices. + * dim: number is a zero-based dimension over which to concatenate the matrices. By default the last dimension of the matrices. + */ + concat(...args: (MathArray|Matrix|number)[]): MathArray|Matrix; + + /** + * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3] + * and B =[b1, b2, b3] is defined as: + * cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ] + */ + cross(x: MathArray|Matrix, y: MathArray|Matrix): Matrix; + + /** + * Calculate the determinant of a matrix. + */ + det(x: MathArray|Matrix): number; + + /** + * Create a diagonal matrix or retrieve the diagonal of a matrix. + * When x is a vector, a matrix with vector x on the diagonal will be returned. When x is a two dimensional matrix, + * the matrixes kth diagonal will be returned + * as vector. When k is positive, the values are placed on the super diagonal. When k is negative, the values are + * placed on the sub diagonal. + * @param X A two dimensional matrix or a vector + * @param k The diagonal where the vector will be filled in or retrieved. Default value: 0. + * @param format The matrix storage format. Default value: 'dense'. + */ + diag(X: MathArray|Matrix, format?: string): Matrix; + diag(X: MathArray|Matrix, k: number|BigNumber, format?: string): Matrix; + + /** + * Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] + * is defined as: + * dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn + */ + dot(x: MathArray|Matrix, y: MathArray|Matrix): number; + + /** + * Create a 2-dimensional identity matrix with size m x n or n x n. The matrix has ones on the diagonal and zeros elsewhere. + */ + eye(n: number, format?: string): Matrix; + eye(m: number, n: number, format?: string): Matrix; + eye(size: number[], format?: string): Matrix; + + /** + * Flatten a multi dimensional matrix into a single dimensional matrix. + */ + flatten(x: MathArray|Matrix): MathArray|Matrix; + + /** + * Calculate the inverse of a square matrix. + */ + inv(x: number|Complex|MathArray|Matrix): number|Complex|MathArray|Matrix; + + /** + * Create a matrix filled with ones. The created matrix can have one or multiple dimensions. + */ + ones(n: number, format?: string): MathArray|Matrix; + ones(m: number, n: number, format?: string): MathArray|Matrix; + ones(size: number[], format?: string): MathArray|Matrix; + + /** + * Create an array from a range. By default, the range end is excluded. This can be customized by providing an extra parameter includeEnd. + * @param str A string 'start:end' or 'start:step:end' + * @param start Start of the range + * @param end End of the range, excluded by default, included when parameter includeEnd=true + * @param step Step size. Default value is 1. + * @returns Parameters describing the ranges start, end, and optional step. + */ + range(str: string, includeEnd?: boolean): Matrix; + range(start: number|BigNumber, end:number|BigNumber, includeEnd?:boolean): Matrix; + range(start: number|BigNumber, end: number|BigNumber, step: number|BigNumber, includeEnd?:boolean): Matrix; + + /** + * Resize a matrix + * @param x Matrix to be resized + * @param size One dimensional array with numbers + * @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0. + */ + resize(x: MathArray|Matrix, size: MathArray|Matrix, defaultValue?: number|string): MathArray|Matrix; + + /** + * Calculate the size of a matrix or scalar. + */ + size(x: boolean|number|Complex|Unit|string|MathArray|Matrix): MathArray|Matrix; + + /** + * Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. + */ + squeeze(x: MathArray|Matrix): Matrix|MathArray; + + /** + * Get or set a subset of a matrix or string. + * @param value An array, matrix, or string + * @param index An index containing ranges for each dimension + * @param replacement An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned + * @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined. + */ + subset(value: MathArray|Matrix|string, index: Index, replacement?: any, defaultValue?: any): MathArray|Matrix|string; + + /** + * Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. + */ + trace(x: MathArray|Matrix): number; + + /** + * Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported. + */ + transpose(x: MathArray|Matrix): MathArray|Matrix; + + /** + * Create a matrix filled with zeros. The created matrix can have one or multiple dimensions. + */ + zeros(n: number, format?: string): MathArray|Matrix; + zeros(m: number, n: number, format?: string): MathArray|Matrix; + zeros(size: number[], format?: string): MathArray|Matrix; + + /** + * Compute the number of ways of picking k unordered outcomes from n possibilities. + * Combinations only takes integer arguments. The following condition must be enforced: k <= n. + */ + combinations(n: number|BigNumber, k: number|BigNumber): number|BigNumber; + + /** + * Create a distribution object with a set of random functions for given random distribution. + * @param name Name of a distribution. Choose from 'uniform', 'normal'. + */ + distribution(name: string): Distribution; + + /** + * Compute the factorial of a value + * Factorial only supports an integer value as argument. For matrices, the function is evaluated element wise. + */ + factorial(n: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix; + + /** + * Compute the gamma function of a value using Lanczos approximation for small values, and an extended + * Stirling approximation for large values. + * For matrices, the function is evaluated element wise. + */ + gamma(n: number|MathArray|Matrix): number|MathArray|Matrix; + + /** + * Calculate the Kullback-Leibler (KL) divergence between two distributions + */ + kldivergence(x: MathArray|Matrix, y: MathArray|Matrix): number; + + /** + * Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from n possibilities. + * multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0 + */ + multinomial(a: number[]|BigNumber[]): number|BigNumber; + + /** + * Compute the number of ways of obtaining an ordered subset of k elements from a set of n elements. + * Permutations only takes integer arguments. The following condition must be enforced: k <= n. + * @param n The number of objects in total + * @param k The number of objects in the subset + */ + permutations(n: number|BigNumber, k?:number|BigNumber): number|BigNumber; + + /** + * Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution. + */ + pickRandom(array: number[]): number; + + /** + * Return a random number larger or equal to min and smaller than max using a uniform distribution. + */ + random(): number; + random(max: number): number; + random(min: number, max: number): number; + random(size: MathArray|Matrix, max?: number): MathArray|Matrix; + random(size: MathArray|Matrix, min:number, max: number): MathArray|Matrix; + + /** + * Return a random integer number larger or equal to min and smaller than max using a uniform distribution. + */ + randomInt(max: number): number; + randomInt(min: number, max: number): number; + randomInt(size: MathArray|Matrix, max?: number): MathArray|Matrix; + randomInt(size: MathArray|Matrix, min:number, max: number): MathArray|Matrix; + + /** + * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. + * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * For matrices, the function is evaluated element wise. + */ + compare(x: MathType, y: MathType): number|BigNumber|Fraction|MathArray|Matrix; + + /** + * Test element wise whether two matrices are equal. The function accepts both matrices and scalar values. + */ + deepEqual(x: MathType, y: MathType): number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix; + + /** + * Test whether two values are equal. + * + * The function tests whether the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. + * + * Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else. + */ + equal(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Test whether value x is larger than y. + * + * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + larger(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Test whether value x is larger or equal to y. + * + * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + largerEq(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Test whether value x is smaller than y. + * + * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + smaller(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Test whether value x is smaller or equal to y. + * + * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. + */ + smallerEq(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Test whether two values are unequal. + * + * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot + * be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. + * + * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with + * everying except. undefined. + */ + unequal(x: MathType, y: MathType): boolean|MathArray|Matrix; + + /** + * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened + * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + max(...args: MathType[]): any; + max(A: MathArray|Matrix, dim?: number): any; + + /** + * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be + * calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + mean(...args: MathType[]): any; + mean(A: MathArray|Matrix, dim?: number): any; + + /** + * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an + * even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit + * + * In case of a (multi dimensional) array or matrix, the median of all elements will be calculated. + */ + median(...args: MathType[]): any; + + /** + * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened + * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + min(...args: MathType[]): any; + min(A: MathArray|Matrix, dim?: number): any; + + /** + * Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values. + */ + mode(...args: MathType[]): any; + + /** + * Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. + */ + prod(...args: MathType[]): any; + + /** + * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. + * Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber + * + * In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated. + */ + quantileSeq(A: MathArray|Matrix, prob: Number|BigNumber|MathArray, sorted?: boolean): Number|BigNumber|Unit|MathArray; + + /** + * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the + * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will + * be calculated. + * + * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following + * values: + * + * 'unbiased' (default) The sum of squared errors is divided by (n - 1) + * 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + */ + std(array: MathArray|Matrix, normalization?: string): number; + + /** + * Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. + */ + sum(...args: (Number|BigNumber|Fraction)[]): any; + sum(array: MathArray|Matrix): any; + + /** + * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all + * elements will be calculated. + * + * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the + * following values: + * + * 'unbiased' (default) The sum of squared errors is divided by (n - 1) + * 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...) + * instead of math.var(...). + */ + var(...args: (Number|BigNumber|Fraction)[]): any; + var(array: MathArray|Matrix, normalization?: string): any; + + /** + * Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise. + */ + acos(x: number): number; + acos(x: BigNumber): BigNumber; + acos(x: Complex): Complex; + acos(x: MathArray): MathArray; + acos(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 - 1) + x). + * For matrices, the function is evaluated element wise. + */ + acosh(x: number): number; + acosh(x: BigNumber): BigNumber; + acosh(x: Complex): Complex; + acosh(x: MathArray): MathArray; + acosh(x: Matrix): Matrix; + + /** + * Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise. + */ + acot(x: number): number; + acot(x: BigNumber): BigNumber; + acot(x: MathArray): MathArray; + acot(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2. + * For matrices, the function is evaluated element wise. + */ + acoth(x: number): number; + acoth(x: BigNumber): BigNumber; + acoth(x: MathArray): MathArray; + acoth(x: Matrix): Matrix; + + /** + * Calculate the inverse cosecant of a value. For matrices, the function is evaluated element wise. + */ + acsc(x: number): number; + acsc(x: BigNumber): BigNumber; + acsc(x: MathArray): MathArray; + acsc(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)). + * For matrices, the function is evaluated element wise. + */ + acsch(x: number): number; + acsch(x: BigNumber): BigNumber; + acsch(x: MathArray): MathArray; + acsch(x: Matrix): Matrix; + + /** + * Calculate the inverse secant of a value. For matrices, the function is evaluated element wise. + */ + asec(x: number): number; + asec(x: BigNumber): BigNumber; + asec(x: MathArray): MathArray; + asec(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise. + */ + asech(x: number): number; + asech(x: BigNumber): BigNumber; + asech(x: MathArray): MathArray; + asech(x: Matrix): Matrix; + + /** + * Calculate the inverse sine of a value. For matrices, the function is evaluated element wise. + */ + asin(x: number): number; + asin(x: BigNumber): BigNumber; + asin(x: Complex): Complex; + asin(x: MathArray): MathArray; + asin(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise. + */ + asinh(x: number): number; + asinh(x: BigNumber): BigNumber; + asinh(x: MathArray): MathArray; + asinh(x: Matrix): Matrix; + + /** + * Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise. + */ + atan(x: number): number; + atan(x: BigNumber): BigNumber; + atan(x: MathArray): MathArray; + atan(x: Matrix): Matrix; + + /** + * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the + * computed angle can be determined. + * + * For matrices, the function is evaluated element wise. + */ + atan2(y: number, x: number): number; + atan2(y: MathArray|Matrix, x: MathArray|Matrix): MathArray|Matrix; + + /** + * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2. + * For matrices, the function is evaluated element wise. + */ + atanh(x: number): number; + atanh(x: BigNumber): BigNumber; + atanh(x: MathArray): MathArray; + atanh(x: Matrix): Matrix; + + /** + * Calculate the cosine of a value. For matrices, the function is evaluated element wise. + */ + asin(x: number): number; + asin(x: BigNumber): BigNumber; + asin(x: Complex): Complex; + asin(x: Unit): number; + asin(x: MathArray): MathArray; + asin(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise. + */ + cosh(x: number): number; + cosh(x: BigNumber): BigNumber; + cosh(x: Complex): Complex; + cosh(x: Unit): number; + cosh(x: MathArray): MathArray; + cosh(x: Matrix): Matrix; + + /** + * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise. + */ + cot(x: number): number; + cot(x: Complex): Complex; + cot(x: Unit): number; + cot(x: MathArray): MathArray; + cot(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise. + */ + coth(x: number): number; + coth(x: Complex): Complex; + coth(x: Unit): number; + coth(x: MathArray): MathArray; + coth(x: Matrix): Matrix; + + /** + * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise. + */ + csc(x: number): number; + csc(x: Complex): Complex; + csc(x: Unit): number; + csc(x: MathArray): MathArray; + csc(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise. + */ + csch(x: number): number; + csch(x: Complex): Complex; + csch(x: Unit): number; + csch(x: MathArray): MathArray; + csch(x: Matrix): Matrix; + + /** + * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise. + */ + sec(x: number): number; + sec(x: Complex): Complex; + sec(x: Unit): number; + sec(x: MathArray): MathArray; + sec(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise. + */ + sech(x: number): number; + sech(x: Complex): Complex; + sech(x: Unit): number; + sech(x: MathArray): MathArray; + sech(x: Matrix): Matrix; + + /** + * Calculate the sine of a value. For matrices, the function is evaluated element wise. + */ + sin(x: number): number; + sin(x: BigNumber): BigNumber; + sin(x: Complex): Complex; + sin(x: Unit): number; + sin(x: MathArray): MathArray; + sin(x: Matrix): Matrix; + + /** + * Calculate the cosine of a value. For matrices, the function is evaluated element wise. + */ + cos(x: number): number; + cos(x: BigNumber): BigNumber; + cos(x: Complex): Complex; + cos(x: Unit): number; + cos(x: MathArray): MathArray; + cos(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise. + */ + sinh(x: number): number; + sinh(x: BigNumber): BigNumber; + sinh(x: Complex): Complex; + sinh(x: Unit): number; + sinh(x: MathArray): MathArray; + sinh(x: Matrix): Matrix; + + /** + * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise. + */ + tan(x: number): number; + tan(x: BigNumber): BigNumber; + tan(x: Complex): Complex; + tan(x: Unit): number; + tan(x: MathArray): MathArray; + tan(x: Matrix): Matrix; + + /** + * Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise. + */ + tanh(x: number): number; + tanh(x: BigNumber): BigNumber; + tanh(x: Complex): Complex; + tanh(x: Unit): number; + tanh(x: MathArray): MathArray; + tanh(x: Matrix): Matrix; + + /** + * Change the unit of a value. For matrices, the function is evaluated element wise. + * @param x The unit to be converted. + * @param unit New unit. Can be a string like "cm" or a unit without value. + */ + to(x: Unit|MathArray|Matrix, unit: Unit|string): Unit|MathArray|Matrix + + /** + * Clone an object. + */ + clone(x: any): any; + + /** + * Filter the items in an array or one dimensional matrix. + * @param x A one dimensional matrix or array to filter + * @param test + */ + filter(x: MathArray|Matrix, test: RegExp|((item: any)=>boolean)): MathArray|Matrix; + + /** + * Iterate over all elements of a matrix/array, and executes the given callback function. + * @param x The matrix to iterate on. + * @param callback The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed. + */ + forEach(x: MathArray|Matrix, callback: (item: any)=>any): void; + + /** + * Format a value of any type into a string. + * @param value The value to be formatted + */ + format(value: any, options?: IFormatOptions|number|((item: any)=>string)): string; + + /** + * Test whether a value is an integer number. The function supports number, BigNumber, and Fraction. + * The function is evaluated element-wise in case of Array or Matrix input. + */ + isInteger(x: any): boolean; + + /** + * Test whether a value is negative: smaller than zero. The function supports types number, BigNumber, Fraction, and Unit. + * The function is evaluated element-wise in case of Array or Matrix input. + */ + isNegative(x: any): boolean; + + /** + * Test whether a value is an numeric value. The function is evaluated element-wise in case of Array or Matrix input. + */ + isNumeric(x: any): boolean; + + /** + * Test whether a value is positive: larger than zero. The function supports types number, BigNumber, Fraction, and Unit. + * The function is evaluated element-wise in case of Array or Matrix input. + */ + isPositive(x: any): boolean; + + /** + * Test whether a value is zero. The function can check for zero for types number, BigNumber, Fraction, Complex, and Unit. + * The function is evaluated element-wise in case of Array or Matrix input. + */ + isZero(x: any): boolean; + + /** + * Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array. + * @param x The matrix to iterate on. + * @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed. + */ + map(x: MathArray|Matrix, callback: (item: any)=>any): MathArray|Matrix; + + /** + * Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect. + * @param x A one dimensional matrix or array to sort + * @param k The kth smallest value to be retrieved; zero-based index + * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. + * @returns Returns the kth lowest value. + */ + partitionSelect(x: MathArray|Matrix, k: number, compare?: string|((a: any, b: any)=>number)): any; + + /** + * Interpolate values into a string template. + * @param template A string containing variable placeholders. + * @param values An object containing variables which will be filled in in the template. + * @param precision Number of digits to format numbers. If not provided, the value will not be rounded. + */ + print(template:string, values: any, precision?: number): void; + + /** + * Sort the items in a matrix. + * @param x A one dimensional matrix or array to sort + * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. + */ + sort(x: MathArray|Matrix, compare?: string|((a: any, b: any)=>number)): MathArray|Matrix; + + /** + * Determine the type of a variable. + */ + typeof(x: any): string; + } + + export interface Matrix { + type: string; + storage(): string; + datatype(): string; + density(): number; + subset(index: Index, replacement?: any, defaultValue?: any): Matrix; + get(index: number[]): any; + set(index: number[], value: any, defaultValue?: number|string): Matrix; + resize(size: MathArray|Matrix, defaultValue?: number|string): Matrix; + clone(): Matrix; + size(): number[]; + map(callback: (a: any, b: number, c: Matrix) => any, skipZeros?: boolean): Matrix; + forEach(callback: (a: any, b: number, c: Matrix) => void, skipZeros?: boolean): void; + toJSON(): any; + diagonal(k?: number|BigNumber): any[]; + swapRows(i: number, j: number): Matrix; + } + + export interface BigNumber { + + } + + export interface Fraction { + + } + + export interface Complex { + re: number; + im: number; + toPolar(): IPolarCoordinates; + clone(): Complex; + } + + export interface IPolarCoordinates { + r: number; + phi: number; + } + + export interface Unit { + to(unit: string): Unit; + toNumber(unit: string): number; + } + + export interface Index { + + } + + export interface EvalFunction { + eval(scope?: any): any; + } + + export interface MathNode { + isNode: boolean; + isSymbolNode?: boolean; + isConstantNode?: boolean; + isOperatorNode?: boolean; + op?: string; + fn?: string; + args?: MathNode[]; + type: string; + name?: string; + value?: any; + + compile(): EvalFunction; + eval(): any; + eval(expr: string): any; + /** + * + * Filter nodes in an expression tree. The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree, + * and must return a boolean. The function filter returns an array with nodes for which the test returned true. + * Parameter path is a string containing a relative JSON Path. + * + * Example: + * + * ``` + * var node = math.parse('x^2 + x/4 + 3*y'); + * var filtered = node.filter(function (node) { + * return node.isSymbolNode && node.name == 'x'; + * }); + * // returns an array with two entries: two SymbolNodes 'x' + * ``` + * + * @param The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree, and must return a boolean. The function filter returns an array with nodes for which the test returned true. Parameter path is a string containing a relative JSON Path. + * @param {Function} callback(node [description] + * @return {[Mathnode]} Returns an array with nodes for which test returned true + */ + filter(callback: (node: MathNode, path: string, parent: MathNode)=>any ): MathNode[]; + + + /** + * [forEach description] + * @param {MathNode} callback(node [description] + * @return {[type]} [description] + */ + forEach(callback: (node: MathNode, path: string, parent: MathNode)=>any): MathNode[]; + + + /** + * `traverse(callback)` + * + * Recursively traverse all nodes in a node tree. Executes given callback for this node and each of its child nodes. Similar to Array.forEach, except recursive. The callback function is a mapping function accepting a node, and returning a replacement for the node or the original node. Function callback is called as callback(node: Node, path: string, parent: Node) for every node in the tree. Parameter path is a string containing a relative JSON Path. Example: + * + * ``` + * var node = math.parse('3 * x + 2'); + * node.traverse(function (node, path, parent) { + * switch (node.type) { + * case 'OperatorNode': console.log(node.type, node.op); break; + * case 'ConstantNode': console.log(node.type, node.value); break; + * case 'SymbolNode': console.log(node.type, node.name); break; + * default: console.log(node.type); + * } + * }); + * // outputs: + * // OperatorNode + + * // OperatorNode * + * // ConstantNode 3 + * // SymbolNode x + * // ConstantNode 2 + * ``` + * + * @param {MathNode} callback=(node [description] + * @return {[type]} [description] + */ + traverse(callback: (node: MathNode, path: string, parent: MathNode)=> void): any; +//addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any); + /** + * Recursively transform an expression tree via a transform function. Similar to Array.map, + * but recursively executed on all nodes in the expression tree. The callback function is a + * mapping function accepting a node, and returning a replacement for the node or the original node. + * Function callback is called as callback(node: Node, path: string, parent: Node) for every node in + * the tree, and must return a Node. Parameter path is a string containing a relative JSON Path. + * + * For example, to replace all nodes of type SymbolNode having name ‘x’ with a ConstantNode with value 3: + * ```js + * var node = math.parse('x^2 + 5*x'); + * var transformed = node.transform(function (node, path, parent) { + * if (node.SymbolNode && node.name == 'x') { + * return new math.expression.node.ConstantNode(3); + * } + * else { + * return node; + * } + * }); + * transformed.toString(); // returns '(3 ^ 2) + (5 * 3)' + * ``` + */ + transform(callback: (node: MathNode, path: string, parent: MathNode)=>MathNode): MathNode; + /** + * Transform a node. Creates a new Node having it’s childs be the results of calling the provided + * callback function for each of the childs of the original node. The callback function is called + * as `callback(child: Node, path: string, parent: Node)` and must return a Node. + * Parameter path is a string containing a relative JSON Path. + * + * + * See also transform, which is a recursive version of map. + */ + map(callback: (node: MathNode, path: string, parent: MathNode)=>MathNode): MathNode; + } + + + export interface Parser { + eval(expr: string): any; + get(variable: string): any; + set(variable: string, value: any): void; + clear(): void; + } + + export interface Distribution { + random(size: any, min?: any, max?: any): any; + randomInt(min: any, max?: any): any; + pickRandom(array: any): any; + } + + export interface IFormatOptions { + /** + * Number notation. Choose from: + * 'fixed' Always use regular number notation. For example '123.40' and '14000000' + * 'exponential' Always use exponential notation. For example '1.234e+2' and '1.4e+7' + * 'auto' (default) Regular number notation for numbers having an absolute value between lower and upper bounds, and + * uses exponential notation elsewhere. Lower bound is included, upper bound is excluded. For example '123.4' and '1.4e7'. + */ + notation?: string; + + /** + * A number between 0 and 16 to round the digits of the number. In case of notations 'exponential' and 'auto', + * precision defines the total number of significant digits returned and is undefined by default. In case of notation 'fixed', + * precision defines the number of significant digits after the decimal point, and is 0 by default. + */ + precision?: number; + + /** + * An object containing two parameters, {number} lower and {number} upper, used by notation 'auto' to determine + * when to return exponential notation. Default values are lower=1e-3 and upper=1e5. Only applicable for notation auto. + */ + exponential?: {lower: number; upper: number}; + + /** + * Available values: 'ratio' (default) or 'decimal'. For example format(fraction(1, 3)) will output '1/3' when 'ratio' + * is configured, and will output 0.(3) when 'decimal' is configured. + */ + fraction?: string; + + /** + * A custom formatting function. Can be used to override the built-in notations. Function fn is called with + * value as parameter and must return a string. Is useful for example to format all values inside a matrix in a particular way. + * */ + fn?: (item: any)=>string; + } + + export interface Help { + toString(): string; + toJSON(): string; + } + + export interface IMathJsChain { + /** + * Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix. + * @param b A column vector with the b values + */ + lsolve(b: Matrix|MathArray): IMathJsChain; + + /** + * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U) + * and a row permutation vector p where A[p,:] = L * U + */ + lup(): IMathJsChain; + + /** + * Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector. + * @param b Column Vector + */ + lusolve(b: Matrix|MathArray): IMathJsChain; + + /** + * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in + * two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U + * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is + * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic + * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. + * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed + * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with + * more than 10*sqr(columns) entries. + * @param threshold Partial pivoting threshold (1 for partial pivoting) + * @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors. + */ + slu(order: Number, threshold: Number): IMathJsChain; + + /** + * Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b + * @param b A column vector with the b values + * @returns A column vector with the linear system solution (x) + */ + usolve(b:Matrix|MathArray): IMathJsChain; + + /** + * Calculate the absolute value of a number. For matrices, the function is evaluated element wise. + */ + abs(): IMathJsChain; + + /** + * Add two values, x + y. For matrices, the function is evaluated element wise. + * @param y Second value to add + */ + add(y: MathType): IMathJsChain; + + /** + * Calculate the cubic root of a value. For matrices, the function is evaluated element wise. + * @param allRoots Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. + */ + cbrt(allRoots?: boolean): IMathJsChain; + + /** + * Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise. + */ + ceil(): IMathJsChain; + + /** + * Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise. + */ + cube(): IMathJsChain; + + /** + * Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y). + * @param y Denominator + */ + divide(y:MathType): IMathJsChain; + + /** + * Divide two matrices element wise. The function accepts both matrices and scalar values. + * @param y Denominator + */ + dotDivide(y: MathType): IMathJsChain; + + /** + * Multiply two matrices element wise. The function accepts both matrices and scalar values. + * @param y Right hand value + */ + dotMultiply(y: MathType): IMathJsChain; + + /** + * Calculates the power of x to y element wise. + * @param y The exponent + */ + dotPow(y: MathType): IMathJsChain; + + /** + * Calculate the exponent of a value. For matrices, the function is evaluated element wise. + */ + exp(): IMathJsChain; + + /** + * Round a value towards zero. For matrices, the function is evaluated element wise. + */ + fix(): IMathJsChain; + + /** + * Round a value towards minus infinity. For matrices, the function is evaluated element wise. + */ + floor(): IMathJsChain; + + /** + * Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise. + */ + gcd(...args: number[]): IMathJsChain; + gcd(...args: BigNumber[]): IMathJsChain ; + gcd(...args: Fraction[]): IMathJsChain ; + gcd(...args: MathArray[]): IMathJsChain ; + gcd(...args: Matrix[]): IMathJsChain; + + /** + * Calculate the hypotenusa of a list with values. The hypotenusa is defined as: + * hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) + * For matrix input, the hypotenusa is calculated for all values in the matrix. + */ + hypot(...args: number[]): IMathJsChain; + hypot(...args: BigNumber[]): IMathJsChain; + + /** + * Calculate the least common multiple for two or more values or arrays. lcm is defined as: + * lcm(a, b) = abs(a * b) / gcd(a, b) + * For matrices, the function is evaluated element wise. + */ + lcm(b: number): IMathJsChain; + lcm(b: BigNumber ): IMathJsChain ; + lcm(b: MathArray): IMathJsChain; + lcm(b: Matrix): IMathJsChain; + + /** + * Calculate the logarithm of a value. For matrices, the function is evaluated element wise. + * @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e. + */ + log(base?: number|BigNumber|Complex): IMathJsChain; + + /** + * Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise. + */ + log10(): IMathJsChain; + + /** + * Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise. + * The modulus is defined as: + * x - y * floor(x / y) + * See http://en.wikipedia.org/wiki/Modulo_operation. + * @param y Divisor + */ + mod(y: number|BigNumber|Fraction|MathArray|Matrix): IMathJsChain; + + /** + * Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated. + */ + multiply(y: MathType): IMathJsChain; + + /** + * Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2. + * @param p Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2. + */ + norm(p?: number|BigNumber|string): IMathJsChain; + + /** + * Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation + * x^root = A + * For matrices, the function is evaluated element wise. + * @param root The root. Default value: 2. + */ + nthRoot(root?: number|BigNumber): IMathJsChain; + + /** + * Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y. + * @param y The exponent + */ + pow(y: number|BigNumber|Complex): IMathJsChain; + + /** + * Round a value towards the nearest integer. For matrices, the function is evaluated element wise. + * @param n Number of decimals Default value: 0. + */ + round(n?: number|BigNumber|MathArray): IMathJsChain; + + /** + * Compute the sign of a value. The sign of a value x is: + * 1 when x > 1 + * -1 when x < 0 + * 0 when x == 0 + * For matrices, the function is evaluated element wise. + */ + sign(): IMathJsChain; + + /** + * Calculate the square root of a value. For matrices, the function is evaluated element wise. + */ + sqrt(): IMathJsChain; + + /** + * Compute the square of a value, x * x. For matrices, the function is evaluated element wise. + */ + square(): IMathJsChain; + + /** + * Subtract two values, x - y. For matrices, the function is evaluated element wise. + */ + subtract(y: MathType): IMathJsChain; + + /** + * Inverse the sign of a value, apply a unary minus operation. + * For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted. + */ + unaryMinus(): IMathJsChain; + + /** + * Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. + * For matrices, the function is evaluated element wise. + */ + unaryPlus(): IMathJsChain; + + /** + * Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. + */ + xgcd(b: number|BigNumber): IMathJsChain; + + /** + * Bitwise AND two values, x & y. For matrices, the function is evaluated element wise. + */ + bitAnd(y: number|BigNumber|MathArray|Matrix): IMathJsChain; + + /** + * Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + */ + bitNot(): IMathJsChain; + + /** + * Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base. + */ + bitOr(): IMathJsChain; + + /** + * Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise. + */ + bitXor(y: number|BigNumber|MathArray|Matrix): IMathJsChain; + + /** + * Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + leftShift(y: number|BigNumber): IMathJsChain; + + /** + * Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + rightArithShift(y: number|BigNumber): IMathJsChain; + + /** + * Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base. + * @param x Value to be shifted + * @param y Amount of shifts + */ + rightLogShift(y: number): IMathJsChain; + + /** + * The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. The following condition must be enforced: n >= 0 + * @param n Total number of objects in the set + */ + bellNumbers(): IMathJsChain; + + /** + * The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0 + * @pararm n nth Catalan number + */ + catalan(): IMathJsChain; + + /** + * The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n. + * @param n Total number of objects in the set + * @param k Number of objects in the subset + * @returns Returns the composition counts of n into k parts. + */ + composition(k: Number|BigNumber): IMathJsChain; + + /** + * The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n. + * If n = k or k = 1, then s(n,k) = 1 + * @param n Total number of objects in the set + * @param k Number of objects in the subset + */ + stirlingS2(k: Number|BigNumber): IMathJsChain; + + /** + * Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise. + * @param x A complex number or array with complex numbers + */ + arg(): IMathJsChain; + + /** + * Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise. + * @param x A complex number or array with complex numbers + */ + conj(): IMathJsChain; + + /** + * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b. + * For matrices, the function is evaluated element wise. + */ + im(): IMathJsChain; + + /** + * Get the real part of a complex number. For a complex number a + bi, the function returns a. + * For matrices, the function is evaluated element wise. + */ + re(): IMathJsChain; + + /** + * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point + * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When + * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric + * equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c) + */ + distance(y: MathArray|Matrix|any): IMathJsChain; + + /** + * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in + * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions + * return null if the lines do not meet. + * Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0. + * @param w Co-ordinates of first end-point of first line + * @param x Co-ordinates of second end-point of first line + * @param y Co-ordinates of first end-point of second line OR Co-efficients of the plane's equation + * @param z Co-ordinates of second end-point of second line OR null if the calculation is for line and plane + * @returns Returns the point of intersection of lines/lines-planes + */ + intersect(x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): IMathJsChain; + + /** + * Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + and(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain; + + /** + * Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise. + */ + not(): IMathJsChain; + + /** + * Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + or(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain; + + /** + * Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise. + */ + xor(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain; + + /** + * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3] + * and B =[b1, b2, b3] is defined as: + * cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ] + */ + cross(y: MathArray|Matrix): IMathJsChain; + + /** + * Calculate the determinant of a matrix. + */ + det(): IMathJsChain; + + /** + * Resize a matrix + * @param x Matrix to be resized + * @param size One dimensional array with numbers + * @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0. + */ + resize(size: MathArray|Matrix, defaultValue?: number|string): IMathJsChain; + + /** + * Calculate the size of a matrix or scalar. + */ + size(): IMathJsChain; + + /** + * Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. + */ + squeeze(): IMathJsChain; + + /** + * Get or set a subset of a matrix or string. + * @param value An array, matrix, or string + * @param index An index containing ranges for each dimension + * @param replacement An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned + * @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined. + */ + subset(index: Index, replacement?: any, defaultValue?: any): IMathJsChain; + + /** + * Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. + */ + trace(): IMathJsChain; + + /** + * Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported. + */ + transpose(): IMathJsChain; + + /** + * Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution. + */ + pickRandom(): IMathJsChain; + + /** + * Return a random number larger or equal to min and smaller than max using a uniform distribution. + */ + random(): IMathJsChain; + random(max?: number): IMathJsChain; + random(min:number, max: number): IMathJsChain; + + /** + * Return a random integer number larger or equal to min and smaller than max using a uniform distribution. + */ + randomInt(max?: number): IMathJsChain; + randomInt(min:number, max: number): IMathJsChain; + + /** + * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. + * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * For matrices, the function is evaluated element wise. + */ + compare(y: MathType): IMathJsChain; + + /** + * Test element wise whether two matrices are equal. The function accepts both matrices and scalar values. + */ + deepEqual(y: MathType): IMathJsChain; + + /** + * Test whether two values are equal. + * + * The function tests whether the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. + * + * Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else. + */ + equal(y: MathType): IMathJsChain; + + /** + * Test whether value x is larger than y. + * + * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + larger(y: MathType): IMathJsChain; + + /** + * Test whether value x is larger or equal to y. + * + * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + largerEq(y: MathType): IMathJsChain; + + /** + * Test whether value x is smaller than y. + * + * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. + */ + smaller(IMathJsChainy: MathType): IMathJsChain; + + /** + * Test whether value x is smaller or equal to y. + * + * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon. + * The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. + */ + smallerEq(IMathJsChainy: MathType): IMathJsChain; + + /** + * Test whether two values are unequal. + * + * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot + * be used to compare values smaller than approximately 2.22e-16. + * + * For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. + * + * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with + * everying except. undefined. + */ + unequal(IMathJsChainy: MathType): IMathJsChain; + + /** + * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened + * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + max(dim?: number): IMathJsChain; + + /** + * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be + * calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + mean(dim?: number): IMathJsChain; + + /** + * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an + * even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit + * + * In case of a (multi dimensional) array or matrix, the median of all elements will be calculated. + */ + median(): IMathJsChain; + + /** + * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened + * array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based. + */ + min(dim?: number): IMathJsChain; + + /** + * Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values. + */ + mode(): IMathJsChain; + + /** + * Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. + */ + prod(): IMathJsChain; + + /** + * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. + * Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber + * + * In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated. + */ + quantileSeq(prob: Number|BigNumber|MathArray, sorted?: boolean): IMathJsChain; + + /** + * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the + * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will + * be calculated. + * + * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following + * values: + * + * 'unbiased' (default) The sum of squared errors is divided by (n - 1) + * 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + */ + std(normalization?: string): IMathJsChain; + + /** + * Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated. + */ + sum(): IMathJsChain; + + /** + * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all + * elements will be calculated. + * + * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the + * following values: + * + * 'unbiased' (default) The sum of squared errors is divided by (n - 1) + * 'uncorrected' The sum of squared errors is divided by n + * 'biased' The sum of squared errors is divided by (n + 1) + * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...) + * instead of math.var(...). + */ + var(normalization?: string): IMathJsChain; + + /** + * Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise. + */ + acos(): IMathJsChain; + + /** + * Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 - 1) + x). + * For matrices, the function is evaluated element wise. + */ + acosh(): IMathJsChain; + + /** + * Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise. + */ + acot(): IMathJsChain; + + /** + * Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2. + * For matrices, the function is evaluated element wise. + */ + acoth(): IMathJsChain; + + /** + * Calculate the inverse cosecant of a value. For matrices, the function is evaluated element wise. + */ + acsc(): IMathJsChain; + + /** + * Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)). + * For matrices, the function is evaluated element wise. + */ + acsch(): IMathJsChain; + + /** + * Calculate the inverse secant of a value. For matrices, the function is evaluated element wise. + */ + asec(): IMathJsChain; + + /** + * Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise. + */ + asech(): IMathJsChain; + + /** + * Calculate the inverse sine of a value. For matrices, the function is evaluated element wise. + */ + asin(): IMathJsChain; + + /** + * Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise. + */ + asinh(): IMathJsChain; + + /** + * Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise. + */ + atan(): IMathJsChain; + + /** + * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the + * computed angle can be determined. + * + * For matrices, the function is evaluated element wise. + */ + atan2(x: number): IMathJsChain; + atan2(x: MathArray|Matrix): IMathJsChain; + + /** + * Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2. + * For matrices, the function is evaluated element wise. + */ + atanh(): IMathJsChain; + + /** + * Calculate the cosine of a value. For matrices, the function is evaluated element wise. + */ + asin(): IMathJsChain; + + /** + * Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise. + */ + cosh(): IMathJsChain; + + /** + * Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise. + */ + cot(): IMathJsChain; + + /** + * Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise. + */ + coth(): IMathJsChain; + + /** + * Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise. + */ + csc(): IMathJsChain; + + /** + * Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise. + */ + csch(): IMathJsChain; + + /** + * Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise. + */ + sec(): IMathJsChain; + + /** + * Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise. + */ + sech(): IMathJsChain; + + /** + * Calculate the sine of a value. For matrices, the function is evaluated element wise. + */ + sin(): IMathJsChain; + + /** + * Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise. + */ + sinh(): IMathJsChain; + + /** + * Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise. + */ + tan(): IMathJsChain; + + /** + * Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise. + */ + tanh(): IMathJsChain; + + /** + * Change the unit of a value. For matrices, the function is evaluated element wise. + * @param x The unit to be converted. + * @param unit New unit. Can be a string like "cm" or a unit without value. + */ + to(unit: Unit|string): IMathJsChain; + + /** + * Clone an object. + */ + clone(): IMathJsChain; + + /** + * Filter the items in an array or one dimensional matrix. + * @param x A one dimensional matrix or array to filter + * @param test + */ + filter(test: RegExp|((item: any)=>boolean)): IMathJsChain; + + /** + * Format a value of any type into a string. + */ + format(options?: IFormatOptions|number|((item: any)=>string)): IMathJsChain; + + /** + * Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array. + * @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed. + */ + map(callback: (item: any)=>any): IMathJsChain; + + /** + * Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect. + * @param k The kth smallest value to be retrieved; zero-based index + * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. + * @returns Returns the kth lowest value. + */ + partitionSelect(k: number, compare?: string|((a: any, b: any)=>number)): IMathJsChain; + + /** + * Sort the items in a matrix. + * @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. + */ + sort(compare?: string|((a: any, b: any)=>number)): IMathJsChain; + + done(): any; + valueOf(): any; + toString(): string; + } +} + +declare module 'mathjs'{ + export = math; +} diff --git a/DynamicBibleIonic/typings/globals/mathjs/typings.json b/DynamicBibleIonic/typings/globals/mathjs/typings.json new file mode 100644 index 00000000..9446403e --- /dev/null +++ b/DynamicBibleIonic/typings/globals/mathjs/typings.json @@ -0,0 +1,8 @@ +{ + "resolution": "main", + "tree": { + "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/11b6a6aecf429fdb7c2f013e5c1fe23a93b1fe0e/mathjs/index.d.ts", + "raw": "registry:dt/mathjs#0.0.0+20170126160507", + "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/11b6a6aecf429fdb7c2f013e5c1fe23a93b1fe0e/mathjs/index.d.ts" + } +} diff --git a/DynamicBibleIonic/typings/index.d.ts b/DynamicBibleIonic/typings/index.d.ts index 841268a2..018adcbc 100644 --- a/DynamicBibleIonic/typings/index.d.ts +++ b/DynamicBibleIonic/typings/index.d.ts @@ -1 +1,3 @@ /// +/// +/// diff --git a/DynamicBibleIonic/www/index.html b/DynamicBibleIonic/www/index.html index d7157b60..9718a9ac 100644 --- a/DynamicBibleIonic/www/index.html +++ b/DynamicBibleIonic/www/index.html @@ -29,7 +29,8 @@ - + + \ No newline at end of file diff --git a/DynamicBibleIonic/www/lib/math.min.js b/DynamicBibleIonic/www/lib/math.min.js new file mode 100644 index 00000000..545fac30 --- /dev/null +++ b/DynamicBibleIonic/www/lib/math.min.js @@ -0,0 +1,55 @@ +/** + * math.js + * https://github.com/josdejong/mathjs + * + * Math.js is an extensive math library for JavaScript and Node.js, + * It features real and complex numbers, units, matrices, a large set of + * mathematical functions, and a flexible expression parser. + * + * @version 3.16.0 + * @date 2017-08-06 + * + * @license + * Copyright (C) 2013-2017 Jos de Jong + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=146)}([function(e,t,r){"use strict";function n(e,t,r,n){function i(t,r,n){var i=e.Matrix.storage(r||"default");return new i(t,n)}var a=n("matrix",{"":function(){return i([])},string:function(e){return i([],e)},"string, string":function(e,t){return i([],e,t)},Array:function(e){return i(e)},Matrix:function(e){return i(e,e.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});return a.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},a}t.name="matrix",t.factory=n},function(e,t,r){"use strict";e.exports=function e(t,r,n){return t&&"function"==typeof t.map?t.map(function(t){return e(t,r,n)}):r(t)}},function(e,t,r){"use strict";function n(e,t,r){var i,a=e.length;if(a!=t[r])throw new f(a,t[r]);if(r")}function i(e,r,n,a){var o,s,u=e.length,c=r[n],f=Math.min(u,c);if(e.length=c,n=t)throw new l(e,t)},t.UNINITIALIZED={},t.resize=function(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");t.forEach(function(e){if(!u.isNumber(e)||!u.isInteger(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+c.format(t)+")")});var n=void 0!==r?r:0;return i(e,t,0,n),e},t.reshape=function(e,r){var n,i=t.flatten(e),o=function(e){return e.reduce(function(e,t){return e*t})};if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new f(0,o(t.size(e)),"!=");try{n=a(i,r)}catch(n){if(n instanceof f)throw new f(o(r),o(t.size(e)),"!=");throw n}if(i.length>0)throw new f(o(r),o(t.size(e)),"!=");return n},t.squeeze=function(e,r){for(var n=r||t.size(e);Array.isArray(e)&&1===e.length;)e=e[0],n.shift();for(var i=n.length;1===n[i-1];)i--;return i0?1:e<0?-1:0},t.format=function(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-(1/0))return"-Infinity";if(isNaN(e))return"NaN";var n="auto",i=void 0;switch(r&&(r.notation&&(n=r.notation),t.isNumber(r)?i=r:r.precision&&(i=r.precision)),n){case"fixed":return t.toFixed(e,i);case"exponential":return t.toExponential(e,i);case"engineering":return t.toEngineering(e,i);case"auto":return t.toPrecision(e,i,r&&r.exponential).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}},t.splitNumber=function(e){var t=String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}},t.toEngineering=function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=t.roundDigits(t.splitNumber(e),r),a=i.exponent,o=i.coefficients,s=a%3===0?a:a<0?a-3-a%3:a-a%3,u=a>=0?a:Math.abs(s);o.length-1=0;)f++;var l=o.slice(f).join(""),p=l.match(/[1-9]/)?"."+l:"",h=o.slice(0,f).join("")+p+"e"+(a>=0?"+":"")+s.toString();return i.sign+h},t.toFixed=function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=t.splitNumber(e),a=t.roundDigits(i,i.exponent+1+(r||0)),o=a.coefficients,s=a.exponent+1,u=s+(r||0);return o.length0?"."+o.join(""):"")+"e"+(s>=0?"+":"")+s},t.toPrecision=function(e,r,i){if(isNaN(e)||!isFinite(e))return String(e);var a=i&&void 0!==i.lower?i.lower:.001,o=i&&void 0!==i.upper?i.upper:1e5,s=t.splitNumber(e),u=Math.abs(Math.pow(10,s.exponent));if(u=o)return t.toExponential(e,r);var c=r?t.roundDigits(s,r):s,f=c.coefficients,l=c.exponent;f.length0?l:0;return pt){var i=n.splice(t,n.length-t);if(i[0]>=5){var a=t-1;for(n[a]++;10===n[a];)n.pop(),0===a&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r},t.digits=function(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},t.DBL_EPSILON=Number.EPSILON||2.220446049250313e-16,t.nearlyEqual=function(e,r,n){if(null==n)return e==r;if(e==r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var i=Math.abs(e-r);return i>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},t.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var n={deg:"^\\circ"};t.toSymbol=function(e,r){if(r="undefined"!=typeof r&&r)return n.hasOwnProperty(e)?n[e]:"\\mathrm{"+e+"}";if(t.symbols.hasOwnProperty(e))return t.symbols[e];if(e.indexOf("_")!==-1){var i=e.indexOf("_");return t.toSymbol(e.substring(0,i))+"_{"+t.toSymbol(e.substring(i+1))+"}"}return e}},function(e,t,r){"use strict";t.clone=function e(r){var n=typeof r;if("number"===n||"string"===n||"boolean"===n||null===r||void 0===r)return r;if("function"==typeof r.clone)return r.clone();if(Array.isArray(r))return r.map(function(t){return e(t)});if(r instanceof Number)return new Number(r.valueOf());if(r instanceof String)return new String(r.valueOf());if(r instanceof Boolean)return new Boolean(r.valueOf());if(r instanceof Date)return new Date(r.valueOf());if(r&&r.isBigNumber===!0)return r;if(r instanceof RegExp)throw new TypeError("Cannot clone "+r);return t.map(r,e)},t.map=function(e,r){var n={};for(var i in e)t.hasOwnProperty(e,i)&&(n[i]=r(e[i]));return n},t.extend=function(e,r){for(var n in r)t.hasOwnProperty(r,n)&&(e[n]=r[n]);return e},t.deepExtend=function e(r,n){if(Array.isArray(n))throw new TypeError("Arrays are not supported by deepExtend");for(var i in n)if(t.hasOwnProperty(n,i))if(n[i]&&n[i].constructor===Object)void 0===r[i]&&(r[i]={}),r[i].constructor===Object?e(r[i],n[i]):r[i]=n[i];else{if(Array.isArray(n[i]))throw new TypeError("Arrays are not supported by deepExtend");r[i]=n[i]}return r},t.deepEqual=function(e,r){var n,i,a;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!=r.length)return!1;for(i=0,a=e.length;i0?s(p,0,f,f[0],c,t,o):[];return new a({data:h,size:i(f),datatype:u})},s=function(e,t,r,n,i,a,o){var u=[];if(t===r.length-1)for(var c=0;c0?s(v,0,h,h[0],o,f):[];return new i({data:g,size:h,datatype:d})},s=function(e,t,r,n,i,a){var o=[];if(t===r.length-1)for(var u=0;u/g,">")}},function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))throw new 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=(new Error).stack}n.prototype=new RangeError,n.prototype.constructor=RangeError,n.prototype.name="DimensionError",n.prototype.isDimensionError=!0,e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("equalScalar",{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,r){return e===r||i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.eq(r)||a(e,r,t.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return e.equals(t)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return o(e.value,t.value)},"string, string":function(e,t){return e===t}});return o}var i=r(3).nearlyEqual,a=r(35);t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=r(4),u=n(r(0)),c=n(r(20)),f=n(r(23)),l=n(r(11)),p=n(r(17)),h=n(r(6)),m=e.DenseMatrix,d=e.SparseMatrix,v=o("multiply",i({"Array, Array":function(e,t){g(a.size(e),a.size(t));var r=v(u(e),u(t));return r&&r.isMatrix===!0?r.valueOf():r},"Matrix, Matrix":function(e,t){var r=e.size(),n=t.size();return g(r,n),1===r.length?1===n.length?y(e,t,r[0]):x(e,t):1===n.length?b(e,t):N(e,t)},"Matrix, Array":function(e,t){return v(e,u(t))},"Array, Matrix":function(e,t){return v(u(e,t.storage()),t)},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=p(e,t,f,!1);break;case"dense":r=h(e,t,f,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=p(t,e,f,!0);break;case"dense":r=h(t,e,f,!0)}return r},"Array, any":function(e,t){return h(u(e),t,f,!1).valueOf()},"any, Array":function(e,t){return h(u(t),e,f,!0).valueOf()},"any, any":f,"any, any, ...any":function(e,t,r){for(var n=v(e,t),i=0;iT)for(var S=0,C=0;C0)throw new Error("Calling compile(math) is deprecated. Call the function as compile() instead.");var e={math:u.expression.mathWithTransform,args:{},_validateScope:f},t={},r=l(this,e,t),n=Object.keys(e).map(function(e){return" var "+e+' = defs["'+e+'"];'}),i=n.join(" ")+'return { "eval": function (scope) { if (scope) _validateScope(scope); scope = scope || {}; return '+r+"; }};",a=new Function("defs",i);return a(e)},c.prototype.forEach=function(e){throw new Error("Cannot run forEach on a Node interface")},c.prototype.map=function(e){throw new Error("Cannot run map on a Node interface")},c.prototype._ifNode=function(e){if(!e||!e.isNode)throw new TypeError("Callback function must return a Node");return e},c.prototype.traverse=function(e){function t(e,r){e.forEach(function(e,n,i){r(e,n,i),t(e,r)})}e(this,null,null),t(this,e)},c.prototype.transform=function(e){function t(e,r){return e.map(function(e,n,i){var a=r(e,n,i);return t(a,r)})}var r=e(this,null,null);return t(r,e)},c.prototype.filter=function(e){var t=[];return this.traverse(function(r,n,i){e(r,n,i)&&t.push(r)}),t},c.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},c.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},c.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},c.prototype.cloneDeep=function(){return this.map(function(e){return e.cloneDeep()})},c.prototype.equals=function(e){return!!e&&a(this,e)},c.prototype.toString=function(e){var t;if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return"undefined"!=typeof t?t:this._toString(e)},c.prototype.toHTML=function(e){var t;if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return"undefined"!=typeof t?t:this.toHTML(e)},c.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},c.prototype.toTex=function(e){var t;if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return"undefined"!=typeof t?t:this._toTex(e)},c.prototype._toTex=function(e){throw new Error("_toTex not implemented for "+this.type)},c.prototype.getIdentifier=function(){return this.type},c.prototype.getContent=function(){return this},c}var i=r(75),a=r(5).deepEqual,o=r(5).hasOwnProperty;t.name="Node",t.path="expression.node",t.math=!0,t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=e.DenseMatrix,o=function(e,t,r,o){var s=e._data,u=e._size,c=e._datatype,f=t._values,l=t._index,p=t._ptr,h=t._size,m=t._datatype;if(u.length!==h.length)throw new i(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d,v=u[0],g=u[1],y=0,x=r;"string"==typeof c&&c===m&&(d=c,y=n.convert(0,d),x=n.find(r,[d,d]));for(var w=[],b=0;bo)for(c=o-1,a=u.length;ct.length?1:e.length0?1:-1:a(n,o);if("Array"===n||"Matrix"===n||"Array"===o||"Matrix"===o)return r=s(e,t),0!==r?r:a(n,o);if(n!==o)return a(n,o);if("Complex"===n)return i(e,t);if("Unit"===n)return e.equalBase(t)?h(e.value,t.value):u(e.formatUnits(),t.formatUnits());if("boolean"===n)return p(e,t);if("string"===n)return a(e,t);if("Object"===n)return c(e,t);if("null"===n)return 0;if("undefined"===n)return 0;throw new TypeError('Unsupported type of value "'+n+'"')}});return h.toTex=void 0,h}function i(e,t){return e.re>t.re?1:e.ret.im?1:e.imt},"number, number":function(e,r){return e>r&&!i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.gt(r)&&!a(e,r,t.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return e>t},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,m);break;default:r=u(t,e,m,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,m,!1);break;default:r=l(e,t,m)}}return r},"Array, Array":function(e,t){return m(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return m(s(e),t)},"Matrix, Array":function(e,t){return m(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,m,!1);break;default:r=p(e,t,m,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,m,!0);break;default:r=p(t,e,m,!0)}return r},"Array, any":function(e,t){return p(s(e),t,m,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}"+h.operators.larger+"${args[1]}\\right)"},m}var i=r(3).nearlyEqual,a=r(35);t.name="larger",t.factory=n},function(e,t,r){"use strict";e.exports=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}},function(e,t,r){"use strict";function n(e,t,r,n){var i=e.DenseMatrix,a=function(e,t,r,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,f=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l,p=c[0],h=c[1],m=r;"string"==typeof f&&(l=f,t=n.convert(t,l),m=n.find(r,[l,l]));for(var d=[],v=new i({data:d,size:[p,h],datatype:l}),g=[],y=[],x=0;x0?o.resize(t,i):o}var s=[];return t.length>0?a(s,t,i):s}function u(e){var t=!1;return e.forEach(function(e,r,n){e&&e.isBigNumber===!0&&(t=!0,n[r]=e.toNumber())}),t}function c(e){e.forEach(function(e){if("number"!=typeof e||!i(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")})}var f=n(r(0)),l=o("zeros",{"":function(){return"Array"===t.matrix?s([]):s([],"default")},"...number | BigNumber | string":function(e){var r=e[e.length-1];if("string"==typeof r){var n=e.pop();return s(e,n)}return"Array"===t.matrix?s(e):s(e,"default")},Array:s,Matrix:function(e){var t=e.storage();return s(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return s(e.valueOf(),t)}});return l.toTex=void 0,l}var i=r(3).isInteger,a=r(2).resize;t.name="zeros",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(t,r){if(1!=arguments.length&&2!=arguments.length)throw new i("parse",arguments.length,1,2);if(he=r&&r.nodes?r.nodes:{},"string"==typeof t)return me=t,g();if(Array.isArray(t)||t instanceof e.Matrix)return a(t,function(e){if("string"!=typeof e)throw new TypeError("String expected");return me=e,g()});throw new TypeError("String or matrix expected")}function u(){ve=0,ge=me.charAt(0),we=0,be=null}function c(){ve++,ge=me.charAt(ve)}function f(){return me.charAt(ve-1)}function l(){return me.charAt(ve+1)}function p(){return me.charAt(ve+2)}function h(){for(xe=fe.NULL,ye="",de="";s.isWhitespace(ge,we);)c();if("#"==ge)for(;"\n"!=ge&&""!=ge;)de+=ge,c();if(""==ge)return void(xe=fe.DELIMITER);if("\n"==ge&&!we)return xe=fe.DELIMITER,ye=ge,void c();var e=ge+l(),t=e+p();if(3==t.length&&le[t])return xe=fe.DELIMITER,ye=t,c(),c(),void c();if(2==e.length&&le[e])return xe=fe.DELIMITER,ye=e,c(),void c();if(le[ge])return xe=fe.DELIMITER,ye=ge,void c();if(!s.isDigitDot(ge)){if(s.isAlpha(ge,f(),l())){for(;s.isAlpha(ge,f(),l())||s.isDigit(ge);)ye+=ge,c();return void(xe=pe.hasOwnProperty(ye)?fe.DELIMITER:fe.SYMBOL)}for(xe=fe.UNKNOWN;""!=ge;)ye+=ge,c();throw W('Syntax error in part "'+ye+'"')}if(xe=fe.NUMBER,"."==ge)ye+=ge,c(),s.isDigit(ge)||(xe=fe.DELIMITER);else{for(;s.isDigit(ge);)ye+=ge,c();s.isDecimalMark(ge,l())&&(ye+=ge,c())}for(;s.isDigit(ge);)ye+=ge,c();if(e=l(),"E"==ge||"e"==ge)if(s.isDigit(e)||"-"==e||"+"==e){if(ye+=ge,c(),"+"!=ge&&"-"!=ge||(ye+=ge,c()),!s.isDigit(ge))throw W('Digit expected, got "'+ge+'"');for(;s.isDigit(ge);)ye+=ge,c();if(s.isDecimalMark(ge,l()))throw W('Digit expected, got "'+ge+'"')}else if("."==e)throw c(),W('Digit expected, got "'+ge+'"')}function m(){do h();while("\n"==ye)}function d(){we++}function v(){we--}function g(){u(),h();var e=y();if(""!=ye)throw xe==fe.DELIMITER?Y("Unexpected operator "+ye):W('Unexpected part "'+ye+'"');return e}function y(){var e,t,r=[];for(""!=ye&&"\n"!=ye&&";"!=ye&&(e=x(),e.comment=de);"\n"==ye||";"==ye;)0==r.length&&e&&(t=";"!=ye,r.push({node:e,visible:t})),h(),"\n"!=ye&&";"!=ye&&""!=ye&&(e=x(),e.comment=de,t=";"!=ye,r.push({node:e,visible:t}));return r.length>0?new K(r):(e||(e=new te("undefined","undefined"),e.comment=de),e)}function x(){var e,t,r,n,i=w();if("="==ye){if(i&&i.isSymbolNode)return e=i.name,m(),r=x(),new Q(new ce(e),r);if(i&&i.isAccessorNode)return m(),r=x(),new Q(i.object,i.index,r);if(i&&i.isFunctionNode&&(n=!0,t=[],e=i.name,i.args.forEach(function(e,r){e&&e.isSymbolNode?t[r]=e.name:n=!1}),n))return m(),r=x(),new re(e,t,r);throw W("Invalid left hand side of assignment operator =")}return i}function w(){for(var e=b();"?"==ye;){var t=be;be=we,m();var r=e,n=x();if(":"!=ye)throw W("False part of conditional expression expected");be=null,m();var i=x();e=new ee(r,n,i),be=t}return e}function b(){for(var e=N();"or"==ye;)m(),e=new ae("or","or",[e,N()]);return e}function N(){for(var e=E();"xor"==ye;)m(),e=new ae("xor","xor",[e,E()]);return e}function E(){for(var e=M();"and"==ye;)m(),e=new ae("and","and",[e,M()]);return e}function M(){for(var e=A();"|"==ye;)m(),e=new ae("|","bitOr",[e,A()]);return e}function A(){for(var e=O();"^|"==ye;)m(),e=new ae("^|","bitXor",[e,O()]);return e}function O(){for(var e=T();"&"==ye;)m(),e=new ae("&","bitAnd",[e,T()]);return e}function T(){var e,t,r,n,i;for(e=_(),t={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};t.hasOwnProperty(ye);)r=ye,n=t[r],m(),i=[e,_()],e=new ae(r,n,i);return e}function _(){var e,t,r,n,i;for(e=S(),t={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};t.hasOwnProperty(ye);)r=ye,n=t[r],m(),i=[e,S()],e=new ae(r,n,i);return e}function S(){var e,t,r,n,i;for(e=C(),t={to:"to",in:"to"};t.hasOwnProperty(ye);)r=ye,n=t[r],m(),"in"===r&&""===ye?e=new ae("*","multiply",[e,new ce("in")],!0):(i=[e,C()],e=new ae(r,n,i));return e}function C(){var e,t=[];if(e=":"==ye?new te("1","number"):z(),":"==ye&&be!==we){for(t.push(e);":"==ye&&t.length<3;)m(),")"==ye||"]"==ye||","==ye||""==ye?t.push(new ce("end")):t.push(z());e=3==t.length?new ue(t[0],t[2],t[1]):new ue(t[0],t[1])}return e}function z(){var e,t,r,n,i;for(e=k(),t={"+":"add","-":"subtract"};t.hasOwnProperty(ye);)r=ye,n=t[r],m(),i=[e,k()],e=new ae(r,n,i);return e}function k(){var e,t,r,n,i;for(e=I(),t=e,r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};;)if(r.hasOwnProperty(ye))n=ye,i=r[n],m(),t=I(),e=new ae(n,i,[e,t]);else{if(!(xe==fe.SYMBOL||"in"==ye&&e&&e.isConstantNode)&&(xe!=fe.NUMBER||t.isConstantNode||t.isOperatorNode&&"!"!==t.op)&&"("!=ye)break;t=I(),e=new ae("*","multiply",[e,t],!0)}return e}function I(){var e,t,r,n={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return n.hasOwnProperty(ye)?(r=n[ye],e=ye,m(),t=[I()],new ae(e,r,t)):B()}function B(){var e,t,r,n;return e=P(),"^"!=ye&&".^"!=ye||(t=ye,r="^"==t?"pow":"dotPow",m(),n=[e,I()],e=new ae(t,r,n)),e}function P(){var e,t,r,n,i;for(e=R(),t={"!":"factorial","'":"transpose"};t.hasOwnProperty(ye);)r=ye,n=t[r],h(),i=[e],e=new ae(r,n,i),e=q(e);return e}function R(){var e=[];if(xe==fe.SYMBOL&&he.hasOwnProperty(ye)){var t=he[ye];if(h(),"("==ye){if(e=[],d(),h(),")"!=ye)for(e.push(x());","==ye;)h(),e.push(x());if(")"!=ye)throw W("Parenthesis ) expected");v(),h()}return new t(e)}return U()}function U(){var e,t;return xe==fe.SYMBOL||xe==fe.DELIMITER&&ye in pe?(t=ye,h(),e=new ce(t),e=q(e)):L()}function q(e,t){for(var r;!("("!=ye&&"["!=ye&&"."!=ye||t&&t.indexOf(ye)===-1);)if(r=[],"("==ye){if(!(e.isSymbolNode||e.isAccessorNode||e.isFunctionNode))return e;if(d(),h(),")"!=ye)for(r.push(x());","==ye;)h(),r.push(x());if(")"!=ye)throw W("Parenthesis ) expected");v(),h(),e=new se(e,r)}else if("["==ye){if(d(),h(),"]"!=ye)for(r.push(x());","==ye;)h(),r.push(x());if("]"!=ye)throw W("Parenthesis ] expected");v(),h(),e=new X(e,new ne(r))}else{if(h(),xe!=fe.SYMBOL)throw W("Property name expected after dot");r.push(new te(ye)),h();var n=!0;e=new X(e,new ne(r,n))}return e}function L(){var e,t;return'"'==ye?(t=j(),e=new te(t,"string"),e=q(e)):F()}function j(){for(var e="";""!=ge&&'"'!=ge;)"\\"==ge&&(e+=ge,c()),e+=ge,c();if(h(),'"'!=ye)throw W('End of string " expected');return h(),e}function F(){var e,t,r,n;if("["==ye){if(d(),h(),"]"!=ye){var i=D();if(";"==ye){for(r=1,t=[i];";"==ye;)h(),t[r]=D(),r++;if("]"!=ye)throw W("End of matrix ] expected");v(),h(),n=t[0].items.length;for(var a=1;a":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},pe={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},he={},me="",de="",ve=0,ge="",ye="",xe=fe.NULL,we=0,be=null;return s.isAlpha=function(e,t,r){return s.isValidLatinOrGreek(e)||s.isValidMathSymbol(e,r)||s.isValidMathSymbol(t,e)},s.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},s.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(t)},s.isWhitespace=function(e,t){return" "==e||"\t"==e||"\n"==e&&t>0},s.isDecimalMark=function(e,t){return"."==e&&"/"!==t&&"*"!==t&&"^"!==t},s.isDigitDot=function(e){return e>="0"&&e<="9"||"."==e},s.isDigit=function(e){return e>="0"&&e<="9"},s}var i=r(50),a=r(1);t.name="parse",t.path="expression",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,c,f){function l(t){return!!e.Unit&&e.Unit.isValuelessUnit(t)}function p(e){if(!(this instanceof p))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}function h(t,r,n){if(!(t instanceof p))throw new TypeError("No valid SymbolNode");r.undef=m,r.Unit=e.Unit,r.getSafeProperty=u,r.hasOwnProperty=s;var i=a(t.name);return s(n,t.name)?n[t.name]:t.name in r.math?"("+i+" in scope ? getSafeProperty(scope, "+i+") : getSafeProperty(math, "+i+"))":"("+i+" in scope ? getSafeProperty(scope, "+i+") : "+(l(t.name)?"new Unit(null, "+i+")":"undef("+i+")")+")"}function m(e){throw new Error("Undefined symbol "+e)}var d=n(r(7)).register,v=(n(r(7)).compile,n(r(14)));return p.prototype=new v,p.prototype.type="SymbolNode",p.prototype.isSymbolNode=!0,d(p.prototype.type,h),p.prototype.forEach=function(e){},p.prototype.map=function(e){return this.clone()},p.prototype.clone=function(){return new p(this.name)},p.prototype._toString=function(e){return this.name},p.prototype.toHTML=function(e){var t=o(this.name);return"true"==t||"false"==t?''+t+"":"i"==t?''+t+"":"Infinity"==t?''+t+"":"NaN"==t?''+t+"":"null"==t?''+t+"":"uninitialized"==t?''+t+"":''+t+""},p.prototype._toTex=function(e){var t=!1;"undefined"==typeof f[this.name]&&l(this.name)&&(t=!0);var r=i.toSymbol(this.name,t);return"\\"===r[0]?r:" "+r},p}var i=r(4),a=r(9).stringify,o=r(9).escape,s=r(5).hasOwnProperty,u=r(13).getSafeProperty;t.name="SymbolNode",t.path="expression.node",t.math=!0,t.factory=n},function(e,t,r){var n=r(51);t.transform=function(e){return e&&e.isIndexError?new n(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}},function(e,t,r){"use strict";e.exports=function e(t,r){t&&t.isMatrix===!0&&(t=t.valueOf());for(var n=0,i=t.length;n");var p=t.max().map(function(e){return e+1});w(e,p,n);var h=o.length,m=0;x(e._data,t,r,h,m)}return e}function x(e,t,r,n,i){var a=i===n-1,o=t.dimension(i);a?o.forEach(function(t,n){m(t),e[t]=r[n[0]]}):o.forEach(function(a,o){m(a),x(e[a],t,r[o[0]],n,i+1)})}function w(e,t,r){for(var n=e._size.slice(0),i=!1;n.lengthn[a]&&(n[a]=t[a],i=!0);i&&E(e,n,r)}function b(e){for(var t=0,r=e.length;t0?e:0,r=e<0?-e:0,n=this._size[0],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=0;s0?n:0,m=n<0?-n:0,v=t[0],g=t[1],y=Math.min(v-m,g-u);if(f(r)){if(r.length!==y)throw new Error("Invalid value array length");o=function(e){return r[e]}}else if(r&&r.isMatrix===!0){var x=r.size();if(1!==x.length||x[0]!==y)throw new Error("Invalid matrix length");o=function(e){return r.get([e])}}else o=function(){return r};i||(i=o(0)&&o(0).isBigNumber===!0?new e.BigNumber(0):0);var w=[];if(t.length>0){w=s.resize(w,t,i);for(var b=0;b1&&n===-(1/0)?0:t.predictable&&(r<-1&&n===1/0||r>-1&&r<0&&n===-(1/0))?NaN:i(n)||r>=0||t.predictable?Math.pow(r,n):new e.Complex(r,0).pow(n,0)}function u(e,t){if(!i(t)||t<0)throw new TypeError("For A^b, b must be a positive integer (value is "+t+")");var r=a(e);if(2!=r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!=r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");for(var n=l(r[0]).valueOf(),o=e;t>=1;)1==(1&t)&&(n=p(o,n)),t>>=1,o=p(o,o);return n}function c(e,t){return h(u(e.valueOf(),t))}var f=r(4),l=n(r(60)),p=n(r(12)),h=n(r(0)),m=n(r(90)),d=n(r(72)),v=o("pow",{"number, number":s,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(r,n){return n.isInteger()||r>=0||t.predictable?r.pow(n):new e.Complex(r.toNumber(),0).pow(n.toNumber(),0)},"Fraction, Fraction":function(e,r){if(1!==r.d){if(t.predictable)throw new Error("Function pow does not support non-integer exponents for fractions.");return s(e.valueOf(),r.valueOf())}return e.pow(r)},"Array, number":u,"Array, BigNumber":function(e,t){return u(e,t.toNumber())},"Matrix, number":c,"Matrix, BigNumber":function(e,t){return c(e,t.toNumber())},"Unit, number":function(e,t){return e.pow(t)}});return v.toTex={2:"\\left(${args[0]}\\right)"+f.operators.pow+"{${args[1]}}"},v}var i=r(3).isInteger,a=r(2).size;t.name="pow",t.factory=n},function(e,t,r){"use strict";e.exports=function(e){return Array.isArray(e)||e&&e.isMatrix===!0}},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(19)),s=n(r(12)),u=n(r(112)),c=n(r(0)),f=n(r(17)),l=n(r(6)),p=a("divide",i({"Array | Matrix, Array | Matrix":function(e,t){return s(e,u(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,o,!1);break;case"dense":r=l(e,t,o,!1)}return r},"Array, any":function(e,t){return l(c(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return s(e,u(t))}},o.signatures));return p.toTex={2:"\\frac{${args[0]}}{${args[1]}}"},p}var i=r(5).extend;t.name="divide",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("isInteger",{number:a.isInteger,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":function(e){return i(e,o)}});return o}var i=r(1),a=r(3);t.name="isInteger",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=n(r(15)),c=n(r(59)),f=n(r(16)),l=n(r(8)),p=n(r(6)),h=o("compare",{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"number, number":function(e,r){return e===r||i(e,r,t.epsilon)?0:e>r?1:-1},"BigNumber, BigNumber":function(r,n){return r.eq(n)||a(r,n,t.epsilon)?new e.BigNumber(0):new e.BigNumber(r.cmp(n))},"Fraction, Fraction":function(t,r){return new e.Fraction(t.compare(r))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return h(e.value,t.value)},"string, string":function(e,t){return e===t?0:e>t?1:-1},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,h);break;default:r=u(t,e,h,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,h,!1);break;default:r=l(e,t,h)}}return r},"Array, Array":function(e,t){return h(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return h(s(e),t)},"Matrix, Array":function(e,t){return h(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,h,!1);break;default:r=p(e,t,h,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,h,!0);break;default:r=p(t,e,h,!0)}return r},"Array, any":function(e,t){return p(s(e),t,h,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,h,!0).valueOf()}});return h.toTex=void 0,h}var i=r(3).nearlyEqual,a=r(35);t.name="compare",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,i){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=i,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(void 0!=i?"-"+i:"")+" expected)",this.stack=(new Error).stack}n.prototype=new Error,n.prototype.constructor=Error,n.prototype.name="ArgumentsError",n.prototype.isArgumentsError=!0,e.exports=n},function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))throw new 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.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}n.prototype=new RangeError,n.prototype.constructor=RangeError,n.prototype.name="IndexError",n.prototype.isIndexError=!0,e.exports=n},function(e,t,r){"use strict";function n(e,t){var r=e;"keep"!==t&&(r=e.getContent());for(var n=r.getIdentifier(),i=0;i'+t+"";case"string":return''+t+"";case"boolean":return''+t+"";case"null":return''+t+"";case"undefined":return''+t+"";default:return''+t+""}},u.prototype._toTex=function(e){var t,r=this.value;switch(this.valueType){case"string":return"\\mathtt{"+a(r)+"}";case"number":return t=r.toLowerCase().indexOf("e"),t!==-1?r.substring(0,t)+"\\cdot10^{"+r.substring(t+1)+"}":r;default:return r}},u}var i=r(58).type,a=r(9).stringify,o=r(9).escape;t.name="ConstantNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,h,m){function d(e,t){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof e&&(e=new N(e)),!e||!e.isNode)throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(function(e){return e&&e.isNode}))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}});var r=function(){throw new Error("Property `FunctionNode.object` is deprecated, use `FunctionNode.fn` instead")};Object.defineProperty(this,"object",{get:r,set:r})}function v(e,t,r){if(!(e instanceof d))throw new TypeError("No valid FunctionNode");var n,i=w(e.fn,t,r),o=c(e.args,function(e){return w(e,t,r)}),s=g(t,r);if(e.fn.isSymbolNode){var h=e.fn.name,m=u(t.math,h)?t.math[h]:void 0,v="function"==typeof m&&1==m.rawArgs;return v?(n=p(t),t[n]=e.args,i+"("+n+", math, "+s+")"):i+"("+f(o,", ")+")"}if(e.fn.isAccessorNode&&e.fn.index.isObjectProperty()){n=p(t),t[n]=e.args,t.validateSafeMethod=l;var y=w(e.fn.object,t,r),x=a(e.fn.index.getObjectProperty());return"(function () {var object = "+y+";validateSafeMethod(object, "+x+");return (object["+x+"] && object["+x+"].rawArgs) ? object["+x+"]("+n+", math, "+s+") : object["+x+"]("+f(o,", ")+")})()"}return n=p(t),t[n]=e.args,"(function () {var fn = "+i+";return (fn && fn.rawArgs) ? fn("+n+", math, "+s+") : fn("+f(o,", ")+")})()"}function g(e,t){var r=Object.keys(t);if(0===r.length)return"scope";e.extend=s;var n=c(r,function(e){return a(e)+": "+t[e]});return"extend(extend({}, scope), {"+f(n,", ")+"})"}function y(e,t,r){for(var n,i="",a=new RegExp("\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)","ig"),o=0;null!==(n=a.exec(e));)if(i+=e.substring(o,n.index),o=n.index,"$$"===n[0])i+="$",o++;else{o+=n[0].length;var s=t[n[1]];if(!s)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof s){case"string":i+=s;break;case"object":if(s.isNode)i+=s.toTex(r);else{if(!Array.isArray(s))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=s.map(function(e,t){if(e&&e.isNode)return e.toTex(r);throw new TypeError("Template: "+n[1]+"["+t+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else{if(!s[n[2]]||!s[n[2]].isNode)throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=s[n[2]].toTex(r)}}return i+=e.slice(o)}var x=n(r(7)).register,w=n(r(7)).compile,b=n(r(14)),N=n(r(40));d.prototype=new b,d.prototype.type="FunctionNode",d.prototype.isFunctionNode=!0,x(d.prototype.type,v),d.prototype.forEach=function(e){for(var t=0;t'+o(this.fn)+'('+t.join(',')+')'};var M=d.prototype.toTex;return d.prototype.toTex=function(e){var t;return e&&"object"==typeof e.handler&&u(e.handler,this.name)&&(t=e.handler[this.name](this,e)),"undefined"!=typeof t?t:M.call(this,e)},d.prototype._toTex=function(e){var t,r=this.args.map(function(t){return t.toTex(e)});!m[this.name]||"function"!=typeof m[this.name].toTex&&"object"!=typeof m[this.name].toTex&&"string"!=typeof m[this.name].toTex||(t=m[this.name].toTex);var n;switch(typeof t){case"function":n=t(this,e);break;case"string":n=y(t,this,e);break;case"object":switch(typeof t[r.length]){case"function":n=t[r.length](this,e);break;case"string":n=y(t[r.length],this,e)}}return"undefined"!=typeof n?n:y(i.defaultTemplate,this,e)},d.prototype.getIdentifier=function(){return this.type+":"+this.name},d}var i=r(4),a=r(9).stringify,o=r(9).escape,s=r(5).extend,u=r(5).hasOwnProperty,c=r(2).map,f=r(2).join,l=r(13).validateSafeMethod,p=r(106);t.name="FunctionNode",t.path="expression.node",t.math=!0,t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isPositive",{number:function(e){return e>0},BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:function(e){return a(e.value)},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(1);r(3);t.name="isPositive",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function a(r){return r>=0||t.predictable?Math.sqrt(r):new e.Complex(r,0).sqrt()}var o=n("sqrt",{number:a,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():a(e.toNumber())},"Array | Matrix":function(e){return i(e,o,!0)},Unit:function(e){return e.pow(.5)}});return o.toTex={1:"\\sqrt{${args[0]}}"},o}var i=r(1);t.name="sqrt",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isNegative",{number:function(e){return e<0},BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:function(e){return a(e.value)},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(1);r(3);t.name="isNegative",t.factory=n},function(e,t,r){"use strict";t.type=function(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":e instanceof Boolean?"boolean":e instanceof Number?"number":e instanceof String?"string":"Object":"function"===t?"Function":t}},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(11)),s=e.SparseMatrix,u=function(e,t,r){var n=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype,p=t._values,h=t._index,m=t._ptr,d=t._size,v=t._datatype;if(f.length!==d.length)throw new i(f.length,d.length);if(f[0]!==d[0]||f[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");var g,y=f[0],x=f[1],w=o,b=0,N=r;"string"==typeof l&&l===v&&(g=l,w=a.find(o,[g,g]),b=a.convert(0,g),N=a.find(r,[g,g]));var E,M,A,O,T=n&&p?[]:void 0,_=[],S=[],C=new s({values:T,index:_,ptr:S,size:[y,x],datatype:g}),z=T?[]:void 0,k=T?[]:void 0,I=[],B=[];for(M=0;M2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()){var o=r.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});return o}if(0===r.length)return[];if(1===r.length){var s=f.getPrecedence(r[0],t);if(n&&null!==s){var u,c;if("keep"===t?(u=r[0].getIdentifier(),c=e.getIdentifier()):(u=r[0].getContent().getIdentifier(),c=e.getContent().getIdentifier()),f.properties[i][c].latexLeftParens===!1)return[!1];if(f.properties[s][u].latexParens===!1)return[!1]}return null===s?[!1]:s<=i?[!0]:[!1]}if(2===r.length){var l,p=f.getPrecedence(r[0],t),h=f.isAssociativeWith(e,r[0],t);l=null!==p&&(p===i&&"right"===a&&!h||p2&&("OperatorNode:add"===e.getIdentifier()||"OperatorNode:multiply"===e.getIdentifier())){var x=r.map(function(r){var n=f.getPrecedence(r,t),o=f.isAssociativeWith(e,r,t),s=f.getAssociativity(r,t);return null!==n&&(i===n&&a===s&&!o||n2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var c=n.map(function(t,r){return t=t.toString(e),i[r]&&(t="("+t+")"),t});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?c.join(" "):c.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},p.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",n=this.args,i=m(this,t,n,!1);if(1===n.length){var a=f.getAssociativity(this,t),o=n[0].toHTML(e);return i[0]&&(o='('+o+')'),"right"===a?''+u(this.op)+""+o:"left"===a?''+u(this.op)+""+o:''+u(this.op)+""+o}if(2==n.length){var s=n[0].toHTML(e),c=n[1].toHTML(e);return i[0]&&(s='('+s+')'),i[1]&&(c='('+c+')'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"==r?s+''+c:s+''+u(this.op)+""+c}if(n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var l=n.map(function(t,r){return t=t.toHTML(e),i[r]&&(t='('+t+')'),t});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?l.join(''):l.join(''+u(this.op)+"")}return''+u(this.fn)+'('+l.join(',')+')'},p.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",n=this.args,a=m(this,t,n,!0),o=i.operators[this.fn];if(o="undefined"==typeof o?this.op:o,1===n.length){var s=f.getAssociativity(this,t),u=n[0].toTex(e);return a[0]&&(u="\\left("+u+"\\right)"),"right"===s?o+u:"left"===s?u+o:u+o}if(2===n.length){var c=n[0],l=c.toTex(e);a[0]&&(l="\\left("+l+"\\right)");var p=n[1],h=p.toTex(e);a[1]&&(h="\\left("+h+"\\right)");var d;switch(d="keep"===t?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+l+"}{"+h+"}";case"OperatorNode:pow":switch(l="{"+l+"}",h="{"+h+"}",d){case"ConditionalNode":case"OperatorNode:divide":l="\\left("+l+"\\right)"}case"OperatorNode:multiply":if(this.implicit&&"hide"===r)return l+"~"+h}return l+o+h}if(n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var v=n.map(function(t,r){return t=t.toTex(e),a[r]&&(t="\\left("+t+"\\right)"),t});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?v.join("~"):v.join(o)}return"\\mathrm{"+this.fn+"}\\left("+n.map(function(t){return t.toTex(e)}).join(",")+"\\right)"},p.prototype.getIdentifier=function(){return this.type+":"+this.fn},p}var i=r(4),a=r(2).map,o=r(2).join,s=r(9).stringify,u=r(9).escape,c=r(13).isSafeMethod,f=r(52);t.name="OperatorNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e){ +if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError('Node expected for parameter "content"');this.content=e}function o(e,t,r){if(!(e instanceof a))throw new TypeError("No valid ParenthesisNode");return u(e.content,t,r)}var s=n(r(7)).register,u=n(r(7)).compile,c=n(r(14));return a.prototype=new c,a.prototype.type="ParenthesisNode",a.prototype.isParenthesisNode=!0,s(a.prototype.type,o),a.prototype.getContent=function(){return this.content.getContent()},a.prototype.forEach=function(e){e(this.content,"content",this)},a.prototype.map=function(e){var t=e(this.content,"content",this);return new a(t)},a.prototype.clone=function(){return new a(this.content)},a.prototype._toString=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)},a.prototype.toHTML=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'('+this.content.toHTML(e)+')':this.content.toHTML(e)},a.prototype._toTex=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left("+this.content.toTex(e)+"\\right)":this.content.toTex(e)},a}t.name="ParenthesisNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,f){var l=n(r(0)),p=f("concat",{"...Array | Matrix | number | BigNumber":function(e){var t,r,n=e.length,f=-1,p=!1,h=[];for(t=0;t0&&f>r)throw new u(f,r+1)}else{var d=a(m).valueOf(),v=s.size(d);if(h[t]=d,r=f,f=v.length-1,t>0&&f!=r)throw new c(r+1,f+1)}}if(0==h.length)throw new SyntaxError("At least one matrix expected");for(var g=h.shift();h.length;)g=i(g,h.shift(),f,0);return p?l(g):g},"...string":function(e){return e.join("")}});return p.toTex=void 0,p}function i(e,t,r,n){if(n=i.length)throw new o(t,i.length);return e&&e.isMatrix===!0?e.create(n(e.valueOf(),t,r)):n(e,t,r)}},function(e,t,r){"use strict";var n=r(46);e.exports=function(e){for(var t=0;te)throw new TypeError("k must be less than or equal to n");for(r=Math.max(t,e-t),n=1,i=1;i<=e-r;i++)n=n*(r+i)/i;return n},"BigNumber, BigNumber":function(t,r){var n,a,o,s,u=new e.BigNumber(1);if(!i(t)||!i(r))throw new TypeError("Positive integer value expected in function combinations");if(r.gt(t))throw new TypeError("k must be less than n in function combinations");for(n=t.minus(r),r.lt(n)&&(n=r),a=u,o=u,s=t.minus(n);o.lte(s);o=o.plus(1))a=a.times(n.plus(o)).dividedBy(o);return a}});return o.toTex={2:"\\binom{${args[0]}}{${args[1]}}"},o}function i(e){return e.isInteger()&&e.gte(0)}var a=r(3).isInteger;t.name="combinations",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.type="Matrix",i.prototype.isMatrix=!0,i.storage=function(e){if(!o(e))throw new TypeError("format must be a string value");var t=i._storage[e];if(!t)throw new SyntaxError("Unsupported matrix storage format: "+e);return t},i._storage={},i.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},i.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},i.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},i.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},i.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},i.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},i.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},i.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},i.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},i.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},i.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},i.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},i.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},i.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},i.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},i.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},i}var i=r(25),a=i.string,o=a.isString;t.name="Matrix",t.path="type",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(11)),s=e.SparseMatrix,u=function(e,t,r){var n=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype,p=t._values,h=t._index,m=t._ptr,d=t._size,v=t._datatype;if(f.length!==d.length)throw new i(f.length,d.length);if(f[0]!==d[0]||f[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");var g,y=f[0],x=f[1],w=o,b=0,N=r;"string"==typeof l&&l===v&&(g=l,w=a.find(o,[g,g]),b=a.convert(0,g),N=a.find(r,[g,g]));var E,M,A,O,T,_=n&&p?[]:void 0,S=[],C=[],z=new s({values:_,index:S,ptr:C,size:[y,x],datatype:g}),k=n&&p?[]:void 0,I=n&&p?[]:void 0,B=[],P=[];for(M=0;M.'+o(this.getObjectProperty())+"":'['+t.join(',')+']'},u.prototype._toTex=function(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"},u.prototype.needsSize=function(){return this.dimensions.some(function(e){return e.isRangeNode&&e.needsEnd()||e.isSymbolNode&&"end"===e.name})},u}var i=r(2).map,a=r(2).join,o=r(9).escape;t.name="IndexNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e,t,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError("Node expected");if(!t||!t.isNode)throw new TypeError("Node expected");if(r&&(!r||!r.isNode))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=r||null}function s(e,t,r){if(!(e instanceof o))throw new TypeError("No valid RangeNode");return"math.range("+f(e.start,t,r)+", "+f(e.end,t,r)+(e.step?", "+f(e.step,t,r):"")+")"}function u(e,t){var r=i.getPrecedence(e,t),n={},a=i.getPrecedence(e.start,t);if(n.start=null!==a&&a<=r||"all"===t,e.step){var o=i.getPrecedence(e.step,t);n.step=null!==o&&o<=r||"all"===t}var s=i.getPrecedence(e.end,t);return n.end=null!==s&&s<=r||"all"===t,n}var c=n(r(7)).register,f=n(r(7)).compile,l=n(r(14));return o.prototype=new l,o.prototype.type="RangeNode",o.prototype.isRangeNode=!0,o.prototype.needsEnd=function(){var e=this.filter(function(e){return e&&e.isSymbolNode&&"end"==e.name});return e.length>0},c(o.prototype.type,s),o.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},o.prototype.map=function(e){return new o(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))},o.prototype.clone=function(){return new o(this.start,this.end,this.step&&this.step)},o.prototype._toString=function(e){var t,r=e&&e.parenthesis?e.parenthesis:"keep",n=u(this,r),i=this.start.toString(e);if(n.start&&(i="("+i+")"),t=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),t+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),t+=":"+o},o.prototype.toHTML=function(e){var t,r=e&&e.parenthesis?e.parenthesis:"keep",n=u(this,r),i=this.start.toHTML(e);if(n.start&&(i='('+i+')'),t=i,this.step){var a=this.step.toHTML(e);n.step&&(a='('+a+')'),t+=':'+a}var o=this.end.toHTML(e);return n.end&&(o='('+o+')'),t+=':'+o},o.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=u(this,t),n=this.start.toTex(e);if(r.start&&(n="\\left("+n+"\\right)"),this.step){var i=this.step.toTex(e);r.step&&(i="\\left("+i+"\\right)"),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left("+a+"\\right)"),n+=":"+a},o}var i=r(52);t.name="RangeNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=e||[],!Array.isArray(this.items)||!this.items.every(function(e){return e&&e.isNode}))throw new TypeError("Array containing Nodes expected");var t=function(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")};Object.defineProperty(this,"nodes",{get:t,set:t})}function u(e,t,r){if(!(e instanceof s))throw new TypeError("No valid ArrayNode");var n="Array"!==t.math.config().matrix,o=i(e.items,function(e){return f(e,t,r)});return(n?"math.matrix([":"[")+a(o,",")+(n?"])":"]")}var c=n(r(7)).register,f=n(r(7)).compile,l=n(r(14));return s.prototype=new l,s.prototype.type="ArrayNode",s.prototype.isArrayNode=!0,c(s.prototype.type,u),s.prototype.forEach=function(e){for(var t=0;t['+t.join(',')+']'},s.prototype._toTex=function(e){var t="\\begin{bmatrix}";return this.items.forEach(function(r){t+=r.items?r.items.map(function(t){return t.toTex(e)}).join("&"):r.toTex(e),t+="\\\\"}),t+="\\end{bmatrix}"},s}var i=r(2).map,a=r(2).join;t.name="ArrayNode",t.path="expression.node",t.factory=n},function(e,t){e.exports=function(e,t,r){var n=e.filter(function(e){return e&&e.isSymbolNode&&!(e.name in t)&&!(e.name in r)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=Object.create(r),o=e.compile();return function(e){return a[i]=e,o.eval(a)}}},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isZero",{number:function(e){return 0===e},BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:function(e){return a(e.value)},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(1);r(3);t.name="isZero",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e){return-e-2};return e}t.name="cs_flip",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e){var t=e.DenseMatrix,r=function(e,r,n){var i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+a.format(i)+")");var u=i[0],c=i[1];if(u!==c)throw new RangeError("Matrix must be square (size: "+a.format(i)+")");var f,l,p;if(r&&r.isMatrix===!0){var h=r.size();if(1===h.length){if(h[0]!==u)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(f=[],p=r._data,l=0;l0)if(++s>c)for(s-=c;s--;u+="0");else s1&&(null==f[o+1]&&(f[o+1]=0),f[o+1]+=f[o]>>1,f[o]&=1)}return f.reverse()}var i=r(84);e.exports=function(e,t,r){var a,o,s=e.constructor,u=+(e.s<0),c=+(t.s<0);if(u){a=n(i(e));for(var f=0;f0;)r(l[--m],p[--d])==v&&(g=g.plus(y)),y=y.times(x);for(;d>0;)r(h,p[--d])==v&&(g=g.plus(y)),y=y.times(x);return s.config({precision:w}),0==v&&(g.s=-g.s),g}},function(e,t){e.exports=function(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var e=e.plus(new t(1));return e.s=-e.s||null,t.config({precision:r}),e}},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(11)),s=e.SparseMatrix,u=function(e,t,r){var n=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype,p=t._values,h=t._index,m=t._ptr,d=t._size,v=t._datatype;if(f.length!==d.length)throw new i(f.length,d.length);if(f[0]!==d[0]||f[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");if(!n||!p)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var g,y=f[0],x=f[1],w=o,b=0,N=r;"string"==typeof l&&l===v&&(g=l,w=a.find(o,[g,g]),b=a.convert(0,g),N=a.find(r,[g,g]));for(var E,M,A,O,T=[],_=[],S=[],C=new s({values:T,index:_,ptr:S,size:[y,x],datatype:g}),z=[],k=[],I=0;I1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,r)}if(Array.isArray(e))return u(e,t,r)}function u(e,t,r){if(t>=e.length)throw new Error("k out of bounds");for(var n=0,i=e.length-1;n=0){var u=e[o];e[o]=e[a],e[a]=u,--o}else++a;r(e[a],s)>0&&--a,t<=a?i=a:n=a+1}return e[t]}var c=n(r(49));return a("partitionSelect",{"Array | Matrix, number":function(e,t){return s(e,t,c)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return s(e,t,c);if("desc"===r)return s(e,t,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s})}var i=r(3).isInteger;t.name="partitionSelect",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,s,u){function c(e){if(!h.hasOwnProperty(e))throw new Error("Unknown distribution "+e);var t=Array.prototype.slice.call(arguments,1),r=h[e].apply(this,t);return function(e){var t={random:function(e,t,r){var s,u,l;if(arguments.length>3)throw new i("random",arguments.length,0,3);if(1===arguments.length?a(e)?s=e:l=e:2===arguments.length?a(e)?(s=e,l=t):(u=e,l=t):(s=e,u=t,l=r),void 0!==u&&!o(u)||void 0!==l&&!o(l))throw new TypeError("Invalid argument in function random");if(void 0===l&&(l=1),void 0===u&&(u=0),void 0!==s){var p=c(s.valueOf(),u,l,n);return s&&s.isMatrix===!0?f(p):p}return n(u,l)},randomInt:s({"number | Array":function(e){var t=0;if(a(e)){var r=e,n=1,i=c(r.valueOf(),t,n,u);return r&&r.isMatrix===!0?f(i):i}var n=e;return u(t,n)},"number | Array, number":function(e,t){if(a(e)){var r=e,n=t,i=0,o=c(r.valueOf(),i,n,u);return r&&r.isMatrix===!0?f(o):o}var i=e,n=t;return u(i,n)},"Array, number, number":function(e,t,r){var n=c(e.valueOf(),t,r,u);return e&&e.isMatrix===!0?f(n):n}}),pickRandom:s({Array:function(e){return r(e)},"Array, number | Array":function(e,t){var n,i;if(Array.isArray(t))i=t;else{if(!o(t))throw new TypeError("Invalid argument in function pickRandom");n=t}return r(e,n,i)},"Array, number | Array, Array | number":function(e,t,n){var i,a;if(Array.isArray(t)?(a=t,i=n):(a=n,i=t),!Array.isArray(a)||!o(i))throw new TypeError("Invalid argument in function pickRandom");return r(e,i,a)}})},r=function(e,t,r){var n="undefined"==typeof t;if(n&&(t=1),e&&e.isMatrix===!0)e=e.valueOf();else if(!Array.isArray(e))throw new TypeError("Unsupported type of value in function pickRandom");if(l.size(e).length>1)throw new Error("Only one dimensional vectors supported");if("undefined"!=typeof r){if(r.length!=e.length)throw new Error("Weights must have the same length as possibles");for(var i=0,a=0,s=r.length;a=u)return e;for(var c,f=[];f.length1)for(var a=0,i=e.shift();a1;)e=p(),t=p(),r=1/6*Math.pow(-2*Math.log(e),.5)*Math.cos(2*Math.PI*t)+.5;return r}}};return c.toTex=void 0,c}var i=r(50),a=r(46),o=r(3).isNumber;t.name="distribution",t.factory=n},function(e,t,r){var n=r(151);t.mixin=function(e){var t=new n;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}},function(e,t,r){function n(e,t,r,n,s){return i.prototype.type="Complex",i.prototype.isComplex=!0,i.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},i.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},i.prototype.format=function(e){var t="",r=this.im,n=this.re,i=a(this.re,e),s=a(this.im,e),u=o(e)?e:e?e.precision:null;if(null!==u){var c=Math.pow(10,-u);Math.abs(n/r)t.re?1:e.ret.im?1:e.im0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},a.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},a.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;tn;)e(t,[i],this),t+=r,i++},a.prototype.map=function(e){var t=[];return this.forEach(function(r,n,i){t[n[0]]=e(r,n,i)}),t},a.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},a.prototype.valueOf=function(){return this.toArray()},a.prototype.format=function(e){var t=i.format(this.start,e);return 1!=this.step&&(t+=":"+i.format(this.step,e)),t+=":"+i.format(this.end,e)},a.prototype.toString=function(){return this.format()},a.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},a.fromJSON=function(e){return new a(e.start,e.end,e.step)},a}var i=r(3);t.name="Range",t.path="type",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){ +function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return i.prototype.type="ResultSet",i.prototype.isResultSet=!0,i.prototype.valueOf=function(){return this.entries},i.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},i.fromJSON=function(e){return new i(e.entries)},i}t.name="ResultSet",t.path="type",t.factory=n},function(e,t,r){function n(e){return e[0].precision}var i=r(32).memoize;t.e=i(function(e){return new e(1).exp()},n),t.phi=i(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},n),t.pi=i(function(e){return e.acos(-1)},n),t.tau=i(function(e){return t.pi(e).times(2)},n)},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("fix",{number:function(e){return e>0?Math.floor(e):Math.ceil(e)},Complex:function(t){return new e.Complex(t.re>0?Math.floor(t.re):Math.ceil(t.re),t.im>0?Math.floor(t.im):Math.ceil(t.im))},BigNumber:function(e){return e.isNegative()?e.ceil():e.floor()},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="fix",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var c=n(r(0)),f=n(r(11)),l=n(r(38)),p=n(r(17)),h=n(r(16)),m=n(r(6)),d=o("round",{number:Math.round,"number, number":function(e,t){if(!a(t))throw new TypeError(u);if(t<0||t>15)throw new Error("Number of decimals in function round must be in te range of 0-15");return i(e,t)},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(u);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(u);var r=t.toNumber();return e.round(r)},"number, BigNumber":function(t,r){if(!r.isInteger())throw new TypeError(u);return new e.BigNumber(t).toDecimalPlaces(r.toNumber())},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(u);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(u);return e.round(t)},"Array | Matrix":function(e){return s(e,d,!0)},"Matrix, number | BigNumber":function(e,t){var r;switch(e.storage()){case"sparse":r=p(e,t,d,!1);break;default:r=m(e,t,d,!1)}return r},"number | Complex | BigNumber, Matrix":function(e,t){if(!f(e,0)){var r;switch(t.storage()){case"sparse":r=h(t,e,d,!0);break;default:r=m(t,e,d,!0)}return r}return l(t.size(),t.storage())},"Array, number | BigNumber":function(e,t){return m(c(e),t,d,!1).valueOf()},"number | Complex | BigNumber, Array":function(e,t){return m(c(t),e,d,!0).valueOf()}});return d.toTex={1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},d}function i(e,t){return parseFloat(o(e,t))}var a=r(3).isInteger,o=r(3).toFixed,s=r(1),u="Number of decimals in function round must be an integer";t.name="round",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("format",{any:i.format,"any, Object | function | number":i.format});return a.toTex=void 0,a}var i=r(9);t.name="format",t.factory=n},function(e,t,r){function n(e,t,n,i){var a={};return a.bignumber=r(190),a.boolean=r(191),a.complex=r(192),a.createUnit=r(193),a.fraction=r(194),a.index=r(195),a.matrix=r(196),a.number=r(197),a.sparse=r(198),a.splitUnit=r(199),a.string=r(200),a.unit=r(201),a.e=r(98),a.E=r(98),a.false=r(202),a.i=r(203),a.Infinity=r(204),a.LN2=r(205),a.LN10=r(206),a.LOG2E=r(207),a.LOG10E=r(208),a.NaN=r(209),a.null=r(210),a.pi=r(99),a.PI=r(99),a.phi=r(211),a.SQRT1_2=r(212),a.SQRT2=r(213),a.tau=r(214),a.true=r(215),a.version=r(216),a.speedOfLight={description:"Speed of light in vacuum",examples:["speedOfLight"]},a.gravitationConstant={description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},a.planckConstant={description:"Planck constant",examples:["planckConstant"]},a.reducedPlanckConstant={description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},a.magneticConstant={description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},a.electricConstant={description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},a.vacuumImpedance={description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},a.coulomb={description:"Coulomb's constant",examples:["coulomb"]},a.elementaryCharge={description:"Elementary charge",examples:["elementaryCharge"]},a.bohrMagneton={description:"Borh magneton",examples:["bohrMagneton"]},a.conductanceQuantum={description:"Conductance quantum",examples:["conductanceQuantum"]},a.inverseConductanceQuantum={description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},a.magneticFluxQuantum={description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},a.nuclearMagneton={description:"Nuclear magneton",examples:["nuclearMagneton"]},a.klitzing={description:"Von Klitzing constant",examples:["klitzing"]},a.bohrRadius={description:"Borh radius",examples:["bohrRadius"]},a.classicalElectronRadius={description:"Classical electron radius",examples:["classicalElectronRadius"]},a.electronMass={description:"Electron mass",examples:["electronMass"]},a.fermiCoupling={description:"Fermi coupling constant",examples:["fermiCoupling"]},a.fineStructure={description:"Fine-structure constant",examples:["fineStructure"]},a.hartreeEnergy={description:"Hartree energy",examples:["hartreeEnergy"]},a.protonMass={description:"Proton mass",examples:["protonMass"]},a.deuteronMass={description:"Deuteron Mass",examples:["deuteronMass"]},a.neutronMass={description:"Neutron mass",examples:["neutronMass"]},a.quantumOfCirculation={description:"Quantum of circulation",examples:["quantumOfCirculation"]},a.rydberg={description:"Rydberg constant",examples:["rydberg"]},a.thomsonCrossSection={description:"Thomson cross section",examples:["thomsonCrossSection"]},a.weakMixingAngle={description:"Weak mixing angle",examples:["weakMixingAngle"]},a.efimovFactor={description:"Efimov factor",examples:["efimovFactor"]},a.atomicMass={description:"Atomic mass constant",examples:["atomicMass"]},a.avogadro={description:"Avogadro's number",examples:["avogadro"]},a.boltzmann={description:"Boltzmann constant",examples:["boltzmann"]},a.faraday={description:"Faraday constant",examples:["faraday"]},a.firstRadiation={description:"First radiation constant",examples:["firstRadiation"]},a.loschmidt={description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},a.gasConstant={description:"Gas constant",examples:["gasConstant"]},a.molarPlanckConstant={description:"Molar Planck constant",examples:["molarPlanckConstant"]},a.molarVolume={description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},a.sackurTetrode={description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},a.secondRadiation={description:"Second radiation constant",examples:["secondRadiation"]},a.stefanBoltzmann={description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},a.wienDisplacement={description:"Wien displacement law constant",examples:["wienDisplacement"]},a.molarMass={description:"Molar mass constant",examples:["molarMass"]},a.molarMassC12={description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},a.gravity={description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},a.planckLength={description:"Planck length",examples:["planckLength"]},a.planckMass={description:"Planck mass",examples:["planckMass"]},a.planckTime={description:"Planck time",examples:["planckTime"]},a.planckCharge={description:"Planck charge",examples:["planckCharge"]},a.planckTemperature={description:"Planck temperature",examples:["planckTemperature"]},a.derivative=r(217),a.lsolve=r(218),a.lup=r(219),a.lusolve=r(220),a.simplify=r(221),a.slu=r(222),a.usolve=r(223),a.qr=r(224),a.abs=r(225),a.add=r(226),a.cbrt=r(227),a.ceil=r(228),a.cube=r(229),a.divide=r(230),a.dotDivide=r(231),a.dotMultiply=r(232),a.dotPow=r(233),a.exp=r(234),a.fix=r(235),a.floor=r(236),a.gcd=r(237),a.hypot=r(238),a.lcm=r(239),a.log=r(240),a.log10=r(241),a.mod=r(242),a.multiply=r(243),a.norm=r(244),a.nthRoot=r(245),a.pow=r(246),a.round=r(247),a.sign=r(248),a.sqrt=r(249),a.square=r(250),a.subtract=r(251),a.unaryMinus=r(252),a.unaryPlus=r(253),a.xgcd=r(254),a.bitAnd=r(255),a.bitNot=r(256),a.bitOr=r(257),a.bitXor=r(258),a.leftShift=r(259),a.rightArithShift=r(260),a.rightLogShift=r(261),a.bellNumbers=r(262),a.catalan=r(263),a.composition=r(264),a.stirlingS2=r(265),a.config=r(266),a.import=r(267),a.typed=r(268),a.arg=r(269),a.conj=r(270),a.re=r(271),a.im=r(272),a.eval=r(273),a.help=r(274),a.distance=r(275),a.intersect=r(276),a.and=r(277),a.not=r(278),a.or=r(279),a.xor=r(280),a.concat=r(281),a.cross=r(282),a.det=r(283),a.diag=r(284),a.dot=r(285),a.eye=r(286),a.filter=r(287),a.flatten=r(288),a.forEach=r(289),a.inv=r(290),a.kron=r(291),a.map=r(292),a.ones=r(293),a.partitionSelect=r(294),a.range=r(295),a.resize=r(296),a.reshape=r(297),a.size=r(298),a.sort=r(299),a.squeeze=r(300),a.subset=r(301),a.trace=r(302),a.transpose=r(303),a.zeros=r(304),a.combinations=r(305),a.factorial=r(306),a.gamma=r(307),a.kldivergence=r(308),a.multinomial=r(309),a.permutations=r(310),a.pickRandom=r(311),a.random=r(312),a.randomInt=r(313),a.compare=r(314),a.compareNatural=r(315),a.deepEqual=r(316),a.equal=r(317),a.larger=r(318),a.largerEq=r(319),a.smaller=r(320),a.smallerEq=r(321),a.unequal=r(322),a.setCartesian=r(323),a.setDifference=r(324),a.setDistinct=r(325),a.setIntersect=r(326),a.setIsSubset=r(327),a.setMultiplicity=r(328),a.setPowerset=r(329),a.setSize=r(330),a.setSymDifference=r(331),a.setUnion=r(332),a.erf=r(333),a.mad=r(334),a.max=r(335),a.mean=r(336),a.median=r(337),a.min=r(338),a.mode=r(339),a.prod=r(340),a.quantileSeq=r(341),a.std=r(342),a.sum=r(343),a.var=r(344),a.acos=r(345),a.acosh=r(346),a.acot=r(347),a.acoth=r(348),a.acsc=r(349),a.acsch=r(350),a.asec=r(351),a.asech=r(352),a.asin=r(353),a.asinh=r(354),a.atan=r(355),a.atanh=r(356),a.atan2=r(357),a.cos=r(358),a.cosh=r(359),a.cot=r(360),a.coth=r(361),a.csc=r(362),a.csch=r(363),a.sec=r(364),a.sech=r(365),a.sin=r(366),a.sinh=r(367),a.tan=r(368),a.tanh=r(369),a.to=r(370),a.clone=r(371),a.format=r(372),a.isNaN=r(373),a.isInteger=r(374),a.isNegative=r(375),a.isNumeric=r(376),a.isPositive=r(377),a.isPrime=r(378),a.isZero=r(379),a.typeof=r(380),a}t.name="docs",t.path="expression",t.factory=n},function(e,t){e.exports={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]}},function(e,t){e.exports={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]}},function(e,t,r){"use strict";function n(e,t,n,o){function s(e,t){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError('Node expected for parameter "object"');if(!t||!t.isIndexNode)throw new TypeError('IndexNode expected for parameter "index"');this.object=e||null,this.index=t,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function u(e,t,r){if(!(e instanceof s))throw new TypeError("No valid AccessorNode");t.access=h,t.getSafeProperty=a;var n=l(e.object,t,r),o=l(e.index,t,r);if(e.index.isObjectProperty()){var u=i(e.index.getObjectProperty());return"getSafeProperty("+n+", "+u+")"}return e.index.needsSize()?"(function () { var object = "+n+"; var size = math.size(object).valueOf(); return access(object, "+o+");})()":"access("+n+", "+o+")"}function c(e){return!(e.isAccessorNode||e.isArrayNode||e.isConstantNode||e.isFunctionNode||e.isObjectNode||e.isParenthesisNode||e.isSymbolNode)}var f=n(r(7)).register,l=n(r(7)).compile,p=n(r(14)),h=(n(r(76)),n(r(101)));return s.prototype=new p,s.prototype.type="AccessorNode",s.prototype.isAccessorNode=!0,f(s.prototype.type,u),s.prototype.forEach=function(e){e(this.object,"object",this),e(this.index,"index",this)},s.prototype.map=function(e){return new s(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))},s.prototype.clone=function(){return new s(this.object,this.index)},s.prototype._toString=function(e){var t=this.object.toString(e);return c(this.object)&&(t="("+t+")"),t+this.index.toString(e)},s.prototype.toHTML=function(e){var t=this.object.toHTML(e);return c(this.object)&&(t='('+t+')'),t+this.index.toHTML(e)},s.prototype._toTex=function(e){var t=this.object.toTex(e);return c(this.object)&&(t="\\left("+t+"\\right)"),t+this.index.toTex(e)},s}var i=r(9).stringify,a=r(13).getSafeProperty;t.name="AccessorNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(22));return function(e,t){try{if(Array.isArray(e))return s(e,t);if(e&&"function"==typeof e.subset)return e.subset(t);if("string"==typeof e)return s(e,t);if("object"==typeof e){if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return a(e,t.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw i(e)}}}var i=r(41).transform,a=r(13).getSafeProperty;t.factory=n},function(e,t,r){"use strict";function n(e,t,n,s){function u(e,t,r){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=e,this.index=r?t:null,this.value=r?r:t,!e||!e.isSymbolNode&&!e.isAccessorNode)throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(e&&e.isSymbolNode&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!this.index.isIndexNode)throw new TypeError('IndexNode expected as "index"');if(!this.value||!this.value.isNode)throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function c(e,t,r){if(!(e instanceof u))throw new TypeError("No valid AssignmentNode");t.assign=m,t.access=d,t.getSafeProperty=a,t.setSafeProperty=o;var n,s=p(e.object,t,r),c=e.index?p(e.index,t,r):null,f=p(e.value,t,r),l=i(e.object.name);if(e.index){if(e.index.isObjectProperty()){var h=i(e.index.getObjectProperty());return"setSafeProperty("+s+", "+h+", "+f+")"}if(e.object.isSymbolNode)return n=e.index.needsSize()?"var size = math.size(object).valueOf();":"","(function () { var object = "+s+"; var value = "+f+"; "+n+" setSafeProperty(scope, "+l+", assign(object, "+c+", value)); return value;})()";n=e.index.needsSize()?"var size = math.size(object).valueOf();":"";var v=p(e.object.object,t,r);if(e.object.index.isObjectProperty()){var g=i(e.object.index.getObjectProperty());return"(function () { var parent = "+v+"; var object = getSafeProperty(parent, "+g+"); var value = "+f+";"+n+" setSafeProperty(parent, "+g+", assign(object, "+c+", value)); return value;})()"}var y=e.object.index.needsSize()?"var size = math.size(parent).valueOf();":"",x=p(e.object.index,t,r);return"(function () { var parent = "+v+"; "+y+" var parentIndex = "+x+"; var object = access(parent, parentIndex); var value = "+f+"; "+n+" assign(parent, parentIndex, assign(object, "+c+", value)); return value;})()"}if(!e.object.isSymbolNode)throw new TypeError("SymbolNode expected as object");return"setSafeProperty(scope, "+l+", "+f+")"}function f(e,t){t||(t="keep");var r=v.getPrecedence(e,t),n=v.getPrecedence(e.value,t);return"all"===t||null!==n&&n<=r}var l=n(r(7)).register,p=n(r(7)).compile,h=n(r(14)),m=(n(r(78)),n(r(0)),n(r(383))),d=n(r(101)),v=(r(75),r(52));return u.prototype=new h,u.prototype.type="AssignmentNode",u.prototype.isAssignmentNode=!0,l(u.prototype.type,c),u.prototype.forEach=function(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)},u.prototype.map=function(e){var t=this._ifNode(e(this.object,"object",this)),r=this.index?this._ifNode(e(this.index,"index",this)):null,n=this._ifNode(e(this.value,"value",this));return new u(t,r,n)},u.prototype.clone=function(){return new u(this.object,this.index,this.value)},u.prototype._toString=function(e){var t=this.object.toString(e),r=this.index?this.index.toString(e):"",n=this.value.toString(e);return f(this,e&&e.parenthesis)&&(n="("+n+")"),t+r+" = "+n},u.prototype.toHTML=function(e){var t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return f(this,e&&e.parenthesis)&&(n='('+n+')'),t+r+'='+n},u.prototype._toTex=function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return f(this,e&&e.parenthesis)&&(n="\\left("+n+"\\right)"),t+r+":="+n},u}var i=(r(4),r(9).stringify),a=r(13).getSafeProperty,o=r(13).setSafeProperty;t.name="AssignmentNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map(function(e){var t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!t||!t.isNode)throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}})}function u(e,t,r){if(!(e instanceof s))throw new TypeError("No valid BlockNode");t.ResultSet=p;var n=i(e.blocks,function(e){var n=f(e.node,t,r);return e.visible?"results.push("+n+");":n+";"});return"(function () {var results = [];"+a(n,"")+"return new ResultSet(results);})()"}var c=n(r(7)).register,f=n(r(7)).compile,l=n(r(14)),p=n(r(92));return s.prototype=new l,s.prototype.type="BlockNode",s.prototype.isBlockNode=!0,c(s.prototype.type,u),s.prototype.forEach=function(e){for(var t=0;t;')}).join('
')},s.prototype._toTex=function(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?"":";")}).join("\\;\\;\n")},s}var i=r(2).map,a=r(2).join;t.name="BlockNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e,t,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError("Parameter condition must be a Node");if(!t||!t.isNode)throw new TypeError("Parameter trueExpr must be a Node");if(!r||!r.isNode)throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=r}function s(e,t,r){if(!(e instanceof o))throw new TypeError("No valid ConditionalNode");return t.testCondition=function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(e.isBigNumber===!0)return!e.isZero();if(e.isComplex===!0)return!(!e.re&&!e.im);if(e.isUnit===!0)return!!e.value}if(null===e||void 0===e)return!1;throw new TypeError('Unsupported type of condition "'+t.math.typeof(e)+'"')},"testCondition("+c(e.condition,t,r)+") ? ( "+c(e.trueExpr,t,r)+") : ( "+c(e.falseExpr,t,r)+")"}var u=n(r(7)).register,c=n(r(7)).compile,f=n(r(14));return o.prototype=new f,o.prototype.type="ConditionalNode",o.prototype.isConditionalNode=!0,u(o.prototype.type,s),o.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},o.prototype.map=function(e){return new o(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},o.prototype.clone=function(){return new o(this.condition,this.trueExpr,this.falseExpr)},o.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=i.getPrecedence(this,t),n=this.condition.toString(e),a=i.getPrecedence(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==a&&a<=r)&&(n="("+n+")");var o=this.trueExpr.toString(e),s=i.getPrecedence(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==s&&s<=r)&&(o="("+o+")");var u=this.falseExpr.toString(e),c=i.getPrecedence(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==c&&c<=r)&&(u="("+u+")"),n+" ? "+o+" : "+u},o.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=i.getPrecedence(this,t),n=this.condition.toHTML(e),a=i.getPrecedence(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==a&&a<=r)&&(n='('+n+')');var o=this.trueExpr.toHTML(e),s=i.getPrecedence(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==s&&s<=r)&&(o='('+o+')');var u=this.falseExpr.toHTML(e),c=i.getPrecedence(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==c&&c<=r)&&(u='('+u+')'),n+'?'+o+':'+u},o.prototype._toTex=function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},o}var i=(r(4),r(52));t.name="ConditionalNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,h){function m(e,t,r){if(!(this instanceof m))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!r||!r.isNode)throw new TypeError('Node expected for parameter "expr"');if(e in i)throw new Error('Illegal function name, "'+e+'" is a reserved keyword');this.name=e,this.params=t.map(function(e){return e&&e.name||e}),this.types=t.map(function(e){return e&&e.type||"any"}),this.expr=r}function d(e,t,r){if(!(e instanceof m))throw new TypeError("No valid FunctionAssignmentNode");t.typed=h,t.setSafeProperty=l;var n=Object.create(r),i=s(e.params,function(e){return n[e]=p(n),n[e]}),o=y(e.expr,t,n),c=a(e.name);return"setSafeProperty(scope, "+c+", (function () { var fn = typed("+c+", { "+a(u(e.types,","))+": function ("+u(i,",")+") { return "+o+" } }); fn.syntax = "+a(e.name+"("+u(e.params,", ")+")")+"; return fn; })())"}function v(e,t){var r=f.getPrecedence(e,t),n=f.getPrecedence(e.expr,t);return"all"===t||null!==n&&n<=r}var g=n(r(7)).register,y=n(r(7)).compile,x=n(r(14));return m.prototype=new x,m.prototype.type="FunctionAssignmentNode",m.prototype.isFunctionAssignmentNode=!0,g(m.prototype.type,d),m.prototype.forEach=function(e){e(this.expr,"expr",this)},m.prototype.map=function(e){var t=this._ifNode(e(this.expr,"expr",this));return new m(this.name,this.params.slice(0),t)},m.prototype.clone=function(){return new m(this.name,this.params.slice(0),this.expr)},m.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toString(e);return v(this,t)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r},m.prototype.toHTML=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=[],n=0;n'+o(this.params[n])+"");var i=this.expr.toHTML(e);return v(this,t)&&(i='('+i+')'),''+o(this.name)+'('+r.join(',')+')='+i},m.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toTex(e);return v(this,t)&&(r="\\left("+r+"\\right)"),"\\mathrm{"+this.name+"}\\left("+this.params.map(c.toSymbol).join(",")+"\\right):="+r},m}var i=r(75),a=r(9).stringify,o=r(9).escape,s=r(2).map,u=r(2).join,c=r(4),f=r(52),l=r(13).setSafeProperty,p=r(106);t.name="FunctionAssignmentNode",t.path="expression.node",t.factory=n},function(e,t){function r(e){return"arg"+Object.keys(e).length}e.exports=r},function(e,t,r){"use strict";function n(e,t,n,u){function c(e){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!=typeof e||Object.keys(e).some(function(t){return!e[t]||!e[t].isNode})))throw new TypeError("Object containing Nodes expected")}function f(e,t,r){if(!(e instanceof c))throw new TypeError("No valid ObjectNode");var n=[];for(var a in e.properties)if(s(e.properties,a)){if(!o(e.properties,a))throw new Error('No access to property "'+a+'"');n.push(i(a)+": "+p(e.properties[a],t,r))}return"{"+n.join(", ")+"}"}var l=n(r(7)).register,p=n(r(7)).compile,h=n(r(14));return c.prototype=new h,c.prototype.type="ObjectNode",c.prototype.isObjectNode=!0,l(c.prototype.type,f),c.prototype.forEach=function(e){for(var t in this.properties)this.properties.hasOwnProperty(t)&&e(this.properties[t],"properties["+i(t)+"]",this)},c.prototype.map=function(e){var t={};for(var r in this.properties)this.properties.hasOwnProperty(r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+i(r)+"]",this)));return new c(t)},c.prototype.clone=function(){var e={};for(var t in this.properties)this.properties.hasOwnProperty(t)&&(e[t]=this.properties[t]);return new c(e)},c.prototype._toString=function(e){var t=[];for(var r in this.properties)this.properties.hasOwnProperty(r)&&t.push(i(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"},c.prototype.toHTML=function(e){var t=[];for(var r in this.properties)this.properties.hasOwnProperty(r)&&t.push(''+a(r)+':'+this.properties[r].toHTML(e));return'{'+t.join(',')+'}'},c.prototype._toTex=function(e){var t=[];for(var r in this.properties)this.properties.hasOwnProperty(r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"},c}var i=r(9).stringify,a=r(9).escape,o=r(13).isSafeProperty,s=r(5).hasOwnProperty;t.name="ObjectNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i,a){var o=n(r(109));return i("parser",{"":function(){return new o(a)}})}t.name="parser",t.factory=n,t.math=!0},function(e,t,r){"use strict";function n(e,t,n,o,s){function u(){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");this.scope={}}var c=n(r(39));return u.prototype.type="Parser",u.prototype.isParser=!0,u.prototype.parse=function(e){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},u.prototype.compile=function(e){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},u.prototype.eval=function(e){return c(e).compile().eval(this.scope)},u.prototype.get=function(e){return e in this.scope?a.getSafeProperty(this.scope,e):void 0},u.prototype.getAll=function(){return i({},this.scope)},u.prototype.set=function(e,t){return a.setSafeProperty(this.scope,e,t)},u.prototype.remove=function(e){delete this.scope[e]},u.prototype.clear=function(){for(var e in this.scope)this.scope.hasOwnProperty(e)&&delete this.scope[e]},u}var i=r(5).extend,a=r(13);t.name="Parser",t.path="expression",t.factory=n,t.math=!0},function(e,t,r){"use strict";function n(e,t,n,s){function u(e,t){return f(e,t)?e:t}function c(e){var t=void 0;if(i(e,function(e){(void 0===t||f(e,t))&&(t=e)}),void 0===t)throw new Error("Cannot calculate max of an empty array");return t}var f=n(r(34)),l=s("max",{"Array | Matrix":c,"Array | Matrix, number | BigNumber":function(e,t){return a(e,t.valueOf(),u)},"...":function(e){if(o(e))throw new TypeError("Scalar values expected in function max");return c(e)}});return l.toTex="\\max\\left(${args}\\right)",l}var i=r(42),a=r(64),o=r(65);t.name="max",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,u){function c(e,t){var r=o(e,t,l),n=Array.isArray(e)?i(e):e.size();return p(r,n[t])}function f(e){var t=0,r=0;if(a(e,function(e){t=l(t,e),r++}),0===r)throw new Error("Cannot calculate mean of an empty array");return p(t,r)}var l=n(r(18)),p=n(r(47)),h=u("mean",{"Array | Matrix":f,"Array | Matrix, number | BigNumber":c,"...":function(e){if(s(e))throw new TypeError("Scalar values expected in function mean");return f(e)}});return h.toTex=void 0,h}var i=r(2).size,a=r(42),o=r(64),s=r(65);t.name="mean",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e,t,r){var n,i,a,o,s;if(1==t){if(o=e[0][0],0==o)throw Error("Cannot calculate inverse, determinant is zero");return[[u(1,o)]]}if(2==t){var m=p(e);if(0==m)throw Error("Cannot calculate inverse, determinant is zero");return[[u(e[1][1],m),u(l(e[0][1]),m)],[u(l(e[1][0]),m),u(e[0][0],m)]]}var d=e.concat();for(n=0;n0)for(;it;)n.push(i),i+=r;return n}function u(e,t,r){var n=[],i=e;if(r>0)for(;i<=t;)n.push(i),i+=r;else if(r<0)for(;i>=t;)n.push(i),i+=r;return n}function c(e,t,r){var n=[],i=e;if(r.gt(h))for(;i.lt(t);)n.push(i),i=i.plus(r);else if(r.lt(h))for(;i.gt(t);)n.push(i),i=i.plus(r);return n}function f(e,t,r){var n=[],i=e;if(r.gt(h))for(;i.lte(t);)n.push(i),i=i.plus(r);else if(r.lt(h))for(;i.gte(t);)n.push(i),i=i.plus(r);return n}function l(e){var t=e.split(":"),r=t.map(function(e){return Number(e)}),n=r.some(function(e){return isNaN(e)});if(n)return null;switch(r.length){case 2:return{start:r[0],end:r[1],step:1};case 3:return{start:r[0],end:r[2],step:r[1]};default:return null}}var p=n(r(0)),h=new e.BigNumber(0),m=new e.BigNumber(1),d=i("range",{string:o,"string, boolean":o,"number, number":function(e,t){return a(s(e,t,1))},"number, number, number":function(e,t,r){return a(s(e,t,r))},"number, number, boolean":function(e,t,r){return a(r?u(e,t,1):s(e,t,1))},"number, number, number, boolean":function(e,t,r,n){return a(n?u(e,t,r):s(e,t,r))},"BigNumber, BigNumber":function(e,t){return a(c(e,t,m))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return a(c(e,t,r))},"BigNumber, BigNumber, boolean":function(e,t,r){return a(r?f(e,t,m):c(e,t,m))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return a(n?f(e,t,r):c(e,t,r))}});return d.toTex=void 0,d}t.name="range",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i,a){function o(e){return e.transform(function(e,t,r){return e.isParenthesisNode?e.content:e})}function s(e){for(var t=[],r=0;r");if(2!==s.length)throw SyntaxError("Could not parse rule: "+i);i={l:s[0],r:s[1]};case"object":if(n={l:o(d(i.l)),r:o(d(i.r))},i.context&&(n.evaluate=i.context),i.evaluate&&(n.evaluate=d(i.evaluate)),n.l.isOperatorNode&&O(n.l)){var c=C(n.l),f=u();n.expanded={},n.expanded.l=c([n.l.clone(),f]),T(n.expanded.l),_(n.expanded.l),n.expanded.r=c([n.r,f])}break;case"function":n=i;break;default:throw TypeError("Unsupported type of rule: "+a)}t.push(n)}return t}function u(){return new w("_p"+I++)}function c(e,t){var r,n,i=[],a=C(e);if(A(e,t))for(var o=0;o=2&&2===e.args.length){for(var i=c(t,e.context),o=[],s=0;s2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var f=[],s=0;s2&&o(e)){for(var i=e.args.pop();e.args.length>0;)i=t([e.args.pop(),i]);e.args=i.args}}}function f(e){if(e.args&&0!==e.args.length){for(var t=l(e),r=e.args.length,n=0;n2&&o(e)){for(var i=e.args.shift();e.args.length>0;)i=t([i,e.args.shift()]);e.args=i.args}}}function l(e){return e.isOperatorNode?function(t){try{return new h(e.op,e.fn,t)}catch(e){return console.error(e),[]}}:function(t){return new p(new m(e.name),t)}}var p=i.expression.node.FunctionNode,h=i.expression.node.OperatorNode,m=i.expression.node.SymbolNode,d={add:!0,multiply:!0},v={add:!0,multiply:!0};return{createMakeNodeFunction:l,isCommutative:a,isAssociative:o,flatten:s,allChildren:u,unflattenr:c,unflattenl:f}}t.factory=n,t.math=!0},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("clone",{any:i.clone});return a.toTex=void 0,a}var i=r(5);t.name="clone",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=n(r(15)),c=n(r(26)),f=n(r(16)),l=n(r(8)),p=n(r(6)),h=r(4),m=o("unequal",{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:d(e,t)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,d);break;default:r=u(t,e,d,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,d,!1);break;default:r=l(e,t,d)}}return r},"Array, Array":function(e,t){return m(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return m(s(e),t)},"Matrix, Array":function(e,t){return m(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,d,!1);break;default:r=p(e,t,d,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,d,!0);break;default:r=p(t,e,d,!0)}return r},"Array, any":function(e,t){return p(s(e),t,d,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,d,!0).valueOf()}}),d=o("_unequal",{"boolean, boolean":function(e,t){return e!==t},"number, number":function(e,r){return!i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return!a(e,r,t.epsilon)},"Fraction, Fraction":function(e,t){return!e.equals(t)},"Complex, Complex":function(e,t){return!e.equals(t)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return e!==t}});return m.toTex={2:"\\left(${args[0]}"+h.operators.unequal+"${args[1]}\\right)"},m}var i=r(3).nearlyEqual,a=r(35);t.name="unequal",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("sign",{number:i.sign,Complex:function(e){return e.sign()},BigNumber:function(t){return new e.BigNumber(t.cmp(0))},Fraction:function(t){return new e.Fraction(t.s,1)},"Array | Matrix":function(e){return a(e,o,!0)},Unit:function(e){return o(e.value)}});return o.toTex={1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},o}var i=r(3),a=r(1);t.name="sign",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("conj",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.conjugate()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\left(${args[0]}\\right)^*"},a}var i=r(1);t.name="conj",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var o=n(r(0)),s=n(r(29)),u=n(r(20)),c=n(r(19)),f=n(r(23)),l=n(r(21)),p=n(r(34)),h=n(r(11)),m=n(r(37)),d=e.SparseMatrix,v=e.DenseMatrix,g=e.Spa,y=i("lup",{DenseMatrix:function(e){return x(e)},SparseMatrix:function(e){return w(e)},Array:function(e){var t=o(e),r=x(t);return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}}),x=function(e){var t,r,n,i=e._size[0],o=e._size[1],m=Math.min(i,o),d=a.clone(e._data),g=[],y=[i,m],x=[],w=[m,o],b=[];for(t=0;t0)for(t=0;t0&&S.forEach(0,r-1,function(e,t){d._forEachRow(e,y,x,w,function(r,n){r>e&&S.accumulate(r,m(f(n,t)))})});var k=r,I=S.get(r),B=s(I);S.forEach(r+1,i-1,function(e,t){var r=s(t);p(r,B)&&(k=e,B=r,I=t)}),r!==k&&(d._swapRows(r,k,b[1],y,x,w),d._swapRows(r,k,A[1],N,E,M),S.swap(r,k),_(r,k)),S.forEach(0,i-1,function(e,t){e<=r?(N.push(t),E.push(e)):(t=c(t,I),h(t,0)||(y.push(t),x.push(e)))})}return M.push(N.length),w.push(y.length),{L:new d({values:y,index:x,ptr:w,size:b}),U:new d({values:N,index:E,ptr:M,size:A}),p:O,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}};return y}var i=r(25),a=i.object;t.name="lup",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(408)),s=n(r(416)),u=i("slu",{"SparseMatrix, number, number":function(e,t,r){if(!o(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=a(t,e,!1),i=s(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}});return u}var i=r(25),a=i.number,o=a.isInteger;t.name="slu",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t,r,n,i,a,o){var s=0;for(r[o]=e;s>=0;){var u=r[o+s],c=r[n+u];c==-1?(s--,a[t++]=u):(r[n+u]=r[i+c],++s,r[o+s]=c)}return t};return e}t.name="cs_tdfs",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=n(r(15)),c=n(r(26)),f=n(r(16)),l=n(r(8)),p=n(r(6)),h=r(4),m=o("largerEq",{"boolean, boolean":function(e,t){return e>=t},"number, number":function(e,r){return e>=r||i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.gte(r)||a(e,r,t.epsilon)},"Fraction, Fraction":function(e,t){return e.compare(t)!==-1},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return e>=t},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,m);break;default:r=u(t,e,m,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,m,!1);break;default:r=l(e,t,m)}}return r},"Array, Array":function(e,t){return m(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return m(s(e),t)},"Matrix, Array":function(e,t){return m(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,m,!1);break;default:r=p(e,t,m,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,m,!0);break;default:r=p(t,e,m,!0)}return r},"Array, any":function(e,t){return p(s(e),t,m,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}"+h.operators.largerEq+"${args[1]}\\right)"},m}var i=r(3).nearlyEqual,a=r(35);t.name="largerEq",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t){return e[t]<0};return e}t.name="cs_marked",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(81)),a=function(e,t){e[t]=i(e[t])};return a}t.name="cs_mark",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(0)),o=n(r(19)),s=n(r(23)),u=n(r(21)),c=n(r(11)),f=n(r(82)),l=e.DenseMatrix,p=i("lsolve",{"SparseMatrix, Array | Matrix":function(e,t){return m(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return h(e,t)},"Array, Array | Matrix":function(e,t){var r=a(e),n=h(r,t);return n.valueOf()}}),h=function(e,t){t=f(e,t,!0);for(var r=t._data,n=e._size[0],i=e._size[1],a=[],p=e._data,h=0;hg&&(w.push(h[n]),b.push(r));if(c(x,0))throw new Error("Linear system cannot be solved since matrix is singular");var E=o(y,x);for(n=0,N=b.length;n=0;h--){var m,d=r[h][0]||0;if(c(d,0))m=0;else{var v=p[h][h];if(c(v,0))throw new Error("Linear system cannot be solved since matrix is singular");m=o(d,v);for(var g=h-1;g>=0;g--)r[g]=[u(r[g][0]||0,s(m,p[g][h]))]}a[h]=[m]}return new l({data:a,size:[n,1]})},m=function(e,t){t=f(e,t,!0);for(var r,n,i=t._data,a=e._size[0],p=e._size[1],h=e._values,m=e._index,d=e._ptr,v=[],g=p-1;g>=0;g--){var y=i[g][0]||0;if(c(y,0))v[g]=[0];else{var x=0,w=[],b=[],N=d[g],E=d[g+1];for(n=E-1;n>=N;n--)r=m[n],r===g?x=h[n]:r=0||t.predictable?Math.log(r):new e.Complex(r,0).log()},Complex:function(e){return e.log()},BigNumber:function(r){return!r.isNegative()||t.predictable?r.ln():new e.Complex(r.toNumber(),0).log()},"Array | Matrix":function(e){return i(e,s)},"any, any":function(e,t){return o(s(e),s(t))}});return s.toTex={1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},s}var i=r(1);t.name="log",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=n(r(18)),c=o("trace",{Array:function(e){return c(s(e))},Matrix:function(e){var t;switch(e.storage()){case"dense":t=f(e);break;case"sparse":t=l(e)}return t},any:i}),f=function(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1==t[0])return i(r[0]);throw new RangeError("Matrix must be square (size: "+a(t)+")");case 2:var n=t[0],o=t[1];if(n===o){for(var s=0,c=0;c0)for(var f=0;ff)break}return c}throw new RangeError("Matrix must be square (size: "+a(i)+")")};return c.toTex={1:"\\mathrm{tr}\\left(${args[0]}\\right)"},c}var i=r(5).clone,a=r(9).format;t.name="trace",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(18)),o=n(r(21)),s=n(r(12)),u=n(r(47)),c=n(r(45)),f=n(r(68)),l=n(r(69)),p=n(r(57)),h=n(r(48)),m=n(r(34)),d=i("stirlingS2",{"number | BigNumber, number | BigNumber":function(e,t){if(!h(e)||p(e)||!h(t)||p(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");for(var r=f(t),n=0,i=0;i<=t;i++){var d=c(-1,o(t,i)),v=l(t,i),g=c(i,e);n=a(n,s(s(v,g),d))}return u(n,r)}});return d.toTex={2:"\\mathrm{S}\\left(${args}\\right)"},d}t.name="stirlingS2",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,u){function c(r){if(r.isZero())return new e.BigNumber(1);for(var n=t.precision+(0|Math.log(r.toNumber())),i=e.BigNumber.clone({precision:n}),a=new i(r),o=r.toNumber()-1;o>1;)a=a.times(o),o--;return new e.BigNumber(a.toPrecision(e.BigNumber.precision))}var f=n(r(12)),l=n(r(45)),p=u("gamma",{number:function(e){var t,r;if(a(e)){if(e<=0)return isFinite(e)?1/0:NaN;if(e>171)return 1/0;for(var n=e-2,i=e-1;n>1;)i*=n,n--;return 0==i&&(i=1),i}if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*p(1-e));if(e>=171.35)return 1/0;if(e>85){var u=e*e,c=u*e,f=c*e,l=f*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*u)-139/(51840*c)-571/(2488320*f)+163879/(209018880*l)+5246819/(75246796800*l*e))}--e,r=s[0];for(var h=1;h0&&(a=e[o]);return m(a,n)}var s=l(e,(t-1)/2);return h(s)}var u=n(r(20)),c=n(r(19)),f=n(r(49)),l=n(r(86)),p=o("median",{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(a(e))throw new TypeError("Scalar values expected in function median");return s(e)}}),h=o({"number | BigNumber | Complex | Unit":function(e){return e}}),m=o({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return c(u(e,t),2)}});return p.toTex=void 0,p}var i=r(2).flatten,a=(r(64),r(65));t.name="median",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(t,r){var n=0,i=0;if(0==t.length)throw new SyntaxError("Function var requires one or more parameters (0 provided)");if(a(t,function(e){ +n=u(n,e),i++}),0===i)throw new Error("Cannot calculate var of an empty array");var o=l(n,i);switch(n=0,a(t,function(e){var t=c(e,o);n=u(n,f(t,t))}),r){case"uncorrected":return l(n,i);case"biased":return l(n,i+1);case"unbiased":var s=n&&n.isBigNumber===!0?new e.BigNumber(0):0;return 1==i?s:l(n,i-1);default:throw new Error('Unknown normalization "'+r+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}var u=n(r(20)),c=n(r(21)),f=n(r(23)),l=n(r(19)),p=o("variance",{"Array | Matrix":function(e){return s(e,i)},"Array | Matrix, string":s,"...":function(e){return s(e,i)}});return p.toTex="\\mathrm{Var}\\left(${args}\\right)",p}var i="unbiased",a=r(42);t.name="var",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("acosh",{number:function(r){return r>=1||t.predictable?a(r):r<=-1?new e.Complex(Math.log(Math.sqrt(r*r-1)-r),Math.PI):new e.Complex(r,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()},"Array | Matrix":function(e){return i(e,o)}});return o.toTex={1:"\\cosh^{-1}\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)};t.name="acosh",t.factory=n},function(e,t,r){function n(e){var t=i.create(e);return t.create=n,t.import(r(154)),t}var i=r(147);e.exports=n()},function(e,t,r){e.exports=r(148)},function(e,t,r){var n=r(5).isFactory,i=r(149),a=r(88),o=r(152),s=r(153);t.create=function(e){function t(e){if(!n(e))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var i,a=r.indexOf(e);return a===-1?(i=e.math===!0?e.factory(c.type,f,t,c.typed,c):e.factory(c.type,f,t,c.typed),r.push(e),u.push(i)):i=u[a],i}if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r=[],u=[],c=a.mixin({});c.type={},c.expression={transform:{},mathWithTransform:{}},c.typed=i.create(c.type);var f={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};return c.import=t(o),c.config=t(s),c.expression.mathWithTransform.config=c.config,e&&c.config(e),c}},function(e,t,r){var n=r(150),i=r(3).digits,a=function(){return a=n.create,n};t.create=function(e){var t=a();return t.types=[{name:"number",test:function(e){return"number"==typeof e}},{name:"Complex",test:function(e){return e&&e.isComplex}},{name:"BigNumber",test:function(e){return e&&e.isBigNumber}},{name:"Fraction",test:function(e){return e&&e.isFraction}},{name:"Unit",test:function(e){return e&&e.isUnit}},{name:"string",test:function(e){return"string"==typeof e}},{name:"Array",test:Array.isArray},{name:"Matrix",test:function(e){return e&&e.isMatrix}},{name:"DenseMatrix",test:function(e){return e&&e.isDenseMatrix}},{name:"SparseMatrix",test:function(e){return e&&e.isSparseMatrix}},{name:"Range",test:function(e){return e&&e.isRange}},{name:"Index",test:function(e){return e&&e.isIndex}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"ResultSet",test:function(e){return e&&e.isResultSet}},{name:"Help",test:function(e){return e&&e.isHelp}},{name:"function",test:function(e){return"function"==typeof e}},{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}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}},{name:"OperatorNode",test:function(e){return e&&e.isOperatorNode}},{name:"ConstantNode",test:function(e){return e&&e.isConstantNode}},{name:"SymbolNode",test:function(e){return e&&e.isSymbolNode}},{name:"ParenthesisNode",test:function(e){return e&&e.isParenthesisNode}},{name:"FunctionNode",test:function(e){return e&&e.isFunctionNode}},{name:"FunctionAssignmentNode",test:function(e){return e&&e.isFunctionAssignmentNode}},{name:"ArrayNode",test:function(e){return e&&e.isArrayNode}},{name:"AssignmentNode",test:function(e){return e&&e.isAssignmentNode}},{name:"BlockNode",test:function(e){return e&&e.isBlockNode}},{name:"ConditionalNode",test:function(e){return e&&e.isConditionalNode}},{name:"IndexNode",test:function(e){return e&&e.isIndexNode}},{name:"RangeNode",test:function(e){return e&&e.isRangeNode}},{name:"UpdateNode",test:function(e){return e&&e.isUpdateNode}},{name:"Node",test:function(e){return e&&e.isNode}}],t.conversions=[{from:"number",to:"BigNumber",convert:function(t){if(i(t)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new e.BigNumber(t)}},{from:"number",to:"Complex",convert:function(t){return new e.Complex(t,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(t){return new e.Complex(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return new e.Complex(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){var r=new e.Fraction(t);if(r.valueOf()!==t)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return new e.Fraction(t)}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(t){try{return new e.BigNumber(t)}catch(e){throw new Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){try{return new e.Fraction(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){try{return new e.Complex(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(t){return new e.BigNumber(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return new e.Fraction(+t)}},{from:"boolean",to:"string",convert:function(e){return+e}},{from:"null",to:"number",convert:function(){return 0}},{from:"null",to:"string",convert:function(){return"null"}},{from:"null",to:"BigNumber",convert:function(){return new e.BigNumber(0)}},{from:"null",to:"Fraction",convert:function(){return new e.Fraction(0)}},{from:"Array",to:"Matrix",convert:function(t){return new e.DenseMatrix(t)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],t}},function(e,t,r){"use strict";var n,i,a;!function(r,o){i=[],n=o,a="function"==typeof n?n.apply(t,i):n,!(void 0!==a&&(e.exports=a))}(this,function(){function e(){function t(e){for(var t,r=0;rr&&!c?"Unexpected type of argument in function "+u+" (expected: "+s.join(" or ")+", actual: "+o+", index: "+r+")":"Too few arguments in function "+u+" (expected: "+s.join(" or ")+", index: "+r+")":"Too many arguments in function "+u+" (expected: "+r+", actual: "+t+")";var l=new TypeError(a);return l.data=f,l}function i(e){this.name=e||"refs",this.categories={}}function a(e,t){if("string"==typeof e){var r=e.trim(),n="..."===r.substr(0,3);if(n&&(r=r.substr(3)),""===r)this.types=["any"];else{this.types=r.split("|");for(var i=0;it&&(t=n)}return t}function d(e){for(var t,r=0;r0},a.prototype.contains=function(e){for(var t=0;tt.params.length)return 1;if(e.params.lengtho)return 1;if(i "+i+") {"),n.push(r+" var varArgs = [];"),n.push(r+" for (var i = "+i+"; i < arguments.length; i++) {"),n.push(r+" varArgs.push(arguments[i]);"),n.push(r+" }"),n.push(this.signature.toCode(e,r+" ")),n.push(r+"}");else{for(var s=function(r,n){for(var i=[],a=0;a "+r+") {",t+" throw createError(name, arguments.length, "+r+", arguments["+r+"]);",t+"}"].join("\n");for(var n={},i=[],a=0;a0){for(a+=o,t=1;tr)throw Error(Me+e)}function s(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=Be,i=0):(i=Math.ceil((t+1)/Be),t%=Be),a=_e(10,Be-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==_e(10,t-2)-1||(s==a/2||0==s)&&0==(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==_e(10,t-3)-1,o}function u(e,t,r){for(var n,i,a=[0],o=0,s=e.length;or-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function c(e,t){var r,n,i=t.d.length;i<32?(r=Math.ceil(i/3),n=Math.pow(4,-r).toString()):(r=16,n="2.3283064365386962890625e-10"),e.precision+=r,t=O(e,1,t.times(n),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}function f(e,t,r,n){var i,a,o,s,u,c,f,l,p,h=e.constructor;e:if(null!=t){if(l=e.d,!l)return e;for(i=1,s=l[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=Be,o=t,f=l[p=0],u=f/_e(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Be),s=l.length,p>=s){if(!n)break e;for(;s++<=p;)l.push(0);f=u=0,i=1,a%=Be,o=a-Be+1}else{for(f=s=l[p],i=1;s>=10;s/=10)i++;a%=Be,o=a-Be+i,u=o<0?0:f/_e(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%_e(10,i-o-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(a>0?o>0?f/_e(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=_e(10,(Be-t%Be)%Be),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=_e(10,Be-a),l[p]=o>0?(f/_e(10,i-o)%_e(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==Ie&&(l[0]=1));break}if(l[p]+=s,l[p]!=Ie)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return Ne&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e0?o=o.charAt(0)+"."+o.slice(1)+v(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+v(-i-1)+o,r&&(n=r-s)>0&&(o+=v(n))):i>=s?(o+=v(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+v(n))):((n=i+1)0&&(i+1===s&&(o+="."),o+=v(n))),o}function p(e,t){var r=e[0];for(t*=Be;r>=10;r/=10)t++;return t}function h(e,t,r){if(t>Re)throw Ne=!0,r&&(e.precision=r),Error(Ae);return f(new e(xe),t,1,!0)}function m(e,t,r){if(t>Ue)throw Error(Ae);return f(new e(we),t,r,!0)}function d(e){var t=e.length-1,r=t*Be+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function v(e){for(var t="";e--;)t+="0";return t}function g(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/Be+4);for(Ne=!1;;){if(r%2&&(a=a.times(t),S(a.d,o)&&(i=!0)),r=Te(r/2),0===r){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}t=t.times(t),S(t.d,o)}return Ne=!0,a}function y(e){return 1&e.d[e.d.length-1]}function x(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(Ne=!1,l=g):l=t,c=new d(.03125);e.e>-2;)e=e.times(c),m+=5;for(n=Math.log(_e(2,m))/Math.LN10*2+5|0,l+=n,r=o=u=new d(1),d.precision=l;;){if(o=f(o.times(e),l,1),r=r.times(++h),c=u.plus(Le(o,r,l,1)),a(c.d).slice(0,l)===a(u.d).slice(0,l)){for(i=m;i--;)u=f(u.times(u),l,1);if(null!=t)return d.precision=g,u;if(!(p<3&&s(u.d,l-n,v,p)))return f(u,d.precision=g,v,Ne=!0);d.precision=l+=10,r=o=c=new d(1),h=0,p++}u=c}}function b(e,t){var r,n,i,o,u,c,l,p,m,d,v,g=1,y=10,x=e,w=x.d,N=x.constructor,E=N.rounding,M=N.precision;if(x.s<0||!w||!w[0]||!x.e&&1==w[0]&&1==w.length)return new N(w&&!w[0]?-1/0:1!=x.s?NaN:w?0:x);if(null==t?(Ne=!1,m=M):m=t,N.precision=m+=y,r=a(w),n=r.charAt(0),!(Math.abs(o=x.e)<15e14))return p=h(N,m+2,M).times(o+""),x=b(new N(n+"."+r.slice(1)),m-y).plus(p),N.precision=M,null==t?f(x,M,E,Ne=!0):x;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)x=x.times(e),r=a(x.d),n=r.charAt(0),g++;for(o=x.e,n>1?(x=new N("0."+r),o++):x=new N(n+"."+r.slice(1)),d=x,l=u=x=Le(x.minus(1),x.plus(1),m,1),v=f(x.times(x),m,1),i=3;;){if(u=f(u.times(v),m,1),p=l.plus(Le(u,new N(i),m,1)),a(p.d).slice(0,m)===a(l.d).slice(0,m)){if(l=l.times(2),0!==o&&(l=l.plus(h(N,m+2,M).times(o+""))),l=Le(l,new N(g),m,1),null!=t)return N.precision=M,l;if(!s(l.d,m-y,E,c))return f(l,N.precision=M,E,Ne=!0);N.precision=m+=y,p=u=x=Le(d.minus(1),d.plus(1),m,1),v=f(x.times(x),m,1),i=c=1}l=p,i+=2}}function N(e){return String(e.s*e.s/0)}function E(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Be,r<0&&(n+=Be),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e0?(c=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf("."),o=a>=0,n=e.constructor,o&&(t=t.replace(".",""),s=t.length,a=s-a,i=g(n,new n(r),a,2*a)),f=u(t,r,Ie),l=f.length-1,a=l;0===f[a];--a)f.pop();return a<0?new n(0*e.s):(e.e=p(f,l),e.d=f,Ne=!1,o&&(e=Le(e,i,4*s)),c&&(e=e.times(Math.abs(c)<54?Math.pow(2,c):be.pow(2,c))),Ne=!0,e)}function A(e,t){var r,n=t.d.length;if(n<3)return O(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:0|r,t=t.times(Math.pow(5,-r)),t=O(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function O(e,t,r,n,i){var a,o,s,u,c=1,f=e.precision,l=Math.ceil(f/Be);for(Ne=!1,u=r.times(r),s=new e(n);;){if(o=Le(s.times(u),new e(t++*t++),f,1),s=i?n.plus(o):n.minus(o),n=Le(o.times(u),new e(t++*t++),f,1),o=s.plus(n),void 0!==o.d[l]){for(a=l;o.d[a]===s.d[a]&&a--;);if(a==-1)break}a=s,s=n,n=o,o=a,c++}return Ne=!0,o.d.length=l+1,o}function T(e,t){var r,n=t.s<0,i=m(e,e.precision,1),a=i.times(.5);if(t=t.abs(),t.lte(a))return de=n?4:1,t;if(r=t.divToInt(i),r.isZero())de=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(a))return de=y(r)?n?2:3:n?4:1,t;de=y(r)?n?1:4:n?3:2}return t.minus(i).abs()}function _(e,t,r,n){var i,a,s,c,f,p,h,m,d,v=e.constructor,g=void 0!==r;if(g?(o(r,1,ge),void 0===n?n=v.rounding:o(n,0,8)):(r=v.precision,n=v.rounding),e.isFinite()){for(h=l(e),s=h.indexOf("."),g?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,s>=0&&(h=h.replace(".",""),d=new v(1),d.e=h.length-s,d.d=u(l(d),10,i),d.e=d.d.length),m=u(h,10,i),a=f=m.length;0==m[--f];)m.pop();if(m[0]){if(s<0?a--:(e=new v(e), +e.d=m,e.e=a,e=Le(e,d,r,n,0,i),m=e.d,a=e.e,p=me),s=m[r],c=i/2,p=p||void 0!==m[r+1],p=n<4?(void 0!==s||p)&&(0===n||n===(e.s<0?3:2)):s>c||s===c&&(4===n||p||6===n&&1&m[r-1]||n===(e.s<0?8:7)),m.length=r,p)for(;++m[--r]>i-1;)m[r]=0,r||(++a,m.unshift(1));for(f=m.length;!m[f-1];--f);for(s=0,h="";s1)if(16==t||8==t){for(s=16==t?4:3,--f;f%s;f++)h+="0";for(m=u(h,i,t),f=m.length;!m[f-1];--f);for(s=1,h="1.";sf)for(a-=f;a--;)h+="0";else at)return e.length=t,!0}function C(e){return new this(e).abs()}function z(e){return new this(e).acos()}function k(e){return new this(e).acosh()}function I(e,t){return new this(e).plus(t)}function B(e){return new this(e).asin()}function P(e){return new this(e).asinh()}function R(e){return new this(e).atan()}function U(e){return new this(e).atanh()}function q(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?m(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=m(this,a,1).times(.5),r.s=e.s):t.s<0?(this.precision=a,this.rounding=1,r=this.atan(Le(e,t,a,1)),t=m(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Le(e,t,a,1)):(r=m(this,a,1).times(t.s>0?.25:.75),r.s=e.s):r=new this(NaN),r}function L(e){return new this(e).cbrt()}function j(e){return f(e=new this(e),e.e+1,2)}function F(e){if(!e||"object"!=typeof e)throw Error(Ee+"Object expected");var t,r,n,i=["precision",1,ge,"rounding",0,8,"toExpNeg",-ve,0,"toExpPos",0,ve,"maxE",0,ve,"minE",-ve,0,"modulo",0,9];for(t=0;t=i[t+1]&&n<=i[t+2]))throw Error(Me+r+": "+n);this[r]=n}if(void 0!==(n=e[r="crypto"])){if(n!==!0&&n!==!1&&0!==n&&1!==n)throw Error(Me+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Oe);this[r]=!0}else this[r]=!1}return this}function D(e){return new this(e).cos()}function H(e){return new this(e).cosh()}function $(e){function t(e){var r,n,i,a=this;if(!(a instanceof t))return new t(e);if(a.constructor=t,e instanceof t)return a.s=e.s,a.e=e.e,void(a.d=(e=e.d)?e.slice():e);if(i=typeof e,"number"===i){if(0===e)return a.s=1/e<0?-1:1,a.e=0,void(a.d=[0]);if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(r=0,n=e;n>=10;n/=10)r++;return a.e=r,void(a.d=[e])}return 0*e!==0?(e||(a.s=NaN),a.e=NaN,void(a.d=null)):E(a,e.toString())}if("string"!==i)throw Error(Me+e);return 45===e.charCodeAt(0)?(e=e.slice(1),a.s=-1):a.s=1,ke.test(e)?E(a,e):M(a,e)}var r,n,i;if(t.prototype=qe,t.ROUND_UP=0,t.ROUND_DOWN=1,t.ROUND_CEIL=2,t.ROUND_FLOOR=3,t.ROUND_HALF_UP=4,t.ROUND_HALF_DOWN=5,t.ROUND_HALF_EVEN=6,t.ROUND_HALF_CEIL=7,t.ROUND_HALF_FLOOR=8,t.EUCLID=9,t.config=t.set=F,t.clone=$,t.abs=C,t.acos=z,t.acosh=k,t.add=I,t.asin=B,t.asinh=P,t.atan=R,t.atanh=U,t.atan2=q,t.cbrt=L,t.ceil=j,t.cos=D,t.cosh=H,t.div=G,t.exp=Z,t.floor=V,t.hypot=W,t.ln=Y,t.log=X,t.log10=Q,t.log2=J,t.max=K,t.min=ee,t.mod=te,t.mul=re,t.pow=ne,t.random=ie,t.round=ae,t.sign=oe,t.sin=se,t.sinh=ue,t.sqrt=ce,t.sub=fe,t.tan=le,t.tanh=pe,t.trunc=he,void 0===e&&(e={}),e)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(Oe);for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(u.push(i%1e7),a+=4);a=n/4}else for(;a=10;i/=10)n++;ne.e^u<0?1:-1;for(n=o.length,i=s.length,t=0,r=ns[t]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},qe.cosine=qe.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())+Be,n.rounding=1,r=c(n,T(n,r)),n.precision=e,n.rounding=t,f(2==de||3==de?r.neg():r,e,t,!0)):new n(1):new n(NaN)},qe.cubeRoot=qe.cbrt=function(){var e,t,r,n,i,o,s,u,c,l,p=this,h=p.constructor;if(!p.isFinite()||p.isZero())return new h(p);for(Ne=!1,o=p.s*Math.pow(p.s*p,1/3),o&&Math.abs(o)!=1/0?n=new h(o.toString()):(r=a(p.d),e=p.e,(o=(e-r.length+1)%3)&&(r+=1==o||o==-2?"0":"00"),o=Math.pow(r,1/3),e=Te((e+1)/3)-(e%3==(e<0?-1:2)),o==1/0?r="5e"+e:(r=o.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new h(r),n.s=p.s),s=(e=h.precision)+3;;)if(u=n,c=u.times(u).times(u),l=c.plus(p),n=Le(l.plus(p).times(u),l.plus(c),s+2,1),a(u.d).slice(0,s)===(r=a(n.d)).slice(0,s)){if(r=r.slice(s-3,s+1),"9999"!=r&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(f(n,e+1,1),t=!n.times(n).times(n).eq(p));break}if(!i&&(f(u,e+1,0),u.times(u).times(u).eq(p))){n=u;break}s+=4,i=1}return Ne=!0,f(n,e,h.rounding,t)},qe.decimalPlaces=qe.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Te(this.e/Be))*Be,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},qe.dividedBy=qe.div=function(e){return Le(this,new this.constructor(e))},qe.dividedToIntegerBy=qe.divToInt=function(e){var t=this,r=t.constructor;return f(Le(t,new r(e),0,1,1),r.precision,r.rounding)},qe.equals=qe.eq=function(e){return 0===this.cmp(e)},qe.floor=function(){return f(new this.constructor(this),this.e+1,3)},qe.greaterThan=qe.gt=function(e){return this.cmp(e)>0},qe.greaterThanOrEqualTo=qe.gte=function(e){var t=this.cmp(e);return 1==t||0===t},qe.hyperbolicCosine=qe.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,i=a.d.length,i<32?(e=Math.ceil(i/3),t=Math.pow(4,-e).toString()):(e=16,t="2.3283064365386962890625e-10"),a=O(o,1,a.times(t),new o(1),!0);for(var u,c=e,l=new o(8);c--;)u=a.times(a),a=s.minus(u.times(l.minus(u.times(l))));return f(a,o.precision=r,o.rounding=n,!0)},qe.hyperbolicSine=qe.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,n=i.d.length,n<3)i=O(a,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:0|e,i=i.times(Math.pow(5,-e)),i=O(a,2,i,i,!0);for(var o,s=new a(5),u=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(c))))}return a.precision=t,a.rounding=r,f(i,t,r,!0)},qe.hyperbolicTangent=qe.tanh=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+7,n.rounding=1,Le(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},qe.inverseCosine=qe.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return n!==-1?0===n?t.isNeg()?m(r,i,a):new r(0):new r(NaN):t.isZero()?m(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=m(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))},qe.inverseHyperbolicCosine=qe.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,Ne=!1,r=r.times(r).minus(1).sqrt().plus(r),Ne=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},qe.inverseHyperbolicSine=qe.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,Ne=!1,r=r.times(r).plus(1).sqrt().plus(r),Ne=!0,n.precision=e,n.rounding=t,r.ln())},qe.inverseHyperbolicTangent=qe.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?f(new a(i),e,t,!0):(a.precision=r=n-i.e,i=Le(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},qe.inverseSine=qe.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,t!==-1?0===t?(e=m(a,r+4,n).times(.5),e.s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},qe.inverseTangent=qe.atan=function(){var e,t,r,n,i,a,o,s,u,c=this,l=c.constructor,p=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&p+4<=Ue)return o=m(l,p+4,h).times(.25),o.s=c.s,o}else{if(!c.s)return new l(NaN);if(p+4<=Ue)return o=m(l,p+4,h).times(.5),o.s=c.s,o}for(l.precision=s=p+10,l.rounding=1,r=Math.min(28,s/Be+2|0),e=r;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Ne=!1,t=Math.ceil(s/Be),n=1,u=c.times(c),o=new l(c),i=c;e!==-1;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),o=a.plus(i.div(n+=2)),void 0!==o.d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2},qe.isNaN=function(){return!this.s},qe.isNegative=qe.isNeg=function(){return this.s<0},qe.isPositive=qe.isPos=function(){return this.s>0},qe.isZero=function(){return!!this.d&&0===this.d[0]},qe.lessThan=qe.lt=function(e){return this.cmp(e)<0},qe.lessThanOrEqualTo=qe.lte=function(e){return this.cmp(e)<1},qe.logarithm=qe.log=function(e){var t,r,n,i,o,u,c,l,p=this,m=p.constructor,d=m.precision,v=m.rounding,g=5;if(null==e)e=new m(10),t=!0;else{if(e=new m(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new m(NaN);t=e.eq(10)}if(r=p.d,p.s<0||!r||!r[0]||p.eq(1))return new m(r&&!r[0]?-1/0:1!=p.s?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10===0;)i/=10;o=1!==i}if(Ne=!1,c=d+g,u=b(p,c),n=t?h(m,c+10):b(e,c),l=Le(u,n,c,1),s(l.d,i=d,v))do if(c+=10,u=b(p,c),n=t?h(m,c+10):b(e,c),l=Le(u,n,c,1),!o){+a(l.d).slice(i+1,i+15)+1==1e14&&(l=f(l,d+1,0));break}while(s(l.d,i+=10,v));return Ne=!0,f(l,d,v)},qe.minus=qe.sub=function(e){var t,r,n,i,a,o,s,u,c,l,h,m,d=this,v=d.constructor;if(e=new v(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new v(e.d||d.s!==e.s?d:NaN):e=new v(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(c=d.d,m=e.d,s=v.precision,u=v.rounding,!c[0]||!m[0]){if(m[0])e.s=-e.s;else{if(!c[0])return new v(3===u?-0:0);e=new v(d)}return Ne?f(e,s,u):e}if(r=Te(e.e/Be),l=Te(d.e/Be),c=c.slice(),a=l-r){for(h=a<0,h?(t=c,a=-a,o=m.length):(t=m,r=l,o=c.length),n=Math.max(Math.ceil(s/Be),o)+2,a>n&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for(n=c.length,o=m.length,h=n0;--n)c[o++]=0;for(n=m.length;n>a;){if(c[--n]o?a+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=c.length,i=l.length,o-i<0&&(i=o,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/Ie|0,c[i]%=Ie;for(t&&(c.unshift(t),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=p(c,n),Ne?f(e,s,u):e},qe.precision=qe.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Me+e);return r.d?(t=d(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},qe.round=function(){var e=this,t=e.constructor;return f(new t(e),e.e+1,t.rounding)},qe.sine=qe.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())+Be,n.rounding=1,r=A(n,T(n,r)),n.precision=e,n.rounding=t,f(de>2?r.neg():r,e,t,!0)):new n(NaN)},qe.squareRoot=qe.sqrt=function(){var e,t,r,n,i,o,s=this,u=s.d,c=s.e,l=s.s,p=s.constructor;if(1!==l||!u||!u[0])return new p(!l||l<0&&(!u||u[0])?NaN:u?s:1/0);for(Ne=!1,l=Math.sqrt(+s),0==l||l==1/0?(t=a(u),(t.length+c)%2==0&&(t+="0"),l=Math.sqrt(t),c=Te((c+1)/2)-(c<0||c%2),l==1/0?t="1e"+c:(t=l.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new p(t)):n=new p(l.toString()),r=(c=p.precision)+3;;)if(o=n,n=o.plus(Le(s,o,r+2,1)).times(.5),a(o.d).slice(0,r)===(t=a(n.d)).slice(0,r)){if(t=t.slice(r-3,r+1),"9999"!=t&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(f(n,c+1,1),e=!n.times(n).eq(s));break}if(!i&&(f(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}return Ne=!0,f(n,c,p.rounding,e)},qe.tangent=qe.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(),r.s=1,r=Le(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,f(2==de||4==de?r.neg():r,e,t,!0)):new n(NaN)},qe.times=qe.mul=function(e){var t,r,n,i,a,o,s,u,c,l=this,h=l.constructor,m=l.d,d=(e=new h(e)).d;if(e.s*=l.s,!(m&&m[0]&&d&&d[0]))return new h(!e.s||m&&!m[0]&&!d||d&&!d[0]&&!m?NaN:m&&d?0*e.s:e.s/0);for(r=Te(l.e/Be)+Te(e.e/Be),u=m.length,c=d.length,u=0;){for(t=0,i=u+n;i>n;)s=a[i]+d[n]*m[i-n-1]+t,a[i--]=s%Ie|0,t=s/Ie|0;a[i]=(a[i]+t)%Ie|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=p(a,r),Ne?f(e,h.precision,h.rounding):e},qe.toBinary=function(e,t){return _(this,2,e,t)},qe.toDecimalPlaces=qe.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(o(e,0,ge),void 0===t?t=n.rounding:o(t,0,8),f(r,e+r.e+1,t))},qe.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=l(n,!0):(o(e,0,ge),void 0===t?t=i.rounding:o(t,0,8),n=f(new i(n),e+1,t),r=l(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},qe.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=l(i):(o(e,0,ge),void 0===t?t=a.rounding:o(t,0,8),n=f(new a(i),e+i.e+1,t),r=l(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},qe.toFraction=function(e){var t,r,n,i,o,s,u,c,f,l,p,h,m=this,v=m.d,g=m.constructor;if(!v)return new g(m);if(f=r=new g(1),n=c=new g(0),t=new g(n),o=t.e=d(v)-m.e-1,s=o%Be,t.d[0]=_e(10,s<0?Be+s:s),null==e)e=o>0?t:f;else{if(u=new g(e),!u.isInt()||u.lt(f))throw Error(Me+u);e=u.gt(t)?o>0?t:f:u}for(Ne=!1,u=new g(a(v)),l=g.precision,g.precision=o=v.length*Be*2;p=Le(u,t,0,1,1),i=r.plus(p.times(n)),1!=i.cmp(e);)r=n,n=i,i=f,f=c.plus(p.times(i)),c=i,i=t,t=u.minus(p.times(i)),u=i;return i=Le(e.minus(r),n,0,1,1),c=c.plus(i.times(f)),r=r.plus(i.times(n)),c.s=f.s=m.s,h=Le(f,n,o,1).minus(m).abs().cmp(Le(c,r,o,1).minus(m).abs())<1?[f,n]:[c,r],g.precision=l,Ne=!0,h},qe.toHexadecimal=qe.toHex=function(e,t){return _(this,16,e,t)},qe.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&&o(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]?(Ne=!1,t<4&&(t=[4,5,7,8][t]),r=Le(r,e,0,t,1).times(e),Ne=!0,f(r)):(e.s=r.s,r=e),r},qe.toNumber=function(){return+this},qe.toOctal=function(e,t){return _(this,8,e,t)},qe.toPower=qe.pow=function(e){var t,r,n,i,o,u,c=this,l=c.constructor,p=+(e=new l(e));if(!(c.d&&e.d&&c.d[0]&&e.d[0]))return new l(_e(+c,p));if(c=new l(c),c.eq(1))return c;if(n=l.precision,o=l.rounding,e.eq(1))return f(c,n,o);if(t=Te(e.e/Be),t>=e.d.length-1&&(r=p<0?-p:p)<=Pe)return i=g(l,c,r,n),e.s<0?new l(1).div(i):f(i,n,o);if(u=c.s,u<0){if(tl.maxE+1||t0?u/0:0):(Ne=!1,l.rounding=c.s=1,r=Math.min(12,(t+"").length),i=w(e.times(b(c,n+r)),n),i.d&&(i=f(i,n+5,1),s(i.d,n,o)&&(t=n+10,i=f(w(e.times(b(c,t+r)),t),t+5,1),+a(i.d).slice(n+1,n+15)+1==1e14&&(i=f(i,n+1,0)))),i.s=u,Ne=!0,l.rounding=o,f(i,n,o))},qe.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=l(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(o(e,1,ge),void 0===t?t=i.rounding:o(t,0,8),n=f(new i(n),e,t),r=l(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},qe.toSignificantDigits=qe.toSD=function(e,t){var r=this,n=r.constructor;return void 0===e?(e=n.precision,t=n.rounding):(o(e,1,ge),void 0===t?t=n.rounding:o(t,0,8)),f(new n(r),e,t)},qe.toString=function(){var e=this,t=e.constructor,r=l(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},qe.truncated=qe.trunc=function(){return f(new this.constructor(this),this.e+1,1)},qe.valueOf=qe.toJSON=function(){var e=this,t=e.constructor,r=l(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var Le=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;)e.shift()}return function(n,i,a,o,s,u){var c,l,p,h,m,d,v,g,y,x,w,b,N,E,M,A,O,T,_,S,C=n.constructor,z=n.s==i.s?1:-1,k=n.d,I=i.d;if(!(k&&k[0]&&I&&I[0]))return new C(n.s&&i.s&&(k?!I||k[0]!=I[0]:I)?k&&0==k[0]||!I?0*z:z/0:NaN);for(u?(m=1,l=n.e-i.e):(u=Ie,m=Be,l=Te(n.e/m)-Te(i.e/m)),_=I.length,O=k.length,y=new C(z),x=y.d=[],p=0;I[p]==(k[p]||0);p++);if(I[p]>(k[p]||0)&&l--,null==a?(E=a=C.precision,o=C.rounding):E=s?a+(n.e-i.e)+1:a,E<0)x.push(1),d=!0;else{if(E=E/m+2|0,p=0,1==_){for(h=0,I=I[0],E++;(p1&&(I=e(I,h,u),k=e(k,h,u),_=I.length,O=k.length),A=_,w=k.slice(0,_),b=w.length;b<_;)w[b++]=0;S=I.slice(),S.unshift(0),T=I[0],I[1]>=u/2&&++T;do h=0,c=t(I,w,_,b),c<0?(N=w[0],_!=b&&(N=N*u+(w[1]||0)),h=N/T|0,h>1?(h>=u&&(h=u-1),v=e(I,h,u),g=v.length,b=w.length,c=t(v,w,g,b),1==c&&(h--,r(v,_=10;h/=10)p++;y.e=p+l*m-1,f(y,s?a+y.e+1:a,o,d)}return y}}();be=$(be),xe=new be(xe),we=new be(we),n=function(){return be}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))}(this)},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("bignumber",{"":function(){return new e.BigNumber(0)},number:function(t){return new e.BigNumber(t+"")},string:function(t){return new e.BigNumber(t)},BigNumber:function(e){return e},Fraction:function(t){return new e.BigNumber(t.n).div(t.d)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={0:"0",1:"\\left(${args[0]}\\right)"},a}var i=r(1);t.name="bignumber",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("bool",{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var r=Number(e);if(""!=e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(1);t.name="boolean",t.factory=n},function(e,t,r){e.exports=[r(162),r(164)]},function(e,t,r){"use strict";function n(e,t,r,n,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");e&&e.isChain?this.value=e.value:this.value=e}function u(e,t){"function"==typeof t&&(s.prototype[e]=f(t))}function c(e,t){a(s.prototype,e,function(){var e=t();if("function"==typeof e)return f(e)})}function f(e){return function(){for(var t=[this.value],r=0;r0&&l();break;case"number":s.im=0,s.re=e;break;default:l()}isNaN(s.re)||isNaN(s.im)};o.prototype={re:0,im:0,sign:function(){var e=this.abs();return new o(this.re/e,this.im/e)},add:function(e,t){return p(e,t),new o(this.re+s.re,this.im+s.im)},sub:function(e,t){return p(e,t),new o(this.re-s.re,this.im-s.im)},mul:function(e,t){return p(e,t),0===s.im&&0===this.im?new o(this.re*s.re,0):new o(this.re*s.re-this.im*s.im,this.re*s.im+this.im*s.re)},div:function(e,t){p(e,t),e=this.re,t=this.im;var r,n,i=s.re,a=s.im;return 0===a?0===i?new o(0!==e?e/0:0,0!==t?t/0:0):new o(e/i,t/i):Math.abs(i)=0)return new o(Math.pow(e,s.re),0);if(0===e)switch((s.re%4+4)%4){case 0:return new o(Math.pow(t,s.re),0);case 1:return new o(0,Math.pow(t,s.re));case 2:return new o(-Math.pow(t,s.re),0);case 3:return new o(0,-Math.pow(t,s.re))}}var r=Math.atan2(t,e),n=a(e,t);return e=Math.exp(s.re*n-s.im*r),t=s.im*n+s.re*r,new o(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();if(r>=0){if(0===n)return new o(Math.sqrt(r),0);e=.5*Math.sqrt(2*(i+r))}else e=Math.abs(n)/Math.sqrt(2*(i-r));return t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new o(e,n<0?-t:t)},exp:function(){var e=Math.exp(this.re);return 0===this.im,new o(e*Math.cos(this.im),e*Math.sin(this.im))},log:function(){var e=this.re,t=this.im;return new o(a(e,t),Math.atan2(t,e))},abs:function(){return f(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,t=this.im;return new o(Math.sin(e)*u(t),Math.cos(e)*c(t))},cos:function(){var e=this.re,t=this.im;return new o(Math.cos(e)*u(t),-Math.sin(e)*c(t))},tan:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)+u(t);return new o(Math.sin(e)/r,c(t)/r)},cot:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)-u(t);return new o(-Math.sin(e)/r,c(t)/r)},sec:function(){var e=this.re,t=this.im,r=.5*u(2*t)+.5*Math.cos(2*e);return new o(Math.cos(e)*u(t)/r,Math.sin(e)*c(t)/r)},csc:function(){var e=this.re,t=this.im,r=.5*u(2*t)-.5*Math.cos(2*e);return new o(Math.sin(e)*u(t)/r,-Math.cos(e)*c(t)/r)},asin:function(){var e=this.re,t=this.im,r=new o(t*t-e*e+1,-2*e*t).sqrt(),n=new o(r.re-t,r.im+e).log();return new o(n.im,-n.re)},acos:function(){var e=this.re,t=this.im,r=new o(t*t-e*e+1,-2*e*t).sqrt(),n=new o(r.re-t,r.im+e).log();return new o(Math.PI/2-n.im,n.re)},atan:function(){var e=this.re,t=this.im;if(0===e){if(1===t)return new o(0,1/0);if(t===-1)return new o(0,-(1/0))}var r=e*e+(1-t)*(1-t),n=new o((1-t*t-e*e)/r,-2*e/r).log();return new o(-.5*n.im,.5*n.re)},acot:function(){var e=this.re,t=this.im;if(0===t)return new o(Math.atan2(1,e),0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).atan():new o(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(0,1/0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).acos():new o(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(Math.PI/2,1/0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).asin():new o(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){var e=this.re,t=this.im;return new o(c(e)*Math.cos(t),u(e)*Math.sin(t))},cosh:function(){var e=this.re,t=this.im;return new o(u(e)*Math.cos(t),c(e)*Math.sin(t))},tanh:function(){var e=2*this.re,t=2*this.im,r=u(e)+Math.cos(t);return new o(c(e)/r,Math.sin(t)/r)},coth:function(){var e=2*this.re,t=2*this.im,r=u(e)-Math.cos(t);return new o(c(e)/r,-Math.sin(t)/r)},csch:function(){var e=this.re,t=this.im,r=Math.cos(2*t)-u(2*e);return new o(-2*c(e)*Math.cos(t)/r,2*u(e)*Math.sin(t)/r)},sech:function(){var e=this.re,t=this.im,r=Math.cos(2*t)+u(2*e);return new o(2*u(e)*Math.cos(t)/r,-2*c(e)*Math.sin(t)/r)},asinh:function(){var e=this.im;this.im=-this.re,this.re=e;var t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){var e,t=this.acos();return t.im<=0?(e=t.re,t.re=-t.im,t.im=e):(e=t.im,t.im=-t.re,t.re=e),t},atanh:function(){var e=this.re,t=this.im,r=e>1&&0===t,n=1-e,i=1+e,s=n*n+t*t,u=0!==s?new o((i*n-t*t)/s,(t*n+i*t)/s):new o(e!==-1?e/0:0,0!==t?t/0:0),c=u.re;return u.re=a(u.re,u.im)/2,u.im=Math.atan2(u.im,c)/2,r&&(u.im=-u.im),u},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(0,Math.PI/2);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).atanh():new o(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new o(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).asinh():new o(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(1/0,0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).acosh():new o(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){var e=this.re,t=this.im,r=e*e+t*t;return new o(0!==e?e/r:0,0!==t?-t/r:0)},conjugate:function(){return new o(this.re,-this.im)},neg:function(){return new o(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new o(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new o(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new o(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){return p(e,t),Math.abs(s.re-this.re)<=o.EPSILON&&Math.abs(s.im-this.im)<=o.EPSILON},clone:function(){return new o(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return isNaN(e)||isNaN(t)?"NaN":(0!==e&&(r+=e),0!==t&&(0!==e?r+=t<0?" - ":" + ":t<0&&(r+="-"),t=Math.abs(t),1!==t&&(r+=t),r+="i"),r?r:"0")},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)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)}},o.ZERO=new o(0,0),o.ONE=new o(1,0),o.I=new o(0,1),o.PI=new o(Math.PI,0),o.E=new o(Math.E,0),o.EPSILON=1e-16,n=[],i=function(){return o}.apply(t,n),!(void 0!==i&&(e.exports=i))}(this)},function(e,t,r){"use strict";function n(e,t,n,a){var o=r(4),s=a("complex",{"":function(){return e.Complex.ZERO},number:function(t){return new e.Complex(t,0)},"number, number":function(t,r){return new e.Complex(t,r)},"BigNumber, BigNumber":function(t,r){return new e.Complex(t.toNumber(),r.toNumber())},Complex:function(e){return e.clone()},string:function(t){return e.Complex(t)},Object:function(t){if("re"in t&&"im"in t)return new e.Complex(t.re,t.im);if("r"in t&&"phi"in t)return new e.Complex(t);throw new Error("Expected object with either properties re and im, or properties r and phi.")},"Array | Matrix":function(e){return i(e,s)}});return s.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+"+o.symbols.i+"\\cdot\\left(${args[1]}\\right)\\right)"},s}var i=r(1);t.name="complex",t.factory=n},function(e,t,r){e.exports=[r(169),r(90)]},function(e,t,r){function n(e,t,r,n){return i}var i=r(170);i.prototype.type="Fraction",i.prototype.isFraction=!0,i.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},i.fromJSON=function(e){return new i(e)},t.name="Fraction",t.path="type",t.factory=n},function(e,t,r){var n,i;/** + * @license Fraction.js v4.0.2 09/09/2015 + * http://www.xarg.org/2014/03/rational-numbers-in-javascript/ + * + * Copyright (c) 2015, Robert Eisele (robert@xarg.org) + * Dual licensed under the MIT or GPL Version 2 licenses. + **/ +!function(r){"use strict";function a(e){var t=function(){var t=Error.apply(this,arguments);t.name=this.name=e,this.stack=t.stack,this.message=t.message},r=function(){};return r.prototype=Error.prototype,t.prototype=new r,t}function o(e,t){return isNaN(e=parseInt(e,10))&&s(),e*t}function s(){throw new p}function u(e,t){return this instanceof u?(h(e,t),e=u.REDUCE?g(f.d,f.n):1,this.s=f.s,this.n=f.n/e,void(this.d=f.d/e)):new u(e,t)}var c=2e3,f={s:1,n:0,d:1},l=u.DivisionByZero=a("DivisionByZero"),p=u.InvalidParameter=a("InvalidParameter"),h=function(e,t){var r,n=0,i=1,a=1,u=0,c=0,p=0,h=1,m=1,d=0,v=1,g=1,y=1,x=1e7;if(void 0===e||null===e);else if(void 0!==t)n=e,i=t,a=n*i;else switch(typeof e){case"object":"d"in e&&"n"in e?(n=e.n,i=e.d,"s"in e&&(n*=e.s)):0 in e?(n=e[0],1 in e&&(i=e[1])):s(),a=n*i;break;case"number":if(e<0&&(a=e,e=-e),e%1===0)n=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);v<=x&&y<=x;){if(r=(d+g)/(v+y),e===r){v+y<=x?(n=d+g,i=v+y):y>v?(n=g,i=y):(n=d,i=v);break}e>r?(d+=g,v+=y):(g+=d,y+=v),v>x?(n=g,i=y):(n=d,i=v)}n*=m}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(v=e.match(/\d+|./g),"-"===v[d]?(a=-1,d++):"+"===v[d]&&d++,v.length===d+1?c=o(v[d++],a):"."===v[d+1]||"."===v[d]?("."!==v[d]&&(u=o(v[d++],a)),d++,(d+1===v.length||"("===v[d+1]&&")"===v[d+3]||"'"===v[d+1]&&"'"===v[d+3])&&(c=o(v[d],a),h=Math.pow(10,v[d].length),d++),("("===v[d]&&")"===v[d+2]||"'"===v[d]&&"'"===v[d+2])&&(p=o(v[d+1],a),m=Math.pow(10,v[d+1].length)-1,d+=3)):"/"===v[d+1]||":"===v[d+1]?(c=o(v[d],a),h=o(v[d+2],1),d+=3):"/"===v[d+3]&&" "===v[d+1]&&(u=o(v[d],a),c=o(v[d+2],a),h=o(v[d+4],1),d+=5),v.length<=d){i=h*m,a=n=p+i*u+m*c;break}default:s()}if(0===i)throw new l;f.s=a<0?-1:1,f.n=Math.abs(n),f.d=Math.abs(i)},m=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n},d=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>c)return 0;return n},v=function(e,t,r){for(var n=1,i=m(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0},g=function(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}};u.REDUCE=1,u.prototype={s:1,n:0,d:1,abs:function(){return new u(this.n,this.d)},neg:function(){return new u(-this.s*this.n,this.d)},add:function(e,t){return h(e,t),new u(this.s*this.n*f.d+f.s*this.d*f.n,this.d*f.d)},sub:function(e,t){return h(e,t),new u(this.s*this.n*f.d-f.s*this.d*f.n,this.d*f.d)},mul:function(e,t){return h(e,t),new u(this.s*f.s*this.n*f.n,this.d*f.d)},div:function(e,t){return h(e,t),new u(this.s*f.s*this.n*f.d,this.d*f.n)},clone:function(){return new u(this)},mod:function(e,t){return isNaN(this.n)||isNaN(this.d)?new u(NaN):void 0===e?new u(this.s*this.n%this.d,1):(h(e,t),0===f.n&&0===this.d&&u(0,0),new u(this.s*f.d*this.n%(f.n*this.d),f.d*this.d))},gcd:function(e,t){return h(e,t),new u(g(f.n,this.n),f.d*this.d/g(f.d,this.d))},lcm:function(e,t){return h(e,t),0===f.n&&0===this.n?new u:new u(f.n*this.n/g(f.n,this.n),g(f.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return new u(this.s*this.d,this.n)},pow:function(e){return e<0?new u(Math.pow(this.s*this.d,-e),Math.pow(this.n,-e)):new u(Math.pow(this.s*this.n,e),Math.pow(this.d,e))},equals:function(e,t){return h(e,t),this.s*this.n*f.d===f.s*f.n*this.d},compare:function(e,t){h(e,t);var r=this.s*this.n*f.d-f.s*f.n*this.d;return(00&&(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=[];do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t);return n},toString:function(){var e,t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";u.REDUCE||(e=g(t,r),t/=e,r/=e);var n=15,i=d(t,r),a=v(t,r,i),o=this.s===-1?"-":"";if(o+=t/r|0,t%=r,t*=10,t&&(o+="."),i){for(var s=a;s--;)o+=t/r|0,t%=r,t*=10;o+="(";for(var s=i;s--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(var s=n;t&&s--;)o+=t/r|0,t%=r,t*=10;return o}},n=[],i=function(){return u}.apply(t,n),!(void 0!==i&&(e.exports=i))}(this)},function(e,t,r){e.exports=[r(70),r(43),r(173),r(174),r(175),r(176),r(27),r(91),r(177),r(0),r(178)]},function(e,t,r){"use strict";t.isBoolean=function(e){return"boolean"==typeof e}},function(e,t,r){"use strict";function n(e,t,n,d){function v(e,t){if(!(this instanceof v))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!h(t))throw new Error("Invalid datatype: "+t);if(e&&e.isMatrix===!0)x(this,e,t);else if(e&&f(e.index)&&f(e.ptr)&&f(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(f(e))w(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+i.types.type(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}var g=n(r(70)),y=n(r(11)),x=function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?s.clone(t._values):void 0,e._index=s.clone(t._index),e._ptr=s.clone(t._ptr),e._size=s.clone(t._size),e._datatype=r||t._datatype):w(e,t.valueOf(),r||t._datatype)},w=function(e,t,r){e._values=[],e._index=[],e._ptr=[],e._datatype=r;var n=t.length,i=0,a=y,o=0;if(h(r)&&(a=d.find(y,[r,r])||y,o=d.convert(0,r)),n>0){var s=0;do{e._ptr.push(e._index.length);for(var u=0;u");for(var p=t.min()[0],h=t.min()[1],m=i[0],d=i[1],v=0;vo-1||i>s-1)&&(O(this,Math.max(n+1,o),Math.max(i+1,s),r),o=this._size[0],s=this._size[1]),m(n,o),m(i,s);var l=E(n,this._ptr[i],this._ptr[i+1],this._index);return lp){for(u=p;ul){if(f){var m=0;for(u=0;ut-1&&(e._values.splice(c,1),e._index.splice(c,1),g++)}e._ptr[u]=e._values.length}return e._size[0]=t,e._size[1]=r,e};v.prototype.reshape=function(e,t){if(!f(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");if(e.forEach(function(t){if(!c.isNumber(t)||!c.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+u.format(e)+")")}),this._size[0]*this._size[1]!==e[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;for(var n=[],i=0;i=t&&N<=r){if(!o)for(var E=w;E "+(this._values?u.format(this._values[c],e):"X")}return i},v.prototype.toString=function(){return u.format(this.toArray())},v.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},v.prototype.diagonal=function(e){if(e){if(e.isBigNumber===!0&&(e=e.toNumber()),!l(e)||!p(e))throw new 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],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=[],u=[];u[0]=0;for(var c=t;c0?r:0,c=r<0?-r:0,m=e[0],g=e[1],x=Math.min(m-c,g-u);if(f(t)){if(t.length!==x)throw new Error("Invalid value array length");s=function(e){return t[e]}}else if(t&&t.isMatrix===!0){var w=t.size();if(1!==w.length||w[0]!==x)throw new Error("Invalid matrix length");s=function(e){return t.get([e])}}else s=function(){return t};for(var b=[],N=[],E=[],M=0;M=0&&A=u||i[f]!==t)){var p=n?n[c]:void 0;i.splice(f,0,t),n&&n.splice(f,0,p),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1)}else if(f=u||i[c]!==e)){var h=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,h),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},e.Matrix._storage.sparse=v,v}var i=r(25),a=r(10),o=i.array,s=i.object,u=i.string,c=i.number,f=Array.isArray,l=c.isNumber,p=c.isInteger,h=u.isString,m=o.validateIndex;t.name="SparseMatrix",t.path="type",t.factory=n,t.lazy=!1},function(e,t,r){"use strict";function n(e,t,n){function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new e.FibonacciHeap}var a=n(r(18)),o=n(r(11));return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{var r=this._heap.insert(e,t);this._values[e]=r}},i.prototype.get=function(e){var t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,t){var r=this._values[e];r?r.value=a(r.value,t):(r=this._heap.insert(e,t),this._values[e]=r)},i.prototype.forEach=function(e,t,r){var n=this._heap,i=this._values,a=[],s=n.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(o(s.value,0)||r(s.key,s.value,this)),s=n.extractMinimum(),s&&a.push(s);for(var u=0;u0;){var i=n.right;n.left.right=n.right,n.right.left=n.left,n.left=t,n.right=t.right,t.right=n,n.right.left=n,n.parent=null,n=i,r--}return e.left.right=e.right,e.right.left=e.left,e==e.right?t=null:(t=e.right,t=h(t,this._size)),this._size--,this._minimum=t,e},a.prototype.remove=function(e){this._minimum=c(this._minimum,e,-1),this.extractMinimum()};var c=function(e,t,r){t.key=r;var n=t.parent;return n&&o(t.key,n.key)&&(f(e,t,n),l(e,n)),o(t.key,e.key)&&(e=t),e},f=function(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child==t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1},l=function(e,t){var r=t.parent;r&&(t.mark?(f(e,t,r),l(r)):t.mark=!0)},p=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1},h=function(e,t){var r=Math.floor(Math.log(t)*u)+1,n=new Array(r),i=0,a=e;if(a)for(i++,a=a.right;a!==e;)i++,a=a.right;for(var c;i>0;){for(var f=a.degree,l=a.right;;){if(c=n[f],!c)break;if(s(a.key,c.key)){var h=c;c=a,a=h}p(c,a),n[f]=null,f++}n[f]=a,a=l,i--}e=null;for(var m=0;m="0"&&e<="9"||"."==e}function p(e){return e>="0"&&e<="9"}function h(){R++,U=P.charAt(R)}function m(e){R=e,U=P.charAt(R)}function d(){var e,t="";if(e=R,"+"==U?h():"-"==U&&(t+=U,h()),!l(U))return m(e),null;if("."==U){if(t+=U,h(),!p(U))return m(e),null}else{for(;p(U);)t+=U,h();"."==U&&(t+=U,h())}for(;p(U);)t+=U,h();if("E"==U||"e"==U){var r="",n=R;if(r+=U,h(),"+"!=U&&"-"!=U||(r+=U,h()),!p(U))return m(n),t;for(t+=r;p(U);)t+=U,h()}return t}function v(){for(var e="",t=P.charCodeAt(R);t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122;)e+=U,h(),t=P.charCodeAt(R);return t=e.charCodeAt(0),t>=65&&t<=90||t>=97&&t<=122?e||null:null}function g(e){return U===e?(h(),e):null}function y(e){if(G.hasOwnProperty(e)){var t=G[e],r=t.prefixes[""];return{unit:t,prefix:r}}for(var n in G)if(G.hasOwnProperty(n)&&i(e,n)){var t=G[n],a=e.length-n.length,o=e.substring(0,a),r=t.prefixes.hasOwnProperty(o)?t.prefixes[o]:void 0;if(void 0!==r)return{unit:t,prefix:r}}return null}function x(t){if("BigNumber"===t.number){var r=o.pi(e.BigNumber);G.rad.value=new e.BigNumber(1),G.deg.value=r.div(180),G.grad.value=r.div(200),G.cycle.value=r.times(2),G.arcsec.value=r.div(648e3),G.arcmin.value=r.div(10800)}else G.rad.value=1,G.deg.value=Math.PI/180,G.grad.value=Math.PI/200,G.cycle.value=2*Math.PI,G.arcsec.value=Math.PI/648e3,G.arcmin.value=Math.PI/10800}function w(e){for(var t=0;t="0"&&e<="9"};if(0===t&&!n(r))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!n(r)&&!i(r))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}var b=n(r(20)),N=n(r(21)),E=n(r(23)),M=n(r(19)),A=n(r(45)),O=n(r(29)),T=n(r(94)),_=n(r(95)),S=n(r(30)),C=n(r(73)),z=n(r(96)),k=n(r(74)),I=n(r(72)),B=n(r(89));c.prototype.type="Unit",c.prototype.isUnit=!0;var P,R,U;c.parse=function(r,n){if(n=n||{},P=r,R=-1,U="","string"!=typeof P)throw new TypeError("Invalid argument in Unit.parse, string expected");var i=new c;i.units=[],h(),f();var a=d(),o=null;a&&(o="BigNumber"===t.number?new e.BigNumber(a):"Fraction"===t.number?new e.Fraction(a):parseFloat(a)),f();for(var s=1,u=!1,l=[],p=1;;){for(f();"("===U;)l.push(s),p*=s,s=1,h(),f();if(!U)break;var m=U,x=v();if(null==x)throw new SyntaxError('Unexpected "'+m+'" in "'+P+'" at index '+R.toString());var w=y(x);if(null==w)throw new SyntaxError('Unit "'+x+'" not found.');var b=s*p;if(f(),g("^")){f();var N=d();if(null==N)throw new SyntaxError('In "'+r+'", "^" must be followed by a floating-point number');b*=N}i.units.push({unit:w.unit,prefix:w.prefix,power:b});for(var E=0;E1||Math.abs(this.units[0].power-1)>1e-15)},c.prototype._normalize=function(e){var t,r,n,i,a;if(null==e||0===this.units.length)return e;if(this._isDerived()){var o=e;a=c._getNumberConverter(k(e));for(var s=0;s1e-12)return!1;return!0},c.prototype.equalBase=function(e){for(var t=0;t1e-12)return!1;return!0},c.prototype.equals=function(e){return this.equalBase(e)&&S(this.value,e.value)},c.prototype.multiply=function(e){for(var t=this.clone(),r=0;r1e-12&&(W.hasOwnProperty(o)?t.push({unit:W[o].unit,prefix:W[o].prefix,power:this.dimensions[a]||0}):i=!0)}t.length1e-12){if(!V.si.hasOwnProperty(n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:V.si[n].unit,prefix:V.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.isUnitListSimplified=!0,e},c.prototype.formatUnits=function(){this.simplifyUnitListLazy();for(var e="",t="",r=0,n=0,i=0;i0?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var i=0;i0?(t+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power+1)>1e-15&&(t+="^"+-this.units[i].power)):(t+=" "+this.units[i].prefix.name+this.units[i].unit.name,t+="^"+this.units[i].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");var a=e;return r>0&&n>0&&(a+=" / "),a+=t},c.prototype.format=function(e){this.simplifyUnitListLazy();var t=!1,r=!0;"undefined"!=typeof this.value&&null!==this.value&&this.value.isComplex&&(t=Math.abs(this.value.re)<1e-14,r=Math.abs(this.value.im)<1e-14);for(var n in this.units)this.units[n].unit&&("VA"===this.units[n].unit.name&&t?this.units[n].unit=G.VAR:"VAR"!==this.units[n].unit.name||t||(this.units[n].unit=G.VA));1!==this.units.length||this.fixPrefix||Math.abs(this.units[0].power-Math.round(this.units[0].power))<1e-14&&(this.units[0].prefix=this._bestPrefix());var i=this._denormalize(this.value),a=null!==this.value?z(i,e||{}):"",o=this.formatUnits();return this.value&&this.value.isComplex&&(a="("+a+")"),o.length>0&&a.length>0&&(a+=" "),a+=o},c.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var e=O(this.value),t=O(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power,i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(a.hasOwnProperty(o)){var s=a[o];if(s.scientific){var u=Math.abs(Math.log(e/Math.pow(s.value*t,n))/Math.LN10-1.2);(u1e-12){p=!1;break}if(p){l=!0;break}}if(!l){var m=e+"_STUFF",d={dimensions:a.dimensions.slice(0)};d.key=m,D[m]=d,W[m]={unit:f,prefix:L.NONE[""]},f.base=m}}else{var m=e+"_STUFF";if(F.indexOf(m)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');F.push(m);for(var v in D)D.hasOwnProperty(v)&&(D[v].dimensions[F.length-1]=0);for(var d={dimensions:[]},u=0;u1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]}},function(e,t){e.exports={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","multiply"]}},function(e,t){e.exports={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]}},function(e,t){e.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]}},function(e,t){e.exports={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]}},function(e,t){e.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]}},function(e,t){e.exports={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}},function(e,t){e.exports={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t){e.exports={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t){e.exports={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e,t){e.exports={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]}},function(e,t){e.exports={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]}},function(e,t){e.exports={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]}},function(e,t){e.exports={name:"rightLogShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]}},function(e,t){e.exports={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]}},function(e,t){e.exports={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]}},function(e,t){e.exports={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]}},function(e,t){e.exports={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]}},function(e,t){e.exports={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]}},function(e,t){e.exports={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]}},function(e,t){e.exports={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number, number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]}},function(e,t){e.exports={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]}},function(e,t){e.exports={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]}},function(e,t){e.exports={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]}},function(e,t){e.exports={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]}},function(e,t){e.exports={name:"eval",category:"Expression",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]}},function(e,t){e.exports={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]}},function(e,t){e.exports={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]}},function(e,t){e.exports={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]}},function(e,t){e.exports={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]}},function(e,t){e.exports={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]}},function(e,t){e.exports={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]}},function(e,t){e.exports={name:"xor",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 or 4"],seealso:["not","and","or"]}},function(e,t){e.exports={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]}},function(e,t){e.exports={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","eye","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"dot",category:"Matrix",syntax:["dot(A, B)"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]}},function(e,t){e.exports={name:"eye",category:"Matrix",syntax:["eye(n)","eye(m, n)","eye([m, n])","eye"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["eye(3)","eye(3, 5)","a = [1, 2, 3; 4, 5, 6]","eye(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]}},function(e,t){e.exports={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.", +examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]}},function(e,t){e.exports={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]}},function(e,t){e.exports={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","eye","ones","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"kron",category:"Matrix",syntax:["math.kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]}},function(e,t){e.exports={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], function(val) { return value * value })"],seealso:["filter","forEach"]}},function(e,t){e.exports={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])","ones"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","eye","inv","range","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1)'],seealso:["sort"]}},function(e,t){e.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","eye","inv","ones","size","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]}},function(e,t){e.exports={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])"],seealso:["size","squeeze","resize"]}},function(e,t){e.exports={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","eye","inv","ones","range","squeeze","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]}},function(e,t){e.exports={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","eye","inv","ones","range","size","subset","trace","transpose","zeros"]}},function(e,t){e.exports={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","trace","transpose","zeros"]}},function(e,t){e.exports={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e,t){e.exports={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","trace","zeros"]}},function(e,t){e.exports={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])","zeros"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","trace","transpose"]}},function(e,t){e.exports={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["permutations","factorial"]}},function(e,t){e.exports={name:"factorial",category:"Probability",syntax:["kldivergence(x, y)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","permutations","gamma"]}},function(e,t){e.exports={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]}},function(e,t){e.exports={name:"kldivergence",category:"Probability",syntax:["n!","factorial(n)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]}},function(e,t){e.exports={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]}},function(e,t){e.exports={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","factorial"]}},function(e,t){e.exports={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]}},function(e,t){e.exports={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]}},function(e,t){e.exports={name:"randInt",category:"Probability",syntax:["randInt(max)","randInt(min, max)","randInt(size)","randInt(size, max)","randInt(size, min, max)"],description:"Return a random integer number",examples:["randInt(10, 20)","randInt([2, 3], 10)"],seealso:["pickRandom","random"]}},function(e,t){e.exports={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 if x is larger than y, -1 if x is smaller than y, and 0 if x and y are equal.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural"]}},function(e,t){e.exports={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)",'compare("2", "10")',"compare(2 + 3i, 2 + 4i)","compare([1, 2, 4], [1, 2, 3])","compare([1, 5], [1, 2, 3])","compare([1, 2], [1, 2])","compare({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}},function(e,t){e.exports={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["[1,3,4] == [1,3,4]","[1,3,4] == [1,3]"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]}},function(e,t){e.exports={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e,t){e.exports={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}},function(e,t){e.exports={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 > 1+1","2 >= 1+1","a = 3.2","b = 6-2.8","(a > b)"],seealso:["equal","unequal","smallerEq","smaller","largerEq","compare"]}},function(e,t){e.exports={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]}},function(e,t){e.exports={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 1+1","2 <= 1+1","a = 3.2","b = 6-2.8","(a < b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]}},function(e,t){e.exports={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e,t){e.exports={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]}},function(e,t){e.exports={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]}},function(e,t){e.exports={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]}},function(e,t){e.exports={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]}},function(e,t){e.exports={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]}},function(e,t){e.exports={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]}},function(e,t){e.exports={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]}},function(e,t){e.exports={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]}},function(e,t){e.exports={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]}},function(e,t){e.exports={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]}},function(e,t){e.exports={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]}},function(e,t){e.exports={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])","mad(10, 20, 30)"],seealso:["mean","median","std","abs"]}},function(e,t){e.exports={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","var"]}},function(e,t){e.exports={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","var"]}},function(e,t){e.exports={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","var","quantileSeq"]}},function(e,t){e.exports={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","var"]}},function(e,t){e.exports={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(5, 2, 7)","mode([3, -1, 5, 7])"],seealso:["max","mean","min","median","prod","std","sum","var"]}},function(e,t){e.exports={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","var"]}},function(e,t){e.exports={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","var"]}},function(e,t){e.exports={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","sum","var"]}},function(e,t){e.exports={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","var"]}},function(e,t){e.exports={name:"var",category:"Statistics",syntax:["var(a, b, c, ...)","var(A)","var(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["var(2, 4, 6)","var([2, 4, 6, 8])",'var([2, 4, 6, 8], "uncorrected")','var([2, 4, 6, 8], "biased")',"var([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}},function(e,t){e.exports={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]}},function(e,t){e.exports={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]}},function(e,t){e.exports={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]}},function(e,t){e.exports={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(0.5)"],seealso:["acsch","asech"]}},function(e,t){e.exports={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(0.5)","acsc(csc(0.5))","acsc(2)"],seealso:["csc","asin","asec"]}},function(e,t){e.exports={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]}},function(e,t){e.exports={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]}},function(e,t){e.exports={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]}},function(e,t){e.exports={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(2.3))"],seealso:["sin","acos","atan"]}},function(e,t){e.exports={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]}},function(e,t){e.exports={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(2.3))"],seealso:["tan","acos","asin"]}},function(e,t){e.exports={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]}},function(e,t){e.exports={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]}},function(e,t){e.exports={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]}},function(e,t){e.exports={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]}},function(e,t){e.exports={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]}},function(e,t){e.exports={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]}},function(e,t){e.exports={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]}},function(e,t){e.exports={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}},function(e,t){e.exports={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]}},function(e,t){e.exports={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]}},function(e,t){e.exports={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]}},function(e,t){e.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]}},function(e,t){e.exports={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]}},function(e,t){e.exports={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]}},function(e,t){e.exports={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]}},function(e,t){e.exports={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]}},function(e,t){e.exports={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]}},function(e,t){e.exports={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]}},function(e,t){e.exports={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]}},function(e,t){e.exports={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]}},function(e,t){e.exports={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)","isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))",'isNumeric("3")',"isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN"]}},function(e,t){e.exports={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]}},function(e,t){e.exports={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]}},function(e,t){e.exports={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]}},function(e,t){e.exports={name:"typeof",category:"Utils",syntax:["typeof(x)"],description:"Get the type of a variable.",examples:["typeof(3.5)","typeof(2 - 4i)","typeof(45 deg)",'typeof("hello world")'],seealso:[]}},function(e,t,r){e.exports=[r(382),r(384),r(385),r(386),r(108)]},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(39));return a("compile",{string:function(e){return o(e).compile()},"Array | Matrix":function(e){return i(e,function(e){return o(e).compile()})}})}var i=r(1);t.name="compile",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(22)),u=n(r(0));return function(e,t,r){try{if(Array.isArray(e))return u(e).subset(t,r).valueOf();if(e&&"function"==typeof e.subset)return e.subset(t,r);if("string"==typeof e)return s(e,t,r);if("object"==typeof e){if(!t.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return a(e,t.getObjectProperty(),r),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw i(e)}}}var i=r(41).transform,a=r(13).setSafeProperty;t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(39));return a("compile",{string:function(e){var t={};return o(e).compile().eval(t)},"string, Object":function(e,t){return o(e).compile().eval(t)},"Array | Matrix":function(e){var t={};return i(e,function(e){return o(e).compile().eval(t)})},"Array | Matrix, Object":function(e,t){return i(e,function(e){return o(e).compile().eval(t)})}})}var i=r(1);t.name="eval",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a,o){var s=n(r(97));return a("help",{any:function(t){var r,n=t;if("string"!=typeof t)for(r in o)if(o.hasOwnProperty(r)&&t===o[r]){n=r;break}var a=i(s,n);if(!a)throw new Error('No documentation found on "'+n+'"');return new e.Help(a)}})}var i=r(13).getSafeProperty;t.math=!0,t.name="help",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(39));return i("parse",{"string | Array | Matrix":a,"string | Array | Matrix, Object":a})}t.name="parse",t.factory=n},function(e,t,r){e.exports=[r(100),r(78),r(102),r(103),r(104),r(53),r(76),r(105),r(54),r(14),r(107),r(61),r(62),r(77),r(40),r(388)]},function(e,t,r){"use strict";function n(e,t,r,n){function i(){throw new Error("UpdateNode is deprecated. Use AssignmentNode instead.")}return i}t.name="UpdateNode",t.path="expression.node",t.factory=n},function(e,t,r){e.exports=[r(390),r(391),r(392),r(393),r(394),r(395),r(396),r(397),r(398),r(399)]; +},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(63));return a("concat",{"...any":function(e){var t=e.length-1,r=e[t];"number"==typeof r?e[t]=r-1:r&&r.isBigNumber===!0&&(e[t]=r.minus(1));try{return o.apply(null,e)}catch(e){throw i(e)}}})}var i=r(41).transform;t.name="concat",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function s(e,t,r){var n,i;return e[0]&&(n=e[0].compile().eval(r)),e[1]&&(i=e[1].isSymbolNode||e[1].isFunctionAssignmentNode?e[1].compile().eval(r):u(e[1],t,r)),f(n,i)}var c=n(r(0));s.rawArgs=!0;var f=a("filter",{"Array, function":i,"Matrix, function":function(e,t){return c(i(e.toArray(),t))},"Array, RegExp":o,"Matrix, RegExp":function(e,t){return c(o(e.toArray(),t))}});return f.toTex=void 0,s}function i(e,t){var r=s(t);return a(e,function(e,n,i){return 1===r?t(e):2===r?t(e,[n+1]):t(e,[n+1],i)})}var a=r(2).filter,o=r(2).filterRegExp,s=r(32).maxArgumentCount,u=r(79);t.name="filter",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function s(e,t,r){var n,i;return e[0]&&(n=e[0].compile().eval(r)),e[1]&&(i=e[1].isSymbolNode||e[1].isFunctionAssignmentNode?e[1].compile().eval(r):o(e[1],t,r)),u(n,i)}s.rawArgs=!0;var u=n("forEach",{"Array | Matrix, function":function(e,t){var r=i(t),n=function(i,o){Array.isArray(i)?a(i,function(e,t){n(e,o.concat(t+1))}):1===r?t(i):2===r?t(i,o):t(i,o,e)};n(e.valueOf(),[])}});return s}var i=r(32).maxArgumentCount,a=r(2).forEach,o=r(79);t.name="forEach",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,r){return function(){for(var t=[],r=0,n=arguments.length;r0?0:2;else if(i&&i.isSet===!0)i=i.map(function(e){return e-1});else if(i&&(i.isArray===!0||i.isMatrix))i=i.map(function(e){return e-1});else if("number"==typeof i)i--;else if(i&&i.isBigNumber===!0)i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");t[r]=i}var a=new e.Index;return e.Index.apply(a,t),a}}t.name="index",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e,t,r){var n,i;return e[0]&&(n=e[0].compile().eval(r)),e[1]&&(i=e[1].isSymbolNode||e[1].isFunctionAssignmentNode?e[1].compile().eval(r):s(e[1],t,r)),c(n,i)}var u=n(r(0));o.rawArgs=!0;var c=a("map",{"Array, function":function(e,t){return i(e,t,e)},"Matrix, function":function(e,t){return u(i(e.valueOf(),t,e))}});return o}function i(e,t,r){function n(e,a){return Array.isArray(e)?o(e,function(e,t){return n(e,a.concat(t+1))}):1===i?t(e):2===i?t(e,a):t(e,a,r)}var i=a(t);return n(e,[])}var a=r(32).maxArgumentCount,o=r(2).map,s=r(79);t.name="map",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(110));return o("max",{"...any":function(e){if(2==e.length&&a(e[0])){var t=e[1];"number"==typeof t?e[1]=t-1:t&&t.isBigNumber===!0&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw i(e)}}})}var i=r(41).transform,a=r(46);t.name="max",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(111));return o("mean",{"...any":function(e){if(2==e.length&&a(e[0])){var t=e[1];"number"==typeof t?e[1]=t-1:t&&t.isBigNumber===!0&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw i(e)}}})}var i=r(41).transform,a=r(46);t.name="mean",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(114));return o("min",{"...any":function(e){if(2==e.length&&a(e[0])){var t=e[1];"number"==typeof t?e[1]=t-1:t&&t.isBigNumber===!0&&(e[1]=t.minus(1))}try{return s.apply(null,e)}catch(e){throw i(e)}}})}var i=r(41).transform,a=r(46);t.name="min",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(115));return i("range",{"...any":function(e){var t=e.length-1,r=e[t];return"boolean"!=typeof r&&e.push(!0),a.apply(null,e)}})}t.name="range",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(22));return a("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw i(e)}}})}var i=r(41).transform;t.name="subset",t.path="expression.transform",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}var u=n(r(108))();return s.prototype.type="Help",s.prototype.isHelp=!0,s.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var r=0;r1?(r=l(n,o,i),u.unshift(r),r=l(n,u,i)):r=l(n,t,i)}else r=l(n,t,i);else t=e.args.map(p),r=l(n,t,i);return r;case"ParenthesisNode":return p(e.content);case"AccessorNode":case"ArrayNode":case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"IndexNode":case"ObjectNode":case"RangeNode":case"UpdateNode":case"ConditionalNode":default:throw"Unimplemented node type in simplifyConstant: "+e.type}}var h=n(r(117)),m=h.isCommutative,d=h.isAssociative,v=h.allChildren,g=h.createMakeNodeFunction,y=a.expression.node.ConstantNode,x=a.expression.node.OperatorNode,w=i({Fraction:f,number:function(e){return e<0?c(new y(-e)):new y(e)},BigNumber:function(e){return e<0?c(new y(e.negated().toString(),"number")):new y(e.toString(),"number")},Complex:function(e){throw"Cannot convert Complex number to Node"}}),b=i({string:function(e){return"BigNumber"===t.number?a.bignumber(e):"Fraction"===t.number?a.fraction(e):u(parseFloat(e))},Fraction:function(e){return e},BigNumber:function(e){return e},number:function(e){return u(e)},Complex:function(e){return 0!==e.im?e:u(e.re)}});return o}r(3).digits;t.math=!0,t.name="simplifyConstant",t.path="algebra.simplify",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n,i){function a(e){if(e.isOperatorNode&&e.args.length<=2){var t=a(e.args[0]),r=e.args[1]&&a(e.args[1]);if("+"===e.op){if(1===e.args.length)return e.args[0];if(t.isConstantNode){if("0"===t.value)return r;if(r.isConstantNode&&t.value&&t.value.length<5&&r.value&&r.value.length<5)return new o(Number(t.value)+Number(r.value))}return r&&r.isConstantNode&&"0"===r.value?t:new s(e.op,e.fn,r?[t,r]:[t])}if("-"===e.op){if(t.isConstantNode&&r){if(r.isConstantNode&&t.value&&t.value.length<5&&r.value&&r.value.length<5)return new o(Number(t.value)-Number(r.value));if("0"===t.value)return new s("-","unaryMinus",[r])}if("subtract"===e.fn)return r.isConstantNode&&"0"===r.value?t:r.isOperatorNode&&"unaryMinus"===r.fn?a(new s("+","add",[t,r.args[0]])):new s(e.op,e.fn,[t,r]);if("unaryMinus"===e.fn)return new s(e.op,e.fn,[t])}else{if("*"===e.op){if(t.isConstantNode){if("0"===t.value)return c;if("1"===t.value)return r;if(r.isConstantNode&&t.value&&t.value.length<5&&r.value&&r.value.length<5)return new o(Number(t.value)*Number(r.value))}if(r.isConstantNode){if("0"===r.value)return c;if("1"===r.value)return t;if(t.isOperatorNode&&t.op===e.op){var n=t.args[0];if(n.isConstantNode&&r.value&&r.value.length<5&&n.value&&n.value.length<5){var l=new o(Number(t.args[0].value)*Number(r.value));return new s(e.op,e.fn,[l,t.args[1]])}}return new s(e.op,e.fn,[r,t])}return new s(e.op,e.fn,[t,r])}if("/"===e.op){if(t.isConstantNode){if("0"===t.value)return c;if(r.isConstantNode&&t.value&&t.value.length<5&&("1"===r.value||"2"===r.value||"4"===r.value))return new o(Number(t.value)/Number(r.value))}return new s(e.op,e.fn,[t,r])}if("^"===e.op){if(r.isConstantNode){if("0"===r.value)return f;if("1"===r.value)return t;if(r.isConstantNode&&t.value&&t.value.length<5&&r.value&&r.value.length<2)return new o(i.pow(Number(t.value),Number(r.value)))}return new s(e.op,e.fn,[t,r])}}}else{if(e.isParenthesisNode){var p=a(e.content);return p.isParenthesisNode||p.isSymbolNode||p.isConstantNode?p:new ParenthesisNode(p)}if(e.isFunctionNode){var h=e.args.map(function(e){return a(e)});return 1===h.length&&h[0].isParenthesisNode&&(h[0]=h[0].content),new u(e.name,h)}}return e}var o=i.expression.node.ConstantNode,s=i.expression.node.OperatorNode,u=i.expression.node.FunctionNode,c=new o(0),f=new o(1);return a}t.math=!0,t.name="simplifyCore",t.path="algebra.simplify",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n,i){function a(e,t){if(null==t)return e;if(e.isSymbolNode){var r=t[e.name];if(r instanceof o)return a(r,t);if("number"==typeof r)return i.parse(String(r))}else{if(e.isOperatorNode){var n=e.args.map(function(e){return a(e,t)});return new s(e.op,e.fn,n)}if(e.isParenthesisNode)return new c(a(e.content,t));if(e.isFunctionNode){var n=e.args.map(function(e){return a(e,t)});return new u(e.name,n)}}return e}var o=i.expression.node.Node,s=i.expression.node.OperatorNode,u=i.expression.node.FunctionNode,c=i.expression.node.ParenthesisNode;return a}t.math=!0,t.name="resolve",t.path="algebra.simplify",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(0)),o=n(r(38)),s=n(r(60)),u=(n(r(118)),n(r(80))),c=(n(r(55)),n(r(119))),f=(n(r(29)),n(r(120))),l=n(r(56)),p=n(r(121)),h=n(r(37)),m=n(r(20)),d=n(r(19)),v=n(r(23)),g=n(r(21)),y=i("qr",{DenseMatrix:function(e){return x(e)},SparseMatrix:function(e){return w(e)},Array:function(e){var t=a(e),r=x(t);return{Q:r.Q.valueOf(),R:r.R.valueOf()}}}),x=function(e){var t,r,n,i=e._size[0],a=e._size[1],y=s([i],"dense"),x=y._data,w=e.clone(),b=w._data,N=o([i],"");for(n=0;n=0;u--)for(f=r[u],l=r[u+1],c=f;c=0;s--)h[s]=-1,u=m[s],u!=-1&&(0===d[x+u]++&&(d[y+u]=s),d[v+s]=d[g+u],d[g+u]=s);for(t.lnz=0,t.m2=a,u=0;u3)return null;var r=t._size,n=r[0],s=r[1],u=0,c=Math.max(16,10*Math.sqrt(s));c=Math.min(s-2,c);var f=l(e,t,n,s,c);a(f,d,null);for(var v,g,y,x,w,b,N,E,M,A,O,T,_,S,C,z,k=f._index,I=f._ptr,B=I[s],P=[],R=[],U=0,q=s+1,L=2*(s+1),j=3*(s+1),F=4*(s+1),D=5*(s+1),H=6*(s+1),$=7*(s+1),G=P,Z=p(s,I,R,U,j,G,L,$,q,H,F,D),V=h(s,I,R,D,F,H,c,q,j,G,L),W=0;VY?(b=y,N=Q,E=R[U+y]-Y):(b=k[Q++],N=I[b],E=R[U+b]),w=1;w<=E;w++)v=k[N++],(M=R[q+v])<=0||(J+=M,R[q+v]=-M,k[ee++]=v,R[L+v]!=-1&&(G[R[L+v]]=G[v]),G[v]!=-1?R[L+G[v]]=R[L+v]:R[j+R[D+v]]=R[L+v]);b!=y&&(I[b]=i(y),R[H+b]=0)}for(0!==Y&&(B=ee),R[D+y]=J,I[y]=K,R[U+y]=ee-K,R[F+y]=-2,Z=m(Z,u,R,H,s),A=K;A=Z?R[H+b]-=M:0!==R[H+b]&&(R[H+b]=R[D+b]+te)}for(A=K;A0?(z+=re,k[S++]=b,C+=b):(I[b]=i(y),R[H+b]=0)}R[F+v]=S-T+1;var ne=S,ie=T+R[U+v];for(Q=_+1;Q=0))for(C=G[v],v=R[$+C],R[$+C]=-1;v!=-1&&R[L+v]!=-1;v=R[L+v],Z++){for(E=R[U+v],O=R[F+v],Q=I[v]+1;Q<=I[v]+E-1;Q++)R[H+k[Q]]=Z;var oe=v;for(g=R[L+v];g!=-1;){var se=R[U+g]===E&&R[F+g]===O;for(Q=I[g]+1;se&&Q<=I[g]+E-1;Q++)R[H+k[Q]]!=Z&&(se=0);se?(I[g]=i(v),R[q+v]+=R[q+g],R[q+g]=0,R[F+g]=-1,g=R[L+g],R[L+oe]=g):(oe=g,g=R[L+g])}}for(Q=K,A=K;A=0;g--)R[q+g]>0||(R[L+g]=R[j+I[g]],R[j+I[g]]=g);for(b=s;b>=0;b--)R[q+b]<=0||I[b]!=-1&&(R[L+b]=R[j+I[b]],R[j+I[b]]=b);for(y=0,v=0;v<=s;v++)I[v]==-1&&(y=o(v,y,R,j,L,P,H));return P.splice(P.length-1,1),P},l=function(e,t,r,n,i){var a=c(t);if(1===e&&n===r)return s(t,a);if(2==e){for(var o=a._index,f=a._ptr,l=0,p=0;pi))for(var m=f[p+1];hs)r[u+h]=0,r[a+h]=-1,p++,t[h]=i(e),r[u+e]++;else{var d=r[c+m];d!=-1&&(f[d]=h),r[l+h]=r[c+m],r[c+m]=h}}return p},m=function(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a=0;r--)e[r]!=-1&&(o[u+r]=o[s+e[r]],o[s+e[r]]=r);for(r=0;r=1&&M[s]++,2==_.jleaf&&M[_.q]--}t[s]!=-1&&(g[y+s]=t[s])}for(s=0;s=0;){e=n[d];var v=s?s[e]:e;i(p,e)||(a(p,e),n[m+d]=v<0?0:o(p[v]));var g=1;for(c=n[m+d],f=v<0?0:o(p[v+1]);c=0||t.predictable?a(r):new e.Complex(r,0).log().div(Math.LN10)},Complex:function(t){return new e.Complex(t).log().div(Math.LN10)},BigNumber:function(r){return!r.isNegative()||t.predictable?r.log():new e.Complex(r.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":function(e){return i(e,o)}});return o.toTex={1:"\\log_{10}\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.log10||function(e){return Math.log(e)/Math.LN10};t.name="log10",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){if(t>0)return e-t*Math.floor(e/t);if(0===t)return e;throw new Error("Cannot calculate mod for a negative divisor")}var o=n(r(0)),s=r(4),u=n(r(24)),c=n(r(15)),f=n(r(59)),l=n(r(17)),p=n(r(16)),h=n(r(8)),m=n(r(6)),d=i("mod",{"number, number":a,"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.mod(t)},"Fraction, Fraction":function(e,t){return e.mod(t)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=f(e,t,d,!1);break;default:r=u(t,e,d,!0)}break;default:switch(t.storage()){case"sparse":r=c(e,t,d,!1);break;default:r=h(e,t,d)}}return r},"Array, Array":function(e,t){return d(o(e),o(t)).valueOf()},"Array, Matrix":function(e,t){return d(o(e),t)},"Matrix, Array":function(e,t){return d(e,o(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=l(e,t,d,!1);break;default:r=m(e,t,d,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=p(t,e,d,!0);break;default:r=m(t,e,d,!0)}return r},"Array, any":function(e,t){return m(o(e),t,d,!1).valueOf()},"any, Array":function(e,t){return m(o(t),e,d,!0).valueOf()}});return d.toTex={2:"\\left(${args[0]}"+s.operators.mod+"${args[1]}\\right)"},d}t.name="mod",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){var r=e.size();if(1==r.length){if(t===Number.POSITIVE_INFINITY||"inf"===t){var n=0;return e.forEach(function(e){var t=o(e);p(t,n)&&(n=t)},!0),n}if(t===Number.NEGATIVE_INFINITY||"-inf"===t){var i;return e.forEach(function(e){var t=o(e);i&&!h(t,i)||(i=t)},!0),i||0}if("fro"===t)return a(e,2);if("number"==typeof t&&!isNaN(t)){if(!l(t,0)){var m=0;return e.forEach(function(e){m=s(u(o(e),t),m)},!0),u(m,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}if(2==r.length){if(1===t){var g=[],y=0;return e.forEach(function(e,t){var r=t[1],n=s(g[r]||0,o(e));p(n,y)&&(y=n),g[r]=n},!0),y}if(t===Number.POSITIVE_INFINITY||"inf"===t){var x=[],w=0;return e.forEach(function(e,t){var r=t[0],n=s(x[r]||0,o(e));p(n,w)&&(w=n),x[r]=n},!0),w}if("fro"===t)return c(d(f(v(e),e)));if(2===t)throw new Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw new Error("Unsupported parameter value")}}var o=n(r(29)),s=n(r(18)),u=n(r(45)),c=n(r(56)),f=n(r(12)),l=n(r(11)),p=n(r(34)),h=n(r(44)),m=n(r(0)),d=n(r(133)),v=n(r(66)),g=i("norm",{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},"boolean | null":function(e){return Math.abs(e)},Array:function(e){return a(m(e),2)},Matrix:function(e){return a(e,2)},"number | Complex | BigNumber | boolean | null, number | BigNumber | string":function(e){return g(e)},"Array, number | BigNumber | string":function(e,t){return a(m(e),t)},"Matrix, number | BigNumber | string":function(e,t){return a(e,t)}});return g.toTex={1:"\\left\\|${args[0]}\\right\\|",2:void 0},g}t.name="norm",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(t,r){var n=e.BigNumber.precision,i=e.BigNumber.clone({precision:n+2}),a=new e.BigNumber(0),o=new i(1),s=r.isNegative();if(s&&(r=r.neg()),r.isZero())throw new Error("Root must be non-zero");if(t.isNegative()&&!r.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(t.isZero())return s?new i(1/0):0;if(!t.isFinite())return s?a:t;var u=t.abs().pow(o.div(r));return u=t.isNeg()?u.neg():u,new e.BigNumber((s?o.div(u):u).toPrecision(n))}var u=n(r(0)),c=n(r(33)),f=n(r(24)),l=n(r(67)),p=n(r(17)),h=n(r(8)),m=n(r(6)),d=o("nthRoot",{number:function(e){return i(e,2)},"number, number":i,BigNumber:function(t){return s(t,new e.BigNumber(2))},Complex:function(e){return a(e,2)},"Complex, number":a,"BigNumber, BigNumber":s,"Array | Matrix":function(e){return d(e,2)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":if(1!==t.density())throw new Error("Root must be non-zero");r=l(e,t,d);break;default:r=f(t,e,d,!0)}break;default:switch(t.storage()){case"sparse":if(1!==t.density())throw new Error("Root must be non-zero");r=c(e,t,d,!1);break;default:r=h(e,t,d)}}return r},"Array, Array":function(e,t){return d(u(e),u(t)).valueOf()},"Array, Matrix":function(e,t){return d(u(e),t)},"Matrix, Array":function(e,t){return d(e,u(t))},"Matrix, number | BigNumber":function(e,t){var r;switch(e.storage()){case"sparse":r=p(e,t,d,!1);break;default:r=m(e,t,d,!1)}return r},"number | BigNumber, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":if(1!==t.density())throw new Error("Root must be non-zero");r=p(t,e,d,!0);break;default:r=m(t,e,d,!0)}return r},"Array, number | BigNumber":function(e,t){return d(u(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return d(e,u(t)).valueOf()}});return d.toTex={2:"\\sqrt[${args[1]}]{${args[0]}}"},d}function i(e,t){var r=t<0;if(r&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0==e)return r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!==0)throw new Error("Root must be an integer");for(var r=e.arg(),n=e.abs(),i=[],a=Math.pow(n,1/t),o=0;o>t},"BigNumber, BigNumber":a,"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=h(e,t,y,!1);break;default:r=p(t,e,y,!0)}break;default:switch(t.storage()){case"sparse":r=l(e,t,y,!1);break;default:r=v(e,t,y)}}return r},"Array, Array":function(e,t){return y(u(e),u(t)).valueOf()},"Array, Matrix":function(e,t){return y(u(e),t)},"Matrix, Array":function(e,t){return y(e,u(t))},"Matrix, number | BigNumber":function(e,t){if(!c(t,0)){var r;switch(e.storage()){case"sparse":r=d(e,t,y,!1);break;default:r=g(e,t,y,!1)}return r}return e.clone()},"number | BigNumber, Matrix":function(e,t){if(!c(e,0)){var r;switch(t.storage()){case"sparse":r=m(t,e,y,!0);break;default:r=g(t,e,y,!0)}return r}return f(t.size(),t.storage())},"Array, number | BigNumber":function(e,t){return y(u(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return y(e,u(t)).valueOf()}});return y.toTex={2:"\\left(${args[0]}"+s.operators.rightArithShift+"${args[1]}\\right)"},y}var i=r(3).isInteger,a=r(453);t.name="rightArithShift",t.factory=n},function(e,t){e.exports=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():new r(e.isNegative()?-1:e.isFinite()?0:NaN)}},function(e,t,r){"use strict";function n(e,t,n,a){var o=r(4),s=n(r(0)),u=n(r(11)),c=n(r(38)),f=n(r(33)),l=n(r(24)),p=n(r(85)),h=n(r(36)),m=n(r(17)),d=n(r(8)),v=n(r(6)),g=a("rightLogShift",{"number, number":function(e,t){if(!i(e)||!i(t))throw new Error("Integers expected in function rightLogShift");return e>>>t},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=p(e,t,g,!1);break;default:r=l(t,e,g,!0)}break;default:switch(t.storage()){case"sparse":r=f(e,t,g,!1);break;default:r=d(e,t,g)}}return r},"Array, Array":function(e,t){return g(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return g(s(e),t)},"Matrix, Array":function(e,t){return g(e,s(t))},"Matrix, number | BigNumber":function(e,t){if(!u(t,0)){var r;switch(e.storage()){case"sparse":r=m(e,t,g,!1);break;default:r=v(e,t,g,!1)}return r}return e.clone()},"number | BigNumber, Matrix":function(e,t){if(!u(e,0)){var r;switch(t.storage()){case"sparse":r=h(t,e,g,!0);break;default:r=v(t,e,g,!0)}return r}return c(t.size(),t.storage())},"Array, number | BigNumber":function(e,t){return g(s(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return g(e,s(t)).valueOf()}});return g.toTex={2:"\\left(${args[0]}"+o.operators.rightLogShift+"${args[1]}\\right)"},g}var i=r(3).isInteger;t.name="rightLogShift",t.factory=n},function(e,t,r){e.exports=[r(456),r(457),r(134),r(458)]},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(18)),o=n(r(134)),s=n(r(57)),u=n(r(48)),c=i("bellNumbers",{"number | BigNumber":function(e){if(!u(e)||s(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,r=0;r<=e;r++)t=a(t,o(e,r));return t}});return c.toTex={1:"\\mathrm{B}_{${args[0]}}"},c}t.name="bellNumbers",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(69)),o=n(r(20)),s=n(r(55)),u=n(r(48)),c=n(r(34)),f=i("composition",{"number | BigNumber, number | BigNumber":function(e,t){if(!(u(e)&&s(e)&&u(t)&&s(t)))throw new TypeError("Positive integer value expected in function composition");if(c(t,e))throw new TypeError("k must be less than or equal to n in function composition");return a(o(e,-1),o(t,-1))}});return f.toTex=void 0,f}t.name="composition",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(18)),o=n(r(47)),s=n(r(12)),u=n(r(69)),c=n(r(57)),f=n(r(48)),l=i("catalan",{"number | BigNumber":function(e){if(!f(e)||c(e))throw new TypeError("Non-negative integer value expected in function catalan");return o(u(s(e,2),e),a(e,1))}});return l.toTex={1:"\\mathrm{C}_{${args[0]}}"},l}t.name="catalan",t.factory=n},function(e,t,r){e.exports=[r(460),r(121),r(461),r(462)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(t){return e.BigNumber.atan2(0,t)},Complex:function(e){return e.arg()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\arg\\left(${args[0]}\\right)"},a}var i=r(1);t.name="arg",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("im",{number:function(e){return 0},BigNumber:function(t){return new e.BigNumber(0)},Complex:function(e){return e.im},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},a}var i=r(1);t.name="im",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("re",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.re},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},a}var i=r(1);t.name="re",t.factory=n},function(e,t,r){e.exports=[r(464),r(465)]},function(e,t,r){"use strict";function n(e,t,n,i){function a(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function o(e){return 3===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]}function s(e){return 4===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]&&"number"==typeof e[3]}function u(e,r,n,i){var a=e,o=n,s=d(a,r),u=d(o,i),c=s[0]*u[1]-u[0]*s[1];if(l(c)1?[o]:o}var s=n(r(0)),u=n(r(21)),c=n(r(12)),f=a("cross",{"Matrix, Matrix":function(e,t){return s(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return s(o(e.toArray(),t))},"Array, Matrix":function(e,t){return s(o(e,t.toArray()))},"Array, Array":o});return f.toTex={2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},f}var i=r(2);t.name="cross",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(e,t,r,n){if(!a(t))throw new TypeError("Second parameter in function diag must be an integer");var i=t>0?t:0,o=t<0?-t:0;switch(r.length){case 1:return u(e,t,n,r[0],o,i);case 2:return c(e,t,n,r,o,i)}throw new RangeError("Matrix for function diag must be 2 dimensional")}function u(t,r,n,i,a,o){var s=[i+a,i+o],u=e.Matrix.storage(n||"dense"),c=u.diagonal(s,t,r);return null!==n?c:c.valueOf()}function c(e,t,r,n,i,a){if(e&&e.isMatrix===!0){var o=e.diagonal(t);return null!==r?r!==o.storage()?f(o,r):o:o.valueOf()}for(var s=Math.min(n[0]-i,n[1]-a),u=[],c=0;c2||i(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");var r=[],n=[];return e.map(function(e){return t.map(function(t){return e.map(function(e){return t.map(function(t){return n.push(u(e,t))})},r.push(n=[]))})},r=[])&&r}var s=n(r(0)),u=n(r(23)),c=a("kron",{"Matrix, Matrix":function(e,t){return s(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return s(o(e.toArray(),t))},"Array, Matrix":function(e,t){return s(o(e,t.toArray()))},"Array, Array":o});return c}var i=r(2).size;t.name="kron",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(t,r){var n=u(t),i=n?new e.BigNumber(1):1;if(c(t),r){var o=f(r);return t.length>0?o.resize(t,i):o}var s=[];return t.length>0?a(s,t,i):s}function u(e){var t=!1;return e.forEach(function(e,r,n){e&&e.isBigNumber===!0&&(t=!0,n[r]=e.toNumber())}),t}function c(e){e.forEach(function(e){if("number"!=typeof e||!i(e)||e<0)throw new Error("Parameters in function ones must be positive integers")})}var f=n(r(0)),l=o("ones",{"":function(){return"Array"===t.matrix?s([]):s([],"default")},"...number | BigNumber | string":function(e){var r=e[e.length-1];if("string"==typeof r){var n=e.pop();return s(e,n)}return"Array"===t.matrix?s(e):s(e,"default")},Array:s,Matrix:function(e){var t=e.storage();return s(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return s(e.valueOf(),t)}});return l.toTex=void 0,l}var i=r(3).isInteger,a=r(2).resize;t.name="ones",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=o("reshape",{"Matrix, Array":function(e,t){return e.reshape?e.reshape(t):s(a.reshape(e.valueOf(),t))},"Array, Array":function(e,t){return t.forEach(function(e){if(!i(e))throw new TypeError("Invalid size for dimension: "+e)}),a.reshape(e,t)}});return u.toTex=void 0,u}var i=(r(10),r(3).isInteger),a=r(2);t.name="reshape",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,f){function l(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new i(t.length,1);var n=t[0];if("number"!=typeof n||!o(n))throw new TypeError("Invalid size, must contain positive integers (size: "+s(t)+")");if(e.length>n)return e.substring(0,n);if(e.lengthv)return 1}for(var g=0,y=Math.max(h.length,m.length);gi)return 1}return 0}},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(0)),u=o("squeeze",{Array:function(e){return a.squeeze(i.clone(e))},Matrix:function(e){var t=a.squeeze(e.toArray());return Array.isArray(t)?s(t):t},any:function(e){return i.clone(e)}});return u.toTex=void 0,u}var i=r(5),a=r(2);t.name="squeeze",t.factory=n},function(e,t,r){e.exports=[r(69),r(68),r(135),r(484),r(485),r(486),r(487),r(491),r(492)]},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){var r=t.size().length,n=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(n>1)throw new Error("second object must be one dimensional");if(r!==n)throw new Error("Length of two vectors must be equal");var i=u(e);if(0===i)throw new Error("Sum of elements in first object must be non zero");var a=u(t);if(0===a)throw new Error("Sum of elements in second object must be non zero");var o=s(e,u(e)),h=s(t,u(t)),m=u(c(o,l(f(o,h))));return p(m)?m:Number.NaN}var o=n(r(0)),s=n(r(47)),u=n(r(139)),c=n(r(12)),f=n(r(130)),l=n(r(132)),p=n(r(73)),h=i("kldivergence",{"Array, Array":function(e,t){return a(o(e),o(t))},"Matrix, Array":function(e,t){return a(e,o(t))},"Array, Matrix":function(e,t){return a(o(e),t)},"Matrix, Matrix":function(e,t){return a(e,t)}});return h}t.name="kldivergence",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(18)),s=n(r(12)),u=n(r(47)),c=n(r(68)),f=n(r(48)),l=n(r(55));return a("multinomial",{"Array | Matrix":function(e){var t=0,r=1;return i(e,function(e){if(!f(e)||!l(e))throw new TypeError("Positive integer value expected in function multinomial");t=o(t,e),r=s(r,c(e))}),u(c(t),r)}})}var i=r(42);t.name="multinomial",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(68)),u=o("permutations",{"number | BigNumber":s,"number, number":function(e,t){var r,n;if(!a(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!a(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");for(r=1,n=e-t+1;n<=e;n++)r*=n;return r},"BigNumber, BigNumber":function(t,r){var n,a;if(!i(t)||!i(r))throw new TypeError("Positive integer value expected in function permutations");if(r.gt(t))throw new TypeError("second argument k must be less than or equal to first argument n");for(n=new e.BigNumber(1),a=t.minus(r).plus(1);a.lte(t);a=a.plus(1))n=n.times(a);return n}});return u.toTex=void 0,u}function i(e){return e.isInteger()&&e.gte(0)}var a=r(3).isInteger;t.name="permutations",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(87)),o=a("uniform").pickRandom;return o.toTex=void 0,o}t.name="pickRandom",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n,o){function s(e){c=null===e?a:i(String(e))}function u(){return c()}var c;return s(t.randomSeed),o.on("config",function(e,t,r){void 0!==r.randomSeed&&s(e.randomSeed)}),u}var i=r(489),a=i();t.factory=n,t.math=!0},function(e,t,r){"use strict";(function(t){function r(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(r||(e=[r++]);i=m;)e/=2,t/=2,r>>>=1;return(e+r)/t}},e.exports.resetGlobal=function(){Math.random=v},i(Math.random(),f)}).call(t,r(490))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(87)),o=a("uniform").random;return o.toTex=void 0,o}t.name="random",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(87)),o=a("uniform").randomInt;return o.toTex=void 0,o}t.name="randomInt",t.factory=n},function(e,t,r){e.exports=[r(49),r(31),r(494),r(30),r(34),r(125),r(44),r(495),r(119)]},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){if(Array.isArray(e)){if(Array.isArray(t)){var r=e.length;if(r!==t.length)return!1;for(var n=0;n0;r--)for(var n=0;ne[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}var u=n(r(27)),c=n(r(28)),f=n(r(22)),l=n(r(31)),p=a("setPowerset",{"Array | Matrix":function(e){if(0===f(c(e),new u(0)))return[];for(var t=i(Array.isArray(e)?e:e.toArray()).sort(l),r=[],n=0;n.toString(2).length<=t.length;)r.push(o(t,n.toString(2).split("").reverse())),n++;return s(r)}});return p}var i=r(2).flatten;t.name="setPowerset",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(30)),s=n(r(31)),u=a("setSize",{"Array | Matrix":function(e){return Array.isArray(e)?i(e).length:i(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(t===!1||0===e.length)return Array.isArray(e)?i(e).length:i(e.toArray()).length;for(var r=i(Array.isArray(e)?e:e.toArray()).sort(s),n=1,a=1;a=f?a(e):t<=o?a(e)*l(t):t<=4?a(e)*(1-p(t)):a(e)*(1-h(t))},BigNumber:function(t){return new e.BigNumber(m(t.toNumber()))},"Array | Matrix":function(e){return i(e,m)}});return m.toTex={1:"erf\\left(${args[0]}\\right)"},m}var i=r(1),a=r(3).sign,o=.46875,s=.5641895835477563,u=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],c=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],f=Math.pow(2,53);t.name="erf",t.factory=n},function(e,t,r){e.exports=[r(507),r(110),r(111),r(143),r(114),r(508),r(509),r(510),r(511),r(139),r(144)]},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){if(e=i(e.valueOf()),0===e.length)throw new Error("Cannot calculate median absolute deviation of an empty array");var t=c(e);return c(u(e,function(e){return s(f(e,t))}))}var s=n(r(29)),u=n(r(137)),c=n(r(143)),f=n(r(21)),l=a("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});return l.toTex=void 0,l}var i=r(2).flatten;t.name="mad",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function a(e){e=i(e.valueOf());var t=e.length;if(0==t)throw new Error("Cannot calculate mode of an empty array");var r={},n=[],a=0;for(var o in e)e[o]in r||(r[e[o]]=0),r[e[o]]++,r[e[o]]==a?n.push(e[o]):r[e[o]]>a&&(a=r[e[o]],n=[e[o]]);return n}var o=n("mode",{"Array | Matrix":a,"...":function(e){return a(e)}});return o}var i=r(2).flatten;t.name="mode",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){var t=void 0;if(i(e,function(e){t=void 0===t?e:s(t,e)}),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}var s=n(r(23)),u=a("prod",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});return u.toTex=void 0,u}var i=r(42);t.name="prod",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,u){function c(t,r,n){var o,u,c;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(s(t)){if(n=n||!1,"boolean"==typeof n){if(u=t.valueOf(),a(r)){if(r<0)throw new Error("N/prob must be non-negative");if(r<=1)return f(u,r,n);if(r>1){if(!i(r))throw new Error("N must be a positive integer");var l=r+1;o=new Array(r);for(var p=0;p4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var l=new e.BigNumber(h+1);o=new Array(h);for(var p=0;p1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!m||!m.isBigNumber)throw new TypeError("Unexpected type of argument in function quantileSeq");if(c=new m.constructor(1),m.isNegative()||m.gt(c))throw new Error("Probability must be between 0 and 1, inclusive"); +}o[p]=f(u,m,n)}return o}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}function f(e,t,r){var n=o(e),i=n.length;if(0===i)throw new Error("Cannot calculate quantile of an empty sequence");if(a(t)){var s=t*(i-1),u=s%1;if(0===u){var c=r?n[s]:h(n,s);return d(c),c}var f,v,g=Math.floor(s);if(r)f=n[g],v=n[g+1];else{v=h(n,g+1),f=n[g];for(var y=0;y0&&(f=n[y])}return d(f),d(v),l(p(f,1-u),p(v,u))}var s=t.times(i-1);if(s.isInteger()){s=s.toNumber();var c=r?n[s]:h(n,s);return d(c),c}var f,v,g=s.floor(),u=s.minus(g),x=g.toNumber();if(r)f=n[x],v=n[x+1];else{v=h(n,x+1),f=n[x];for(var y=0;y0&&(f=n[y])}d(f),d(v);var w=new u.constructor(1);return l(p(f,w.minus(u)),p(v,u))}var l=n(r(18)),p=n(r(12)),h=n(r(86)),m=n(r(49)),d=u({"number | BigNumber | Unit":function(e){return e}});return c}var i=r(3).isInteger,a=r(3).isNumber,o=r(2).flatten,s=r(46);t.name="quantileSeq",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){if(0==e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");return o(s.apply(null,arguments))}var o=n(r(56)),s=n(r(144)),u=i("std",{"Array | Matrix":a,"Array | Matrix, string":a,"...":function(e){return a(e)}});return u.toTex=void 0,u}t.name="std",t.factory=n},function(e,t,r){e.exports=[r(96),r(513)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("print",{"string, Object":i,"string, Object, number | Object":i});return a.toTex=void 0,a}function i(e,t,r){return e.replace(/\$([\w\.]+)/g,function(e,n){for(var i=n.split("."),s=t[i.shift()];i.length&&void 0!==s;){var u=i.shift();s=u?s[u]:s+"."}return void 0!==s?a(s)?s:o(s,r):e})}var a=r(9).isString,o=r(9).format;t.name="print",t.factory=n},function(e,t,r){e.exports=[r(515),r(145),r(516),r(517),r(518),r(519),r(520),r(521),r(522),r(523),r(524),r(525),r(526),r(527),r(528),r(529),r(530),r(531),r(532),r(533),r(534),r(535),r(536),r(537),r(538)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acos",{number:function(r){return r>=-1&&r<=1||t.predictable?Math.acos(r):new e.Complex(r,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cos^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="acos",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acot",{number:function(e){return Math.atan(1/e)},Complex:function(e){return e.acot()},BigNumber:function(t){return new e.BigNumber(1).div(t).atan()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cot^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="acot",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acoth",{number:function(r){return r>=1||r<=-1||t.predictable?isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0:new e.Complex(r,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(t){return new e.BigNumber(1).div(t).atanh()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\coth^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="acoth",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acsc",{number:function(r){return r<=-1||r>=1||t.predictable?Math.asin(1/r):new e.Complex(r,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(t){return new e.BigNumber(1).div(t).asin()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\csc^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="acsc",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acsch",{number:function(e){return e=1/e,Math.log(e+Math.sqrt(e*e+1))},Complex:function(e){return e.acsch()},BigNumber:function(t){return new e.BigNumber(1).div(t).asinh()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="acsch",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asec",{number:function(r){return r<=-1||r>=1||t.predictable?Math.acos(1/r):new e.Complex(r,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(t){return new e.BigNumber(1).div(t).acos()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\sec^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="asec",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=(a.find(n(r(145)),["Complex"]),a("asech",{number:function(r){if(r<=1&&r>=-1||t.predictable){r=1/r;var n=Math.sqrt(r*r-1);return r>0||t.predictable?Math.log(n+r):new e.Complex(Math.log(n-r),Math.PI)}return new e.Complex(r,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(t){return new e.BigNumber(1).div(t).acosh()},"Array | Matrix":function(e){return i(e,o)}}));return o.toTex={1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},o}var i=r(1);t.name="asech",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asin",{number:function(r){return r>=-1&&r<=1||t.predictable?Math.asin(r):new e.Complex(r,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\sin^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="asin",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asinh",{number:Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\sinh^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="asinh",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\tan^{-1}\\left(${args[0]}\\right)"},a}var i=r(1);t.name="atan",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(0)),o=n(r(24)),s=n(r(15)),u=n(r(131)),c=n(r(17)),f=n(r(16)),l=n(r(8)),p=n(r(6)),h=i("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(t,r){return e.BigNumber.atan2(t,r)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=u(e,t,h,!1);break;default:r=o(t,e,h,!0)}break;default:switch(t.storage()){case"sparse":r=s(e,t,h,!1);break;default:r=l(e,t,h)}}return r},"Array, Array":function(e,t){return h(a(e),a(t)).valueOf()},"Array, Matrix":function(e,t){return h(a(e),t)},"Matrix, Array":function(e,t){return h(e,a(t))},"Matrix, number | BigNumber":function(e,t){var r;switch(e.storage()){case"sparse":r=c(e,t,h,!1);break;default:r=p(e,t,h,!1)}return r},"number | BigNumber, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,h,!0);break;default:r=p(t,e,h,!0)}return r},"Array, number | BigNumber":function(e,t){return p(a(e),t,h,!1).valueOf()},"number | BigNumber, Array":function(e,t){return p(a(t),e,h,!0).valueOf()}});return h.toTex={2:"\\mathrm{atan2}\\left(${args}\\right)"},h}t.name="atan2",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("atanh",{number:function(r){return r<=1&&r>=-1||t.predictable?a(r):new e.Complex(r,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()},"Array | Matrix":function(e){return i(e,o,!0)}});return o.toTex={1:"\\tanh^{-1}\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2};t.name="atanh",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("cos",{number:Math.cos,Complex:function(e){return e.cos()},BigNumber:function(e){return e.cos()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cos\\left(${args[0]}\\right)"},a}var i=r(1);t.name="cos",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("cosh",{number:a,Complex:function(e){return e.cosh()},BigNumber:function(e){return e.cosh()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return o(t.value)},"Array | Matrix":function(e){return i(e,o)}});return o.toTex={1:"\\cosh\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2};t.name="cosh",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("cot",{number:function(e){return 1/Math.tan(e)},Complex:function(e){return e.cot()},BigNumber:function(t){return new e.BigNumber(1).div(t.tan())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cot\\left(${args[0]}\\right)"},a}var i=r(1);t.name="cot",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("coth",{number:i,Complex:function(e){return e.coth()},BigNumber:function(t){return new e.BigNumber(1).div(t.tanh())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return o(t.value)},"Array | Matrix":function(e){return a(e,o)}});return o.toTex={1:"\\coth\\left(${args[0]}\\right)"},o}function i(e){var t=Math.exp(2*e);return(t+1)/(t-1)}var a=r(1);t.name="coth",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("csc",{number:function(e){return 1/Math.sin(e)},Complex:function(e){return e.csc()},BigNumber:function(t){return new e.BigNumber(1).div(t.sin())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\csc\\left(${args[0]}\\right)"},a}var i=r(1);t.name="csc",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("csch",{number:i,Complex:function(e){return e.csch()},BigNumber:function(t){return new e.BigNumber(1).div(t.sinh())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return o(t.value)},"Array | Matrix":function(e){return a(e,o)}});return o.toTex={1:"\\mathrm{csch}\\left(${args[0]}\\right)"},o}function i(e){return 0==e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*o(e)}var a=r(1),o=r(3).sign;t.name="csch",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("sec",{number:function(e){return 1/Math.cos(e)},Complex:function(e){return e.sec()},BigNumber:function(t){return new e.BigNumber(1).div(t.cos())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\sec\\left(${args[0]}\\right)"},a}var i=r(1);t.name="sec",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("sech",{number:i,Complex:function(e){return e.sech()},BigNumber:function(t){return new e.BigNumber(1).div(t.cosh())},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return o(t.value)},"Array | Matrix":function(e){return a(e,o)}});return o.toTex={1:"\\mathrm{sech}\\left(${args[0]}\\right)"},o}function i(e){return 2/(Math.exp(e)+Math.exp(-e))}var a=r(1);t.name="sech",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("sin",{number:Math.sin,Complex:function(e){return e.sin()},BigNumber:function(e){return e.sin()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\sin\\left(${args[0]}\\right)"},a}var i=r(1);t.name="sin",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("sinh",{number:a,Complex:function(e){return e.sinh()},BigNumber:function(e){return e.sinh()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return o(t.value)},"Array | Matrix":function(e){return i(e,o,!0)}});return o.toTex={1:"\\sinh\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2};t.name="sinh",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("tan",{number:Math.tan,Complex:function(e){return e.tan()},BigNumber:function(e){return e.tan()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return a(t.value)},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\tan\\left(${args[0]}\\right)"},a}var i=r(1);t.name="tan",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("tanh",{number:a,Complex:function(e){return e.tanh()},BigNumber:function(e){return e.tanh()},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return o(t.value)},"Array | Matrix":function(e){return i(e,o,!0)}});return o.toTex={1:"\\tanh\\left(${args[0]}\\right)"},o}var i=r(1),a=Math.tanh||function(e){var t=Math.exp(2*e);return(t-1)/(t+1)};t.name="tanh",t.factory=n},function(e,t,r){e.exports=[r(540)]},function(e,t,r){"use strict";function n(e,t,n,i){var a=r(4),o=n(r(0)),s=n(r(8)),u=n(r(6)),c=i("to",{"Unit, Unit | string":function(e,t){return e.to(t)},"Matrix, Matrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(o(e),o(t)).valueOf()},"Array, Matrix":function(e,t){return c(o(e),t)},"Matrix, Array":function(e,t){return c(e,o(t))},"Matrix, any":function(e,t){return u(e,t,c,!1)},"any, Matrix":function(e,t){return u(t,e,c,!0)},"Array, any":function(e,t){return u(o(e),t,c,!1).valueOf()},"any, Array":function(e,t){return u(o(t),e,c,!0).valueOf()}});return c.toTex={2:"\\left(${args[0]}"+a.operators.to+"${args[1]}\\right)"},c}t.name="to",t.factory=n},function(e,t,r){e.exports=[r(118),r(48),r(57),r(73),r(55),r(542),r(80),r(543),r(74)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isPrime",{number:function(e){if(e<2)return!1;if(2==e)return!0;if(e%2==0)return!1;for(var t=3;t*t<=e;t+=2)if(e%t==0)return!1;return!0},BigNumber:function(t){if(t.lt(2))return!1;if(t.equals(2))return!0;if(t.mod(2).isZero())return!1;for(var r=e.BigNumber(3);r.times(r).lte(t);r=r.plus(1))if(t.mod(r).isZero())return!1;return!0},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(1);t.name="isPrime",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isNaN",{number:function(e){return Number.isNaN(e)},BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return Number.isNaN(e.re)&&Number.isNaN(e.im)},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return i(e,Number.isNaN)}});return a}var i=r(1);r(3);t.name="isNaN",t.factory=n},function(e,t,r){e.exports=[r(545)]},function(e,t,r){"use strict";function n(e,t,r,n){return function(t,r){var n=e[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}}t.name="reviver",t.path="json",t.factory=n},function(e,t,r){"use strict";var n=r(50),i=r(10),a=r(51);e.exports=[{name:"ArgumentsError",path:"error",factory:function(){return n}},{name:"DimensionError",path:"error",factory:function(){return i}},{name:"IndexError",path:"error",factory:function(){return a}}]}])}); +//# sourceMappingURL=math.map \ No newline at end of file