(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.stdlib_plot_flat = f()}})(function(){var define,module,exports; var createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}}; var _$buffer_902 = createModuleFactory(function (module, exports) { (function (Buffer){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /* eslint-disable no-proto */ 'use strict' /* removed: var _$base64Js_900 = require('base64-js') */; /* removed: var _$ieee754_918 = require('ieee754') */; var customInspectSymbol = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? Symbol.for('nodejs.util.inspect.custom') : null exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 var K_MAX_LENGTH = 0x7fffffff exports.kMaxLength = K_MAX_LENGTH /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Print warning and recommend using `buffer` v4.x which has an Object * implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * We report that the browser does not support typed arrays if the are not subclassable * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support * for __proto__ and has a buggy typed array implementation. */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') { console.error( 'This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' ) } function typedArraySupport () { // Can typed array instances can be augmented? try { var arr = new Uint8Array(1) var proto = { foo: function () { return 42 } } Object.setPrototypeOf(proto, Uint8Array.prototype) Object.setPrototypeOf(arr, proto) return arr.foo() === 42 } catch (e) { return false } } Object.defineProperty(Buffer.prototype, 'parent', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.buffer } }) Object.defineProperty(Buffer.prototype, 'offset', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.byteOffset } }) function createBuffer (length) { if (length > K_MAX_LENGTH) { throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance var buf = new Uint8Array(length) Object.setPrototypeOf(buf, Buffer.prototype) return buf } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new TypeError( 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) } return from(arg, encodingOrOffset, length) } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 if (typeof Symbol !== 'undefined' && Symbol.species != null && Buffer[Symbol.species] === Buffer) { Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true, enumerable: false, writable: false }) } Buffer.poolSize = 8192 // not used by this implementation function from (value, encodingOrOffset, length) { if (typeof value === 'string') { return fromString(value, encodingOrOffset) } if (ArrayBuffer.isView(value)) { return fromArrayLike(value) } if (value == null) { throw new TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } if (isInstance(value, ArrayBuffer) || (value && isInstance(value.buffer, ArrayBuffer))) { return fromArrayBuffer(value, encodingOrOffset, length) } if (typeof value === 'number') { throw new TypeError( 'The "value" argument must not be of type number. Received type number' ) } var valueOf = value.valueOf && value.valueOf() if (valueOf != null && valueOf !== value) { return Buffer.from(valueOf, encodingOrOffset, length) } var b = fromObject(value) if (b) return b if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') { return Buffer.from( value[Symbol.toPrimitive]('string'), encodingOrOffset, length ) } throw new TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(value, encodingOrOffset, length) } // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: // https://github.com/feross/buffer/pull/148 Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) Object.setPrototypeOf(Buffer, Uint8Array) function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be of type number') } else if (size < 0) { throw new RangeError('The value "' + size + '" is invalid for option "size"') } } function alloc (size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill) } return createBuffer(size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(size, fill, encoding) } function allocUnsafe (size) { assertSize(size) return createBuffer(size < 0 ? 0 : checked(size) | 0) } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(size) } function fromString (string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } var length = byteLength(string, encoding) | 0 var buf = createBuffer(length) var actual = buf.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') buf = buf.slice(0, actual) } return buf } function fromArrayLike (array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 var buf = createBuffer(length) for (var i = 0; i < length; i += 1) { buf[i] = array[i] & 255 } return buf } function fromArrayBuffer (array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('"offset" is outside of buffer bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('"length" is outside of buffer bounds') } var buf if (byteOffset === undefined && length === undefined) { buf = new Uint8Array(array) } else if (length === undefined) { buf = new Uint8Array(array, byteOffset) } else { buf = new Uint8Array(array, byteOffset, length) } // Return an augmented `Uint8Array` instance Object.setPrototypeOf(buf, Buffer.prototype) return buf } function fromObject (obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 var buf = createBuffer(len) if (buf.length === 0) { return buf } obj.copy(buf, 0, 0, len) return buf } if (obj.length !== undefined) { if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { return createBuffer(0) } return fromArrayLike(obj) } if (obj.type === 'Buffer' && Array.isArray(obj.data)) { return fromArrayLike(obj.data) } } function checked (length) { // Note: cannot use `length < K_MAX_LENGTH` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= K_MAX_LENGTH) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false } Buffer.compare = function compare (a, b) { if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError( 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' ) } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (isInstance(buf, Uint8Array)) { buf = Buffer.from(buf) } if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { throw new TypeError( 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + typeof string ) } var len = string.length var mustMatch = (arguments.length > 2 && arguments[2] === true) if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) { return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 } encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) // to detect a Buffer instance. It's not possible to use `instanceof Buffer` // reliably in a browserify context because there could be multiple different // copies of the 'buffer' package in use. This method works even for Buffer // instances that were created from another copy of the `buffer` package. // See: https://github.com/feross/buffer/issues/154 Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.toLocaleString = Buffer.prototype.toString Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() if (this.length > max) str += ' ... ' return '' } if (customInspectSymbol) { Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { target = Buffer.from(target, target.offset, target.byteLength) } if (!Buffer.isBuffer(target)) { throw new TypeError( 'The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + (typeof target) ) } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (numberIsNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } var strLen = string.length if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (numberIsNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset >>> 0 if (isFinite(length)) { length = length >>> 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return _$base64Js_900.fromByteArray(buf) } else { return _$base64Js_900.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance Object.setPrototypeOf(newBuf, Buffer.prototype) return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return _$ieee754_918.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return _$ieee754_918.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return _$ieee754_918.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return _$ieee754_918.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } _$ieee754_918.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } _$ieee754_918.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('Index out of range') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { // Use built-in when available, missing from IE11 this.copyWithin(targetStart, start, end) } else if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (var i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, end), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } if (val.length === 1) { var code = val.charCodeAt(0) if ((encoding === 'utf8' && code < 128) || encoding === 'latin1') { // Fast path: If `val` fits into a single byte, use that numeric value. val = code } } } else if (typeof val === 'number') { val = val & 255 } else if (typeof val === 'boolean') { val = Number(val) } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding) var len = bytes.length if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"') } for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node takes equal signs as end of the Base64 encoding str = str.split('=')[0] // Node strips out invalid characters like \n and \t from the string, base64-js does not str = str.trim().replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return _$base64Js_900.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass // the `instanceof` check but they should be treated as of that type. // See: https://github.com/feross/buffer/issues/166 function isInstance (obj, type) { return obj instanceof type || (obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name) } function numberIsNaN (obj) { // For IE11 support return obj !== obj // eslint-disable-line no-self-compare } }).call(this,_$buffer_902({}).Buffer) }); /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null; // EXPORTS // var _$main_34 = main; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$main_34 = require( './define_property.js' ); */; // MAIN // /** * Tests for `Object.defineProperty` support. * * @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support * * @example * var bool = hasDefinePropertySupport(); * // returns */ function hasDefinePropertySupport() { var bool; if ( typeof _$main_34 !== 'function' ) { return false; } // Test basic support... try { _$main_34( {}, 'x', {} ); bool = true; } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasDefinePropertySupport_36 = hasDefinePropertySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for `Object.defineProperty` support. * * @module @stdlib/assert/has-define-property-support * * @example * var hasDefinePropertySupport = require( '@stdlib/assert/has-define-property-support' ); * * var bool = hasDefinePropertySupport(); * // returns */ // MODULES // /* removed: var _$hasDefinePropertySupport_36 = require( './main.js' ); */; // EXPORTS // var _$hasDefinePropertySupport_35 = _$hasDefinePropertySupport_36; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Defines (or modifies) an object property. * * ## Notes * * - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both. * * @name defineProperty * @type {Function} * @param {Object} obj - object on which to define the property * @param {(string|symbol)} prop - property name * @param {Object} descriptor - property descriptor * @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object * @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties * @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator * @param {*} [descriptor.value] - property value * @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value. * @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned. * @throws {TypeError} first argument must be an object * @throws {TypeError} third argument must be an object * @throws {Error} property descriptor cannot have both a value and a setter and/or getter * @returns {Object} object with added property * * @example * var obj = {}; * * defineProperty( obj, 'foo', { * 'value': 'bar' * }); * * var str = obj.foo; * // returns 'bar' */ var __defineProperty_824 = Object.defineProperty; // EXPORTS // var _$defineProperty_824 = __defineProperty_824; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests if an object has a specified property, either own or inherited. * * @param {*} value - value to test * @param {*} property - property to test * @returns {boolean} boolean indicating if an object has a specified property * * @example * var beep = { * 'boop': true * }; * * var bool = hasProp( beep, 'boop' ); * // returns true * * @example * var beep = { * 'boop': true * }; * * var bool = hasProp( beep, 'bap' ); * // returns false */ function hasProp( value, property ) { if ( value === void 0 || value === null ) { return false; } if ( typeof property === 'symbol' ) { return property in Object( value ); } return ( String( property ) in Object( value ) ); } // EXPORTS // var _$hasProp_58 = hasProp; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test whether an object has a specified property, either own or inherited. * * @module @stdlib/assert/has-property * * @example * var hasProp = require( '@stdlib/assert/has-property' ); * * var beep = { * 'boop': true * }; * * var bool = hasProp( beep, 'boop' ); * // returns true * * bool = hasProp( beep, 'bop' ); * // returns false */ // MODULES // /* removed: var _$hasProp_58 = require( './main.js' ); */; // EXPORTS // var _$hasProp_57 = _$hasProp_58; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests for native `Symbol` support. * * @returns {boolean} boolean indicating if an environment has `Symbol` support * * @example * var bool = hasSymbolSupport(); * // returns */ function hasSymbolSupport() { return ( typeof Symbol === 'function' && typeof Symbol( 'foo' ) === 'symbol' ); } // EXPORTS // var _$hasSymbolSupport_60 = hasSymbolSupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Symbol` support. * * @module @stdlib/assert/has-symbol-support * * @example * var hasSymbolSupport = require( '@stdlib/assert/has-symbol-support' ); * * var bool = hasSymbolSupport(); * // returns */ // MODULES // /* removed: var _$hasSymbolSupport_60 = require( './main.js' ); */; // EXPORTS // var _$hasSymbolSupport_59 = _$hasSymbolSupport_60; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasSymbolSupport_59 = require( '@stdlib/assert/has-symbol-support' ); */; // VARIABLES // var FLG = _$hasSymbolSupport_59(); // MAIN // /** * Tests for native `toStringTag` support. * * @returns {boolean} boolean indicating if an environment has `toStringTag` support * * @example * var bool = hasToStringTagSupport(); * // returns */ function hasToStringTagSupport() { return ( FLG && typeof Symbol.toStringTag === 'symbol' ); } // EXPORTS // var _$hasToStringTagSupport_62 = hasToStringTagSupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `toStringTag` support. * * @module @stdlib/assert/has-tostringtag-support * * @example * var hasToStringTagSupport = require( '@stdlib/assert/has-tostringtag-support' ); * * var bool = hasToStringTagSupport(); * // returns */ // MODULES // /* removed: var _$hasToStringTagSupport_62 = require( './main.js' ); */; // EXPORTS // var _$hasToStringTagSupport_61 = _$hasToStringTagSupport_62; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var toStr = Object.prototype.toString; // EXPORTS // var _$toStr_877 = toStr; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$toStr_877 = require( './tostring.js' ); */; // MAIN // /** * Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object. * * @param {*} v - input value * @returns {string} string value indicating a specification defined classification of the input value * * @example * var str = nativeClass( 'a' ); * // returns '[object String]' * * @example * var str = nativeClass( 5 ); * // returns '[object Number]' * * @example * function Beep() { * return this; * } * var str = nativeClass( new Beep() ); * // returns '[object Object]' */ function nativeClass( v ) { return _$toStr_877.call( v ); } // EXPORTS // var _$nativeClass_875 = nativeClass; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // FUNCTIONS // var has = Object.prototype.hasOwnProperty; // MAIN // /** * Tests if an object has a specified property. * * @param {*} value - value to test * @param {*} property - property to test * @returns {boolean} boolean indicating if an object has a specified property * * @example * var beep = { * 'boop': true * }; * * var bool = hasOwnProp( beep, 'boop' ); * // returns true * * @example * var beep = { * 'boop': true * }; * * var bool = hasOwnProp( beep, 'bap' ); * // returns false */ function hasOwnProp( value, property ) { if ( value === void 0 || value === null ) { return false; } return has.call( value, property ); } // EXPORTS // var _$hasOwnProp_56 = hasOwnProp; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test whether an object has a specified property. * * @module @stdlib/assert/has-own-property * * @example * var hasOwnProp = require( '@stdlib/assert/has-own-property' ); * * var beep = { * 'boop': true * }; * * var bool = hasOwnProp( beep, 'boop' ); * // returns true * * bool = hasOwnProp( beep, 'bop' ); * // returns false */ // MODULES // /* removed: var _$hasOwnProp_56 = require( './main.js' ); */; // EXPORTS // var _$hasOwnProp_55 = _$hasOwnProp_56; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : ''; // EXPORTS // var _$toStrTag_878 = toStrTag; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$toStrTag_878 = require( './tostringtag.js' ); */; /* removed: var _$toStr_877 = require( './tostring.js' ); */; // MAIN // /** * Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`. * * @param {*} v - input value * @returns {string} string value indicating a specification defined classification of the input value * * @example * var str = nativeClass( 'a' ); * // returns '[object String]' * * @example * var str = nativeClass( 5 ); * // returns '[object Number]' * * @example * function Beep() { * return this; * } * var str = nativeClass( new Beep() ); * // returns '[object Object]' */ function __nativeClass_876( v ) { var isOwn; var tag; var out; if ( v === null || v === void 0 ) { return _$toStr_877.call( v ); } tag = v[ _$toStrTag_878 ]; isOwn = _$hasOwnProp_55( v, _$toStrTag_878 ); // Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`. try { v[ _$toStrTag_878 ] = void 0; } catch ( err ) { // eslint-disable-line no-unused-vars return _$toStr_877.call( v ); } out = _$toStr_877.call( v ); if ( isOwn ) { v[ _$toStrTag_878 ] = tag; } else { delete v[ _$toStrTag_878 ]; } return out; } // EXPORTS // var _$nativeClass_876 = __nativeClass_876; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a string value indicating a specification defined classification of an object. * * @module @stdlib/utils/native-class * * @example * var nativeClass = require( '@stdlib/utils/native-class' ); * * var str = nativeClass( 'a' ); * // returns '[object String]' * * str = nativeClass( 5 ); * // returns '[object Number]' * * function Beep() { * return this; * } * str = nativeClass( new Beep() ); * // returns '[object Object]' */ // MODULES // /* removed: var _$hasToStringTagSupport_61 = require( '@stdlib/assert/has-tostringtag-support' ); */; /* removed: var _$nativeClass_875 = require( './native_class.js' ); */; /* removed: var _$nativeClass_876 = require( './polyfill.js' ); */; // MAIN // var __nativeClass_874; if ( _$hasToStringTagSupport_61() ) { __nativeClass_874 = _$nativeClass_876; } else { __nativeClass_874 = _$nativeClass_875; } // EXPORTS // var _$nativeClass_874 = __nativeClass_874; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var f; // FUNCTIONS // /** * Tests if a value is an array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an array * * @example * var bool = isArray( [] ); * // returns true * * @example * var bool = isArray( {} ); * // returns false */ function isArray( value ) { return ( _$nativeClass_874( value ) === '[object Array]' ); } // MAIN // if ( Array.isArray ) { f = Array.isArray; } else { f = isArray; } // EXPORTS // var _$f_84 = f; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an array. * * @module @stdlib/assert/is-array * * @example * var isArray = require( '@stdlib/assert/is-array' ); * * var bool = isArray( [] ); * // returns true * * bool = isArray( {} ); * // returns false */ // MODULES // /* removed: var _$f_84 = require( './main.js' ); */; // EXPORTS // var _$isArray_83 = _$f_84; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // MAIN // /** * Tests if a value is an object; e.g., `{}`. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an object * * @example * var bool = isObject( {} ); * // returns true * * @example * var bool = isObject( null ); * // returns false */ function isObject( value ) { return ( typeof value === 'object' && value !== null && !_$isArray_83( value ) ); } // EXPORTS // var _$isObject_152 = isObject; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an object. * * @module @stdlib/assert/is-object * * @example * var isObject = require( '@stdlib/assert/is-object' ); * * var bool = isObject( {} ); * // returns true * * bool = isObject( true ); * // returns false */ // MODULES // /* removed: var _$isObject_152 = require( './main.js' ); */; // EXPORTS // var _$isObject_151 = _$isObject_152; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable no-underscore-dangle, no-proto */ 'use strict'; // MODULES // /* removed: var _$hasProp_57 = require( '@stdlib/assert/has-property' ); */; /* removed: var _$isObject_151 = require( '@stdlib/assert/is-object' ); */; // VARIABLES // var objectProtoype = Object.prototype; var defineGetter = objectProtoype.__defineGetter__; var defineSetter = objectProtoype.__defineSetter__; var lookupGetter = objectProtoype.__lookupGetter__; var lookupSetter = objectProtoype.__lookupSetter__; // MAIN // /** * Defines (or modifies) an object property. * * ## Notes * * - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both. * * @param {Object} obj - object on which to define the property * @param {string} prop - property name * @param {Object} descriptor - property descriptor * @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object * @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties * @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator * @param {*} [descriptor.value] - property value * @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value. * @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned. * @throws {TypeError} first argument must be an object * @throws {TypeError} third argument must be an object * @throws {Error} property descriptor cannot have both a value and a setter and/or getter * @returns {Object} object with added property * * @example * var obj = {}; * * defineProperty( obj, 'foo', { * 'value': 'bar' * }); * * var str = obj.foo; * // returns 'bar' */ function __defineProperty_826( obj, prop, descriptor ) { var prototype; var hasValue; var hasGet; var hasSet; if ( !_$isObject_151( obj ) ) { throw new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' ); } if ( !_$isObject_151( descriptor ) ) { throw new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' ); } hasValue = _$hasProp_57( descriptor, 'value' ); if ( hasValue ) { if ( lookupGetter.call( obj, prop ) || lookupSetter.call( obj, prop ) ) { // Override `__proto__` to avoid touching inherited accessors: prototype = obj.__proto__; obj.__proto__ = objectProtoype; // Delete property as existing getters/setters prevent assigning value to specified property: delete obj[ prop ]; obj[ prop ] = descriptor.value; // Restore original prototype: obj.__proto__ = prototype; } else { obj[ prop ] = descriptor.value; } } hasGet = _$hasProp_57( descriptor, 'get' ); hasSet = _$hasProp_57( descriptor, 'set' ); if ( hasValue && ( hasGet || hasSet ) ) { throw new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' ); } if ( hasGet && defineGetter ) { defineGetter.call( obj, prop, descriptor.get ); } if ( hasSet && defineSetter ) { defineSetter.call( obj, prop, descriptor.set ); } return obj; } // EXPORTS // var _$defineProperty_826 = __defineProperty_826; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Define (or modify) an object property. * * @module @stdlib/utils/define-property * * @example * var defineProperty = require( '@stdlib/utils/define-property' ); * * var obj = {}; * defineProperty( obj, 'foo', { * 'value': 'bar', * 'writable': false, * 'configurable': false, * 'enumerable': false * }); * obj.foo = 'boop'; // => throws */ // MODULES // /* removed: var _$hasDefinePropertySupport_35 = require( '@stdlib/assert/has-define-property-support' ); */; /* removed: var _$defineProperty_824 = require( './builtin.js' ); */; /* removed: var _$defineProperty_826 = require( './polyfill.js' ); */; // MAIN // var __defineProperty_825; if ( _$hasDefinePropertySupport_35() ) { __defineProperty_825 = _$defineProperty_824; } else { __defineProperty_825 = _$defineProperty_826; } // EXPORTS // var _$defineProperty_825 = __defineProperty_825; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; // MAIN // /** * Defines a read-only property. * * @param {Object} obj - object on which to define the property * @param {(string|symbol)} prop - property name * @param {*} value - value to set * * @example * var obj = {}; * * setReadOnly( obj, 'foo', 'bar' ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ function setReadOnly( obj, prop, value ) { _$defineProperty_825( obj, prop, { 'configurable': false, 'enumerable': true, 'writable': false, 'value': value }); } // EXPORTS // var _$setReadOnly_828 = setReadOnly; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Define a read-only property. * * @module @stdlib/utils/define-read-only-property * * @example * var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); * * var obj = {}; * * setReadOnly( obj, 'foo', 'bar' ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ // MODULES // /* removed: var _$setReadOnly_828 = require( './main.js' ); */; // EXPORTS // var _$setReadOnly_827 = _$setReadOnly_828; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; // MAIN // /** * Defines a non-enumerable read-only property. * * @param {Object} obj - object on which to define the property * @param {(string|symbol)} prop - property name * @param {*} value - value to set * * @example * var obj = {}; * * setNonEnumerableReadOnly( obj, 'foo', 'bar' ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ function setNonEnumerableReadOnly( obj, prop, value ) { _$defineProperty_825( obj, prop, { 'configurable': false, 'enumerable': false, 'writable': false, 'value': value }); } // EXPORTS // var _$setNonEnumerableReadOnly_821 = setNonEnumerableReadOnly; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Define a non-enumerable read-only property. * * @module @stdlib/utils/define-nonenumerable-read-only-property * * @example * var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); * * var obj = {}; * * setNonEnumerableReadOnly( obj, 'foo', 'bar' ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_821 = require( './main.js' ); */; // EXPORTS // var _$setNonEnumerableReadOnly_820 = _$setNonEnumerableReadOnly_821; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var objectCreate = Object.create || objectCreatePolyfill var objectKeys = Object.keys || objectKeysPolyfill var bind = Function.prototype.bind || functionBindPolyfill function EventEmitter() { if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { this._events = objectCreate(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || undefined; } var _$EventEmitter_917 = EventEmitter; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; var hasDefineProperty; try { var o = {}; if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); hasDefineProperty = o.x === 0; } catch (err) { hasDefineProperty = false } if (hasDefineProperty) { Object.defineProperty(EventEmitter, 'defaultMaxListeners', { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { // check whether the input is a positive number (whose value is zero or // greater and not a NaN). if (typeof arg !== 'number' || arg < 0 || arg !== arg) throw new TypeError('"defaultMaxListeners" must be a positive number'); defaultMaxListeners = arg; } }); } else { EventEmitter.defaultMaxListeners = defaultMaxListeners; } // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== 'number' || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number'); this._maxListeners = n; return this; }; function $getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return $getMaxListeners(this); }; // These standalone emit* functions are used to optimize calling of event // handlers for fast cases because emit() itself often has a variable number of // arguments and can be deoptimized because of that. These functions always have // the same number of arguments and thus do not get deoptimized, so the code // inside them can execute faster. function emitNone(handler, isFn, self) { if (isFn) handler.call(self); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self); } } function emitOne(handler, isFn, self, arg1) { if (isFn) handler.call(self, arg1); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1); } } function emitTwo(handler, isFn, self, arg1, arg2) { if (isFn) handler.call(self, arg1, arg2); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2); } } function emitThree(handler, isFn, self, arg1, arg2, arg3) { if (isFn) handler.call(self, arg1, arg2, arg3); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3); } } function emitMany(handler, isFn, self, args) { if (isFn) handler.apply(self, args); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].apply(self, args); } } EventEmitter.prototype.emit = function emit(type) { var er, handler, len, args, i, events; var doError = (type === 'error'); events = this._events; if (events) doError = (doError && events.error == null); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { if (arguments.length > 1) er = arguments[1]; if (er instanceof Error) { throw er; // Unhandled 'error' event } else { // At least give some kind of context to the user var err = new Error('Unhandled "error" event. (' + er + ')'); err.context = er; throw err; } return false; } handler = events[type]; if (!handler) return false; var isFn = typeof handler === 'function'; len = arguments.length; switch (len) { // fast cases case 1: emitNone(handler, isFn, this); break; case 2: emitOne(handler, isFn, this, arguments[1]); break; case 3: emitTwo(handler, isFn, this, arguments[1], arguments[2]); break; case 4: emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); break; // slower default: args = new Array(len - 1); for (i = 1; i < len; i++) args[i - 1] = arguments[i]; emitMany(handler, isFn, this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = target._events; if (!events) { events = target._events = objectCreate(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener) { target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object events = target._events; } existing = events[type]; } if (!existing) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = prepend ? [listener, existing] : [existing, listener]; } else { // If we've already got an array, just append. if (prepend) { existing.unshift(listener); } else { existing.push(listener); } } // Check for listener leak if (!existing.warned) { m = $getMaxListeners(target); if (m && m > 0 && existing.length > m) { existing.warned = true; var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' "' + String(type) + '" listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit.'); w.name = 'MaxListenersExceededWarning'; w.emitter = target; w.type = type; w.count = existing.length; if (typeof console === 'object' && console.warn) { console.warn('%s: %s', w.name, w.message); } } } } return target; } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; switch (arguments.length) { case 0: return this.listener.call(this.target); case 1: return this.listener.call(this.target, arguments[0]); case 2: return this.listener.call(this.target, arguments[0], arguments[1]); case 3: return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]); default: var args = new Array(arguments.length); for (var i = 0; i < args.length; ++i) args[i] = arguments[i]; this.listener.apply(this.target, args); } } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; var wrapped = bind.call(onceWrapper, state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // Emits a 'removeListener' event if and only if the listener was removed. EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = this._events; if (!events) return this; list = events[type]; if (!list) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = objectCreate(null); else { delete events[type]; if (events.removeListener) this.emit('removeListener', type, list.listener || listener); } } else if (typeof list !== 'function') { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else spliceOne(list, position); if (list.length === 1) events[type] = list[0]; if (events.removeListener) this.emit('removeListener', type, originalListener || listener); } return this; }; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (!events) return this; // not listening for removeListener, no need to emit if (!events.removeListener) { if (arguments.length === 0) { this._events = objectCreate(null); this._eventsCount = 0; } else if (events[type]) { if (--this._eventsCount === 0) this._events = objectCreate(null); else delete events[type]; } return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { var keys = objectKeys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = objectCreate(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === 'function') { this.removeListener(type, listeners); } else if (listeners) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (!events) return []; var evlistener = events[type]; if (!evlistener) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === 'function') { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; } else if (evlistener) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; }; // About 1.5x faster than the two-arg version of Array#splice(). function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k]; list.pop(); } function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function objectCreatePolyfill(proto) { var F = function() {}; F.prototype = proto; return new F; } function objectKeysPolyfill(obj) { var keys = []; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { keys.push(k); } return k; } function functionBindPolyfill(context) { var fn = this; return function () { return fn.apply(context, arguments); }; } /** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} [options] * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ var _$ms_922 = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); } else if (type === 'number' && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( 'val is not a non-empty string or a valid number. val=' + JSON.stringify(val) ); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; default: return undefined; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtShort(ms) { if (ms >= d) { return Math.round(ms / d) + 'd'; } if (ms >= h) { return Math.round(ms / h) + 'h'; } if (ms >= m) { return Math.round(ms / m) + 'm'; } if (ms >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtLong(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) { return; } if (ms < n * 1.5) { return Math.floor(ms / n) + ' ' + name; } return Math.ceil(ms / n) + ' ' + name + 's'; } var _$debug_914 = {}; /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. * * Expose `debug()` as the module. */ _$debug_914 = _$debug_914 = createDebug.debug = createDebug['default'] = createDebug; _$debug_914.coerce = coerce; _$debug_914.disable = disable; _$debug_914.enable = enable; _$debug_914.enabled = enabled; _$debug_914.humanize = _$ms_922; /** * The currently active debug mode names, and names to skip. */ _$debug_914.names = []; _$debug_914.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". */ _$debug_914.formatters = {}; /** * Previous log timestamp. */ var prevTime; /** * Select a color. * @param {String} namespace * @return {Number} * @api private */ function selectColor(namespace) { var hash = 0, i; for (i in namespace) { hash = ((hash << 5) - hash) + namespace.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return _$debug_914.colors[Math.abs(hash) % _$debug_914.colors.length]; } /** * Create a debugger with the given `namespace`. * * @param {String} namespace * @return {Function} * @api public */ function createDebug(namespace) { function debug() { // disabled? if (!debug.enabled) return; var self = debug; // set `diff` timestamp var curr = +new Date(); var ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; // turn the `arguments` into a proper Array var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } args[0] = _$debug_914.coerce(args[0]); if ('string' !== typeof args[0]) { // anything else let's inspect with %O args.unshift('%O'); } // apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { // if we encounter an escaped % then don't increase the array index if (match === '%%') return match; index++; var formatter = _$debug_914.formatters[format]; if ('function' === typeof formatter) { var val = args[index]; match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); // apply env-specific formatting (colors, etc.) _$debug_914.formatArgs.call(self, args); var logFn = debug.log || _$debug_914.log || console.log.bind(console); logFn.apply(self, args); } debug.namespace = namespace; debug.enabled = _$debug_914.enabled(namespace); debug.useColors = _$debug_914.useColors(); debug.color = selectColor(namespace); // env-specific initialization logic for debug instances if ('function' === typeof _$debug_914.init) { _$debug_914.init(debug); } return debug; } /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ function enable(namespaces) { _$debug_914.save(namespaces); _$debug_914.names = []; _$debug_914.skips = []; var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { if (!split[i]) continue; // ignore empty strings namespaces = split[i].replace(/\*/g, '.*?'); if (namespaces[0] === '-') { _$debug_914.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { _$debug_914.names.push(new RegExp('^' + namespaces + '$')); } } } /** * Disable debug output. * * @api public */ function disable() { _$debug_914.enable(''); } /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ function enabled(name) { var i, len; for (i = 0, len = _$debug_914.skips.length; i < len; i++) { if (_$debug_914.skips[i].test(name)) { return false; } } for (i = 0, len = _$debug_914.names.length; i < len; i++) { if (_$debug_914.names[i].test(name)) { return true; } } return false; } /** * Coerce `val`. * * @param {Mixed} val * @return {Mixed} * @api private */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } var _$browser_924 = {}; // shim for using process in browser var process = _$browser_924 = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; var _$browser_913 = {}; (function (process){ /** * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ _$browser_913 = _$browser_913 = _$debug_914; _$browser_913.log = log; _$browser_913.formatArgs = formatArgs; _$browser_913.save = save; _$browser_913.load = load; _$browser_913.useColors = useColors; _$browser_913.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); /** * Colors. */ _$browser_913.colors = [ 'lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson' ]; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * TODO: add a `localStorage` variable to explicitly enable/disable colors */ function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { return true; } // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || // double check webkit in userAgent just in case we are in a worker (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ _$browser_913.formatters.j = function(v) { try { return JSON.stringify(v); } catch (err) { return '[UnexpectedJSONParseError]: ' + err.message; } }; /** * Colorize log arguments if enabled. * * @api public */ function formatArgs(args) { var useColors = this.useColors; args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + _$browser_913.humanize(this.diff); if (!useColors) return; var c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit') // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { // we only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log() { // this hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (null == namespaces) { _$browser_913.storage.removeItem('debug'); } else { _$browser_913.storage.debug = namespaces; } } catch(e) {} } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { r = _$browser_913.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; } /** * Enable namespaces listed in `localStorage.debug` initially. */ _$browser_913.enable(load()); /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage() { try { return window.localStorage; } catch (e) {} } }).call(this,_$browser_924) /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns an array of an object's own enumerable property names. * * ## Notes * * - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error. * * @private * @param {*} value - input object * @returns {Array} a list of own enumerable property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var k = keys( obj ); * // e.g., returns [ 'beep', 'foo' ] */ function keys( value ) { return Object.keys( Object( value ) ); } // EXPORTS // var _$keys_851 = keys; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_851 = require( './builtin.js' ); */; // FUNCTIONS // /** * Tests the built-in `Object.keys()` implementation when provided `arguments`. * * @private * @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys */ function test() { return ( _$keys_851( arguments ) || '' ).length !== 2; } // MAIN // /** * Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value. * * ## Notes * * - Safari 5.0 does **not** support `arguments` as an input value. * * @private * @returns {boolean} boolean indicating whether a built-in implementation supports `arguments` */ function check() { return test( 1, 2 ); } // EXPORTS // var _$check_854 = check; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var bool = ( typeof Object.keys !== 'undefined' ); // EXPORTS // var _$bool_856 = bool; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // MAIN // /** * Tests whether a value is an `arguments` object. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is an `arguments` object * * @example * function foo() { * return arguments; * } * * var bool = isArguments( foo() ); * // returns true * * @example * var bool = isArguments( [] ); * // returns false */ function isArguments( value ) { return ( _$nativeClass_874( value ) === '[object Arguments]' ); } // EXPORTS // var _$isArguments_79 = isArguments; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArguments_79 = require( './main.js' ); */; // VARIABLES // var __bool_77; // FUNCTIONS // /** * Detects whether an environment returns the expected internal class of the `arguments` object. * * @private * @returns {boolean} boolean indicating whether an environment behaves as expected * * @example * var bool = detect(); * // returns */ function detect() { return _$isArguments_79( arguments ); } // MAIN // __bool_77 = detect(); // EXPORTS // var _$bool_77 = __bool_77; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests if a value is a string primitive. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a string primitive * * @example * var bool = isString( 'beep' ); * // returns true * * @example * var bool = isString( new String( 'beep' ) ); * // returns false */ function isString( value ) { return ( typeof value === 'string' ); } // EXPORTS // var _$isString_167 = isString; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // eslint-disable-next-line stdlib/no-redeclare var valueOf = String.prototype.valueOf; // non-generic // EXPORTS // var _$valueOf_169 = valueOf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$valueOf_169 = require( './valueof.js' ); */; // eslint-disable-line stdlib/no-redeclare // MAIN // /** * Attempts to extract a string value. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating if a string can be extracted */ function __test_168( value ) { try { _$valueOf_169.call( value ); return true; } catch ( err ) { // eslint-disable-line no-unused-vars return false; } } // EXPORTS // var _$test_168 = __test_168; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasToStringTagSupport_61 = require( '@stdlib/assert/has-tostringtag-support' ); */; /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; /* removed: var _$test_168 = require( './try2valueof.js' ); */; // VARIABLES // var __FLG_166 = _$hasToStringTagSupport_61(); // MAIN // /** * Tests if a value is a string object. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a string object * * @example * var bool = isString( new String( 'beep' ) ); * // returns true * * @example * var bool = isString( 'beep' ); * // returns false */ function __isString_166( value ) { if ( typeof value === 'object' ) { if ( value instanceof String ) { return true; } if ( __FLG_166 ) { return _$test_168( value ); } return ( _$nativeClass_874( value ) === '[object String]' ); } return false; } // EXPORTS // var _$isString_166 = __isString_166; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isString_167 = require( './primitive.js' ); */; /* removed: var _$isString_166 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a string. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a string * * @example * var bool = isString( new String( 'beep' ) ); * // returns true * * @example * var bool = isString( 'beep' ); * // returns true */ function __isString_165( value ) { return ( _$isString_167( value ) || _$isString_166( value ) ); } // EXPORTS // var _$isString_165 = __isString_165; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a string. * * @module @stdlib/assert/is-string * * @example * var isString = require( '@stdlib/assert/is-string' ); * * var bool = isString( 'beep' ); * // returns true * * bool = isString( new String( 'beep' ) ); * // returns true * * bool = isString( 5 ); * // returns false * * @example * var isString = require( '@stdlib/assert/is-string' ).isObject; * * var bool = isString( new String( 'beep' ) ); * // returns true * * bool = isString( 'beep' ); * // returns false * * @example * var isString = require( '@stdlib/assert/is-string' ).isPrimitive; * * var bool = isString( 'beep' ); * // returns true * * bool = isString( new String( 'beep' ) ); * // returns false */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isString_165 = require( './main.js' ); */; /* removed: var _$isString_167 = require( './primitive.js' ); */; /* removed: var _$isString_166 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isString_165, 'isPrimitive', _$isString_167 ); _$setNonEnumerableReadOnly_820( _$isString_165, 'isObject', _$isString_166 ); // EXPORTS // var _$isString_164 = _$isString_165; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests if a value is a number primitive. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive * * @example * var bool = isNumber( 3.14 ); * // returns true * * @example * var bool = isNumber( NaN ); * // returns true * * @example * var bool = isNumber( new Number( 3.14 ) ); * // returns false */ function isNumber( value ) { return ( typeof value === 'number' ); } // EXPORTS // var _$isNumber_146 = isNumber; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // EXPORTS // var _$Number_241 = Number; // eslint-disable-line stdlib/require-globals /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Constructor which returns a `Number` object. * * @module @stdlib/number/ctor * * @example * var Number = require( '@stdlib/number/ctor' ); * * var v = new Number( 10.0 ); * // returns */ // MODULES // /* removed: var _$Number_241 = require( './number.js' ); */; // EXPORTS // var _$Number_240 = _$Number_241; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$Number_240 = require( '@stdlib/number/ctor' ); */; // MAIN // // eslint-disable-next-line stdlib/no-redeclare var toString = _$Number_240.prototype.toString; // non-generic // EXPORTS // var _$toString_147 = toString; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // eslint-disable-next-line stdlib/no-redeclare var __toString_90 = Boolean.prototype.toString; // non-generic // EXPORTS // var _$toString_90 = __toString_90; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$toString_90 = require( './tostring.js' ); */; // eslint-disable-line stdlib/no-redeclare // MAIN // /** * Attempts to serialize a value to a string. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating if a value can be serialized */ function __test_91( value ) { try { _$toString_90.call( value ); return true; } catch ( err ) { // eslint-disable-line no-unused-vars return false; } } // EXPORTS // var _$test_91 = __test_91; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$toString_147 = require( './tostring.js' ); */; // eslint-disable-line stdlib/no-redeclare // MAIN // /** * Attempts to serialize a value to a string. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating if a value can be serialized */ function __test_148( value ) { try { _$toString_147.call( value ); return true; } catch ( err ) { // eslint-disable-line no-unused-vars return false; } } // EXPORTS // var _$test_148 = __test_148; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasToStringTagSupport_61 = require( '@stdlib/assert/has-tostringtag-support' ); */; /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; /* removed: var _$Number_240 = require( '@stdlib/number/ctor' ); */; /* removed: var _$test_148 = require( './try2serialize.js' ); */; // VARIABLES // var __FLG_145 = _$hasToStringTagSupport_61(); // MAIN // /** * Tests if a value is a number object. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object * * @example * var bool = isNumber( 3.14 ); * // returns false * * @example * var bool = isNumber( new Number( 3.14 ) ); * // returns true */ function __isNumber_145( value ) { if ( typeof value === 'object' ) { if ( value instanceof _$Number_240 ) { return true; } if ( __FLG_145 ) { return _$test_148( value ); } return ( _$nativeClass_874( value ) === '[object Number]' ); } return false; } // EXPORTS // var _$isNumber_145 = __isNumber_145; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNumber_146 = require( './primitive.js' ); */; /* removed: var _$isNumber_145 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a number. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a number * * @example * var bool = isNumber( 3.14 ); * // returns true * * @example * var bool = isNumber( new Number( 3.14 ) ); * // returns true * * @example * var bool = isNumber( NaN ); * // returns true * * @example * var bool = isNumber( null ); * // returns false */ function __isNumber_144( value ) { return ( _$isNumber_146( value ) || _$isNumber_145( value ) ); } // EXPORTS // var _$isNumber_144 = __isNumber_144; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a number. * * @module @stdlib/assert/is-number * * @example * var isNumber = require( '@stdlib/assert/is-number' ); * * var bool = isNumber( 3.14 ); * // returns true * * bool = isNumber( new Number( 3.14 ) ); * // returns true * * bool = isNumber( NaN ); * // returns true * * bool = isNumber( null ); * // returns false * * @example * var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; * * var bool = isNumber( 3.14 ); * // returns true * * bool = isNumber( NaN ); * // returns true * * bool = isNumber( new Number( 3.14 ) ); * // returns false * * @example * var isNumber = require( '@stdlib/assert/is-number' ).isObject; * * var bool = isNumber( 3.14 ); * // returns false * * bool = isNumber( new Number( 3.14 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isNumber_144 = require( './main.js' ); */; /* removed: var _$isNumber_146 = require( './primitive.js' ); */; /* removed: var _$isNumber_145 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isNumber_144, 'isPrimitive', _$isNumber_146 ); _$setNonEnumerableReadOnly_820( _$isNumber_144, 'isObject', _$isNumber_145 ); // EXPORTS // var _$isNumber_143 = _$isNumber_144; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests if a numeric value is `NaN`. * * @param {number} x - value to test * @returns {boolean} boolean indicating whether the value is `NaN` * * @example * var bool = isnan( NaN ); * // returns true * * @example * var bool = isnan( 7.0 ); * // returns false */ function isnan( x ) { return ( x !== x ); } // EXPORTS // var _$isnan_225 = isnan; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a numeric value is `NaN`. * * @module @stdlib/math/base/assert/is-nan * * @example * var isnan = require( '@stdlib/math/base/assert/is-nan' ); * * var bool = isnan( NaN ); * // returns true * * bool = isnan( 7.0 ); * // returns false */ // MODULES // /* removed: var _$isnan_225 = require( './is_nan.js' ); */; // EXPORTS // var _$isnan_224 = _$isnan_225; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_131 = _$isNumber_143.isPrimitive; /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; // MAIN // /** * Tests if a value is a `NaN` number primitive. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a `NaN` number primitive * * @example * var bool = isnan( NaN ); * // returns true * * @example * var bool = isnan( 3.14 ); * // returns false * * @example * var bool = isnan( new Number( NaN ) ); * // returns false */ function __isnan_131( value ) { return ( __isNumber_131( value ) && _$isnan_224( value ) ); } // EXPORTS // var _$isnan_131 = __isnan_131; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_130 = _$isNumber_143.isObject; /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; // MAIN // /** * Tests if a value is a number object having a value of `NaN`. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having a value of `NaN` * * @example * var bool = isnan( NaN ); * // returns false * * @example * var bool = isnan( new Number( NaN ) ); * // returns true */ function __isnan_130( value ) { return ( __isNumber_130( value ) && _$isnan_224( value.valueOf() ) ); } // EXPORTS // var _$isnan_130 = __isnan_130; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isnan_131 = require( './primitive.js' ); */; /* removed: var _$isnan_130 = require( './object.js' ); */; // MAIN // /** * Tests if a value is `NaN`. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is `NaN` * * @example * var bool = isnan( NaN ); * // returns true * * @example * var bool = isnan( new Number( NaN ) ); * // returns true * * @example * var bool = isnan( 3.14 ); * // returns false * * @example * var bool = isnan( null ); * // returns false */ function __isnan_129( value ) { return ( _$isnan_131( value ) || _$isnan_130( value ) ); } // EXPORTS // var _$isnan_129 = __isnan_129; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is `NaN`. * * @module @stdlib/assert/is-nan * * @example * var isnan = require( '@stdlib/assert/is-nan' ); * * var bool = isnan( NaN ); * // returns true * * bool = isnan( new Number( NaN ) ); * // returns true * * bool = isnan( 3.14 ); * // returns false * * bool = isnan( null ); * // returns false * * @example * var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; * * var bool = isnan( NaN ); * // returns true * * bool = isnan( 3.14 ); * // returns false * * bool = isnan( new Number( NaN ) ); * // returns false * * @example * var isnan = require( '@stdlib/assert/is-nan' ).isObject; * * var bool = isnan( NaN ); * // returns false * * bool = isnan( new Number( NaN ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isnan_129 = require( './main.js' ); */; /* removed: var _$isnan_131 = require( './primitive.js' ); */; /* removed: var _$isnan_130 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isnan_129, 'isPrimitive', _$isnan_131 ); _$setNonEnumerableReadOnly_820( _$isnan_129, 'isObject', _$isnan_130 ); // EXPORTS // var _$isnan_128 = _$isnan_129; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Double-precision floating-point positive infinity. * * @module @stdlib/constants/math/float64-pinf * @type {number} * * @example * var FLOAT64_PINF = require( '@stdlib/constants/math/float64-pinf' ); * // returns Infinity */ // MAIN // /** * Double-precision floating-point positive infinity. * * ## Notes * * Double-precision floating-point positive infinity has the bit sequence * * ```binarystring * 0 11111111111 00000000000000000000 00000000000000000000000000000000 * ``` * * @constant * @type {number} * @default Number.POSITIVE_INFINITY * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$FLOAT64_PINF_207 = FLOAT64_PINF; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Double-precision floating-point negative infinity. * * @module @stdlib/constants/math/float64-ninf * @type {number} * * @example * var FLOAT64_NINF = require( '@stdlib/constants/math/float64-ninf' ); * // returns -Infinity */ // MODULES // /* removed: var _$Number_240 = require( '@stdlib/number/ctor' ); */; // MAIN // /** * Double-precision floating-point negative infinity. * * ## Notes * * Double-precision floating-point negative infinity has the bit sequence * * ```binarystring * 1 11111111111 00000000000000000000 00000000000000000000000000000000 * ``` * * @constant * @type {number} * @default Number.NEGATIVE_INFINITY * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_NINF = _$Number_240.NEGATIVE_INFINITY; // EXPORTS // var _$FLOAT64_NINF_206 = FLOAT64_NINF; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: implementation (?) /** * Rounds a numeric value toward negative infinity. * * @param {number} x - input value * @returns {number} rounded value * * @example * var v = floor( -4.2 ); * // returns -5.0 * * @example * var v = floor( 9.99999 ); * // returns 9.0 * * @example * var v = floor( 0.0 ); * // returns 0.0 * * @example * var v = floor( NaN ); * // returns NaN */ var floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math // EXPORTS // var _$floor_234 = floor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Round a numeric value toward negative infinity. * * @module @stdlib/math/base/special/floor * * @example * var floor = require( '@stdlib/math/base/special/floor' ); * * var v = floor( -4.2 ); * // returns -5.0 * * v = floor( 9.99999 ); * // returns 9.0 * * v = floor( 0.0 ); * // returns 0.0 * * v = floor( NaN ); * // returns NaN */ // MODULES // /* removed: var _$floor_234 = require( './floor.js' ); */; // EXPORTS // var _$floor_235 = _$floor_234; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$floor_235 = require( '@stdlib/math/base/special/floor' ); */; // MAIN // /** * Tests if a finite double-precision floating-point number is an integer. * * @param {number} x - value to test * @returns {boolean} boolean indicating whether the value is an integer * * @example * var bool = isInteger( 1.0 ); * // returns true * * @example * var bool = isInteger( 3.14 ); * // returns false */ function isInteger( x ) { return (_$floor_235(x) === x); } // EXPORTS // var _$isInteger_223 = isInteger; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a finite double-precision floating-point number is an integer. * * @module @stdlib/math/base/assert/is-integer * * @example * var isInteger = require( '@stdlib/math/base/assert/is-integer' ); * * var bool = isInteger( 1.0 ); * // returns true * * bool = isInteger( 3.14 ); * // returns false */ // MODULES // /* removed: var _$isInteger_223 = require( './is_integer.js' ); */; // EXPORTS // var _$isInteger_222 = _$isInteger_223; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; /* removed: var _$isInteger_222 = require( '@stdlib/math/base/assert/is-integer' ); */; // MAIN // /** * Tests if a number primitive is an integer value. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating if a number primitive is an integer value */ function __isInteger_121( value ) { return ( value < _$FLOAT64_PINF_207 && value > _$FLOAT64_NINF_206 && _$isInteger_222( value ) ); } // EXPORTS // var _$isInteger_121 = __isInteger_121; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_124 = _$isNumber_143.isPrimitive; /* removed: var _$isInteger_121 = require( './integer.js' ); */; // MAIN // /** * Tests if a value is a number primitive having an integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive having an integer value * * @example * var bool = isInteger( -3.0 ); * // returns true * * @example * var bool = isInteger( new Number( -3.0 ) ); * // returns false */ function __isInteger_124( value ) { return ( __isNumber_124( value ) && _$isInteger_121( value ) ); } // EXPORTS // var _$isInteger_124 = __isInteger_124; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_123 = _$isNumber_143.isObject; /* removed: var _$isInteger_121 = require( './integer.js' ); */; // MAIN // /** * Tests if a value is a number object having an integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having an integer value * * @example * var bool = isInteger( 3.0 ); * // returns false * * @example * var bool = isInteger( new Number( 3.0 ) ); * // returns true */ function __isInteger_123( value ) { return ( __isNumber_123( value ) && _$isInteger_121( value.valueOf() ) ); } // EXPORTS // var _$isInteger_123 = __isInteger_123; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInteger_124 = require( './primitive.js' ); */; /* removed: var _$isInteger_123 = require( './object.js' ); */; // MAIN // /** * Tests if a value is an integer. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an integer * * @example * var bool = isInteger( 5.0 ); * // returns true * * @example * var bool = isInteger( new Number( 5.0 ) ); * // returns true * * @example * var bool = isInteger( -3.14 ); * // returns false * * @example * var bool = isInteger( null ); * // returns false */ function __isInteger_122( value ) { return ( _$isInteger_124( value ) || _$isInteger_123( value ) ); } // EXPORTS // var _$isInteger_122 = __isInteger_122; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an integer. * * @module @stdlib/assert/is-integer * * @example * var isInteger = require( '@stdlib/assert/is-integer' ); * * var bool = isInteger( 5.0 ); * // returns true * * bool = isInteger( new Number( 5.0 ) ); * // returns true * * bool = isInteger( -3.14 ); * // returns false * * bool = isInteger( null ); * // returns false * * @example * // Use interface to check for integer primitives... * var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; * * var bool = isInteger( -3.0 ); * // returns true * * bool = isInteger( new Number( -3.0 ) ); * // returns false * * @example * // Use interface to check for integer objects... * var isInteger = require( '@stdlib/assert/is-integer' ).isObject; * * var bool = isInteger( 3.0 ); * // returns false * * bool = isInteger( new Number( 3.0 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isInteger_122 = require( './main.js' ); */; /* removed: var _$isInteger_124 = require( './primitive.js' ); */; /* removed: var _$isInteger_123 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isInteger_122, 'isPrimitive', _$isInteger_124 ); _$setNonEnumerableReadOnly_820( _$isInteger_122, 'isObject', _$isInteger_123 ); // EXPORTS // var _$isInteger_120 = _$isInteger_122; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests if an object's own property is enumerable. * * @private * @name isEnumerableProperty * @type {Function} * @param {*} value - value to test * @param {*} property - property to test * @returns {boolean} boolean indicating if an object property is enumerable * * @example * var beep = { * 'boop': true * }; * * var bool = isEnumerableProperty( beep, 'boop' ); * // returns true * * @example * var beep = { * 'boop': true * }; * * var bool = isEnumerableProperty( beep, 'hasOwnProperty' ); * // returns false */ var isEnumerableProperty = Object.prototype.propertyIsEnumerable; // EXPORTS // var _$isEnumerableProperty_101 = isEnumerableProperty; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isEnumerableProperty_101 = require( './native.js' ); */; // VARIABLES // var __bool_98; // FUNCTIONS // /** * Detects whether an environment has a bug where String indices are not detected as "enumerable" properties. Observed in Node v0.10. * * @private * @returns {boolean} boolean indicating whether an environment has the bug */ function __detect_98() { return !_$isEnumerableProperty_101.call( 'beep', '0' ); } // MAIN // __bool_98 = __detect_98(); // EXPORTS // var _$bool_98 = __bool_98; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isString_164 = require( '@stdlib/assert/is-string' ); */; var __isnan_100 = _$isnan_128.isPrimitive; var __isInteger_100 = _$isInteger_120.isPrimitive; /* removed: var _$isEnumerableProperty_101 = require( './native.js' ); */; /* removed: var _$bool_98 = require( './has_string_enumerability_bug.js' ); */; // MAIN // /** * Tests if an object's own property is enumerable. * * @param {*} value - value to test * @param {*} property - property to test * @returns {boolean} boolean indicating if an object property is enumerable * * @example * var beep = { * 'boop': true * }; * * var bool = isEnumerableProperty( beep, 'boop' ); * // returns true * * @example * var beep = { * 'boop': true * }; * * var bool = isEnumerableProperty( beep, 'hasOwnProperty' ); * // returns false */ function __isEnumerableProperty_100( value, property ) { var bool; if ( value === void 0 || value === null ) { return false; } bool = _$isEnumerableProperty_101.call( value, property ); if ( !bool && _$bool_98 && _$isString_164( value ) ) { // Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above. property = +property; return ( !__isnan_100( property ) && __isInteger_100( property ) && property >= 0 && property < value.length ); } return bool; } // EXPORTS // var _$isEnumerableProperty_100 = __isEnumerableProperty_100; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test whether an object's own property is enumerable. * * @module @stdlib/assert/is-enumerable-property * * @example * var isEnumerableProperty = require( '@stdlib/assert/is-enumerable-property' ); * * var beep = { * 'boop': true * }; * * var bool = isEnumerableProperty( beep, 'boop' ); * // returns true * * bool = isEnumerableProperty( beep, 'hasOwnProperty' ); * // returns false */ // MODULES // /* removed: var _$isEnumerableProperty_100 = require( './main.js' ); */; // EXPORTS // var _$isEnumerableProperty_99 = _$isEnumerableProperty_100; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum unsigned 32-bit integer. * * @module @stdlib/constants/math/uint32-max * @type {uinteger32} * * @example * var UINT32_MAX = require( '@stdlib/constants/math/uint32-max' ); * // returns 4294967295 */ // MAIN // /** * Maximum unsigned 32-bit integer. * * ## Notes * * The number has the value * * ```tex * 2^{32} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 11111111111111111111111111111111 * ``` * * @constant * @type {uinteger32} * @default 4294967295 */ var UINT32_MAX = 4294967295; // EXPORTS // var _$UINT32_MAX_216 = UINT32_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$isEnumerableProperty_99 = require( '@stdlib/assert/is-enumerable-property' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; /* removed: var _$isInteger_222 = require( '@stdlib/math/base/assert/is-integer' ); */; /* removed: var _$UINT32_MAX_216 = require( '@stdlib/constants/math/uint32-max' ); */; // MAIN // /** * Tests whether a value is an `arguments` object. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is an `arguments` object * * @example * function foo() { * return arguments; * } * * var bool = isArguments( foo() ); * // returns true * * @example * var bool = isArguments( [] ); * // returns false */ function __isArguments_80( value ) { return ( value !== null && typeof value === 'object' && !_$isArray_83( value ) && typeof value.length === 'number' && _$isInteger_222( value.length ) && value.length >= 0 && value.length <= _$UINT32_MAX_216 && _$hasOwnProp_55( value, 'callee' ) && !_$isEnumerableProperty_99( value, 'callee' ) ); } // EXPORTS // var _$isArguments_80 = __isArguments_80; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an `arguments` object. * * @module @stdlib/assert/is-arguments * * @example * var isArguments = require( '@stdlib/assert/is-arguments' ); * * function foo() { * return arguments; * } * * var bool = isArguments( foo() ); * // returns true * * bool = isArguments( [] ); * // returns false */ // MODULES // /* removed: var _$bool_77 = require( './detect.js' ); */; /* removed: var _$isArguments_79 = require( './main.js' ); */; /* removed: var _$isArguments_80 = require( './polyfill.js' ); */; // MAIN // var __isArguments_78; if ( _$bool_77 ) { __isArguments_78 = _$isArguments_79; } else { __isArguments_78 = _$isArguments_80; } // EXPORTS // var _$isArguments_78 = __isArguments_78; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArguments_78 = require( '@stdlib/assert/is-arguments' ); */; /* removed: var _$keys_851 = require( './builtin.js' ); */; // VARIABLES // var slice = Array.prototype.slice; // MAIN // /** * Returns an array of an object's own enumerable property names. * * @private * @param {*} value - input object * @returns {Array} a list of own enumerable property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var k = keys( obj ); * // e.g., returns [ 'beep', 'foo' ] */ function __keys_852( value ) { if ( _$isArguments_78( value ) ) { return _$keys_851( slice.call( value ) ); } return _$keys_851( value ); } // EXPORTS // var _$keys_852 = __keys_852; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // MAIN // /** * Returns a function which tests if every element in an array passes a test condition. * * @param {Function} predicate - function to apply * @throws {TypeError} must provide a function * @returns {Function} an array function * * @example * var isOdd = require( '@stdlib/assert/is-odd' ); * * var arr1 = [ 1, 3, 5, 7 ]; * var arr2 = [ 3, 5, 8 ]; * * var validate = arrayfcn( isOdd ); * * var bool = validate( arr1 ); * // returns true * * bool = validate( arr2 ); * // returns false */ function arrayfcn( predicate ) { if ( typeof predicate !== 'function' ) { throw new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' ); } return every; /** * Tests if every element in an array passes a test condition. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition */ function every( value ) { var len; var i; if ( !_$isArray_83( value ) ) { return false; } len = value.length; if ( len === 0 ) { return false; } for ( i = 0; i < len; i++ ) { if ( predicate( value[ i ] ) === false ) { return false; } } return true; } } // EXPORTS // var _$arrayfcn_182 = arrayfcn; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a function which tests if every element in an array passes a test condition. * * @module @stdlib/assert/tools/array-function * * @example * var isOdd = require( '@stdlib/assert/is-odd' ); * var arrayfcn = require( '@stdlib/assert/tools/array-function' ); * * var arr1 = [ 1, 3, 5, 7 ]; * var arr2 = [ 3, 5, 8 ]; * * var validate = arrayfcn( isOdd ); * * var bool = validate( arr1 ); * // returns true * * bool = validate( arr2 ); * // returns false */ // MODULES // /* removed: var _$arrayfcn_182 = require( './arrayfcn.js' ); */; // EXPORTS // var _$arrayfcn_183 = _$arrayfcn_182; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests if a value is object-like. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is object-like * * @example * var bool = isObjectLike( {} ); * // returns true * * @example * var bool = isObjectLike( [] ); * // returns true * * @example * var bool = isObjectLike( null ); * // returns false */ function isObjectLike( value ) { return ( value !== null && typeof value === 'object' ); } // EXPORTS // var _$isObjectLike_150 = isObjectLike; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is object-like. * * @module @stdlib/assert/is-object-like * * @example * var isObjectLike = require( '@stdlib/assert/is-object-like' ); * * var bool = isObjectLike( {} ); * // returns true * * bool = isObjectLike( [] ); * // returns true * * bool = isObjectLike( null ); * // returns false * * @example * var isObjectLike = require( '@stdlib/assert/is-object-like' ).isObjectLikeArray; * * var bool = isObjectLike( [ {}, [] ] ); * // returns true * * bool = isObjectLike( [ {}, '3.0' ] ); * // returns false */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$arrayfcn_183 = require( '@stdlib/assert/tools/array-function' ); */; /* removed: var _$isObjectLike_150 = require( './main.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isObjectLike_150, 'isObjectLikeArray', _$arrayfcn_183( _$isObjectLike_150 ) ); // EXPORTS // var _$isObjectLike_149 = _$isObjectLike_150; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * No operation. * * @example * noop(); * // ...does nothing. */ function __noop_880() { // Empty function... } // EXPORTS // var _$noop_880 = __noop_880; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * No operation. * * @module @stdlib/utils/noop * * @example * var noop = require( '@stdlib/utils/noop' ); * * noop(); * // ...does nothing. */ // MODULES // /* removed: var _$noop_880 = require( './noop.js' ); */; // EXPORTS // var _$noop_879 = _$noop_880; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isEnumerableProperty_99 = require( '@stdlib/assert/is-enumerable-property' ); */; /* removed: var _$noop_879 = require( '@stdlib/utils/noop' ); */; // MAIN // // Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be... var __bool_857 = _$isEnumerableProperty_99( _$noop_879, 'prototype' ); // EXPORTS // var _$bool_857 = __bool_857; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isEnumerableProperty_99 = require( '@stdlib/assert/is-enumerable-property' ); */; // VARIABLES // var obj = { 'toString': null }; // MAIN // // Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable... var __bool_858 = !_$isEnumerableProperty_99( obj, 'toString' ); // EXPORTS // var _$bool_858 = __bool_858; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum length of a typed array. * * @module @stdlib/constants/array/max-typed-array-length * * @example * var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants/array/max-typed-array-length' ); * // returns 9007199254740991 */ // MAIN // /** * Maximum length of a typed array. * * ```tex * 2^{53} - 1 * ``` * * @constant * @type {number} * @default 9007199254740991 */ var MAX_TYPED_ARRAY_LENGTH = 9007199254740991; // EXPORTS // var _$MAX_TYPED_ARRAY_LENGTH_197 = MAX_TYPED_ARRAY_LENGTH; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInteger_222 = require( '@stdlib/math/base/assert/is-integer' ); */; /* removed: var _$MAX_TYPED_ARRAY_LENGTH_197 = require( '@stdlib/constants/array/max-typed-array-length' ); */; // MAIN // /** * Tests if a value is a collection. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is a collection * * @example * var bool = isCollection( [] ); * // returns true * * @example * var bool = isCollection( {} ); * // returns false */ function isCollection( value ) { return ( typeof value === 'object' && value !== null && typeof value.length === 'number' && _$isInteger_222( value.length ) && value.length >= 0 && value.length <= _$MAX_TYPED_ARRAY_LENGTH_197 ); } // EXPORTS // var _$isCollection_95 = isCollection; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a collection. * * @module @stdlib/assert/is-collection * * @example * var isCollection = require( '@stdlib/assert/is-collection' ); * * var bool = isCollection( [] ); * // returns true * * bool = isCollection( {} ); * // returns false */ // MODULES // /* removed: var _$isCollection_95 = require( './main.js' ); */; // EXPORTS // var _$isCollection_94 = _$isCollection_95; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isnan_128 = require( '@stdlib/assert/is-nan' ); */; /* removed: var _$isCollection_94 = require( '@stdlib/assert/is-collection' ); */; var __isString_844 = _$isString_164.isPrimitive; var __isInteger_844 = _$isInteger_120.isPrimitive; // MAIN // /** * Returns the first index at which a given element can be found. * * @param {ArrayLike} arr - array-like object * @param {*} searchElement - element to find * @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element) * @throws {TypeError} must provide an array-like object * @throws {TypeError} `fromIndex` must be an integer * @returns {integer} index or -1 * * @example * var arr = [ 4, 3, 2, 1 ]; * var idx = indexOf( arr, 3 ); * // returns 1 * * @example * var arr = [ 4, 3, 2, 1 ]; * var idx = indexOf( arr, 5 ); * // returns -1 * * @example * // Using a `fromIndex`: * var arr = [ 1, 2, 3, 4, 5, 2, 6 ]; * var idx = indexOf( arr, 2, 3 ); * // returns 5 * * @example * // `fromIndex` which exceeds `array` length: * var arr = [ 1, 2, 3, 4, 2, 5 ]; * var idx = indexOf( arr, 2, 10 ); * // returns -1 * * @example * // Negative `fromIndex`: * var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ]; * var idx = indexOf( arr, 2, -4 ); * // returns 5 * * idx = indexOf( arr, 2, -1 ); * // returns 7 * * @example * // Negative `fromIndex` exceeding input `array` length: * var arr = [ 1, 2, 3, 4, 5, 2, 6 ]; * var idx = indexOf( arr, 2, -10 ); * // returns 1 * * @example * // Array-like objects: * var str = 'bebop'; * var idx = indexOf( str, 'o' ); * // returns 3 */ function indexOf( arr, searchElement, fromIndex ) { var len; var i; if ( !_$isCollection_94( arr ) && !__isString_844( arr ) ) { throw new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' ); } len = arr.length; if ( len === 0 ) { return -1; } if ( arguments.length === 3 ) { if ( !__isInteger_844( fromIndex ) ) { throw new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' ); } if ( fromIndex >= 0 ) { if ( fromIndex >= len ) { return -1; } i = fromIndex; } else { i = len + fromIndex; if ( i < 0 ) { i = 0; } } } else { i = 0; } // Check for `NaN`... if ( _$isnan_128( searchElement ) ) { for ( ; i < len; i++ ) { if ( _$isnan_128( arr[i] ) ) { return i; } } } else { for ( ; i < len; i++ ) { if ( arr[ i ] === searchElement ) { return i; } } } return -1; } // EXPORTS // var _$indexOf_844 = indexOf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return the first index at which a given element can be found. * * @module @stdlib/utils/index-of * * @example * var indexOf = require( '@stdlib/utils/index-of' ); * * var arr = [ 4, 3, 2, 1 ]; * var idx = indexOf( arr, 3 ); * // returns 1 * * arr = [ 4, 3, 2, 1 ]; * idx = indexOf( arr, 5 ); * // returns -1 * * // Using a `fromIndex`: * arr = [ 1, 2, 3, 4, 5, 2, 6 ]; * idx = indexOf( arr, 2, 3 ); * // returns 5 * * // `fromIndex` which exceeds `array` length: * arr = [ 1, 2, 3, 4, 2, 5 ]; * idx = indexOf( arr, 2, 10 ); * // returns -1 * * // Negative `fromIndex`: * arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ]; * idx = indexOf( arr, 2, -4 ); * // returns 5 * * idx = indexOf( arr, 2, -1 ); * // returns 7 * * // Negative `fromIndex` exceeding input `array` length: * arr = [ 1, 2, 3, 4, 5, 2, 6 ]; * idx = indexOf( arr, 2, -10 ); * // returns 1 * * // Array-like objects: * var str = 'bebop'; * idx = indexOf( str, 'o' ); * // returns 3 */ // MODULES // /* removed: var _$indexOf_844 = require( './index_of.js' ); */; // EXPORTS // var _$indexOf_843 = _$indexOf_844; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var RE = /./; // EXPORTS // var _$RE_895 = RE; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests if a value is a boolean primitive. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a boolean primitive * * @example * var bool = isBoolean( true ); * // returns true * * @example * var bool = isBoolean( false ); * // returns true * * @example * var bool = isBoolean( new Boolean( true ) ); * // returns false */ function isBoolean( value ) { return ( typeof value === 'boolean' ); } // EXPORTS // var _$isBoolean_89 = isBoolean; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasToStringTagSupport_61 = require( '@stdlib/assert/has-tostringtag-support' ); */; /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; /* removed: var _$test_91 = require( './try2serialize.js' ); */; // VARIABLES // var __FLG_88 = _$hasToStringTagSupport_61(); // MAIN // /** * Tests if a value is a boolean object. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a boolean object * * @example * var bool = isBoolean( true ); * // returns false * * @example * var bool = isBoolean( new Boolean( false ) ); * // returns true */ function __isBoolean_88( value ) { if ( typeof value === 'object' ) { if ( value instanceof Boolean ) { return true; } if ( __FLG_88 ) { return _$test_91( value ); } return ( _$nativeClass_874( value ) === '[object Boolean]' ); } return false; } // EXPORTS // var _$isBoolean_88 = __isBoolean_88; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isBoolean_89 = require( './primitive.js' ); */; /* removed: var _$isBoolean_88 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a boolean. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a boolean * * @example * var bool = isBoolean( false ); * // returns true * * @example * var bool = isBoolean( true ); * // returns true * * @example * var bool = isBoolean( new Boolean( false ) ); * // returns true * * @example * var bool = isBoolean( new Boolean( true ) ); * // returns true */ function __isBoolean_87( value ) { return ( _$isBoolean_89( value ) || _$isBoolean_88( value ) ); } // EXPORTS // var _$isBoolean_87 = __isBoolean_87; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a boolean. * * @module @stdlib/assert/is-boolean * * @example * var isBoolean = require( '@stdlib/assert/is-boolean' ); * * var bool = isBoolean( false ); * // returns true * * bool = isBoolean( new Boolean( false ) ); * // returns true * * @example * // Use interface to check for boolean primitives... * var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; * * var bool = isBoolean( false ); * // returns true * * bool = isBoolean( new Boolean( true ) ); * // returns false * * @example * // Use interface to check for boolean objects... * var isBoolean = require( '@stdlib/assert/is-boolean' ).isObject; * * var bool = isBoolean( true ); * // returns false * * bool = isBoolean( new Boolean( false ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isBoolean_87 = require( './main.js' ); */; /* removed: var _$isBoolean_89 = require( './primitive.js' ); */; /* removed: var _$isBoolean_88 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isBoolean_87, 'isPrimitive', _$isBoolean_89 ); _$setNonEnumerableReadOnly_820( _$isBoolean_87, 'isObject', _$isBoolean_88 ); // EXPORTS // var _$isBoolean_86 = _$isBoolean_87; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns the global object using code generation. * * @private * @returns {Object} global object */ function getGlobal() { return new Function( 'return this;' )(); // eslint-disable-line no-new-func } // EXPORTS // var _$getGlobal_835 = getGlobal; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __obj_839 = ( typeof self === 'object' ) ? self : null; // EXPORTS // var _$obj_839 = __obj_839; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __obj_840 = ( typeof window === 'object' ) ? window : null; // EXPORTS // var _$obj_840 = __obj_840; var _$obj_836 = {}; (function (global){ /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var obj = ( typeof global === 'object' ) ? global : null; // EXPORTS // _$obj_836 = obj; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_838 = _$isBoolean_86.isPrimitive; /* removed: var _$getGlobal_835 = require( './codegen.js' ); */; /* removed: var _$obj_839 = require( './self.js' ); */; /* removed: var _$obj_840 = require( './window.js' ); */; /* removed: var _$obj_836 = require( './global.js' ); */; // MAIN // /** * Returns the global object. * * ## Notes * * - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere. * * @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object * @throws {TypeError} must provide a boolean * @throws {Error} unable to resolve global object * @returns {Object} global object * * @example * var g = getGlobal(); * // returns {...} */ function __getGlobal_838( codegen ) { if ( arguments.length ) { if ( !__isBoolean_838( codegen ) ) { throw new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' ); } if ( codegen ) { return _$getGlobal_835(); } // Fall through... } // Case: browsers and web workers if ( _$obj_839 ) { return _$obj_839; } // Case: browsers if ( _$obj_840 ) { return _$obj_840; } // Case: Node.js if ( _$obj_836 ) { return _$obj_836; } // Case: unknown throw new Error( 'unexpected error. Unable to resolve global object.' ); } // EXPORTS // var _$getGlobal_838 = __getGlobal_838; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return the global object. * * @module @stdlib/utils/global * * @example * var getGlobal = require( '@stdlib/utils/global' ); * * var g = getGlobal(); * // returns {...} */ // MODULES // /* removed: var _$getGlobal_838 = require( './main.js' ); */; // EXPORTS // var _$getGlobal_837 = _$getGlobal_838; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$getGlobal_837 = require( '@stdlib/utils/global' ); */; // MAIN // var root = _$getGlobal_837(); var nodeList = root.document && root.document.childNodes; // EXPORTS // var _$nodeList_894 = nodeList; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var typedarray = Int8Array; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$typedarray_896 = typedarray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$RE_895 = require( './fixtures/re.js' ); */; /* removed: var _$nodeList_894 = require( './fixtures/nodelist.js' ); */; /* removed: var _$typedarray_896 = require( './fixtures/typedarray.js' ); */; // MAIN // /** * Checks whether a polyfill is needed when using the `typeof` operator. * * @private * @returns {boolean} boolean indicating whether a polyfill is needed */ function __check_893() { if ( // Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof): typeof _$RE_895 === 'function' || // Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929): typeof _$typedarray_896 === 'object' || // PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236): typeof _$nodeList_894 === 'function' ) { return true; } return false; } // EXPORTS // var _$check_893 = __check_893; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis. * * @module @stdlib/regexp/function-name * @type {RegExp} * * @example * var RE_FUNCTION_NAME = require( '@stdlib/regexp/function-name' ); * * function fname( fcn ) { * return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ]; * } * * var fn = fname( Math.sqrt ); * // returns 'sqrt' * * fn = fname( Int8Array ); * // returns 'Int8Array' * * fn = fname( Object.prototype.toString ); * // returns 'toString' * * fn = fname( function(){} ); * // returns '' */ // MAIN // /** * Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis. * * Regular expression: `/^\s*function\s*([^(]*)/i` * * - `/^\s*` * - Match zero or more spaces at beginning * * - `function` * - Match the word `function` * * - `\s*` * - Match zero or more spaces after the word `function` * * - `()` * - Capture * * - `[^(]*` * - Match anything except a left parenthesis `(` zero or more times * * - `/i` * - ignore case * * @constant * @type {RegExp} * @default /^\s*function\s*([^(]*)/i */ var RE_FUNCTION_NAME = /^\s*function\s*([^(]*)/i; // EXPORTS // var _$RE_FUNCTION_NAME_808 = RE_FUNCTION_NAME; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isObjectLike_149 = require( '@stdlib/assert/is-object-like' ); */; // MAIN // /** * Tests if a value is a Buffer instance. * * @param {*} value - value to validate * @returns {boolean} boolean indicating if a value is a Buffer instance * * @example * var v = isBuffer( new Buffer( 'beep' ) ); * // returns true * * @example * var v = isBuffer( new Buffer( [1,2,3,4] ) ); * // returns true * * @example * var v = isBuffer( {} ); * // returns false * * @example * var v = isBuffer( [] ); * // returns false */ function isBuffer( value ) { return ( _$isObjectLike_149( value ) && ( // eslint-disable-next-line no-underscore-dangle value._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7) ( value.constructor && // WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions typeof value.constructor.isBuffer === 'function' && value.constructor.isBuffer( value ) ) ) ); } // EXPORTS // var _$isBuffer_93 = isBuffer; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Buffer instance. * * @module @stdlib/assert/is-buffer * * @example * var isBuffer = require( '@stdlib/assert/is-buffer' ); * * var v = isBuffer( new Buffer( 'beep' ) ); * // returns true * * v = isBuffer( {} ); * // returns false */ // MODULES // /* removed: var _$isBuffer_93 = require( './main.js' ); */; // EXPORTS // var _$isBuffer_92 = _$isBuffer_93; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; /* removed: var _$RE_FUNCTION_NAME_808 = require( '@stdlib/regexp/function-name' ); */; /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; // MAIN // /** * Determines the name of a value's constructor. * * @param {*} v - input value * @returns {string} name of a value's constructor * * @example * var v = constructorName( 'a' ); * // returns 'String' * * @example * var v = constructorName( 5 ); * // returns 'Number' * * @example * var v = constructorName( null ); * // returns 'Null' * * @example * var v = constructorName( undefined ); * // returns 'Undefined' * * @example * var v = constructorName( function noop() {} ); * // returns 'Function' */ function constructorName( v ) { var match; var name; var ctor; name = _$nativeClass_874( v ).slice( 8, -1 ); if ( (name === 'Object' || name === 'Error') && v.constructor ) { ctor = v.constructor; if ( typeof ctor.name === 'string' ) { return ctor.name; } match = _$RE_FUNCTION_NAME_808.exec( ctor.toString() ); if ( match ) { return match[ 1 ]; } } if ( _$isBuffer_92( v ) ) { return 'Buffer'; } return name; } // EXPORTS // var _$constructorName_813 = constructorName; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Determine the name of a value's constructor. * * @module @stdlib/utils/constructor-name * * @example * var constructorName = require( '@stdlib/utils/constructor-name' ); * * var v = constructorName( 'a' ); * // returns 'String' * * v = constructorName( {} ); * // returns 'Object' * * v = constructorName( true ); * // returns 'Boolean' */ // MODULES // /* removed: var _$constructorName_813 = require( './main.js' ); */; // EXPORTS // var _$constructorName_812 = _$constructorName_813; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$constructorName_812 = require( '@stdlib/utils/constructor-name' ); */; // NOTES // /* * Built-in `typeof` operator behavior: * * ```text * typeof null => 'object' * typeof undefined => 'undefined' * typeof 'a' => 'string' * typeof 5 => 'number' * typeof NaN => 'number' * typeof true => 'boolean' * typeof false => 'boolean' * typeof {} => 'object' * typeof [] => 'object' * typeof function foo(){} => 'function' * typeof function* foo(){} => 'object' * typeof Symbol() => 'symbol' * ``` * */ // MAIN // /** * Determines a value's type. * * @param {*} v - input value * @returns {string} string indicating the value's type */ function typeOf( v ) { var type; // Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null): if ( v === null ) { return 'null'; } type = typeof v; // If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor. if ( type === 'object' ) { return _$constructorName_812( v ).toLowerCase(); } return type; } // EXPORTS // var _$typeOf_899 = typeOf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$constructorName_812 = require( '@stdlib/utils/constructor-name' ); */; // MAIN // /** * Determines a value's type. * * @param {*} v - input value * @returns {string} string indicating the value's type */ function __typeOf_898( v ) { return _$constructorName_812( v ).toLowerCase(); } // EXPORTS // var _$typeOf_898 = __typeOf_898; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Determine a value's type. * * @module @stdlib/utils/type-of * * @example * var typeOf = require( '@stdlib/utils/type-of' ); * * var str = typeOf( 'a' ); * // returns 'string' * * str = typeOf( 5 ); * // returns 'number' */ // MODULES // /* removed: var _$check_893 = require( './check.js' ); */; /* removed: var _$typeOf_899 = require( './typeof.js' ); */; /* removed: var _$typeOf_898 = require( './polyfill.js' ); */; // MAIN // var __main_897 = ( _$check_893() ) ? _$typeOf_898 : _$typeOf_899; // EXPORTS // var _$main_897 = __main_897; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests whether a value equals the prototype of its constructor. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value equals the prototype of its constructor */ function isConstructorPrototype( value ) { return ( value.constructor && value.constructor.prototype === value ); } // EXPORTS // var _$isConstructorPrototype_861 = isConstructorPrototype; var _$excluded_keys_853=[ "console", "external", "frame", "frameElement", "frames", "innerHeight", "innerWidth", "outerHeight", "outerWidth", "pageXOffset", "pageYOffset", "parent", "scrollLeft", "scrollTop", "scrollX", "scrollY", "self", "webkitIndexedDB", "webkitStorageInfo", "window" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var w = ( typeof window === 'undefined' ) ? void 0 : window; // EXPORTS // var _$w_866 = w; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$main_897 = require( '@stdlib/utils/type-of' ); */; /* removed: var _$isConstructorPrototype_861 = require( './is_constructor_prototype.js' ); */; /* removed: var _$excluded_keys_853 = require( './excluded_keys.json' ); */; /* removed: var _$w_866 = require( './window.js' ); */; // VARIABLES // var __bool_855; // FUNCTIONS // /** * Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]). * * [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable * * @private * @returns {boolean} boolean indicating whether an environment is buggy */ function __check_855() { var k; if ( _$main_897( _$w_866 ) === 'undefined' ) { return false; } for ( k in _$w_866 ) { // eslint-disable-line guard-for-in try { if ( _$indexOf_843( _$excluded_keys_853, k ) === -1 && _$hasOwnProp_55( _$w_866, k ) && _$w_866[ k ] !== null && _$main_897( _$w_866[ k ] ) === 'object' ) { _$isConstructorPrototype_861( _$w_866[ k ] ); } } catch ( err ) { // eslint-disable-line no-unused-vars return true; } } return false; } // MAIN // __bool_855 = __check_855(); // EXPORTS // var _$bool_855 = __bool_855; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __bool_859 = ( typeof window !== 'undefined' ); // EXPORTS // var _$bool_859 = __bool_859; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$bool_855 = require( './has_automation_equality_bug.js' ); */; /* removed: var _$isConstructorPrototype_861 = require( './is_constructor_prototype.js' ); */; /* removed: var _$bool_859 = require( './has_window.js' ); */; // MAIN // /** * Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality). * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value equals the prototype of its constructor */ function wrapper( value ) { if ( _$bool_859 === false && !_$bool_855 ) { return _$isConstructorPrototype_861( value ); } try { return _$isConstructorPrototype_861( value ); } catch ( error ) { // eslint-disable-line no-unused-vars return false; } } // EXPORTS // var _$wrapper_862 = wrapper; var _$non_enumerable_864=[ "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isObjectLike_149 = require( '@stdlib/assert/is-object-like' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$isArguments_78 = require( '@stdlib/assert/is-arguments' ); */; /* removed: var _$bool_857 = require( './has_enumerable_prototype_bug.js' ); */; /* removed: var _$bool_858 = require( './has_non_enumerable_properties_bug.js' ); */; /* removed: var _$wrapper_862 = require( './is_constructor_prototype_wrapper.js' ); */; /* removed: var _$non_enumerable_864 = require( './non_enumerable.json' ); */; // MAIN // /** * Returns an array of an object's own enumerable property names. * * @private * @param {*} value - input object * @returns {Array} a list of own enumerable property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var k = keys( obj ); * // e.g., returns [ 'beep', 'foo' ] */ function __keys_865( value ) { var skipConstructor; var skipPrototype; var isFcn; var out; var k; var p; var i; out = []; if ( _$isArguments_78( value ) ) { // Account for environments which treat `arguments` differently... for ( i = 0; i < value.length; i++ ) { out.push( i.toString() ); } // Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization). return out; } if ( typeof value === 'string' ) { // Account for environments which do not treat string character indices as "own" properties... if ( value.length > 0 && !_$hasOwnProp_55( value, '0' ) ) { for ( i = 0; i < value.length; i++ ) { out.push( i.toString() ); } } } else { isFcn = ( typeof value === 'function' ); if ( isFcn === false && !_$isObjectLike_149( value ) ) { return out; } skipPrototype = ( _$bool_857 && isFcn ); } for ( k in value ) { if ( !( skipPrototype && k === 'prototype' ) && _$hasOwnProp_55( value, k ) ) { out.push( String( k ) ); } } if ( _$bool_858 ) { skipConstructor = _$wrapper_862( value ); for ( i = 0; i < _$non_enumerable_864.length; i++ ) { p = _$non_enumerable_864[ i ]; if ( !( skipConstructor && p === 'constructor' ) && _$hasOwnProp_55( value, p ) ) { out.push( String( p ) ); } } } return out; } // EXPORTS // var _$keys_865 = __keys_865; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$check_854 = require( './has_arguments_bug.js' ); */; /* removed: var _$bool_856 = require( './has_builtin.js' ); */; /* removed: var _$keys_851 = require( './builtin.js' ); */; /* removed: var _$keys_852 = require( './builtin_wrapper.js' ); */; /* removed: var _$keys_865 = require( './polyfill.js' ); */; // MAIN // /** * Returns an array of an object's own enumerable property names. * * @name keys * @type {Function} * @param {*} value - input object * @returns {Array} a list of own enumerable property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var k = keys( obj ); * // e.g., returns [ 'beep', 'foo' ] */ var __keys_863; if ( _$bool_856 ) { if ( _$check_854() ) { __keys_863 = _$keys_852; } else { __keys_863 = _$keys_851; } } else { __keys_863 = _$keys_865; } // EXPORTS // var _$keys_863 = __keys_863; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return an array of an object's own enumerable property names. * * @module @stdlib/utils/keys * * @example * var keys = require( '@stdlib/utils/keys' ); * * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var k = keys( obj ); * // e.g., returns [ 'beep', 'foo' ] */ // MODULES // /* removed: var _$keys_863 = require( './main.js' ); */; // EXPORTS // var _$keys_860 = _$keys_863; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$main_897 = require( '@stdlib/utils/type-of' ); */; // MAIN // /** * Tests if a value is a function. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a function * * @example * function beep() { * return 'beep'; * } * * var bool = isFunction( beep ); * // returns true */ function isFunction( value ) { // Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists. return ( _$main_897( value ) === 'function' ); } // EXPORTS // var _$isFunction_113 = isFunction; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a function. * * @module @stdlib/assert/is-function * * @example * var isFunction = require( '@stdlib/assert/is-function' ); * * function beep() { * return 'beep'; * } * * var bool = isFunction( beep ); * // returns true */ // MODULES // /* removed: var _$isFunction_113 = require( './main.js' ); */; // EXPORTS // var _$isFunction_112 = _$isFunction_113; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var getProto = Object.getPrototypeOf; // EXPORTS // var _$getProto_832 = getProto; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the value of the `__proto__` property. * * @private * @param {Object} obj - input object * @returns {*} value of `__proto__` property */ function __getProto_834( obj ) { // eslint-disable-next-line no-proto return obj.__proto__; } // EXPORTS // var _$getProto_834 = __getProto_834; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; /* removed: var _$getProto_834 = require( './proto.js' ); */; // MAIN // /** * Returns the prototype of a provided object. * * @private * @param {Object} obj - input object * @returns {(Object|null)} prototype */ function getPrototypeOf( obj ) { var proto = _$getProto_834( obj ); if ( proto || proto === null ) { return proto; } if ( _$nativeClass_874( obj.constructor ) === '[object Function]' ) { // May break if the constructor has been tampered with... return obj.constructor.prototype; } if ( obj instanceof Object ) { return Object.prototype; } // Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11. return null; } // EXPORTS // var _$getPrototypeOf_833 = getPrototypeOf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; /* removed: var _$getProto_832 = require( './native.js' ); */; /* removed: var _$getPrototypeOf_833 = require( './polyfill.js' ); */; // MAIN // var __getProto_829; if ( _$isFunction_112( Object.getPrototypeOf ) ) { __getProto_829 = _$getProto_832; } else { __getProto_829 = _$getPrototypeOf_833; } // EXPORTS // var _$getProto_829 = __getProto_829; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$getProto_829 = require( './detect.js' ); */; // MAIN // /** * Returns the prototype of a provided object. * * @param {*} value - input value * @returns {(Object|null)} prototype * * @example * var proto = getPrototypeOf( {} ); * // returns {} */ function __getPrototypeOf_830( value ) { if ( value === null || value === void 0 ) { return null; } // In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts: value = Object( value ); return _$getProto_829( value ); } // EXPORTS // var _$getPrototypeOf_830 = __getPrototypeOf_830; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return the prototype of a provided object. * * @module @stdlib/utils/get-prototype-of * * @example * var getPrototype = require( '@stdlib/utils/get-prototype-of' ); * * var proto = getPrototype( {} ); * // returns {} */ // MODULES // /* removed: var _$getPrototypeOf_830 = require( './get_prototype_of.js' ); */; // EXPORTS // var _$getPrototype_831 = _$getPrototypeOf_830; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isObject_151 = require( '@stdlib/assert/is-object' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; /* removed: var _$getPrototype_831 = require( '@stdlib/utils/get-prototype-of' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var objectPrototype = Object.prototype; // FUNCTIONS // /** * Tests that an object only has own properties. * * @private * @param {Object} obj - value to test * @returns {boolean} boolean indicating if an object only has own properties */ function ownProps( obj ) { var key; // NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing). for ( key in obj ) { if ( !_$hasOwnProp_55( obj, key ) ) { return false; } } return true; } // MAIN // /** * Tests if a value is a plain object. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a plain object * * @example * var bool = isPlainObject( {} ); * // returns true * * @example * var bool = isPlainObject( null ); * // returns false */ function isPlainObject( value ) { var proto; // Screen for obvious non-objects... if ( !_$isObject_151( value ) ) { return false; } // Objects with no prototype (e.g., `Object.create( null )`) are plain... proto = _$getPrototype_831( value ); if ( !proto ) { return true; } // Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object... return ( // Cannot have own `constructor` property: !_$hasOwnProp_55( value, 'constructor' ) && // Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing): _$hasOwnProp_55( proto, 'constructor' ) && _$isFunction_112( proto.constructor ) && _$nativeClass_874( proto.constructor ) === '[object Function]' && // Test for object-specific method: _$hasOwnProp_55( proto, 'isPrototypeOf' ) && _$isFunction_112( proto.isPrototypeOf ) && ( // Test if the prototype matches the global `Object` prototype (same realm): proto === objectPrototype || // Test that all properties are own properties (cross-realm; *most* likely a plain object): ownProps( value ) ) ); } // EXPORTS // var _$isPlainObject_154 = isPlainObject; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a plain object. * * @module @stdlib/assert/is-plain-object * * @example * var isPlainObject = require( '@stdlib/assert/is-plain-object' ); * * var bool = isPlainObject( {} ); * // returns true * * bool = isPlainObject( null ); * // returns false */ // MODULES // /* removed: var _$isPlainObject_154 = require( './main.js' ); */; // EXPORTS // var _$isPlainObject_153 = _$isPlainObject_154; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isInteger_139 = _$isInteger_120.isPrimitive; // MAIN // /** * Tests if a value is a number primitive having a nonnegative integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value * * @example * var bool = isNonNegativeInteger( 3.0 ); * // returns true * * @example * var bool = isNonNegativeInteger( new Number( 3.0 ) ); * // returns false */ function isNonNegativeInteger( value ) { return ( __isInteger_139( value ) && value >= 0 ); } // EXPORTS // var _$isNonNegativeInteger_139 = isNonNegativeInteger; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isInteger_138 = _$isInteger_120.isObject; // MAIN // /** * Tests if a value is a number object having a nonnegative integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value * * @example * var bool = isNonNegativeInteger( 3.0 ); * // returns false * * @example * var bool = isNonNegativeInteger( new Number( 3.0 ) ); * // returns true */ function __isNonNegativeInteger_138( value ) { return ( __isInteger_138( value ) && value.valueOf() >= 0 ); } // EXPORTS // var _$isNonNegativeInteger_138 = __isNonNegativeInteger_138; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNonNegativeInteger_139 = require( './primitive.js' ); */; /* removed: var _$isNonNegativeInteger_138 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a nonnegative integer. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a nonnegative integer * * @example * var bool = isNonNegativeInteger( 5.0 ); * // returns true * * @example * var bool = isNonNegativeInteger( new Number( 5.0 ) ); * // returns true * * @example * var bool = isNonNegativeInteger( -5.0 ); * // returns false * * @example * var bool = isNonNegativeInteger( 3.14 ); * // returns false * * @example * var bool = isNonNegativeInteger( null ); * // returns false */ function __isNonNegativeInteger_137( value ) { return ( _$isNonNegativeInteger_139( value ) || _$isNonNegativeInteger_138( value ) ); } // EXPORTS // var _$isNonNegativeInteger_137 = __isNonNegativeInteger_137; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a nonnegative integer. * * @module @stdlib/assert/is-nonnegative-integer * * @example * var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ); * * var bool = isNonNegativeInteger( 5.0 ); * // returns true * * bool = isNonNegativeInteger( new Number( 5.0 ) ); * // returns true * * bool = isNonNegativeInteger( -5.0 ); * // returns false * * bool = isNonNegativeInteger( 3.14 ); * // returns false * * bool = isNonNegativeInteger( null ); * // returns false * * @example * var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; * * var bool = isNonNegativeInteger( 3.0 ); * // returns true * * bool = isNonNegativeInteger( new Number( 3.0 ) ); * // returns false * * @example * var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isObject; * * var bool = isNonNegativeInteger( 3.0 ); * // returns false * * bool = isNonNegativeInteger( new Number( 3.0 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isNonNegativeInteger_137 = require( './main.js' ); */; /* removed: var _$isNonNegativeInteger_139 = require( './primitive.js' ); */; /* removed: var _$isNonNegativeInteger_138 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isNonNegativeInteger_137, 'isPrimitive', _$isNonNegativeInteger_139 ); _$setNonEnumerableReadOnly_820( _$isNonNegativeInteger_137, 'isObject', _$isNonNegativeInteger_138 ); // EXPORTS // var _$isNonNegativeInteger_136 = _$isNonNegativeInteger_137; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$getPrototype_831 = require( '@stdlib/utils/get-prototype-of' ); */; /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // MAIN // /** * Tests if a value is an `Error` object. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is an `Error` object * * @example * var bool = isError( new Error( 'beep' ) ); * // returns true * * @example * var bool = isError( {} ); * // returns false */ function isError( value ) { if ( typeof value !== 'object' || value === null ) { return false; } // Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)... if ( value instanceof Error ) { return true; } // Walk the prototype tree until we find an object having the desired native class... while ( value ) { if ( _$nativeClass_874( value ) === '[object Error]' ) { return true; } value = _$getPrototype_831( value ); } return false; } // EXPORTS // var _$isError_103 = isError; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an `Error` object. * * @module @stdlib/assert/is-error * * @example * var isError = require( '@stdlib/assert/is-error' ); * * var bool = isError( new Error( 'beep' ) ); * // returns true * * bool = isError( {} ); * // returns false */ // MODULES // /* removed: var _$isError_103 = require( './main.js' ); */; // EXPORTS // var _$isError_102 = _$isError_103; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Regular expression to parse a regular expression string. * * @module @stdlib/regexp/regexp * @type {RegExp} * * @example * var RE_REGEXP = require( '@stdlib/regexp/regexp' ); * * var bool = RE_REGEXP.test( '/^beep$/' ); * // returns true * * bool = RE_REGEXP.test( '' ); * // returns false * * @example * var RE_REGEXP = require( '@stdlib/regexp/regexp' ); * * var parts = RE_REGEXP.exec( '/^.*$/ig' ); * // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ] */ // MAIN // /** * Matches parts of a regular expression string. * * Regular expression: `/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/` * * - `/^\/` * - match a string that begins with a `/` * * - `()` * - capture * * - `(?:)+` * - capture, but do not remember, a group of characters which occur one or more times * * - `\\\/` * - match the literal `\/` * * - `|` * - OR * * - `[^\/]` * - anything which is not the literal `\/` * * - `\/` * - match the literal `/` * * - `([imgy]*)` * - capture any characters matching `imgy` occurring zero or more times * * - `$/` * - string end * * * @constant * @type {RegExp} * @default /^\/((?:\\\/|[^\/])+)\/([imgy]*)$/ */ var RE_REGEXP = /^\/((?:\\\/|[^\/])+)\/([imgy]*)$/; // eslint-disable-line no-useless-escape // EXPORTS // var _$RE_REGEXP_809 = RE_REGEXP; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_891 = _$isString_164.isPrimitive; /* removed: var _$RE_REGEXP_809 = require( '@stdlib/regexp/regexp' ); */; // MAIN // /** * Parses a regular expression string and returns a new regular expression. * * @param {string} str - regular expression string * @throws {TypeError} must provide a regular expression string * @returns {(RegExp|null)} regular expression or null * * @example * var re = reFromString( '/beep/' ); * // returns /beep/ */ function reFromString( str ) { if ( !__isString_891( str ) ) { throw new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' ); } // Capture the regular expression pattern and any flags: str = _$RE_REGEXP_809.exec( str ); // Create a new regular expression: return ( str ) ? new RegExp( str[1], str[2] ) : null; } // EXPORTS // var _$reFromString_891 = reFromString; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a regular expression from a regular expression string. * * @module @stdlib/utils/regexp-from-string * * @example * var reFromString = require( '@stdlib/utils/regexp-from-string' ); * * var re = reFromString( '/beep/' ); * // returns /beep/ */ // MODULES // /* removed: var _$reFromString_891 = require( './from_string.js' ); */; // EXPORTS // var _$reFromString_892 = _$reFromString_891; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __bool_888 = ( typeof Object.getOwnPropertyNames !== 'undefined' ); // EXPORTS // var _$bool_888 = __bool_888; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var propertyNames = Object.getOwnPropertyNames; // MAIN // /** * Returns an array of an object's own enumerable and non-enumerable property names. * * ## Notes * * - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error. * * @private * @param {*} value - input object * @returns {Array} a list of own property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var keys = getOwnPropertyNames( obj ); * // e.g., returns [ 'beep', 'foo' ] */ function getOwnPropertyNames( value ) { return propertyNames( Object( value ) ); } // EXPORTS // var _$getOwnPropertyNames_887 = getOwnPropertyNames; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; // MAIN // /** * Returns an array of an object's own enumerable and non-enumerable property names. * * ## Notes * * - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error. * - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names. * * @private * @param {*} value - input object * @returns {Array} a list of own property names * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var keys = getOwnPropertyNames( obj ); * // e.g., returns [ 'beep', 'foo' ] */ function __getOwnPropertyNames_890( value ) { return _$keys_860( Object( value ) ); } // EXPORTS // var _$getOwnPropertyNames_890 = __getOwnPropertyNames_890; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return an array of an object's own enumerable and non-enumerable property names. * * @module @stdlib/utils/property-names * * @example * var getOwnPropertyNames = require( '@stdlib/utils/property-names' ); * * var keys = getOwnPropertyNames({ * 'foo': 'bar', * 'beep': 'boop' * }); * // e.g., returns [ 'foo', 'beep' ] */ // MODULES // /* removed: var _$bool_888 = require( './has_builtin.js' ); */; /* removed: var _$getOwnPropertyNames_887 = require( './builtin.js' ); */; /* removed: var _$getOwnPropertyNames_890 = require( './polyfill.js' ); */; // MAIN // var __main_889; if ( _$bool_888 ) { __main_889 = _$getOwnPropertyNames_887; } else { __main_889 = _$getOwnPropertyNames_890; } // EXPORTS // var _$main_889 = __main_889; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __bool_884 = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' ); // EXPORTS // var _$bool_884 = __bool_884; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var propertyDescriptor = Object.getOwnPropertyDescriptor; // MAIN // /** * Returns a property descriptor for an object's own property. * * ## Notes * * - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error. * - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`. * * @private * @param {*} value - input object * @param {(string|symbol)} property - property * @returns {(Object|null)} property descriptor or null * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var desc = getOwnPropertyDescriptor( obj, 'foo' ); * // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14} */ function getOwnPropertyDescriptor( value, property ) { var desc; if ( value === null || value === void 0 ) { return null; } desc = propertyDescriptor( value, property ); return ( desc === void 0 ) ? null : desc; } // EXPORTS // var _$getOwnPropertyDescriptor_883 = getOwnPropertyDescriptor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; // MAIN // /** * Returns a property descriptor for an object's own property. * * ## Notes * * - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error. * - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`. * - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`. * * @private * @param {*} value - input object * @param {(string|symbol)} property - property * @returns {(Object|null)} property descriptor or null * * @example * var obj = { * 'beep': 'boop', * 'foo': 3.14 * }; * * var desc = getOwnPropertyDescriptor( obj, 'foo' ); * // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14} */ function __getOwnPropertyDescriptor_886( value, property ) { if ( _$hasOwnProp_55( value, property ) ) { return { 'configurable': true, 'enumerable': true, 'writable': true, 'value': value[ property ] }; } return null; } // EXPORTS // var _$getOwnPropertyDescriptor_886 = __getOwnPropertyDescriptor_886; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a property descriptor for an object's own property. * * @module @stdlib/utils/property-descriptor * * @example * var getOwnPropertyDescriptor = require( '@stdlib/utils/property-descriptor' ); * * var obj = { * 'foo': 'bar', * 'beep': 'boop' * }; * * var keys = getOwnPropertyDescriptor( obj, 'foo' ); * // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'} */ // MODULES // /* removed: var _$bool_884 = require( './has_builtin.js' ); */; /* removed: var _$getOwnPropertyDescriptor_883 = require( './builtin.js' ); */; /* removed: var _$getOwnPropertyDescriptor_886 = require( './polyfill.js' ); */; // MAIN // var __main_885; if ( _$bool_884 ) { __main_885 = _$getOwnPropertyDescriptor_883; } else { __main_885 = _$getOwnPropertyDescriptor_886; } // EXPORTS // var _$main_885 = __main_885; var _$base64Js_900 = {}; 'use strict' _$base64Js_900.byteLength = byteLength _$base64Js_900.toByteArray = toByteArray _$base64Js_900.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen var i for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } var _$ieee754_918 = {}; _$ieee754_918.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } _$ieee754_918.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } var _$main_52 = {}; (function (Buffer){ /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var main = ( typeof Buffer === 'function' ) ? Buffer : null; // eslint-disable-line stdlib/require-globals // EXPORTS // _$main_52 = main; }).call(this,_$buffer_902({}).Buffer) /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; /* removed: var _$main_52 = require( './buffer.js' ); */; // MAIN // /** * Tests for native `Buffer` support. * * @returns {boolean} boolean indicating if an environment has `Buffer` support * * @example * var bool = hasNodeBufferSupport(); * // returns */ function hasNodeBufferSupport() { var bool; var b; if ( typeof _$main_52 !== 'function' ) { return false; } // Test basic support... try { if ( typeof _$main_52.from === 'function' ) { b = _$main_52.from( [ 1, 2, 3, 4 ] ); } else { b = new _$main_52( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array) } bool = ( _$isBuffer_92( b ) && b[ 0 ] === 1 && b[ 1 ] === 2 && b[ 2 ] === 3 && b[ 3 ] === 4 ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasNodeBufferSupport_54 = hasNodeBufferSupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Buffer` support. * * @module @stdlib/assert/has-node-buffer-support * * @example * var hasNodeBufferSupport = require( '@stdlib/assert/has-node-buffer-support' ); * * var bool = hasNodeBufferSupport(); * // returns */ // MODULES // /* removed: var _$hasNodeBufferSupport_54 = require( './main.js' ); */; // EXPORTS // var _$hasNodeBufferSupport_53 = _$hasNodeBufferSupport_54; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var ctor = _$buffer_902({}).Buffer; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_189 = ctor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write (browser) polyfill // MAIN // /** * Buffer constructor. * * @throws {Error} not implemented */ function __polyfill_191() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_191 = __polyfill_191; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Buffer constructor. * * @module @stdlib/buffer/ctor * * @example * var ctor = require( '@stdlib/buffer/ctor' ); * * var b = new ctor( [ 1, 2, 3, 4 ] ); * // returns */ // MODULES // /* removed: var _$hasNodeBufferSupport_53 = require( '@stdlib/assert/has-node-buffer-support' ); */; /* removed: var _$ctor_189 = require( './buffer.js' ); */; /* removed: var _$polyfill_191 = require( './polyfill.js' ); */; // MAIN // var __ctor_190; if ( _$hasNodeBufferSupport_53() ) { __ctor_190 = _$ctor_189; } else { __ctor_190 = _$polyfill_191; } // EXPORTS // var _$ctor_190 = __ctor_190; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; /* removed: var _$ctor_190 = require( '@stdlib/buffer/ctor' ); */; // MAIN // var __bool_192 = _$isFunction_112( _$ctor_190.from ); // EXPORTS // var _$bool_192 = __bool_192; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; /* removed: var _$ctor_190 = require( '@stdlib/buffer/ctor' ); */; // MAIN // /** * Copies buffer data to a new `Buffer` instance. * * @param {Buffer} buffer - buffer from which to copy * @throws {TypeError} must provide a `Buffer` instance * @returns {Buffer} new `Buffer` instance * * @example * var fromArray = require( '@stdlib/buffer/from-array' ); * * var b1 = fromArray( [ 1, 2, 3, 4 ] ); * // returns * * var b2 = fromBuffer( b1 ); * // returns */ function fromBuffer( buffer ) { if ( !_$isBuffer_92( buffer ) ) { throw new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' ); } return _$ctor_190.from( buffer ); } // EXPORTS // var _$fromBuffer_194 = fromBuffer; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; /* removed: var _$ctor_190 = require( '@stdlib/buffer/ctor' ); */; // MAIN // /** * Copies buffer data to a new `Buffer` instance. * * @param {Buffer} buffer - buffer from which to copy * @throws {TypeError} must provide a `Buffer` instance * @returns {Buffer} new `Buffer` instance * * @example * var fromArray = require( '@stdlib/buffer/from-array' ); * * var b1 = fromArray( [ 1, 2, 3, 4 ] ); * // returns * * var b2 = fromBuffer( b1 ); * // returns */ function __fromBuffer_195( buffer ) { if ( !_$isBuffer_92( buffer ) ) { throw new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' ); } return new _$ctor_190( buffer ); // eslint-disable-line no-buffer-constructor } // EXPORTS // var _$fromBuffer_195 = __fromBuffer_195; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Copy buffer data to a new `Buffer` instance. * * @module @stdlib/buffer/from-buffer * * @example * var fromArray = require( '@stdlib/buffer/from-array' ); * var copyBuffer = require( '@stdlib/buffer/from-buffer' ); * * var b1 = fromArray( [ 1, 2, 3, 4 ] ); * // returns * * var b2 = copyBuffer( b1 ); * // returns */ // MODULES // /* removed: var _$bool_192 = require( './has_from.js' ); */; /* removed: var _$fromBuffer_194 = require( './main.js' ); */; /* removed: var _$fromBuffer_195 = require( './polyfill.js' ); */; // MAIN // var copyBuffer; if ( _$bool_192 ) { copyBuffer = _$fromBuffer_194; } else { copyBuffer = _$fromBuffer_195; } // EXPORTS // var _$copyBuffer_193 = copyBuffer; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is an Int8Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an Int8Array * * @example * var bool = isInt8Array( new Int8Array( 10 ) ); * // returns true * * @example * var bool = isInt8Array( [] ); * // returns false */ function isInt8Array( value ) { return ( ( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Int8Array]' ); } // EXPORTS // var _$isInt8Array_119 = isInt8Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an Int8Array. * * @module @stdlib/assert/is-int8array * * @example * var isInt8Array = require( '@stdlib/assert/is-int8array' ); * * var bool = isInt8Array( new Int8Array( 10 ) ); * // returns true * * bool = isInt8Array( [] ); * // returns false */ // MODULES // /* removed: var _$isInt8Array_119 = require( './main.js' ); */; // EXPORTS // var _$isInt8Array_118 = _$isInt8Array_119; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum signed 8-bit integer. * * @module @stdlib/constants/math/int8-max * @type {integer32} * * @example * var INT8_MAX = require( '@stdlib/constants/math/int8-max' ); * // returns 127 */ // MAIN // /** * Maximum signed 8-bit integer. * * ## Notes * * The number is given by * * ```tex * 2^{7} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 01111111 * ``` * * @constant * @type {integer32} * @default 127 */ var INT8_MAX = 127|0; // asm type annotation // EXPORTS // var _$INT8_MAX_213 = INT8_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Minimum signed 8-bit integer. * * @module @stdlib/constants/math/int8-min * @type {integer32} * * @example * var INT8_MIN = require( '@stdlib/constants/math/int8-min' ); * // returns -128 */ // MAIN // /** * Minimum signed 8-bit integer. * * ## Notes * * The number is given by * * ```tex * -(2^{7}) * ``` * * which corresponds to the two's complement bit sequence * * ```binarystring * 10000000 * ``` * * @constant * @type {integer32} * @default -128 */ var INT8_MIN = -128|0; // asm type annotation // EXPORTS // var _$INT8_MIN_214 = INT8_MIN; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_50 = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_50 = __main_50; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInt8Array_118 = require( '@stdlib/assert/is-int8array' ); */; /* removed: var _$INT8_MAX_213 = require( '@stdlib/constants/math/int8-max' ); */; /* removed: var _$INT8_MIN_214 = require( '@stdlib/constants/math/int8-min' ); */; /* removed: var _$main_50 = require( './int8array.js' ); */; // MAIN // /** * Tests for native `Int8Array` support. * * @returns {boolean} boolean indicating if an environment has `Int8Array` support * * @example * var bool = hasInt8ArraySupport(); * // returns */ function hasInt8ArraySupport() { var bool; var arr; if ( typeof _$main_50 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_50( [ 1, 3.14, -3.14, _$INT8_MAX_213+1 ] ); bool = ( _$isInt8Array_118( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === -3 && // truncation arr[ 3 ] === _$INT8_MIN_214 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasInt8ArraySupport_51 = hasInt8ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Int8Array` support. * * @module @stdlib/assert/has-int8array-support * * @example * var hasInt8ArraySupport = require( '@stdlib/assert/has-int8array-support' ); * * var bool = hasInt8ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasInt8ArraySupport_51 = require( './main.js' ); */; // EXPORTS // var _$hasInt8ArraySupport_49 = _$hasInt8ArraySupport_51; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_14 = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_14 = __ctor_14; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_15() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_15 = __polyfill_15; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order. * * @module @stdlib/array/int8 * * @example * var ctor = require( '@stdlib/array/int8' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasInt8ArraySupport_49 = require( '@stdlib/assert/has-int8array-support' ); */; /* removed: var _$ctor_14 = require( './int8array.js' ); */; /* removed: var _$polyfill_15 = require( './polyfill.js' ); */; // MAIN // var __ctor_13; if ( _$hasInt8ArraySupport_49() ) { __ctor_13 = _$ctor_14; } else { __ctor_13 = _$polyfill_15; } // EXPORTS // var _$ctor_13 = __ctor_13; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Uint8Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Uint8Array * * @example * var bool = isUint8Array( new Uint8Array( 10 ) ); * // returns true * * @example * var bool = isUint8Array( [] ); * // returns false */ function isUint8Array( value ) { return ( ( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Uint8Array]' ); } // EXPORTS // var _$isUint8Array_179 = isUint8Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Uint8Array. * * @module @stdlib/assert/is-uint8array * * @example * var isUint8Array = require( '@stdlib/assert/is-uint8array' ); * * var bool = isUint8Array( new Uint8Array( 10 ) ); * // returns true * * bool = isUint8Array( [] ); * // returns false */ // MODULES // /* removed: var _$isUint8Array_179 = require( './main.js' ); */; // EXPORTS // var _$isUint8Array_178 = _$isUint8Array_179; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum unsigned 8-bit integer. * * @module @stdlib/constants/math/uint8-max * @type {integer32} * * @example * var UINT8_MAX = require( '@stdlib/constants/math/uint8-max' ); * // returns 255 */ // MAIN // /** * Maximum unsigned 8-bit integer. * * ## Notes * * The number has the value * * ```tex * 2^{8} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 11111111 * ``` * * @constant * @type {integer32} * @default 255 */ var UINT8_MAX = 255|0; // asm type annotation // EXPORTS // var _$UINT8_MAX_217 = UINT8_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_71 = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_71 = __main_71; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isUint8Array_178 = require( '@stdlib/assert/is-uint8array' ); */; /* removed: var _$UINT8_MAX_217 = require( '@stdlib/constants/math/uint8-max' ); */; /* removed: var _$main_71 = require( './uint8array.js' ); */; // MAIN // /** * Tests for native `Uint8Array` support. * * @returns {boolean} boolean indicating if an environment has `Uint8Array` support * * @example * var bool = hasUint8ArraySupport(); * // returns */ function hasUint8ArraySupport() { var bool; var arr; if ( typeof _$main_71 !== 'function' ) { return false; } // Test basic support... try { arr = [ 1, 3.14, -3.14, _$UINT8_MAX_217+1, _$UINT8_MAX_217+2 ]; arr = new _$main_71( arr ); bool = ( _$isUint8Array_178( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === _$UINT8_MAX_217-2 && // truncation and wrap around arr[ 3 ] === 0 && // wrap around arr[ 4 ] === 1 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasUint8ArraySupport_70 = hasUint8ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Uint8Array` support. * * @module @stdlib/assert/has-uint8array-support * * @example * var hasUint8ArraySupport = require( '@stdlib/assert/has-uint8array-support' ); * * var bool = hasUint8ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasUint8ArraySupport_70 = require( './main.js' ); */; // EXPORTS // var _$hasUint8ArraySupport_69 = _$hasUint8ArraySupport_70; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_28 = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_28 = __ctor_28; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of 8-bit unsigned integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_27() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_27 = __polyfill_27; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order. * * @module @stdlib/array/uint8 * * @example * var ctor = require( '@stdlib/array/uint8' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasUint8ArraySupport_69 = require( '@stdlib/assert/has-uint8array-support' ); */; /* removed: var _$ctor_28 = require( './uint8array.js' ); */; /* removed: var _$polyfill_27 = require( './polyfill.js' ); */; // MAIN // var __ctor_26; if ( _$hasUint8ArraySupport_69() ) { __ctor_26 = _$ctor_28; } else { __ctor_26 = _$polyfill_27; } // EXPORTS // var _$ctor_26 = __ctor_26; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Uint8ClampedArray. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Uint8ClampedArray * * @example * var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) ); * // returns true * * @example * var bool = isUint8ClampedArray( [] ); * // returns false */ function isUint8ClampedArray( value ) { return ( ( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Uint8ClampedArray]' ); } // EXPORTS // var _$isUint8ClampedArray_181 = isUint8ClampedArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Uint8ClampedArray. * * @module @stdlib/assert/is-uint8clampedarray * * @example * var isUint8ClampedArray = require( '@stdlib/assert/is-uint8clampedarray' ); * * var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) ); * // returns true * * bool = isUint8ClampedArray( [] ); * // returns false */ // MODULES // /* removed: var _$isUint8ClampedArray_181 = require( './main.js' ); */; // EXPORTS // var _$isUint8ClampedArray_180 = _$isUint8ClampedArray_181; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_74 = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_74 = __main_74; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isUint8ClampedArray_180 = require( '@stdlib/assert/is-uint8clampedarray' ); */; /* removed: var _$main_74 = require( './uint8clampedarray.js' ); */; // MAIN // /** * Tests for native `Uint8ClampedArray` support. * * @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support * * @example * var bool = hasUint8ClampedArraySupport(); * // returns */ function hasUint8ClampedArraySupport() { // eslint-disable-line id-length var bool; var arr; if ( typeof _$main_74 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_74( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] ); bool = ( _$isUint8ClampedArray_180( arr ) && arr[ 0 ] === 0 && // clamped arr[ 1 ] === 0 && arr[ 2 ] === 1 && arr[ 3 ] === 3 && // round to nearest arr[ 4 ] === 5 && // round to nearest arr[ 5 ] === 255 && arr[ 6 ] === 255 // clamped ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasUint8ClampedArraySupport_73 = hasUint8ClampedArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Uint8ClampedArray` support. * * @module @stdlib/assert/has-uint8clampedarray-support * * @example * var hasUint8ClampedArraySupport = require( '@stdlib/assert/has-uint8clampedarray-support' ); * * var bool = hasUint8ClampedArraySupport(); * // returns */ // MODULES // /* removed: var _$hasUint8ClampedArraySupport_73 = require( './main.js' ); */; // EXPORTS // var _$hasUint8ClampedArraySupport_72 = _$hasUint8ClampedArraySupport_73; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_31 = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_31 = __ctor_31; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255. * * @throws {Error} not implemented */ function __polyfill_30() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_30 = __polyfill_30; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255. * * @module @stdlib/array/uint8c * * @example * var ctor = require( '@stdlib/array/uint8c' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasUint8ClampedArraySupport_72 = require( '@stdlib/assert/has-uint8clampedarray-support' ); */; // eslint-disable-line id-length /* removed: var _$ctor_31 = require( './uint8clampedarray.js' ); */; /* removed: var _$polyfill_30 = require( './polyfill.js' ); */; // MAIN // var __ctor_29; if ( _$hasUint8ClampedArraySupport_72() ) { __ctor_29 = _$ctor_31; } else { __ctor_29 = _$polyfill_30; } // EXPORTS // var _$ctor_29 = __ctor_29; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is an Int16Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an Int16Array * * @example * var bool = isInt16Array( new Int16Array( 10 ) ); * // returns true * * @example * var bool = isInt16Array( [] ); * // returns false */ function isInt16Array( value ) { return ( ( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Int16Array]' ); } // EXPORTS // var _$isInt16Array_115 = isInt16Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an Int16Array. * * @module @stdlib/assert/is-int16array * * @example * var isInt16Array = require( '@stdlib/assert/is-int16array' ); * * var bool = isInt16Array( new Int16Array( 10 ) ); * // returns true * * bool = isInt16Array( [] ); * // returns false */ // MODULES // /* removed: var _$isInt16Array_115 = require( './main.js' ); */; // EXPORTS // var _$isInt16Array_114 = _$isInt16Array_115; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum signed 16-bit integer. * * @module @stdlib/constants/math/int16-max * @type {integer32} * * @example * var INT16_MAX = require( '@stdlib/constants/math/int16-max' ); * // returns 32767 */ // MAIN // /** * Maximum signed 16-bit integer. * * ## Notes * * The number has the value * * ```tex * 2^{15} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 0111111111111111 * ``` * * @constant * @type {integer32} * @default 32767 */ var INT16_MAX = 32767|0; // asm type annotation // EXPORTS // var _$INT16_MAX_209 = INT16_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Minimum signed 16-bit integer. * * @module @stdlib/constants/math/int16-min * @type {integer32} * * @example * var INT16_MIN = require( '@stdlib/constants/math/int16-min' ); * // returns -32768 */ // MAIN // /** * Minimum signed 16-bit integer. * * ## Notes * * The number has the value * * ```tex * -(2^{15}) * ``` * * which corresponds to the two's complement bit sequence * * ```binarystring * 1000000000000000 * ``` * * @constant * @type {integer32} * @default -32768 */ var INT16_MIN = -32768|0; // asm type annotation // EXPORTS // var _$INT16_MIN_210 = INT16_MIN; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_44 = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_44 = __main_44; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInt16Array_114 = require( '@stdlib/assert/is-int16array' ); */; /* removed: var _$INT16_MAX_209 = require( '@stdlib/constants/math/int16-max' ); */; /* removed: var _$INT16_MIN_210 = require( '@stdlib/constants/math/int16-min' ); */; /* removed: var _$main_44 = require( './int16array.js' ); */; // MAIN // /** * Tests for native `Int16Array` support. * * @returns {boolean} boolean indicating if an environment has `Int16Array` support * * @example * var bool = hasInt16ArraySupport(); * // returns */ function hasInt16ArraySupport() { var bool; var arr; if ( typeof _$main_44 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_44( [ 1, 3.14, -3.14, _$INT16_MAX_209+1 ] ); bool = ( _$isInt16Array_114( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === -3 && // truncation arr[ 3 ] === _$INT16_MIN_210 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasInt16ArraySupport_45 = hasInt16ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Int16Array` support. * * @module @stdlib/assert/has-int16array-support * * @example * var hasInt16ArraySupport = require( '@stdlib/assert/has-int16array-support' ); * * var bool = hasInt16ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasInt16ArraySupport_45 = require( './main.js' ); */; // EXPORTS // var _$hasInt16ArraySupport_43 = _$hasInt16ArraySupport_45; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_8 = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_8 = __ctor_8; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_9() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_9 = __polyfill_9; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order. * * @module @stdlib/array/int16 * * @example * var ctor = require( '@stdlib/array/int16' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasInt16ArraySupport_43 = require( '@stdlib/assert/has-int16array-support' ); */; /* removed: var _$ctor_8 = require( './int16array.js' ); */; /* removed: var _$polyfill_9 = require( './polyfill.js' ); */; // MAIN // var __ctor_7; if ( _$hasInt16ArraySupport_43() ) { __ctor_7 = _$ctor_8; } else { __ctor_7 = _$polyfill_9; } // EXPORTS // var _$ctor_7 = __ctor_7; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Uint16Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Uint16Array * * @example * var bool = isUint16Array( new Uint16Array( 10 ) ); * // returns true * * @example * var bool = isUint16Array( [] ); * // returns false */ function isUint16Array( value ) { return ( ( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Uint16Array]' ); } // EXPORTS // var _$isUint16Array_175 = isUint16Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Uint16Array. * * @module @stdlib/assert/is-uint16array * * @example * var isUint16Array = require( '@stdlib/assert/is-uint16array' ); * * var bool = isUint16Array( new Uint16Array( 10 ) ); * // returns true * * bool = isUint16Array( [] ); * // returns false */ // MODULES // /* removed: var _$isUint16Array_175 = require( './main.js' ); */; // EXPORTS // var _$isUint16Array_174 = _$isUint16Array_175; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum unsigned 16-bit integer. * * @module @stdlib/constants/math/uint16-max * @type {integer32} * * @example * var UINT16_MAX = require( '@stdlib/constants/math/uint16-max' ); * // returns 65535 */ // MAIN // /** * Maximum unsigned 16-bit integer. * * ## Notes * * The number has the value * * ```tex * 2^{16} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 1111111111111111 * ``` * * @constant * @type {integer32} * @default 65535 */ var UINT16_MAX = 65535|0; // asm type annotation // EXPORTS // var _$UINT16_MAX_215 = UINT16_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_65 = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_65 = __main_65; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isUint16Array_174 = require( '@stdlib/assert/is-uint16array' ); */; /* removed: var _$UINT16_MAX_215 = require( '@stdlib/constants/math/uint16-max' ); */; /* removed: var _$main_65 = require( './uint16array.js' ); */; // MAIN // /** * Tests for native `Uint16Array` support. * * @returns {boolean} boolean indicating if an environment has `Uint16Array` support * * @example * var bool = hasUint16ArraySupport(); * // returns */ function hasUint16ArraySupport() { var bool; var arr; if ( typeof _$main_65 !== 'function' ) { return false; } // Test basic support... try { arr = [ 1, 3.14, -3.14, _$UINT16_MAX_215+1, _$UINT16_MAX_215+2 ]; arr = new _$main_65( arr ); bool = ( _$isUint16Array_174( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === _$UINT16_MAX_215-2 && // truncation and wrap around arr[ 3 ] === 0 && // wrap around arr[ 4 ] === 1 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasUint16ArraySupport_64 = hasUint16ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Uint16Array` support. * * @module @stdlib/assert/has-uint16array-support * * @example * var hasUint16ArraySupport = require( '@stdlib/assert/has-uint16array-support' ); * * var bool = hasUint16ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasUint16ArraySupport_64 = require( './main.js' ); */; // EXPORTS // var _$hasUint16ArraySupport_63 = _$hasUint16ArraySupport_64; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_22 = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_22 = __ctor_22; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of 16-bit unsigned integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_21() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_21 = __polyfill_21; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order. * * @module @stdlib/array/uint16 * * @example * var ctor = require( '@stdlib/array/uint16' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasUint16ArraySupport_63 = require( '@stdlib/assert/has-uint16array-support' ); */; /* removed: var _$ctor_22 = require( './uint16array.js' ); */; /* removed: var _$polyfill_21 = require( './polyfill.js' ); */; // MAIN // var __ctor_20; if ( _$hasUint16ArraySupport_63() ) { __ctor_20 = _$ctor_22; } else { __ctor_20 = _$polyfill_21; } // EXPORTS // var _$ctor_20 = __ctor_20; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is an Int32Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an Int32Array * * @example * var bool = isInt32Array( new Int32Array( 10 ) ); * // returns true * * @example * var bool = isInt32Array( [] ); * // returns false */ function isInt32Array( value ) { return ( ( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Int32Array]' ); } // EXPORTS // var _$isInt32Array_117 = isInt32Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an Int32Array. * * @module @stdlib/assert/is-int32array * * @example * var isInt32Array = require( '@stdlib/assert/is-int32array' ); * * var bool = isInt32Array( new Int32Array( 10 ) ); * // returns true * * bool = isInt32Array( [] ); * // returns false */ // MODULES // /* removed: var _$isInt32Array_117 = require( './main.js' ); */; // EXPORTS // var _$isInt32Array_116 = _$isInt32Array_117; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum signed 32-bit integer. * * @module @stdlib/constants/math/int32-max * @type {integer32} * * @example * var INT32_MAX = require( '@stdlib/constants/math/int32-max' ); * // returns 2147483647 */ // MAIN // /** * Maximum signed 32-bit integer. * * ## Notes * * The number has the value * * ```tex * 2^{31} - 1 * ``` * * which corresponds to the bit sequence * * ```binarystring * 01111111111111111111111111111111 * ``` * * @constant * @type {integer32} * @default 2147483647 */ var INT32_MAX = 2147483647|0; // asm type annotation // EXPORTS // var _$INT32_MAX_211 = INT32_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Minimum signed 32-bit integer. * * @module @stdlib/constants/math/int32-min * @type {integer32} * * @example * var INT32_MIN = require( '@stdlib/constants/math/int32-min' ); * // returns -2147483648 */ // MAIN // /** * Minimum signed 32-bit integer. * * ## Notes * * The number has the value * * ```tex * -(2^{31}) * ``` * * which corresponds to the two's complement bit sequence * * ```binarystring * 10000000000000000000000000000000 * ``` * * @constant * @type {integer32} * @default -2147483648 */ var INT32_MIN = -2147483648|0; // asm type annotation // EXPORTS // var _$INT32_MIN_212 = INT32_MIN; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_47 = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_47 = __main_47; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInt32Array_116 = require( '@stdlib/assert/is-int32array' ); */; /* removed: var _$INT32_MAX_211 = require( '@stdlib/constants/math/int32-max' ); */; /* removed: var _$INT32_MIN_212 = require( '@stdlib/constants/math/int32-min' ); */; /* removed: var _$main_47 = require( './int32array.js' ); */; // MAIN // /** * Tests for native `Int32Array` support. * * @returns {boolean} boolean indicating if an environment has `Int32Array` support * * @example * var bool = hasInt32ArraySupport(); * // returns */ function hasInt32ArraySupport() { var bool; var arr; if ( typeof _$main_47 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_47( [ 1, 3.14, -3.14, _$INT32_MAX_211+1 ] ); bool = ( _$isInt32Array_116( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === -3 && // truncation arr[ 3 ] === _$INT32_MIN_212 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasInt32ArraySupport_48 = hasInt32ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Int32Array` support. * * @module @stdlib/assert/has-int32array-support * * @example * var hasInt32ArraySupport = require( '@stdlib/assert/has-int32array-support' ); * * var bool = hasInt32ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasInt32ArraySupport_48 = require( './main.js' ); */; // EXPORTS // var _$hasInt32ArraySupport_46 = _$hasInt32ArraySupport_48; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_11 = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_11 = __ctor_11; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_12() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_12 = __polyfill_12; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order. * * @module @stdlib/array/int32 * * @example * var ctor = require( '@stdlib/array/int32' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasInt32ArraySupport_46 = require( '@stdlib/assert/has-int32array-support' ); */; /* removed: var _$ctor_11 = require( './int32array.js' ); */; /* removed: var _$polyfill_12 = require( './polyfill.js' ); */; // MAIN // var __ctor_10; if ( _$hasInt32ArraySupport_46() ) { __ctor_10 = _$ctor_11; } else { __ctor_10 = _$polyfill_12; } // EXPORTS // var _$ctor_10 = __ctor_10; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Uint32Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Uint32Array * * @example * var bool = isUint32Array( new Uint32Array( 10 ) ); * // returns true * * @example * var bool = isUint32Array( [] ); * // returns false */ function isUint32Array( value ) { return ( ( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Uint32Array]' ); } // EXPORTS // var _$isUint32Array_177 = isUint32Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Uint32Array. * * @module @stdlib/assert/is-uint32array * * @example * var isUint32Array = require( '@stdlib/assert/is-uint32array' ); * * var bool = isUint32Array( new Uint32Array( 10 ) ); * // returns true * * bool = isUint32Array( [] ); * // returns false */ // MODULES // /* removed: var _$isUint32Array_177 = require( './main.js' ); */; // EXPORTS // var _$isUint32Array_176 = _$isUint32Array_177; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_68 = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_68 = __main_68; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isUint32Array_176 = require( '@stdlib/assert/is-uint32array' ); */; /* removed: var _$UINT32_MAX_216 = require( '@stdlib/constants/math/uint32-max' ); */; /* removed: var _$main_68 = require( './uint32array.js' ); */; // MAIN // /** * Tests for native `Uint32Array` support. * * @returns {boolean} boolean indicating if an environment has `Uint32Array` support * * @example * var bool = hasUint32ArraySupport(); * // returns */ function hasUint32ArraySupport() { var bool; var arr; if ( typeof _$main_68 !== 'function' ) { return false; } // Test basic support... try { arr = [ 1, 3.14, -3.14, _$UINT32_MAX_216+1, _$UINT32_MAX_216+2 ]; arr = new _$main_68( arr ); bool = ( _$isUint32Array_176( arr ) && arr[ 0 ] === 1 && arr[ 1 ] === 3 && // truncation arr[ 2 ] === _$UINT32_MAX_216-2 && // truncation and wrap around arr[ 3 ] === 0 && // wrap around arr[ 4 ] === 1 // wrap around ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasUint32ArraySupport_67 = hasUint32ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Uint32Array` support. * * @module @stdlib/assert/has-uint32array-support * * @example * var hasUint32ArraySupport = require( '@stdlib/assert/has-uint32array-support' ); * * var bool = hasUint32ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasUint32ArraySupport_67 = require( './main.js' ); */; // EXPORTS // var _$hasUint32ArraySupport_66 = _$hasUint32ArraySupport_67; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_25 = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_25 = __ctor_25; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of 32-bit unsigned integers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_24() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_24 = __polyfill_24; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order. * * @module @stdlib/array/uint32 * * @example * var ctor = require( '@stdlib/array/uint32' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasUint32ArraySupport_66 = require( '@stdlib/assert/has-uint32array-support' ); */; /* removed: var _$ctor_25 = require( './uint32array.js' ); */; /* removed: var _$polyfill_24 = require( './polyfill.js' ); */; // MAIN // var __ctor_23; if ( _$hasUint32ArraySupport_66() ) { __ctor_23 = _$ctor_25; } else { __ctor_23 = _$polyfill_24; } // EXPORTS // var _$ctor_23 = __ctor_23; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasFloat32Array = ( typeof Float32Array === 'function' );// eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Float32Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Float32Array * * @example * var bool = isFloat32Array( new Float32Array( 10 ) ); * // returns true * * @example * var bool = isFloat32Array( [] ); * // returns false */ function isFloat32Array( value ) { return ( ( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Float32Array]' ); } // EXPORTS // var _$isFloat32Array_109 = isFloat32Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Float32Array. * * @module @stdlib/assert/is-float32array * * @example * var isFloat32Array = require( '@stdlib/assert/is-float32array' ); * * var bool = isFloat32Array( new Float32Array( 10 ) ); * // returns true * * bool = isFloat32Array( [] ); * // returns false */ // MODULES // /* removed: var _$isFloat32Array_109 = require( './main.js' ); */; // EXPORTS // var _$isFloat32Array_108 = _$isFloat32Array_109; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_37 = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_37 = __main_37; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFloat32Array_108 = require( '@stdlib/assert/is-float32array' ); */; /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$main_37 = require( './float32array.js' ); */; // MAIN // /** * Tests for native `Float32Array` support. * * @returns {boolean} boolean indicating if an environment has `Float32Array` support * * @example * var bool = hasFloat32ArraySupport(); * // returns */ function hasFloat32ArraySupport() { var bool; var arr; if ( typeof _$main_37 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_37( [ 1.0, 3.14, -3.14, 5.0e40 ] ); bool = ( _$isFloat32Array_108( arr ) && arr[ 0 ] === 1.0 && arr[ 1 ] === 3.140000104904175 && arr[ 2 ] === -3.140000104904175 && arr[ 3 ] === _$FLOAT64_PINF_207 ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasFloat32ArraySupport_39 = hasFloat32ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Float32Array` support. * * @module @stdlib/assert/has-float32array-support * * @example * var hasFloat32ArraySupport = require( '@stdlib/assert/has-float32array-support' ); * * var bool = hasFloat32ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasFloat32ArraySupport_39 = require( './main.js' ); */; // EXPORTS // var _$hasFloat32ArraySupport_38 = _$hasFloat32ArraySupport_39; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_1 = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_1 = __ctor_1; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of single-precision floating-point numbers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_3() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_3 = __polyfill_3; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order. * * @module @stdlib/array/float32 * * @example * var ctor = require( '@stdlib/array/float32' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasFloat32ArraySupport_38 = require( '@stdlib/assert/has-float32array-support' ); */; /* removed: var _$ctor_1 = require( './float32array.js' ); */; /* removed: var _$polyfill_3 = require( './polyfill.js' ); */; // MAIN // var __ctor_2; if ( _$hasFloat32ArraySupport_38() ) { __ctor_2 = _$ctor_1; } else { __ctor_2 = _$polyfill_3; } // EXPORTS // var _$ctor_2 = __ctor_2; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$nativeClass_874 = require( '@stdlib/utils/native-class' ); */; // VARIABLES // var hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals // MAIN // /** * Tests if a value is a Float64Array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a Float64Array * * @example * var bool = isFloat64Array( new Float64Array( 10 ) ); * // returns true * * @example * var bool = isFloat64Array( [] ); * // returns false */ function isFloat64Array( value ) { return ( ( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals _$nativeClass_874( value ) === '[object Float64Array]' ); } // EXPORTS // var _$isFloat64Array_111 = isFloat64Array; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a Float64Array. * * @module @stdlib/assert/is-float64array * * @example * var isFloat64Array = require( '@stdlib/assert/is-float64array' ); * * var bool = isFloat64Array( new Float64Array( 10 ) ); * // returns true * * bool = isFloat64Array( [] ); * // returns false */ // MODULES // /* removed: var _$isFloat64Array_111 = require( './main.js' ); */; // EXPORTS // var _$isFloat64Array_110 = _$isFloat64Array_111; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __main_40 = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$main_40 = __main_40; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFloat64Array_110 = require( '@stdlib/assert/is-float64array' ); */; /* removed: var _$main_40 = require( './float64array.js' ); */; // MAIN // /** * Tests for native `Float64Array` support. * * @returns {boolean} boolean indicating if an environment has `Float64Array` support * * @example * var bool = hasFloat64ArraySupport(); * // returns */ function hasFloat64ArraySupport() { var bool; var arr; if ( typeof _$main_40 !== 'function' ) { return false; } // Test basic support... try { arr = new _$main_40( [ 1.0, 3.14, -3.14, NaN ] ); bool = ( _$isFloat64Array_110( arr ) && arr[ 0 ] === 1.0 && arr[ 1 ] === 3.14 && arr[ 2 ] === -3.14 && arr[ 3 ] !== arr[ 3 ] ); } catch ( err ) { // eslint-disable-line no-unused-vars bool = false; } return bool; } // EXPORTS // var _$hasFloat64ArraySupport_42 = hasFloat64ArraySupport; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test for native `Float64Array` support. * * @module @stdlib/assert/has-float64array-support * * @example * var hasFloat64ArraySupport = require( '@stdlib/assert/has-float64array-support' ); * * var bool = hasFloat64ArraySupport(); * // returns */ // MODULES // /* removed: var _$hasFloat64ArraySupport_42 = require( './main.js' ); */; // EXPORTS // var _$hasFloat64ArraySupport_41 = _$hasFloat64ArraySupport_42; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // var __ctor_4 = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // var _$ctor_4 = __ctor_4; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: write polyfill // MAIN // /** * Typed array which represents an array of double-precision floating-point numbers in the platform byte order. * * @throws {Error} not implemented */ function __polyfill_6() { throw new Error( 'not implemented' ); } // EXPORTS // var _$polyfill_6 = __polyfill_6; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order. * * @module @stdlib/array/float64 * * @example * var ctor = require( '@stdlib/array/float64' ); * * var arr = new ctor( 10 ); * // returns */ // MODULES // /* removed: var _$hasFloat64ArraySupport_41 = require( '@stdlib/assert/has-float64array-support' ); */; /* removed: var _$ctor_4 = require( './float64array.js' ); */; /* removed: var _$polyfill_6 = require( './polyfill.js' ); */; // MAIN // var __ctor_5; if ( _$hasFloat64ArraySupport_41() ) { __ctor_5 = _$ctor_4; } else { __ctor_5 = _$polyfill_6; } // EXPORTS // var _$ctor_5 = __ctor_5; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_13 = require( '@stdlib/array/int8' ); */; /* removed: var _$ctor_26 = require( '@stdlib/array/uint8' ); */; /* removed: var _$ctor_29 = require( '@stdlib/array/uint8c' ); */; /* removed: var _$ctor_7 = require( '@stdlib/array/int16' ); */; /* removed: var _$ctor_20 = require( '@stdlib/array/uint16' ); */; /* removed: var _$ctor_10 = require( '@stdlib/array/int32' ); */; /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_2 = require( '@stdlib/array/float32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; // VARIABLES // var hash; // FUNCTIONS // /** * Copies an `Int8Array`. * * @private * @param {Int8Array} arr - array to copy * @returns {Int8Array} new array */ function int8array( arr ) { return new _$ctor_13( arr ); } /** * Copies a `Uint8Array`. * * @private * @param {Uint8Array} arr - array to copy * @returns {Uint8Array} new array */ function uint8array( arr ) { return new _$ctor_26( arr ); } /** * Copies a `Uint8ClampedArray`. * * @private * @param {Uint8ClampedArray} arr - array to copy * @returns {Uint8ClampedArray} new array */ function uint8clampedarray( arr ) { return new _$ctor_29( arr ); } /** * Copies an `Int16Array`. * * @private * @param {Int16Array} arr - array to copy * @returns {Int16Array} new array */ function int16array( arr ) { return new _$ctor_7( arr ); } /** * Copies a `Uint16Array`. * * @private * @param {Uint16Array} arr - array to copy * @returns {Uint16Array} new array */ function uint16array( arr ) { return new _$ctor_20( arr ); } /** * Copies an `Int32Array`. * * @private * @param {Int32Array} arr - array to copy * @returns {Int32Array} new array */ function int32array( arr ) { return new _$ctor_10( arr ); } /** * Copies a `Uint32Array`. * * @private * @param {Uint32Array} arr - array to copy * @returns {Uint32Array} new array */ function uint32array( arr ) { return new _$ctor_23( arr ); } /** * Copies a `Float32Array`. * * @private * @param {Float32Array} arr - array to copy * @returns {Float32Array} new array */ function float32array( arr ) { return new _$ctor_2( arr ); } /** * Copies a `Float64Array`. * * @private * @param {Float64Array} arr - array to copy * @returns {Float64Array} new array */ function float64array( arr ) { return new _$ctor_5( arr ); } /** * Returns a hash of functions for copying typed arrays. * * @private * @returns {Object} function hash */ function typedarrays() { var out = { 'int8array': int8array, 'uint8array': uint8array, 'uint8clampedarray': uint8clampedarray, 'int16array': int16array, 'uint16array': uint16array, 'int32array': int32array, 'uint32array': uint32array, 'float32array': float32array, 'float64array': float64array }; return out; } // MAIN // hash = typedarrays(); // EXPORTS // var _$hash_817 = hash; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; /* removed: var _$isError_102 = require( '@stdlib/assert/is-error' ); */; /* removed: var _$main_897 = require( '@stdlib/utils/type-of' ); */; /* removed: var _$reFromString_892 = require( '@stdlib/utils/regexp-from-string' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$main_889 = require( '@stdlib/utils/property-names' ); */; /* removed: var _$main_885 = require( '@stdlib/utils/property-descriptor' ); */; /* removed: var _$getPrototype_831 = require( '@stdlib/utils/get-prototype-of' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$copyBuffer_193 = require( '@stdlib/buffer/from-buffer' ); */; /* removed: var _$hash_817 = require( './typed_arrays.js' ); */; // FUNCTIONS // /** * Clones a class instance. * * ## Notes * * - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**. * - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state. * * * @private * @param {Object} val - class instance * @returns {Object} new instance */ function cloneInstance( val ) { var cache; var names; var name; var refs; var desc; var tmp; var ref; var i; cache = []; refs = []; ref = Object.create( _$getPrototype_831( val ) ); cache.push( val ); refs.push( ref ); names = _$main_889( val ); for ( i = 0; i < names.length; i++ ) { name = names[ i ]; desc = _$main_885( val, name ); if ( _$hasOwnProp_55( desc, 'value' ) ) { tmp = ( _$isArray_83( val[name] ) ) ? [] : {}; desc.value = deepCopy( val[name], tmp, cache, refs, -1 ); } _$defineProperty_825( ref, name, desc ); } if ( !Object.isExtensible( val ) ) { Object.preventExtensions( ref ); } if ( Object.isSealed( val ) ) { Object.seal( ref ); } if ( Object.isFrozen( val ) ) { Object.freeze( ref ); } return ref; } /** * Copies an error object. * * @private * @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy * @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy * * @example * var err1 = new TypeError( 'beep' ); * * var err2 = copyError( err1 ); * // returns */ function copyError( error ) { var cache = []; var refs = []; var keys; var desc; var tmp; var key; var err; var i; // Create a new error... err = new error.constructor( error.message ); cache.push( error ); refs.push( err ); // If a `stack` property is present, copy it over... if ( error.stack ) { err.stack = error.stack; } // Node.js specific (system errors)... if ( error.code ) { err.code = error.code; } if ( error.errno ) { err.errno = error.errno; } if ( error.syscall ) { err.syscall = error.syscall; } // Any enumerable properties... keys = _$keys_860( error ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; desc = _$main_885( error, key ); if ( _$hasOwnProp_55( desc, 'value' ) ) { tmp = ( _$isArray_83( error[ key ] ) ) ? [] : {}; desc.value = deepCopy( error[ key ], tmp, cache, refs, -1 ); } _$defineProperty_825( err, key, desc ); } return err; } // MAIN // /** * Recursively performs a deep copy of an input object. * * @private * @param {*} val - value to copy * @param {(Array|Object)} copy - copy * @param {Array} cache - an array of visited objects * @param {Array} refs - an array of object references * @param {NonNegativeInteger} level - copy depth * @returns {*} deep copy */ function deepCopy( val, copy, cache, refs, level ) { var parent; var keys; var name; var desc; var ctor; var key; var ref; var x; var i; var j; level -= 1; // Primitives and functions... if ( typeof val !== 'object' || val === null ) { return val; } if ( _$isBuffer_92( val ) ) { return _$copyBuffer_193( val ); } if ( _$isError_102( val ) ) { return copyError( val ); } // Objects... name = _$main_897( val ); if ( name === 'date' ) { return new Date( +val ); } if ( name === 'regexp' ) { return _$reFromString_892( val.toString() ); } if ( name === 'set' ) { return new Set( val ); } if ( name === 'map' ) { return new Map( val ); } if ( name === 'string' || name === 'boolean' || name === 'number' ) { // If provided an `Object`, return an equivalent primitive! return val.valueOf(); } ctor = _$hash_817[ name ]; if ( ctor ) { return ctor( val ); } // Class instances... if ( name !== 'array' && name !== 'object' ) { // Cloning requires ES5 or higher... if ( typeof Object.freeze === 'function' ) { return cloneInstance( val ); } return {}; } // Arrays and plain objects... keys = _$keys_860( val ); if ( level > 0 ) { parent = name; for ( j = 0; j < keys.length; j++ ) { key = keys[ j ]; x = val[ key ]; // Primitive, Buffer, special class instance... name = _$main_897( x ); if ( typeof x !== 'object' || x === null || ( name !== 'array' && name !== 'object' ) || _$isBuffer_92( x ) ) { if ( parent === 'object' ) { desc = _$main_885( val, key ); if ( _$hasOwnProp_55( desc, 'value' ) ) { desc.value = deepCopy( x ); } _$defineProperty_825( copy, key, desc ); } else { copy[ key ] = deepCopy( x ); } continue; } // Circular reference... i = _$indexOf_843( cache, x ); if ( i !== -1 ) { copy[ key ] = refs[ i ]; continue; } // Plain array or object... ref = ( _$isArray_83( x ) ) ? new Array( x.length ) : {}; cache.push( x ); refs.push( ref ); if ( parent === 'array' ) { copy[ key ] = deepCopy( x, ref, cache, refs, level ); } else { desc = _$main_885( val, key ); if ( _$hasOwnProp_55( desc, 'value' ) ) { desc.value = deepCopy( x, ref, cache, refs, level ); } _$defineProperty_825( copy, key, desc ); } } } else if ( name === 'array' ) { for ( j = 0; j < keys.length; j++ ) { key = keys[ j ]; copy[ key ] = val[ key ]; } } else { for ( j = 0; j < keys.length; j++ ) { key = keys[ j ]; desc = _$main_885( val, key ); _$defineProperty_825( copy, key, desc ); } } if ( !Object.isExtensible( val ) ) { Object.preventExtensions( copy ); } if ( Object.isSealed( val ) ) { Object.seal( copy ); } if ( Object.isFrozen( val ) ) { Object.freeze( copy ); } return copy; } // EXPORTS // var _$deepCopy_815 = deepCopy; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; var __isNonNegativeInteger_814 = _$isNonNegativeInteger_136.isPrimitive; /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$deepCopy_815 = require( './deep_copy.js' ); */; // MAIN // /** * Copies or deep clones a value to an arbitrary depth. * * @param {*} value - value to copy * @param {NonNegativeInteger} [level=+infinity] - copy depth * @throws {TypeError} `level` must be a nonnegative integer * @returns {*} value copy * * @example * var out = copy( 'beep' ); * // returns 'beep' * * @example * var value = [ * { * 'a': 1, * 'b': true, * 'c': [ 1, 2, 3 ] * } * ]; * var out = copy( value ); * // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ] * * var bool = ( value[0].c === out[0].c ); * // returns false */ function copy( value, level ) { var out; if ( arguments.length > 1 ) { if ( !__isNonNegativeInteger_814( level ) ) { throw new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' ); } if ( level === 0 ) { return value; } } else { level = _$FLOAT64_PINF_207; } out = ( _$isArray_83( value ) ) ? new Array( value.length ) : {}; return _$deepCopy_815( value, out, [value], [out], level ); } // EXPORTS // var _$copy_814 = copy; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Copy or deep clone a value to an arbitrary depth. * * @module @stdlib/utils/copy * * @example * var copy = require( '@stdlib/utils/copy' ); * * var out = copy( 'beep' ); * // returns 'beep' * * @example * var copy = require( '@stdlib/utils/copy' ); * * var value = [ * { * 'a': 1, * 'b': true, * 'c': [ 1, 2, 3 ] * } * ]; * var out = copy( value ); * // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ] * * var bool = ( value[0].c === out[0].c ); * // returns false */ // MODULES // /* removed: var _$copy_814 = require( './copy.js' ); */; // EXPORTS // var _$copy_816 = _$copy_814; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests that a value is a valid constructor. * * @private * @param {*} value - value to test * @returns {(Error|null)} error object or null * * @example * var ctor = function ctor() {}; * * var err = validate( ctor ); * // returns null * * err = validate( null ); * // returns */ function validate( value ) { var type = typeof value; if ( value === null || (type !== 'object' && type !== 'function') ) { return new TypeError( 'invalid argument. A provided constructor must be either an object (except null) or a function. Value: `'+value+'`.' ); } return null; } // EXPORTS // var _$validate_850 = validate; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // EXPORTS // var _$native_848 = Object.create; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // FUNCTIONS // /** * Dummy constructor. * * @private */ function Ctor() { // Empty... } // MAIN // /** * An `Object.create` shim for older JavaScript engines. * * @private * @param {Object} proto - prototype * @returns {Object} created object * * @example * var obj = createObject( Object.prototype ); * // returns {} */ function createObject( proto ) { Ctor.prototype = proto; return new Ctor(); } // EXPORTS // var _$createObject_849 = createObject; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$native_848 = require( './native.js' ); */; /* removed: var _$createObject_849 = require( './polyfill.js' ); */; // MAIN // var __createObject_845; if ( typeof _$native_848 === 'function' ) { __createObject_845 = _$native_848; } else { __createObject_845 = _$createObject_849; } // EXPORTS // var _$createObject_845 = __createObject_845; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$validate_850 = require( './validate.js' ); */; /* removed: var _$createObject_845 = require( './detect.js' ); */; // MAIN // /** * Implements prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor. * * ## Notes * * - This implementation is not designed to work with ES2015/ES6 classes. For ES2015/ES6 classes, use `class` with `extends`. * - For reference, see [node#3455](https://github.com/nodejs/node/pull/3455), [node#4179](https://github.com/nodejs/node/issues/4179), [node#3452](https://github.com/nodejs/node/issues/3452), and [node commit](https://github.com/nodejs/node/commit/29da8cf8d7ab8f66b9091ab22664067d4468461e#diff-3deb3f32958bb937ae05c6f3e4abbdf5). * * * @param {(Object|Function)} ctor - constructor which will inherit * @param {(Object|Function)} superCtor - super (parent) constructor * @throws {TypeError} first argument must be either an object or a function which can inherit * @throws {TypeError} second argument must be either an object or a function from which a constructor can inherit * @throws {TypeError} second argument must have an inheritable prototype * @returns {(Object|Function)} child constructor * * @example * function Foo() { * return this; * } * Foo.prototype.beep = function beep() { * return 'boop'; * }; * * function Bar() { * Foo.call( this ); * return this; * } * inherit( Bar, Foo ); * * var bar = new Bar(); * var v = bar.beep(); * // returns 'boop' */ function inherit( ctor, superCtor ) { var err = _$validate_850( ctor ); if ( err ) { throw err; } err = _$validate_850( superCtor ); if ( err ) { throw err; } if ( typeof superCtor.prototype === 'undefined' ) { throw new TypeError( 'invalid argument. Second argument must have a prototype from which another object can inherit. Value: `'+superCtor.prototype+'`.' ); } // Create a prototype which inherits from the parent prototype: ctor.prototype = _$createObject_845( superCtor.prototype ); // Set the constructor to refer to the child constructor: _$defineProperty_825( ctor.prototype, 'constructor', { 'configurable': true, 'enumerable': false, 'writable': true, 'value': ctor }); return ctor; } // EXPORTS // var _$inherit_847 = inherit; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Implement prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor. * * @module @stdlib/utils/inherit * * @example * var inherit = require( '@stdlib/utils/inherit' ); * * function Foo() { * return this; * } * Foo.prototype.beep = function beep() { * return 'boop'; * }; * * function Bar() { * Foo.call( this ); * return this; * } * inherit( Bar, Foo ); * * var bar = new Bar(); * var v = bar.beep(); * // returns 'boop' */ // MODULES // /* removed: var _$inherit_847 = require( './inherit.js' ); */; // EXPORTS // var _$inherit_846 = _$inherit_847; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; // MAIN // var DEFAULTS = { 'level': _$FLOAT64_PINF_207, 'override': true, 'extend': true, 'copy': true }; // EXPORTS // var _$DEFAULTS_868 = DEFAULTS; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isObject_151 = require( '@stdlib/assert/is-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$isBuffer_92 = require( '@stdlib/assert/is-buffer' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; /* removed: var _$main_897 = require( '@stdlib/utils/type-of' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; // MAIN // /** * Merges a source object into a target object. * * @private * @param {Object} target - target object * @param {Object} source - source object * @param {number} level - merge level * @param {boolean} copy - indicates whether to perform a deep copy of merged values * @param {(boolean|Function)} override - defines the merge strategy * @param {boolean} extend - indicates whether new properties can be added to the target object */ function deepMerge( target, source, level, copy, override, extend ) { var hasProp; var isFunc; var name; var keys; var curr; var key; var val; var tmp; var i; // Determine if we were provided a custom override strategy: isFunc = _$isFunction_112( override ); // Decrement the level: level -= 1; // Loop through the source keys and implement the merge strategy... keys = _$keys_860( source ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; hasProp = _$hasOwnProp_55( target, key ); // Can we add new properties to the target? if ( !hasProp && !extend ) { continue; } val = source[ key ]; if ( hasProp ) { curr = target[ key ]; name = _$main_897( curr ); // Should we recurse to perform a deep(er) merge? (only if both the current value and the proposed value are objects and the level is > 0) if ( !_$isBuffer_92( curr ) && name === 'object' && _$isObject_151( val ) && level ) { deepMerge( curr, val, level, copy, override, extend ); continue; } // Should we apply a custom merge (override) strategy? if ( isFunc ) { tmp = override( curr, val, key ); // WARNING: the following check does NOT prevent shared (leaky) nested references. We only check for top-level reference equality. We will assume that the user knows best, given their having provided a custom override strategy. if ( copy && tmp !== curr && tmp === val ) { tmp = _$copy_816( tmp ); } target[ key ] = tmp; } // Are we allowed to override an existing target value? else if ( override ) { if ( copy ) { target[ key ] = _$copy_816( val ); } else { target[ key ] = val; } } } // New property to be added to target object. Should we deep copy the source value? else if ( copy ) { target[ key ] = _$copy_816( val ); } // Perform a simple assignment... else { target[ key ] = val; } } } // EXPORTS // var _$deepMerge_867 = deepMerge; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isObject_151 = require( '@stdlib/assert/is-object' ); */; /* removed: var _$deepMerge_867 = require( './deepmerge.js' ); */; // MAIN // /** * Returns a merge function based on provided options. * * @private * @param {Options} opts - function options * @param {number} options.level - merge level * @param {boolean} options.copy - boolean indicating whether to deep copy merged values * @param {(boolean|Function)} options.override - defines the merge strategy * @param {boolean} options.extend - boolean indicating whether new properties can be added to the target object * @returns {Function} merge function * * @example * var merge = mergefcn({ * 'level': Number.POSITIVE_INFINITY, * 'copy': true, * 'override': true, * 'extend': true * }); * // returns */ function mergefcn( opts ) { return merge; /** * Merges objects into a target object. Note that the target object is mutated. * * @private * @param {Object} target - target object * @param {...Object} source - source objects (i.e., objects to be merged into the target object) * @throws {Error} must provide a target object and one or more source objects * @throws {TypeError} first argument must be an object * @throws {TypeError} source arguments must be objects * @returns {Object} merged (target) object * * @example * var target = { * 'a': 'beep' * }; * var source = { * 'a': 'boop', * 'b': 'bap' * }; * * var out = merge( target, source ); * // returns {'a':'boop', 'b':'bap'} */ function merge( target ) { var nargs; var arg; var src; var i; nargs = arguments.length - 1; if ( nargs < 1 ) { throw new Error( 'insufficient input arguments. Must provide both a target object and one or more source objects.' ); } if ( !_$isObject_151( target ) ) { throw new TypeError( 'invalid argument. First argument must be an object. Value: `' + target + '`.' ); } src = new Array( nargs ); for ( i = 0; i < nargs; i++ ) { arg = arguments[ i+1 ]; // WARNING: this is a porous check. Buffers, Numbers, Booleans, Strings, Dates, RegExp, custom class instances,... will all pass. if ( !_$isObject_151( arg ) ) { throw new TypeError( 'invalid argument. A merge source must be an object. Value: `' + arg + '`.' ); } src[ i ] = arg; } for ( i = 0; i < nargs; i++ ) { _$deepMerge_867( target, src[ i ], opts.level, opts.copy, opts.override, opts.extend ); // eslint-disable-line max-len } return target; } } // EXPORTS // var _$mergefcn_872 = mergefcn; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$DEFAULTS_868 = require( './defaults.js' ); */; /* removed: var _$mergefcn_872 = require( './mergefcn.js' ); */; // MAIN // /** * Merges objects into a target object. Note that the target object is mutated. * * @name merge * @type {Function} * @param {Object} target - target object * @param {...Object} source - source objects (i.e., objects to be merged into the target object) * @throws {Error} must provide a target object and one or more source objects * @throws {TypeError} first argument must be an object * @throws {TypeError} source arguments must be objects * @returns {Object} merged (target) object * * @example * var target = { * 'a': 'beep' * }; * var source = { * 'a': 'boop', * 'b': 'bap' * }; * * var out = merge( target, source ); * // returns {'a':'boop', 'b':'bap'} */ var merge = _$mergefcn_872( _$DEFAULTS_868 ); // EXPORTS // var _$merge_871 = merge; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isInteger_158 = _$isInteger_120.isPrimitive; // MAIN // /** * Tests if a value is a number primitive having a positive integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive having a positive integer value * * @example * var bool = isPositiveInteger( 3.0 ); * // returns true * * @example * var bool = isPositiveInteger( new Number( 3.0 ) ); * // returns false */ function isPositiveInteger( value ) { return ( __isInteger_158( value ) && value > 0.0 ); } // EXPORTS // var _$isPositiveInteger_158 = isPositiveInteger; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isInteger_157 = _$isInteger_120.isObject; // MAIN // /** * Tests if a value is a number object having a positive integer value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having a positive integer value * * @example * var bool = isPositiveInteger( 3.0 ); * // returns false * * @example * var bool = isPositiveInteger( new Number( 3.0 ) ); * // returns true */ function __isPositiveInteger_157( value ) { return ( __isInteger_157( value ) && value.valueOf() > 0.0 ); } // EXPORTS // var _$isPositiveInteger_157 = __isPositiveInteger_157; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isPositiveInteger_158 = require( './primitive.js' ); */; /* removed: var _$isPositiveInteger_157 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a positive integer. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a positive integer * * @example * var bool = isPositiveInteger( 5.0 ); * // returns true * * @example * var bool = isPositiveInteger( new Number( 5.0 ) ); * // returns true * * @example * var bool = isPositiveInteger( 0.0 ); * // returns false * * @example * var bool = isPositiveInteger( -5.0 ); * // returns false * * @example * var bool = isPositiveInteger( 3.14 ); * // returns false * * @example * var bool = isPositiveInteger( null ); * // returns false */ function __isPositiveInteger_156( value ) { return ( _$isPositiveInteger_158( value ) || _$isPositiveInteger_157( value ) ); } // EXPORTS // var _$isPositiveInteger_156 = __isPositiveInteger_156; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a positive integer. * * @module @stdlib/assert/is-positive-integer * * @example * var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ); * * var bool = isPositiveInteger( 5.0 ); * // returns true * * bool = isPositiveInteger( new Number( 5.0 ) ); * // returns true * * bool = isPositiveInteger( -5.0 ); * // returns false * * bool = isPositiveInteger( 3.14 ); * // returns false * * bool = isPositiveInteger( null ); * // returns false * * @example * var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive; * * var bool = isPositiveInteger( 3.0 ); * // returns true * * bool = isPositiveInteger( new Number( 3.0 ) ); * // returns false * * @example * var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isObject; * * var bool = isPositiveInteger( 3.0 ); * // returns false * * bool = isPositiveInteger( new Number( 3.0 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isPositiveInteger_156 = require( './main.js' ); */; /* removed: var _$isPositiveInteger_158 = require( './primitive.js' ); */; /* removed: var _$isPositiveInteger_157 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isPositiveInteger_156, 'isPrimitive', _$isPositiveInteger_158 ); _$setNonEnumerableReadOnly_820( _$isPositiveInteger_156, 'isObject', _$isPositiveInteger_157 ); // EXPORTS // var _$isPositiveInteger_155 = _$isPositiveInteger_156; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; var __isBoolean_873 = _$isBoolean_86.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; var __isPositiveInteger_873 = _$isPositiveInteger_155.isPrimitive; // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - options to validate * @param {number} [options.level] - merge level * @param {boolean} [options.copy] - boolean indicating whether to deep copy merged values * @param {(boolean|Function)} [options.override] - defines the merge strategy * @param {boolean} [options.extend] - boolean indicating whether new properties can be added to the target object * @returns {(Error|null)} error object or null */ function __validate_873( opts, options ) { if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } if ( _$hasOwnProp_55( options, 'level' ) ) { opts.level = options.level; if ( !__isPositiveInteger_873( opts.level ) ) { return new TypeError( 'invalid option. `level` option must be a positive integer. Option: `' + opts.level + '`.' ); } } if ( _$hasOwnProp_55( options, 'copy' ) ) { opts.copy = options.copy; if ( !__isBoolean_873( opts.copy ) ) { return new TypeError( 'invalid option. `copy` option must be a boolean primitive. Option: `' + opts.copy + '`.' ); } } if ( _$hasOwnProp_55( options, 'override' ) ) { opts.override = options.override; if ( !__isBoolean_873( opts.override ) && !_$isFunction_112( opts.override ) ) { return new TypeError( 'invalid option. `override` option must be either a boolean primitive or a function. Option: `' + opts.override + '`.' ); } } if ( _$hasOwnProp_55( options, 'extend' ) ) { opts.extend = options.extend; if ( !__isBoolean_873( opts.extend ) ) { return new TypeError( 'invalid option. `extend` option must be a boolean primitive. Option: `' + opts.extend + '`.' ); } } return null; } // EXPORTS // var _$validate_873 = __validate_873; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$validate_873 = require( './validate.js' ); */; /* removed: var _$DEFAULTS_868 = require( './defaults.js' ); */; /* removed: var _$mergefcn_872 = require( './mergefcn.js' ); */; // MAIN // /** * Returns a function for merging and extending objects. * * @param {Options} options - merge options * @param {number} [options.level=Infinity] - merge level * @param {boolean} [options.copy=true] - boolean indicating whether to deep copy merged values * @param {(boolean|Function)} [options.override=true] - defines the merge strategy * @param {boolean} [options.extend=true] - boolean indicating whether new properties can be added to the target object * @throws {TypeError} must provide valid options * @returns {Function} function which can be used to merge objects * * @example * var opts = { * 'level': 100, * 'copy': true, * 'override': true, * 'extend': true * }; * * var merge = factory( opts ); * // returns */ function factory( options ) { var opts; var err; opts = _$copy_816( _$DEFAULTS_868 ); err = _$validate_873( opts, options ); if ( err ) { throw err; } return _$mergefcn_872( opts ); } // EXPORTS // var _$factory_869 = factory; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Merge and extend objects. * * @module @stdlib/utils/merge * * @example * var merge = require( '@stdlib/utils/merge' ); * * var target = { * 'a': 'beep' * }; * var source = { * 'a': 'boop', * 'b': 'bap' * }; * * var out = merge( target, source ); * // returns {'a':'boop', 'b':'bap'} * * @example * var factory = require( '@stdlib/utils/merge' ).factory; * * var opts = { * 'level': 100, * 'copy': true, * 'override': true, * 'extend': true * }; * * var merge = factory( opts ); * // returns */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$merge_871 = require( './merge.js' ); */; /* removed: var _$factory_869 = require( './factory.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$merge_871, 'factory', _$factory_869 ); // EXPORTS // var _$merge_870 = _$merge_871; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; // MAIN // /** * Defines a non-enumerable read-only accessor. * * @param {Object} obj - object on which to define the property * @param {(string|symbol)} prop - property name * @param {Function} getter - accessor * * @example * function getter() { * return 'bar'; * } * * var obj = {}; * * setNonEnumerableReadOnlyAccessor( obj, 'foo', getter ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ function setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length _$defineProperty_825( obj, prop, { 'configurable': false, 'enumerable': false, 'get': getter }); } // EXPORTS // var _$setNonEnumerableReadOnlyAccessor_819 = setNonEnumerableReadOnlyAccessor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Define a non-enumerable read-only accessor. * * @module @stdlib/utils/define-nonenumerable-read-only-accessor * * @example * var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); * * function getter() { * return 'bar'; * } * * var obj = {}; * * setNonEnumerableReadOnlyAccessor( obj, 'foo', getter ); * * try { * obj.foo = 'boop'; * } catch ( err ) { * console.error( err.message ); * } */ // MODULES // /* removed: var _$setNonEnumerableReadOnlyAccessor_819 = require( './main.js' ); */; // eslint-disable-line id-length // EXPORTS // var _$setNonEnumerableReadOnlyAccessor_818 = _$setNonEnumerableReadOnlyAccessor_819; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; // MAIN // /** * Defines a non-enumerable read-write accessor. * * @param {Object} obj - object on which to define the property * @param {(string|symbol)} prop - property name * @param {Function} getter - get accessor * @param {Function} setter - set accessor * * @example * function getter() { * return name + ' foo'; * } * * function setter( v ) { * name = v; * } * * var name = 'bar'; * var obj = {}; * * setNonEnumerableReadWriteAccessor( obj, 'foo', getter, setter ); * * var v = obj.foo; * // returns 'bar foo' * * obj.foo = 'beep'; * * v = obj.foo; * // returns 'beep foo' */ function setNonEnumerableReadWriteAccessor( obj, prop, getter, setter ) { // eslint-disable-line id-length _$defineProperty_825( obj, prop, { 'configurable': false, 'enumerable': false, 'get': getter, 'set': setter }); } // EXPORTS // var _$setNonEnumerableReadWriteAccessor_823 = setNonEnumerableReadWriteAccessor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Define a non-enumerable read-write accessor. * * @module @stdlib/utils/define-nonenumerable-read-write-accessor * * @example * var setNonEnumerableReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' ); * * function getter() { * return name + ' foo'; * } * * function setter( v ) { * name = v; * } * * var name = 'bar'; * var obj = {}; * * setNonEnumerableReadWriteAccessor( obj, 'foo', getter, setter ); * * var v = obj.foo; * // returns 'bar foo' * * obj.foo = 'beep'; * * v = obj.foo; * // returns 'beep foo' */ // MODULES // /* removed: var _$setNonEnumerableReadWriteAccessor_823 = require( './main.js' ); */; // EXPORTS // var _$setNonEnumerableReadWriteAccessor_822 = _$setNonEnumerableReadWriteAccessor_823; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var M = 8; // MAIN // /** * Copies values from `x` into `y`. * * @param {PositiveInteger} N - number of values to copy * @param {(Array|TypedArray)} x - input array * @param {integer} strideX - `x` stride length * @param {(Array|TypedArray)} y - destination array * @param {integer} strideY - `y` stride length * @returns {(Array|TypedArray)} `y` * * @example * var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; * var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; * * gcopy( x.length, x, 1, y, 1 ); * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] */ function gcopy( N, x, strideX, y, strideY ) { var ix; var iy; var m; var i; if ( N <= 0 ) { return y; } // Use unrolled loops if both strides are equal to `1`... if ( strideX === 1 && strideY === 1 ) { m = N % M; // If we have a remainder, run a clean-up loop... if ( m > 0 ) { for ( i = 0; i < m; i++ ) { y[ i ] = x[ i ]; } } if ( N < M ) { return y; } for ( i = m; i < N; i += M ) { y[ i ] = x[ i ]; y[ i+1 ] = x[ i+1 ]; y[ i+2 ] = x[ i+2 ]; y[ i+3 ] = x[ i+3 ]; y[ i+4 ] = x[ i+4 ]; y[ i+5 ] = x[ i+5 ]; y[ i+6 ] = x[ i+6 ]; y[ i+7 ] = x[ i+7 ]; } return y; } if ( strideX < 0 ) { ix = (1-N) * strideX; } else { ix = 0; } if ( strideY < 0 ) { iy = (1-N) * strideY; } else { iy = 0; } for ( i = 0; i < N; i++ ) { y[ iy ] = x[ ix ]; ix += strideX; iy += strideY; } return y; } // EXPORTS // var _$gcopy_187 = gcopy; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var __M_188 = 8; // MAIN // /** * Copies values from `x` into `y`. * * @param {PositiveInteger} N - number of values to copy * @param {(Array|TypedArray)} x - input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting `x` index * @param {(Array|TypedArray)} y - destination array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting `y` index * @returns {(Array|TypedArray)} `y` * * @example * var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; * var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; * * gcopy( x.length, x, 1, 0, y, 1, 0 ); * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] */ function __gcopy_188( N, x, strideX, offsetX, y, strideY, offsetY ) { var ix; var iy; var m; var i; if ( N <= 0 ) { return y; } ix = offsetX; iy = offsetY; // Use unrolled loops if both strides are equal to `1`... if ( strideX === 1 && strideY === 1 ) { m = N % __M_188; // If we have a remainder, run a clean-up loop... if ( m > 0 ) { for ( i = 0; i < m; i++ ) { y[ iy ] = x[ ix ]; ix += strideX; iy += strideY; } } if ( N < __M_188 ) { return y; } for ( i = m; i < N; i += __M_188 ) { y[ iy ] = x[ ix ]; y[ iy+1 ] = x[ ix+1 ]; y[ iy+2 ] = x[ ix+2 ]; y[ iy+3 ] = x[ ix+3 ]; y[ iy+4 ] = x[ ix+4 ]; y[ iy+5 ] = x[ ix+5 ]; y[ iy+6 ] = x[ ix+6 ]; y[ iy+7 ] = x[ ix+7 ]; ix += __M_188; iy += __M_188; } return y; } for ( i = 0; i < N; i++ ) { y[ iy ] = x[ ix ]; ix += strideX; iy += strideY; } return y; } // EXPORTS // var _$gcopy_188 = __gcopy_188; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Blas level 1 routine to copy values from `x` into `y`. * * @module @stdlib/blas/base/gcopy * * @example * var gcopy = require( '@stdlib/blas/base/gcopy' ); * * var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; * var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; * * gcopy( x.length, x, 1, y, 1 ); * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] * * @example * // Use the `ndarray` interface... * var gcopy = require( '@stdlib/blas/base/gcopy' ).ndarray; * * var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; * var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; * * gcopy( x.length, x, 1, 0, y, 1, 0 ); * // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ] */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$gcopy_187 = require( './main.js' ); */; /* removed: var _$gcopy_188 = require( './ndarray.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$gcopy_187, 'ndarray', _$gcopy_188 ); // EXPORTS // var _$gcopy_186 = _$gcopy_187; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_13 = require( '@stdlib/array/int8' ); */; /* removed: var _$ctor_26 = require( '@stdlib/array/uint8' ); */; /* removed: var _$ctor_29 = require( '@stdlib/array/uint8c' ); */; /* removed: var _$ctor_7 = require( '@stdlib/array/int16' ); */; /* removed: var _$ctor_20 = require( '@stdlib/array/uint16' ); */; /* removed: var _$ctor_10 = require( '@stdlib/array/int32' ); */; /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_2 = require( '@stdlib/array/float32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; // MAIN // var CTORS = [ _$ctor_5, _$ctor_2, _$ctor_10, _$ctor_23, _$ctor_7, _$ctor_20, _$ctor_13, _$ctor_26, _$ctor_29 ]; // EXPORTS // var _$CTORS_170 = CTORS; var _$names_173=[ "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$constructorName_812 = require( '@stdlib/utils/constructor-name' ); */; /* removed: var _$getPrototype_831 = require( '@stdlib/utils/get-prototype-of' ); */; /* removed: var _$hasFloat64ArraySupport_41 = require( '@stdlib/assert/has-float64array-support' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; /* removed: var _$CTORS_170 = require( './ctors.js' ); */; /* removed: var _$names_173 = require( './names.json' ); */; // VARIABLES // // Abstract `TypedArray` class: var TypedArray = ( _$hasFloat64ArraySupport_41() ) ? _$getPrototype_831( _$ctor_5 ) : Dummy; // eslint-disable-line max-len // FUNCTIONS // /** * Dummy constructor. * * @private */ function Dummy() {} // eslint-disable-line no-empty-function // MAIN // /** * Tests if a value is a typed array. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a typed array * * @example * var Int8Array = require( '@stdlib/array/int8' ); * * var bool = isTypedArray( new Int8Array( 10 ) ); * // returns true */ function isTypedArray( value ) { var v; var i; if ( typeof value !== 'object' || value === null ) { return false; } // Check for the abstract class... if ( value instanceof TypedArray ) { return true; } // Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)... for ( i = 0; i < _$CTORS_170.length; i++ ) { if ( value instanceof _$CTORS_170[ i ] ) { return true; } } // Walk the prototype tree until we find an object having a desired class... while ( value ) { v = _$constructorName_812( value ); for ( i = 0; i < _$names_173.length; i++ ) { if ( _$names_173[ i ] === v ) { return true; } } value = _$getPrototype_831( value ); } return false; } // EXPORTS // var _$isTypedArray_172 = isTypedArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a typed array. * * @module @stdlib/assert/is-typed-array * * @example * var Int8Array = require( '@stdlib/array/int8' ); * var isTypedArray = require( '@stdlib/assert/is-typed-array' ); * * var bool = isTypedArray( new Int8Array( 10 ) ); * // returns true */ // MODULES // /* removed: var _$isTypedArray_172 = require( './main.js' ); */; // EXPORTS // var _$isTypedArray_171 = _$isTypedArray_172; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests whether a value has in its prototype chain a specified constructor as a prototype property. * * @param {*} value - value to test * @param {Function} constructor - constructor to test against * @throws {TypeError} constructor must be callable * @returns {boolean} boolean indicating whether a value is an instance of a provided constructor * * @example * var bool = instanceOf( [], Array ); * // returns true * * @example * var bool = instanceOf( {}, Object ); // exception * // returns true * * @example * var bool = instanceOf( 'beep', String ); * // returns false * * @example * var bool = instanceOf( null, Object ); * // returns false * * @example * var bool = instanceOf( 5, Object ); * // returns false */ function instanceOf( value, constructor ) { // TODO: replace with `isCallable` check if ( typeof constructor !== 'function' ) { throw new TypeError( 'invalid argument. `constructor` argument must be callable. Value: `'+constructor+'`.' ); } return ( value instanceof constructor ); } // EXPORTS // var _$instanceOf_76 = instanceOf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test whether a value has in its prototype chain a specified constructor as a prototype property. * * @module @stdlib/assert/instance-of * * @example * var instanceOf = require( '@stdlib/assert/instance-of' ); * * var bool = instanceOf( [], Array ); * // returns true * * bool = instanceOf( {}, Object ); // exception * // returns true * * bool = instanceOf( 'beep', String ); * // returns false * * bool = instanceOf( null, Object ); * // returns false * * bool = instanceOf( 5, Object ); * // returns false */ // MODULES // /* removed: var _$instanceOf_76 = require( './main.js' ); */; // EXPORTS // var _$instanceOf_75 = _$instanceOf_76; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_13 = require( '@stdlib/array/int8' ); */; /* removed: var _$ctor_26 = require( '@stdlib/array/uint8' ); */; /* removed: var _$ctor_29 = require( '@stdlib/array/uint8c' ); */; /* removed: var _$ctor_7 = require( '@stdlib/array/int16' ); */; /* removed: var _$ctor_20 = require( '@stdlib/array/uint16' ); */; /* removed: var _$ctor_10 = require( '@stdlib/array/int32' ); */; /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_2 = require( '@stdlib/array/float32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; // MAIN // var __CTORS_16 = [ [ _$ctor_5, 'Float64Array' ], [ _$ctor_2, 'Float32Array' ], [ _$ctor_10, 'Int32Array' ], [ _$ctor_23, 'Uint32Array' ], [ _$ctor_7, 'Int16Array' ], [ _$ctor_20, 'Uint16Array' ], [ _$ctor_13, 'Int8Array' ], [ _$ctor_26, 'Uint8Array' ], [ _$ctor_29, 'Uint8ClampedArray' ] ]; // EXPORTS // var _$CTORS_16 = __CTORS_16; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$instanceOf_75 = require( '@stdlib/assert/instance-of' ); */; /* removed: var _$constructorName_812 = require( '@stdlib/utils/constructor-name' ); */; /* removed: var _$getPrototype_831 = require( '@stdlib/utils/get-prototype-of' ); */; /* removed: var _$CTORS_16 = require( './ctors.js' ); */; // MAIN // /** * Returns the typed array type. * * @private * @param {TypedArray} arr - typed array * @returns {(string|void)} typed array type * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var arr = new Float64Array( 5 ); * var str = typeName( arr ); * // returns 'Float64Array' */ function typeName( arr ) { var v; var i; // Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)... for ( i = 0; i < _$CTORS_16.length; i++ ) { if ( _$instanceOf_75( arr, _$CTORS_16[ i ][ 0 ] ) ) { return _$CTORS_16[ i ][ 1 ]; } } // Walk the prototype tree until we find an object having a desired native class... while ( arr ) { v = _$constructorName_812( arr ); for ( i = 0; i < _$CTORS_16.length; i++ ) { if ( v === _$CTORS_16[ i ][ 1 ] ) { return _$CTORS_16[ i ][ 1 ]; } } arr = _$getPrototype_831( arr ); } } // EXPORTS // var _$typeName_19 = typeName; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isTypedArray_171 = require( '@stdlib/assert/is-typed-array' ); */; /* removed: var _$typeName_19 = require( './type.js' ); */; // MAIN // /** * Returns a JSON representation of a typed array. * * ## Notes * * - We build a JSON object representing a typed array similar to how Node.js `Buffer` objects are represented. See [Buffer][1]. * * [1]: https://nodejs.org/api/buffer.html#buffer_buf_tojson * * @param {TypedArray} arr - typed array to serialize * @throws {TypeError} first argument must be a typed array * @returns {Object} JSON representation * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var arr = new Float64Array( [ 5.0, 3.0 ] ); * var json = toJSON( arr ); * // returns { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] } */ function toJSON( arr ) { var out; var i; if ( !_$isTypedArray_171( arr ) ) { throw new TypeError( 'invalid argument. Must provide a typed array. Value: `' + arr + '`.' ); } out = {}; out.type = _$typeName_19( arr ); out.data = []; for ( i = 0; i < arr.length; i++ ) { out.data.push( arr[ i ] ); } return out; } // EXPORTS // var _$toJSON_18 = toJSON; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a JSON representation of a typed array. * * @module @stdlib/array/to-json * * @example * var Float64Array = require( '@stdlib/array/float64' ); * var toJSON = require( '@stdlib/array/to-json' ); * * var arr = new Float64Array( [ 5.0, 3.0 ] ); * var json = toJSON( arr ); * // returns { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] } */ // MODULES // /* removed: var _$toJSON_18 = require( './to_json.js' ); */; // EXPORTS // var _$toJSON_17 = _$toJSON_18; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$INT32_MAX_211 = require( '@stdlib/constants/math/int32-max' ); */; /* removed: var _$floor_235 = require( '@stdlib/math/base/special/floor' ); */; // VARIABLES // var MAX = _$INT32_MAX_211 - 1; // MAIN // /** * Returns a pseudorandom integer on the interval \\([1, 2^{31}-1)\\). * * @private * @returns {PositiveInteger} pseudorandom integer * * @example * var v = randint32(); * // returns */ function randint32() { var v = _$floor_235( 1.0 + (MAX*Math.random()) ); // eslint-disable-line stdlib/no-builtin-math return v|0; // asm type annotation } // EXPORTS // var _$randint32_807 = randint32; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable max-len */ 'use strict'; // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$setNonEnumerableReadOnlyAccessor_818 = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); */; /* removed: var _$setNonEnumerableReadWriteAccessor_822 = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; var __isBoolean_804 = _$isBoolean_86.isPrimitive; /* removed: var _$isCollection_94 = require( '@stdlib/assert/is-collection' ); */; var __isPositiveInteger_804 = _$isPositiveInteger_155.isPrimitive; /* removed: var _$isInt32Array_116 = require( '@stdlib/assert/is-int32array' ); */; /* removed: var _$INT32_MAX_211 = require( '@stdlib/constants/math/int32-max' ); */; /* removed: var _$ctor_10 = require( '@stdlib/array/int32' ); */; /* removed: var _$gcopy_186 = require( '@stdlib/blas/base/gcopy' ); */; /* removed: var _$toJSON_17 = require( '@stdlib/array/to-json' ); */; /* removed: var _$randint32_807 = require( './rand_int32.js' ); */; // VARIABLES // var NORMALIZATION_CONSTANT = (_$INT32_MAX_211 - 1)|0; // asm type annotation var MAX_SEED = (_$INT32_MAX_211 - 1)|0; // asm type annotation var A = 16807|0; // asm type annotation // Define the state array schema version: var STATE_ARRAY_VERSION = 1; // NOTE: anytime the state array schema changes, this value should be incremented!!! // Define the number of sections in the state array: var NUM_STATE_SECTIONS = 2; // state, seed // Define the index offset of the "state" section in the state array: var STATE_SECTION_OFFSET = 2; // | version | num_sections | state_length | ...state | seed_length | ...seed | // Define the index offset of the seed section in the state array: var SEED_SECTION_OFFSET = 4; // | version | num_sections | state_length | ...state | seed_length | ...seed | // Define the length of the "fixed" length portion of the state array: var STATE_FIXED_LENGTH = 5; // 1 (version) + 1 (num_sections) + 1 (state_length) + 1 (state) + 1 (seed_length) // FUNCTIONS // /** * Verifies state array integrity. * * @private * @param {Int32Array} state - state array * @param {boolean} FLG - flag indicating whether the state array was provided as an option (true) or an argument (false) * @returns {(Error|null)} an error or `null` */ function verifyState( state, FLG ) { var s1; if ( FLG ) { s1 = 'option'; } else { s1 = 'argument'; } // The state array must have a minimum length... if ( state.length < STATE_FIXED_LENGTH+1 ) { return new RangeError( 'invalid '+s1+'. `state` array has insufficient length.' ); } // The first element of the state array must equal the supported state array schema version... if ( state[ 0 ] !== STATE_ARRAY_VERSION ) { return new RangeError( 'invalid '+s1+'. `state` array has an incompatible schema version. Expected: '+STATE_ARRAY_VERSION+'. Actual: '+state[ 0 ]+'.' ); } // The second element of the state array must contain the number of sections... if ( state[ 1 ] !== NUM_STATE_SECTIONS ) { return new RangeError( 'invalid '+s1+'. `state` array has an incompatible number of sections. Expected: '+NUM_STATE_SECTIONS+'. Actual: '+state[ 1 ]+'.' ); } // The length of the "state" section must equal `1`... if ( state[ STATE_SECTION_OFFSET ] !== 1 ) { return new RangeError( 'invalid '+s1+'. `state` array has an incompatible state length. Expected: '+(1).toString()+'. Actual: '+state[ STATE_SECTION_OFFSET ]+'.' ); } // The length of the "seed" section much match the empirical length... if ( state[ SEED_SECTION_OFFSET ] !== state.length-STATE_FIXED_LENGTH ) { return new RangeError( 'invalid '+s1+'. `state` array length is incompatible with seed section length. Expected: '+(state.length-STATE_FIXED_LENGTH)+'. Actual: '+state[ SEED_SECTION_OFFSET ]+'.' ); } return null; } // MAIN // /** * Returns a linear congruential pseudorandom number generator (LCG) based on Park and Miller. * * @param {Options} [options] - options * @param {PRNGSeedMINSTD} [options.seed] - pseudorandom number generator seed * @param {PRNGStateMINSTD} [options.state] - pseudorandom number generator state * @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state * @throws {TypeError} options argument must be an object * @throws {TypeError} a seed must be either a positive integer less than the maximum signed 32-bit integer or an array-like object containing integers less than the maximum signed 32-bit integer * @throws {RangeError} a numeric seed must be a positive integer less than the maximum signed 32-bit integer * @throws {TypeError} state must be an `Int32Array` * @throws {Error} must provide a valid state * @throws {TypeError} `copy` option must be a boolean * @returns {PRNG} LCG PRNG * * @example * var minstd = factory(); * * var v = minstd(); * // returns * * @example * // Return a seeded LCG: * var minstd = factory({ * 'seed': 1234 * }); * * var v = minstd(); * // returns 20739838 */ function __factory_804( options ) { var STATE; var state; var opts; var seed; var slen; var err; opts = {}; if ( arguments.length ) { if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } if ( _$hasOwnProp_55( options, 'copy' ) ) { opts.copy = options.copy; if ( !__isBoolean_804( options.copy ) ) { throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + options.copy + '`.' ); } } if ( _$hasOwnProp_55( options, 'state' ) ) { state = options.state; opts.state = true; if ( !_$isInt32Array_116( state ) ) { throw new TypeError( 'invalid option. `state` option must be an Int32Array. Option: `' + state + '`.' ); } err = verifyState( state, true ); if ( err ) { throw err; } if ( opts.copy === false ) { STATE = state; } else { STATE = new _$ctor_10( state.length ); _$gcopy_186( state.length, state, 1, STATE, 1 ); } // Create a state "view": state = new _$ctor_10( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 ); // Create a seed "view": seed = new _$ctor_10( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), state[ SEED_SECTION_OFFSET ] ); } // If provided a PRNG state, we ignore the `seed` option... if ( seed === void 0 ) { if ( _$hasOwnProp_55( options, 'seed' ) ) { seed = options.seed; opts.seed = true; if ( __isPositiveInteger_804( seed ) ) { if ( seed > MAX_SEED ) { throw new RangeError( 'invalid option. `seed` option must be a positive integer less than the maximum signed 32-bit integer. Option: `' + seed + '`.' ); } seed |= 0; // asm type annotation } else if ( _$isCollection_94( seed ) && seed.length > 0 ) { slen = seed.length; STATE = new _$ctor_10( STATE_FIXED_LENGTH+slen ); // Initialize sections: STATE[ 0 ] = STATE_ARRAY_VERSION; STATE[ 1 ] = NUM_STATE_SECTIONS; STATE[ STATE_SECTION_OFFSET ] = 1; STATE[ SEED_SECTION_OFFSET ] = slen; // Copy the provided seed array to prevent external mutation, as mutation would lead to an inability to reproduce PRNG values according to the PRNG's stated seed: _$gcopy_186.ndarray( slen, seed, 1, 0, STATE, 1, SEED_SECTION_OFFSET+1 ); // Create a state "view": state = new _$ctor_10( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 ); // Create a seed "view": seed = new _$ctor_10( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), slen ); // Initialize the internal PRNG state: state[ 0 ] = seed[ 0 ]; } else { throw new TypeError( 'invalid option. `seed` option must be either a positive integer less than the maximum signed 32-bit integer or an array-like object containing integer values less than the maximum signed 32-bit integer. Option: `' + seed + '`.' ); } } else { seed = _$randint32_807()|0; // asm type annotation } } } else { seed = _$randint32_807()|0; // asm type annotation } if ( state === void 0 ) { STATE = new _$ctor_10( STATE_FIXED_LENGTH+1 ); // Initialize sections: STATE[ 0 ] = STATE_ARRAY_VERSION; STATE[ 1 ] = NUM_STATE_SECTIONS; STATE[ STATE_SECTION_OFFSET ] = 1; STATE[ SEED_SECTION_OFFSET ] = 1; STATE[ SEED_SECTION_OFFSET+1 ] = seed; // Create a state "view": state = new _$ctor_10( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 ); // Create a seed "view": seed = new _$ctor_10( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 ); // Initialize the internal PRNG state: state[ 0 ] = seed[ 0 ]; } _$setNonEnumerableReadOnly_820( minstd, 'NAME', 'minstd' ); _$setNonEnumerableReadOnlyAccessor_818( minstd, 'seed', getSeed ); _$setNonEnumerableReadOnlyAccessor_818( minstd, 'seedLength', getSeedLength ); _$setNonEnumerableReadWriteAccessor_822( minstd, 'state', getState, setState ); _$setNonEnumerableReadOnlyAccessor_818( minstd, 'stateLength', getStateLength ); _$setNonEnumerableReadOnlyAccessor_818( minstd, 'byteLength', getStateSize ); _$setNonEnumerableReadOnly_820( minstd, 'toJSON', toJSON ); _$setNonEnumerableReadOnly_820( minstd, 'MIN', 1 ); _$setNonEnumerableReadOnly_820( minstd, 'MAX', _$INT32_MAX_211-1 ); _$setNonEnumerableReadOnly_820( minstd, 'normalized', normalized ); _$setNonEnumerableReadOnly_820( normalized, 'NAME', minstd.NAME ); _$setNonEnumerableReadOnlyAccessor_818( normalized, 'seed', getSeed ); _$setNonEnumerableReadOnlyAccessor_818( normalized, 'seedLength', getSeedLength ); _$setNonEnumerableReadWriteAccessor_822( normalized, 'state', getState, setState ); _$setNonEnumerableReadOnlyAccessor_818( normalized, 'stateLength', getStateLength ); _$setNonEnumerableReadOnlyAccessor_818( normalized, 'byteLength', getStateSize ); _$setNonEnumerableReadOnly_820( normalized, 'toJSON', toJSON ); _$setNonEnumerableReadOnly_820( normalized, 'MIN', (minstd.MIN-1.0) / NORMALIZATION_CONSTANT ); _$setNonEnumerableReadOnly_820( normalized, 'MAX', (minstd.MAX-1.0) / NORMALIZATION_CONSTANT ); return minstd; /** * Returns the PRNG seed. * * @private * @returns {PRNGSeedMINSTD} seed */ function getSeed() { var len = STATE[ SEED_SECTION_OFFSET ]; return _$gcopy_186( len, seed, 1, new _$ctor_10( len ), 1 ); } /** * Returns the PRNG seed length. * * @private * @returns {PositiveInteger} seed length */ function getSeedLength() { return STATE[ SEED_SECTION_OFFSET ]; } /** * Returns the PRNG state length. * * @private * @returns {PositiveInteger} state length */ function getStateLength() { return STATE.length; } /** * Returns the PRNG state size (in bytes). * * @private * @returns {PositiveInteger} state size (in bytes) */ function getStateSize() { return STATE.byteLength; } /** * Returns the current PRNG state. * * ## Notes * * - The PRNG state array is comprised of a preamble followed by `2` sections: * * 0. preamble (version + number of sections) * 1. internal PRNG state * 2. PRNG seed * * - The first element of the PRNG state array preamble is the state array schema version. * * - The second element of the PRNG state array preamble is the number of state array sections (i.e., `2`). * * - The first element of each section following the preamble specifies the section length. The remaining section elements comprise the section contents. * * @private * @returns {PRNGStateMINSTD} current state */ function getState() { var len = STATE.length; return _$gcopy_186( len, STATE, 1, new _$ctor_10( len ), 1 ); } /** * Sets the PRNG state. * * ## Notes * * - If PRNG state is "shared" (meaning a state array was provided during PRNG creation and **not** copied) and one sets the generator state to a state array having a different length, the PRNG does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize PRNG output according to the new shared state array, the state array for **each** relevant PRNG must be **explicitly** set. * - If PRNG state is "shared" and one sets the generator state to a state array of the same length, the PRNG state is updated (along with the state of all other PRNGs sharing the PRNG's state array). * * @private * @param {PRNGStateMINSTD} s - generator state * @throws {TypeError} must provide an `Int32Array` * @throws {Error} must provide a valid state */ function setState( s ) { var err; if ( !_$isInt32Array_116( s ) ) { throw new TypeError( 'invalid argument. Must provide an Int32Array. Value: `' + s + '`.' ); } err = verifyState( s, false ); if ( err ) { throw err; } if ( opts.copy === false ) { if ( opts.state && s.length === STATE.length ) { _$gcopy_186( s.length, s, 1, STATE, 1 ); // update current shared state } else { STATE = s; // point to new shared state opts.state = true; // setting this flag allows updating a shared state even if a state array was not provided at PRNG creation } } else { // Check if we can reuse allocated memory... if ( s.length !== STATE.length ) { STATE = new _$ctor_10( s.length ); // reallocate } _$gcopy_186( s.length, s, 1, STATE, 1 ); } // Create a new state "view": state = new _$ctor_10( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 ); // Create a new seed "view": seed = new _$ctor_10( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), STATE[ SEED_SECTION_OFFSET ] ); } /** * Serializes the pseudorandom number generator as a JSON object. * * ## Notes * * - `JSON.stringify()` implicitly calls this method when stringifying a PRNG. * * @private * @returns {Object} JSON representation */ function toJSON() { var out = {}; out.type = 'PRNG'; out.name = minstd.NAME; out.state = _$toJSON_17( STATE ); out.params = []; return out; } /** * Generates a pseudorandom integer on the interval \\( [1,2^{31}-1) \\). * * @private * @returns {integer32} pseudorandom integer */ function minstd() { var s = state[ 0 ]|0; // asm type annotation s = ( (A*s)%_$INT32_MAX_211 )|0; // asm type annotation state[ 0 ] = s; return s|0; // asm type annotation } /** * Generates a pseudorandom number on the interval \\( [0,1) \\). * * @private * @returns {number} pseudorandom number */ function normalized() { return (minstd()-1) / NORMALIZATION_CONSTANT; } } // EXPORTS // var _$factory_804 = __factory_804; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$factory_804 = require( './factory.js' ); */; /* removed: var _$randint32_807 = require( './rand_int32.js' ); */; // MAIN // /** * Generates a pseudorandom integer on the interval \\( [1,2^{31}-1) \\). * * ## Method * * Linear congruential generators (LCGs) use the recurrence relation * * ```tex * X_{n+1} = ( a \cdot X_n + c ) \operatorname{mod}(m) * ``` * * where the modulus \\( m \\) is a prime number or power of a prime number and \\( a \\) is a primitive root modulo \\( m \\). * * * * For an LCG to be a Lehmer RNG, the seed \\( X_0 \\) must be coprime to \\( m \\). * * * * In this implementation, the constants \\( a \\), \\( c \\), and \\( m \\) have the values * * ```tex * \begin{align*} * a &= 7^5 = 16807 \\ * c &= 0 \\ * m &= 2^{31} - 1 = 2147483647 * \end{align*} * ``` * * * * The constant \\( m \\) is a Mersenne prime (modulo \\(31\\)). * * * * * * The constant \\( a \\) is a primitive root (modulo \\(31\\)). * * * * Accordingly, the maximum possible product is * * ```tex * 16807 \cdot (m - 1) \approx 2^{46} * ``` * * The values for \\( a \\), \\( c \\), and \\( m \\) are taken from Park and Miller, "Random Number Generators: Good Ones Are Hard To Find". Park's and Miller's article is also the basis for a recipe in the second edition of _Numerical Recipes in C_. * * * ## Notes * * - The generator has a period of approximately \\(2.1\mbox{e}9\\) (see [Numerical Recipes in C, 2nd Edition](#references), p. 279). * * * ## References * * - Park, S. K., and K. W. Miller. 1988. "Random Number Generators: Good Ones Are Hard to Find." _Communications of the ACM_ 31 (10). New York, NY, USA: ACM: 1192–1201. doi:[10.1145/63039.63042](http://dx.doi.org/10.1145/63039.63042). * - Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. 1992. _Numerical Recipes in C: The Art of Scientific Computing, Second Edition_. Cambridge University Press. * * * @function minstd * @type {PRNG} * @returns {PositiveInteger} pseudorandom integer * * @example * var v = minstd(); * // returns */ var minstd = _$factory_804({ 'seed': _$randint32_807() }); // EXPORTS // var _$minstd_806 = minstd; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * A linear congruential pseudorandom number generator (LCG) based on Park and Miller. * * @module @stdlib/random/base/minstd * * @example * var minstd = require( '@stdlib/random/base/minstd' ); * * var v = minstd(); * // returns * * @example * var factory = require( '@stdlib/random/base/minstd' ).factory; * * var minstd = factory({ * 'seed': 1234 * }); * * var v = minstd(); * // returns 20739838 */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$minstd_806 = require( './main.js' ); */; /* removed: var _$factory_804 = require( './factory.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$minstd_806, 'factory', _$factory_804 ); // EXPORTS // var _$minstd_805 = _$minstd_806; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Writes a plot (rendered as a virtual DOM tree) to `stdout`. * * @private * @param {VTree} plot - virtual tree */ function view( plot ) { console.log( JSON.stringify( plot ) ); } // EXPORTS // var _$view_327 = view; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Writes a plot (rendered as a virtual DOM tree) to `stdout`. * * @private * @param {VTree} plot - virtual tree */ function __view_724( plot ) { console.log( JSON.stringify( plot ) ); } // EXPORTS // var _$view_724 = __view_724; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$view_327 = require( './stdout' ); */; // MAIN // /** * Generates a plot view. * * @private * @param {Plot} plot - plot context * @param {string} viewer - plot viewer * @param {VTree} vtree - virtual tree * @throws {Error} must specify a supported viewer * @returns {void} */ function __view_328( plot, viewer, vtree ) { if ( viewer === 'none' ) { return; } if ( viewer === 'stdout' ) { return _$view_327( vtree ); } if ( viewer === 'browser' ) { throw new Error( 'invalid argument. Must provide a supported viewer. Value: `'+viewer+'`.' ); } if ( viewer === 'terminal' ) { // TODO: ASCII return; } throw new Error( 'invalid argument. Must provide a supported viewer. Value: `'+viewer+'`.' ); } // EXPORTS // var _$view_328 = __view_328; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$view_724 = require( './stdout' ); */; // MAIN // /** * Generates a plot view. * * @private * @param {Plot} plot - plot context * @param {string} viewer - plot viewer * @param {VTree} vtree - virtual tree * @throws {Error} must specify a supported viewer * @returns {void} */ function __view_725( plot, viewer, vtree ) { if ( viewer === 'none' ) { return; } if ( viewer === 'stdout' ) { return _$view_724( vtree ); } if ( viewer === 'browser' ) { throw new Error( 'invalid argument. Must provide a supported viewer. Value: `'+viewer+'`.' ); } if ( viewer === 'terminal' ) { // TODO: ASCII return; } throw new Error( 'invalid argument. Must provide a supported viewer. Value: `'+viewer+'`.' ); } // EXPORTS // var _$view_725 = __view_725; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Creates a function which always returns the same value. * * @param {*} [value] - value to always return * @returns {Function} constant function * * @example * var fcn = wrap( 3.14 ); * * var v = fcn(); * // returns 3.14 * * v = fcn(); * // returns 3.14 * * v = fcn(); * // returns 3.14 */ function wrap( value ) { return constantFunction; /** * Constant function. * * @private * @returns {*} constant value */ function constantFunction() { return value; } } // EXPORTS // var _$wrap_810 = wrap; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a constant function. * * @module @stdlib/utils/constant-function * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var fcn = constantFunction( 3.14 ); * * var v = fcn(); * // returns 3.14 * * v = fcn(); * // returns 3.14 * * v = fcn(); * // returns 3.14 */ // MODULES // /* removed: var _$wrap_810 = require( './constant_function.js' ); */; // EXPORTS // var _$constantFunction_811 = _$wrap_810; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$constantFunction_811 = require( '@stdlib/utils/constant-function' ); */; // MAIN // var __f_134 = _$constantFunction_811( false ); // EXPORTS // var _$f_134 = __f_134; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isnan_592 = _$isnan_128.isPrimitive; // VARIABLES // var debug = _$browser_913( 'plot:accessor:is-defined' ); // MAIN // /** * Accessor function which determines whether a datum is defined. * * @private * @param {number} d - datum * @param {integer} i - index * @returns {boolean} boolean indicating whether a datum is defined */ function isDefined( d ) { var bool = !__isnan_592( d ); debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); return bool; } // EXPORTS // var _$isDefined_592 = isDefined; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$f_134 = require( '@stdlib/assert/is-node-repl' ); */; /* removed: var _$isDefined_592 = require( './accessors/is_defined.js' ); */; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_593() { var isREPL; var o; isREPL = _$f_134(); o = {}; // Boolean indicating whether to re-render on a change event: o.autoRender = false; // Boolean indicating whether to generate an updated view on a render event: o.autoView = false; // Data colors: o.colors = 'category10'; // Plot description: o.description = ''; // Plot engine: o.engine = 'svg'; // Plot height: o.height = 400; // px // Accessor indicating whether a datum is defined: o.isDefined = _$isDefined_592; // Data labels: o.labels = []; // Data line opacity: o.lineOpacity = 0.9; // [0,1] // Data line style(s): o.lineStyle = '-'; // Data line width(s): o.lineWidth = 2; // px // FIXME: padding props depend on orientation (may require using `null` to flag) // Bottom padding: o.paddingBottom = 80; // px // Left padding: o.paddingLeft = 90; // px // Right padding: o.paddingRight = 20; // px // Top padding: o.paddingTop = 80; // px // Render format: o.renderFormat = 'vdom'; // Data symbols: o.symbols = 'none'; // Symbols opacity: o.symbolsOpacity = 0.9; // [0,1] // Symbols size: o.symbolsSize = 6; // px // Plot title: o.title = ''; // Plot viewer: if ( isREPL ) { o.viewer = 'window'; } else { o.viewer = 'none'; } // Plot width: o.width = 400; // px // x-values: o.x = []; // x-axis orientation: o.xAxisOrient = 'bottom'; // x-axis label: o.xLabel = 'x'; // Maximum value of x-axis domain: o.xMax = null; // Minimum value of x-axis domain: o.xMin = null; // Number of x-axis tick marks: o.xNumTicks = 5; // Boolean indicating whether to render a rug plot along the x-axis: o.xRug = false; // x-axis rug orientation: o.xRugOrient = 'bottom'; // x-axis rug opacity: o.xRugOpacity = 0.1; // [0,1] // x-axis rug tick (tassel) size: o.xRugSize = 6; // px // x-axis scale: o.xScale = 'linear'; // x-axis tick format: o.xTickFormat = null; // y-values: o.y = []; // y-axis orientation: o.yAxisOrient = 'left'; // y-axis label: o.yLabel = 'y'; // Maximum value of y-axis domain: o.yMax = null; // Minimum value of y-axis domain: o.yMin = null; // Number of y-axis tick marks: o.yNumTicks = 5; // Boolean indicating whether to render a rug plot along the y-axis: o.yRug = false; // y-axis rug orientation: o.yRugOrient = 'left'; // y-axis rug opacity: o.yRugOpacity = 0.1; // [0,1] // y-axis rug tick (tassel) size: o.yRugSize = 6; // px // y-axis scale: o.yScale = 'linear'; // y-axis tick format: o.yTickFormat = null; return o; } // EXPORTS // var _$defaults_593 = __defaults_593; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // VARIABLES // var __debug_677 = _$browser_913( 'plot:set:x' ); // MAIN // /** * Sets the plot `x` values. * * @private * @param {Array} x - x values * @throws {TypeError} must be an array * @returns {void} */ function set( x ) { /* eslint-disable no-invalid-this */ if ( !_$isArray_83( x ) ) { throw new TypeError( 'invalid value. `x` must be an array. Value: `' + x + '.`' ); } __debug_677( 'Current value: %s.', JSON.stringify( this._xData ) ); this._xData = x.slice(); __debug_677( 'New Value: %s.', JSON.stringify( this._xData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_677 = set; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the plot `x` values. * * @private * @returns {Array} x values */ function get() { /* eslint-disable no-invalid-this */ return this._xData.slice(); } // EXPORTS // var _$get_676 = get; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // VARIABLES // var __debug_706 = _$browser_913( 'plot:set:y' ); // MAIN // /** * Sets the plot `y` values. * * @private * @param {Array} y - y values * @throws {TypeError} must be an array * @returns {void} */ function __set_706( y ) { /* eslint-disable no-invalid-this */ if ( !_$isArray_83( y ) ) { throw new TypeError( 'invalid value. `y` must be an array. Value: `' + y + '.`' ); } __debug_706( 'Current value: %s.', JSON.stringify( this._yData ) ); this._yData = y.slice(); __debug_706( 'New Value: %s.', JSON.stringify( this._yData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_706 = __set_706; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the plot `y` values. * * @private * @returns {Array} y values */ function __get_705() { /* eslint-disable no-invalid-this */ return this._yData.slice(); } // EXPORTS // var _$get_705 = __get_705; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // MAIN // /** * Tests if a value is an empty array. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is an empty array * * @example * var bool = isEmptyArray( [] ); * // returns true * * @example * var bool = isEmptyArray( [ 1, 2, 3 ] ); * // returns false * * @example * var bool = isEmptyArray( {} ); * // returns false */ function isEmptyArray( value ) { return ( _$isArray_83( value ) && value.length === 0 ); } // EXPORTS // var _$isEmptyArray_97 = isEmptyArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an empty array. * * @module @stdlib/assert/is-empty-array * * @example * var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); * * var bool = isEmptyArray( [] ); * // returns true * * bool = isEmptyArray( [ 1, 2, 3 ] ); * // returns false * * bool = isEmptyArray( {} ); * // returns false */ // MODULES // /* removed: var _$isEmptyArray_97 = require( './main.js' ); */; // EXPORTS // var _$isEmptyArray_96 = _$isEmptyArray_97; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an array of strings. * * @module @stdlib/assert/is-string-array * * @example * var isStringArray = require( '@stdlib/assert/is-string-array' ); * * var bool = isStringArray( [ 'abc', 'def' ] ); * // returns true * * bool = isStringArray( [ 'abc', 123 ] ); * // returns false * * @example * var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; * * var bool = isStringArray( [ 'abc', 'def' ] ); * // returns true * * bool = isStringArray( [ 'abc', new String( 'def' ) ] ); * // returns false * * @example * var isStringArray = require( '@stdlib/assert/is-string-array' ).objects; * * var bool = isStringArray( [ new String( 'abc' ), new String( 'def' ) ] ); * // returns true * * bool = isStringArray( [ new String( 'abc' ), 'def' ] ); * // returns false */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$arrayfcn_183 = require( '@stdlib/assert/tools/array-function' ); */; /* removed: var _$isString_164 = require( '@stdlib/assert/is-string' ); */; // MAIN // var isStringArray = _$arrayfcn_183( _$isString_164 ); _$setNonEnumerableReadOnly_820( isStringArray, 'primitives', _$arrayfcn_183( _$isString_164.isPrimitive ) ); _$setNonEnumerableReadOnly_820( isStringArray, 'objects', _$arrayfcn_183( _$isString_164.isObject ) ); // EXPORTS // var _$isStringArray_163 = isStringArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isEmptyArray_96 = require( '@stdlib/assert/is-empty-array' ); */; var __isStringArray_616 = _$isStringArray_163.primitives; // VARIABLES // var __debug_616 = _$browser_913( 'plot:set:labels' ); // MAIN // /** * Sets the data labels. * * @private * @param {(StringArray|EmptyArray)} labels - data labels * @throws {TypeError} must be either an array of strings or an empty array * @returns {void} */ function __set_616( labels ) { /* eslint-disable no-invalid-this */ if ( !_$isEmptyArray_96( labels ) && !__isStringArray_616( labels ) ) { throw new TypeError( 'invalid value. `labels` must be either an array of strings or an empty array. Value: `' + labels + '.`' ); } __debug_616( 'Current value: %s.', JSON.stringify( this._labels ) ); this._labels = labels.slice(); __debug_616( 'New Value: %s.', JSON.stringify( this._labels ) ); this.emit( 'change' ); } // EXPORTS // var _$set_616 = __set_616; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data labels. * * @private * @returns {(EmptyArray|StringArray)} labels */ function __get_273() { /* eslint-disable no-invalid-this */ return this._labels.slice(); } // EXPORTS // var _$get_273 = __get_273; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data labels. * * @private * @returns {(EmptyArray|StringArray)} labels */ function __get_615() { /* eslint-disable no-invalid-this */ return this._labels.slice(); } // EXPORTS // var _$get_615 = __get_615; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_614 = _$browser_913( 'plot:set:is-defined' ); // MAIN // /** * Sets the accessor for defined values. * * @private * @param {Function} fcn - accessor * @throws {TypeError} must be a function */ function __set_614( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `isDefined` must be a function. Value: `' + fcn + '.`' ); } if ( fcn !== this._isDefined ) { __debug_614( 'Current value: %s.', this._isDefined ); this._isDefined = fcn; __debug_614( 'New Value: %s.', this._isDefined ); this.emit( 'change' ); } } // EXPORTS // var _$set_614 = __set_614; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the accessor for defined values. * * @private * @returns {Function} accessor */ function __get_493() { /* eslint-disable no-invalid-this */ return this._isDefined; } // EXPORTS // var _$get_493 = __get_493; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the accessor for defined values. * * @private * @returns {Function} accessor */ function __get_613() { /* eslint-disable no-invalid-this */ return this._isDefined; } // EXPORTS // var _$get_613 = __get_613; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /* * See [D3]{@link https://github.com/d3/d3-scale/blob/master/README.md}. */ var COLORS = {}; COLORS.category10 = [ '#1f77b4', // 'category10-1' '#ff7f0e', // 'category10-2' '#2ca02c', // 'category10-3' '#d62728', // 'category10-4' '#9467bd', // 'category10-5' '#8c564b', // 'category10-6' '#e377c2', // 'category10-7' '#7f7f7f', // 'category10-8' '#bcdb22', // 'category10-9' '#17becf' // 'category10-10' ]; COLORS.category20 = [ '#1f77b4', // 'category20-1' '#aec7e8', // 'category20-2' '#ff7f0e', // 'category20-3' '#ffbb78', // 'category20-4' '#2ca02c', // 'category20-5' '#98df8a', // 'category20-6' '#d62728', // 'category20-7' '#ff9896', // 'category20-8' '#9467bd', // 'category20-9' '#c5b0d5', // 'category20-10' '#8c564b', // 'category20-11' '#c49c94', // 'category20-12' '#e377c2', // 'category20-13' '#f7b6d2', // 'category20-14' '#7f7f7f', // 'category20-15' '#c7c7c7', // 'category20-16' '#bcbd22', // 'category20-17' '#dbdb8d', // 'category20-18' '#17becf', // 'category20-19' '#9edae5' // 'category20-20' ]; COLORS.category20b = [ '#393b79', // 'category20b-1' '#5254a3', // 'category20b-2' '#6b6ecf', // 'category20b-3' '#9c9ede', // 'category20b-4' '#637939', // 'category20b-5' '#8ca252', // 'category20b-6' '#b5cf6b', // 'category20b-7' '#cedb9c', // 'category20b-8' '#8c6d31', // 'category20b-9' '#bd9e39', // 'category20b-10' '#e7ba52', // 'category20b-11' '#e7cb94', // 'category20b-12' '#843c39', // 'category20b-13' '#ad494a', // 'category20b-14' '#d6616b', // 'category20b-15' '#e7969c', // 'category20b-16' '#7b4173', // 'category20b-17' '#a55194', // 'category20b-18' '#ce6dbd', // 'category20b-19' '#de9ed6' // 'category20b-20' ]; COLORS.category20c = [ '#3182bd', // 'category20c-1' '#6baed6', // 'category20c-2' '#9ecae1', // 'category20c-3' '#c6dbef', // 'category20c-4' '#e6550d', // 'category20c-5' '#fd8d3c', // 'category20c-6' '#fdae6b', // 'category20c-7' '#fdd0a2', // 'category20c-8' '#31a354', // 'category20c-9' '#74c476', // 'category20c-10' '#a1d99b', // 'category20c-11' '#c7e9c0', // 'category20c-12' '#756bb1', // 'category20c-13' '#9e9ac8', // 'category20c-14' '#bcbddc', // 'category20c-15' '#dadaeb', // 'category20c-16' '#636363', // 'category20c-17' '#969696', // 'category20c-18' '#bdbdbd', // 'category20c-19' '#d9d9d9' // 'category20c-20' ]; // EXPORTS // var _$COLORS_601 = COLORS; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_603 = _$isString_164.isPrimitive; var __isStringArray_603 = _$isStringArray_163.primitives; /* removed: var _$COLORS_601 = require( './colors.js' ); */; // VARIABLES // var __debug_603 = _$browser_913( 'plot:set:colors' ); // MAIN // /** * Sets the data colors. * * @private * @param {(string|StringArray)} v - data colors * @throws {TypeError} must be either a string or an array of strings * @returns {void} */ function __set_603( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_603( v ); if ( !isStr && !__isStringArray_603( v ) ) { throw new TypeError( 'invalid value. `colors` must be either a string or a string array. Value: `' + v + '.`' ); } if ( isStr ) { if ( _$COLORS_601[ v ] === void 0 ) { v = [ v ]; } else { v = _$COLORS_601[ v ].slice(); } } else { v = v.slice(); } __debug_603( 'Current value: %s.', JSON.stringify( this._colors ) ); this._colors = v; __debug_603( 'New Value: %s.', JSON.stringify( this._colors ) ); this.emit( 'change' ); } // EXPORTS // var _$set_603 = __set_603; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data colors. * * @private * @returns {StringArray} colors */ function __get_602() { /* eslint-disable no-invalid-this */ return this._colors.slice(); } // EXPORTS // var _$get_602 = __get_602; var _$line_styles_278=[ "-", "--", ":", "-.", "none" ] var _$line_styles_620=[ "-", "--", ":", "-.", "none" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_621 = _$isString_164.isPrimitive; var __isStringArray_621 = _$isStringArray_163.primitives; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$line_styles_620 = require( './line_styles.json' ); */; // VARIABLES // var __debug_621 = _$browser_913( 'plot:set:line-style' ); // MAIN // /** * Sets the data line style(s). * * @private * @param {(string|StringArray)} v - line style(s) * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported line style * @returns {void} */ function __set_621( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_621( v ); var i; if ( !isStr && !__isStringArray_621( v ) ) { throw new TypeError( 'invalid value. `lineStyle` must be a string or a string array. Value: `'+v+'.`' ); } if ( isStr ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( _$indexOf_843( _$line_styles_620, v[i] ) === -1 ) { throw new Error( 'invalid value. Unsupported/unrecognized line style. Must be one of `['+_$line_styles_620.join(',')+']`. Value: `'+v[i]+'`.' ); } } __debug_621( 'Current value: %s.', JSON.stringify( this._lineStyle ) ); this._lineStyle = v; __debug_621( 'New Value: %s.', JSON.stringify( this._lineStyle ) ); this.emit( 'change' ); } // EXPORTS // var _$set_621 = __set_621; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data line style(s). * * @private * @returns {StringArray} line style(s) */ function __get_619() { /* eslint-disable no-invalid-this */ return this._lineStyle.slice(); } // EXPORTS // var _$get_619 = __get_619; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum length of a generic array. * * @module @stdlib/constants/array/max-array-length * * @example * var MAX_ARRAY_LENGTH = require( '@stdlib/constants/array/max-array-length' ); * // returns 4294967295 */ // MAIN // /** * Maximum length of a generic array. * * ```tex * 2^{32} - 1 * ``` * * @constant * @type {uinteger32} * @default 4294967295 */ var MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation // EXPORTS // var _$MAX_ARRAY_LENGTH_196 = MAX_ARRAY_LENGTH; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isInteger_222 = require( '@stdlib/math/base/assert/is-integer' ); */; /* removed: var _$MAX_ARRAY_LENGTH_196 = require( '@stdlib/constants/array/max-array-length' ); */; // MAIN // /** * Tests if a value is array-like. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is array-like * * @example * var bool = isArrayLike( [] ); * // returns true * * @example * var bool = isArrayLike( {'length':10} ); * // returns true */ function isArrayLike( value ) { return ( value !== void 0 && value !== null && typeof value !== 'function' && typeof value.length === 'number' && _$isInteger_222( value.length ) && value.length >= 0 && value.length <= _$MAX_ARRAY_LENGTH_196 ); } // EXPORTS // var _$isArrayLike_82 = isArrayLike; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is array-like. * * @module @stdlib/assert/is-array-like * * @example * var isArrayLike = require( '@stdlib/assert/is-array-like' ); * * var bool = isArrayLike( [] ); * // returns true * * bool = isArrayLike( { 'length': 10 } ); * // returns true * * bool = isArrayLike( 'beep' ); * // returns true */ // MODULES // /* removed: var _$isArrayLike_82 = require( './main.js' ); */; // EXPORTS // var _$isArrayLike_81 = _$isArrayLike_82; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // MAIN // /** * Returns a function which tests if every element in an array-like object passes a test condition. * * @param {Function} predicate - function to apply * @throws {TypeError} must provide a function * @returns {Function} an array-like object function * * @example * var isOdd = require( '@stdlib/assert/is-odd' ); * * var arr1 = [ 1, 3, 5, 7 ]; * var arr2 = [ 3, 5, 8 ]; * * var validate = arraylikefcn( isOdd ); * * var bool = validate( arr1 ); * // returns true * * bool = validate( arr2 ); * // returns false */ function arraylikefcn( predicate ) { if ( typeof predicate !== 'function' ) { throw new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' ); } return every; /** * Tests if every element in an array-like object passes a test condition. * * @private * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is an array-like object for which all elements pass a test condition */ function every( value ) { var len; var i; if ( !_$isArrayLike_81( value ) ) { return false; } len = value.length; if ( len === 0 ) { return false; } for ( i = 0; i < len; i++ ) { if ( predicate( value[ i ] ) === false ) { return false; } } return true; } } // EXPORTS // var _$arraylikefcn_184 = arraylikefcn; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a function which tests if every element in an array-like object passes a test condition. * * @module @stdlib/assert/tools/array-like-function * * @example * var isOdd = require( '@stdlib/assert/is-odd' ); * var arraylikefcn = require( '@stdlib/assert/tools/array-like-function' ); * * var arr1 = [ 1, 3, 5, 7 ]; * var arr2 = [ 3, 5, 8 ]; * * var validate = arraylikefcn( isOdd ); * * var bool = validate( arr1 ); * // returns true * * bool = validate( arr2 ); * // returns false */ // MODULES // /* removed: var _$arraylikefcn_184 = require( './arraylikefcn.js' ); */; // EXPORTS // var _$arraylikefcn_185 = _$arraylikefcn_184; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an array-like object of numbers. * * @module @stdlib/assert/is-number-array * * @example * var isNumberArray = require( '@stdlib/assert/is-number-array' ); * * var bool = isNumberArray( [ 1, 2, 3 ] ); * // returns true * * bool = isNumberArray( [ '1', 2, 3 ] ); * // returns false * * @example * var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; * * var bool = isNumberArray( [ 1, 2, 3 ] ); * // returns true * * bool = isNumberArray( [ 1, new Number( 2 ) ] ); * // returns false * * @example * var isNumberArray = require( '@stdlib/assert/is-number-array' ).objects; * * var bool = isNumberArray( [ new Number( 1 ), new Number( 2 ) ] ); * // returns true * * bool = isNumberArray( [ new Number( 1 ), 2 ] ); * // returns false */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$arraylikefcn_185 = require( '@stdlib/assert/tools/array-like-function' ); */; /* removed: var _$isNumber_143 = require( '@stdlib/assert/is-number' ); */; // MAIN // var isNumberArray = _$arraylikefcn_185( _$isNumber_143 ); _$setNonEnumerableReadOnly_820( isNumberArray, 'primitives', _$arraylikefcn_185( _$isNumber_143.isPrimitive ) ); _$setNonEnumerableReadOnly_820( isNumberArray, 'objects', _$arraylikefcn_185( _$isNumber_143.isObject ) ); // EXPORTS // var _$isNumberArray_142 = isNumberArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_618 = _$isNumber_143.isPrimitive; var __isNumberArray_618 = _$isNumberArray_142.primitives; // VARIABLES // var __debug_618 = _$browser_913( 'plot:set:line-opacity' ); // MAIN // /** * Sets the data line opacity. * * @private * @param {(number|NumberArray)} v - opacity * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @returns {void} */ function __set_618( v ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_618( v ); var i; if ( !isNum && !__isNumberArray_618( v ) ) { throw new TypeError( 'invalid value. `lineOpacity` must be a number or number array. Value: `' + v + '.`' ); } if ( isNum ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { throw new RangeError( 'invalid value. A `lineOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' ); } } __debug_618( 'Current value: %s.', JSON.stringify( this._lineOpacity ) ); this._lineOpacity = v; __debug_618( 'New Value: %s.', JSON.stringify( this._lineOpacity ) ); this.emit( 'change' ); } // EXPORTS // var _$set_618 = __set_618; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data line opacity. * * @private * @returns {NumberArray} line opacity */ function __get_617() { /* eslint-disable no-invalid-this */ return this._lineOpacity.slice(); } // EXPORTS // var _$get_617 = __get_617; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an array-like object containing only nonnegative integers. * * @module @stdlib/assert/is-nonnegative-integer-array * * @example * var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ); * * var bool = isNonNegativeIntegerArray( [ 3.0, new Number(3.0) ] ); * // returns true * * bool = isNonNegativeIntegerArray( [ 3.0, '3.0' ] ); * // returns false * * @example * var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; * * var bool = isNonNegativeIntegerArray( [ 1.0, 0.0, 10.0 ] ); * // returns true * * bool = isNonNegativeIntegerArray( [ 3.0, new Number(1.0) ] ); * // returns false * * @example * var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).objects; * * var bool = isNonNegativeIntegerArray( [ new Number(3.0), new Number(1.0) ] ); * // returns true * * bool = isNonNegativeIntegerArray( [ 1.0, 0.0, 10.0 ] ); * // returns false */ // MODULES // /* removed: var _$isNonNegativeInteger_136 = require( '@stdlib/assert/is-nonnegative-integer' ); */; /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$arraylikefcn_185 = require( '@stdlib/assert/tools/array-like-function' ); */; // MAIN // var isNonNegativeIntegerArray = _$arraylikefcn_185( _$isNonNegativeInteger_136 ); _$setNonEnumerableReadOnly_820( isNonNegativeIntegerArray, 'primitives', _$arraylikefcn_185( _$isNonNegativeInteger_136.isPrimitive ) ); _$setNonEnumerableReadOnly_820( isNonNegativeIntegerArray, 'objects', _$arraylikefcn_185( _$isNonNegativeInteger_136.isObject ) ); // EXPORTS // var _$isNonNegativeIntegerArray_135 = isNonNegativeIntegerArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_623 = _$isNonNegativeInteger_136.isPrimitive; var __isNonNegativeIntegerArray_623 = _$isNonNegativeIntegerArray_135.primitives; // VARIABLES // var __debug_623 = _$browser_913( 'plot:set:line-width' ); // MAIN // /** * Sets the data line width(s). * * @private * @param {(NonNegativeInteger|Array)} v - width * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @returns {void} */ function __set_623( v ) { /* eslint-disable no-invalid-this */ var isInt = __isNonNegativeInteger_623( v ); if ( !isInt && !__isNonNegativeIntegerArray_623( v ) ) { throw new TypeError( 'invalid value. `lineWidth` must be a nonnegative integer or nonnegative integer array. Value: `' + v + '.`' ); } if ( isInt ) { v = [ v ]; } else { v = v.slice(); } __debug_623( 'Current value: %s.', JSON.stringify( this._lineWidth ) ); this._lineWidth = v; __debug_623( 'New Value: %s.', JSON.stringify( this._lineWidth ) ); this.emit( 'change' ); } // EXPORTS // var _$set_623 = __set_623; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data line width. * * @private * @returns {Array} line width(s) */ function __get_622() { /* eslint-disable no-invalid-this */ return this._lineWidth.slice(); } // EXPORTS // var _$get_622 = __get_622; var _$symbols_641=[ "closed-circle", "open-circle", "none" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_640 = _$isString_164.isPrimitive; var __isStringArray_640 = _$isStringArray_163.primitives; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$symbols_641 = require( './symbols.json' ); */; // VARIABLES // var __debug_640 = _$browser_913( 'plot:set:symbols' ); // MAIN // /** * Sets the data symbols. * * @private * @param {(string|StringArray)} v - data symbols * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported symbol * @returns {void} */ function __set_640( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_640( v ); var i; if ( !isStr && !__isStringArray_640( v ) ) { throw new TypeError( 'invalid value. `symbols` must be a string or string array. Value: `'+v+'.`' ); } if ( isStr ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( _$indexOf_843( _$symbols_641, v[i] ) === -1 ) { throw new Error( 'invalid value. Unrecognized/unsupported symbol. Value: `['+v.join(',')+']`.' ); } } __debug_640( 'Current value: %s.', JSON.stringify( this._symbols ) ); this._symbols = v; __debug_640( 'New Value: %s.', JSON.stringify( this._symbols ) ); this.emit( 'change' ); } // EXPORTS // var _$set_640 = __set_640; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data symbols. * * @private * @returns {StringArray} symbols */ function __get_639() { /* eslint-disable no-invalid-this */ return this._symbols.slice(); } // EXPORTS // var _$get_639 = __get_639; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_638 = _$isNonNegativeInteger_136.isPrimitive; var __isNonNegativeIntegerArray_638 = _$isNonNegativeIntegerArray_135.primitives; // VARIABLES // var __debug_638 = _$browser_913( 'plot:set:symbols-size' ); // MAIN // /** * Sets the symbols size. * * @private * @param {(NonNegativeInteger|Array)} v - size * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @returns {void} */ function __set_638( v ) { /* eslint-disable no-invalid-this */ var isInt = __isNonNegativeInteger_638( v ); if ( !isInt && !__isNonNegativeIntegerArray_638( v ) ) { throw new TypeError( 'invalid value. `symbolsSize` must be a nonnegative integer or nonnegative integer array. Value: `' + v + '.`' ); } if ( isInt ) { v = [ v ]; } else { v = v.slice(); } __debug_638( 'Current value: %s.', JSON.stringify( this._symbolsSize ) ); this._symbolsSize = v; __debug_638( 'New Value: %s.', JSON.stringify( this._symbolsSize ) ); this.emit( 'change' ); } // EXPORTS // var _$set_638 = __set_638; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the symbols size. * * @private * @returns {Array} symbols sizes */ function __get_637() { /* eslint-disable no-invalid-this */ return this._symbolsSize.slice(); } // EXPORTS // var _$get_637 = __get_637; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_636 = _$isNumber_143.isPrimitive; var __isNumberArray_636 = _$isNumberArray_142.primitives; // VARIABLES // var __debug_636 = _$browser_913( 'plot:set:symbols-opacity' ); // MAIN // /** * Sets the symbol opacity. * * @private * @param {(number|NumberArray)} v - opacity * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @returns {void} */ function __set_636( v ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_636( v ); var i; if ( !isNum && !__isNumberArray_636( v ) ) { throw new TypeError( 'invalid value. `symbolsOpacity` must be a number or number array. Value: `' + v + '.`' ); } if ( isNum ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { throw new RangeError( 'invalid value. A `symbolsOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' ); } } __debug_636( 'Current value: %s.', JSON.stringify( this._symbolsOpacity ) ); this._symbolsOpacity = v; __debug_636( 'New Value: %s.', JSON.stringify( this._symbolsOpacity ) ); this.emit( 'change' ); } // EXPORTS // var _$set_636 = __set_636; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the symbols opacity. * * @private * @returns {NumberArray} symbols opacity */ function __get_635() { /* eslint-disable no-invalid-this */ return this._symbolsOpacity.slice(); } // EXPORTS // var _$get_635 = __get_635; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_162 = _$isNumber_143.isPrimitive; // MAIN // /** * Tests if a value is a number primitive having a positive value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive having a positive value * * @example * var bool = isPositiveNumber( 3.0 ); * // returns true * * @example * var bool = isPositiveNumber( new Number( 3.0 ) ); * // returns false */ function isPositiveNumber( value ) { return ( __isNumber_162( value ) && value > 0.0 ); } // EXPORTS // var _$isPositiveNumber_162 = isPositiveNumber; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_161 = _$isNumber_143.isObject; // MAIN // /** * Tests if a value is a number object having a positive value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having a positive value * * @example * var bool = isPositiveNumber( 3.0 ); * // returns false * * @example * var bool = isPositiveNumber( new Number( 3.0 ) ); * // returns true */ function __isPositiveNumber_161( value ) { return ( __isNumber_161( value ) && value.valueOf() > 0.0 ); } // EXPORTS // var _$isPositiveNumber_161 = __isPositiveNumber_161; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isPositiveNumber_162 = require( './primitive.js' ); */; /* removed: var _$isPositiveNumber_161 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a positive number. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is a positive number * * @example * var bool = isPositiveNumber( 5.0 ); * // returns true * * @example * var bool = isPositiveNumber( new Number( 5.0 ) ); * // returns true * * @example * var bool = isPositiveNumber( 3.14 ); * // returns true * * @example * var bool = isPositiveNumber( -5.0 ); * // returns false * * @example * var bool = isPositiveNumber( null ); * // returns false */ function __isPositiveNumber_160( value ) { return ( _$isPositiveNumber_162( value ) || _$isPositiveNumber_161( value ) ); } // EXPORTS // var _$isPositiveNumber_160 = __isPositiveNumber_160; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is a positive number. * * @module @stdlib/assert/is-positive-number * * @example * var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ); * * var bool = isPositiveNumber( 5.0 ); * // returns true * * bool = isPositiveNumber( new Number( 5.0 ) ); * // returns true * * bool = isPositiveNumber( 3.14 ); * // returns true * * bool = isPositiveNumber( -5.0 ); * // returns false * * bool = isPositiveNumber( null ); * // returns false * * @example * var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; * * var bool = isPositiveNumber( 3.0 ); * // returns true * * bool = isPositiveNumber( new Number( 3.0 ) ); * // returns false * * @example * var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isObject; * * var bool = isPositiveNumber( 3.0 ); * // returns false * * bool = isPositiveNumber( new Number( 3.0 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isPositiveNumber_160 = require( './main.js' ); */; /* removed: var _$isPositiveNumber_162 = require( './primitive.js' ); */; /* removed: var _$isPositiveNumber_161 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isPositiveNumber_160, 'isPrimitive', _$isPositiveNumber_162 ); _$setNonEnumerableReadOnly_820( _$isPositiveNumber_160, 'isObject', _$isPositiveNumber_161 ); // EXPORTS // var _$isPositiveNumber_159 = _$isPositiveNumber_160; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isPositiveNumber_648 = _$isPositiveNumber_159.isPrimitive; // VARIABLES // var __debug_648 = _$browser_913( 'plot:set:width' ); // MAIN // /** * Sets the width. * * @private * @param {PositiveNumber} width - width * @throws {TypeError} must be a positive number */ function __set_648( width ) { /* eslint-disable no-invalid-this */ if ( !__isPositiveNumber_648( width ) ) { throw new TypeError( 'invalid value. `width` must be a positive number. Value: `' + width + '.`' ); } if ( width !== this._width ) { __debug_648( 'Current value: %d.', this._width ); this._width = width; __debug_648( 'New value: %d.', this._width ); this.emit( 'change' ); } } // EXPORTS // var _$set_648 = __set_648; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {number} width */ function __get_298() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_298 = __get_298; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {number} width */ function __get_647() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_647 = __get_647; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isPositiveNumber_612 = _$isPositiveNumber_159.isPrimitive; // VARIABLES // var __debug_612 = _$browser_913( 'plot:set:height' ); // MAIN // /** * Sets the height. * * @private * @param {PositiveNumber} height - height * @throws {TypeError} must be a positive number * @returns {void} */ function __set_612( height ) { /* eslint-disable no-invalid-this */ if ( !__isPositiveNumber_612( height ) ) { throw new TypeError( 'invalid value. `height` must be a positive number. Value: `' + height + '.`' ); } if ( height !== this._height ) { __debug_612( 'Current value: %d.', this._height ); this._height = height; __debug_612( 'New Value: %d.', this._height ); this.emit( 'change' ); } } // EXPORTS // var _$set_612 = __set_612; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the height. * * @private * @returns {number} height */ function __get_271() { /* eslint-disable no-invalid-this */ return this._height; } // EXPORTS // var _$get_271 = __get_271; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the height. * * @private * @returns {number} height */ function __get_611() { /* eslint-disable no-invalid-this */ return this._height; } // EXPORTS // var _$get_611 = __get_611; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_627 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_627 = _$browser_913( 'plot:set:padding-left' ); // MAIN // /** * Sets the left padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_627( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_627( padding ) ) { throw new TypeError( 'invalid value. `paddingLeft` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingLeft ) { __debug_627( 'Current value: %d.', this._paddingLeft ); this._paddingLeft = padding; __debug_627( 'New value: %d.', this._paddingLeft ); this.emit( 'change' ); } } // EXPORTS // var _$set_627 = __set_627; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the left padding. * * @private * @returns {number} padding */ function __get_284() { /* eslint-disable no-invalid-this */ return this._paddingLeft; } // EXPORTS // var _$get_284 = __get_284; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the left padding. * * @private * @returns {number} padding */ function __get_626() { /* eslint-disable no-invalid-this */ return this._paddingLeft; } // EXPORTS // var _$get_626 = __get_626; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_629 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_629 = _$browser_913( 'plot:set:padding-right' ); // MAIN // /** * Sets the right padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_629( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_629( padding ) ) { throw new TypeError( 'invalid value. `paddingRight` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingRight ) { __debug_629( 'Current value: %d.', this._paddingRight ); this._paddingRight = padding; __debug_629( 'New value: %d.', this._paddingRight ); this.emit( 'change' ); } } // EXPORTS // var _$set_629 = __set_629; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the right padding. * * @private * @returns {number} padding */ function __get_286() { /* eslint-disable no-invalid-this */ return this._paddingRight; } // EXPORTS // var _$get_286 = __get_286; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the right padding. * * @private * @returns {number} padding */ function __get_628() { /* eslint-disable no-invalid-this */ return this._paddingRight; } // EXPORTS // var _$get_628 = __get_628; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_631 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_631 = _$browser_913( 'plot:set:padding-top' ); // MAIN // /** * Sets the top padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_631( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_631( padding ) ) { throw new TypeError( 'invalid value. `paddingTop` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingTop ) { __debug_631( 'Current value: %d.', this._paddingTop ); this._paddingTop = padding; __debug_631( 'New value: %d.', this._paddingTop ); this.emit( 'change' ); } } // EXPORTS // var _$set_631 = __set_631; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the top padding. * * @private * @returns {number} padding */ function __get_288() { /* eslint-disable no-invalid-this */ return this._paddingTop; } // EXPORTS // var _$get_288 = __get_288; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the top padding. * * @private * @returns {number} padding */ function __get_630() { /* eslint-disable no-invalid-this */ return this._paddingTop; } // EXPORTS // var _$get_630 = __get_630; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_625 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_625 = _$browser_913( 'plot:set:padding-bottom' ); // MAIN // /** * Sets the bottom padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_625( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_625( padding ) ) { throw new TypeError( 'invalid value. `paddingBottom` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingBottom ) { __debug_625( 'Current value: %d.', this._paddingBottom ); this._paddingBottom = padding; __debug_625( 'New value: %d.', this._paddingBottom ); this.emit( 'change' ); } } // EXPORTS // var _$set_625 = __set_625; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the bottom padding. * * @private * @returns {number} padding */ function __get_282() { /* eslint-disable no-invalid-this */ return this._paddingBottom; } // EXPORTS // var _$get_282 = __get_282; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the bottom padding. * * @private * @returns {number} padding */ function __get_624() { /* eslint-disable no-invalid-this */ return this._paddingBottom; } // EXPORTS // var _$get_624 = __get_624; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Tests if a value is `null`. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether value is null * * @example * var bool = isNull( null ); * // returns true * * bool = isNull( true ); * // returns false */ function isNull( value ) { return value === null; } // EXPORTS // var _$isNull_141 = isNull; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is `null`. * * @module @stdlib/assert/is-null * * @example * var isNull = require( '@stdlib/assert/is-null' ); * * var value = null; * * var bool = isNull( value ); * // returns true */ // MODULES // /* removed: var _$isNull_141 = require( './main.js' ); */; // EXPORTS // var _$isNull_140 = _$isNull_141; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNumber_658 = _$isNumber_143.isPrimitive; // VARIABLES // var __debug_658 = _$browser_913( 'plot:set:x-min' ); // MAIN // /** * Sets the minimum value of the x-axis domain. * * @private * @param {(Date|FiniteNumber|null)} min - minimum value * @throws {TypeError} must be a finite number primitive or null * @returns {void} */ function __set_658( min ) { /* eslint-disable no-invalid-this */ // TODO: add test to determine if evaluates to valid date? if ( !_$isNull_140( min ) && !__isNumber_658( min ) // FIXME: finite number // TODO: Date ) { throw new TypeError( 'invalid value. `xMin` must be either a finite number, Date, or null. Value: `' + min + '.`' ); } __debug_658( 'Current value: %s.', this._xMin ); this._xMin = min; __debug_658( 'New value: %s.', this._xMin ); this.emit( 'change' ); } // EXPORTS // var _$set_658 = __set_658; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Computes a minimum value. * * @private * @param {NumericArray} arr - input array * @returns {(number|null)} minimum value or null */ function getMin( arr ) { var min; var i; if ( arr.length === 0 ) { return null; } min = arr[ 0 ]; for ( i = 1; i < arr.length; i++ ) { if ( arr[ i ] < min ) { min = arr[ i ]; } } return min; } // EXPORTS // var _$getMin_722 = getMin; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$getMin_722 = require( './../../utils/min.js' ); */; // TODO: replace with mod when written // FUNCTIONS // /** * Computes a minimum value. * * @private * @param {Array} arr - input array * @returns {(number|null)} minimum value or null */ function __getMin_657( arr ) { var tmp; var i; if ( arr.length === 0 ) { return null; } tmp = new Array( arr.length ); for ( i = 0; i < arr.length; i++ ) { tmp[ i ] = _$getMin_722( arr[ i ] ); } return _$getMin_722( tmp ); } // MAIN // /** * Returns the minimum value of the x-axis domain. * * @private * @returns {number} minimum value */ function __get_657() { /* eslint-disable no-invalid-this */ var min; if ( _$isNull_140( this._xMin ) ) { min = __getMin_657( this._xData ); return ( _$isNull_140( min ) ) ? 0.0 : min; } return this._xMin; } // EXPORTS // var _$get_657 = __get_657; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNumber_656 = _$isNumber_143.isPrimitive; // VARIABLES // var __debug_656 = _$browser_913( 'line:set:x-max' ); // MAIN // /** * Sets the maximum value of the x-axis domain. * * @private * @param {(Date|FiniteNumber|null)} max - maximum value * @throws {TypeError} must be a finite number primitive or null */ function __set_656( max ) { /* eslint-disable no-invalid-this */ // TODO: add test to determine if evaluates to valid date? if ( !_$isNull_140( max ) && !__isNumber_656( max ) // FIXME: finite number // TODO: Date ) { throw new TypeError( 'invalid value. `xMax` must be either a finite number, Date, or null. Value: `' + max + '.`' ); } if ( max !== this._xMax ) { __debug_656( 'Current value: %s.', this._xMax ); this._xMax = max; __debug_656( 'New value: %s.', this._xMax ); this.emit( 'change' ); } } // EXPORTS // var _$set_656 = __set_656; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Computes a maximum value. * * @private * @param {NumericArray} arr - input array * @returns {(number|null)} maximum value or null */ function getMax( arr ) { var max; var i; if ( arr.length === 0 ) { return null; } max = arr[ 0 ]; for ( i = 1; i < arr.length; i++ ) { if ( arr[ i ] > max ) { max = arr[ i ]; } } return max; } // EXPORTS // var _$getMax_721 = getMax; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$getMax_721 = require( './../../utils/max.js' ); */; // TODO: replace with mod when written // FUNCTIONS // /** * Computes a maximum value. * * @private * @param {Array} arr - input array * @returns {(number|null)} maximum value or null */ function __getMax_655( arr ) { var tmp; var i; if ( arr.length === 0 ) { return null; } tmp = new Array( arr.length ); for ( i = 0; i < arr.length; i++ ) { tmp[ i ] = _$getMax_721( arr[ i ] ); } return _$getMax_721( tmp ); } // MAIN // /** * Returns the maximum value of the x-axis domain. * * @private * @returns {number} maximum value */ function __get_655() { /* eslint-disable no-invalid-this */ var max; if ( _$isNull_140( this._xMax ) ) { max = __getMax_655( this._xData ); return ( _$isNull_140( max ) ) ? 1.0 : max; } return this._xMax; } // EXPORTS // var _$get_655 = __get_655; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNumber_687 = _$isNumber_143.isPrimitive; // VARIABLES // var __debug_687 = _$browser_913( 'plot:set:y-min' ); // MAIN // /** * Sets the minimum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} min - minimum value * @throws {TypeError} must be a finite number primitive or null * @returns {void} */ function __set_687( min ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( min ) && !__isNumber_687( min ) // FIXME: finite number ) { throw new TypeError( 'invalid value. `yMin` must be either a finite number or null. Value: `' + min + '.`' ); } if ( min !== this._yMin ) { __debug_687( 'Current value: %d.', this._yMin ); this._yMin = min; __debug_687( 'New value: %d.', this._yMin ); this.emit( 'change' ); } } // EXPORTS // var _$set_687 = __set_687; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$getMin_722 = require( './../../utils/min.js' ); */; // TODO: replace with mod when written // FUNCTIONS // /** * Computes a minimum value. * * @private * @param {Array} arr - input array * @returns {(number|null)} minimum value or null */ function __getMin_686( arr ) { var tmp; var i; if ( arr.length === 0 ) { return null; } tmp = new Array( arr.length ); for ( i = 0; i < arr.length; i++ ) { tmp[ i ] = _$getMin_722( arr[ i ] ); } return _$getMin_722( tmp ); } // MAIN // /** * Returns the minimum value of the y-axis domain. * * @private * @returns {number} minimum value */ function __get_686() { /* eslint-disable no-invalid-this */ var min; if ( _$isNull_140( this._yMin ) ) { min = __getMin_686( this._yData ); return ( _$isNull_140( min ) ) ? 0.0 : min; } return this._yMin; } // EXPORTS // var _$get_686 = __get_686; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNumber_685 = _$isNumber_143.isPrimitive; // VARIABLES // var __debug_685 = _$browser_913( 'plot:set:y-max' ); // MAIN // /** * Sets the maximum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} max - maximum value * @throws {TypeError} must be a finite number primitive or null * @returns {void} */ function __set_685( max ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( max ) && !__isNumber_685( max ) // FIXME: finite number ) { throw new TypeError( 'invalid value. `yMax` must be either a finite number or null. Value: `' + max + '.`' ); } if ( max !== this._yMax ) { __debug_685( 'Current value: %d.', this._yMax ); this._yMax = max; __debug_685( 'New value: %d.', this._yMax ); this.emit( 'change' ); } } // EXPORTS // var _$set_685 = __set_685; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$getMax_721 = require( './../../utils/max.js' ); */; // TODO: replace with mod when written // FUNCTIONS // /** * Computes a maximum value. * * @private * @param {Array} arr - input array * @returns {(number|null)} maximum value or null */ function __getMax_684( arr ) { var tmp; var i; if ( arr.length === 0 ) { return null; } tmp = new Array( arr.length ); for ( i = 0; i < arr.length; i++ ) { tmp[ i ] = _$getMax_721( arr[ i ] ); } return _$getMax_721( tmp ); } // MAIN // /** * Returns the maximum value of the y-axis domain. * * @private * @returns {number} maximum value */ function __get_684() { /* eslint-disable no-invalid-this */ var max; if ( _$isNull_140( this._yMax ) ) { max = __getMax_684( this._yData ); return ( _$isNull_140( max ) ) ? 1.0 : max; } return this._yMax; } // EXPORTS // var _$get_684 = __get_684; var _$d3Array_903 = { exports: {} }; // https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock (function (global, factory) { typeof _$d3Array_903.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Array_903.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.d3 = global.d3 || {}))); }(this, (function (exports) { 'use strict'; function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } function bisector(compare) { if (compare.length === 1) compare = ascendingComparator(compare); return { left: function(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; } return lo; }, right: function(a, x, lo, hi) { if (lo == null) lo = 0; if (hi == null) hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; } return lo; } }; } function ascendingComparator(f) { return function(d, x) { return ascending(f(d), x); }; } var ascendingBisect = bisector(ascending); var bisectRight = ascendingBisect.right; var bisectLeft = ascendingBisect.left; function pairs(array, f) { if (f == null) f = pair; var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); while (i < n) pairs[i] = f(p, p = array[++i]); return pairs; } function pair(a, b) { return [a, b]; } function cross(values0, values1, reduce) { var n0 = values0.length, n1 = values1.length, values = new Array(n0 * n1), i0, i1, i, value0; if (reduce == null) reduce = pair; for (i0 = i = 0; i0 < n0; ++i0) { for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { values[i] = reduce(value0, values1[i1]); } } return values; } function descending(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } function number(x) { return x === null ? NaN : +x; } function variance(values, valueof) { var n = values.length, m = 0, i = -1, mean = 0, value, delta, sum = 0; if (valueof == null) { while (++i < n) { if (!isNaN(value = number(values[i]))) { delta = value - mean; mean += delta / ++m; sum += delta * (value - mean); } } } else { while (++i < n) { if (!isNaN(value = number(valueof(values[i], i, values)))) { delta = value - mean; mean += delta / ++m; sum += delta * (value - mean); } } } if (m > 1) return sum / (m - 1); } function deviation(array, f) { var v = variance(array, f); return v ? Math.sqrt(v) : v; } function extent(values, valueof) { var n = values.length, i = -1, value, min, max; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { min = max = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null) { if (min > value) min = value; if (max < value) max = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { min = max = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null) { if (min > value) min = value; if (max < value) max = value; } } } } } return [min, max]; } var array = Array.prototype; var slice = array.slice; var map = array.map; function constant(x) { return function() { return x; }; } function identity(x) { return x; } function range(start, stop, step) { start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); while (++i < n) { range[i] = start + i * step; } return range; } var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); function ticks(start, stop, count) { var reverse, i = -1, n, ticks, step; stop = +stop, start = +start, count = +count; if (start === stop && count > 0) return [start]; if (reverse = stop < start) n = start, start = stop, stop = n; if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; if (step > 0) { start = Math.ceil(start / step); stop = Math.floor(stop / step); ticks = new Array(n = Math.ceil(stop - start + 1)); while (++i < n) ticks[i] = (start + i) * step; } else { start = Math.floor(start * step); stop = Math.ceil(stop * step); ticks = new Array(n = Math.ceil(start - stop + 1)); while (++i < n) ticks[i] = (start - i) / step; } if (reverse) ticks.reverse(); return ticks; } function tickIncrement(start, stop, count) { var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); } function tickStep(start, stop, count) { var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; if (error >= e10) step1 *= 10; else if (error >= e5) step1 *= 5; else if (error >= e2) step1 *= 2; return stop < start ? -step1 : step1; } function sturges(values) { return Math.ceil(Math.log(values.length) / Math.LN2) + 1; } function histogram() { var value = identity, domain = extent, threshold = sturges; function histogram(data) { var i, n = data.length, x, values = new Array(n); for (i = 0; i < n; ++i) { values[i] = value(data[i], i, data); } var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds. if (!Array.isArray(tz)) { tz = tickStep(x0, x1, tz); tz = range(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive } // Remove any thresholds outside the domain. var m = tz.length; while (tz[0] <= x0) tz.shift(), --m; while (tz[m - 1] > x1) tz.pop(), --m; var bins = new Array(m + 1), bin; // Initialize bins. for (i = 0; i <= m; ++i) { bin = bins[i] = []; bin.x0 = i > 0 ? tz[i - 1] : x0; bin.x1 = i < m ? tz[i] : x1; } // Assign data to bins by value, ignoring any outside the domain. for (i = 0; i < n; ++i) { x = values[i]; if (x0 <= x && x <= x1) { bins[bisectRight(tz, x, 0, m)].push(data[i]); } } return bins; } histogram.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; }; histogram.domain = function(_) { return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; }; histogram.thresholds = function(_) { return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; }; return histogram; } function quantile(values, p, valueof) { if (valueof == null) valueof = number; if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); if (p >= 1) return +valueof(values[n - 1], n - 1, values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); } function freedmanDiaconis(values, min, max) { values = map.call(values, number).sort(ascending); return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3))); } function scott(values, min, max) { return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); } function max(values, valueof) { var n = values.length, i = -1, value, max; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { max = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null && value > max) { max = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { max = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null && value > max) { max = value; } } } } } return max; } function mean(values, valueof) { var n = values.length, m = n, i = -1, value, sum = 0; if (valueof == null) { while (++i < n) { if (!isNaN(value = number(values[i]))) sum += value; else --m; } } else { while (++i < n) { if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; else --m; } } if (m) return sum / m; } function median(values, valueof) { var n = values.length, i = -1, value, numbers = []; if (valueof == null) { while (++i < n) { if (!isNaN(value = number(values[i]))) { numbers.push(value); } } } else { while (++i < n) { if (!isNaN(value = number(valueof(values[i], i, values)))) { numbers.push(value); } } } return quantile(numbers.sort(ascending), 0.5); } function merge(arrays) { var n = arrays.length, m, i = -1, j = 0, merged, array; while (++i < n) j += arrays[i].length; merged = new Array(j); while (--n >= 0) { array = arrays[n]; m = array.length; while (--m >= 0) { merged[--j] = array[m]; } } return merged; } function min(values, valueof) { var n = values.length, i = -1, value, min; if (valueof == null) { while (++i < n) { // Find the first comparable value. if ((value = values[i]) != null && value >= value) { min = value; while (++i < n) { // Compare the remaining values. if ((value = values[i]) != null && min > value) { min = value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value = valueof(values[i], i, values)) != null && value >= value) { min = value; while (++i < n) { // Compare the remaining values. if ((value = valueof(values[i], i, values)) != null && min > value) { min = value; } } } } } return min; } function permute(array, indexes) { var i = indexes.length, permutes = new Array(i); while (i--) permutes[i] = array[indexes[i]]; return permutes; } function scan(values, compare) { if (!(n = values.length)) return; var n, i = 0, j = 0, xi, xj = values[j]; if (compare == null) compare = ascending; while (++i < n) { if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { xj = xi, j = i; } } if (compare(xj, xj) === 0) return j; } function shuffle(array, i0, i1) { var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), t, i; while (m) { i = Math.random() * m-- | 0; t = array[m + i0]; array[m + i0] = array[i + i0]; array[i + i0] = t; } return array; } function sum(values, valueof) { var n = values.length, i = -1, value, sum = 0; if (valueof == null) { while (++i < n) { if (value = +values[i]) sum += value; // Note: zero and null are equivalent. } } else { while (++i < n) { if (value = +valueof(values[i], i, values)) sum += value; } } return sum; } function transpose(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) { for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { row[j] = matrix[j][i]; } } return transpose; } function length(d) { return d.length; } function zip() { return transpose(arguments); } exports.bisect = bisectRight; exports.bisectRight = bisectRight; exports.bisectLeft = bisectLeft; exports.ascending = ascending; exports.bisector = bisector; exports.cross = cross; exports.descending = descending; exports.deviation = deviation; exports.extent = extent; exports.histogram = histogram; exports.thresholdFreedmanDiaconis = freedmanDiaconis; exports.thresholdScott = scott; exports.thresholdSturges = sturges; exports.max = max; exports.mean = mean; exports.median = median; exports.merge = merge; exports.min = min; exports.pairs = pairs; exports.permute = permute; exports.quantile = quantile; exports.range = range; exports.scan = scan; exports.shuffle = shuffle; exports.sum = sum; exports.ticks = ticks; exports.tickIncrement = tickIncrement; exports.tickStep = tickStep; exports.transpose = transpose; exports.variance = variance; exports.zip = zip; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Array_903 = _$d3Array_903.exports var _$d3Collection_904 = { exports: {} }; // https://d3js.org/d3-collection/ v1.0.7 Copyright 2018 Mike Bostock (function (global, factory) { typeof _$d3Collection_904.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Collection_904.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.d3 = global.d3 || {}))); }(this, (function (exports) { 'use strict'; var prefix = "$"; function Map() {} Map.prototype = map.prototype = { constructor: Map, has: function(key) { return (prefix + key) in this; }, get: function(key) { return this[prefix + key]; }, set: function(key, value) { this[prefix + key] = value; return this; }, remove: function(key) { var property = prefix + key; return property in this && delete this[property]; }, clear: function() { for (var property in this) if (property[0] === prefix) delete this[property]; }, keys: function() { var keys = []; for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); return keys; }, values: function() { var values = []; for (var property in this) if (property[0] === prefix) values.push(this[property]); return values; }, entries: function() { var entries = []; for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); return entries; }, size: function() { var size = 0; for (var property in this) if (property[0] === prefix) ++size; return size; }, empty: function() { for (var property in this) if (property[0] === prefix) return false; return true; }, each: function(f) { for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); } }; function map(object, f) { var map = new Map; // Copy constructor. if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); // Index array by numeric index or specified key function. else if (Array.isArray(object)) { var i = -1, n = object.length, o; if (f == null) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f(o = object[i], i, object), o); } // Convert object to map. else if (object) for (var key in object) map.set(key, object[key]); return map; } function nest() { var keys = [], sortKeys = [], sortValues, rollup, nest; function apply(array, depth, createResult, setResult) { if (depth >= keys.length) { if (sortValues != null) array.sort(sortValues); return rollup != null ? rollup(array) : array; } var i = -1, n = array.length, key = keys[depth++], keyValue, value, valuesByKey = map(), values, result = createResult(); while (++i < n) { if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { values.push(value); } else { valuesByKey.set(keyValue, [value]); } } valuesByKey.each(function(values, key) { setResult(result, key, apply(values, depth, createResult, setResult)); }); return result; } function entries(map$$1, depth) { if (++depth > keys.length) return map$$1; var array, sortKey = sortKeys[depth - 1]; if (rollup != null && depth >= keys.length) array = map$$1.entries(); else array = [], map$$1.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; } return nest = { object: function(array) { return apply(array, 0, createObject, setObject); }, map: function(array) { return apply(array, 0, createMap, setMap); }, entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, key: function(d) { keys.push(d); return nest; }, sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, sortValues: function(order) { sortValues = order; return nest; }, rollup: function(f) { rollup = f; return nest; } }; } function createObject() { return {}; } function setObject(object, key, value) { object[key] = value; } function createMap() { return map(); } function setMap(map$$1, key, value) { map$$1.set(key, value); } function Set() {} var proto = map.prototype; Set.prototype = set.prototype = { constructor: Set, has: proto.has, add: function(value) { value += ""; this[prefix + value] = value; return this; }, remove: proto.remove, clear: proto.clear, values: proto.keys, size: proto.size, empty: proto.empty, each: proto.each }; function set(object, f) { var set = new Set; // Copy constructor. if (object instanceof Set) object.each(function(value) { set.add(value); }); // Otherwise, assume it’s an array. else if (object) { var i = -1, n = object.length; if (f == null) while (++i < n) set.add(object[i]); else while (++i < n) set.add(f(object[i], i, object)); } return set; } function keys(map) { var keys = []; for (var key in map) keys.push(key); return keys; } function values(map) { var values = []; for (var key in map) values.push(map[key]); return values; } function entries(map) { var entries = []; for (var key in map) entries.push({key: key, value: map[key]}); return entries; } exports.nest = nest; exports.set = set; exports.map = map; exports.keys = keys; exports.values = values; exports.entries = entries; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Collection_904 = _$d3Collection_904.exports var _$d3Color_905 = { exports: {} }; // https://d3js.org/d3-color/ v1.3.0 Copyright 2019 Mike Bostock (function (global, factory) { typeof _$d3Color_905.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Color_905.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.d3 = global.d3 || {})); }(this, function (exports) { 'use strict'; function define(constructor, factory, prototype) { constructor.prototype = factory.prototype = prototype; prototype.constructor = constructor; } function extend(parent, definition) { var prototype = Object.create(parent.prototype); for (var key in definition) prototype[key] = definition[key]; return prototype; } function Color() {} var darker = 0.7; var brighter = 1 / darker; var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex3 = /^#([0-9a-f]{3})$/, reHex6 = /^#([0-9a-f]{6})$/, reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); var named = { aliceblue: 0xf0f8ff, antiquewhite: 0xfaebd7, aqua: 0x00ffff, aquamarine: 0x7fffd4, azure: 0xf0ffff, beige: 0xf5f5dc, bisque: 0xffe4c4, black: 0x000000, blanchedalmond: 0xffebcd, blue: 0x0000ff, blueviolet: 0x8a2be2, brown: 0xa52a2a, burlywood: 0xdeb887, cadetblue: 0x5f9ea0, chartreuse: 0x7fff00, chocolate: 0xd2691e, coral: 0xff7f50, cornflowerblue: 0x6495ed, cornsilk: 0xfff8dc, crimson: 0xdc143c, cyan: 0x00ffff, darkblue: 0x00008b, darkcyan: 0x008b8b, darkgoldenrod: 0xb8860b, darkgray: 0xa9a9a9, darkgreen: 0x006400, darkgrey: 0xa9a9a9, darkkhaki: 0xbdb76b, darkmagenta: 0x8b008b, darkolivegreen: 0x556b2f, darkorange: 0xff8c00, darkorchid: 0x9932cc, darkred: 0x8b0000, darksalmon: 0xe9967a, darkseagreen: 0x8fbc8f, darkslateblue: 0x483d8b, darkslategray: 0x2f4f4f, darkslategrey: 0x2f4f4f, darkturquoise: 0x00ced1, darkviolet: 0x9400d3, deeppink: 0xff1493, deepskyblue: 0x00bfff, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1e90ff, firebrick: 0xb22222, floralwhite: 0xfffaf0, forestgreen: 0x228b22, fuchsia: 0xff00ff, gainsboro: 0xdcdcdc, ghostwhite: 0xf8f8ff, gold: 0xffd700, goldenrod: 0xdaa520, gray: 0x808080, green: 0x008000, greenyellow: 0xadff2f, grey: 0x808080, honeydew: 0xf0fff0, hotpink: 0xff69b4, indianred: 0xcd5c5c, indigo: 0x4b0082, ivory: 0xfffff0, khaki: 0xf0e68c, lavender: 0xe6e6fa, lavenderblush: 0xfff0f5, lawngreen: 0x7cfc00, lemonchiffon: 0xfffacd, lightblue: 0xadd8e6, lightcoral: 0xf08080, lightcyan: 0xe0ffff, lightgoldenrodyellow: 0xfafad2, lightgray: 0xd3d3d3, lightgreen: 0x90ee90, lightgrey: 0xd3d3d3, lightpink: 0xffb6c1, lightsalmon: 0xffa07a, lightseagreen: 0x20b2aa, lightskyblue: 0x87cefa, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xb0c4de, lightyellow: 0xffffe0, lime: 0x00ff00, limegreen: 0x32cd32, linen: 0xfaf0e6, magenta: 0xff00ff, maroon: 0x800000, mediumaquamarine: 0x66cdaa, mediumblue: 0x0000cd, mediumorchid: 0xba55d3, mediumpurple: 0x9370db, mediumseagreen: 0x3cb371, mediumslateblue: 0x7b68ee, mediumspringgreen: 0x00fa9a, mediumturquoise: 0x48d1cc, mediumvioletred: 0xc71585, midnightblue: 0x191970, mintcream: 0xf5fffa, mistyrose: 0xffe4e1, moccasin: 0xffe4b5, navajowhite: 0xffdead, navy: 0x000080, oldlace: 0xfdf5e6, olive: 0x808000, olivedrab: 0x6b8e23, orange: 0xffa500, orangered: 0xff4500, orchid: 0xda70d6, palegoldenrod: 0xeee8aa, palegreen: 0x98fb98, paleturquoise: 0xafeeee, palevioletred: 0xdb7093, papayawhip: 0xffefd5, peachpuff: 0xffdab9, peru: 0xcd853f, pink: 0xffc0cb, plum: 0xdda0dd, powderblue: 0xb0e0e6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xff0000, rosybrown: 0xbc8f8f, royalblue: 0x4169e1, saddlebrown: 0x8b4513, salmon: 0xfa8072, sandybrown: 0xf4a460, seagreen: 0x2e8b57, seashell: 0xfff5ee, sienna: 0xa0522d, silver: 0xc0c0c0, skyblue: 0x87ceeb, slateblue: 0x6a5acd, slategray: 0x708090, slategrey: 0x708090, snow: 0xfffafa, springgreen: 0x00ff7f, steelblue: 0x4682b4, tan: 0xd2b48c, teal: 0x008080, thistle: 0xd8bfd8, tomato: 0xff6347, turquoise: 0x40e0d0, violet: 0xee82ee, wheat: 0xf5deb3, white: 0xffffff, whitesmoke: 0xf5f5f5, yellow: 0xffff00, yellowgreen: 0x9acd32 }; define(Color, color, { copy: function(channels) { return Object.assign(new this.constructor, this, channels); }, displayable: function() { return this.rgb().displayable(); }, hex: color_formatHex, // Deprecated! Use color.formatHex. formatHex: color_formatHex, formatHsl: color_formatHsl, formatRgb: color_formatRgb, toString: color_formatRgb }); function color_formatHex() { return this.rgb().formatHex(); } function color_formatHsl() { return hslConvert(this).formatHsl(); } function color_formatRgb() { return this.rgb().formatRgb(); } function color(format) { var m; format = (format + "").trim().toLowerCase(); return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; } function rgbn(n) { return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); } function rgba(r, g, b, a) { if (a <= 0) r = g = b = NaN; return new Rgb(r, g, b, a); } function rgbConvert(o) { if (!(o instanceof Color)) o = color(o); if (!o) return new Rgb; o = o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); } function rgb(r, g, b, opacity) { return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); } function Rgb(r, g, b, opacity) { this.r = +r; this.g = +g; this.b = +b; this.opacity = +opacity; } define(Rgb, rgb, extend(Color, { brighter: function(k) { k = k == null ? brighter : Math.pow(brighter, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, darker: function(k) { k = k == null ? darker : Math.pow(darker, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, rgb: function() { return this; }, displayable: function() { return (-0.5 <= this.r && this.r < 255.5) && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); }, hex: rgb_formatHex, // Deprecated! Use color.formatHex. formatHex: rgb_formatHex, formatRgb: rgb_formatRgb, toString: rgb_formatRgb })); function rgb_formatHex() { return "#" + hex(this.r) + hex(this.g) + hex(this.b); } function rgb_formatRgb() { var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); } function hex(value) { value = Math.max(0, Math.min(255, Math.round(value) || 0)); return (value < 16 ? "0" : "") + value.toString(16); } function hsla(h, s, l, a) { if (a <= 0) h = s = l = NaN; else if (l <= 0 || l >= 1) h = s = NaN; else if (s <= 0) h = NaN; return new Hsl(h, s, l, a); } function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); if (!(o instanceof Color)) o = color(o); if (!o) return new Hsl; if (o instanceof Hsl) return o; o = o.rgb(); var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; if (s) { if (r === max) h = (g - b) / s + (g < b) * 6; else if (g === max) h = (b - r) / s + 2; else h = (r - g) / s + 4; s /= l < 0.5 ? max + min : 2 - max - min; h *= 60; } else { s = l > 0 && l < 1 ? 0 : h; } return new Hsl(h, s, l, o.opacity); } function hsl(h, s, l, opacity) { return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); } function Hsl(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } define(Hsl, hsl, extend(Color, { brighter: function(k) { k = k == null ? brighter : Math.pow(brighter, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k = k == null ? darker : Math.pow(darker, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; return new Rgb( hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity ); }, displayable: function() { return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); }, formatHsl: function() { var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); } })); /* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; } var deg2rad = Math.PI / 180; var rad2deg = 180 / Math.PI; // https://observablehq.com/@mbostock/lab-and-rgb var K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) return hcl2lab(o); if (!(o instanceof Rgb)) o = rgbConvert(o); var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; if (r === g && g === b) x = z = y; else { x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); } return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); } function gray(l, opacity) { return new Lab(l, 0, 0, opacity == null ? 1 : opacity); } function lab(l, a, b, opacity) { return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); } function Lab(l, a, b, opacity) { this.l = +l; this.a = +a; this.b = +b; this.opacity = +opacity; } define(Lab, lab, extend(Color, { brighter: function(k) { return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, darker: function(k) { return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); }, rgb: function() { var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; x = Xn * lab2xyz(x); y = Yn * lab2xyz(y); z = Zn * lab2xyz(z); return new Rgb( lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity ); } })); function xyz2lab(t) { return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; } function lab2xyz(t) { return t > t1 ? t * t * t : t2 * (t - t0); } function lrgb2rgb(x) { return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); } function rgb2lrgb(x) { return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); } function hclConvert(o) { if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); if (!(o instanceof Lab)) o = labConvert(o); if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); var h = Math.atan2(o.b, o.a) * rad2deg; return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); } function lch(l, c, h, opacity) { return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function hcl(h, c, l, opacity) { return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); } function Hcl(h, c, l, opacity) { this.h = +h; this.c = +c; this.l = +l; this.opacity = +opacity; } function hcl2lab(o) { if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); var h = o.h * deg2rad; return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); } define(Hcl, hcl, extend(Color, { brighter: function(k) { return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); }, darker: function(k) { return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); }, rgb: function() { return hcl2lab(this).rgb(); } })); var A = -0.14861, B = +1.78277, C = -0.29227, D = -0.90649, E = +1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; function cubehelixConvert(o) { if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); if (!(o instanceof Rgb)) o = rgbConvert(o); var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); } function cubehelix(h, s, l, opacity) { return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); } function Cubehelix(h, s, l, opacity) { this.h = +h; this.s = +s; this.l = +l; this.opacity = +opacity; } define(Cubehelix, cubehelix, extend(Color, { brighter: function(k) { k = k == null ? brighter : Math.pow(brighter, k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k = k == null ? darker : Math.pow(darker, k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); return new Rgb( 255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity ); } })); exports.color = color; exports.cubehelix = cubehelix; exports.gray = gray; exports.hcl = hcl; exports.hsl = hsl; exports.lab = lab; exports.lch = lch; exports.rgb = rgb; Object.defineProperty(exports, '__esModule', { value: true }); })); _$d3Color_905 = _$d3Color_905.exports var _$d3Interpolate_907 = { exports: {} }; // https://d3js.org/d3-interpolate/ v1.3.2 Copyright 2018 Mike Bostock (function (global, factory) { typeof _$d3Interpolate_907.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Interpolate_907.exports, _$d3Color_905) : typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) : (factory((global.d3 = global.d3 || {}),global.d3)); }(this, (function (exports,d3Color) { 'use strict'; function basis(t1, v0, v1, v2, v3) { var t2 = t1 * t1, t3 = t2 * t1; return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; } function basis$1(values) { var n = values.length - 1; return function(t) { var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis((t - i / n) * n, v0, v1, v2, v3); }; } function basisClosed(values) { var n = values.length; return function(t) { var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; return basis((t - i / n) * n, v0, v1, v2, v3); }; } function constant(x) { return function() { return x; }; } function linear(a, d) { return function(t) { return a + t * d; }; } function exponential(a, b, y) { return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { return Math.pow(a + t * b, y); }; } function hue(a, b) { var d = b - a; return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); } function gamma(y) { return (y = +y) === 1 ? nogamma : function(a, b) { return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); }; } function nogamma(a, b) { var d = b - a; return d ? linear(a, d) : constant(isNaN(a) ? b : a); } var rgb = (function rgbGamma(y) { var color = gamma(y); function rgb(start, end) { var r = color((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); return function(t) { start.r = r(t); start.g = g(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } rgb.gamma = rgbGamma; return rgb; })(1); function rgbSpline(spline) { return function(colors) { var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; for (i = 0; i < n; ++i) { color = d3Color.rgb(colors[i]); r[i] = color.r || 0; g[i] = color.g || 0; b[i] = color.b || 0; } r = spline(r); g = spline(g); b = spline(b); color.opacity = 1; return function(t) { color.r = r(t); color.g = g(t); color.b = b(t); return color + ""; }; }; } var rgbBasis = rgbSpline(basis$1); var rgbBasisClosed = rgbSpline(basisClosed); function array(a, b) { var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]); for (; i < nb; ++i) c[i] = b[i]; return function(t) { for (i = 0; i < na; ++i) c[i] = x[i](t); return c; }; } function date(a, b) { var d = new Date; return a = +a, b -= a, function(t) { return d.setTime(a + b * t), d; }; } function number(a, b) { return a = +a, b -= a, function(t) { return a + b * t; }; } function object(a, b) { var i = {}, c = {}, k; if (a === null || typeof a !== "object") a = {}; if (b === null || typeof b !== "object") b = {}; for (k in b) { if (k in a) { i[k] = value(a[k], b[k]); } else { c[k] = b[k]; } } return function(t) { for (k in i) c[k] = i[k](t); return c; }; } var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); function zero(b) { return function() { return b; }; } function one(b) { return function(t) { return b(t) + ""; }; } function string(a, b) { var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b am, // current match in a bm, // current match in b bs, // string preceding current number in b, if any i = -1, // index in s s = [], // string constants and placeholders q = []; // number interpolators // Coerce inputs to strings. a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b. while ((am = reA.exec(a)) && (bm = reB.exec(b))) { if ((bs = bm.index) > bi) { // a string precedes the next number in b bs = b.slice(bi, bs); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match if (s[i]) s[i] += bm; // coalesce with previous string else s[++i] = bm; } else { // interpolate non-matching numbers s[++i] = null; q.push({i: i, x: number(am, bm)}); } bi = reB.lastIndex; } // Add remains of b. if (bi < b.length) { bs = b.slice(bi); if (s[i]) s[i] += bs; // coalesce with previous string else s[++i] = bs; } // Special optimization for only a single match. // Otherwise, interpolate each of the numbers and rejoin the string. return s.length < 2 ? (q[0] ? one(q[0].x) : zero(b)) : (b = q.length, function(t) { for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); return s.join(""); }); } function value(a, b) { var t = typeof b, c; return b == null || t === "boolean" ? constant(b) : (t === "number" ? number : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string) : b instanceof d3Color.color ? rgb : b instanceof Date ? date : Array.isArray(b) ? array : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : number)(a, b); } function discrete(range) { var n = range.length; return function(t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } function hue$1(a, b) { var i = hue(+a, +b); return function(t) { var x = i(t); return x - 360 * Math.floor(x / 360); }; } function round(a, b) { return a = +a, b -= a, function(t) { return Math.round(a + b * t); }; } var degrees = 180 / Math.PI; var identity = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function decompose(a, b, c, d, e, f) { var scaleX, scaleY, skewX; if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; return { translateX: e, translateY: f, rotate: Math.atan2(b, a) * degrees, skewX: Math.atan(skewX) * degrees, scaleX: scaleX, scaleY: scaleY }; } var cssNode, cssRoot, cssView, svgNode; function parseCss(value) { if (value === "none") return identity; if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; cssNode.style.transform = value; value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); cssRoot.removeChild(cssNode); value = value.slice(7, -1).split(","); return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); } function parseSvg(value) { if (value == null) return identity; if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); svgNode.setAttribute("transform", value); if (!(value = svgNode.transform.baseVal.consolidate())) return identity; value = value.matrix; return decompose(value.a, value.b, value.c, value.d, value.e, value.f); } function interpolateTransform(parse, pxComma, pxParen, degParen) { function pop(s) { return s.length ? s.pop() + " " : ""; } function translate(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push("translate(", null, pxComma, null, pxParen); q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); } else if (xb || yb) { s.push("translate(" + xb + pxComma + yb + pxParen); } } function rotate(a, b, s, q) { if (a !== b) { if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)}); } else if (b) { s.push(pop(s) + "rotate(" + b + degParen); } } function skewX(a, b, s, q) { if (a !== b) { q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)}); } else if (b) { s.push(pop(s) + "skewX(" + b + degParen); } } function scale(xa, ya, xb, yb, s, q) { if (xa !== xb || ya !== yb) { var i = s.push(pop(s) + "scale(", null, ",", null, ")"); q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)}); } else if (xb !== 1 || yb !== 1) { s.push(pop(s) + "scale(" + xb + "," + yb + ")"); } } return function(a, b) { var s = [], // string constants and placeholders q = []; // number interpolators a = parse(a), b = parse(b); translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); rotate(a.rotate, b.rotate, s, q); skewX(a.skewX, b.skewX, s, q); scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); a = b = null; // gc return function(t) { var i = -1, n = q.length, o; while (++i < n) s[(o = q[i]).i] = o.x(t); return s.join(""); }; }; } var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); var rho = Math.SQRT2, rho2 = 2, rho4 = 4, epsilon2 = 1e-12; function cosh(x) { return ((x = Math.exp(x)) + 1 / x) / 2; } function sinh(x) { return ((x = Math.exp(x)) - 1 / x) / 2; } function tanh(x) { return ((x = Math.exp(2 * x)) - 1) / (x + 1); } // p0 = [ux0, uy0, w0] // p1 = [ux1, uy1, w1] function zoom(p0, p1) { var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; // Special case for u0 ≅ u1. if (d2 < epsilon2) { S = Math.log(w1 / w0) / rho; i = function(t) { return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; }; } // General case. else { var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); S = (r1 - r0) / rho; i = function(t) { var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ]; }; } i.duration = S * 1000; return i; } function hsl(hue$$1) { return function(start, end) { var h = hue$$1((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); return function(t) { start.h = h(t); start.s = s(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; } } var hsl$1 = hsl(hue); var hslLong = hsl(nogamma); function lab(start, end) { var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); return function(t) { start.l = l(t); start.a = a(t); start.b = b(t); start.opacity = opacity(t); return start + ""; }; } function hcl(hue$$1) { return function(start, end) { var h = hue$$1((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); return function(t) { start.h = h(t); start.c = c(t); start.l = l(t); start.opacity = opacity(t); return start + ""; }; } } var hcl$1 = hcl(hue); var hclLong = hcl(nogamma); function cubehelix(hue$$1) { return (function cubehelixGamma(y) { y = +y; function cubehelix(start, end) { var h = hue$$1((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); return function(t) { start.h = h(t); start.s = s(t); start.l = l(Math.pow(t, y)); start.opacity = opacity(t); return start + ""; }; } cubehelix.gamma = cubehelixGamma; return cubehelix; })(1); } var cubehelix$1 = cubehelix(hue); var cubehelixLong = cubehelix(nogamma); function piecewise(interpolate, values) { var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); while (i < n) I[i] = interpolate(v, v = values[++i]); return function(t) { var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); return I[i](t - i); }; } function quantize(interpolator, n) { var samples = new Array(n); for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); return samples; } exports.interpolate = value; exports.interpolateArray = array; exports.interpolateBasis = basis$1; exports.interpolateBasisClosed = basisClosed; exports.interpolateDate = date; exports.interpolateDiscrete = discrete; exports.interpolateHue = hue$1; exports.interpolateNumber = number; exports.interpolateObject = object; exports.interpolateRound = round; exports.interpolateString = string; exports.interpolateTransformCss = interpolateTransformCss; exports.interpolateTransformSvg = interpolateTransformSvg; exports.interpolateZoom = zoom; exports.interpolateRgb = rgb; exports.interpolateRgbBasis = rgbBasis; exports.interpolateRgbBasisClosed = rgbBasisClosed; exports.interpolateHsl = hsl$1; exports.interpolateHslLong = hslLong; exports.interpolateLab = lab; exports.interpolateHcl = hcl$1; exports.interpolateHclLong = hclLong; exports.interpolateCubehelix = cubehelix$1; exports.interpolateCubehelixLong = cubehelixLong; exports.piecewise = piecewise; exports.quantize = quantize; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Interpolate_907 = _$d3Interpolate_907.exports var _$d3Format_906 = { exports: {} }; // https://d3js.org/d3-format/ v1.4.1 Copyright 2019 Mike Bostock (function (global, factory) { typeof _$d3Format_906.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Format_906.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.d3 = global.d3 || {})); }(this, function (exports) { 'use strict'; // Computes the decimal coefficient and exponent of the specified number x with // significant digits p, where x is positive and p is in [1, 21] or undefined. // For example, formatDecimal(1.23) returns ["123", 0]. function formatDecimal(x, p) { if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity var i, coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ]; } function exponent(x) { return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; } function formatGroup(grouping, thousands) { return function(value, width) { var i = value.length, t = [], j = 0, g = grouping[0], length = 0; while (i > 0 && g > 0) { if (length + g + 1 > width) g = Math.max(1, width - length); t.push(value.substring(i -= g, i + g)); if ((length += g + 1) > width) break; g = grouping[j = (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; } function formatNumerals(numerals) { return function(value) { return value.replace(/[0-9]/g, function(i) { return numerals[+i]; }); }; } // [[fill]align][sign][symbol][0][width][,][.precision][~][type] var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; function formatSpecifier(specifier) { if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); var match; return new FormatSpecifier({ fill: match[1], align: match[2], sign: match[3], symbol: match[4], zero: match[5], width: match[6], comma: match[7], precision: match[8] && match[8].slice(1), trim: match[9], type: match[10] }); } formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof function FormatSpecifier(specifier) { this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; this.align = specifier.align === undefined ? ">" : specifier.align + ""; this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; this.width = specifier.width === undefined ? undefined : +specifier.width; this.comma = !!specifier.comma; this.precision = specifier.precision === undefined ? undefined : +specifier.precision; this.trim = !!specifier.trim; this.type = specifier.type === undefined ? "" : specifier.type + ""; } FormatSpecifier.prototype.toString = function() { return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; }; // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. function formatTrim(s) { out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { switch (s[i]) { case ".": i0 = i1 = i; break; case "0": if (i0 === 0) i0 = i; i1 = i; break; default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break; } } return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; } var prefixExponent; function formatPrefixAuto(x, p) { var d = formatDecimal(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! } function formatRounded(x, p) { var d = formatDecimal(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); } var formatTypes = { "%": function(x, p) { return (x * 100).toFixed(p); }, "b": function(x) { return Math.round(x).toString(2); }, "c": function(x) { return x + ""; }, "d": function(x) { return Math.round(x).toString(10); }, "e": function(x, p) { return x.toExponential(p); }, "f": function(x, p) { return x.toFixed(p); }, "g": function(x, p) { return x.toPrecision(p); }, "o": function(x) { return Math.round(x).toString(8); }, "p": function(x, p) { return formatRounded(x * 100, p); }, "r": formatRounded, "s": formatPrefixAuto, "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, "x": function(x) { return Math.round(x).toString(16); } }; function identity(x) { return x; } var map = Array.prototype.map, prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; function formatLocale(locale) { var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "-" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; function newFormat(specifier) { specifier = formatSpecifier(specifier); var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; // The "n" type is an alias for ",g". if (type === "n") comma = true, type = "g"; // The "" type, and any invalid type, is an alias for ".12~g". else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; // If zero fill is specified, padding goes after sign and before digits. if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; // Compute the prefix and suffix. // For SI-prefix, the suffix is lazily computed. var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; // What format function should we use? // Is this an integer type? // Can this type generate exponential notation? var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type); // Set the default precision if not specified, // or clamp the specified precision to the supported range. // For significant precision, it must be in [1, 21]. // For fixed precision, it must be in [0, 20]. precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); function format(value) { var valuePrefix = prefix, valueSuffix = suffix, i, n, c; if (type === "c") { valueSuffix = formatType(value) + valueSuffix; value = ""; } else { value = +value; // Perform the initial formatting. var valueNegative = value < 0; value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros. if (trim) value = formatTrim(value); // If a negative value rounds to zero during formatting, treat as positive. if (valueNegative && +value === 0) valueNegative = false; // Compute the prefix and suffix. valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); // Break the formatted value into the integer “value” part that can be // grouped, and fractional or exponential “suffix” part that is not. if (maybeSuffix) { i = -1, n = value.length; while (++i < n) { if (c = value.charCodeAt(i), 48 > c || c > 57) { valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; value = value.slice(0, i); break; } } } } // If the fill character is not "0", grouping is applied before padding. if (comma && !zero) value = group(value, Infinity); // Compute the padding. var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding. if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; // Reconstruct the final output based on the desired alignment. switch (align) { case "<": value = valuePrefix + value + valueSuffix + padding; break; case "=": value = valuePrefix + padding + value + valueSuffix; break; case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; default: value = padding + valuePrefix + value + valueSuffix; break; } return numerals(value); } format.toString = function() { return specifier + ""; }; return format; } function formatPrefix(specifier, value) { var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; return function(value) { return f(k * value) + prefix; }; } return { format: newFormat, formatPrefix: formatPrefix }; } var locale; defaultLocale({ decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""], minus: "-" }); function defaultLocale(definition) { locale = formatLocale(definition); exports.format = locale.format; exports.formatPrefix = locale.formatPrefix; return locale; } function precisionFixed(step) { return Math.max(0, -exponent(Math.abs(step))); } function precisionPrefix(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); } function precisionRound(step, max) { step = Math.abs(step), max = Math.abs(max) - step; return Math.max(0, exponent(max) - exponent(step)) + 1; } exports.FormatSpecifier = FormatSpecifier; exports.formatDefaultLocale = defaultLocale; exports.formatLocale = formatLocale; exports.formatSpecifier = formatSpecifier; exports.precisionFixed = precisionFixed; exports.precisionPrefix = precisionPrefix; exports.precisionRound = precisionRound; Object.defineProperty(exports, '__esModule', { value: true }); })); _$d3Format_906 = _$d3Format_906.exports var _$d3Time_912 = { exports: {} }; // https://d3js.org/d3-time/ v1.0.11 Copyright 2019 Mike Bostock (function (global, factory) { typeof _$d3Time_912.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Time_912.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.d3 = global.d3 || {}))); }(this, (function (exports) { 'use strict'; var t0 = new Date, t1 = new Date; function newInterval(floori, offseti, count, field) { function interval(date) { return floori(date = new Date(+date)), date; } interval.floor = interval; interval.ceil = function(date) { return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; }; interval.round = function(date) { var d0 = interval(date), d1 = interval.ceil(date); return date - d0 < d1 - date ? d0 : d1; }; interval.offset = function(date, step) { return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; }; interval.range = function(start, stop, step) { var range = [], previous; start = interval.ceil(start); step = step == null ? 1 : Math.floor(step); if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date do range.push(previous = new Date(+start)), offseti(start, step), floori(start); while (previous < start && start < stop); return range; }; interval.filter = function(test) { return newInterval(function(date) { if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); }, function(date, step) { if (date >= date) { if (step < 0) while (++step <= 0) { while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty } else while (--step >= 0) { while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty } } }); }; if (count) { interval.count = function(start, end) { t0.setTime(+start), t1.setTime(+end); floori(t0), floori(t1); return Math.floor(count(t0, t1)); }; interval.every = function(step) { step = Math.floor(step); return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) { return field(d) % step === 0; } : function(d) { return interval.count(0, d) % step === 0; }); }; } return interval; } var millisecond = newInterval(function() { // noop }, function(date, step) { date.setTime(+date + step); }, function(start, end) { return end - start; }); // An optimized implementation for this simple case. millisecond.every = function(k) { k = Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; return newInterval(function(date) { date.setTime(Math.floor(date / k) * k); }, function(date, step) { date.setTime(+date + step * k); }, function(start, end) { return (end - start) / k; }); }; var milliseconds = millisecond.range; var durationSecond = 1e3; var durationMinute = 6e4; var durationHour = 36e5; var durationDay = 864e5; var durationWeek = 6048e5; var second = newInterval(function(date) { date.setTime(date - date.getMilliseconds()); }, function(date, step) { date.setTime(+date + step * durationSecond); }, function(start, end) { return (end - start) / durationSecond; }, function(date) { return date.getUTCSeconds(); }); var seconds = second.range; var minute = newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getMinutes(); }); var minutes = minute.range; var hour = newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getHours(); }); var hours = hour.range; var day = newInterval(function(date) { date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay; }, function(date) { return date.getDate() - 1; }); var days = day.range; function weekday(i) { return newInterval(function(date) { date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step * 7); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; }); } var sunday = weekday(0); var monday = weekday(1); var tuesday = weekday(2); var wednesday = weekday(3); var thursday = weekday(4); var friday = weekday(5); var saturday = weekday(6); var sundays = sunday.range; var mondays = monday.range; var tuesdays = tuesday.range; var wednesdays = wednesday.range; var thursdays = thursday.range; var fridays = friday.range; var saturdays = saturday.range; var month = newInterval(function(date) { date.setDate(1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setMonth(date.getMonth() + step); }, function(start, end) { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; }, function(date) { return date.getMonth(); }); var months = month.range; var year = newInterval(function(date) { date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step); }, function(start, end) { return end.getFullYear() - start.getFullYear(); }, function(date) { return date.getFullYear(); }); // An optimized implementation for this simple case. year.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { date.setFullYear(Math.floor(date.getFullYear() / k) * k); date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step * k); }); }; var years = year.range; var utcMinute = newInterval(function(date) { date.setUTCSeconds(0, 0); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getUTCMinutes(); }); var utcMinutes = utcMinute.range; var utcHour = newInterval(function(date) { date.setUTCMinutes(0, 0, 0); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getUTCHours(); }); var utcHours = utcHour.range; var utcDay = newInterval(function(date) { date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step); }, function(start, end) { return (end - start) / durationDay; }, function(date) { return date.getUTCDate() - 1; }); var utcDays = utcDay.range; function utcWeekday(i) { return newInterval(function(date) { date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step * 7); }, function(start, end) { return (end - start) / durationWeek; }); } var utcSunday = utcWeekday(0); var utcMonday = utcWeekday(1); var utcTuesday = utcWeekday(2); var utcWednesday = utcWeekday(3); var utcThursday = utcWeekday(4); var utcFriday = utcWeekday(5); var utcSaturday = utcWeekday(6); var utcSundays = utcSunday.range; var utcMondays = utcMonday.range; var utcTuesdays = utcTuesday.range; var utcWednesdays = utcWednesday.range; var utcThursdays = utcThursday.range; var utcFridays = utcFriday.range; var utcSaturdays = utcSaturday.range; var utcMonth = newInterval(function(date) { date.setUTCDate(1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCMonth(date.getUTCMonth() + step); }, function(start, end) { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; }, function(date) { return date.getUTCMonth(); }); var utcMonths = utcMonth.range; var utcYear = newInterval(function(date) { date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step); }, function(start, end) { return end.getUTCFullYear() - start.getUTCFullYear(); }, function(date) { return date.getUTCFullYear(); }); // An optimized implementation for this simple case. utcYear.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step * k); }); }; var utcYears = utcYear.range; exports.timeInterval = newInterval; exports.timeMillisecond = millisecond; exports.timeMilliseconds = milliseconds; exports.utcMillisecond = millisecond; exports.utcMilliseconds = milliseconds; exports.timeSecond = second; exports.timeSeconds = seconds; exports.utcSecond = second; exports.utcSeconds = seconds; exports.timeMinute = minute; exports.timeMinutes = minutes; exports.timeHour = hour; exports.timeHours = hours; exports.timeDay = day; exports.timeDays = days; exports.timeWeek = sunday; exports.timeWeeks = sundays; exports.timeSunday = sunday; exports.timeSundays = sundays; exports.timeMonday = monday; exports.timeMondays = mondays; exports.timeTuesday = tuesday; exports.timeTuesdays = tuesdays; exports.timeWednesday = wednesday; exports.timeWednesdays = wednesdays; exports.timeThursday = thursday; exports.timeThursdays = thursdays; exports.timeFriday = friday; exports.timeFridays = fridays; exports.timeSaturday = saturday; exports.timeSaturdays = saturdays; exports.timeMonth = month; exports.timeMonths = months; exports.timeYear = year; exports.timeYears = years; exports.utcMinute = utcMinute; exports.utcMinutes = utcMinutes; exports.utcHour = utcHour; exports.utcHours = utcHours; exports.utcDay = utcDay; exports.utcDays = utcDays; exports.utcWeek = utcSunday; exports.utcWeeks = utcSundays; exports.utcSunday = utcSunday; exports.utcSundays = utcSundays; exports.utcMonday = utcMonday; exports.utcMondays = utcMondays; exports.utcTuesday = utcTuesday; exports.utcTuesdays = utcTuesdays; exports.utcWednesday = utcWednesday; exports.utcWednesdays = utcWednesdays; exports.utcThursday = utcThursday; exports.utcThursdays = utcThursdays; exports.utcFriday = utcFriday; exports.utcFridays = utcFridays; exports.utcSaturday = utcSaturday; exports.utcSaturdays = utcSaturdays; exports.utcMonth = utcMonth; exports.utcMonths = utcMonths; exports.utcYear = utcYear; exports.utcYears = utcYears; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Time_912 = _$d3Time_912.exports var _$d3TimeFormat_911 = { exports: {} }; // https://d3js.org/d3-time-format/ v2.1.3 Copyright 2018 Mike Bostock (function (global, factory) { typeof _$d3TimeFormat_911.exports === 'object' && "object" !== 'undefined' ? factory(_$d3TimeFormat_911.exports, _$d3Time_912) : typeof define === 'function' && define.amd ? define(['exports', 'd3-time'], factory) : (factory((global.d3 = global.d3 || {}),global.d3)); }(this, (function (exports,d3Time) { 'use strict'; function localDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date.setFullYear(d.y); return date; } return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); } function utcDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); date.setUTCFullYear(d.y); return date; } return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); } function newYear(y) { return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; } function formatLocale(locale) { var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); var formats = { "a": formatShortWeekday, "A": formatWeekday, "b": formatShortMonth, "B": formatMonth, "c": null, "d": formatDayOfMonth, "e": formatDayOfMonth, "f": formatMicroseconds, "H": formatHour24, "I": formatHour12, "j": formatDayOfYear, "L": formatMilliseconds, "m": formatMonthNumber, "M": formatMinutes, "p": formatPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatSeconds, "u": formatWeekdayNumberMonday, "U": formatWeekNumberSunday, "V": formatWeekNumberISO, "w": formatWeekdayNumberSunday, "W": formatWeekNumberMonday, "x": null, "X": null, "y": formatYear, "Y": formatFullYear, "Z": formatZone, "%": formatLiteralPercent }; var utcFormats = { "a": formatUTCShortWeekday, "A": formatUTCWeekday, "b": formatUTCShortMonth, "B": formatUTCMonth, "c": null, "d": formatUTCDayOfMonth, "e": formatUTCDayOfMonth, "f": formatUTCMicroseconds, "H": formatUTCHour24, "I": formatUTCHour12, "j": formatUTCDayOfYear, "L": formatUTCMilliseconds, "m": formatUTCMonthNumber, "M": formatUTCMinutes, "p": formatUTCPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatUTCSeconds, "u": formatUTCWeekdayNumberMonday, "U": formatUTCWeekNumberSunday, "V": formatUTCWeekNumberISO, "w": formatUTCWeekdayNumberSunday, "W": formatUTCWeekNumberMonday, "x": null, "X": null, "y": formatUTCYear, "Y": formatUTCFullYear, "Z": formatUTCZone, "%": formatLiteralPercent }; var parses = { "a": parseShortWeekday, "A": parseWeekday, "b": parseShortMonth, "B": parseMonth, "c": parseLocaleDateTime, "d": parseDayOfMonth, "e": parseDayOfMonth, "f": parseMicroseconds, "H": parseHour24, "I": parseHour24, "j": parseDayOfYear, "L": parseMilliseconds, "m": parseMonthNumber, "M": parseMinutes, "p": parsePeriod, "Q": parseUnixTimestamp, "s": parseUnixTimestampSeconds, "S": parseSeconds, "u": parseWeekdayNumberMonday, "U": parseWeekNumberSunday, "V": parseWeekNumberISO, "w": parseWeekdayNumberSunday, "W": parseWeekNumberMonday, "x": parseLocaleDate, "X": parseLocaleTime, "y": parseYear, "Y": parseFullYear, "Z": parseZone, "%": parseLiteralPercent }; // These recursive directive definitions must be deferred. formats.x = newFormat(locale_date, formats); formats.X = newFormat(locale_time, formats); formats.c = newFormat(locale_dateTime, formats); utcFormats.x = newFormat(locale_date, utcFormats); utcFormats.X = newFormat(locale_time, utcFormats); utcFormats.c = newFormat(locale_dateTime, utcFormats); function newFormat(specifier, formats) { return function(date) { var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; if (!(date instanceof Date)) date = new Date(+date); while (++i < n) { if (specifier.charCodeAt(i) === 37) { string.push(specifier.slice(j, i)); if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); else pad = c === "e" ? " " : "0"; if (format = formats[c]) c = format(date, pad); string.push(c); j = i + 1; } } string.push(specifier.slice(j, i)); return string.join(""); }; } function newParse(specifier, newDate) { return function(string) { var d = newYear(1900), i = parseSpecifier(d, specifier, string += "", 0), week, day; if (i != string.length) return null; // If a UNIX timestamp is specified, return it. if ("Q" in d) return new Date(d.Q); // The am-pm flag is 0 for AM, and 1 for PM. if ("p" in d) d.H = d.H % 12 + d.p * 12; // Convert day-of-week and week-of-year to day-of-year. if ("V" in d) { if (d.V < 1 || d.V > 53) return null; if (!("w" in d)) d.w = 1; if ("Z" in d) { week = utcDate(newYear(d.y)), day = week.getUTCDay(); week = day > 4 || day === 0 ? d3Time.utcMonday.ceil(week) : d3Time.utcMonday(week); week = d3Time.utcDay.offset(week, (d.V - 1) * 7); d.y = week.getUTCFullYear(); d.m = week.getUTCMonth(); d.d = week.getUTCDate() + (d.w + 6) % 7; } else { week = newDate(newYear(d.y)), day = week.getDay(); week = day > 4 || day === 0 ? d3Time.timeMonday.ceil(week) : d3Time.timeMonday(week); week = d3Time.timeDay.offset(week, (d.V - 1) * 7); d.y = week.getFullYear(); d.m = week.getMonth(); d.d = week.getDate() + (d.w + 6) % 7; } } else if ("W" in d || "U" in d) { if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(); d.m = 0; d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; } // If a time zone is specified, all fields are interpreted as UTC and then // offset according to the specified time zone. if ("Z" in d) { d.H += d.Z / 100 | 0; d.M += d.Z % 100; return utcDate(d); } // Otherwise, all fields are in local time. return newDate(d); }; } function parseSpecifier(d, specifier, string, j) { var i = 0, n = specifier.length, m = string.length, c, parse; while (i < n) { if (j >= m) return -1; c = specifier.charCodeAt(i++); if (c === 37) { c = specifier.charAt(i++); parse = parses[c in pads ? specifier.charAt(i++) : c]; if (!parse || ((j = parse(d, string, j)) < 0)) return -1; } else if (c != string.charCodeAt(j++)) { return -1; } } return j; } function parsePeriod(d, string, i) { var n = periodRe.exec(string.slice(i)); return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortWeekday(d, string, i) { var n = shortWeekdayRe.exec(string.slice(i)); return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseWeekday(d, string, i) { var n = weekdayRe.exec(string.slice(i)); return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortMonth(d, string, i) { var n = shortMonthRe.exec(string.slice(i)); return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseMonth(d, string, i) { var n = monthRe.exec(string.slice(i)); return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseLocaleDateTime(d, string, i) { return parseSpecifier(d, locale_dateTime, string, i); } function parseLocaleDate(d, string, i) { return parseSpecifier(d, locale_date, string, i); } function parseLocaleTime(d, string, i) { return parseSpecifier(d, locale_time, string, i); } function formatShortWeekday(d) { return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { return locale_months[d.getMonth()]; } function formatPeriod(d) { return locale_periods[+(d.getHours() >= 12)]; } function formatUTCShortWeekday(d) { return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { return locale_periods[+(d.getUTCHours() >= 12)]; } return { format: function(specifier) { var f = newFormat(specifier += "", formats); f.toString = function() { return specifier; }; return f; }, parse: function(specifier) { var p = newParse(specifier += "", localDate); p.toString = function() { return specifier; }; return p; }, utcFormat: function(specifier) { var f = newFormat(specifier += "", utcFormats); f.toString = function() { return specifier; }; return f; }, utcParse: function(specifier) { var p = newParse(specifier, utcDate); p.toString = function() { return specifier; }; return p; } }; } var pads = {"-": "", "_": " ", "0": "0"}, numberRe = /^\s*\d+/, // note: ignores next directive percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; function pad(value, fill, width) { var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); } function requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { var map = {}, i = -1, n = names.length; while (++i < n) map[names[i].toLowerCase()] = i; return map; } function parseWeekdayNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; } function parseWeekdayNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; } function parseWeekNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; } function parseWeekNumberISO(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; } function parseWeekNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; } function parseFullYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; } function parseYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; } function parseZone(d, string, i) { var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; } function parseMonthNumber(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; } function parseDayOfMonth(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; } function parseDayOfYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; } function parseHour24(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; } function parseMinutes(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; } function parseSeconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; } function parseMilliseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; } function parseMicroseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 6)); return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; } function parseLiteralPercent(d, string, i) { var n = percentRe.exec(string.slice(i, i + 1)); return n ? i + n[0].length : -1; } function parseUnixTimestamp(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; } function parseUnixTimestampSeconds(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1; } function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); } function formatHour24(d, p) { return pad(d.getHours(), p, 2); } function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); } function formatDayOfYear(d, p) { return pad(1 + d3Time.timeDay.count(d3Time.timeYear(d), d), p, 3); } function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); } function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; } function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); } function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); } function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); } function formatWeekdayNumberMonday(d) { var day = d.getDay(); return day === 0 ? 7 : day; } function formatWeekNumberSunday(d, p) { return pad(d3Time.timeSunday.count(d3Time.timeYear(d), d), p, 2); } function formatWeekNumberISO(d, p) { var day = d.getDay(); d = (day >= 4 || day === 0) ? d3Time.timeThursday(d) : d3Time.timeThursday.ceil(d); return pad(d3Time.timeThursday.count(d3Time.timeYear(d), d) + (d3Time.timeYear(d).getDay() === 4), p, 2); } function formatWeekdayNumberSunday(d) { return d.getDay(); } function formatWeekNumberMonday(d, p) { return pad(d3Time.timeMonday.count(d3Time.timeYear(d), d), p, 2); } function formatYear(d, p) { return pad(d.getFullYear() % 100, p, 2); } function formatFullYear(d, p) { return pad(d.getFullYear() % 10000, p, 4); } function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); } function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); } function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); } function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); } function formatUTCDayOfYear(d, p) { return pad(1 + d3Time.utcDay.count(d3Time.utcYear(d), d), p, 3); } function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); } function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; } function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); } function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); } function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); } function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; } function formatUTCWeekNumberSunday(d, p) { return pad(d3Time.utcSunday.count(d3Time.utcYear(d), d), p, 2); } function formatUTCWeekNumberISO(d, p) { var day = d.getUTCDay(); d = (day >= 4 || day === 0) ? d3Time.utcThursday(d) : d3Time.utcThursday.ceil(d); return pad(d3Time.utcThursday.count(d3Time.utcYear(d), d) + (d3Time.utcYear(d).getUTCDay() === 4), p, 2); } function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); } function formatUTCWeekNumberMonday(d, p) { return pad(d3Time.utcMonday.count(d3Time.utcYear(d), d), p, 2); } function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCFullYear(d, p) { return pad(d.getUTCFullYear() % 10000, p, 4); } function formatUTCZone() { return "+0000"; } function formatLiteralPercent() { return "%"; } function formatUnixTimestamp(d) { return +d; } function formatUnixTimestampSeconds(d) { return Math.floor(+d / 1000); } var locale; defaultLocale({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", periods: ["AM", "PM"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] }); function defaultLocale(definition) { locale = formatLocale(definition); exports.timeFormat = locale.format; exports.timeParse = locale.parse; exports.utcFormat = locale.utcFormat; exports.utcParse = locale.utcParse; return locale; } var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; function formatIsoNative(date) { return date.toISOString(); } var formatIso = Date.prototype.toISOString ? formatIsoNative : exports.utcFormat(isoSpecifier); function parseIsoNative(string) { var date = new Date(string); return isNaN(date) ? null : date; } var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : exports.utcParse(isoSpecifier); exports.timeFormatDefaultLocale = defaultLocale; exports.timeFormatLocale = formatLocale; exports.isoFormat = formatIso; exports.isoParse = parseIso; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3TimeFormat_911 = _$d3TimeFormat_911.exports var _$d3Scale_909 = { exports: {} }; // https://d3js.org/d3-scale/ Version 1.0.7. Copyright 2017 Mike Bostock. (function (global, factory) { typeof _$d3Scale_909.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Scale_909.exports, _$d3Array_903, _$d3Collection_904, _$d3Interpolate_907, _$d3Format_906, _$d3Time_912, _$d3TimeFormat_911, _$d3Color_905) : typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format', 'd3-color'], factory) : (factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3)); }(this, (function (exports,d3Array,d3Collection,d3Interpolate,d3Format,d3Time,d3TimeFormat,d3Color) { 'use strict'; var array = Array.prototype; var map$1 = array.map; var slice = array.slice; var implicit = {name: "implicit"}; function ordinal(range$$1) { var index = d3Collection.map(), domain = [], unknown = implicit; range$$1 = range$$1 == null ? [] : slice.call(range$$1); function scale(d) { var key = d + "", i = index.get(key); if (!i) { if (unknown !== implicit) return unknown; index.set(key, i = domain.push(d)); } return range$$1[(i - 1) % range$$1.length]; } scale.domain = function(_) { if (!arguments.length) return domain.slice(); domain = [], index = d3Collection.map(); var i = -1, n = _.length, d, key; while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); return scale; }; scale.range = function(_) { return arguments.length ? (range$$1 = slice.call(_), scale) : range$$1.slice(); }; scale.unknown = function(_) { return arguments.length ? (unknown = _, scale) : unknown; }; scale.copy = function() { return ordinal() .domain(domain) .range(range$$1) .unknown(unknown); }; return scale; } function band() { var scale = ordinal().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, range$$1 = [0, 1], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; delete scale.unknown; function rescale() { var n = domain().length, reverse = range$$1[1] < range$$1[0], start = range$$1[reverse - 0], stop = range$$1[1 - reverse]; step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); if (round) step = Math.floor(step); start += (stop - start - step * (n - paddingInner)) * align; bandwidth = step * (1 - paddingInner); if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); var values = d3Array.range(n).map(function(i) { return start + step * i; }); return ordinalRange(reverse ? values.reverse() : values); } scale.domain = function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.range = function(_) { return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice(); }; scale.rangeRound = function(_) { return range$$1 = [+_[0], +_[1]], round = true, rescale(); }; scale.bandwidth = function() { return bandwidth; }; scale.step = function() { return step; }; scale.round = function(_) { return arguments.length ? (round = !!_, rescale()) : round; }; scale.padding = function(_) { return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; }; scale.paddingInner = function(_) { return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; }; scale.paddingOuter = function(_) { return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter; }; scale.align = function(_) { return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; }; scale.copy = function() { return band() .domain(domain()) .range(range$$1) .round(round) .paddingInner(paddingInner) .paddingOuter(paddingOuter) .align(align); }; return rescale(); } function pointish(scale) { var copy = scale.copy; scale.padding = scale.paddingOuter; delete scale.paddingInner; delete scale.paddingOuter; scale.copy = function() { return pointish(copy()); }; return scale; } function point() { return pointish(band().paddingInner(1)); } var constant = function(x) { return function() { return x; }; }; var number = function(x) { return +x; }; var unit = [0, 1]; function deinterpolateLinear(a, b) { return (b -= (a = +a)) ? function(x) { return (x - a) / b; } : constant(b); } function deinterpolateClamp(deinterpolate) { return function(a, b) { var d = deinterpolate(a = +a, b = +b); return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); }; }; } function reinterpolateClamp(reinterpolate) { return function(a, b) { var r = reinterpolate(a = +a, b = +b); return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); }; }; } function bimap(domain, range$$1, deinterpolate, reinterpolate) { var d0 = domain[0], d1 = domain[1], r0 = range$$1[0], r1 = range$$1[1]; if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0); else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1); return function(x) { return r0(d0(x)); }; } function polymap(domain, range$$1, deinterpolate, reinterpolate) { var j = Math.min(domain.length, range$$1.length) - 1, d = new Array(j), r = new Array(j), i = -1; // Reverse descending domains. if (domain[j] < domain[0]) { domain = domain.slice().reverse(); range$$1 = range$$1.slice().reverse(); } while (++i < j) { d[i] = deinterpolate(domain[i], domain[i + 1]); r[i] = reinterpolate(range$$1[i], range$$1[i + 1]); } return function(x) { var i = d3Array.bisect(domain, x, 1, j) - 1; return r[i](d[i](x)); }; } function copy(source, target) { return target .domain(source.domain()) .range(source.range()) .interpolate(source.interpolate()) .clamp(source.clamp()); } // deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. // reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b]. function continuous(deinterpolate, reinterpolate) { var domain = unit, range$$1 = unit, interpolate$$1 = d3Interpolate.interpolate, clamp = false, piecewise, output, input; function rescale() { piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap; output = input = null; return scale; } function scale(x) { return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x); } scale.invert = function(y) { return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); }; scale.domain = function(_) { return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice(); }; scale.range = function(_) { return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice(); }; scale.rangeRound = function(_) { return range$$1 = slice.call(_), interpolate$$1 = d3Interpolate.interpolateRound, rescale(); }; scale.clamp = function(_) { return arguments.length ? (clamp = !!_, rescale()) : clamp; }; scale.interpolate = function(_) { return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1; }; return rescale(); } var tickFormat = function(domain, count, specifier) { var start = domain[0], stop = domain[domain.length - 1], step = d3Array.tickStep(start, stop, count == null ? 10 : count), precision; specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier); switch (specifier.type) { case "s": { var value = Math.max(Math.abs(start), Math.abs(stop)); if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision; return d3Format.formatPrefix(specifier, value); } case "": case "e": case "g": case "p": case "r": { if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); break; } case "f": case "%": { if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; break; } } return d3Format.format(specifier); }; function linearish(scale) { var domain = scale.domain; scale.ticks = function(count) { var d = domain(); return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count); }; scale.tickFormat = function(count, specifier) { return tickFormat(domain(), count, specifier); }; scale.nice = function(count) { if (count == null) count = 10; var d = domain(), i0 = 0, i1 = d.length - 1, start = d[i0], stop = d[i1], step; if (stop < start) { step = start, start = stop, stop = step; step = i0, i0 = i1, i1 = step; } step = d3Array.tickIncrement(start, stop, count); if (step > 0) { start = Math.floor(start / step) * step; stop = Math.ceil(stop / step) * step; step = d3Array.tickIncrement(start, stop, count); } else if (step < 0) { start = Math.ceil(start * step) / step; stop = Math.floor(stop * step) / step; step = d3Array.tickIncrement(start, stop, count); } if (step > 0) { d[i0] = Math.floor(start / step) * step; d[i1] = Math.ceil(stop / step) * step; domain(d); } else if (step < 0) { d[i0] = Math.ceil(start * step) / step; d[i1] = Math.floor(stop * step) / step; domain(d); } return scale; }; return scale; } function linear() { var scale = continuous(deinterpolateLinear, d3Interpolate.interpolateNumber); scale.copy = function() { return copy(scale, linear()); }; return linearish(scale); } function identity() { var domain = [0, 1]; function scale(x) { return +x; } scale.invert = scale; scale.domain = scale.range = function(_) { return arguments.length ? (domain = map$1.call(_, number), scale) : domain.slice(); }; scale.copy = function() { return identity().domain(domain); }; return linearish(scale); } var nice = function(domain, interval) { domain = domain.slice(); var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; if (x1 < x0) { t = i0, i0 = i1, i1 = t; t = x0, x0 = x1, x1 = t; } domain[i0] = interval.floor(x0); domain[i1] = interval.ceil(x1); return domain; }; function deinterpolate(a, b) { return (b = Math.log(b / a)) ? function(x) { return Math.log(x / a) / b; } : constant(b); } function reinterpolate(a, b) { return a < 0 ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); } : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); }; } function pow10(x) { return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; } function powp(base) { return base === 10 ? pow10 : base === Math.E ? Math.exp : function(x) { return Math.pow(base, x); }; } function logp(base) { return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), function(x) { return Math.log(x) / base; }); } function reflect(f) { return function(x) { return -f(-x); }; } function log() { var scale = continuous(deinterpolate, reinterpolate).domain([1, 10]), domain = scale.domain, base = 10, logs = logp(10), pows = powp(10); function rescale() { logs = logp(base), pows = powp(base); if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows); return scale; } scale.base = function(_) { return arguments.length ? (base = +_, rescale()) : base; }; scale.domain = function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.ticks = function(count) { var d = domain(), u = d[0], v = d[d.length - 1], r; if (r = v < u) i = u, u = v, v = i; var i = logs(u), j = logs(v), p, k, t, n = count == null ? 10 : +count, z = []; if (!(base % 1) && j - i < n) { i = Math.round(i) - 1, j = Math.round(j) + 1; if (u > 0) for (; i < j; ++i) { for (k = 1, p = pows(i); k < base; ++k) { t = p * k; if (t < u) continue; if (t > v) break; z.push(t); } } else for (; i < j; ++i) { for (k = base - 1, p = pows(i); k >= 1; --k) { t = p * k; if (t < u) continue; if (t > v) break; z.push(t); } } } else { z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows); } return r ? z.reverse() : z; }; scale.tickFormat = function(count, specifier) { if (specifier == null) specifier = base === 10 ? ".0e" : ","; if (typeof specifier !== "function") specifier = d3Format.format(specifier); if (count === Infinity) return specifier; if (count == null) count = 10; var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? return function(d) { var i = d / pows(Math.round(logs(d))); if (i * base < base - 0.5) i *= base; return i <= k ? specifier(d) : ""; }; }; scale.nice = function() { return domain(nice(domain(), { floor: function(x) { return pows(Math.floor(logs(x))); }, ceil: function(x) { return pows(Math.ceil(logs(x))); } })); }; scale.copy = function() { return copy(scale, log().base(base)); }; return scale; } function raise(x, exponent) { return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); } function pow() { var exponent = 1, scale = continuous(deinterpolate, reinterpolate), domain = scale.domain; function deinterpolate(a, b) { return (b = raise(b, exponent) - (a = raise(a, exponent))) ? function(x) { return (raise(x, exponent) - a) / b; } : constant(b); } function reinterpolate(a, b) { b = raise(b, exponent) - (a = raise(a, exponent)); return function(t) { return raise(a + b * t, 1 / exponent); }; } scale.exponent = function(_) { return arguments.length ? (exponent = +_, domain(domain())) : exponent; }; scale.copy = function() { return copy(scale, pow().exponent(exponent)); }; return linearish(scale); } function sqrt() { return pow().exponent(0.5); } function quantile$1() { var domain = [], range$$1 = [], thresholds = []; function rescale() { var i = 0, n = Math.max(1, range$$1.length); thresholds = new Array(n - 1); while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n); return scale; } function scale(x) { if (!isNaN(x = +x)) return range$$1[d3Array.bisect(thresholds, x)]; } scale.invertExtent = function(y) { var i = range$$1.indexOf(y); return i < 0 ? [NaN, NaN] : [ i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1] ]; }; scale.domain = function(_) { if (!arguments.length) return domain.slice(); domain = []; for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d); domain.sort(d3Array.ascending); return rescale(); }; scale.range = function(_) { return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice(); }; scale.quantiles = function() { return thresholds.slice(); }; scale.copy = function() { return quantile$1() .domain(domain) .range(range$$1); }; return scale; } function quantize() { var x0 = 0, x1 = 1, n = 1, domain = [0.5], range$$1 = [0, 1]; function scale(x) { if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)]; } function rescale() { var i = -1; domain = new Array(n); while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); return scale; } scale.domain = function(_) { return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1]; }; scale.range = function(_) { return arguments.length ? (n = (range$$1 = slice.call(_)).length - 1, rescale()) : range$$1.slice(); }; scale.invertExtent = function(y) { var i = range$$1.indexOf(y); return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >= n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; }; scale.copy = function() { return quantize() .domain([x0, x1]) .range(range$$1); }; return linearish(scale); } function threshold() { var domain = [0.5], range$$1 = [0, 1], n = 1; function scale(x) { if (x <= x) return range$$1[d3Array.bisect(domain, x, 0, n)]; } scale.domain = function(_) { return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : domain.slice(); }; scale.range = function(_) { return arguments.length ? (range$$1 = slice.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : range$$1.slice(); }; scale.invertExtent = function(y) { var i = range$$1.indexOf(y); return [domain[i - 1], domain[i]]; }; scale.copy = function() { return threshold() .domain(domain) .range(range$$1); }; return scale; } var durationSecond = 1000; var durationMinute = durationSecond * 60; var durationHour = durationMinute * 60; var durationDay = durationHour * 24; var durationWeek = durationDay * 7; var durationMonth = durationDay * 30; var durationYear = durationDay * 365; function date(t) { return new Date(t); } function number$1(t) { return t instanceof Date ? +t : +new Date(+t); } function calendar(year, month, week, day, hour, minute, second, millisecond, format$$1) { var scale = continuous(deinterpolateLinear, d3Interpolate.interpolateNumber), invert = scale.invert, domain = scale.domain; var formatMillisecond = format$$1(".%L"), formatSecond = format$$1(":%S"), formatMinute = format$$1("%I:%M"), formatHour = format$$1("%I %p"), formatDay = format$$1("%a %d"), formatWeek = format$$1("%b %d"), formatMonth = format$$1("%B"), formatYear = format$$1("%Y"); var tickIntervals = [ [second, 1, durationSecond], [second, 5, 5 * durationSecond], [second, 15, 15 * durationSecond], [second, 30, 30 * durationSecond], [minute, 1, durationMinute], [minute, 5, 5 * durationMinute], [minute, 15, 15 * durationMinute], [minute, 30, 30 * durationMinute], [ hour, 1, durationHour ], [ hour, 3, 3 * durationHour ], [ hour, 6, 6 * durationHour ], [ hour, 12, 12 * durationHour ], [ day, 1, durationDay ], [ day, 2, 2 * durationDay ], [ week, 1, durationWeek ], [ month, 1, durationMonth ], [ month, 3, 3 * durationMonth ], [ year, 1, durationYear ] ]; function tickFormat(date) { return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? (week(date) < date ? formatDay : formatWeek) : year(date) < date ? formatMonth : formatYear)(date); } function tickInterval(interval, start, stop, step) { if (interval == null) interval = 10; // If a desired tick count is specified, pick a reasonable tick interval // based on the extent of the domain and a rough estimate of tick size. // Otherwise, assume interval is already a time interval and use it. if (typeof interval === "number") { var target = Math.abs(stop - start) / interval, i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target); if (i === tickIntervals.length) { step = d3Array.tickStep(start / durationYear, stop / durationYear, interval); interval = year; } else if (i) { i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; step = i[1]; interval = i[0]; } else { step = Math.max(d3Array.tickStep(start, stop, interval), 1); interval = millisecond; } } return step == null ? interval : interval.every(step); } scale.invert = function(y) { return new Date(invert(y)); }; scale.domain = function(_) { return arguments.length ? domain(map$1.call(_, number$1)) : domain().map(date); }; scale.ticks = function(interval, step) { var d = domain(), t0 = d[0], t1 = d[d.length - 1], r = t1 < t0, t; if (r) t = t0, t0 = t1, t1 = t; t = tickInterval(interval, t0, t1, step); t = t ? t.range(t0, t1 + 1) : []; // inclusive stop return r ? t.reverse() : t; }; scale.tickFormat = function(count, specifier) { return specifier == null ? tickFormat : format$$1(specifier); }; scale.nice = function(interval, step) { var d = domain(); return (interval = tickInterval(interval, d[0], d[d.length - 1], step)) ? domain(nice(d, interval)) : scale; }; scale.copy = function() { return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format$$1)); }; return scale; } var time = function() { return calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]); }; var utcTime = function() { return calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]); }; var colors = function(s) { return s.match(/.{6}/g).map(function(x) { return "#" + x; }); }; var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"); var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"); var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"); var cubehelix$1 = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(300, 0.5, 0.0), d3Color.cubehelix(-240, 0.5, 1.0)); var warm = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(-100, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8)); var cool = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(260, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8)); var rainbow = d3Color.cubehelix(); var rainbow$1 = function(t) { if (t < 0 || t > 1) t -= Math.floor(t); var ts = Math.abs(t - 0.5); rainbow.h = 360 * t - 100; rainbow.s = 1.5 - 1.5 * ts; rainbow.l = 0.8 - 0.9 * ts; return rainbow + ""; }; function ramp(range$$1) { var n = range$$1.length; return function(t) { return range$$1[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); function sequential(interpolator) { var x0 = 0, x1 = 1, clamp = false; function scale(x) { var t = (x - x0) / (x1 - x0); return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t); } scale.domain = function(_) { return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1]; }; scale.clamp = function(_) { return arguments.length ? (clamp = !!_, scale) : clamp; }; scale.interpolator = function(_) { return arguments.length ? (interpolator = _, scale) : interpolator; }; scale.copy = function() { return sequential(interpolator).domain([x0, x1]).clamp(clamp); }; return linearish(scale); } exports.scaleBand = band; exports.scalePoint = point; exports.scaleIdentity = identity; exports.scaleLinear = linear; exports.scaleLog = log; exports.scaleOrdinal = ordinal; exports.scaleImplicit = implicit; exports.scalePow = pow; exports.scaleSqrt = sqrt; exports.scaleQuantile = quantile$1; exports.scaleQuantize = quantize; exports.scaleThreshold = threshold; exports.scaleTime = time; exports.scaleUtc = utcTime; exports.schemeCategory10 = category10; exports.schemeCategory20b = category20b; exports.schemeCategory20c = category20c; exports.schemeCategory20 = category20; exports.interpolateCubehelixDefault = cubehelix$1; exports.interpolateRainbow = rainbow$1; exports.interpolateWarm = warm; exports.interpolateCool = cool; exports.interpolateViridis = viridis; exports.interpolateMagma = magma; exports.interpolateInferno = inferno; exports.interpolatePlasma = plasma; exports.scaleSequential = sequential; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Scale_909 = _$d3Scale_909.exports /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var linear = _$d3Scale_909.scaleLinear; // TODO: remove var time = _$d3Scale_909.scaleTime; // TODO: remove // MAIN // /** * Returns a scale function for mapping values to a coordinate along the x-axis. * * @private * @returns {Function} scale function */ function __get_672() { /* eslint-disable no-invalid-this */ var scale; if ( this._xScale === 'time' ) { scale = time() .domain( this.xDomain ) .range( this.xRange ); } else if ( this._xScale === 'linear' ) { scale = linear() .domain( this.xDomain ) .range( this.xRange ); } // TODO: other scales return scale; } // EXPORTS // var _$get_672 = __get_672; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_673 = _$isString_164.isPrimitive; // VARIABLES // var __debug_673 = _$browser_913( 'plot:set:x-scale' ); // MAIN // /** * Sets the x-axis scale. * * @private * @param {string} scale - axis scale * @throws {TypeError} must be a string primitive * @returns {void} */ function __set_673( scale ) { /* eslint-disable no-invalid-this */ if ( !__isString_673( scale ) ) { throw new TypeError( 'invalid value. `xScale` must be a string. Value: `' + scale + '.`' ); } // TODO: test for valid scale if ( scale !== this._xScale ) { __debug_673( 'Current value: %s.', this._xScale ); this._xScale = scale; __debug_673( 'New value: %s.', this._xScale ); this.emit( 'change' ); } } // EXPORTS // var _$set_673 = __set_673; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __linear_701 = _$d3Scale_909.scaleLinear; // TODO: remove var __time_701 = _$d3Scale_909.scaleTime; // TODO: remove // MAIN // /** * Returns a scale function for mapping values to a coordinate along the y-axis. * * @private * @returns {Function} scale function */ function __get_701() { /* eslint-disable no-invalid-this */ var scale; if ( this._yScale === 'time' ) { scale = __time_701() .domain( this.yDomain ) .range( this.yRange ); } else if ( this._yScale === 'linear' ) { scale = __linear_701() .domain( this.yDomain ) .range( this.yRange ); } // TODO: other scales return scale; } // EXPORTS // var _$get_701 = __get_701; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_702 = _$isString_164.isPrimitive; // VARIABLES // var __debug_702 = _$browser_913( 'plot:set:y-scale' ); // MAIN // /** * Sets the y-axis scale. * * @private * @param {string} scale - axis scale * @throws {TypeError} must be a string primitive * @returns {void} */ function __set_702( scale ) { /* eslint-disable no-invalid-this */ if ( !__isString_702( scale ) ) { throw new TypeError( 'invalid value. `yScale` must be a string. Value: `' + scale + '.`' ); } // TODO: test for valid scale __debug_702( 'Current value: %s.', this._yScale ); this._yScale = scale; __debug_702( 'New value: %s.', this._yScale ); this.emit( 'change' ); } // EXPORTS // var _$set_702 = __set_702; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isString_675 = _$isString_164.isPrimitive; // VARIABLES // var __debug_675 = _$browser_913( 'plot:set:x-tick-format' ); // MAIN // /** * Sets the x-axis tick format. * * @private * @param {(string|null)} fmt - axis tick format * @throws {TypeError} must be a string primitive */ function __set_675( fmt ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( fmt ) && !__isString_675( fmt ) ) { throw new TypeError( 'invalid value. `xTickFormat` must be a string or null. Value: `' + fmt + '.`' ); } if ( fmt !== this._xTickFormat ) { __debug_675( 'Current value: %s.', this._xTickFormat ); this._xTickFormat = fmt; __debug_675( 'New value: %s.', this._xTickFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_675 = __set_675; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var format = _$d3Format_906.format; // TODO: remove var timeFormat = _$d3TimeFormat_911.timeFormat; // TODO: remove /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // MAIN // /** * Returns the x-axis tick format. * * @private * @returns {(Function|null)} format function or null */ function __get_310() { /* eslint-disable no-invalid-this */ if ( _$isNull_140( this._xTickFormat ) ) { return this._xTickFormat; } if ( this._xScale === 'time' ) { return timeFormat( this._xTickFormat ); } return format( this._xTickFormat ); } // EXPORTS // var _$get_310 = __get_310; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __format_674 = _$d3Format_906.format; // TODO: remove var __timeFormat_674 = _$d3TimeFormat_911.timeFormat; // TODO: remove /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // MAIN // /** * Returns the x-axis tick format. * * @private * @returns {(Function|null)} format function or null */ function __get_674() { /* eslint-disable no-invalid-this */ if ( _$isNull_140( this._xTickFormat ) ) { return this._xTickFormat; } if ( this._xScale === 'time' ) { return __timeFormat_674( this._xTickFormat ); } return __format_674( this._xTickFormat ); } // EXPORTS // var _$get_674 = __get_674; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isString_704 = _$isString_164.isPrimitive; // VARIABLES // var __debug_704 = _$browser_913( 'plot:set:y-tick-format' ); // MAIN // /** * Sets the y-axis tick format. * * @private * @param {(string|null)} fmt - axis tick format * @throws {TypeError} must be a string primitive or null */ function __set_704( fmt ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( fmt ) && !__isString_704( fmt ) ) { throw new TypeError( 'invalid value. `yTickFormat` must be a string or null. Value: `' + fmt + '.`' ); } if ( fmt !== this._yTickFormat ) { __debug_704( 'Current value: %s.', this._yTickFormat ); this._yTickFormat = fmt; __debug_704( 'New value: %s.', this._yTickFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_704 = __set_704; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __format_703 = _$d3Format_906.format; // TODO: remove var __timeFormat_703 = _$d3TimeFormat_911.timeFormat; // TODO: remove /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // MAIN // /** * Returns the y-axis tick format. * * @private * @returns {(Function|null)} format function or null */ function __get_703() { /* eslint-disable no-invalid-this */ if ( _$isNull_140( this._yTickFormat ) ) { return this._yTickFormat; } if ( this._yScale === 'time' ) { return __timeFormat_703( this._yTickFormat ); } return __format_703( this._yTickFormat ); } // EXPORTS // var _$get_703 = __get_703; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNonNegativeInteger_660 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_660 = _$browser_913( 'plot:set:x-num-ticks' ); // MAIN // /** * Sets the number of x-axis tick marks. * * @private * @param {(NonNegativeInteger|null)} ticks - number of ticks * @throws {TypeError} must be a nonnegative integer or null */ function __set_660( ticks ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( ticks ) && !__isNonNegativeInteger_660( ticks ) ) { throw new TypeError( 'invalid value. `xNumTicks` must be a nonnegative integer or null. Value: `' + ticks + '.`' ); } if ( ticks !== this._xNumTicks ) { __debug_660( 'Current value: %d.', this._xNumTicks ); this._xNumTicks = ticks; __debug_660( 'New value: %d.', this._xNumTicks ); this.emit( 'change' ); } } // EXPORTS // var _$set_660 = __set_660; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the number of x-axis tick marks. * * @private * @returns {(NonNegativeInteger|null)} number of ticks */ function __get_306() { /* eslint-disable no-invalid-this */ return this._xNumTicks; } // EXPORTS // var _$get_306 = __get_306; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the number of x-axis tick marks. * * @private * @returns {(NonNegativeInteger|null)} number of ticks */ function __get_659() { /* eslint-disable no-invalid-this */ return this._xNumTicks; } // EXPORTS // var _$get_659 = __get_659; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNonNegativeInteger_689 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_689 = _$browser_913( 'plot:set:y-num-ticks' ); // MAIN // /** * Sets the number of y-axis tick marks. * * @private * @param {(NonNegativeInteger|null)} ticks - number of ticks * @throws {TypeError} must be a nonnegative integer or null */ function __set_689( ticks ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( ticks ) && !__isNonNegativeInteger_689( ticks ) ) { throw new TypeError( 'invalid value. `yNumTicks` must be a nonnegative integer or null. Value: `' + ticks + '.`' ); } if ( ticks !== this._yNumTicks ) { __debug_689( 'Current value: %d.', this._yNumTicks ); this._yNumTicks = ticks; __debug_689( 'New value: %d.', this._yNumTicks ); this.emit( 'change' ); } } // EXPORTS // var _$set_689 = __set_689; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the number of y-axis tick marks. * * @private * @returns {(NonNegativeInteger|null)} number of ticks */ function __get_318() { /* eslint-disable no-invalid-this */ return this._yNumTicks; } // EXPORTS // var _$get_318 = __get_318; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the number of y-axis tick marks. * * @private * @returns {(NonNegativeInteger|null)} number of ticks */ function __get_688() { /* eslint-disable no-invalid-this */ return this._yNumTicks; } // EXPORTS // var _$get_688 = __get_688; var _$orientations_301=[ "bottom", "top" ] var _$orientations_650=[ "bottom", "top" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_650 = require( './orientations.json' ); */; // VARIABLES // var __debug_651 = _$browser_913( 'plot:set:x-axis-orient' ); // MAIN // /** * Sets the x-axis orientation. * * @private * @param {string} orientation - axis orientation * @throws {TypeError} must be either `'bottom'` or `'top'` */ function __set_651( orientation ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$orientations_650, orientation ) === -1 ) { throw new TypeError( 'invalid value. `xAxisOrient` must be one of `[' + _$orientations_650.join( ', ' ) + ']`. Value: `' + orientation + '.`' ); } if ( orientation !== this._xAxisOrient ) { __debug_651( 'Current value: %s.', this._xAxisOrient ); this._xAxisOrient = orientation; __debug_651( 'New value: %s.', this._xAxisOrient ); this.emit( 'change' ); } } // EXPORTS // var _$set_651 = __set_651; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis orientation. * * @private * @returns {string} orientation */ function __get_300() { /* eslint-disable no-invalid-this */ return this._xAxisOrient; } // EXPORTS // var _$get_300 = __get_300; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis orientation. * * @private * @returns {string} orientation */ function __get_649() { /* eslint-disable no-invalid-this */ return this._xAxisOrient; } // EXPORTS // var _$get_649 = __get_649; var _$orientations_313=[ "left", "right" ] var _$orientations_679=[ "left", "right" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_679 = require( './orientations.json' ); */; // VARIABLES // var __debug_680 = _$browser_913( 'plot:set:y-axis-orient' ); // MAIN // /** * Sets the y-axis orientation. * * @private * @param {string} orientation - axis orientation * @throws {TypeError} must be either `'left'` or `'right'` */ function __set_680( orientation ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$orientations_679, orientation ) === -1 ) { throw new TypeError( 'invalid value. `yAxisOrient` must be one of `[' + _$orientations_679.join( ', ' ) + ']`. Value: `' + orientation + '.`' ); } if ( orientation !== this._yAxisOrient ) { __debug_680( 'Current value: %s.', this._yAxisOrient ); this._yAxisOrient = orientation; __debug_680( 'New value: %s.', this._yAxisOrient ); this.emit( 'change' ); } } // EXPORTS // var _$set_680 = __set_680; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis orientation. * * @private * @returns {string} orientation */ function __get_312() { /* eslint-disable no-invalid-this */ return this._yAxisOrient; } // EXPORTS // var _$get_312 = __get_312; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis orientation. * * @private * @returns {string} orientation */ function __get_678() { /* eslint-disable no-invalid-this */ return this._yAxisOrient; } // EXPORTS // var _$get_678 = __get_678; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is an array-like object of booleans. * * @module @stdlib/assert/is-boolean-array * * @example * var isBooleanArray = require( '@stdlib/assert/is-boolean-array' ); * * var bool = isBooleanArray( [ true, false, true ] ); * // returns true * * bool = isBooleanArray( [ true, 'abc', false ] ); * // returns false * * @example * var isBooleanArray = require( '@stdlib/assert/is-boolean-array' ).primitives; * * var bool = isBooleanArray( [ true, false ] ); * // returns true * * bool = isBooleanArray( [ false, new Boolean( true ) ] ); * // returns false * * @example * var isBooleanArray = require( '@stdlib/assert/is-boolean-array' ).objects; * * var bool = isBooleanArray( [ new Boolean( false ), new Boolean( true ) ] ); * // returns true * * bool = isBooleanArray( [ new Boolean( false ), true ] ); * // returns false */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$arraylikefcn_185 = require( '@stdlib/assert/tools/array-like-function' ); */; /* removed: var _$isBoolean_86 = require( '@stdlib/assert/is-boolean' ); */; // MAIN // var isBooleanArray = _$arraylikefcn_185( _$isBoolean_86 ); _$setNonEnumerableReadOnly_820( isBooleanArray, 'primitives', _$arraylikefcn_185( _$isBoolean_86.isPrimitive ) ); _$setNonEnumerableReadOnly_820( isBooleanArray, 'objects', _$arraylikefcn_185( _$isBoolean_86.isObject ) ); // EXPORTS // var _$isBooleanArray_85 = isBooleanArray; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_671 = _$isBoolean_86.isPrimitive; var __isBooleanArray_671 = _$isBooleanArray_85.primitives; // VARIABLES // var __debug_671 = _$browser_913( 'plot:set:x-rug' ); // MAIN // /** * Sets a flag indicating whether to display a rug plot along the x-axis. * * @private * @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the x-axis * @throws {TypeError} must be a boolean primitive or boolean array */ function __set_671( v ) { /* eslint-disable no-invalid-this */ var isBool = __isBoolean_671( v ); if ( !isBool && !__isBooleanArray_671( v ) ) { throw new TypeError( 'invalid value. `xRug` must be a boolean or boolean array. Value: `' + v + '.`' ); } if ( isBool ) { v = [ v ]; } __debug_671( 'Current value: %s.', JSON.stringify( this._xRug ) ); this._xRug = v; __debug_671( 'New Value: %s.', JSON.stringify( this._xRug ) ); this.emit( 'change' ); } // EXPORTS // var _$set_671 = __set_671; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns whether a rug plot is displayed along the x-axis. * * @private * @returns {BooleanArray} boolean flags */ function __get_670() { /* eslint-disable no-invalid-this */ return this._xRug.slice(); } // EXPORTS // var _$get_670 = __get_670; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_700 = _$isBoolean_86.isPrimitive; var __isBooleanArray_700 = _$isBooleanArray_85.primitives; // VARIABLES // var __debug_700 = _$browser_913( 'plot:set:y-rug' ); // MAIN // /** * Sets a flag indicating whether to display a rug plot along the y-axis. * * @private * @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the y-axis * @throws {TypeError} must be a boolean primitive or boolean array */ function __set_700( v ) { /* eslint-disable no-invalid-this */ var isBool = __isBoolean_700( v ); if ( !isBool && !__isBooleanArray_700( v ) ) { throw new TypeError( 'invalid value. `yRug` must be a boolean or boolean array. Value: `' + v + '.`' ); } if ( isBool ) { v = [ v ]; } __debug_700( 'Current value: %s.', JSON.stringify( this._yRug ) ); this._yRug = v; __debug_700( 'New Value: %s.', JSON.stringify( this._yRug ) ); this.emit( 'change' ); } // EXPORTS // var _$set_700 = __set_700; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns whether a rug plot is displayed along the y-axis. * * @private * @returns {BooleanArray} boolean flag */ function __get_699() { /* eslint-disable no-invalid-this */ return this._yRug.slice(); } // EXPORTS // var _$get_699 = __get_699; var _$orientations_666=[ "bottom", "top" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_667 = _$isString_164.isPrimitive; var __isStringArray_667 = _$isStringArray_163.primitives; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_666 = require( './orientations.json' ); */; // VARIABLES // var __debug_667 = _$browser_913( 'plot:set:x-rug-orient' ); // MAIN // /** * Sets the x-axis rug orientation. * * @private * @param {(string|StringArray)} v - rug orientation * @throws {TypeError} must be either a string or string array * @throws {TypeError} must be either `'bottom'` or `'top'` */ function __set_667( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_667( v ); var i; if ( !isStr && !__isStringArray_667( v ) ) { throw new TypeError( 'invalid value. `xRugOrient` must be either a string or string array. Value: `' + v + '`.' ); } if ( isStr ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( _$indexOf_843( _$orientations_666, v[i] ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported orientation. An `xRugOrient` value must be one of `[' + _$orientations_666.join( ', ' ) + ']`. Value: `' + v[i] + '.`' ); } } __debug_667( 'Current value: %s.', JSON.stringify( this._xRugOrient ) ); this._xRugOrient = v; __debug_667( 'New value: %s.', JSON.stringify( this._xRugOrient ) ); this.emit( 'change' ); } // EXPORTS // var _$set_667 = __set_667; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis rug orientation. * * @private * @returns {StringArray} orientation */ function __get_665() { /* eslint-disable no-invalid-this */ return this._xRugOrient.slice(); } // EXPORTS // var _$get_665 = __get_665; var _$orientations_695=[ "left", "right" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_696 = _$isString_164.isPrimitive; var __isStringArray_696 = _$isStringArray_163.primitives; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_695 = require( './orientations.json' ); */; // VARIABLES // var __debug_696 = _$browser_913( 'plot:set:y-rug-orient' ); // MAIN // /** * Sets the y-axis rug orientation. * * @private * @param {(string|StringArray)} v - rug orientation * @throws {TypeError} must be either a string or string array * @throws {TypeError} must be either `'bottom'` or `'top'` */ function __set_696( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_696( v ); var i; if ( !isStr && !__isStringArray_696( v ) ) { throw new TypeError( 'invalid value. `yRugOrient` must be either a string or string array. Value: `' + v + '`.' ); } if ( isStr ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( _$indexOf_843( _$orientations_695, v[i] ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported orientation. A `yRugOrient` value must be one of `[' + _$orientations_695.join( ', ' ) + ']`. Value: `' + v[i] + '.`' ); } } __debug_696( 'Current value: %s.', JSON.stringify( this._yRugOrient ) ); this._yRugOrient = v; __debug_696( 'New value: %s.', JSON.stringify( this._yRugOrient ) ); this.emit( 'change' ); } // EXPORTS // var _$set_696 = __set_696; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis rug orientation. * * @private * @returns {StringArray} orientation */ function __get_694() { /* eslint-disable no-invalid-this */ return this._yRugOrient.slice(); } // EXPORTS // var _$get_694 = __get_694; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_664 = _$isNumber_143.isPrimitive; var __isNumberArray_664 = _$isNumberArray_142.primitives; // VARIABLES // var __debug_664 = _$browser_913( 'plot:set:x-rug-opacity' ); // MAIN // /** * Sets the x-axis rug opacity. * * @private * @param {(number|NumberArray)} v - opacity * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_664( v ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_664( v ); var i; if ( !isNum && !__isNumberArray_664( v ) ) { throw new TypeError( 'invalid value. `xRugOpacity` must be a number or number array. Value: `' + v + '.`' ); } if ( isNum ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { throw new RangeError( 'invalid value. An `xRugOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' ); } } __debug_664( 'Current value: %s.', JSON.stringify( this._xRugOpacity ) ); this._xRugOpacity = v; __debug_664( 'New Value: %s.', JSON.stringify( this._xRugOpacity ) ); this.emit( 'change' ); } // EXPORTS // var _$set_664 = __set_664; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis rug opacity. * * @private * @returns {NumberArray} rug opacities */ function __get_663() { /* eslint-disable no-invalid-this */ return this._xRugOpacity.slice(); } // EXPORTS // var _$get_663 = __get_663; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_693 = _$isNumber_143.isPrimitive; var __isNumberArray_693 = _$isNumberArray_142.primitives; // VARIABLES // var __debug_693 = _$browser_913( 'plot:set:y-rug-opacity' ); // MAIN // /** * Sets the y-axis rug opacity. * * @private * @param {(number|NumberArray)} v - opacity * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_693( v ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_693( v ); var i; if ( !isNum && !__isNumberArray_693( v ) ) { throw new TypeError( 'invalid value. `yRugOpacity` must be a number or number array. Value: `' + v + '.`' ); } if ( isNum ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { throw new RangeError( 'invalid value. A `yRugOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' ); } } __debug_693( 'Current value: %s.', JSON.stringify( this._yRugOpacity ) ); this._yRugOpacity = v; __debug_693( 'New Value: %s.', JSON.stringify( this._yRugOpacity ) ); this.emit( 'change' ); } // EXPORTS // var _$set_693 = __set_693; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis rug opacity. * * @private * @returns {NumberArray} rug opacities */ function __get_692() { /* eslint-disable no-invalid-this */ return this._yRugOpacity.slice(); } // EXPORTS // var _$get_692 = __get_692; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_669 = _$isNonNegativeInteger_136.isPrimitive; var __isNonNegativeIntegerArray_669 = _$isNonNegativeIntegerArray_135.primitives; // VARIABLES // var __debug_669 = _$browser_913( 'plot:set:x-rug-size' ); // MAIN // /** * Sets the x-axis rug tick (tassel) size. * * @private * @param {(NonNegativeInteger|Array)} v - size * @throws {TypeError} must be a nonnegative integer or nonnegative integer array */ function __set_669( v ) { /* eslint-disable no-invalid-this */ var isInt = __isNonNegativeInteger_669( v ); if ( !isInt && !__isNonNegativeIntegerArray_669( v ) ) { throw new TypeError( 'invalid value. `xRugSize` must be a nonnegative integer or nonnegative integer array. Value: `' + v + '.`' ); } if ( isInt ) { v = [ v ]; } else { v = v.slice(); } __debug_669( 'Current value: %s.', JSON.stringify( this._xRugSize ) ); this._xRugSize = v; __debug_669( 'New Value: %s.', JSON.stringify( this._xRugSize ) ); this.emit( 'change' ); } // EXPORTS // var _$set_669 = __set_669; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis rug tick (tassel) size. * * @private * @returns {Array} tick sizes */ function __get_668() { /* eslint-disable no-invalid-this */ return this._xRugSize.slice(); } // EXPORTS // var _$get_668 = __get_668; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_698 = _$isNonNegativeInteger_136.isPrimitive; var __isNonNegativeIntegerArray_698 = _$isNonNegativeIntegerArray_135.primitives; // VARIABLES // var __debug_698 = _$browser_913( 'plot:set:y-rug-size' ); // MAIN // /** * Sets the y-axis rug tick (tassel) size. * * @private * @param {(NonNegativeInteger|Array)} v - size * @throws {TypeError} must be a nonnegative integer or nonnegative integer array */ function __set_698( v ) { /* eslint-disable no-invalid-this */ var isInt = __isNonNegativeInteger_698( v ); if ( !isInt && !__isNonNegativeIntegerArray_698( v ) ) { throw new TypeError( 'invalid value. `yRugSize` must be a nonnegative integer or nonnegative integer array. Value: `' + v + '.`' ); } if ( isInt ) { v = [ v ]; } else { v = v.slice(); } __debug_698( 'Current value: %s.', JSON.stringify( this._yRugSize ) ); this._yRugSize = v; __debug_698( 'New Value: %s.', JSON.stringify( this._yRugSize ) ); this.emit( 'change' ); } // EXPORTS // var _$set_698 = __set_698; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis rug tick (tassel) size. * * @private * @returns {Array} tick sizes */ function __get_697() { /* eslint-disable no-invalid-this */ return this._yRugSize.slice(); } // EXPORTS // var _$get_697 = __get_697; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_605 = _$isString_164.isPrimitive; // VARIABLES // var __debug_605 = _$browser_913( 'plot:set:description' ); // MAIN // /** * Sets the description. * * @private * @param {string} str - description * @throws {TypeError} must be a string primitive */ function __set_605( str ) { /* eslint-disable no-invalid-this */ if ( !__isString_605( str ) ) { throw new TypeError( 'invalid value. `description` must be a string. Value: `' + str + '.`' ); } if ( str !== this._description ) { __debug_605( 'Current value: %s.', this._description ); this._description = str; __debug_605( 'New value: %s.', this._description ); this.emit( 'change' ); } } // EXPORTS // var _$set_605 = __set_605; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the description. * * @private * @returns {string} description */ function __get_264() { /* eslint-disable no-invalid-this */ return this._description; } // EXPORTS // var _$get_264 = __get_264; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the description. * * @private * @returns {string} description */ function __get_604() { /* eslint-disable no-invalid-this */ return this._description; } // EXPORTS // var _$get_604 = __get_604; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_643 = _$isString_164.isPrimitive; // VARIABLES // var __debug_643 = _$browser_913( 'plot:set:title' ); // MAIN // /** * Sets the title. * * @private * @param {string} str - title * @throws {TypeError} must be a string primitive */ function __set_643( str ) { /* eslint-disable no-invalid-this */ if ( !__isString_643( str ) ) { throw new TypeError( 'invalid value. `title` must be a string. Value: `' + str + '.`' ); } if ( str !== this._title ) { __debug_643( 'Current value: %s.', this._title ); this._title = str; __debug_643( 'New value: %s.', this._title ); this.emit( 'change' ); } } // EXPORTS // var _$set_643 = __set_643; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the title. * * @private * @returns {string} title */ function __get_293() { /* eslint-disable no-invalid-this */ return this._title; } // EXPORTS // var _$get_293 = __get_293; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the title. * * @private * @returns {string} title */ function __get_642() { /* eslint-disable no-invalid-this */ return this._title; } // EXPORTS // var _$get_642 = __get_642; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_654 = _$isString_164.isPrimitive; // VARIABLES // var __debug_654 = _$browser_913( 'plot:set:x-label' ); // MAIN // /** * Sets the x-axis label. * * @private * @param {string} label - axis label * @throws {TypeError} must be a string primitive */ function __set_654( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_654( label ) ) { throw new TypeError( 'invalid value. `xLabel` must be a string. Value: `' + label + '.`' ); } if ( label !== this._xLabel ) { __debug_654( 'Current value: %s.', this._xLabel ); this._xLabel = label; __debug_654( 'New value: %s.', this._xLabel ); this.emit( 'change' ); } } // EXPORTS // var _$set_654 = __set_654; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis label. * * @private * @returns {string} label */ function __get_304() { /* eslint-disable no-invalid-this */ return this._xLabel; } // EXPORTS // var _$get_304 = __get_304; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis label. * * @private * @returns {string} label */ function __get_653() { /* eslint-disable no-invalid-this */ return this._xLabel; } // EXPORTS // var _$get_653 = __get_653; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_683 = _$isString_164.isPrimitive; // VARIABLES // var __debug_683 = _$browser_913( 'plot:set:y-label' ); // MAIN // /** * Sets the y-axis label. * * @private * @param {string} label - axis label * @throws {TypeError} must be a string primitive */ function __set_683( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_683( label ) ) { throw new TypeError( 'invalid value. `yLabel` must be a string. Value: `' + label + '.`' ); } if ( label !== this._yLabel ) { __debug_683( 'Current value: %s.', this._yLabel ); this._yLabel = label; __debug_683( 'New value: %s.', this._yLabel ); this.emit( 'change' ); } } // EXPORTS // var _$set_683 = __set_683; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis label. * * @private * @returns {string} label */ function __get_316() { /* eslint-disable no-invalid-this */ return this._yLabel; } // EXPORTS // var _$get_316 = __get_316; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis label. * * @private * @returns {string} label */ function __get_682() { /* eslint-disable no-invalid-this */ return this._yLabel; } // EXPORTS // var _$get_682 = __get_682; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isCollection_94 = require( '@stdlib/assert/is-collection' ); */; var __isInteger_32 = _$isInteger_120.isPrimitive; var __isString_32 = _$isString_164.isPrimitive; var __isnan_32 = _$isnan_128.isPrimitive; // MAIN // /** * Tests if an array-like value contains a search value. * * @param {(Collection|string)} val - input value * @param {*} searchValue - search value * @param {integer} [position=0] - position at which to start searching for `searchValue` * @throws {TypeError} first argument must be array-like * @throws {Error} must provide a search value * @throws {TypeError} second argument must be a primitive string primitive when the first argument is a string * @throws {TypeError} third argument must be an integer * @returns {boolean} boolean indicating whether one value contains another * * @example * var bool = contains( 'last man standing', 'stand' ); * // returns true * * @example * var bool = contains( [ 1, 2, 3, 4 ], 2 ); * // returns true * * @example * var bool = contains( 'presidential election', 'president' ); * // returns true * * @example * var bool = contains( [ NaN, 2, 3, 4 ], NaN ); * // returns true * * @example * var bool = contains( 'javaScript', 'js' ); * // returns false * * @example * var bool = contains( [ 1, 2, 3, {} ], {} ); * // returns false * * @example * var bool = contains( 'Hidden Treasures', '' ); * // returns true */ function contains( val, searchValue, position ) { var len; var pos; var i; if ( !_$isCollection_94( val ) && !__isString_32( val ) ) { throw new TypeError( 'invalid argument. First argument must be array-like. Value: `' + val + '`.' ); } if ( arguments.length < 2 ) { throw new Error( 'insufficient input arguments. Must provide a search value.' ); } if ( arguments.length > 2 ) { if ( !__isInteger_32( position ) ) { throw new TypeError( 'invalid argument. Third argument must be an integer. Value: `' + position + '`.' ); } pos = position; if ( pos < 0 ) { pos = 0; } } else { pos = 0; } if ( __isString_32( val ) ) { if ( !__isString_32( searchValue ) ) { throw new TypeError( 'invalid argument. Second argument must be a string primitive. Value: `' + searchValue + '`.' ); } return val.indexOf( searchValue, pos ) !== -1; } len = val.length; if ( __isnan_32( searchValue ) ) { for ( i = pos; i < len; i++ ) { if ( __isnan_32( val[ i ] ) ) { return true; } } return false; } for ( i = pos; i < len; i++ ) { if ( val[ i ] === searchValue ) { return true; } } return false; } // EXPORTS // var _$contains_32 = contains; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if an array-like value contains another value. * * @module @stdlib/assert/contains * * @example * var contains = require( '@stdlib/assert/contains' ); * * var bool = contains( 'Hello World', 'World' ); * // returns true * * bool = contains( 'Hello World', 'world' ); * // returns false * * bool = contains( [ 1, 2, 3, 4 ], 2 ); * // returns true * * bool = contains( [ NaN, 2, 3, 4 ], NaN ); * // returns true */ // MODULES // /* removed: var _$contains_32 = require( './contains.js' ); */; // EXPORTS // var _$contains_33 = _$contains_32; var _$engines_266=[ "svg" ] var _$engines_606=[ "svg" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$contains_33 = require( '@stdlib/assert/contains' ); */; /* removed: var _$engines_606 = require( './engines.json' ); */; // VARIABLES // var __debug_608 = _$browser_913( 'plot:set:engine' ); // MAIN // /** * Sets the engine. * * @private * @param {string} engine - engine * @throws {TypeError} must be a recognized engine */ function __set_608( engine ) { /* eslint-disable no-invalid-this */ if ( !_$contains_33( _$engines_606, engine ) ) { throw new TypeError( 'invalid value. `engine` must be one of `[' + _$engines_606.join( ', ' ) + ']`. Value: `' + engine + '.`' ); } if ( engine !== this._engine ) { __debug_608( 'Current value: %s.', this._engine ); this._engine = engine; __debug_608( 'New value: %s.', this._engine ); this.emit( 'change' ); } } // EXPORTS // var _$set_608 = __set_608; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the plot engine. * * @private * @returns {string} engine */ function __get_607() { /* eslint-disable no-invalid-this */ return this._engine; } // EXPORTS // var _$get_607 = __get_607; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_598 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_598 = _$browser_913( 'plot:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a boolean primitive */ function __set_598( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_598( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoRender ) { __debug_598( 'Current value: %s.', this._autoRender ); this._autoRender = bool; __debug_598( 'New Value: %s.', this._autoRender ); this.emit( 'change' ); } } // EXPORTS // var _$set_598 = __set_598; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_260() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_260 = __get_260; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_597() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_597 = __get_597; var _$formats_290=[ "vdom", "html" ] var _$formats_632=[ "vdom", "html" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$formats_632 = require( './formats.json' ); */; // VARIABLES // var __debug_634 = _$browser_913( 'plot:set:renderformat' ); // MAIN // /** * Sets the render format. * * @private * @param {string} format - format * @throws {TypeError} must be a recognized render format */ function __set_634( format ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$formats_632, format ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported `format`. Must be one of `[' + _$formats_632.join( ', ' ) + ']`. Value: `' + format + '.`' ); } if ( format !== this._renderFormat ) { __debug_634( 'Current value: %s.', this._renderFormat ); this._renderFormat = format; __debug_634( 'New value: %s.', this._renderFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_634 = __set_634; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the render format. * * @private * @returns {string} format */ function __get_291() { /* eslint-disable no-invalid-this */ return this._renderFormat; } // EXPORTS // var _$get_291 = __get_291; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the render format. * * @private * @returns {string} format */ function __get_633() { /* eslint-disable no-invalid-this */ return this._renderFormat; } // EXPORTS // var _$get_633 = __get_633; var _$viewers_297=[ "none", "browser", "terminal", "stdout", "window" ] var _$viewers_646=[ "none", "browser", "terminal", "stdout", "window" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$viewers_646 = require( './viewers.json' ); */; // VARIABLES // var __debug_645 = _$browser_913( 'plot:set:viewer' ); // MAIN // /** * Sets the viewer. * * @private * @param {string} viewer - viewer * @throws {TypeError} must be a recognized viewer */ function __set_645( viewer ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$viewers_646, viewer ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported `viewer`. Value: `' + viewer + '.`' ); } if ( viewer !== this._viewer ) { __debug_645( 'Current value: %s.', this._viewer ); this._viewer = viewer; __debug_645( 'New value: %s.', this._viewer ); this.emit( 'change' ); } } // EXPORTS // var _$set_645 = __set_645; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the plot viewer. * * @private * @returns {string} viewer */ function __get_295() { /* eslint-disable no-invalid-this */ return this._viewer; } // EXPORTS // var _$get_295 = __get_295; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the plot viewer. * * @private * @returns {string} viewer */ function __get_644() { /* eslint-disable no-invalid-this */ return this._viewer; } // EXPORTS // var _$get_644 = __get_644; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_600 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_600 = _$browser_913( 'plot:set:auto-view' ); // MAIN // /** * Sets the viewing mode. * * @private * @param {boolean} bool - boolean indicating whether to generate an updated view on a render event * @throws {TypeError} must be a boolean primitive */ function __set_600( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_600( bool ) ) { throw new TypeError( 'invalid value. `autoView` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoView ) { __debug_600( 'Current value: %s.', this._autoView ); this._autoView = bool; __debug_600( 'New Value: %s.', this._autoView ); this.emit( 'change' ); } } // EXPORTS // var _$set_600 = __set_600; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the viewing mode. * * @private * @returns {boolean} viewing mode */ function __get_262() { /* eslint-disable no-invalid-this */ return this._autoView; } // EXPORTS // var _$get_262 = __get_262; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the viewing mode. * * @private * @returns {boolean} viewing mode */ function __get_599() { /* eslint-disable no-invalid-this */ return this._autoView; } // EXPORTS // var _$get_599 = __get_599; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the expected graph width. * * @private * @returns {number} graph width */ function __get_270() { /* eslint-disable no-invalid-this */ return this._width - this._paddingLeft - this._paddingRight; } // EXPORTS // var _$get_270 = __get_270; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the expected graph width. * * @private * @returns {number} graph width */ function __get_610() { /* eslint-disable no-invalid-this */ return this._width - this._paddingLeft - this._paddingRight; } // EXPORTS // var _$get_610 = __get_610; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the expected graph height. * * @private * @returns {number} graph height */ function __get_269() { /* eslint-disable no-invalid-this */ return this._height - this._paddingTop - this._paddingBottom; } // EXPORTS // var _$get_269 = __get_269; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the expected graph height. * * @private * @returns {number} graph height */ function __get_609() { /* eslint-disable no-invalid-this */ return this._height - this._paddingTop - this._paddingBottom; } // EXPORTS // var _$get_609 = __get_609; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis domain. * * @private * @returns {Array} domain */ function __get_303() { /* eslint-disable no-invalid-this */ return [ this.xMin, this.xMax ]; } // EXPORTS // var _$get_303 = __get_303; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis domain. * * @private * @returns {Array} domain */ function __get_652() { /* eslint-disable no-invalid-this */ return [ this.xMin, this.xMax ]; } // EXPORTS // var _$get_652 = __get_652; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis domain. * * @private * @returns {Array} domain */ function __get_315() { /* eslint-disable no-invalid-this */ return [ this.yMin, this.yMax ]; } // EXPORTS // var _$get_315 = __get_315; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis domain. * * @private * @returns {Array} domain */ function __get_681() { /* eslint-disable no-invalid-this */ return [ this.yMin, this.yMax ]; } // EXPORTS // var _$get_681 = __get_681; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis range. * * @private * @returns {NumberArray} range */ function __get_309() { /* eslint-disable no-invalid-this */ return [ 0, this.graphWidth ]; } // EXPORTS // var _$get_309 = __get_309; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-axis range. * * @private * @returns {NumberArray} range */ function __get_662() { /* eslint-disable no-invalid-this */ return [ 0, this.graphWidth ]; } // EXPORTS // var _$get_662 = __get_662; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis range. * * @private * @returns {NumberArray} range */ function __get_321() { /* eslint-disable no-invalid-this */ return [ this.graphHeight, 0 ]; } // EXPORTS // var _$get_321 = __get_321; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-axis range. * * @private * @returns {NumberArray} range */ function __get_691() { /* eslint-disable no-invalid-this */ return [ this.graphHeight, 0 ]; } // EXPORTS // var _$get_691 = __get_691; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_661 = _$browser_913( 'plot:x-pos' ); // MAIN // /** * Returns a function to map values to x-axis coordinate values. * * @private * @returns {Function} map function */ function __get_661() { /* eslint-disable no-invalid-this */ var scale = this.xScale; return xPos; /** * Maps a value to a x-axis coordinate value. * * @private * @param {number} d - datum * @returns {number} pixel value */ function xPos( d ) { var px = scale( d ); __debug_661( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_661 = __get_661; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_690 = _$browser_913( 'plot:y-pos' ); // MAIN // /** * Returns a function to map values to y-axis coordinate values. * * @private * @returns {Function} map function */ function __get_690() { /* eslint-disable no-invalid-this */ var scale = this.yScale; return yPos; /** * Maps a value to a y-axis coordinate value. * * @private * @param {number} d - datum * @returns {number} pixel value */ function yPos( d ) { var px = scale( d ); __debug_690( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_690 = __get_690; /*! * escape-html * Copyright(c) 2012-2013 TJ Holowaychuk * Copyright(c) 2015 Andreas Lubbe * Copyright(c) 2015 Tiancheng "Timothy" Gu * MIT Licensed */ 'use strict'; /** * Module variables. * @private */ var matchHtmlRegExp = /["'&<>]/; /** * Module exports. * @public */ var _$escapeHtml_915 = escapeHtml; /** * Escape special characters in the given string of html. * * @param {string} string The string to escape for inserting into HTML * @return {string} * @public */ function escapeHtml(string) { var str = '' + string; var match = matchHtmlRegExp.exec(str); if (!match) { return str; } var escape; var html = ''; var index = 0; var lastIndex = 0; for (index = match.index; index < str.length; index++) { switch (str.charCodeAt(index)) { case 34: // " escape = '"'; break; case 38: // & escape = '&'; break; case 39: // ' escape = '''; break; case 60: // < escape = '<'; break; case 62: // > escape = '>'; break; default: continue; } if (lastIndex !== index) { html += str.substring(lastIndex, index); } lastIndex = index + 1; html += escape; } return lastIndex !== index ? html + str.substring(lastIndex, index) : html; } var _$extend_948 = extend var hasOwnProperty = Object.prototype.hasOwnProperty; function extend() { var target = {} for (var i = 0; i < arguments.length; i++) { var source = arguments[i] for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key] } } } return target } var _$version_944 = "2" /* removed: var _$version_944 = require("./version") */; var _$isVirtualNode_941 = isVirtualNode function isVirtualNode(x) { return x && x.type === "VirtualNode" && x.version === _$version_944 } /* removed: var _$version_944 = require("./version") */; var _$isVirtualText_942 = isVirtualText function isVirtualText(x) { return x && x.type === "VirtualText" && x.version === _$version_944 } var _$isThunk_939 = isThunk function isThunk(t) { return t && t.type === "Thunk" } var _$isWidget_943 = isWidget function isWidget(w) { return w && w.type === "Widget" } 'use strict'; var _$SoftSetHook_936 = SoftSetHook; function SoftSetHook(value) { if (!(this instanceof SoftSetHook)) { return new SoftSetHook(value); } this.value = value; } SoftSetHook.prototype.hook = function (node, propertyName) { if (node[propertyName] !== this.value) { node[propertyName] = this.value; } }; 'use strict'; var _$AttributeHook_934 = AttributeHook; function AttributeHook(namespace, value) { if (!(this instanceof AttributeHook)) { return new AttributeHook(namespace, value); } this.namespace = namespace; this.value = value; } AttributeHook.prototype.hook = function (node, prop, prev) { if (prev && prev.type === 'AttributeHook' && prev.value === this.value && prev.namespace === this.namespace) { return; } node.setAttributeNS(this.namespace, prop, this.value); }; AttributeHook.prototype.unhook = function (node, prop, next) { if (next && next.type === 'AttributeHook' && next.namespace === this.namespace) { return; } var colonPosition = prop.indexOf(':'); var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop; node.removeAttributeNS(this.namespace, localName); }; AttributeHook.prototype.type = 'AttributeHook'; /** * Special language-specific overrides. * * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt * * @type {Object} */ var LANGUAGES = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { '\u0130': '\u0069', '\u0049': '\u0131', '\u0049\u0307': '\u0069' } }, az: { regexp: /[\u0130]/g, map: { '\u0130': '\u0069', '\u0049': '\u0131', '\u0049\u0307': '\u0069' } }, lt: { regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g, map: { '\u0049': '\u0069\u0307', '\u004A': '\u006A\u0307', '\u012E': '\u012F\u0307', '\u00CC': '\u0069\u0307\u0300', '\u00CD': '\u0069\u0307\u0301', '\u0128': '\u0069\u0307\u0303' } } } /** * Lowercase a string. * * @param {String} str * @return {String} */ var _$lowerCase_921 = function (str, locale) { var lang = LANGUAGES[locale] str = str == null ? '' : String(str) if (lang) { str = str.replace(lang.regexp, function (m) { return lang.map[m] }) } return str.toLowerCase() } var _$nonWordRegexp_927 = /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g var _$camelCaseRegexp_926 = /([\u0061-\u007A\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])([\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g var _$trailingDigitRegexp_928 = /([\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([^\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g /* removed: var _$lowerCase_921 = require('lower-case') */; /* removed: var _$nonWordRegexp_927 = require('./vendor/non-word-regexp') */; /* removed: var _$camelCaseRegexp_926 = require('./vendor/camel-case-regexp') */; /* removed: var _$trailingDigitRegexp_928 = require('./vendor/trailing-digit-regexp') */; /** * Sentence case a string. * * @param {String} str * @param {String} locale * @param {String} replacement * @return {String} */ var _$sentenceCase_925 = function (str, locale, replacement) { if (str == null) { return '' } replacement = replacement || ' ' function replace (match, index, string) { if (index === 0 || index === (string.length - match.length)) { return '' } return replacement } str = String(str) // Support camel case ("camelCase" -> "camel Case"). .replace(_$camelCaseRegexp_926, '$1 $2') // Support digit groups ("test2012" -> "test 2012"). .replace(_$trailingDigitRegexp_928, '$1 $2') // Remove all non-word characters and replace with a single space. .replace(_$nonWordRegexp_927, replace) // Lower case the entire string. return _$lowerCase_921(str, locale) } /* removed: var _$sentenceCase_925 = require('sentence-case') */; /** * Param case a string. * * @param {String} string * @param {String} [locale] * @return {String} */ var _$paramCase_923 = function (string, locale) { return _$sentenceCase_925(string, locale, '-') } /** * Attribute types. */ var types = { BOOLEAN: 1, OVERLOADED_BOOLEAN: 2 }; /** * Properties. * * Taken from https://github.com/facebook/react/blob/847357e42e5267b04dd6e297219eaa125ab2f9f4/src/browser/ui/dom/HTMLDOMPropertyConfig.js * */ var properties = { /** * Standard Properties */ accept: true, acceptCharset: true, accessKey: true, action: true, allowFullScreen: types.BOOLEAN, allowTransparency: true, alt: true, async: types.BOOLEAN, autocomplete: true, autofocus: types.BOOLEAN, autoplay: types.BOOLEAN, cellPadding: true, cellSpacing: true, charset: true, checked: types.BOOLEAN, classID: true, className: true, cols: true, colSpan: true, content: true, contentEditable: true, contextMenu: true, controls: types.BOOLEAN, coords: true, crossOrigin: true, data: true, // For `` acts as `src`. dateTime: true, defer: types.BOOLEAN, dir: true, disabled: types.BOOLEAN, download: types.OVERLOADED_BOOLEAN, draggable: true, enctype: true, form: true, formAction: true, formEncType: true, formMethod: true, formNoValidate: types.BOOLEAN, formTarget: true, frameBorder: true, headers: true, height: true, hidden: types.BOOLEAN, href: true, hreflang: true, htmlFor: true, httpEquiv: true, icon: true, id: true, label: true, lang: true, list: true, loop: types.BOOLEAN, manifest: true, marginHeight: true, marginWidth: true, max: true, maxLength: true, media: true, mediaGroup: true, method: true, min: true, multiple: types.BOOLEAN, muted: types.BOOLEAN, name: true, noValidate: types.BOOLEAN, open: true, pattern: true, placeholder: true, poster: true, preload: true, radiogroup: true, readOnly: types.BOOLEAN, rel: true, required: types.BOOLEAN, role: true, rows: true, rowSpan: true, sandbox: true, scope: true, scrolling: true, seamless: types.BOOLEAN, selected: types.BOOLEAN, shape: true, size: true, sizes: true, span: true, spellcheck: true, src: true, srcdoc: true, srcset: true, start: true, step: true, style: true, tabIndex: true, target: true, title: true, type: true, useMap: true, value: true, width: true, wmode: true, /** * Non-standard Properties */ // autoCapitalize and autoCorrect are supported in Mobile Safari for // keyboard hints. autocapitalize: true, autocorrect: true, // itemProp, itemScope, itemType are for Microdata support. See // http://schema.org/docs/gs.html itemProp: true, itemScope: types.BOOLEAN, itemType: true, // property is supported for OpenGraph in meta tags. property: true }; /** * Properties to attributes mapping. * * The ones not here are simply converted to lower case. */ var attributeNames = { acceptCharset: 'accept-charset', className: 'class', htmlFor: 'for', httpEquiv: 'http-equiv' }; /** * Exports. */ var _$propertyConfig_931 = { attributeTypes: types, properties: properties, attributeNames: attributeNames }; /* removed: var _$escapeHtml_915 = require('escape-html'); */; /* removed: var _$propertyConfig_931 = require('./property-config'); */; var __types_929 = _$propertyConfig_931.attributeTypes; var __properties_929 = _$propertyConfig_931.properties; var __attributeNames_929 = _$propertyConfig_931.attributeNames; var prefixAttribute = memoizeString(function (name) { return _$escapeHtml_915(name) + '="'; }); var _$createAttribute_929 = createAttribute; /** * Create attribute string. * * @param {String} name The name of the property or attribute * @param {*} value The value * @param {Boolean} [isAttribute] Denotes whether `name` is an attribute. * @return {?String} Attribute string || null if not a valid property or custom attribute. */ function createAttribute(name, value, isAttribute) { if (__properties_929.hasOwnProperty(name)) { if (shouldSkip(name, value)) return ''; name = (__attributeNames_929[name] || name).toLowerCase(); var attrType = __properties_929[name]; // for BOOLEAN `value` only has to be truthy // for OVERLOADED_BOOLEAN `value` has to be === true if ((attrType === __types_929.BOOLEAN) || (attrType === __types_929.OVERLOADED_BOOLEAN && value === true)) { return _$escapeHtml_915(name); } return prefixAttribute(name) + _$escapeHtml_915(value) + '"'; } else if (isAttribute) { if (value == null) return ''; return prefixAttribute(name) + _$escapeHtml_915(value) + '"'; } // return null if `name` is neither a valid property nor an attribute return null; } /** * Should skip false boolean attributes. */ function shouldSkip(name, value) { var attrType = __properties_929[name]; return value == null || (attrType === __types_929.BOOLEAN && !value) || (attrType === __types_929.OVERLOADED_BOOLEAN && value === false); } /** * Memoizes the return value of a function that accepts one string argument. * * @param {function} callback * @return {function} */ function memoizeString(callback) { var cache = {}; return function(string) { if (cache.hasOwnProperty(string)) { return cache[string]; } else { return cache[string] = callback.call(this, string); } }; } /** * Void elements. * * https://github.com/facebook/react/blob/v0.12.0/src/browser/ui/ReactDOMComponent.js#L99 */ var _$voidElements_932 = { 'area': true, 'base': true, 'br': true, 'col': true, 'embed': true, 'hr': true, 'img': true, 'input': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'track': true, 'wbr': true }; /* removed: var _$escapeHtml_915 = require('escape-html'); */; /* removed: var _$extend_948 = require('xtend'); */; /* removed: var _$isVirtualNode_941 = require('virtual-dom/vnode/is-vnode'); */; /* removed: var _$isVirtualText_942 = require('virtual-dom/vnode/is-vtext'); */; /* removed: var _$isThunk_939 = require('virtual-dom/vnode/is-thunk'); */; /* removed: var _$isWidget_943 = require('virtual-dom/vnode/is-widget'); */; /* removed: var _$SoftSetHook_936 = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook'); */; /* removed: var _$AttributeHook_934 = require('virtual-dom/virtual-hyperscript/hooks/attribute-hook'); */; /* removed: var _$paramCase_923 = require('param-case'); */; /* removed: var _$createAttribute_929 = require('./create-attribute'); */; /* removed: var _$voidElements_932 = require('./void-elements'); */; var _$toHTML_930 = toHTML; function toHTML(node, parent) { if (!node) return ''; if (_$isThunk_939(node)) { node = node.render(); } if (_$isWidget_943(node) && node.render) { node = node.render(); } if (_$isVirtualNode_941(node)) { return openTag(node) + tagContent(node) + closeTag(node); } else if (_$isVirtualText_942(node)) { if (parent && (parent.tagName.toLowerCase() === 'script' || parent.tagName.toLowerCase() === 'style')) return String(node.text); return _$escapeHtml_915(String(node.text)); } return ''; } function openTag(node) { var props = node.properties; var ret = '<' + node.tagName.toLowerCase(); for (var name in props) { var value = props[name]; if (value == null) continue; if (name == 'attributes') { value = _$extend_948({}, value); for (var attrProp in value) { ret += ' ' + _$createAttribute_929(attrProp, value[attrProp], true); } continue; } if (name == 'dataset') { value = _$extend_948({}, value); for (var dataProp in value) { ret += ' ' + _$createAttribute_929('data-' + _$paramCase_923(dataProp), value[dataProp], true); } continue; } if (name == 'style') { var css = ''; value = _$extend_948({}, value); for (var styleProp in value) { css += _$paramCase_923(styleProp) + ': ' + value[styleProp] + '; '; } value = css.trim(); } if (value instanceof _$SoftSetHook_936 || value instanceof _$AttributeHook_934) { ret += ' ' + _$createAttribute_929(name, value.value, true); continue; } var attr = _$createAttribute_929(name, value); if (attr) ret += ' ' + attr; } return ret + '>'; } function tagContent(node) { var innerHTML = node.properties.innerHTML; if (innerHTML != null) return innerHTML; else { var ret = ''; if (node.children && node.children.length) { for (var i = 0, l = node.children.length; i'; } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns an x-axis translation transform. * * @private * @param {string} orient - axis orientation * @param {number} height - graph height * @returns {string} transform */ function xAxisTransform( orient, height ) { if ( orient === 'top' ) { return 'translate(0,0)'; } return 'translate(0,'+height+')'; } // EXPORTS // var _$xAxisTransform_716 = xAxisTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a y-axis translation transform. * * @private * @param {string} orient - axis orientation * @param {number} width - graph width * @returns {string} transform */ function yAxisTransform( orient, width ) { if ( orient === 'left' ) { return 'translate(0,0)'; } return 'translate('+width+',0)'; } // EXPORTS // var _$yAxisTransform_718 = yAxisTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_711 = _$browser_913( 'plot:render:svg:marks:lines' ); // MAIN // /** * Renders line marks. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function render( state ) { var nOpacities; var lineStyle; var opacity; var nColors; var nStyles; var nWidths; var color; var width; var marks; var line; var len; var i; line = state.$.svg.path; nOpacities = state.lineOpacity.length; nStyles = state.lineStyle.length; nWidths = state.lineWidth.length; nColors = state.colors.length; len = state.x.length; marks = []; __debug_711( 'Rendering lines...' ); for ( i = 0; i < len; i++ ) { lineStyle = state.lineStyle[ i%nStyles ]; __debug_711( 'Line style: %s (%d).', lineStyle, i ); if ( lineStyle === 'none' ) { __debug_711( 'Line style (%d) is `none`. Skipping...', i ); continue; } color = state.colors[ i%nColors ]; __debug_711( 'Line color: %s (%d).', color, i ); opacity = state.lineOpacity[ i%nOpacities ]; __debug_711( 'Line opacity: %s (%d).', opacity, i ); width = state.lineWidth[ i%nWidths ]; __debug_711( 'Line width: %s (%d).', width, i ); line.x = state.x[ i ]; line.y = state.y[ i ]; line.style = lineStyle; line.label = state.labels[ i ] || ''; line.color = color; line.opacity = opacity; line.width = width; __debug_711( 'Rendering line %d...', i ); marks.push( line.render() ); } __debug_711( 'Finished rendering lines.' ); return marks; } // EXPORTS // var _$render_711 = render; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_712 = _$browser_913( 'plot:render:svg:marks:symbols' ); // MAIN // /** * Renders symbols marks. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function __render_712( state ) { var nOpacities; var nSymbols; var nColors; var opacity; var nSizes; var symbol; var color; var marks; var size; var sym; var len; var i; sym = state.$.svg.symbols; nOpacities = state.symbolsOpacity.length; nSymbols = state.symbols.length; nColors = state.colors.length; nSizes = state.symbolsSize.length; len = state.x.length; marks = []; __debug_712( 'Rendering symbols...' ); for ( i = 0; i < len; i++ ) { symbol = state.symbols[ i%nSymbols ]; __debug_712( 'Symbol: %s (%d).', symbol, i ); if ( symbol === 'none' ) { __debug_712( 'Symbol (%d) is `none`. Skipping...', i ); continue; } opacity = state.symbolsOpacity[ i%nOpacities ]; __debug_712( 'Symbols opacity: %d (%d).', opacity, i ); size = state.symbolsSize[ i%nSizes ]; __debug_712( 'Symbols size: %d (%d).', size, i ); color = state.colors[ i%nColors ]; __debug_712( 'Symbols color: %s (%d).', color, i ); sym.x = state.x[ i ]; sym.y = state.y[ i ]; sym.symbol = symbol; sym.label = state.labels[ i ] || ''; sym.color = color; sym.size = size; sym.opacity = opacity; __debug_712( 'Rendering symbols %d...', i ); marks.push( sym.render() ); } __debug_712( 'Finished rendering symbols.' ); return marks; } // EXPORTS // var _$render_712 = __render_712; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns an x-axis rug translation transform. * * @private * @param {string} orient - axis orientation * @param {number} height - graph height * @returns {string} transform */ function xRugTransform( orient, height ) { if ( orient === 'top' ) { return 'translate(0,0)'; } return 'translate(0,'+height+')'; } // EXPORTS // var _$xRugTransform_717 = xRugTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$xRugTransform_717 = require( './../utils/x_rug_transform.js' ); */; // VARIABLES // var __debug_713 = _$browser_913( 'plot:render:svg:marks:x-rug' ); // MAIN // /** * Renders x-axis rug plots. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function __render_713( state ) { var rugTransform; var nOpacities; var nOrients; var opacity; var nColors; var nSizes; var orient; var nFlgs; var color; var marks; var size; var rug; var len; var tmp; var i; rug = state.$.svg.xRug; nOpacities = state.xRugOpacity.length; nOrients = state.xRugOrient.length; nColors = state.colors.length; nSizes = state.xRugSize.length; nFlgs = state.xRug.length; len = state.x.length; marks = []; __debug_713( 'Rendering x-axis rug plots...' ); for ( i = 0; i < len; i++ ) { if ( !state.xRug[ i%nFlgs ] ) { __debug_713( 'Rug plot (%d) disabled. Skipping...', i ); continue; } color = state.colors[ i%nColors ]; __debug_713( 'Rug color: %s (%d).', color, i ); opacity = state.xRugOpacity[ i%nOpacities ]; __debug_713( 'Rug opacity: %d (%d).', opacity, i ); orient = state.xRugOrient[ i%nOrients ]; __debug_713( 'Rug orientation: %s (%d).', orient, i ); size = state.xRugSize[ i%nSizes ]; __debug_713( 'Rug tick size: %d (%d).', size, i ); rug.data = state.x[ i ]; rug.label = state.labels[ i ] || ''; rug.color = color; rug.size = size; rug.opacity = opacity; rug.orientation = orient; __debug_713( 'Rendering x-axis rug %d...', i ); tmp = rug.render(); // Update the class name to indicate this is an x-axis rug and add a transform to translate the rug into position based on the graph dimensions. tmp.properties.className += ' x'; rugTransform = _$xRugTransform_717( orient, state.graphHeight ); if ( !tmp.properties.attributes ) { tmp.properties.attributes = {}; } tmp.properties.attributes.transform = rugTransform; marks.push( tmp ); } __debug_713( 'Finished rendering x-axis rug plots.' ); return marks; } // EXPORTS // var _$render_713 = __render_713; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a y-axis rug translation transform. * * @private * @param {string} orient - axis orientation * @param {number} width - graph width * @returns {string} transform */ function yRugTransform( orient, width ) { if ( orient === 'left' ) { return 'translate(0,0)'; } return 'translate('+width+',0)'; } // EXPORTS // var _$yRugTransform_719 = yRugTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$yRugTransform_719 = require( './../utils/y_rug_transform.js' ); */; // VARIABLES // var __debug_714 = _$browser_913( 'plot:render:svg:marks:y-rug' ); // MAIN // /** * Renders y-axis rug plots. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function __render_714( state ) { var rugTransform; var nOpacities; var nOrients; var opacity; var nColors; var nSizes; var orient; var nFlgs; var color; var marks; var size; var rug; var len; var tmp; var i; rug = state.$.svg.yRug; nOpacities = state.yRugOpacity.length; nOrients = state.yRugOrient.length; nColors = state.colors.length; nSizes = state.yRugSize.length; nFlgs = state.yRug.length; len = state.y.length; marks = []; __debug_714( 'Rendering y-axis rug plots...' ); for ( i = 0; i < len; i++ ) { if ( !state.yRug[ i%nFlgs ] ) { __debug_714( 'Rug plot (%d) disabled. Skipping...', i ); continue; } color = state.colors[ i%nColors ]; __debug_714( 'Rug color: %s (%d).', color, i ); opacity = state.yRugOpacity[ i%nOpacities ]; __debug_714( 'Rug opacity: %d (%d).', opacity, i ); orient = state.yRugOrient[ i%nOrients ]; __debug_714( 'Rug orientation: %s (%d).', orient, i ); size = state.yRugSize[ i%nSizes ]; __debug_714( 'Rug tick size: %d (%d).', size, i ); rug.data = state.y[ i ]; rug.label = state.labels[ i ] || ''; rug.color = color; rug.size = size; rug.opacity = opacity; rug.orientation = orient; __debug_714( 'Rendering y-axis rug %d...', i ); tmp = rug.render(); // Update the class name to indicate this is a y-axis rug and add a transform to translate the rug into position based on the graph dimensions. tmp.properties.className += ' y'; rugTransform = _$yRugTransform_719( orient, state.graphWidth ); if ( !tmp.properties.attributes ) { tmp.properties.attributes = {}; } tmp.properties.attributes.transform = rugTransform; marks.push( tmp ); } __debug_714( 'Finished rendering y-axis rug plots.' ); return marks; } // EXPORTS // var _$render_714 = __render_714; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$render_711 = require( './lines.js' ); */; /* removed: var _$render_712 = require( './symbols.js' ); */; /* removed: var _$render_713 = require( './x_rug.js' ); */; /* removed: var _$render_714 = require( './y_rug.js' ); */; // VARIABLES // var __debug_710 = _$browser_913( 'plot:render:svg:marks' ); // MAIN // /** * Renders individual marks. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function __render_710( state ) { var parent; var marks; var len; var i; __debug_710( 'Rendering marks group...' ); parent = state.$.svg.marks.render(); len = state.x.length; if ( len === 0 ) { __debug_710( 'No individual marks to render.' ); return parent; } marks = []; __debug_710( 'Rendering lines...' ); marks = marks.concat( _$render_711( state ) ); __debug_710( 'Rendering symbols...' ); marks = marks.concat( _$render_712( state ) ); __debug_710( 'Rendering x-axis rug plots...' ); marks = marks.concat( _$render_713( state ) ); __debug_710( 'Rendering y-axis rug plots...' ); marks = marks.concat( _$render_714( state ) ); __debug_710( 'Inserting individual marks into marks group...' ); for ( i = 0; i < marks.length; i++ ) { parent.children.push( marks[i] ); parent.count += marks[i].count; } __debug_710( 'Finished rendering marks.' ); return parent; } // EXPORTS // var _$render_710 = __render_710; var nativeIsArray = Array.isArray var __toString_947 = Object.prototype.toString var _$xIsArray_947 = nativeIsArray || __isArray_947 function __isArray_947(obj) { return __toString_947.call(obj) === "[object Array]" } var _$isHook_940 = isHook function isHook(hook) { return hook && (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") || typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook")) } /* removed: var _$version_944 = require("./version") */; /* removed: var _$isVirtualNode_941 = require("./is-vnode") */; /* removed: var _$isWidget_943 = require("./is-widget") */; /* removed: var _$isThunk_939 = require("./is-thunk") */; /* removed: var _$isHook_940 = require("./is-vhook") */; var _$VirtualNode_945 = VirtualNode var noProperties = {} var noChildren = [] function VirtualNode(tagName, properties, children, key, namespace) { this.tagName = tagName this.properties = properties || noProperties this.children = children || noChildren this.key = key != null ? String(key) : undefined this.namespace = (typeof namespace === "string") ? namespace : null var count = (children && children.length) || 0 var descendants = 0 var hasWidgets = false var hasThunks = false var descendantHooks = false var hooks for (var propName in properties) { if (properties.hasOwnProperty(propName)) { var property = properties[propName] if (_$isHook_940(property) && property.unhook) { if (!hooks) { hooks = {} } hooks[propName] = property } } } for (var i = 0; i < count; i++) { var child = children[i] if (_$isVirtualNode_941(child)) { descendants += child.count || 0 if (!hasWidgets && child.hasWidgets) { hasWidgets = true } if (!hasThunks && child.hasThunks) { hasThunks = true } if (!descendantHooks && (child.hooks || child.descendantHooks)) { descendantHooks = true } } else if (!hasWidgets && _$isWidget_943(child)) { if (typeof child.destroy === "function") { hasWidgets = true } } else if (!hasThunks && _$isThunk_939(child)) { hasThunks = true; } } this.count = count + descendants this.hasWidgets = hasWidgets this.hasThunks = hasThunks this.hooks = hooks this.descendantHooks = descendantHooks } VirtualNode.prototype.version = _$version_944 VirtualNode.prototype.type = "VirtualNode" /* removed: var _$version_944 = require("./version") */; var _$VirtualText_946 = VirtualText function VirtualText(text) { this.text = String(text) } VirtualText.prototype.version = _$version_944 VirtualText.prototype.type = "VirtualText" /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ /** * Splits a string into an array of strings using a regex or string separator. Matches of the * separator are not included in the result array. However, if `separator` is a regex that contains * capturing groups, backreferences are spliced into the result each time `separator` is matched. * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably * cross-browser. * @param {String} str String to split. * @param {RegExp|String} separator Regex or string to use for separating the string. * @param {Number} [limit] Maximum number of items to include in the result array. * @returns {Array} Array of substrings. * @example * * // Basic use * split('a b c d', ' '); * // -> ['a', 'b', 'c', 'd'] * * // With limit * split('a b c d', ' ', 2); * // -> ['a', 'b'] * * // Backreferences in result array * split('..word1 word2..', /([a-z]+)(\d+)/i); * // -> ['..', 'word', '1', ' ', 'word', '2', '..'] */ var _$browserSplit_901 = (function split(undef) { var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group self; self = function(str, separator, limit) { // If `separator` is not a regex, use `nativeSplit` if (Object.prototype.toString.call(separator) !== "[object RegExp]") { return nativeSplit.call(str, separator, limit); } var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6 (separator.sticky ? "y" : ""), // Firefox 3+ lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy separator = new RegExp(separator.source, flags + "g"), separator2, match, lastIndex, lastLength; str += ""; // Type-convert if (!compliantExecNpcg) { // Doesn't need flags gy, but they don't hurt separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); } /* Values for `limit`, per the spec: * If undefined: 4294967295 // Math.pow(2, 32) - 1 * If 0, Infinity, or NaN: 0 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; * If negative number: 4294967296 - Math.floor(Math.abs(limit)) * If other: Type-convert, then use the above rules */ limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1 limit >>> 0; // ToUint32(limit) while (match = separator.exec(str)) { // `separator.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0].length; if (lastIndex > lastLastIndex) { output.push(str.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1) { match[0].replace(separator2, function() { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undef) { match[i] = undef; } } }); } if (match.length > 1 && match.index < str.length) { Array.prototype.push.apply(output, match.slice(1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= limit) { break; } } if (separator.lastIndex === match.index) { separator.lastIndex++; // Avoid an infinite loop } } if (lastLastIndex === str.length) { if (lastLength || !separator.test("")) { output.push(""); } } else { output.push(str.slice(lastLastIndex)); } return output.length > limit ? output.slice(0, limit) : output; }; return self; })(); 'use strict'; /* removed: var _$browserSplit_901 = require('browser-split'); */; var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; var _$parseTag_938 = parseTag; function parseTag(tag, props) { if (!tag) { return 'DIV'; } var noId = !(props.hasOwnProperty('id')); var tagParts = _$browserSplit_901(tag, classIdSplit); var tagName = null; if (notClassId.test(tagParts[1])) { tagName = 'DIV'; } var classes, part, type, i; for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; if (!part) { continue; } type = part.charAt(0); if (!tagName) { tagName = part; } else if (type === '.') { classes = classes || []; classes.push(part.substring(1, part.length)); } else if (type === '#' && noId) { props.id = part.substring(1, part.length); } } if (classes) { if (props.className) { classes.push(props.className); } props.className = classes.join(' '); } return props.namespace ? tagName : tagName.toUpperCase(); } var _$Individual_919 = {}; (function (global){ 'use strict'; /*global window, global*/ var root = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; _$Individual_919 = Individual; function Individual(key, value) { if (key in root) { return root[key]; } root[key] = value; return value; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 'use strict'; /* removed: var _$Individual_919 = require('./index.js'); */; var _$OneVersion_920 = OneVersion; function OneVersion(moduleName, version, defaultValue) { var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName; var enforceKey = key + '_ENFORCE_SINGLETON'; var versionValue = _$Individual_919(enforceKey, version); if (versionValue !== version) { throw new Error('Can only have one copy of ' + moduleName + '.\n' + 'You already have version ' + versionValue + ' installed.\n' + 'This means you cannot install version ' + version); } return _$Individual_919(key, defaultValue); } 'use strict'; /* removed: var _$OneVersion_920 = require('individual/one-version'); */; var MY_VERSION = '7'; _$OneVersion_920('ev-store', MY_VERSION); var hashKey = '__EV_STORE_KEY@' + MY_VERSION; var _$EvStore_916 = EvStore; function EvStore(elem) { var hash = elem[hashKey]; if (!hash) { hash = elem[hashKey] = {}; } return hash; } 'use strict'; /* removed: var _$EvStore_916 = require('ev-store'); */; var _$EvHook_935 = EvHook; function EvHook(value) { if (!(this instanceof EvHook)) { return new EvHook(value); } this.value = value; } EvHook.prototype.hook = function (node, propertyName) { var es = _$EvStore_916(node); var propName = propertyName.substr(3); es[propName] = this.value; }; EvHook.prototype.unhook = function(node, propertyName) { var es = _$EvStore_916(node); var propName = propertyName.substr(3); es[propName] = undefined; }; 'use strict'; /* removed: var _$xIsArray_947 = require('x-is-array'); */; /* removed: var _$VirtualNode_945 = require('../vnode/vnode.js'); */; /* removed: var _$VirtualText_946 = require('../vnode/vtext.js'); */; /* removed: var _$isVirtualNode_941 = require('../vnode/is-vnode'); */; /* removed: var _$isVirtualText_942 = require('../vnode/is-vtext'); */; /* removed: var _$isWidget_943 = require('../vnode/is-widget'); */; /* removed: var _$isHook_940 = require('../vnode/is-vhook'); */; /* removed: var _$isThunk_939 = require('../vnode/is-thunk'); */; /* removed: var _$parseTag_938 = require('./parse-tag.js'); */; /* removed: var _$SoftSetHook_936 = require('./hooks/soft-set-hook.js'); */; /* removed: var _$EvHook_935 = require('./hooks/ev-hook.js'); */; var _$h_937 = __h_937; function __h_937(tagName, properties, children) { var childNodes = []; var tag, props, key, namespace; if (!children && isChildren(properties)) { children = properties; props = {}; } props = props || properties || {}; tag = _$parseTag_938(tagName, props); // support keys if (props.hasOwnProperty('key')) { key = props.key; props.key = undefined; } // support namespace if (props.hasOwnProperty('namespace')) { namespace = props.namespace; props.namespace = undefined; } // fix cursor bug if (tag === 'INPUT' && !namespace && props.hasOwnProperty('value') && props.value !== undefined && !_$isHook_940(props.value) ) { props.value = _$SoftSetHook_936(props.value); } transformProperties(props); if (children !== undefined && children !== null) { addChild(children, childNodes, tag, props); } return new _$VirtualNode_945(tag, props, childNodes, key, namespace); } function addChild(c, childNodes, tag, props) { if (typeof c === 'string') { childNodes.push(new _$VirtualText_946(c)); } else if (typeof c === 'number') { childNodes.push(new _$VirtualText_946(String(c))); } else if (isChild(c)) { childNodes.push(c); } else if (_$xIsArray_947(c)) { for (var i = 0; i < c.length; i++) { addChild(c[i], childNodes, tag, props); } } else if (c === null || c === undefined) { return; } else { throw UnexpectedVirtualElement({ foreignObject: c, parentVnode: { tagName: tag, properties: props } }); } } function transformProperties(props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { var value = props[propName]; if (_$isHook_940(value)) { continue; } if (propName.substr(0, 3) === 'ev-') { // add ev-foo support props[propName] = _$EvHook_935(value); } } } } function isChild(x) { return _$isVirtualNode_941(x) || _$isVirtualText_942(x) || _$isWidget_943(x) || _$isThunk_939(x); } function isChildren(x) { return typeof x === 'string' || _$xIsArray_947(x) || isChild(x); } function UnexpectedVirtualElement(data) { var err = new Error(); err.type = 'virtual-hyperscript.unexpected.virtual-element'; err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + 'got:\n' + errorString(data.foreignObject) + '.\n' + 'The parent vnode is:\n' + errorString(data.parentVnode) '\n' + 'Suggested fix: change your `h(..., [ ... ])` callsite.'; err.foreignObject = data.foreignObject; err.parentVnode = data.parentVnode; return err; } function errorString(obj) { try { return JSON.stringify(obj, null, ' '); } catch (e) { return String(obj); } } /* removed: var _$h_937 = require("./virtual-hyperscript/index.js") */; var _$h_933 = _$h_937 /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_331 = _$browser_913( 'annotations:render' ); var ELEMENT = 'g'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual tree */ function __render_331() { /* eslint-disable no-invalid-this */ var vtree; var props; __debug_331( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'annotations', 'className': 'annotations', 'attributes': { 'transform': 'translate(0,0)' } }; __debug_331( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); vtree = _$h_933( ELEMENT, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_331 = __render_331; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_330 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$instanceOf_75 = require( '@stdlib/assert/instance-of' ); */; // VARIABLES // var __debug_330 = _$browser_913( 'annotations:main' ); // MAIN // /** * Annotations constructor. * * @constructor * @returns {Annotations} annotations instance * * @example * var node = new Annotations(); */ function Annotations() { var self; if ( !_$instanceOf_75( this, Annotations ) ) { return new Annotations(); } self = this; __debug_330( 'Creating an instance...' ); __EventEmitter_330.call( this ); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_330( 'Received a change event.' ); self.render(); } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_330( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( Annotations, __EventEmitter_330 ); /** * Renders a virtual DOM tree. * * @name render * @memberof Annotations.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var node = new Annotations(); * * var vtree = node.render(); * // returns */ _$setNonEnumerableReadOnly_820( Annotations.prototype, 'render', _$render_331 ); // EXPORTS // var _$Annotations_330 = Annotations; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * SVG plot annotations. * * @module @stdlib/plot/components/svg/annotations * * @example * var Annotations = require( '@stdlib/plot/components/svg/annotations' ); * * var node = new Annotations(); */ // MODULES // /* removed: var _$Annotations_330 = require( './main.js' ); */; // EXPORTS // var _$Annotations_329 = _$Annotations_330; var _$defaults_432={ "width": 400, "height": 400, "id": "", "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_411 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `width`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_411( v ) { if ( !__isPositiveNumber_411( v ) ) { return new TypeError( 'invalid value. `width` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_411 = __test_411; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_450 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `width`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_450( v ) { if ( !__isPositiveNumber_450( v ) ) { return new TypeError( 'invalid value. `width` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_450 = __test_450; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_409 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `height`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_409( v ) { if ( !__isPositiveNumber_409( v ) ) { return new TypeError( 'invalid value. `height` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_409 = __test_409; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_447 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `height`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_447( v ) { if ( !__isPositiveNumber_447( v ) ) { return new TypeError( 'invalid value. `height` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_447 = __test_447; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_448 = _$isString_164.isPrimitive; // MAIN // /** * Validates `id`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_448( v ) { if ( !__isString_448( v ) ) { return new TypeError( 'invalid value. `id` must be a string. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_448 = __test_448; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_383 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_383( v ) { if ( !__isBoolean_383( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_383 = __test_383; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_446 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_446( v ) { if ( !__isBoolean_446( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_446 = __test_446; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var validators = { 'width': _$test_450, 'height': _$test_447, 'id': _$test_448, 'autoRender': _$test_446 }; // EXPORTS // var _$validators_449 = validators; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_449 = require( './validators' ); */; // VARIABLES // var KEYS = _$keys_860( _$validators_449 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {PositiveNumber} [options.width] - width * @param {PositiveNumber} [options.height] - height * @param {string} [options.id] - clipping path id * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'width': 400, * 'height': 400 * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_445( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < KEYS.length; i++ ) { key = KEYS[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_449[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_445 = __validate_445; var _$events_433={ "width": "change", "height": "change", "id": "change", "autoRender": "change" } var _$events_342={ "label": "change", "numTicks": "change", "orientation": "change", "scale": "change", "tickFormat": "change", "tickPadding": "change", "ticks": "change", "tickSize": "change", "innerTickSize": "change", "outerTickSize": "change", "autoRender": "change" } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_342 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_343( prop ) { return _$events_342[ prop ]; } // EXPORTS // var _$get_343 = __get_343; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_433 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_434( prop ) { return _$events_433[ prop ]; } // EXPORTS // var _$get_434 = __get_434; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_434 = require( './../../events' ); */; /* removed: var _$test_450 = require( './../../validators/width.js' ); */; // VARIABLES // var __debug_444 = _$browser_913( 'clippath:set:width' ); var CHANGE_EVENT = _$get_434( 'width' ); // MAIN // /** * Sets the width. * * @private * @param {PositiveNumber} width - width * @throws {TypeError} must be a positive number */ function __set_444( width ) { /* eslint-disable no-invalid-this */ var err = _$test_450( width ); if ( err ) { throw err; } __debug_444( 'Current value: %d.', this._width ); this._width = width; __debug_444( 'New value: %d.', this._width ); this.emit( CHANGE_EVENT ); } // EXPORTS // var _$set_444 = __set_444; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {number} width */ function __get_443() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_443 = __get_443; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_434 = require( './../../events' ); */; /* removed: var _$test_447 = require( './../../validators/height.js' ); */; // VARIABLES // var __debug_440 = _$browser_913( 'clippath:set:height' ); var __CHANGE_EVENT_440 = _$get_434( 'height' ); // MAIN // /** * Sets the height. * * @private * @param {PositiveNumber} height - height * @throws {TypeError} must be a positive number */ function __set_440( height ) { /* eslint-disable no-invalid-this */ var err = _$test_447( height ); if ( err ) { throw err; } __debug_440( 'Current value: %d.', this._height ); this._height = height; __debug_440( 'New Value: %d.', this._height ); this.emit( __CHANGE_EVENT_440 ); } // EXPORTS // var _$set_440 = __set_440; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the height. * * @private * @returns {number} height */ function __get_439() { /* eslint-disable no-invalid-this */ return this._height; } // EXPORTS // var _$get_439 = __get_439; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_434 = require( './../../events' ); */; /* removed: var _$test_448 = require( './../../validators/id.js' ); */; // VARIABLES // var __debug_442 = _$browser_913( 'clippath:set:id' ); var __CHANGE_EVENT_442 = _$get_434( 'id' ); // MAIN // /** * Sets the clipping path id. * * @private * @param {string} id - id * @throws {TypeError} must be a string primitive */ function __set_442( id ) { /* eslint-disable no-invalid-this */ var err = _$test_448( id ); if ( err ) { throw err; } __debug_442( 'Current value: %s.', this._id ); this._id = id; __debug_442( 'New value: %s.', this._id ); this.emit( __CHANGE_EVENT_442 ); } // EXPORTS // var _$set_442 = __set_442; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the clipping path id. * * @private * @returns {string} id */ function __get_441() { /* eslint-disable no-invalid-this */ return this._id; } // EXPORTS // var _$get_441 = __get_441; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_434 = require( './../../events' ); */; /* removed: var _$test_446 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_438 = _$browser_913( 'clip-path:set:auto-render' ); var __CHANGE_EVENT_438 = _$get_434( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_438( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_446( bool ); if ( err ) { throw err; } __debug_438( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_438( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_438 ); } // EXPORTS // var _$set_438 = __set_438; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_437() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_437 = __get_437; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_431 = _$browser_913( 'clippath:components:rect' ); var __ELEMENT_431 = 'rect'; // MAIN // /** * Renders a clipping path rectangle. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_431( ctx ) { var props = { 'namespace': 'http://www.w3.org/2000/svg', 'className': 'clipPath', 'attributes': { 'width': ctx.width, 'height': ctx.height } }; __debug_431( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_431, JSON.stringify( props ) ); return _$h_933( __ELEMENT_431, props, [] ); } // EXPORTS // var _$render_431 = __render_431; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$render_431 = require( './rect.js' ); */; // VARIABLES // var __debug_430 = _$browser_913( 'clippath:components:main' ); var __ELEMENT_430 = 'clipPath'; // MAIN // /** * Renders a clipping path. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_430( ctx ) { var children; var props; props = { 'namespace': 'http://www.w3.org/2000/svg', 'id': ctx.id }; __debug_430( 'Rendering clipping path rectangle...' ); children = [ _$render_431( ctx ) ]; __debug_430( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_430, JSON.stringify( props ) ); return _$h_933( __ELEMENT_430, props, children ); } // EXPORTS // var _$render_430 = __render_430; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$render_430 = require( './../components' ); */; // VARIABLES // var __debug_436 = _$browser_913( 'clippath:render' ); // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual tree */ function __render_436() { /* eslint-disable no-invalid-this */ var vtree; __debug_436( 'Rendering...' ); vtree = _$render_430( this ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_436 = __render_436; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_429 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$minstd_805 = require( '@stdlib/random/base/minstd' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_432 = require( './defaults.json' ); */; /* removed: var _$validate_445 = require( './validate.js' ); */; // VARIABLES // var __debug_429 = _$browser_913( 'clippath:main' ); // MAIN // /** * Clipping path constructor. * * @constructor * @param {Options} options - constructor options * @param {PositiveNumber} [options.width=400] - width * @param {PositiveNumber} [options.height=400] - height * @param {string} [options.id] - clipping path id * @param {boolean} [options.autoRender=true] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {ClipPath} clipping path instance * * @example * var clipPath = new ClipPath({ * 'width': 500, * 'height': 500 * }); */ function ClipPath( options ) { var self; var opts; var err; if ( !( this instanceof ClipPath ) ) { return new ClipPath( options ); } self = this; opts = _$copy_816( _$defaults_432 ); err = _$validate_445( opts, options ); if ( err ) { throw err; } __debug_429( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_429.call( this ); _$defineProperty_825( this, '_width', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.width }); _$defineProperty_825( this, '_height', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.height }); _$defineProperty_825( this, '_id', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.id || _$minstd_805().toString() // TODO: uuid }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_429( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_429( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ ClipPath.prototype = Object.create( __EventEmitter_429.prototype ); /* * Set the constructor. */ ClipPath.prototype.constructor = ClipPath; /** * Width. * * @name width * @memberof ClipPath.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var clipPath = new ClipPath({ * 'width': 500 * }); * * var width = clipPath.width; * // returns 500 */ _$defineProperty_825( ClipPath.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_444, 'get': _$get_443 }); /** * Height. * * @name height * @memberof ClipPath.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var clipPath = new ClipPath({ * 'height': 500 * }); * * var height = clipPath.height; * // returns 500 */ _$defineProperty_825( ClipPath.prototype, 'height', { 'configurable': false, 'enumerable': true, 'set': _$set_440, 'get': _$get_439 }); /** * Clipping path id. * * @name id * @memberof ClipPath.prototype * @type {string} * @throws {TypeError} must be a primitive string * * @example * var clipPath = new ClipPath({ * 'id': '1234' * }); * * var id = clipPath.id; * // returns '1234' */ _$defineProperty_825( ClipPath.prototype, 'id', { 'configurable': false, 'enumerable': true, 'set': _$set_442, 'get': _$get_441 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof ClipPath.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var clipPath = new ClipPath({ * 'autoRender': true * }); * * var mode = clipPath.autoRender; * // returns true */ _$defineProperty_825( ClipPath.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_438, 'get': _$get_437 }); /** * Renders a virtual DOM tree. * * @name render * @memberof ClipPath.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var clipPath = new ClipPath(); * * var out = clipPath.render(); */ _$setReadOnly_827( ClipPath.prototype, 'render', _$render_436 ); // EXPORTS // var _$ClipPath_429 = ClipPath; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Clipping path. * * @module @stdlib/plot/components/svg/clip-path * * @example * var ClipPath = require( '@stdlib/plot/components/svg/clip-path' ); * * var clipPath = new ClipPath({ * 'width': 400, * 'height': 400 * }); */ // MODULES // /* removed: var _$ClipPath_429 = require( './clippath.js' ); */; // EXPORTS // var _$ClipPath_435 = _$ClipPath_429; var _$defaults_396={ "width": 400, "height": 400, "autoRender": false } var _$defaults_413={ "width": 400, "height": 400, "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_428 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `width`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_428( v ) { if ( !__isPositiveNumber_428( v ) ) { return new TypeError( 'invalid value. `width` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_428 = __test_428; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isPositiveNumber_426 = _$isPositiveNumber_159.isPrimitive; // MAIN // /** * Validates `height`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_426( v ) { if ( !__isPositiveNumber_426( v ) ) { return new TypeError( 'invalid value. `height` must be a positive number. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_426 = __test_426; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_425 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_425( v ) { if ( !__isBoolean_425( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_425 = __test_425; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_408 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_408( v ) { if ( !__isBoolean_408( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_408 = __test_408; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_410 = { 'width': _$test_411, 'height': _$test_409, 'autoRender': _$test_408 }; // EXPORTS // var _$validators_410 = __validators_410; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_427 = { 'width': _$test_428, 'height': _$test_426, 'autoRender': _$test_425 }; // EXPORTS // var _$validators_427 = __validators_427; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_410 = require( './validators' ); */; // VARIABLES // var __KEYS_407 = _$keys_860( _$validators_410 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {PositiveNumber} [options.width] - width * @param {PositiveNumber} [options.height] - height * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'width': 400, * 'height': 400 * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_407( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_407.length; i++ ) { key = __KEYS_407[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_410[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_407 = __validate_407; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_427 = require( './validators' ); */; // VARIABLES // var __KEYS_424 = _$keys_860( _$validators_427 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {PositiveNumber} [options.width] - width * @param {PositiveNumber} [options.height] - height * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'width': 400, * 'height': 400 * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_424( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_424.length; i++ ) { key = __KEYS_424[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_427[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_424 = __validate_424; var _$events_397={ "width": "change", "height": "change", "autoRender": "change" } var _$events_414={ "width": "change", "height": "change", "autoRender": "change" } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_414 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_415( prop ) { return _$events_414[ prop ]; } // EXPORTS // var _$get_415 = __get_415; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_415 = require( './../../events' ); */; /* removed: var _$test_428 = require( './../../validators/width.js' ); */; // VARIABLES // var __debug_423 = _$browser_913( 'canvas:set:width' ); var __CHANGE_EVENT_423 = _$get_415( 'width' ); // MAIN // /** * Sets the width. * * @private * @param {PositiveNumber} width - width * @throws {TypeError} must be a positive number */ function __set_423( width ) { /* eslint-disable no-invalid-this */ var err = _$test_428( width ); if ( err ) { throw err; } __debug_423( 'Current value: %d.', this._width ); this._width = width; __debug_423( 'New value: %d.', this._width ); this.emit( __CHANGE_EVENT_423 ); } // EXPORTS // var _$set_423 = __set_423; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {number} width */ function __get_422() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_422 = __get_422; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_415 = require( './../../events' ); */; /* removed: var _$test_426 = require( './../../validators/height.js' ); */; // VARIABLES // var __debug_421 = _$browser_913( 'canvas:set:height' ); var __CHANGE_EVENT_421 = _$get_415( 'height' ); // MAIN // /** * Sets the height. * * @private * @param {PositiveNumber} height - height * @throws {TypeError} must be a positive number */ function __set_421( height ) { /* eslint-disable no-invalid-this */ var err = _$test_426( height ); if ( err ) { throw err; } __debug_421( 'Current value: %d.', this._height ); this._height = height; __debug_421( 'New Value: %d.', this._height ); this.emit( __CHANGE_EVENT_421 ); } // EXPORTS // var _$set_421 = __set_421; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the height. * * @private * @returns {number} height */ function __get_420() { /* eslint-disable no-invalid-this */ return this._height; } // EXPORTS // var _$get_420 = __get_420; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_415 = require( './../../events' ); */; /* removed: var _$test_425 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_419 = _$browser_913( 'canvas:set:auto-render' ); var __CHANGE_EVENT_419 = _$get_415( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_419( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_425( bool ); if ( err ) { throw err; } __debug_419( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_419( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_419 ); } // EXPORTS // var _$set_419 = __set_419; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_418() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_418 = __get_418; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_417 = _$browser_913( 'canvas:render' ); var __ELEMENT_417 = 'svg'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_417() { /* eslint-disable no-invalid-this */ var props; var vtree; __debug_417( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'canvas', 'className': 'canvas', 'attributes': { 'width': this.width, 'height': this.height } }; __debug_417( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_417, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_417, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_417 = __render_417; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_412 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_413 = require( './defaults.json' ); */; /* removed: var _$validate_424 = require( './validate.js' ); */; // VARIABLES // var __debug_412 = _$browser_913( 'canvas:main' ); // MAIN // /** * Canvas constructor. * * @constructor * @param {Options} options - constructor options * @param {PositiveNumber} [options.width=400] - width * @param {PositiveNumber} [options.height=400] - height * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Canvas} canvas instance * * @example * var canvas = new Canvas({ * 'width': 500, * 'height': 500 * }); */ function Canvas( options ) { var self; var opts; var err; if ( !( this instanceof Canvas ) ) { return new Canvas( options ); } self = this; opts = _$copy_816( _$defaults_413 ); err = _$validate_424( opts, options ); if ( err ) { throw err; } __debug_412( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_412.call( this ); _$defineProperty_825( this, '_width', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.width }); _$defineProperty_825( this, '_height', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.height }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_412( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_412( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Canvas.prototype = Object.create( __EventEmitter_412.prototype ); /* * Set the constructor. */ Canvas.prototype.constructor = Canvas; /** * Width. * * @name width * @memberof Canvas.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var canvas = new Canvas({ * 'width': 500 * }); * * var width = canvas.width; * // returns 500 */ _$defineProperty_825( Canvas.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_423, 'get': _$get_422 }); /** * Height. * * @name height * @memberof Canvas.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var canvas = new Canvas({ * 'height': 500 * }); * * var height = canvas.height; * // returns 500 */ _$defineProperty_825( Canvas.prototype, 'height', { 'configurable': false, 'enumerable': true, 'set': _$set_421, 'get': _$get_420 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Canvas.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var canvas = new Canvas({ * 'autoRender': true * }); * * var mode = canvas.autoRender; * // returns true */ _$defineProperty_825( Canvas.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_419, 'get': _$get_418 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Canvas.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var canvas = new Canvas({}); * * var out = canvas.render(); */ _$setReadOnly_827( Canvas.prototype, 'render', _$render_417 ); // EXPORTS // var _$Canvas_412 = Canvas; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Canvas. * * @module @stdlib/plot/components/svg/canvas * * @example * var Canvas = require( '@stdlib/plot/components/svg/canvas' ); * * var canvas = new Canvas({ * 'width': 400, * 'height': 400 * }); */ // MODULES // /* removed: var _$Canvas_412 = require( './canvas.js' ); */; // EXPORTS // var _$Canvas_416 = _$Canvas_412; var _$defaults_454={ "translateX": 0, "translateY": 0, "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_469 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `translateX`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_469( v ) { if ( !__isNonNegativeInteger_469( v ) ) { return new TypeError( 'invalid value. `translateX` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_469 = __test_469; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_470 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `translateY`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_470( v ) { if ( !__isNonNegativeInteger_470( v ) ) { return new TypeError( 'invalid value. `translateY` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_470 = __test_470; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_467 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_467( v ) { if ( !__isBoolean_467( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_467 = __test_467; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_468 = { 'translateX': _$test_469, 'translateY': _$test_470, 'autoRender': _$test_467 }; // EXPORTS // var _$validators_468 = __validators_468; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_468 = require( './validators' ); */; // VARIABLES // var __KEYS_466 = _$keys_860( _$validators_468 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {NonNegativeInteger} [options.translateX] - horizontal translation * @param {NonNegativeInteger} [options.translateY] - vertical translation * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'translateX': 90, * 'translateY': 20 * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_466( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_466.length; i++ ) { key = __KEYS_466[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_468[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_466 = __validate_466; var _$events_455={ "translateX": "change", "translateY": "change", "autoRender": "change" } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_455 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_456( prop ) { return _$events_455[ prop ]; } // EXPORTS // var _$get_456 = __get_456; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_456 = require( './../../events' ); */; /* removed: var _$test_469 = require( './../../validators/translate_x.js' ); */; // VARIABLES // var __debug_463 = _$browser_913( 'graph:set:translate-x' ); var __CHANGE_EVENT_463 = _$get_456( 'translateX' ); // MAIN // /** * Sets the horizontal translation. * * @private * @param {NonNegativeInteger} v - translation * @throws {TypeError} must be a nonnegative integer */ function __set_463( v ) { /* eslint-disable no-invalid-this */ var err = _$test_469( v ); if ( err ) { throw err; } __debug_463( 'Current value: %d.', this._translateX ); this._translateX = v; __debug_463( 'New Value: %d.', this._translateX ); this.emit( __CHANGE_EVENT_463 ); } // EXPORTS // var _$set_463 = __set_463; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the horizontal translation. * * @private * @returns {NonNegativeInteger} translation */ function __get_462() { /* eslint-disable no-invalid-this */ return this._translateX; } // EXPORTS // var _$get_462 = __get_462; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_456 = require( './../../events' ); */; /* removed: var _$test_470 = require( './../../validators/translate_y.js' ); */; // VARIABLES // var __debug_465 = _$browser_913( 'graph:set:translate-y' ); var __CHANGE_EVENT_465 = _$get_456( 'translateY' ); // MAIN // /** * Sets the vertical translation. * * @private * @param {NonNegativeInteger} v - translation * @throws {TypeError} must be a nonnegative integer */ function __set_465( v ) { /* eslint-disable no-invalid-this */ var err = _$test_470( v ); if ( err ) { throw err; } __debug_465( 'Current value: %d.', this._translateY ); this._translateY = v; __debug_465( 'New Value: %d.', this._translateY ); this.emit( __CHANGE_EVENT_465 ); } // EXPORTS // var _$set_465 = __set_465; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the vertical translation. * * @private * @returns {NonNegativeInteger} translation */ function __get_464() { /* eslint-disable no-invalid-this */ return this._translateY; } // EXPORTS // var _$get_464 = __get_464; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_456 = require( './../../events' ); */; /* removed: var _$test_467 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_461 = _$browser_913( 'canvas:set:auto-render' ); var __CHANGE_EVENT_461 = _$get_456( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_461( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_467( bool ); if ( err ) { throw err; } __debug_461( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_461( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_461 ); } // EXPORTS // var _$set_461 = __set_461; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_460() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_460 = __get_460; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_459 = _$browser_913( 'graph:render' ); var __ELEMENT_459 = 'g'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_459() { /* eslint-disable no-invalid-this */ var props; var vtree; __debug_459( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'graph', 'className': 'graph', 'attributes': { 'transform': 'translate('+this.translateX+','+this.translateY+')' } }; __debug_459( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_459, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_459, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_459 = __render_459; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_457 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_454 = require( './defaults.json' ); */; /* removed: var _$validate_466 = require( './validate.js' ); */; // VARIABLES // var __debug_457 = _$browser_913( 'graph:main' ); // MAIN // /** * Graph constructor. * * @constructor * @param {Options} options - constructor options * @param {NonNegativeInteger} [options.translateX=0] - horizontal translation * @param {NonNegativeInteger} [options.translateY=0] - vertical translation * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Graph} graph instance * * @example * var graph = new Graph({ * 'translateX': 90, * 'translateY': 20 * }); */ function Graph( options ) { var self; var opts; var err; if ( !( this instanceof Graph ) ) { return new Graph( options ); } self = this; opts = _$copy_816( _$defaults_454 ); err = _$validate_466( opts, options ); if ( err ) { throw err; } __debug_457( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_457.call( this ); _$defineProperty_825( this, '_translateX', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.translateX }); _$defineProperty_825( this, '_translateY', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.translateY }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_457( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_457( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Graph.prototype = Object.create( __EventEmitter_457.prototype ); /* * Set the constructor. */ Graph.prototype.constructor = Graph; /** * Horizontal translation. * * @name translateX * @memberof Graph.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 0 * * @example * var graph = new Graph({ * 'translateX': 90 * }); * * var v = graph.translateX; * // returns 90 */ _$defineProperty_825( Graph.prototype, 'translateX', { 'configurable': false, 'enumerable': true, 'set': _$set_463, 'get': _$get_462 }); /** * Vertical translation. * * @name translateY * @memberof Graph.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 0 * * @example * var graph = new Graph({ * 'translateY': 20 * }); * * var v = graph.translateY; * // returns 20 */ _$defineProperty_825( Graph.prototype, 'translateY', { 'configurable': false, 'enumerable': true, 'set': _$set_465, 'get': _$get_464 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Graph.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var graph = new Graph({ * 'autoRender': true * }); * * var mode = graph.autoRender; * // returns true */ _$defineProperty_825( Graph.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_461, 'get': _$get_460 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Graph.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var graph = new Graph(); * * var out = graph.render(); */ _$setReadOnly_827( Graph.prototype, 'render', _$render_459 ); // EXPORTS // var _$Graph_457 = Graph; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Graph component. * * @module @stdlib/plot/components/svg/graph * * @example * var Graph = require( '@stdlib/plot/components/svg/graph' ); * * var graph = new Graph({ * 'translateX': 90, * 'translateY': 20 * }); */ // MODULES // /* removed: var _$Graph_457 = require( './graph.js' ); */; // EXPORTS // var _$Graph_458 = _$Graph_457; var _$defaults_578={ "text": "", "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_591 = _$isString_164.isPrimitive; // MAIN // /** * Validates `text`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_591( v ) { if ( !__isString_591( v ) ) { return new TypeError( 'invalid value. `text` must be a string primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_591 = __test_591; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_589 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_589( v ) { if ( !__isBoolean_589( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_589 = __test_589; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_590 = { 'text': _$test_591, 'autoRender': _$test_589 }; // EXPORTS // var _$validators_590 = __validators_590; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_590 = require( './validators' ); */; // VARIABLES // var __KEYS_588 = _$keys_860( _$validators_590 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {string} [options.text] - title text * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'text': 'Beep' * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_588( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_588.length; i++ ) { key = __KEYS_588[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_590[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_588 = __validate_588; var _$events_579={ "text": "change", "autoRender": "change" } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_579 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_580( prop ) { return _$events_579[ prop ]; } // EXPORTS // var _$get_580 = __get_580; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_580 = require( './../../events' ); */; /* removed: var _$test_591 = require( './../../validators/text.js' ); */; // VARIABLES // var __debug_586 = _$browser_913( 'title:set:text' ); var __CHANGE_EVENT_586 = _$get_580( 'text' ); // MAIN // /** * Sets the title text. * * @private * @param {string} text - text * @throws {TypeError} must be a string primitive */ function __set_586( text ) { /* eslint-disable no-invalid-this */ var err = _$test_591( text ); if ( err ) { throw err; } __debug_586( 'Current value: %d.', this._text ); this._text = text; __debug_586( 'New Value: %d.', this._text ); this.emit( __CHANGE_EVENT_586 ); } // EXPORTS // var _$set_586 = __set_586; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the title text. * * @private * @returns {string} text */ function __get_585() { /* eslint-disable no-invalid-this */ return this._text; } // EXPORTS // var _$get_585 = __get_585; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_580 = require( './../../events' ); */; /* removed: var _$test_589 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_584 = _$browser_913( 'title:set:auto-render' ); var __CHANGE_EVENT_584 = _$get_580( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_584( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_589( bool ); if ( err ) { throw err; } __debug_584( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_584( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_584 ); } // EXPORTS // var _$set_584 = __set_584; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_583() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_583 = __get_583; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_582 = _$browser_913( 'title:render' ); var __ELEMENT_582 = 'text'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_582() { /* eslint-disable no-invalid-this */ var props; var vtree; var text; __debug_582( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'title', 'className': 'title noselect', 'attributes': { 'x': 0, 'y': 0, 'text-anchor': 'middle' } }; text = this.text; __debug_582( 'Title: %s.', text ); __debug_582( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_582, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_582, props, text ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_582 = __render_582; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_587 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_578 = require( './defaults.json' ); */; /* removed: var _$validate_588 = require( './validate.js' ); */; // VARIABLES // var __debug_587 = _$browser_913( 'title:main' ); // MAIN // /** * Title constructor. * * @constructor * @param {Options} options - constructor options * @param {string} [options.text] - title text * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Title} title instance * * @example * var title = new Title({ * 'text':'Beep' * }); */ function Title( options ) { var self; var opts; var err; if ( !( this instanceof Title ) ) { return new Title( options ); } self = this; opts = _$copy_816( _$defaults_578 ); err = _$validate_588( opts, options ); if ( err ) { throw err; } __debug_587( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_587.call( this ); _$defineProperty_825( this, '_text', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.text }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_587( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_587( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Title.prototype = Object.create( __EventEmitter_587.prototype ); /* * Set the constructor. */ Title.prototype.constructor = Title; /** * Title text. * * @name text * @memberof Title.prototype * @type {string} * @throws {TypeError} must be a primitive string * * @example * var title = new Title({ * 'text': 'Beep' * }); * * var text = title.text; * // returns 'Beep' */ _$defineProperty_825( Title.prototype, 'text', { 'configurable': false, 'enumerable': true, 'set': _$set_586, 'get': _$get_585 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Title.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var title = new Title({ * 'autoRender': true * }); * * var mode = title.autoRender; * // returns true */ _$defineProperty_825( Title.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_584, 'get': _$get_583 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Title.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var title = new Title(); * * var out = title.render(); */ _$setReadOnly_827( Title.prototype, 'render', _$render_582 ); // EXPORTS // var _$Title_587 = Title; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Title. * * @module @stdlib/plot/components/svg/title * * @example * var Title = require( '@stdlib/plot/components/svg/title' ); * * var title = new Title({ * 'text': 'Beep' * }); */ // MODULES // /* removed: var _$Title_587 = require( './title.js' ); */; // EXPORTS // var _$Title_581 = _$Title_587; var _$defaults_471={ "clipPathId": "", "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_483 = _$isString_164.isPrimitive; // MAIN // /** * Validates `clipPathId`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_483( v ) { if ( !__isString_483( v ) ) { return new TypeError( 'invalid value. `clipPathId` must be a string primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_483 = __test_483; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isBoolean_482 = _$isBoolean_86.isPrimitive; // MAIN // /** * Validates `autoRender`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_482( v ) { if ( !__isBoolean_482( v ) ) { return new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_482 = __test_482; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_484 = { 'clipPathId': _$test_483, 'autoRender': _$test_482 }; // EXPORTS // var _$validators_484 = __validators_484; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_484 = require( './validators' ); */; // VARIABLES // var __KEYS_481 = _$keys_860( _$validators_484 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {string} [options.clipPathId] - clipping path id * @param {boolean} [options.autoRender] - indicates whether to re-render on a change event * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'clipPathId': '1234' * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_481( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_481.length; i++ ) { key = __KEYS_481[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_484[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_481 = __validate_481; var _$events_472={ "clipPathId": "change", "autoRender": "change" } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_472 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_473( prop ) { return _$events_472[ prop ]; } // EXPORTS // var _$get_473 = __get_473; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_473 = require( './../../events' ); */; /* removed: var _$test_483 = require( './../../validators/clip_path_id.js' ); */; // VARIABLES // var __debug_480 = _$browser_913( 'marks:set:clip-path-id' ); var __CHANGE_EVENT_480 = _$get_473( 'clipPathId' ); // MAIN // /** * Sets the clipping path id. * * @private * @param {string} id - clipping path id * @throws {TypeError} must be a string primitive */ function __set_480( id ) { /* eslint-disable no-invalid-this */ var err = _$test_483( id ); if ( err ) { throw err; } __debug_480( 'Current value: %d.', this._clipPathId ); this._clipPathId = id; __debug_480( 'New Value: %d.', this._clipPathId ); this.emit( __CHANGE_EVENT_480 ); } // EXPORTS // var _$set_480 = __set_480; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the clipping path id. * * @private * @returns {string} id */ function __get_479() { /* eslint-disable no-invalid-this */ return this._clipPathId; } // EXPORTS // var _$get_479 = __get_479; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_473 = require( './../../events' ); */; /* removed: var _$test_482 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_478 = _$browser_913( 'marks:set:auto-render' ); var __CHANGE_EVENT_478 = _$get_473( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_478( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_482( bool ); if ( err ) { throw err; } __debug_478( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_478( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_478 ); } // EXPORTS // var _$set_478 = __set_478; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_477() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_477 = __get_477; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_476 = _$browser_913( 'marks:render' ); var __ELEMENT_476 = 'g'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_476() { /* eslint-disable no-invalid-this */ var props; var vtree; __debug_476( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'marks', 'className': 'marks', 'attributes': { 'clip-path': 'url(#'+this._clipPathId+')' } }; __debug_476( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_476, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_476, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_476 = __render_476; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_475 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_471 = require( './defaults.json' ); */; /* removed: var _$validate_481 = require( './validate.js' ); */; // VARIABLES // var __debug_475 = _$browser_913( 'marks:main' ); // MAIN // /** * Marks constructor. * * @constructor * @param {Options} options - constructor options * @param {string} [options.clipPathId] - clipping path id * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Marks} marks instance * * @example * var marks = new Marks({ * 'clipPathId': '1234' * }); */ function Marks( options ) { var self; var opts; var err; if ( !( this instanceof Marks ) ) { return new Marks( options ); } self = this; opts = _$copy_816( _$defaults_471 ); err = _$validate_481( opts, options ); if ( err ) { throw err; } __debug_475( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_475.call( this ); _$defineProperty_825( this, '_clipPathId', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.clipPathId }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_475( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_475( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Marks.prototype = Object.create( __EventEmitter_475.prototype ); /* * Set the constructor. */ Marks.prototype.constructor = Marks; /** * Clipping path id. * * @name clipPathId * @memberof Marks.prototype * @type {string} * @throws {TypeError} must be a primitive string * * @example * var marks = new Marks({ * 'clipPathId': '1234' * }); * * var id = marks.clipPathId; * // returns '1234' */ _$defineProperty_825( Marks.prototype, 'clipPathId', { 'configurable': false, 'enumerable': true, 'set': _$set_480, 'get': _$get_479 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Marks.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var marks = new Marks({ * 'autoRender': true * }); * * var mode = marks.autoRender; * // returns true */ _$defineProperty_825( Marks.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_478, 'get': _$get_477 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Marks.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var marks = new Marks(); * * var out = marks.render(); */ _$setReadOnly_827( Marks.prototype, 'render', _$render_476 ); // EXPORTS // var _$Marks_475 = Marks; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Marks. * * @module @stdlib/plot/components/svg/marks * * @example * var Marks = require( '@stdlib/plot/components/svg/marks' ); * * var marks = new Marks({ * 'clipPathId': '1234' * }); */ // MODULES // /* removed: var _$Marks_475 = require( './marks.js' ); */; // EXPORTS // var _$Marks_474 = _$Marks_475; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$events_397 = require( './events.json' ); */; // MAIN // /** * Provided a property, returns a corresponding event name for when a property value changes. * * @private * @param {string} prop - property * @returns {string} event name */ function __get_398( prop ) { return _$events_397[ prop ]; } // EXPORTS // var _$get_398 = __get_398; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_398 = require( './../../events' ); */; /* removed: var _$test_411 = require( './../../validators/width.js' ); */; // VARIABLES // var __debug_406 = _$browser_913( 'background:set:width' ); var __CHANGE_EVENT_406 = _$get_398( 'width' ); // MAIN // /** * Sets the width. * * @private * @param {PositiveNumber} width - width * @throws {TypeError} must be a positive number */ function __set_406( width ) { /* eslint-disable no-invalid-this */ var err = _$test_411( width ); if ( err ) { throw err; } __debug_406( 'Current value: %d.', this._width ); this._width = width; __debug_406( 'New value: %d.', this._width ); this.emit( __CHANGE_EVENT_406 ); } // EXPORTS // var _$set_406 = __set_406; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {number} width */ function __get_405() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_405 = __get_405; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_398 = require( './../../events' ); */; /* removed: var _$test_409 = require( './../../validators/height.js' ); */; // VARIABLES // var __debug_404 = _$browser_913( 'background:set:height' ); var __CHANGE_EVENT_404 = _$get_398( 'height' ); // MAIN // /** * Sets the height. * * @private * @param {PositiveNumber} height - height * @throws {TypeError} must be a positive number */ function __set_404( height ) { /* eslint-disable no-invalid-this */ var err = _$test_409( height ); if ( err ) { throw err; } __debug_404( 'Current value: %d.', this._height ); this._height = height; __debug_404( 'New Value: %d.', this._height ); this.emit( __CHANGE_EVENT_404 ); } // EXPORTS // var _$set_404 = __set_404; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the height. * * @private * @returns {number} height */ function __get_403() { /* eslint-disable no-invalid-this */ return this._height; } // EXPORTS // var _$get_403 = __get_403; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_398 = require( './../../events' ); */; /* removed: var _$test_408 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_402 = _$browser_913( 'background:set:auto-render' ); var __CHANGE_EVENT_402 = _$get_398( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_402( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_408( bool ); if ( err ) { throw err; } __debug_402( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_402( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_402 ); } // EXPORTS // var _$set_402 = __set_402; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_401() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_401 = __get_401; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_400 = _$browser_913( 'background:render' ); var __ELEMENT_400 = 'rect'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_400() { /* eslint-disable no-invalid-this */ var props; var vtree; __debug_400( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'className': 'background', 'attributes': { 'x': 0, 'y': 0, 'width': this.width, 'height': this.height, 'fill': 'none', 'stroke': 'none' } }; __debug_400( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_400, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_400, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_400 = __render_400; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_395 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_396 = require( './defaults.json' ); */; /* removed: var _$validate_407 = require( './validate.js' ); */; // VARIABLES // var __debug_395 = _$browser_913( 'background:main' ); // MAIN // /** * Background constructor. * * @constructor * @param {Options} options - constructor options * @param {PositiveNumber} [options.width=400] - width * @param {PositiveNumber} [options.height=400] - height * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Background} background instance * * @example * var bkgd = new Background({ * 'width': 500, * 'height': 500 * }); */ function Background( options ) { var self; var opts; var err; if ( !( this instanceof Background ) ) { return new Background( options ); } self = this; opts = _$copy_816( _$defaults_396 ); err = _$validate_407( opts, options ); if ( err ) { throw err; } __debug_395( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_395.call( this ); _$defineProperty_825( this, '_width', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.width }); _$defineProperty_825( this, '_height', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.height }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_395( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_395( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Background.prototype = Object.create( __EventEmitter_395.prototype ); /* * Set the constructor. */ Background.prototype.constructor = Background; /** * Width. * * @name width * @memberof Background.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var bkgd = new Background({ * 'width': 500 * }); * * var width = bkgd.width; * // returns 500 */ _$defineProperty_825( Background.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_406, 'get': _$get_405 }); /** * Height. * * @name height * @memberof Background.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 * * @example * var bkgd = new Background({ * 'height': 500 * }); * * var height = bkgd.height; * // returns 500 */ _$defineProperty_825( Background.prototype, 'height', { 'configurable': false, 'enumerable': true, 'set': _$set_404, 'get': _$get_403 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Background.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var bkgd = new Background({ * 'autoRender': true * }); * * var mode = bkgd.autoRender; * // returns true */ _$defineProperty_825( Background.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_402, 'get': _$get_401 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Background.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var bkgd = new Background(); * * var out = bkgd.render(); */ _$setReadOnly_827( Background.prototype, 'render', _$render_400 ); // EXPORTS // var _$Background_395 = Background; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Background. * * @module @stdlib/plot/components/svg/background * * @example * var Background = require( '@stdlib/plot/components/svg/background' ); * * var bkgd = new Background({ * 'width': 400, * 'height': 400 * }); */ // MODULES // /* removed: var _$Background_395 = require( './background.js' ); */; // EXPORTS // var _$Background_399 = _$Background_395; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_453 = _$browser_913( 'defs:render' ); var __ELEMENT_453 = 'defs'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual tree */ function __render_453() { /* eslint-disable no-invalid-this */ var vtree; var props; __debug_453( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg' }; __debug_453( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_453, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_453, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_453 = __render_453; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_452 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$instanceOf_75 = require( '@stdlib/assert/instance-of' ); */; // VARIABLES // var __debug_452 = _$browser_913( 'defs:main' ); // MAIN // /** * SVG definitions constructor. * * @constructor * @returns {Defs} definitions instance * * @example * var node = new Defs(); * // returns */ function Defs() { var self; if ( !_$instanceOf_75( this, Defs ) ) { return new Defs(); } self = this; __debug_452( 'Creating an instance...' ); __EventEmitter_452.call( this ); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_452( 'Received a change event.' ); self.render(); } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_452( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( Defs, __EventEmitter_452 ); /** * Renders a virtual DOM tree. * * @name render * @memberof Defs.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var node = new Defs(); * * var out = node.render(); * // returns */ _$setNonEnumerableReadOnly_820( Defs.prototype, 'render', _$render_453 ); // EXPORTS // var _$Defs_452 = Defs; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * SVG plot definitions. * * @module @stdlib/plot/components/svg/defs * * @example * var Defs = require( '@stdlib/plot/components/svg/defs' ); * * var node = new Defs(); * // returns */ // MODULES // /* removed: var _$Defs_452 = require( './main.js' ); */; // EXPORTS // var _$Defs_451 = _$Defs_452; var _$defaults_340={ "scale": null, "label": "", "ticks": null, "numTicks": null, "tickFormat": null, "tickSize": 6, "innerTickSize": 6, "outerTickSize": 6, "tickPadding": 3, "orientation": "bottom", "autoRender": false } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_386 = _$isString_164.isPrimitive; // MAIN // /** * Validates `label`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_386( v ) { if ( !__isString_386( v ) ) { return new TypeError( 'invalid value. `label` must be a string. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_386 = __test_386; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNonNegativeInteger_387 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `numTicks`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_387( v ) { if ( !_$isNull_140( v ) && !__isNonNegativeInteger_387( v ) ) { return new TypeError( 'invalid value. `numTicks` must be a nonnegative integer or null. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_387 = __test_387; var _$orientations_341=[ "left", "right", "top", "bottom" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_341 = require( './../etc/orientations.json' ); */; // MAIN // /** * Validates `orientation`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_388( v ) { if ( _$indexOf_843( _$orientations_341, v ) === -1 ) { return new TypeError( 'invalid value. `orientation` must be one of `[' + _$orientations_341.join(',') + ']`. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_388 = __test_388; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // MAIN // /** * Validates `scale`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_390( v ) { if ( !_$isFunction_112( v ) ) { return new TypeError( 'invalid value. `scale` must be a function. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_390 = __test_390; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isString_391 = _$isString_164.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // MAIN // /** * Validates `tickFormat`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_391( v ) { if ( !_$isNull_140( v ) && !__isString_391( v ) && !_$isFunction_112( v ) ) { return new TypeError( 'invalid value. `tickFormat` must be a string, function, or null. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_391 = __test_391; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_392 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `tickPadding`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_392( v ) { if ( !__isNonNegativeInteger_392( v ) ) { return new TypeError( 'invalid value. `tickPadding` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_392 = __test_392; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; // MAIN // /** * Validates `ticks`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_394( v ) { if ( !_$isNull_140( v ) && !_$isArray_83( v ) ) { return new TypeError( 'invalid value. `ticks` must be either null or an array. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_394 = __test_394; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_393 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `tickSize`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_393( v ) { if ( !__isNonNegativeInteger_393( v ) ) { return new TypeError( 'invalid value. `tickSize` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_393 = __test_393; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_385 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `innerTickSize`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_385( v ) { if ( !__isNonNegativeInteger_385( v ) ) { return new TypeError( 'invalid value. `innerTickSize` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_385 = __test_385; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNonNegativeInteger_389 = _$isNonNegativeInteger_136.isPrimitive; // MAIN // /** * Validates `outerTickSize`. * * @private * @param {*} v - value to test * @returns {(Error|null)} error object or null */ function __test_389( v ) { if ( !__isNonNegativeInteger_389( v ) ) { return new TypeError( 'invalid value. `outerTickSize` must be a nonnegative integer. Value: `' + v + '.`' ); } return null; } // EXPORTS // var _$test_389 = __test_389; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __validators_384 = { 'autoRender': _$test_383, 'label': _$test_386, 'numTicks': _$test_387, 'orientation': _$test_388, 'scale': _$test_390, 'tickFormat': _$test_391, 'tickPadding': _$test_392, 'ticks': _$test_394, 'tickSize': _$test_393, 'innerTickSize': _$test_385, 'outerTickSize': _$test_389 }; // EXPORTS // var _$validators_384 = __validators_384; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; /* removed: var _$validators_384 = require( './validators' ); */; // VARIABLES // var __KEYS_382 = _$keys_860( _$validators_384 ); // MAIN // /** * Validates function options. * * @private * @param {Object} opts - destination object * @param {Options} options - function options * @param {Function} [options.scale] - scale function * @param {string} [options.orientation] - axis orientation * @param {string} [options.label] - axis label * @param {(Array|null)} [options.ticks] - tick values * @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks * @param {(null|string|Function)} [options.tickFormat] - tick format * @param {NonNegativeInteger} [options.tickSize] - tick size * @param {NonNegativeInteger} [options.innerTickSize] - inner tick size * @param {NonNegativeInteger} [options.outerTickSize] - outer tick size * @param {NonNegativeInteger} [options.tickPadding] - tick padding * @returns {(Error|null)} error or null * * @example * var opts = {}; * var options = { * 'scale': function scale(){}, * 'orientation': 'left', * 'tickSize': 10 * }; * var err = validate( opts, options ); * if ( err ) { * throw err; * } */ function __validate_382( opts, options ) { var err; var key; var val; var i; if ( !_$isPlainObject_153( options ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } for ( i = 0; i < __KEYS_382.length; i++ ) { key = __KEYS_382[ i ]; if ( _$hasOwnProp_55( options, key ) ) { val = options[ key ]; err = _$validators_384[ key ]( val ); if ( err ) { return err; } opts[ key ] = val; } } return null; } // EXPORTS // var _$validate_382 = __validate_382; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_390 = require( './../../validators/scale.js' ); */; // VARIABLES // var __debug_359 = _$browser_913( 'axis:set:scale' ); var __CHANGE_EVENT_359 = _$get_343( 'scale' ); // MAIN // /** * Sets the scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_359( fcn ) { /* eslint-disable no-invalid-this */ var err = _$test_390( fcn ); if ( err ) { throw err; } __debug_359( 'Current value: %s.', this._scale ); this._scale = fcn; __debug_359( 'New Value: %s.', this._scale ); this.emit( __CHANGE_EVENT_359 ); } // EXPORTS // var _$set_359 = __set_359; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the scale function. * * @private * @returns {Function} scale function */ function __get_358() { /* eslint-disable no-invalid-this */ return this._scale; } // EXPORTS // var _$get_358 = __get_358; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_388 = require( './../../validators/orientation.js' ); */; // VARIABLES // var __debug_355 = _$browser_913( 'axis:set:orientation' ); var __CHANGE_EVENT_355 = _$get_343( 'orientation' ); // MAIN // /** * Sets the axis orientation. * * @private * @param {string} orient - axis orientation * @throws {TypeError} must be a string */ function __set_355( orient ) { /* eslint-disable no-invalid-this */ var err = _$test_388( orient ); if ( err ) { throw err; } __debug_355( 'Current value: %s.', this._orientation ); this._orientation = orient; __debug_355( 'New Value: %s.', this._orientation ); this.emit( __CHANGE_EVENT_355 ); } // EXPORTS // var _$set_355 = __set_355; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the axis orientation. * * @private * @returns {string} orientation */ function __get_354() { /* eslint-disable no-invalid-this */ return this._orientation; } // EXPORTS // var _$get_354 = __get_354; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_386 = require( './../../validators/label.js' ); */; // VARIABLES // var __debug_351 = _$browser_913( 'axis:set:xlabel' ); var __CHANGE_EVENT_351 = _$get_343( 'label' ); // MAIN // /** * Sets the axis label. * * @private * @param {string} label - axis label * @throws {TypeError} must be a string primitive */ function __set_351( label ) { /* eslint-disable no-invalid-this */ var err = _$test_386( label ); if ( err ) { throw err; } __debug_351( 'Current value: %s.', this._label ); this._label = label; __debug_351( 'New value: %s.', this._label ); this.emit( __CHANGE_EVENT_351 ); } // EXPORTS // var _$set_351 = __set_351; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the axis label. * * @private * @returns {string} label */ function __get_350() { /* eslint-disable no-invalid-this */ return this._label; } // EXPORTS // var _$get_350 = __get_350; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_394 = require( './../../validators/ticks.js' ); */; // VARIABLES // var __debug_371 = _$browser_913( 'axis:set:ticks' ); var __CHANGE_EVENT_371 = _$get_343( 'ticks' ); // MAIN // /** * Sets the axis tick values. * * @private * @param {(Array|null)} ticks - tick values * @throws {TypeError} must be an array or null */ function __set_371( ticks ) { /* eslint-disable no-invalid-this */ var err = _$test_394( ticks ); if ( err ) { throw err; } __debug_371( 'Current value: %s.', JSON.stringify( this._ticks ) ); if ( _$isNull_140( ticks ) ) { this._ticks = ticks; } else { this._ticks = ticks.slice(); } __debug_371( 'New Value: %s.', JSON.stringify( this._ticks ) ); this.emit( __CHANGE_EVENT_371 ); } // EXPORTS // var _$set_371 = __set_371; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // MAIN // /** * Returns the axis tick values. * * @private * @returns {Array} ticks */ function __get_370() { /* eslint-disable no-invalid-this */ if ( _$isNull_140( this._ticks ) ) { if ( this._scale.ticks ) { return this._scale.ticks( this._numTicks, this._tickFormat ); } return this._scale.domain(); } return this._ticks.slice(); } // EXPORTS // var _$get_370 = __get_370; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_387 = require( './../../validators/num_ticks.js' ); */; // VARIABLES // var __debug_353 = _$browser_913( 'axis:set:numticks' ); var __CHANGE_EVENT_353 = _$get_343( 'numTicks' ); // MAIN // /** * Sets the number of axis ticks. * * @private * @param {(NonNegativeInteger|null)} num - num * @throws {TypeError} must be a nonnegative integer or null */ function __set_353( num ) { /* eslint-disable no-invalid-this */ var err = _$test_387( num ); if ( err ) { throw err; } __debug_353( 'Current value: %d.', num ); this._numTicks = num; __debug_353( 'New Value: %s.', this._numTicks ); this.emit( __CHANGE_EVENT_353 ); } // EXPORTS // var _$set_353 = __set_353; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the number of axis ticks. * * @private * @returns {(NonNegativeInteger|null)} number of ticks */ function __get_352() { /* eslint-disable no-invalid-this */ return this._numTicks; } // EXPORTS // var _$get_352 = __get_352; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_391 = require( './../../validators/tick_format.js' ); */; // VARIABLES // var __debug_362 = _$browser_913( 'axis:set:tickformat' ); var __CHANGE_EVENT_362 = _$get_343( 'tickFormat' ); // MAIN // /** * Sets the axis tick format. * * @private * @param {(null|string|Function)} fmt - tick format * @throws {TypeError} must be either null, a string, or a function */ function __set_362( fmt ) { /* eslint-disable no-invalid-this */ var err = _$test_391( fmt ); if ( err ) { throw err; } __debug_362( 'Current value: %s.', this._tickFormat ); this._tickFormat = fmt; __debug_362( 'New Value: %s.', this._tickFormat ); this.emit( __CHANGE_EVENT_362 ); } // EXPORTS // var _$set_362 = __set_362; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Identity function. * * @param {*} x - input value * @returns {*} input value * * @example * var v = identity( 3.14 ); * // returns 3.14 */ function identity( x ) { return x; } // EXPORTS // var _$identity_841 = identity; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Identity function. * * @module @stdlib/utils/identity-function * * @example * var identity = require( '@stdlib/utils/identity-function' ); * * var input = []; * var output = identity( input ); * * var bool = ( input === output ); * // returns true */ // MODULES // /* removed: var _$identity_841 = require( './identity.js' ); */; // EXPORTS // var _$identity_842 = _$identity_841; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __format_361 = _$d3Format_906.format; // TODO: remove var __isString_361 = _$isString_164.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$identity_842 = require( '@stdlib/utils/identity-function' ); */; // MAIN // /** * Returns the axis tick format. * * @private * @returns {Function} format function */ function __get_361() { /* eslint-disable no-invalid-this */ if ( __isString_361( this._tickFormat ) ) { return __format_361( this._tickFormat ); } if ( _$isNull_140( this._tickFormat ) ) { if ( this._scale.tickFormat ) { return this._scale.tickFormat( this._numTicks, this._tickFormat ); } return _$identity_842; } return this._tickFormat; } // EXPORTS // var _$get_361 = __get_361; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_393 = require( './../../validators/tick_size.js' ); */; // VARIABLES // var __debug_368 = _$browser_913( 'axis:set:ticksize' ); var __CHANGE_EVENT_368 = _$get_343( 'tickSize' ); // MAIN // /** * Sets the axis tick size. * * @private * @param {NonNegativeInteger} size - size * @throws {TypeError} must be a nonnegative integer */ function __set_368( size ) { /* eslint-disable no-invalid-this */ var err = _$test_393( size ); if ( err ) { throw err; } __debug_368( 'Current value: %d.', size ); this._tickSize = size; __debug_368( 'New Value: %s.', this._tickSize ); this.emit( __CHANGE_EVENT_368 ); } // EXPORTS // var _$set_368 = __set_368; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the axis tick size. * * @private * @returns {NonNegativeInteger} tick size */ function __get_367() { /* eslint-disable no-invalid-this */ return this._tickSize; } // EXPORTS // var _$get_367 = __get_367; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_385 = require( './../../validators/inner_tick_size.js' ); */; // VARIABLES // var __debug_349 = _$browser_913( 'axis:set:ticksize-inner' ); var __CHANGE_EVENT_349 = _$get_343( 'innerTickSize' ); // MAIN // /** * Sets the inner tick size. * * @private * @param {NonNegativeInteger} size - size * @throws {TypeError} must be a nonnegative integer */ function __set_349( size ) { /* eslint-disable no-invalid-this */ var err = _$test_385( size ); if ( err ) { throw err; } __debug_349( 'Current value: %d.', size ); this._innerTickSize = size; __debug_349( 'New Value: %s.', this._innerTickSize ); this.emit( __CHANGE_EVENT_349 ); } // EXPORTS // var _$set_349 = __set_349; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the inner tick size. * * @private * @returns {NonNegativeInteger} tick size */ function __get_348() { /* eslint-disable no-invalid-this */ return this._innerTickSize; } // EXPORTS // var _$get_348 = __get_348; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_389 = require( './../../validators/outer_tick_size.js' ); */; // VARIABLES // var __debug_357 = _$browser_913( 'axis:set:ticksize-outer' ); var __CHANGE_EVENT_357 = _$get_343( 'outerTickSize' ); // MAIN // /** * Sets the axis outer tick size. * * @private * @param {NonNegativeInteger} size - size * @throws {TypeError} must be a nonnegative integer */ function __set_357( size ) { /* eslint-disable no-invalid-this */ var err = _$test_389( size ); if ( err ) { throw err; } __debug_357( 'Current value: %d.', size ); this._outerTickSize = size; __debug_357( 'New Value: %s.', this._outerTickSize ); this.emit( __CHANGE_EVENT_357 ); } // EXPORTS // var _$set_357 = __set_357; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the axis outer tick size. * * @private * @returns {NonNegativeInteger} tick size */ function __get_356() { /* eslint-disable no-invalid-this */ return this._outerTickSize; } // EXPORTS // var _$get_356 = __get_356; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_392 = require( './../../validators/tick_padding.js' ); */; // VARIABLES // var __debug_364 = _$browser_913( 'axis:set:tickpadding' ); var __CHANGE_EVENT_364 = _$get_343( 'tickPadding' ); // MAIN // /** * Sets the axis tick padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_364( padding ) { /* eslint-disable no-invalid-this */ var err = _$test_392( padding ); if ( err ) { throw err; } __debug_364( 'Current value: %d.', padding ); this._tickPadding = padding; __debug_364( 'New Value: %s.', this._tickPadding ); this.emit( __CHANGE_EVENT_364 ); } // EXPORTS // var _$set_364 = __set_364; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the axis tick padding. * * @private * @returns {NonNegativeInteger} padding */ function __get_363() { /* eslint-disable no-invalid-this */ return this._tickPadding; } // EXPORTS // var _$get_363 = __get_363; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the tick spacing. * * @private * @returns {number} tick spacing */ function __get_369() { /* eslint-disable no-invalid-this */ return this._innerTickSize + this._tickPadding; } // EXPORTS // var _$get_369 = __get_369; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the tick direction. * * @private * @returns {number} tick direction */ function __get_360() { /* eslint-disable no-invalid-this */ if ( this._orientation === 'top' || this._orientation === 'left' ) { return -1; } return 1; } // EXPORTS // var _$get_360 = __get_360; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_365 = _$browser_913( 'axis:center' ); // MAIN // /** * Returns a function to center a tick. * * @private * @returns {Function} function to center a tick */ function center() { /* eslint-disable no-invalid-this */ var width = this._scale.bandwidth() / 2; return center; /** * Returns a centered tick position. * * @private * @param {*} d - datum * @returns {number} tick position */ function center( d ) { var pos = this._scale( d ) + width; __debug_365( 'Value: %s => Coordinate: %d', d, pos ); return pos; } } // EXPORTS // var _$center_365 = center; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$center_365 = require( './center.js' ); */; // MAIN // /** * Returns a function for positioning ticks. * * @private * @returns {Function} position function */ function __get_366() { /* eslint-disable no-invalid-this */ var scale = this._scale.copy(); if ( scale.bandwidth ) { return _$center_365( scale ); } return scale; } // EXPORTS // var _$get_366 = __get_366; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$get_343 = require( './../../events' ); */; /* removed: var _$test_383 = require( './../../validators/auto_render.js' ); */; // VARIABLES // var __debug_347 = _$browser_913( 'axis:set:auto-render' ); var __CHANGE_EVENT_347 = _$get_343( 'autoRender' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_347( bool ) { /* eslint-disable no-invalid-this */ var err = _$test_383( bool ); if ( err ) { throw err; } __debug_347( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_347( 'New Value: %d.', this._autoRender ); this.emit( __CHANGE_EVENT_347 ); } // EXPORTS // var _$set_347 = __set_347; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_346() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_346 = __get_346; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the text anchor value for text positioning. * * @private * @param {string} orient - axis orientation * @returns {string} text anchor value */ function textAnchor( orient ) { if ( orient === 'left' ) { return 'end'; } if ( orient === 'right' ) { return 'start'; } return 'middle'; } // EXPORTS // var _$textAnchor_375 = textAnchor; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /* * For manually constructing SVG paths, see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d} */ // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_333 = _$browser_913( 'axis:components:domain' ); var __ELEMENT_333 = 'path'; // MAIN // /** * Renders an axis domain. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_333( ctx ) { /* eslint-disable no-underscore-dangle */ var orient; var stroke; var range0; var range1; var offset; var range; var props; var d; orient = ctx._orientation; __debug_333( 'Axis orientation: %s.', orient ); range = ctx._scale.range(); __debug_333( 'Axis range: %s.', JSON.stringify( range ) ); range0 = range[ 0 ] + 0.5; range1 = range[ range.length-1 ] + 0.5; offset = ctx.tickDir * ctx._outerTickSize; d = ''; if ( orient === 'left' || orient === 'right' ) { d += 'M' + offset + ',' + range0; d += 'H0.5'; d += 'V' + range1; d += 'H' + offset; stroke = 'none'; } else { d += 'M' + range0 + ',' + offset; d += 'V0.5'; d += 'H' + range1; d += 'V' + offset; stroke = '#aaa'; } props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'axis.domain', 'className': 'domain', 'attributes': { 'fill': 'none', 'stroke': stroke, 'stroke-width': 1, 'd': d } }; __debug_333( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_333, JSON.stringify( props ) ); return _$h_933( __ELEMENT_333, props, [] ); } // EXPORTS // var _$render_333 = __render_333; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_378 = _$browser_913( 'axis:engine:translate-x' ); // MAIN // /** * Returns a function to horizontally translate a tick. * * @private * @param {Function} scale - scale function * @returns {Function} function to translate a tick */ function translateX( scale ) { return translateX; /** * Horizontally translates a tick. * * @private * @param {*} d - datum * @returns {string} transform */ function translateX( d ) { var t = 'translate('+scale( d )+',0)'; __debug_378( 'Value: %s => Transform: %s.', d, t ); return t; } } // EXPORTS // var _$translateX_378 = translateX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_379 = _$browser_913( 'axis:engine:translate-y' ); // MAIN // /** * Returns a function to vertically translate a tick. * * @private * @param {Function} scale - scale function * @returns {Function} function to translate a tick */ function translateY( scale ) { return translateY; /** * Vertically translates a tick. * * @private * @param {*} d - datum * @returns {string} transform */ function translateY( d ) { var t = 'translate(0,'+scale( d )+')'; __debug_379( 'Value: %s => Transform: %s.', d, t ); return t; } } // EXPORTS // var _$translateY_379 = translateY; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$translateX_378 = require( './translate_x.js' ); */; /* removed: var _$translateY_379 = require( './translate_y.js' ); */; // MAIN // /** * Returns a function to translate ticks. * * @private * @param {string} orient - axis orientation * @param {Function} scale - scale function * @returns {Function} transform function */ function tickTransform( orient, scale ) { if ( orient === 'top' || orient === 'bottom' ) { return _$translateX_378( scale ); } return _$translateY_379( scale ); } // EXPORTS // var _$tickTransform_377 = tickTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the "x" attribute for tick positioning. * * @private * @param {string} orient - axis orientation * @returns {string} attribute */ function xAttr( orient ) { if ( orient === 'left' || orient === 'right' ) { return 'x'; } return 'y'; } // EXPORTS // var _$xAttr_380 = xAttr; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the "y" attribute for tick positioning. * * @private * @param {string} orient - axis orientation * @returns {string} attribute */ function yAttr( orient ) { if ( orient === 'left' || orient === 'right' ) { return 'y'; } return 'x'; } // EXPORTS // var _$yAttr_381 = yAttr; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$xAttr_380 = require( './../utils/x_attr.js' ); */; /* removed: var _$yAttr_381 = require( './../utils/y_attr.js' ); */; // VARIABLES // var __debug_336 = _$browser_913( 'axis:components:line' ); var __ELEMENT_336 = 'line'; // MAIN // /** * Renders a tick line. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_336( ctx ) { /* eslint-disable no-underscore-dangle */ var props; var x; var y; props = { 'namespace': 'http://www.w3.org/2000/svg', 'attributes': { 'stroke': '#aaa', 'stroke-width': 1 } }; x = _$xAttr_380( ctx._orientation ); y = _$yAttr_381( ctx._orientation ); props.attributes[ x+'2' ] = ctx.tickDir * ctx._innerTickSize; props.attributes[ y+'1' ] = 0.5; props.attributes[ y+'2' ] = 0.5; __debug_336( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_336, JSON.stringify( props ) ); return _$h_933( __ELEMENT_336, props, [] ); } // EXPORTS // var _$render_336 = __render_336; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns vertical shift for aligning tick text. * * @private * @param {string} orient - axis orientation * @returns {string} text shift */ function dy( orient ) { if ( orient === 'top' ) { return '0em'; } if ( orient === 'bottom' ) { return '.71em'; } return '.32em'; } // EXPORTS // var _$dy_376 = dy; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$dy_376 = require( './../utils/text_dy.js' ); */; /* removed: var _$xAttr_380 = require( './../utils/x_attr.js' ); */; /* removed: var _$yAttr_381 = require( './../utils/y_attr.js' ); */; // VARIABLES // var __debug_337 = _$browser_913( 'axis:components:text' ); var __ELEMENT_337 = 'text'; // MAIN // /** * Renders tick text. * * @private * @param {Object} ctx - context * @param {*} d - tick value * @returns {VTree} virtual tree */ function __render_337( ctx, d ) { /* eslint-disable no-underscore-dangle */ var orient; var props; var txt; var x; var y; orient = ctx._orientation; __debug_337( 'Axis orientation: %s.', orient ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'attributes': { 'fill': '#000', 'dy': _$dy_376( orient ) } }; x = _$xAttr_380( orient ); y = _$yAttr_381( orient ); props.attributes[ x ] = ctx.tickDir * ctx.tickSpacing; props.attributes[ y ] = 0.5; txt = ctx.tickFormat( d ); __debug_337( 'Tick text: %s.', txt ); __debug_337( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_337, JSON.stringify( props ) ); return _$h_933( __ELEMENT_337, props, txt ); } // EXPORTS // var _$render_337 = __render_337; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$render_336 = require( './line.js' ); */; /* removed: var _$render_337 = require( './text.js' ); */; // VARIABLES // var __debug_338 = _$browser_913( 'axis:components:tick' ); var __ELEMENT_338 = 'g'; // MAIN // /** * Renders an axis tick. * * @private * @param {Object} ctx - context * @param {*} d - tick value * @param {Function} transform - tick transform * @returns {VTree} virtual tree */ function __render_338( ctx, d, transform ) { var children; var props; props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'axis.tick', 'className': 'tick', 'attributes': { 'opacity': 1, 'transform': transform( d ) } }; children = new Array( 2 ); __debug_338( 'Rendering a tick line...' ); children[ 0 ] = _$render_336( ctx ); __debug_338( 'Rendering tick text...' ); children[ 1 ] = _$render_337( ctx, d ); __debug_338( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_338, JSON.stringify( props ) ); return _$h_933( __ELEMENT_338, props, children ); } // EXPORTS // var _$render_338 = __render_338; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$tickTransform_377 = require( './../utils/tick_transform.js' ); */; /* removed: var _$render_338 = require( './tick.js' ); */; // VARIABLES // var __debug_339 = _$browser_913( 'axis:components:ticks' ); // MAIN // /** * Renders axis ticks. * * @private * @param {Object} ctx - context * @returns {Array} array of virtual DOM trees */ function __render_339( ctx ) { /* eslint-disable no-underscore-dangle */ var transform; var values; var out; var i; values = ctx.ticks; __debug_339( 'Tick values: %s.', JSON.stringify( values ) ); __debug_339( 'Generating tick transform...' ); transform = _$tickTransform_377( ctx._orientation, ctx._scale ); __debug_339( 'Rendering ticks...' ); out = new Array( values.length ); for ( i = 0; i < values.length; i++ ) { __debug_339( 'Rendering tick %d with value %s...', i, values[i] ); out[ i ] = _$render_338( ctx, values[i], transform ); } __debug_339( 'Finished rendering ticks.' ); return out; } // EXPORTS // var _$render_339 = __render_339; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a label SVG transform. * * @private * @param {string} orient - axis orientation * @returns {string} SVG transform */ function labelTransform( orient ) { if ( orient === 'bottom' || orient === 'top' ) { return 'rotate(0)'; } if ( orient === 'left' ) { return 'rotate(-90)'; } // orient === 'right' return 'rotate(90)'; } // EXPORTS // var _$labelTransform_372 = labelTransform; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the label `x` coordinate. * * @private * @param {string} orient - axis orientation * @param {NumericArray} range - scale range * @returns {number} `x` coordinate */ function labelXPos( orient, range ) { if ( orient === 'left' || orient === 'right' ) { return -range[0] / 2; } return range[1] / 2; } // EXPORTS // var _$labelXPos_373 = labelXPos; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the label `y` coordinate. * * @private * @param {string} orient - axis orientation * @returns {number} `y` coordinate */ function labelYPos( orient ) { if ( orient === 'left' ) { return -72; } if ( orient === 'right' ) { return 72; } if ( orient === 'bottom' ) { return 45; } // orient === 'top' return -45; } // EXPORTS // var _$labelYPos_374 = labelYPos; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$labelTransform_372 = require( './../utils/label_transform.js' ); */; /* removed: var _$labelXPos_373 = require( './../utils/label_x_pos.js' ); */; /* removed: var _$labelYPos_374 = require( './../utils/label_y_pos.js' ); */; // VARIABLES // var __debug_335 = _$browser_913( 'axis:components:label' ); var __ELEMENT_335 = 'text'; // MAIN // /** * Renders an axis label. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_335( ctx ) { /* eslint-disable no-underscore-dangle */ var orient; var props; orient = ctx._orientation; __debug_335( 'Axis orientation: %s.', orient ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'axis.label', 'className': 'label noselect', 'attributes': { 'fill': '#000', 'stroke': 'none', 'text-anchor': 'middle', 'transform': _$labelTransform_372( orient ), 'x': _$labelXPos_373( orient, ctx._scale.range() ), 'y': _$labelYPos_374( orient ) } }; __debug_335( 'Axis label: %s.', ctx._label ); __debug_335( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_335, JSON.stringify( props ) ); return _$h_933( __ELEMENT_335, props, ctx._label ); } // EXPORTS // var _$render_335 = __render_335; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$textAnchor_375 = require( './../utils/text_anchor.js' ); */; /* removed: var _$render_333 = require( './domain.js' ); */; /* removed: var _$render_339 = require( './ticks.js' ); */; /* removed: var _$render_335 = require( './label.js' ); */; // VARIABLES // var __debug_334 = _$browser_913( 'axis:components:main' ); var __ELEMENT_334 = 'g'; // MAIN // /** * Renders an axis. * * @private * @param {Object} ctx - context * @returns {VTree} virtual tree */ function __render_334( ctx ) { var children; var props; props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'axis', 'className': 'axis', 'attributes': { 'fill': 'none', 'font-size': 10, // TODO: option 'font-family': 'sans-serif', // TODO: option 'text-anchor': _$textAnchor_375( ctx._orientation ) // eslint-disable-line no-underscore-dangle } }; __debug_334( 'Rendering tick marks...' ); children = _$render_339( ctx ); __debug_334( 'Rendering domain line...' ); children.unshift( _$render_333( ctx ) ); __debug_334( 'Rendering label...' ); children.push( _$render_335( ctx ) ); __debug_334( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_334, JSON.stringify( props ) ); return _$h_933( __ELEMENT_334, props, children ); } // EXPORTS // var _$render_334 = __render_334; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$render_334 = require( './../components' ); */; // VARIABLES // var __debug_345 = _$browser_913( 'axis:render' ); // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual tree */ function __render_345() { /* eslint-disable no-invalid-this */ var vtree; __debug_345( 'Rendering...' ); vtree = _$render_334( this ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_345 = __render_345; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: improve JSDoc examples // MODULES // var __EventEmitter_332 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; var __linear_332 = _$d3Scale_909.scaleLinear; // TODO: remove /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$defaults_340 = require( './defaults.json' ); */; /* removed: var _$validate_382 = require( './validate.js' ); */; // VARIABLES // var __debug_332 = _$browser_913( 'axis:main' ); // MAIN // /** * Axis constructor. * * @constructor * @param {Options} options - constructor options * @param {Function} [options.scale] - scale function * @param {string} [options.orientation='bottom'] - axis orientation * @param {string} [options.label] - axis label * @param {(Array|null)} [options.ticks] - tick values * @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks * @param {(null|string|Function)} [options.tickFormat] - tick format * @param {NonNegativeInteger} [options.tickSize=6] - tick size * @param {NonNegativeInteger} [options.innerTickSize=6] - inner tick size * @param {NonNegativeInteger} [options.outerTickSize=6] - outer tick size * @param {NonNegativeInteger} [options.tickPadding=3] - tick padding * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Axis} axis instance * * @example * var axis = new Axis({ * 'orientation': 'bottom' * }); */ function Axis( options ) { var self; var opts; var err; if ( !( this instanceof Axis ) ) { return new Axis( options ); } self = this; opts = _$copy_816( _$defaults_340 ); err = _$validate_382( opts, options ); if ( err ) { throw err; } __debug_332( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_332.call( this ); _$defineProperty_825( this, '_scale', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.scale || __linear_332() }); _$defineProperty_825( this, '_orientation', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.orientation }); _$defineProperty_825( this, '_label', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.label }); _$defineProperty_825( this, '_ticks', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.ticks }); _$defineProperty_825( this, '_numTicks', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.numTicks }); _$defineProperty_825( this, '_tickFormat', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.tickFormat }); _$defineProperty_825( this, '_tickSize', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.tickSize }); _$defineProperty_825( this, '_innerTickSize', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.innerTickSize }); _$defineProperty_825( this, '_outerTickSize', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.outerTickSize }); _$defineProperty_825( this, '_tickPadding', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.tickPadding }); _$defineProperty_825( this, '_autoRender', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': opts.autoRender }); this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_332( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_332( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Axis.prototype = Object.create( __EventEmitter_332.prototype ); /* * Set the constructor. */ Axis.prototype.constructor = Axis; /** * Scale function. * * @name scale * @memberof Axis.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var axis = new Axis({ * 'orientation': 'top' * }); * * var f = axis.scale; * // returns */ _$defineProperty_825( Axis.prototype, 'scale', { 'configurable': false, 'enumerable': true, 'set': _$set_359, 'get': _$get_358 }); /** * Axis orientation. * * @name orientation * @memberof Axis.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'bottom' * * @example * var axis = new Axis({ * 'orientation': 'bottom' * }); * axis.orientation = 'top'; * * var v = axis.orientation; * // returns 'top' */ _$defineProperty_825( Axis.prototype, 'orientation', { 'configurable': false, 'enumerable': true, 'set': _$set_355, 'get': _$get_354 }); /** * Axis label. * * @name label * @memberof Axis.prototype * @type {string} * @throws {TypeError} must be a string primitive * * @example * var axis = new Axis({ * 'label': 'y' * }); * axis.label = 'Counts'; * * var v = axis.label; * // returns 'Counts' */ _$defineProperty_825( Axis.prototype, 'label', { 'configurable': false, 'enumerable': true, 'set': _$set_351, 'get': _$get_350 }); /** * Axis tick values. When set to `null`, the retrieved values are the computed tick values. * * @name ticks * @memberof Axis.prototype * @type {(Array|null)} * @throws {TypeError} must be an array or null * @default null * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'ticks': [1,2,3] * }); * axis.ticks = ['a','b','c']; * * var v = axis.ticks; * // returns */ _$defineProperty_825( Axis.prototype, 'ticks', { 'configurable': false, 'enumerable': true, 'set': _$set_371, 'get': _$get_370 }); /** * Number of axis ticks. * * @name numTicks * @memberof Axis.prototype * @type {(NonNegativeInteger|null)} * @throws {TypeError} must be a nonnegative integer or null * @default null * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'numTicks': 10 * }); * axis.numTicks = 5; * * var v = axis.numTicks; * // returns 5 */ _$defineProperty_825( Axis.prototype, 'numTicks', { 'configurable': false, 'enumerable': true, 'set': _$set_353, 'get': _$get_352 }); /** * Tick format. When retrieved, the returned value is a formatting function. * * @name tickFormat * @memberof Axis.prototype * @type {(null|string|Function)} * @throws {TypeError} must be either null, a string, or a function * @default null * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'tickFormat': ',f' * }); * axis.tickFormat = ',.0f'; * * var v = axis.tickFormat; * // returns */ _$defineProperty_825( Axis.prototype, 'tickFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_362, 'get': _$get_361 }); /** * Axis tick size. * * @name tickSize * @memberof Axis.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 6 * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'tickSize': 12 * }); * axis.tickSize = 8; * * var v = axis.tickSize; * // returns 8 */ _$defineProperty_825( Axis.prototype, 'tickSize', { 'configurable': false, 'enumerable': true, 'set': _$set_368, 'get': _$get_367 }); /** * Axis inner tick size. * * @name innerTickSize * @memberof Axis.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 6 * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'innerTickSize': 10 * }); * axis.innerTickSize = 5; * * var v = axis.innerTickSize; * // returns 5 */ _$defineProperty_825( Axis.prototype, 'innerTickSize', { 'configurable': false, 'enumerable': true, 'set': _$set_349, 'get': _$get_348 }); /** * Axis outer tick size. * * @name outerTickSize * @memberof Axis.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 6 * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'outerTickSize': 10 * }); * axis.outerTickSize = 5; * * var v = axis.outerTickSize; * // returns 5 */ _$defineProperty_825( Axis.prototype, 'outerTickSize', { 'configurable': false, 'enumerable': true, 'set': _$set_357, 'get': _$get_356 }); /** * Axis tick padding. * * @name tickPadding * @memberof Axis.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 3 * * @example * var axis = new Axis({ * 'orientation': 'bottom', * 'tickPadding': 10 * }); * axis.tickPadding = 5; * * var v = axis.tickPadding; * // returns 5 */ _$defineProperty_825( Axis.prototype, 'tickPadding', { 'configurable': false, 'enumerable': true, 'set': _$set_364, 'get': _$get_363 }); /** * Tick spacing. * * @name tickSpacing * @memberof Axis.prototype * @type {number} * * @example * var axis = new Axis(); * var spacing = axis.tickSpacing; * // returns */ _$defineProperty_825( Axis.prototype, 'tickSpacing', { 'configurable': false, 'enumerable': true, 'get': _$get_369 }); /** * Tick direction. * * @name tickDir * @memberof Axis.prototype * @type {number} * * @example * var axis = new Axis(); * var dir = axis.tickDir; * // returns */ _$defineProperty_825( Axis.prototype, 'tickDir', { 'configurable': false, 'enumerable': true, 'get': _$get_360 }); /** * Function for computing tick positions. * * @name tickPos * @memberof Axis.prototype * @type {Function} * * @example * var axis = new Axis(); * var tickPos = axis.tickPos; * // returns */ _$defineProperty_825( Axis.prototype, 'tickPos', { 'configurable': false, 'enumerable': true, 'get': _$get_366 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Axis.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var axis = new Axis({ * 'autoRender': true * }); * * var mode = axis.autoRender; * // returns true */ _$defineProperty_825( Axis.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_347, 'get': _$get_346 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Axis.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var axis = new Axis(); * * var out = axis.render(); */ _$setReadOnly_827( Axis.prototype, 'render', _$render_345 ); // EXPORTS // var _$Axis_332 = Axis; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: remove d3-scale /** * Plot axis. * * @module @stdlib/plot/components/svg/axis * * @example * var linear = require( 'd3-scale' ).scaleLinear(); * var Axis = require( '@stdlib/plot/components/svg/axis' ); * * var axis = new Axis({ * 'scale': linear(), * 'orient': 'bottom' * }); */ // MODULES // /* removed: var _$Axis_332 = require( './axis.js' ); */; // EXPORTS // var _$Axis_344 = _$Axis_332; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isnan_485 = _$isnan_128.isPrimitive; // VARIABLES // var __debug_485 = _$browser_913( 'path:accessor:is-defined' ); // MAIN // /** * Accessor function which determines whether a datum is defined. * * @private * @param {number} d - datum * @returns {boolean} boolean indicating whether a datum is defined */ function __isDefined_485( d ) { var bool = !__isnan_485( d ); __debug_485( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); return bool; } // EXPORTS // var _$isDefined_485 = __isDefined_485; var _$defaults_486={ "autoRender": false, "color": "#000", "isDefined": null, "label": "", "opacity": 0.9, "style": "-", "width": 2, "x": [], "xScale": null, "y": [], "yScale": null } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // VARIABLES // var __debug_508 = _$browser_913( 'path:set:x' ); // MAIN // /** * Sets the `x` values. * * @private * @param {ArrayLike} x - x values * @throws {TypeError} must be array-like */ function __set_508( x ) { /* eslint-disable no-invalid-this */ if ( !_$isArrayLike_81( x ) ) { throw new TypeError( 'invalid value. `x` must be array-like. Value: `' + x + '.`' ); } __debug_508( 'Current value: %s.', JSON.stringify( this._xData ) ); this._xData = x; __debug_508( 'New Value: %s.', JSON.stringify( this._xData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_508 = __set_508; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the `x` values. * * @private * @returns {ArrayLike} x values */ function __get_507() { /* eslint-disable no-invalid-this */ return this._xData; } // EXPORTS // var _$get_507 = __get_507; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // VARIABLES // var __debug_513 = _$browser_913( 'path:set:y' ); // MAIN // /** * Sets the `y` values. * * @private * @param {ArrayLike} y - y values * @throws {TypeError} must be array-like */ function __set_513( y ) { /* eslint-disable no-invalid-this */ if ( !_$isArrayLike_81( y ) ) { throw new TypeError( 'invalid value. `y` must be array-like. Value: `' + y + '.`' ); } __debug_513( 'Current value: %s.', JSON.stringify( this._yData ) ); this._yData = y; __debug_513( 'New Value: %s.', JSON.stringify( this._yData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_513 = __set_513; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the `y` values. * * @private * @returns {ArrayLike} y values */ function __get_512() { /* eslint-disable no-invalid-this */ return this._yData; } // EXPORTS // var _$get_512 = __get_512; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_506 = _$browser_913( 'path:set:xscale' ); // MAIN // /** * Sets the x-scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_506( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `xScale` must be a function. Value: `' + fcn + '.`' ); } __debug_506( 'Current value: %s.', this._xScale ); this._xScale = fcn; __debug_506( 'New Value: %s.', this._xScale ); this.emit( 'change' ); } // EXPORTS // var _$set_506 = __set_506; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-scale function. * * @private * @returns {Function} scale function */ function __get_505() { /* eslint-disable no-invalid-this */ return this._xScale; } // EXPORTS // var _$get_505 = __get_505; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_511 = _$browser_913( 'path:set:yscale' ); // MAIN // /** * Sets the y-scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_511( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `yScale` must be a function. Value: `' + fcn + '.`' ); } __debug_511( 'Current value: %s.', this._yScale ); this._yScale = fcn; __debug_511( 'New Value: %s.', this._yScale ); this.emit( 'change' ); } // EXPORTS // var _$set_511 = __set_511; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-scale function. * * @private * @returns {Function} scale function */ function __get_510() { /* eslint-disable no-invalid-this */ return this._yScale; } // EXPORTS // var _$get_510 = __get_510; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_494 = _$browser_913( 'path:set:is-defined' ); // MAIN // /** * Sets the accessor for defined values. * * @private * @param {Function} fcn - accessor * @throws {TypeError} must be a function */ function __set_494( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `isDefined` must be a function. Value: `' + fcn + '.`' ); } __debug_494( 'Current value: %s.', this._isDefined ); this._isDefined = fcn; __debug_494( 'New Value: %s.', this._isDefined ); this.emit( 'change' ); } // EXPORTS // var _$set_494 = __set_494; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_492 = _$isString_164.isPrimitive; // VARIABLES // var __debug_492 = _$browser_913( 'path:set:color' ); // MAIN // /** * Sets the path color. * * @private * @param {string} color - color * @throws {TypeError} must be a string primitive */ function __set_492( color ) { /* eslint-disable no-invalid-this */ if ( !__isString_492( color ) ) { throw new TypeError( 'invalid value. `color` must be a string primitive. Value: `' + color + '.`' ); } __debug_492( 'Current value: %d.', this._color ); this._color = color; __debug_492( 'New Value: %d.', this._color ); this.emit( 'change' ); } // EXPORTS // var _$set_492 = __set_492; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the path color. * * @private * @returns {string} color */ function __get_491() { /* eslint-disable no-invalid-this */ return this._color; } // EXPORTS // var _$get_491 = __get_491; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_496 = _$isString_164.isPrimitive; // VARIABLES // var __debug_496 = _$browser_913( 'path:set:label' ); // MAIN // /** * Sets the path label. * * @private * @param {string} label - label * @throws {TypeError} must be a string primitive */ function __set_496( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_496( label ) ) { throw new TypeError( 'invalid value. `label` must be a string primitive. Value: `' + label + '.`' ); } __debug_496( 'Current value: %d.', this._label ); this._label = label; __debug_496( 'New Value: %d.', this._label ); this.emit( 'change' ); } // EXPORTS // var _$set_496 = __set_496; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the path label. * * @private * @returns {string} label */ function __get_495() { /* eslint-disable no-invalid-this */ return this._label; } // EXPORTS // var _$get_495 = __get_495; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_499 = _$isNumber_143.isPrimitive; // VARIABLES // var __debug_499 = _$browser_913( 'path:set:opacity' ); // MAIN // /** * Sets the opacity. * * @private * @param {number} opacity - opacity * @throws {TypeError} must be a number * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_499( opacity ) { /* eslint-disable no-invalid-this */ if ( !__isNumber_499( opacity ) ) { throw new TypeError( 'invalid value. `opacity` must be a number. Value: `' + opacity + '.`' ); } if ( opacity < 0.0 || opacity > 1.0 ) { throw new RangeError( 'invalid value. `opacity` must be a number on the interval `[0,1]`. Value: `' + opacity + '`.' ); } __debug_499( 'Current value: %d.', this._opacity ); this._opacity = opacity; __debug_499( 'New Value: %d.', this._opacity ); this.emit( 'change' ); } // EXPORTS // var _$set_499 = __set_499; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the opacity. * * @private * @returns {number} opacity */ function __get_498() { /* eslint-disable no-invalid-this */ return this._opacity; } // EXPORTS // var _$get_498 = __get_498; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_503 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_503 = _$browser_913( 'path:set:width' ); // MAIN // /** * Sets the width. * * @private * @param {NonNegativeInteger} v - width * @throws {TypeError} must be a nonnegative integer */ function __set_503( v ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_503( v ) ) { throw new TypeError( 'invalid value. `width` must be a nonnegative integer. Value: `' + v + '.`' ); } __debug_503( 'Current value: %d.', this._width ); this._width = v; __debug_503( 'New Value: %d.', this._width ); this.emit( 'change' ); } // EXPORTS // var _$set_503 = __set_503; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the width. * * @private * @returns {NonNegativeInteger} width */ function __get_502() { /* eslint-disable no-invalid-this */ return this._width; } // EXPORTS // var _$get_502 = __get_502; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_501 = _$isString_164.isPrimitive; // VARIABLES // var __debug_501 = _$browser_913( 'path:set:style' ); // MAIN // /** * Sets the path style. * * @private * @param {string} v - style * @throws {TypeError} must be a string primitive */ function __set_501( v ) { /* eslint-disable no-invalid-this */ if ( !__isString_501( v ) ) { throw new TypeError( 'invalid value. `style` must be a string primitive. Value: `' + v + '.`' ); } __debug_501( 'Current value: %d.', this._style ); this._style = v; __debug_501( 'New Value: %d.', this._style ); this.emit( 'change' ); } // EXPORTS // var _$set_501 = __set_501; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the path style. * * @private * @returns {string} style */ function __get_500() { /* eslint-disable no-invalid-this */ return this._style; } // EXPORTS // var _$get_500 = __get_500; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_490 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_490 = _$browser_913( 'path:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a positive number */ function __set_490( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_490( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } __debug_490( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_490( 'New Value: %d.', this._autoRender ); this.emit( 'change' ); } // EXPORTS // var _$set_490 = __set_490; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_489() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_489 = __get_489; var _$d3Path_908 = { exports: {} }; // https://d3js.org/d3-path/ v1.0.8 Copyright 2019 Mike Bostock (function (global, factory) { typeof _$d3Path_908.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Path_908.exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.d3 = global.d3 || {})); }(this, function (exports) { 'use strict'; var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; function Path() { this._x0 = this._y0 = // start of current subpath this._x1 = this._y1 = null; // end of current subpath this._ = ""; } function path() { return new Path; } Path.prototype = path.prototype = { constructor: Path, moveTo: function(x, y) { this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); }, closePath: function() { if (this._x1 !== null) { this._x1 = this._x0, this._y1 = this._y0; this._ += "Z"; } }, lineTo: function(x, y) { this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); }, quadraticCurveTo: function(x1, y1, x, y) { this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); }, arcTo: function(x1, y1, x2, y2, r) { x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x1,y1). if (this._x1 === null) { this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); } // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. else if (!(l01_2 > epsilon)); // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? // Equivalently, is (x1,y1) coincident with (x2,y2)? // Or, is the radius zero? Line to (x1,y1). else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) { this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); } // Otherwise, draw an arc! else { var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to. if (Math.abs(t01 - 1) > epsilon) { this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); } this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); } }, arc: function(x, y, r, a0, a1, ccw) { x = +x, y = +y, r = +r, ccw = !!ccw; var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x0,y0). if (this._x1 === null) { this._ += "M" + x0 + "," + y0; } // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) { this._ += "L" + x0 + "," + y0; } // Is this arc empty? We’re done. if (!r) return; // Does the angle go the wrong way? Flip the direction. if (da < 0) da = da % tau + tau; // Is this a complete circle? Draw two arcs to complete the circle. if (da > tauEpsilon) { this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); } // Is this arc non-empty? Draw an arc! else if (da > epsilon) { this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); } }, rect: function(x, y, w, h) { this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; }, toString: function() { return this._; } }; exports.path = path; Object.defineProperty(exports, '__esModule', { value: true }); })); _$d3Path_908 = _$d3Path_908.exports var _$d3Shape_910 = { exports: {} }; // https://d3js.org/d3-shape/ v1.3.5 Copyright 2019 Mike Bostock (function (global, factory) { typeof _$d3Shape_910.exports === 'object' && "object" !== 'undefined' ? factory(_$d3Shape_910.exports, _$d3Path_908) : typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) : (factory((global.d3 = global.d3 || {}),global.d3)); }(this, (function (exports,d3Path) { 'use strict'; function constant(x) { return function constant() { return x; }; } var abs = Math.abs; var atan2 = Math.atan2; var cos = Math.cos; var max = Math.max; var min = Math.min; var sin = Math.sin; var sqrt = Math.sqrt; var epsilon = 1e-12; var pi = Math.PI; var halfPi = pi / 2; var tau = 2 * pi; function acos(x) { return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); } function asin(x) { return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); } function arcInnerRadius(d) { return d.innerRadius; } function arcOuterRadius(d) { return d.outerRadius; } function arcStartAngle(d) { return d.startAngle; } function arcEndAngle(d) { return d.endAngle; } function arcPadAngle(d) { return d && d.padAngle; // Note: optional! } function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; if (t * t < epsilon) return; t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; return [x0 + t * x10, y0 + t * y10]; } // Compute perpendicular offset line of length rc. // http://mathworld.wolfram.com/Circle-LineIntersection.html function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; // Pick the closer of the two intersection points. // TODO Is there a faster way to determine which intersection to use? if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return { cx: cx0, cy: cy0, x01: -ox, y01: -oy, x11: cx0 * (r1 / r - 1), y11: cy0 * (r1 / r - 1) }; } function arc() { var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null; function arc() { var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0; if (!context) context = buffer = d3Path.path(); // Ensure that the outer radius is always larger than the inner radius. if (r1 < r0) r = r1, r1 = r0, r0 = r; // Is it a point? if (!(r1 > epsilon)) context.moveTo(0, 0); // Or is it a circle or annulus? else if (da > tau - epsilon) { context.moveTo(r1 * cos(a0), r1 * sin(a0)); context.arc(0, 0, r1, a0, a1, !cw); if (r0 > epsilon) { context.moveTo(r0 * cos(a1), r0 * sin(a1)); context.arc(0, 0, r0, a1, a0, cw); } } // Or is it a circular or annular sector? else { var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. if (rp > epsilon) { var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; else da0 = 0, a00 = a10 = (a0 + a1) / 2; if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; else da1 = 0, a01 = a11 = (a0 + a1) / 2; } var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); // Apply rounded corners? if (rc > epsilon) { var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc; // Restrict the corner radius according to the sector angle. if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); rc0 = min(rc, (r0 - lc) / (kc - 1)); rc1 = min(rc, (r1 - lc) / (kc + 1)); } } // Is the sector collapsed to a line? if (!(da1 > epsilon)) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners? else if (rc1 > epsilon) { t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); } } // Or is the outer ring just a circular arc? else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it’s a circular sector? // Or perhaps it’s an annular sector collapsed due to padding? if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners? else if (rc0 > epsilon) { t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); } } // Or is the inner ring just a circular arc? else context.arc(0, 0, r0, a10, a00, cw); } context.closePath(); if (buffer) return context = null, buffer + "" || null; } arc.centroid = function() { var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; return [cos(a) * r, sin(a) * r]; }; arc.innerRadius = function(_) { return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; }; arc.outerRadius = function(_) { return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; }; arc.cornerRadius = function(_) { return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; }; arc.padRadius = function(_) { return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; }; arc.startAngle = function(_) { return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; }; arc.endAngle = function(_) { return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; }; arc.padAngle = function(_) { return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; }; arc.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), arc) : context; }; return arc; } function Linear(context) { this._context = context; } Linear.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; // proceed default: this._context.lineTo(x, y); break; } } }; function curveLinear(context) { return new Linear(context); } function x(p) { return p[0]; } function y(p) { return p[1]; } function line() { var x$$1 = x, y$$1 = y, defined = constant(true), context = null, curve = curveLinear, output = null; function line(data) { var i, n = data.length, d, defined0 = false, buffer; if (context == null) output = curve(buffer = d3Path.path()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) output.lineStart(); else output.lineEnd(); } if (defined0) output.point(+x$$1(d, i, data), +y$$1(d, i, data)); } if (buffer) return output = null, buffer + "" || null; } line.x = function(_) { return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant(+_), line) : x$$1; }; line.y = function(_) { return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant(+_), line) : y$$1; }; line.defined = function(_) { return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; }; line.curve = function(_) { return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; }; line.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; }; return line; } function area() { var x0 = x, x1 = null, y0 = constant(0), y1 = y, defined = constant(true), context = null, curve = curveLinear, output = null; function area(data) { var i, j, k, n = data.length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); if (context == null) output = curve(buffer = d3Path.path()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) { j = i; output.areaStart(); output.lineStart(); } else { output.lineEnd(); output.lineStart(); for (k = i - 1; k >= j; --k) { output.point(x0z[k], y0z[k]); } output.lineEnd(); output.areaEnd(); } } if (defined0) { x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); } } if (buffer) return output = null, buffer + "" || null; } function arealine() { return line().defined(defined).curve(curve).context(context); } area.x = function(_) { return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; }; area.x0 = function(_) { return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0; }; area.x1 = function(_) { return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1; }; area.y = function(_) { return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; }; area.y0 = function(_) { return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0; }; area.y1 = function(_) { return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1; }; area.lineX0 = area.lineY0 = function() { return arealine().x(x0).y(y0); }; area.lineY1 = function() { return arealine().x(x0).y(y1); }; area.lineX1 = function() { return arealine().x(x1).y(y0); }; area.defined = function(_) { return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined; }; area.curve = function(_) { return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; }; area.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; }; return area; } function descending(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; } function identity(d) { return d; } function pie() { var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0); function pie(data) { var i, n = data.length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v; for (i = 0; i < n; ++i) { if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { sum += v; } } // Optionally sort the arcs by previously-computed values or by data. if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); }); // Compute the arcs! They are stored in the original data's order. for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { data: data[j], index: i, value: v, startAngle: a0, endAngle: a1, padAngle: p }; } return arcs; } pie.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; }; pie.sortValues = function(_) { return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; }; pie.sort = function(_) { return arguments.length ? (sort = _, sortValues = null, pie) : sort; }; pie.startAngle = function(_) { return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; }; pie.endAngle = function(_) { return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; }; pie.padAngle = function(_) { return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; }; return pie; } var curveRadialLinear = curveRadial(curveLinear); function Radial(curve) { this._curve = curve; } Radial.prototype = { areaStart: function() { this._curve.areaStart(); }, areaEnd: function() { this._curve.areaEnd(); }, lineStart: function() { this._curve.lineStart(); }, lineEnd: function() { this._curve.lineEnd(); }, point: function(a, r) { this._curve.point(r * Math.sin(a), r * -Math.cos(a)); } }; function curveRadial(curve) { function radial(context) { return new Radial(curve(context)); } radial._curve = curve; return radial; } function lineRadial(l) { var c = l.curve; l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; l.curve = function(_) { return arguments.length ? c(curveRadial(_)) : c()._curve; }; return l; } function lineRadial$1() { return lineRadial(line().curve(curveRadialLinear)); } function areaRadial() { var a = area().curve(curveRadialLinear), c = a.curve, x0 = a.lineX0, x1 = a.lineX1, y0 = a.lineY0, y1 = a.lineY1; a.angle = a.x, delete a.x; a.startAngle = a.x0, delete a.x0; a.endAngle = a.x1, delete a.x1; a.radius = a.y, delete a.y; a.innerRadius = a.y0, delete a.y0; a.outerRadius = a.y1, delete a.y1; a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0; a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1; a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0; a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1; a.curve = function(_) { return arguments.length ? c(curveRadial(_)) : c()._curve; }; return a; } function pointRadial(x, y) { return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)]; } var slice = Array.prototype.slice; function linkSource(d) { return d.source; } function linkTarget(d) { return d.target; } function link(curve) { var source = linkSource, target = linkTarget, x$$1 = x, y$$1 = y, context = null; function link() { var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv); if (!context) context = buffer = d3Path.path(); curve(context, +x$$1.apply(this, (argv[0] = s, argv)), +y$$1.apply(this, argv), +x$$1.apply(this, (argv[0] = t, argv)), +y$$1.apply(this, argv)); if (buffer) return context = null, buffer + "" || null; } link.source = function(_) { return arguments.length ? (source = _, link) : source; }; link.target = function(_) { return arguments.length ? (target = _, link) : target; }; link.x = function(_) { return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant(+_), link) : x$$1; }; link.y = function(_) { return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant(+_), link) : y$$1; }; link.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), link) : context; }; return link; } function curveHorizontal(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); } function curveVertical(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1); } function curveRadial$1(context, x0, y0, x1, y1) { var p0 = pointRadial(x0, y0), p1 = pointRadial(x0, y0 = (y0 + y1) / 2), p2 = pointRadial(x1, y0), p3 = pointRadial(x1, y1); context.moveTo(p0[0], p0[1]); context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); } function linkHorizontal() { return link(curveHorizontal); } function linkVertical() { return link(curveVertical); } function linkRadial() { var l = link(curveRadial$1); l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; return l; } var circle = { draw: function(context, size) { var r = Math.sqrt(size / pi); context.moveTo(r, 0); context.arc(0, 0, r, 0, tau); } }; var cross = { draw: function(context, size) { var r = Math.sqrt(size / 5) / 2; context.moveTo(-3 * r, -r); context.lineTo(-r, -r); context.lineTo(-r, -3 * r); context.lineTo(r, -3 * r); context.lineTo(r, -r); context.lineTo(3 * r, -r); context.lineTo(3 * r, r); context.lineTo(r, r); context.lineTo(r, 3 * r); context.lineTo(-r, 3 * r); context.lineTo(-r, r); context.lineTo(-3 * r, r); context.closePath(); } }; var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2; var diamond = { draw: function(context, size) { var y = Math.sqrt(size / tan30_2), x = y * tan30; context.moveTo(0, -y); context.lineTo(x, 0); context.lineTo(0, y); context.lineTo(-x, 0); context.closePath(); } }; var ka = 0.89081309152928522810, kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), kx = Math.sin(tau / 10) * kr, ky = -Math.cos(tau / 10) * kr; var star = { draw: function(context, size) { var r = Math.sqrt(size * ka), x = kx * r, y = ky * r; context.moveTo(0, -r); context.lineTo(x, y); for (var i = 1; i < 5; ++i) { var a = tau * i / 5, c = Math.cos(a), s = Math.sin(a); context.lineTo(s * r, -c * r); context.lineTo(c * x - s * y, s * x + c * y); } context.closePath(); } }; var square = { draw: function(context, size) { var w = Math.sqrt(size), x = -w / 2; context.rect(x, x, w, w); } }; var sqrt3 = Math.sqrt(3); var triangle = { draw: function(context, size) { var y = -Math.sqrt(size / (sqrt3 * 3)); context.moveTo(0, y * 2); context.lineTo(-sqrt3 * y, -y); context.lineTo(sqrt3 * y, -y); context.closePath(); } }; var c = -0.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3; var wye = { draw: function(context, size) { var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1; context.moveTo(x0, y0); context.lineTo(x1, y1); context.lineTo(x2, y2); context.lineTo(c * x0 - s * y0, s * x0 + c * y0); context.lineTo(c * x1 - s * y1, s * x1 + c * y1); context.lineTo(c * x2 - s * y2, s * x2 + c * y2); context.lineTo(c * x0 + s * y0, c * y0 - s * x0); context.lineTo(c * x1 + s * y1, c * y1 - s * x1); context.lineTo(c * x2 + s * y2, c * y2 - s * x2); context.closePath(); } }; var symbols = [ circle, cross, diamond, square, star, triangle, wye ]; function symbol() { var type = constant(circle), size = constant(64), context = null; function symbol() { var buffer; if (!context) context = buffer = d3Path.path(); type.apply(this, arguments).draw(context, +size.apply(this, arguments)); if (buffer) return context = null, buffer + "" || null; } symbol.type = function(_) { return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; }; symbol.size = function(_) { return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; }; symbol.context = function(_) { return arguments.length ? (context = _ == null ? null : _, symbol) : context; }; return symbol; } function noop() {} function point(that, x, y) { that._context.bezierCurveTo( (2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6 ); } function Basis(context) { this._context = context; } Basis.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 3: point(this, this._x1, this._y1); // proceed case 2: this._context.lineTo(this._x1, this._y1); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed default: point(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; function basis(context) { return new Basis(context); } function BasisClosed(context) { this._context = context; } BasisClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x2, this._y2); this._context.closePath(); break; } case 2: { this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); this._context.closePath(); break; } case 3: { this.point(this._x2, this._y2); this.point(this._x3, this._y3); this.point(this._x4, this._y4); break; } } }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._x2 = x, this._y2 = y; break; case 1: this._point = 2; this._x3 = x, this._y3 = y; break; case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; default: point(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; function basisClosed(context) { return new BasisClosed(context); } function BasisOpen(context) { this._context = context; } BasisOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; case 3: this._point = 4; // proceed default: point(this, x, y); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; } }; function basisOpen(context) { return new BasisOpen(context); } function Bundle(context, beta) { this._basis = new Basis(context); this._beta = beta; } Bundle.prototype = { lineStart: function() { this._x = []; this._y = []; this._basis.lineStart(); }, lineEnd: function() { var x = this._x, y = this._y, j = x.length - 1; if (j > 0) { var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; while (++i <= j) { t = i / j; this._basis.point( this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy) ); } } this._x = this._y = null; this._basis.lineEnd(); }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; var bundle = (function custom(beta) { function bundle(context) { return beta === 1 ? new Basis(context) : new Bundle(context, beta); } bundle.beta = function(beta) { return custom(+beta); }; return bundle; })(0.85); function point$1(that, x, y) { that._context.bezierCurveTo( that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2 ); } function Cardinal(context, tension) { this._context = context; this._k = (1 - tension) / 6; } Cardinal.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: point$1(this, this._x1, this._y1); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; this._x1 = x, this._y1 = y; break; case 2: this._point = 3; // proceed default: point$1(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var cardinal = (function custom(tension) { function cardinal(context) { return new Cardinal(context, tension); } cardinal.tension = function(tension) { return custom(+tension); }; return cardinal; })(0); function CardinalClosed(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._x3 = x, this._y3 = y; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; case 2: this._point = 3; this._x5 = x, this._y5 = y; break; default: point$1(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var cardinalClosed = (function custom(tension) { function cardinal$$1(context) { return new CardinalClosed(context, tension); } cardinal$$1.tension = function(tension) { return custom(+tension); }; return cardinal$$1; })(0); function CardinalOpen(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; // proceed default: point$1(this, x, y); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var cardinalOpen = (function custom(tension) { function cardinal$$1(context) { return new CardinalOpen(context, tension); } cardinal$$1.tension = function(tension) { return custom(+tension); }; return cardinal$$1; })(0); function point$2(that, x, y) { var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; if (that._l01_a > epsilon) { var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; } if (that._l23_a > epsilon) { var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; } that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); } function CatmullRom(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRom.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: this.point(this._x2, this._y2); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; // proceed default: point$2(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var catmullRom = (function custom(alpha) { function catmullRom(context) { return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); } catmullRom.alpha = function(alpha) { return custom(+alpha); }; return catmullRom; })(0.5); function CatmullRomClosed(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._x3 = x, this._y3 = y; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; case 2: this._point = 3; this._x5 = x, this._y5 = y; break; default: point$2(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var catmullRomClosed = (function custom(alpha) { function catmullRom$$1(context) { return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); } catmullRom$$1.alpha = function(alpha) { return custom(+alpha); }; return catmullRom$$1; })(0.5); function CatmullRomOpen(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; if (this._point) { var x23 = this._x2 - x, y23 = this._y2 - y; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; // proceed default: point$2(this, x, y); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; } }; var catmullRomOpen = (function custom(alpha) { function catmullRom$$1(context) { return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); } catmullRom$$1.alpha = function(alpha) { return custom(+alpha); }; return catmullRom$$1; })(0.5); function LinearClosed(context) { this._context = context; } LinearClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._point) this._context.closePath(); }, point: function(x, y) { x = +x, y = +y; if (this._point) this._context.lineTo(x, y); else this._point = 1, this._context.moveTo(x, y); } }; function linearClosed(context) { return new LinearClosed(context); } function sign(x) { return x < 0 ? -1 : 1; } // Calculate the slopes of the tangents (Hermite-type interpolation) based on // the following paper: Steffen, M. 1990. A Simple Method for Monotonic // Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. // NOV(II), P. 443, 1990. function slope3(that, x2, y2) { var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; } // Calculate a one-sided slope. function slope2(that, t) { var h = that._x1 - that._x0; return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; } // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations // "you can express cubic Hermite interpolation in terms of cubic Bézier curves // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". function point$3(that, t0, t1) { var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); } function MonotoneX(context) { this._context = context; } MonotoneX.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x1, this._y1); break; case 3: point$3(this, this._t0, slope2(this, this._t0)); break; } if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); this._line = 1 - this._line; }, point: function(x, y) { var t1 = NaN; x = +x, y = +y; if (x === this._x1 && y === this._y1) return; // Ignore coincident points. switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; break; case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break; default: point$3(this, this._t0, t1 = slope3(this, x, y)); break; } this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; this._t0 = t1; } }; function MonotoneY(context) { this._context = new ReflectContext(context); } (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { MonotoneX.prototype.point.call(this, y, x); }; function ReflectContext(context) { this._context = context; } ReflectContext.prototype = { moveTo: function(x, y) { this._context.moveTo(y, x); }, closePath: function() { this._context.closePath(); }, lineTo: function(x, y) { this._context.lineTo(y, x); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); } }; function monotoneX(context) { return new MonotoneX(context); } function monotoneY(context) { return new MonotoneY(context); } function Natural(context) { this._context = context; } Natural.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = []; this._y = []; }, lineEnd: function() { var x = this._x, y = this._y, n = x.length; if (n) { this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); if (n === 2) { this._context.lineTo(x[1], y[1]); } else { var px = controlPoints(x), py = controlPoints(y); for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); } } } if (this._line || (this._line !== 0 && n === 1)) this._context.closePath(); this._line = 1 - this._line; this._x = this._y = null; }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; // See https://www.particleincell.com/2012/bezier-splines/ for derivation. function controlPoints(x) { var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; a[n - 1] = r[n - 1] / b[n - 1]; for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; b[n - 1] = (x[n] + a[n - 1]) / 2; for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; return [a, b]; } function natural(context) { return new Natural(context); } function Step(context, t) { this._context = context; this._t = t; } Step.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = this._y = NaN; this._point = 0; }, lineEnd: function() { if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; }, point: function(x, y) { x = +x, y = +y; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; case 1: this._point = 2; // proceed default: { if (this._t <= 0) { this._context.lineTo(this._x, y); this._context.lineTo(x, y); } else { var x1 = this._x * (1 - this._t) + x * this._t; this._context.lineTo(x1, this._y); this._context.lineTo(x1, y); } break; } } this._x = x, this._y = y; } }; function step(context) { return new Step(context, 0.5); } function stepBefore(context) { return new Step(context, 0); } function stepAfter(context) { return new Step(context, 1); } function none(series, order) { if (!((n = series.length) > 1)) return; for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { s0 = s1, s1 = series[order[i]]; for (j = 0; j < m; ++j) { s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; } } } function none$1(series) { var n = series.length, o = new Array(n); while (--n >= 0) o[n] = n; return o; } function stackValue(d, key) { return d[key]; } function stack() { var keys = constant([]), order = none$1, offset = none, value = stackValue; function stack(data) { var kz = keys.apply(this, arguments), i, m = data.length, n = kz.length, sz = new Array(n), oz; for (i = 0; i < n; ++i) { for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { si[j] = sij = [0, +value(data[j], ki, j, data)]; sij.data = data[j]; } si.key = ki; } for (i = 0, oz = order(sz); i < n; ++i) { sz[oz[i]].index = i; } offset(sz, oz); return sz; } stack.keys = function(_) { return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys; }; stack.value = function(_) { return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value; }; stack.order = function(_) { return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order; }; stack.offset = function(_) { return arguments.length ? (offset = _ == null ? none : _, stack) : offset; }; return stack; } function expand(series, order) { if (!((n = series.length) > 0)) return; for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; } none(series, order); } function diverging(series, order) { if (!((n = series.length) > 0)) return; for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { for (yp = yn = 0, i = 0; i < n; ++i) { if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) { d[0] = yp, d[1] = yp += dy; } else if (dy < 0) { d[1] = yn, d[0] = yn += dy; } else { d[0] = yp; } } } } function silhouette(series, order) { if (!((n = series.length) > 0)) return; for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; s0[j][1] += s0[j][0] = -y / 2; } none(series, order); } function wiggle(series, order) { if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; for (var y = 0, j = 1, s0, m, n; j < m; ++j) { for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { var si = series[order[i]], sij0 = si[j][1] || 0, sij1 = si[j - 1][1] || 0, s3 = (sij0 - sij1) / 2; for (var k = 0; k < i; ++k) { var sk = series[order[k]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0; s3 += skj0 - skj1; } s1 += sij0, s2 += s3 * sij0; } s0[j - 1][1] += s0[j - 1][0] = y; if (s1) y -= s2 / s1; } s0[j - 1][1] += s0[j - 1][0] = y; none(series, order); } function appearance(series) { var peaks = series.map(peak); return none$1(series).sort(function(a, b) { return peaks[a] - peaks[b]; }); } function peak(series) { var i = -1, j = 0, n = series.length, vi, vj = -Infinity; while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i; return j; } function ascending(series) { var sums = series.map(sum); return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; }); } function sum(series) { var s = 0, i = -1, n = series.length, v; while (++i < n) if (v = +series[i][1]) s += v; return s; } function descending$1(series) { return ascending(series).reverse(); } function insideOut(series) { var n = series.length, i, j, sums = series.map(sum), order = appearance(series), top = 0, bottom = 0, tops = [], bottoms = []; for (i = 0; i < n; ++i) { j = order[i]; if (top < bottom) { top += sums[j]; tops.push(j); } else { bottom += sums[j]; bottoms.push(j); } } return bottoms.reverse().concat(tops); } function reverse(series) { return none$1(series).reverse(); } exports.arc = arc; exports.area = area; exports.line = line; exports.pie = pie; exports.areaRadial = areaRadial; exports.radialArea = areaRadial; exports.lineRadial = lineRadial$1; exports.radialLine = lineRadial$1; exports.pointRadial = pointRadial; exports.linkHorizontal = linkHorizontal; exports.linkVertical = linkVertical; exports.linkRadial = linkRadial; exports.symbol = symbol; exports.symbols = symbols; exports.symbolCircle = circle; exports.symbolCross = cross; exports.symbolDiamond = diamond; exports.symbolSquare = square; exports.symbolStar = star; exports.symbolTriangle = triangle; exports.symbolWye = wye; exports.curveBasisClosed = basisClosed; exports.curveBasisOpen = basisOpen; exports.curveBasis = basis; exports.curveBundle = bundle; exports.curveCardinalClosed = cardinalClosed; exports.curveCardinalOpen = cardinalOpen; exports.curveCardinal = cardinal; exports.curveCatmullRomClosed = catmullRomClosed; exports.curveCatmullRomOpen = catmullRomOpen; exports.curveCatmullRom = catmullRom; exports.curveLinearClosed = linearClosed; exports.curveLinear = curveLinear; exports.curveMonotoneX = monotoneX; exports.curveMonotoneY = monotoneY; exports.curveNatural = natural; exports.curveStep = step; exports.curveStepAfter = stepAfter; exports.curveStepBefore = stepBefore; exports.stack = stack; exports.stackOffsetExpand = expand; exports.stackOffsetDiverging = diverging; exports.stackOffsetNone = none; exports.stackOffsetSilhouette = silhouette; exports.stackOffsetWiggle = wiggle; exports.stackOrderAppearance = appearance; exports.stackOrderAscending = ascending; exports.stackOrderDescending = descending$1; exports.stackOrderInsideOut = insideOut; exports.stackOrderNone = none$1; exports.stackOrderReverse = reverse; Object.defineProperty(exports, '__esModule', { value: true }); }))); _$d3Shape_910 = _$d3Shape_910.exports /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __line_497 = _$d3Shape_910.line; // TODO: remove // MAIN // /** * Returns a function to generate a line as an SVG path. * * @private * @returns {Function} function to generate a line as an SVG path */ function __get_497() { /* eslint-disable no-invalid-this, stdlib/empty-line-before-comment */ var f = __line_497() .x( this.xPos ) .y( this.yPos ) .defined( this.isDefined ); // TODO: interpolate (curve factory) // TODO: tension return f; } // EXPORTS // var _$get_497 = __get_497; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_504 = _$browser_913( 'path:xpos' ); // MAIN // /** * Returns a function to map values to x coordinate values. * * @private * @returns {Function} map function */ function __get_504() { /* eslint-disable no-invalid-this */ var scale = this.xScale; return xPos; /** * Maps a value to a x coordinate value. * * @private * @param {Array} d - datum * @returns {number} pixel value */ function xPos( d ) { var px = scale( d[0] ); __debug_504( 'Value: %d => Pixel: %d.', d[0], px ); return px; } } // EXPORTS // var _$get_504 = __get_504; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_509 = _$browser_913( 'path:ypos' ); // MAIN // /** * Returns a function to map values to y coordinate values. * * @private * @returns {Function} map function */ function __get_509() { /* eslint-disable no-invalid-this */ var scale = this.yScale; return yPos; /** * Maps a value to a y coordinate value. * * @private * @param {Array} d - datum * @returns {number} pixel value */ function yPos( d ) { var px = scale( d[1] ); __debug_509( 'Value: %d => Pixel: %d.', d[1], px ); return px; } } // EXPORTS // var _$get_509 = __get_509; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Zips two arrays. * * @private * @param {ArrayLike} x - x-values * @param {ArrayLike} y - y-values * @throws {Error} must provide equal length array-like objects * @returns {Array} zipped array */ function zip( x, y ) { var out; var i; if ( x.length !== y.length ) { throw new Error( 'invalid arguments. Must provide equal length array-like objects. `x` length: '+x.length+', `y` length: '+y.length+'.' ); } out = new Array( x.length ); for ( i = 0; i < x.length; i++ ) { out[ i ] = [ x[i], y[i] ]; } return out; } // EXPORTS // var _$zip_516 = zip; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var STYLES = { // Solid path: '-': '', // Dashes: '--': '5, 1', // Dotted path: ':': '0.9', // Dash-dotted path: '-.': '5, 1, 1, 1' }; // MAIN // /** * Checks for a known style. If present, returns the [`stroke-dasharray`][1]. Otherwise, returns the provided input value. * * [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray * * @private * @param {string} v - style * @returns {string} stroke dasharray value */ function style( v ) { var s = STYLES[ v ]; if ( s ) { return s; } return v; } // EXPORTS // var _$style_515 = style; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$zip_516 = require( './utils/zip.js' ); */; /* removed: var _$style_515 = require( './utils/style.js' ); */; // VARIABLES // var __debug_514 = _$browser_913( 'path:render' ); var __ELEMENT_514 = 'path'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_514() { /* eslint-disable no-invalid-this */ var props; var vtree; __debug_514( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'line', 'className': 'path line', 'attributes': { 'd': this.line( _$zip_516( this._xData, this._yData ) ), 'fill': 'none', 'stroke': this.color, 'stroke-width': this.width, 'stroke-opacity': this.opacity, 'stroke-dasharray': _$style_515( this.style ), 'data-label': this.label } }; __debug_514( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_514, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_514, props, [] ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_514 = __render_514; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: improve JSDoc examples // MODULES // var __EventEmitter_488 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; var __linear_488 = _$d3Scale_909.scaleLinear; // TODO: remove /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$merge_870 = require( '@stdlib/utils/merge' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$isDefined_485 = require( './accessors/is_defined.js' ); */; /* removed: var _$defaults_486 = require( './defaults.json' ); */; // VARIABLES // var __debug_488 = _$browser_913( 'path:main' ); var PRIVATE_PROPS = [ '_autoRender', '_color', '_isDefined', '_label', '_opacity', '_style', '_width', '_xData', '_xScale', '_yData', '_yScale' ]; // MAIN // /** * Path constructor. * * @constructor * @param {Options} options - constructor options * @param {ArrayLike} [options.x=[]] - x-values * @param {ArrayLike} [options.y=[]] - y-values * @param {Function} [options.xScale] - x scale function * @param {Function} [options.yScale] - y scale function * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.color] - color * @param {string} [options.label] - label * @param {NonNegativeInteger} [options.width=2] - width * @param {number} [options.opacity=0.9] - opacity * @param {string} [options.style='-'] - style * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Path} Path instance * * @example * var path = new Path({ * 'x': [0.1,0.2,0.3], * 'y': [0.4,0.5,0.6] * }); */ function Path( options ) { var self; var keys; var opts; var key; var i; if ( !( this instanceof Path ) ) { if ( arguments.length ) { return new Path( options ); } return new Path(); } self = this; opts = _$copy_816( _$defaults_486 ); opts.isDefined = _$isDefined_485; opts.xScale = __linear_488(); opts.yScale = __linear_488(); if ( arguments.length ) { if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. `options` argument must be an object. Value: `' + options + '`.' ); } opts = _$merge_870( opts, options ); } __debug_488( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_488.call( this ); for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { _$defineProperty_825( this, PRIVATE_PROPS[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_488( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_488( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Path.prototype = Object.create( __EventEmitter_488.prototype ); /* * Set the constructor. */ Path.prototype.constructor = Path; /** * `x` values. * * @name x * @memberof Path.prototype * @type {ArrayLike} * @throws {TypeError} must be array-like * @default [] * * @example * var path = new Path({ * 'x': [0.1,0.2,0.3] * }); * * var x = path.x; * // returns [0.1,0.2,0.3] */ _$defineProperty_825( Path.prototype, 'x', { 'configurable': false, 'enumerable': true, 'set': _$set_508, 'get': _$get_507 }); /** * `y` values. * * @name y * @memberof Path.prototype * @type {ArrayLike} * @throws {TypeError} must be array-like * @default [] * * @example * var path = new Path({ * 'y': [0.4,0.5,0.6] * }); * * var y = path.y; * // returns [0.4,0.5,0.6] */ _$defineProperty_825( Path.prototype, 'y', { 'configurable': false, 'enumerable': true, 'set': _$set_513, 'get': _$get_512 }); /** * `x` scale function. * * @name xScale * @memberof Path.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var path = new Path({ * 'xScale': function scale(){} * }); * * var f = path.xScale; * // returns */ _$defineProperty_825( Path.prototype, 'xScale', { 'configurable': false, 'enumerable': true, 'set': _$set_506, 'get': _$get_505 }); /** * `y` scale function. * * @name yScale * @memberof Path.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var path = new Path({ * 'yScale': function scale(){} * }); * * var f = path.yScale; * // returns */ _$defineProperty_825( Path.prototype, 'yScale', { 'configurable': false, 'enumerable': true, 'set': _$set_511, 'get': _$get_510 }); /** * Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. * * @name isDefined * @memberof Path.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var Path = new Path(); * path.isDefined = function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * * @example * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * var path = new Path({ * 'isDefined': isDefined * }); * var fcn = path.isDefined; * // returns */ _$defineProperty_825( Path.prototype, 'isDefined', { 'configurable': false, 'enumerable': true, 'set': _$set_494, 'get': _$get_493 }); /** * Path color. * * @name color * @memberof Path.prototype * @type {string} * @throws {TypeError} must be a primitive string * * @example * var path = new Path({ * 'color': 'steelblue' * }); * * var color = path.color; * // returns 'steelblue' */ _$defineProperty_825( Path.prototype, 'color', { 'configurable': false, 'enumerable': true, 'set': _$set_492, 'get': _$get_491 }); /** * Path label. * * @name label * @memberof Path.prototype * @type {string} * @throws {TypeError} must be a primitive string * * @example * var path = new Path({ * 'label': 'line-1' * }); * * var label = path.label; * // returns 'line-1' */ _$defineProperty_825( Path.prototype, 'label', { 'configurable': false, 'enumerable': true, 'set': _$set_496, 'get': _$get_495 }); /** * Path opacity. * * @name opacity * @memberof Path.prototype * @type {number} * @throws {TypeError} must be a number * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.9 * * @example * var path = new Path({ * 'opacity': 0.5 * }); * * var opacity = path.opacity; * // returns 0.5 */ _$defineProperty_825( Path.prototype, 'opacity', { 'configurable': false, 'enumerable': true, 'set': _$set_499, 'get': _$get_498 }); /** * Path width. * * @name width * @memberof Path.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 2 * * @example * var path = new Path({ * 'width': 1 * }); * * var width = path.width; * // returns 1 */ _$defineProperty_825( Path.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_503, 'get': _$get_502 }); /** * Path style. * * @name style * @memberof Path.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '-' * * @example * var path = new Path({ * 'style': '-.' * }); * * var style = path.style; * // returns '-.' */ _$defineProperty_825( Path.prototype, 'style', { 'configurable': false, 'enumerable': true, 'set': _$set_501, 'get': _$get_500 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Path.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var path = new Path({ * 'autoRender': true * }); * * var mode = path.autoRender; * // returns true */ _$defineProperty_825( Path.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_490, 'get': _$get_489 }); /** * Returns a function to generate a line as an SVG path. * * @name line * @memberof Path.prototype * @type {Function} * * @example * var path = new Path(); * * var line = path.line; * // returns */ _$defineProperty_825( Path.prototype, 'line', { 'configurable': false, 'enumerable': true, 'get': _$get_497 }); /** * Function to map values to x coordinate values. * * @name xPos * @memberof Path.prototype * @type {Function} * * @example * var path = new Path(); * var xPos = path.xPos; * // returns */ _$defineProperty_825( Path.prototype, 'xPos', { 'configurable': false, 'enumerable': true, 'get': _$get_504 }); /** * Function to map values to y coordinate values. * * @name yPos * @memberof Path.prototype * @type {Function} * * @example * var path = new Path(); * var yPos = path.yPos; * // returns */ _$defineProperty_825( Path.prototype, 'yPos', { 'configurable': false, 'enumerable': true, 'get': _$get_509 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Path.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var path = new Path(); * * var out = path.render(); */ _$setReadOnly_827( Path.prototype, 'render', _$render_514 ); // EXPORTS // var _$Path_488 = Path; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * SVG path component. * * @module @stdlib/plot/components/svg/path * * @example * var Path = require( '@stdlib/plot/components/svg/path' ); * * var path = new Path({ * 'x': [0.1,0.2,0.3], * 'y': [0.4,0.5,0.6] * }); */ // MODULES // /* removed: var _$Path_488 = require( './path.js' ); */; // EXPORTS // var _$Path_487 = _$Path_488; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isnan_546 = _$isnan_128.isPrimitive; // VARIABLES // var __debug_546 = _$browser_913( 'symbols:accessor:is-defined' ); // MAIN // /** * Accessor function which determines whether a datum is defined. * * @private * @param {number} d - datum * @returns {boolean} boolean indicating whether a datum is defined */ function __isDefined_546( d ) { var bool = !__isnan_546( d ); __debug_546( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); return bool; } // EXPORTS // var _$isDefined_546 = __isDefined_546; var _$defaults_547={ "autoRender": false, "color": "#000", "isDefined": null, "label": "", "opacity": 0.9, "size": 6, "symbol": "closed-circle", "x": [], "xScale": null, "y": [], "yScale": null } var _$symbols_563=[ "closed-circle", "open-circle" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$symbols_563 = require( './symbols.json' ); */; // VARIABLES // var __debug_562 = _$browser_913( 'symbols:set:symbol' ); // MAIN // /** * Sets the symbol. * * @private * @param {string} symbol - symbol * @throws {TypeError} must be a supported symbol */ function __set_562( symbol ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$symbols_563, symbol ) === -1 ) { throw new TypeError( 'invalid value. `symbol` must be a supported symbol. Symbols: ['+_$symbols_563.join(',')+']. Value: `'+symbol+'`.' ); } __debug_562( 'Current value: %d.', this._symbol ); this._symbol = symbol; __debug_562( 'New Value: %d.', this._symbol ); this.emit( 'change' ); } // EXPORTS // var _$set_562 = __set_562; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the symbol. * * @private * @returns {string} symbol */ function __get_561() { /* eslint-disable no-invalid-this */ return this._symbol; } // EXPORTS // var _$get_561 = __get_561; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // VARIABLES // var __debug_568 = _$browser_913( 'symbols:set:x' ); // MAIN // /** * Sets the `x` values. * * @private * @param {ArrayLike} x - x values * @throws {TypeError} must be array-like */ function __set_568( x ) { /* eslint-disable no-invalid-this */ if ( !_$isArrayLike_81( x ) ) { throw new TypeError( 'invalid value. `x` must be array-like. Value: `' + x + '.`' ); } __debug_568( 'Current value: %s.', JSON.stringify( this._xData ) ); this._xData = x; __debug_568( 'New Value: %s.', JSON.stringify( this._xData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_568 = __set_568; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the `x` values. * * @private * @returns {ArrayLike} x values */ function __get_567() { /* eslint-disable no-invalid-this */ return this._xData; } // EXPORTS // var _$get_567 = __get_567; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // VARIABLES // var __debug_573 = _$browser_913( 'symbols:set:y' ); // MAIN // /** * Sets the `y` values. * * @private * @param {ArrayLike} y - y values * @throws {TypeError} must be array-like */ function __set_573( y ) { /* eslint-disable no-invalid-this */ if ( !_$isArrayLike_81( y ) ) { throw new TypeError( 'invalid value. `y` must be array-like. Value: `' + y + '.`' ); } __debug_573( 'Current value: %s.', JSON.stringify( this._yData ) ); this._yData = y; __debug_573( 'New Value: %s.', JSON.stringify( this._yData ) ); this.emit( 'change' ); } // EXPORTS // var _$set_573 = __set_573; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the `y` values. * * @private * @returns {ArrayLike} y values */ function __get_572() { /* eslint-disable no-invalid-this */ return this._yData; } // EXPORTS // var _$get_572 = __get_572; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_566 = _$browser_913( 'symbols:set:xscale' ); // MAIN // /** * Sets the x-scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_566( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `xScale` must be a function. Value: `' + fcn + '.`' ); } __debug_566( 'Current value: %s.', this._xScale ); this._xScale = fcn; __debug_566( 'New Value: %s.', this._xScale ); this.emit( 'change' ); } // EXPORTS // var _$set_566 = __set_566; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-scale function. * * @private * @returns {Function} scale function */ function __get_565() { /* eslint-disable no-invalid-this */ return this._xScale; } // EXPORTS // var _$get_565 = __get_565; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_571 = _$browser_913( 'symbols:set:yscale' ); // MAIN // /** * Sets the y-scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_571( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `yScale` must be a function. Value: `' + fcn + '.`' ); } __debug_571( 'Current value: %s.', this._yScale ); this._yScale = fcn; __debug_571( 'New Value: %s.', this._yScale ); this.emit( 'change' ); } // EXPORTS // var _$set_571 = __set_571; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-scale function. * * @private * @returns {Function} scale function */ function __get_570() { /* eslint-disable no-invalid-this */ return this._yScale; } // EXPORTS // var _$get_570 = __get_570; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_554 = _$browser_913( 'symbols:set:is-defined' ); // MAIN // /** * Sets the accessor for defined values. * * @private * @param {Function} fcn - accessor * @throws {TypeError} must be a function */ function __set_554( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `isDefined` must be a function. Value: `' + fcn + '.`' ); } __debug_554( 'Current value: %s.', this._isDefined ); this._isDefined = fcn; __debug_554( 'New Value: %s.', this._isDefined ); this.emit( 'change' ); } // EXPORTS // var _$set_554 = __set_554; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the accessor for defined values. * * @private * @returns {Function} accessor */ function __get_553() { /* eslint-disable no-invalid-this */ return this._isDefined; } // EXPORTS // var _$get_553 = __get_553; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_560 = _$isNonNegativeInteger_136.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_560 = _$browser_913( 'symbols:set:size' ); // MAIN // /** * Sets the symbol size. * * @private * @param {(NonNegativeInteger|Function)} size - size * @throws {TypeError} must be a nonnegative integer or a function */ function __set_560( size ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_560( size ) && !_$isFunction_112( size ) ) { throw new TypeError( 'invalid value. `size` must be a nonnegative integer or a function. Value: `' + size + '.`' ); } __debug_560( 'Current value: %d.', this._size ); this._size = size; __debug_560( 'New Value: %d.', this._size ); this.emit( 'change' ); } // EXPORTS // var _$set_560 = __set_560; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_559 = _$isNumber_143.isPrimitive; // MAIN // /** * Returns a function to get a symbol's size. * * @private * @returns {Function} size accessor */ function __get_559() { /* eslint-disable no-invalid-this */ var self = this; if ( __isNumber_559( this._size ) ) { return size; } return this._size; /** * Returns the size. * * @private * @returns {number} size */ function size() { return self._size; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_559 = __get_559; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_558 = _$isNumber_143.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_558 = _$browser_913( 'symbols:set:opacity' ); // MAIN // /** * Sets the symbol opacity. * * @private * @param {(number|Function)} opacity - opacity * @throws {TypeError} must be a number or a function * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_558( opacity ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_558( opacity ); if ( !isNum && !_$isFunction_112( opacity ) ) { throw new TypeError( 'invalid value. `opacity` must be a number or a function. Value: `' + opacity + '.`' ); } if ( isNum && (opacity < 0.0 || opacity > 1.0) ) { throw new RangeError( 'invalid value. `opacity` must be a number on the interval `[0,1]`. Value: `' + opacity + '`.' ); } __debug_558( 'Current value: %d.', this._opacity ); this._opacity = opacity; __debug_558( 'New Value: %d.', this._opacity ); this.emit( 'change' ); } // EXPORTS // var _$set_558 = __set_558; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_557 = _$isNumber_143.isPrimitive; // MAIN // /** * Returns a function to get a symbol's opacity. * * @private * @returns {Function} opacity accessor */ function __get_557() { /* eslint-disable no-invalid-this */ var self = this; if ( __isNumber_557( this._opacity ) ) { return opacity; } return this._opacity; /** * Returns the opacity. * * @private * @returns {number} opacity */ function opacity() { return self._opacity; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_557 = __get_557; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_552 = _$isString_164.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_552 = _$browser_913( 'symbols:set:color' ); // MAIN // /** * Sets the color. * * @private * @param {(string|Function)} color - color * @throws {TypeError} must be a string primitive or function */ function __set_552( color ) { /* eslint-disable no-invalid-this */ if ( !__isString_552( color ) && !_$isFunction_112( color ) ) { throw new TypeError( 'invalid value. `color` must be a string primitive or a function. Value: `' + color + '.`' ); } __debug_552( 'Current value: %d.', this._color ); this._color = color; __debug_552( 'New Value: %d.', this._color ); this.emit( 'change' ); } // EXPORTS // var _$set_552 = __set_552; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_551 = _$isString_164.isPrimitive; // MAIN // /** * Returns a function to get a symbol's color. * * @private * @returns {Function} color accessor */ function __get_551() { /* eslint-disable no-invalid-this */ var self = this; if ( __isString_551( this._color ) ) { return color; } return this._color; /** * Returns the color. * * @private * @returns {string} color */ function color() { return self._color; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_551 = __get_551; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_556 = _$isString_164.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_556 = _$browser_913( 'symbols:set:label' ); // MAIN // /** * Sets the label. * * @private * @param {(string|Function)} label - label * @throws {TypeError} must be a string primitive or a function */ function __set_556( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_556( label ) && !_$isFunction_112( label ) ) { throw new TypeError( 'invalid value. `label` must be a string primitive or a function. Value: `' + label + '.`' ); } __debug_556( 'Current value: %d.', this._label ); this._label = label; __debug_556( 'New Value: %d.', this._label ); this.emit( 'change' ); } // EXPORTS // var _$set_556 = __set_556; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_555 = _$isString_164.isPrimitive; // MAIN // /** * Returns a function to get a symbol's label. * * @private * @returns {Function} label accessor */ function __get_555() { /* eslint-disable no-invalid-this */ var self = this; if ( __isString_555( this._label ) ) { return label; } return this._label; /** * Returns the label. * * @private * @returns {string} label */ function label() { return self._label; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_555 = __get_555; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_550 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_550 = _$browser_913( 'symbols:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a boolean primitive */ function __set_550( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_550( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } __debug_550( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_550( 'New Value: %d.', this._autoRender ); this.emit( 'change' ); } // EXPORTS // var _$set_550 = __set_550; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_549() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_549 = __get_549; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_564 = _$browser_913( 'symbols:xpos' ); // MAIN // /** * Returns a function to map values to x coordinate values. * * @private * @returns {Function} map function */ function __get_564() { /* eslint-disable no-invalid-this */ var scale = this.xScale; return xPos; /** * Maps a value to a x coordinate value. * * @private * @param {*} d - datum * @returns {number} pixel value */ function xPos( d ) { var px = scale( d ); __debug_564( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_564 = __get_564; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_569 = _$browser_913( 'symbols:ypos' ); // MAIN // /** * Returns a function to map values to y coordinate values. * * @private * @returns {Function} map function */ function __get_569() { /* eslint-disable no-invalid-this */ var scale = this.yScale; return yPos; /** * Maps a value to a y coordinate value. * * @private * @param {*} d - datum * @returns {number} pixel value */ function yPos( d ) { var px = scale( d ); __debug_569( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_569 = __get_569; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_574 = _$browser_913( 'symbols:render:closed-circles' ); var __ELEMENT_574 = 'circle'; // MAIN // /** * Renders data as a closed circles. * * @private * @param {Object} state - state * @returns {Array} array of virtual trees */ function __render_574( state ) { var isDefined; var opacity; var label; var color; var props; var size; var xPos; var yPos; var out; var xi; var yi; var x; var y; var i; __debug_574( 'Rendering closed circles...' ); isDefined = state.isDefined; opacity = state.opacity; label = state.label; color = state.color; size = state.size; xPos = state.xPos; yPos = state.yPos; x = state.x; y = state.y; out = new Array( x.length ); for ( i = 0; i < x.length; i++ ) { xi = x[ i ]; yi = y[ i ]; if ( !isDefined( xi ) || !isDefined( yi ) ) { __debug_574( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); continue; } __debug_574( 'Rendering datum %d...', i ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'closed-circle', 'className': 'closed-circle', 'attributes': { 'cx': xPos( xi ), 'cy': yPos( yi ), 'r': size( xi, yi, i ) / 2, 'stroke': 'none', 'opacity': opacity( xi, yi, i ), 'fill': color( xi, yi, i ), 'data-label': label( xi, yi, i ) } }; __debug_574( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_574, JSON.stringify( props ) ); out[ i ] = _$h_933( __ELEMENT_574, props, [] ); } return out; } // EXPORTS // var _$render_574 = __render_574; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; // VARIABLES // var __debug_576 = _$browser_913( 'symbols:render:open-circles' ); var __ELEMENT_576 = 'circle'; // MAIN // /** * Renders data as a open circles. * * @private * @param {Object} state - state * @returns {Array} array of virtual trees */ function __render_576( state ) { var isDefined; var opacity; var label; var color; var props; var size; var xPos; var yPos; var out; var xi; var yi; var x; var y; var i; __debug_576( 'Rendering open circles...' ); isDefined = state.isDefined; opacity = state.opacity; label = state.label; color = state.color; size = state.size; xPos = state.xPos; yPos = state.yPos; x = state.x; y = state.y; out = new Array( x.length ); for ( i = 0; i < x.length; i++ ) { xi = x[ i ]; yi = y[ i ]; if ( !isDefined( xi ) || !isDefined( yi ) ) { __debug_576( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); continue; } __debug_576( 'Rendering datum %d...', i ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'open-circle', 'className': 'open-circle', 'attributes': { 'cx': xPos( xi ), 'cy': yPos( yi ), 'r': size( xi, yi, i ) / 2, 'fill': 'none', 'opacity': opacity( xi, yi, i ), 'stroke': color( xi, yi, i ), 'stroke-width': 1, // TODO: make property? I certainly don't see a good reason or use case why this should be a function. 'data-label': label( xi, yi, i ) } }; __debug_576( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_576, JSON.stringify( props ) ); out[ i ] = _$h_933( __ELEMENT_576, props, [] ); } return out; } // EXPORTS // var _$render_576 = __render_576; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$render_574 = require( './closed_circles.js' ); */; /* removed: var _$render_576 = require( './open_circles.js' ); */; // VARIABLES // var __debug_575 = _$browser_913( 'symbols:render' ); var __ELEMENT_575 = 'g'; var RENDER = { 'closed-circle': _$render_574, 'open-circle': _$render_576 }; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual DOM tree */ function __render_575() { /* eslint-disable no-invalid-this */ var children; var props; var vtree; var f; __debug_575( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'symbols', 'className': 'symbols' }; __debug_575( 'Symbol: %s.', this.symbol ); f = RENDER[ this.symbol ]; children = f( this ); __debug_575( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_575, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_575, props, children ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_575 = __render_575; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: improve JSDoc examples // MODULES // var __EventEmitter_577 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; var __linear_577 = _$d3Scale_909.scaleLinear; // TODO: remove /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$merge_870 = require( '@stdlib/utils/merge' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$isDefined_546 = require( './accessors/is_defined.js' ); */; /* removed: var _$defaults_547 = require( './defaults.json' ); */; // VARIABLES // var __debug_577 = _$browser_913( 'symbols:main' ); var __PRIVATE_PROPS_577 = [ '_autoRender', '_color', '_isDefined', '_label', '_opacity', '_size', '_symbol', '_xData', '_xScale', '_yData', '_yScale' ]; // MAIN // /** * Symbols constructor. * * @constructor * @param {Options} options - constructor options * @param {ArrayLike} [options.x=[]] - x-values * @param {ArrayLike} [options.y=[]] - y-values * @param {Function} [options.xScale] - x scale function * @param {Function} [options.yScale] - y scale function * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.symbol='closed-circle'] - symbol * @param {(number|Function)} [options.opacity=0.9] - opacity * @param {(string|Function)} [options.color] - color * @param {(string|Function)} [options.label] - label * @param {(NonNegativeInteger|Function)} [options.size=6] - symbol size * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @throws {TypeError} must provide valid options * @returns {Symbols} Symbols instance * * @example * var symbols = new Symbols({ * 'x': [0.1,0.2,0.3], * 'y': [0.4,0.5,0.6] * }); */ function Symbols( options ) { var self; var keys; var opts; var key; var i; if ( !( this instanceof Symbols ) ) { if ( arguments.length ) { return new Symbols( options ); } return new Symbols(); } self = this; opts = _$copy_816( _$defaults_547 ); opts.isDefined = _$isDefined_546; opts.xScale = __linear_577(); opts.yScale = __linear_577(); if ( arguments.length ) { if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. `options` argument must be an object. Value: `' + options + '`.' ); } opts = _$merge_870( opts, options ); } __debug_577( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_577.call( this ); for ( i = 0; i < __PRIVATE_PROPS_577.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_577[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_577( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_577( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Create a prototype which inherits from the parent prototype. */ Symbols.prototype = Object.create( __EventEmitter_577.prototype ); /* * Set the constructor. */ Symbols.prototype.constructor = Symbols; /** * Symbol. * * @name symbol * @memberof Symbols.prototype * @type {string} * @throws {TypeError} must be a supported symbol * @default 'closed-circle' * * @example * var symbols = new Symbols({ * 'symbol': 'open-circle' * }); * * var symbol = symbols.symbol; * // returns 'open-circle' */ _$defineProperty_825( Symbols.prototype, 'symbol', { 'configurable': false, 'enumerable': true, 'set': _$set_562, 'get': _$get_561 }); /** * `x` values. * * @name x * @memberof Symbols.prototype * @type {ArrayLike} * @throws {TypeError} must be array-like * @default [] * * @example * var symbols = new Symbols({ * 'x': [0.1,0.2,0.3] * }); * * var x = symbols.x; * // returns [0.1,0.2,0.3] */ _$defineProperty_825( Symbols.prototype, 'x', { 'configurable': false, 'enumerable': true, 'set': _$set_568, 'get': _$get_567 }); /** * `y` values. * * @name y * @memberof Symbols.prototype * @type {ArrayLike} * @throws {TypeError} must be array-like * @default [] * * @example * var symbols = new Symbols({ * 'y': [0.4,0.5,0.6] * }); * * var y = symbols.y; * // returns [0.4,0.5,0.6] */ _$defineProperty_825( Symbols.prototype, 'y', { 'configurable': false, 'enumerable': true, 'set': _$set_573, 'get': _$get_572 }); /** * `x` scale function. * * @name xScale * @memberof Symbols.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var symbols = new Symbols({ * 'xScale': function scale(){} * }); * * var f = symbols.xScale; * // returns */ _$defineProperty_825( Symbols.prototype, 'xScale', { 'configurable': false, 'enumerable': true, 'set': _$set_566, 'get': _$get_565 }); /** * `y` scale function. * * @name yScale * @memberof Symbols.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var symbols = new Symbols({ * 'yScale': function scale(){} * }); * * var f = symbols.yScale; * // returns */ _$defineProperty_825( Symbols.prototype, 'yScale', { 'configurable': false, 'enumerable': true, 'set': _$set_571, 'get': _$get_570 }); /** * Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. * * @name isDefined * @memberof Symbols.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var Symbols = new Symbols(); * symbols.isDefined = function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * * @example * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * var symbols = new Symbols({ * 'isDefined': isDefined * }); * var fcn = symbols.isDefined; * // returns */ _$defineProperty_825( Symbols.prototype, 'isDefined', { 'configurable': false, 'enumerable': true, 'set': _$set_554, 'get': _$get_553 }); /** * Symbol size. When retrieved, the returned value is a size accessor. * * @name size * @memberof Symbols.prototype * @type {(NonNegativeInteger|Function)} * @throws {TypeError} must be a nonnegative integer or function * @default 6 * * @example * var symbols = new Symbols({ * 'size': 5 * }); * * var size = symbols.size; * // returns */ _$defineProperty_825( Symbols.prototype, 'size', { 'configurable': false, 'enumerable': true, 'set': _$set_560, 'get': _$get_559 }); /** * Symbol opacity. When retrieved, the returned value is an opacity accessor. * * @name opacity * @memberof Symbols.prototype * @type {(number|Function)} * @throws {TypeError} must be a number or function * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.9 * * @example * var symbols = new Symbols({ * 'opacity': 0.5 * }); * * var opacity = symbols.opacity; * // returns */ _$defineProperty_825( Symbols.prototype, 'opacity', { 'configurable': false, 'enumerable': true, 'set': _$set_558, 'get': _$get_557 }); /** * Symbols color. When retrieved, the returned value is a color accessor. * * @name color * @memberof Symbols.prototype * @type {(string|Function)} * @throws {TypeError} must be a primitive string or function * * @example * var symbols = new Symbols({ * 'color': 'steelblue' * }); * * var color = symbols.color; * // returns */ _$defineProperty_825( Symbols.prototype, 'color', { 'configurable': false, 'enumerable': true, 'set': _$set_552, 'get': _$get_551 }); /** * Symbols label. When retrieved, the returned value is a label accessor. * * @name label * @memberof Symbols.prototype * @type {(string|Function)} * @throws {TypeError} must be a primitive string or function * * @example * var symbols = new Symbols({ * 'label': 'group-1' * }); * * var label = symbols.label; * // returns */ _$defineProperty_825( Symbols.prototype, 'label', { 'configurable': false, 'enumerable': true, 'set': _$set_556, 'get': _$get_555 }); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Symbols.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var symbols = new Symbols({ * 'autoRender': true * }); * * var mode = symbols.autoRender; * // returns true */ _$defineProperty_825( Symbols.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_550, 'get': _$get_549 }); /** * Function to map values to x coordinate values. * * @name xPos * @memberof Symbols.prototype * @type {Function} * * @example * var symbols = new Symbols(); * var xPos = symbols.xPos; * // returns */ _$defineProperty_825( Symbols.prototype, 'xPos', { 'configurable': false, 'enumerable': true, 'get': _$get_564 }); /** * Function to map values to y coordinate values. * * @name yPos * @memberof Symbols.prototype * @type {Function} * * @example * var symbols = new Symbols(); * var yPos = symbols.yPos; * // returns */ _$defineProperty_825( Symbols.prototype, 'yPos', { 'configurable': false, 'enumerable': true, 'get': _$get_569 }); /** * Renders a virtual DOM tree. * * @name render * @memberof Symbols.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var symbols = new Symbols(); * * var out = symbols.render(); */ _$setReadOnly_827( Symbols.prototype, 'render', _$render_575 ); // EXPORTS // var _$Symbols_577 = Symbols; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * SVG symbols. * * @module @stdlib/plot/components/svg/symbols * * @example * var Symbols = require( '@stdlib/plot/components/svg/symbols' ); * * var symbols = new Symbols({ * 'x': [0.1,0.2,0.3], * 'y': [0.4,0.5,0.6] * }); */ // MODULES // /* removed: var _$Symbols_577 = require( './symbols.js' ); */; // EXPORTS // var _$Symbols_548 = _$Symbols_577; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isnan_517 = _$isnan_128.isPrimitive; // VARIABLES // var __debug_517 = _$browser_913( 'rug:accessor:is-defined' ); // MAIN // /** * Predicate function which returns a boolean indicating whether a datum is defined. * * @private * @param {number} d - datum * @param {integer} i - index * @returns {boolean} boolean indicating whether a datum is defined */ function __isDefined_517( d ) { var bool = !__isnan_517( d ); __debug_517( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); return bool; } // EXPORTS // var _$isDefined_517 = __isDefined_517; var _$defaults_518={ "autoRender": false, "color": "#aaa", "data": [], "isDefined": null, "label": "", "opacity": 0.9, "orientation": "bottom", "scale": null, "size": 6 } /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_522 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_522 = _$browser_913( 'rug:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a boolean primitive */ function __set_522( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_522( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoRender ) { __debug_522( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_522( 'New Value: %d.', this._autoRender ); this.emit( 'change' ); } } // EXPORTS // var _$set_522 = __set_522; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_521() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_521 = __get_521; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_524 = _$isString_164.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_524 = _$browser_913( 'rug:set:color' ); // MAIN // /** * Sets the color. * * @private * @param {(string|Function)} color - color * @throws {TypeError} must be a string primitive or function */ function __set_524( color ) { /* eslint-disable no-invalid-this */ if ( !__isString_524( color ) && !_$isFunction_112( color ) ) { throw new TypeError( 'invalid value. `color` must be a string primitive or a function. Value: `' + color + '.`' ); } if ( color !== this._color ) { __debug_524( 'Current value: %d.', this._color ); this._color = color; __debug_524( 'New Value: %d.', this._color ); this.emit( 'change' ); } } // EXPORTS // var _$set_524 = __set_524; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_523 = _$isString_164.isPrimitive; // MAIN // /** * Returns a function to get a color. * * @private * @returns {Function} color accessor */ function __get_523() { /* eslint-disable no-invalid-this */ var self = this; if ( __isString_523( this._color ) ) { return color; } return this._color; /** * Returns a color value. * * @private * @returns {string} color */ function color() { return self._color; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_523 = __get_523; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; // VARIABLES // var __debug_526 = _$browser_913( 'rug:set:data' ); // MAIN // /** * Sets the data values. * * ## Notes * * - We always fire a `change` event when set, even if the provided reference is the same, to allow signaling that data values have changed (e.g., a data array has mutated). * * @private * @param {ArrayLike} data - data values * @throws {TypeError} must be array-like */ function __set_526( data ) { /* eslint-disable no-invalid-this */ if ( !_$isArrayLike_81( data ) ) { throw new TypeError( 'invalid value. `data` must be array-like. Value: `' + data + '.`' ); } __debug_526( 'Current value: %s.', JSON.stringify( this._data ) ); this._data = data; __debug_526( 'New Value: %s.', JSON.stringify( this._data ) ); this.emit( 'change' ); } // EXPORTS // var _$set_526 = __set_526; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data values. * * @private * @returns {ArrayLike} data values */ function __get_525() { /* eslint-disable no-invalid-this */ return this._data; } // EXPORTS // var _$get_525 = __get_525; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_528 = _$browser_913( 'rug:set:is-defined' ); // MAIN // /** * Sets the predicate function for determining whether a value is defined. * * @private * @param {Function} fcn - predicate function * @throws {TypeError} must be a function */ function __set_528( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `isDefined` must be a function. Value: `' + fcn + '.`' ); } if ( fcn !== this._isDefined ) { __debug_528( 'Current value: %s.', this._isDefined ); this._isDefined = fcn; __debug_528( 'New Value: %s.', this._isDefined ); this.emit( 'change' ); } } // EXPORTS // var _$set_528 = __set_528; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the predicate function for determining whether a value is defined. * * @private * @returns {Function} predicate function */ function __get_527() { /* eslint-disable no-invalid-this */ return this._isDefined; } // EXPORTS // var _$get_527 = __get_527; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_530 = _$isString_164.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_530 = _$browser_913( 'rug:set:label' ); // MAIN // /** * Sets the label. * * @private * @param {(string|Function)} label - label * @throws {TypeError} must be a string primitive or a function */ function __set_530( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_530( label ) && !_$isFunction_112( label ) ) { throw new TypeError( 'invalid value. `label` must be a string primitive or a function. Value: `' + label + '.`' ); } if ( label !== this._label ) { __debug_530( 'Current value: %d.', this._label ); this._label = label; __debug_530( 'New Value: %d.', this._label ); this.emit( 'change' ); } } // EXPORTS // var _$set_530 = __set_530; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_529 = _$isString_164.isPrimitive; // MAIN // /** * Returns a function to get a label. * * @private * @returns {Function} label accessor */ function __get_529() { /* eslint-disable no-invalid-this */ var self = this; if ( __isString_529( this._label ) ) { return label; } return this._label; /** * Returns a label. * * @private * @returns {string} label */ function label() { return self._label; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_529 = __get_529; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_532 = _$isNumber_143.isPrimitive; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_532 = _$browser_913( 'rug:set:opacity' ); // MAIN // /** * Sets the opacity. * * @private * @param {(number|Function)} opacity - opacity * @throws {TypeError} must be a number or a function * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_532( opacity ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_532( opacity ); if ( !isNum && !_$isFunction_112( opacity ) ) { throw new TypeError( 'invalid value. `opacity` must be a number or a function. Value: `' + opacity + '.`' ); } if ( isNum && (opacity !== opacity || opacity < 0.0 || opacity > 1.0) ) { throw new RangeError( 'invalid value. `opacity` must be a number on the interval `[0,1]`. Value: `' + opacity + '`.' ); } if ( opacity !== this._opacity ) { __debug_532( 'Current value: %d.', this._opacity ); this._opacity = opacity; __debug_532( 'New Value: %d.', this._opacity ); this.emit( 'change' ); } } // EXPORTS // var _$set_532 = __set_532; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isNumber_531 = _$isNumber_143.isPrimitive; // MAIN // /** * Returns a function to get an opacity. * * @private * @returns {Function} opacity accessor */ function __get_531() { /* eslint-disable no-invalid-this */ var self = this; if ( __isNumber_531( this._opacity ) ) { return opacity; } return this._opacity; /** * Returns the opacity. * * @private * @returns {number} opacity */ function opacity() { return self._opacity; // eslint-disable-line no-underscore-dangle } } // EXPORTS // var _$get_531 = __get_531; var _$orientations_534=[ "bottom", "left", "right", "top" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_534 = require( './orientations.json' ); */; // VARIABLES // var __debug_535 = _$browser_913( 'rug:set:orientation' ); // MAIN // /** * Sets the orientation. * * @private * @param {string} orient - orientation * @throws {TypeError} must be a supported orientation */ function __set_535( orient ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$orientations_534, orient ) === -1 ) { throw new Error( 'invalid value. `orientation` must be one of `['+_$orientations_534.join(',')+']`. Value: `' + orient + '.`' ); } if ( orient !== this._orientation ) { __debug_535( 'Current value: %d.', this._orientation ); this._orientation = orient; __debug_535( 'New Value: %d.', this._orientation ); this.emit( 'change' ); } } // EXPORTS // var _$set_535 = __set_535; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the orientation. * * @private * @returns {string} orientation */ function __get_533() { /* eslint-disable no-invalid-this */ return this._orientation; } // EXPORTS // var _$get_533 = __get_533; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_536 = _$browser_913( 'rug:pos' ); // MAIN // /** * Returns a function to map values to coordinate values. * * @private * @returns {Function} map function */ function __get_536() { /* eslint-disable no-invalid-this */ var scale = this.scale; return pos; /** * Maps a value to a coordinate value. * * @private * @param {*} d - datum * @returns {number} pixel value */ function pos( d ) { var p = scale( d ); __debug_536( 'Value: %d => Pixel: %d.', d, p ); return p; } } // EXPORTS // var _$get_536 = __get_536; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_538 = _$browser_913( 'rug:set:scale' ); // MAIN // /** * Sets the scale function. * * @private * @param {Function} fcn - scale * @throws {TypeError} must be a function */ function __set_538( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `scale` must be a function. Value: `' + fcn + '.`' ); } if ( fcn !== this._scale ) { __debug_538( 'Current value: %s.', this._scale ); this._scale = fcn; __debug_538( 'New Value: %s.', this._scale ); this.emit( 'change' ); } } // EXPORTS // var _$set_538 = __set_538; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the scale function. * * @private * @returns {Function} scale function */ function __get_537() { /* eslint-disable no-invalid-this */ return this._scale; } // EXPORTS // var _$get_537 = __get_537; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_540 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_540 = _$browser_913( 'rug:set:size' ); // MAIN // /** * Sets the tick (tassel) size. * * @private * @param {NonNegativeInteger} size - size * @throws {TypeError} must be a nonnegative integer */ function __set_540( size ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_540( size ) ) { throw new TypeError( 'invalid value. `size` must be a nonnegative integer. Value: `' + size + '.`' ); } if ( size !== this._size ) { __debug_540( 'Current value: %d.', this._size ); this._size = size; __debug_540( 'New Value: %d.', this._size ); this.emit( 'change' ); } } // EXPORTS // var _$set_540 = __set_540; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns the tick (tassel) size. * * @private * @returns {NonNegativeInteger} tick size */ function __get_539() { /* eslint-disable no-invalid-this */ return this._size; } // EXPORTS // var _$get_539 = __get_539; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the "x" attribute for tick positioning. * * @private * @param {string} orient - rug orientation * @returns {string} attribute */ function __xAttr_544( orient ) { if ( orient === 'left' || orient === 'right' ) { return 'x'; } return 'y'; } // EXPORTS // var _$xAttr_544 = __xAttr_544; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the "y" attribute for tick positioning. * * @private * @param {string} orient - rug orientation * @returns {string} attribute */ function __yAttr_545( orient ) { if ( orient === 'left' || orient === 'right' ) { return 'y'; } return 'x'; } // EXPORTS // var _$yAttr_545 = __yAttr_545; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the tick direction. * * @private * @param {string} orient - orientation * @returns {number} tick direction */ function tickDir( orient ) { if ( orient === 'bottom' || orient === 'right' ) { return -1; } return 1; } // EXPORTS // var _$tickDir_543 = tickDir; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$xAttr_544 = require( './utils/x_attr.js' ); */; /* removed: var _$yAttr_545 = require( './utils/y_attr.js' ); */; /* removed: var _$tickDir_543 = require( './utils/tick_dir.js' ); */; // VARIABLES // var __debug_542 = _$browser_913( 'rug:render:ticks' ); var __ELEMENT_542 = 'line'; // MAIN // /** * Renders rug ticks (tassels). * * @private * @param {Object} ctx - context * @returns {Array} array of virtual trees */ function __render_542( ctx ) { var props; var data; var out; var pos; var dir; var p; var x; var y; var d; var i; __debug_542( 'Rendering ticks...' ); data = ctx.data; pos = ctx.pos; x = _$xAttr_544( ctx.orientation ); y = _$yAttr_545( ctx.orientation ); dir = _$tickDir_543( ctx.orientation ); out = new Array( data.length ); for ( i = 0; i < data.length; i++ ) { d = data[ i ]; if ( !ctx.isDefined( d, i ) ) { __debug_542( 'Datum %d is not defined. Value: %s.', i, d ); continue; } props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'rug.tick', 'className': 'tick', 'attributes': { 'fill': 'none', 'opacity': ctx.opacity( d, i ), 'stroke': ctx.color( d, i ), 'stroke-width': 1, 'data-label': ctx.label( d, i ) } }; p = pos( d ); props.attributes[ x+'1' ] = 0; props.attributes[ x+'2' ] = dir * ctx.size; props.attributes[ y+'1' ] = p; props.attributes[ y+'2' ] = p; __debug_542( 'Rendering tick %d with value %s...', i, d ); __debug_542( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_542, JSON.stringify( props ) ); out[ i ] = _$h_933( __ELEMENT_542, props, [] ); } __debug_542( 'Finished rendering ticks.' ); return out; } // EXPORTS // var _$render_542 = __render_542; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$h_933 = require( 'virtual-dom/h' ); */; /* removed: var _$render_542 = require( './ticks.js' ); */; // VARIABLES // var __debug_541 = _$browser_913( 'rug:render' ); var __ELEMENT_541 = 'g'; // MAIN // /** * Renders a virtual DOM tree. * * @private * @returns {VTree} virtual tree */ function __render_541() { /* eslint-disable no-invalid-this */ var children; var props; var vtree; __debug_541( 'Rendering...' ); props = { 'namespace': 'http://www.w3.org/2000/svg', 'property': 'rug', 'className': 'rug' }; children = _$render_542( this ); __debug_541( 'Generating a virtual DOM tree (%s) with properties: %s.', __ELEMENT_541, JSON.stringify( props ) ); vtree = _$h_933( __ELEMENT_541, props, children ); // Announce that a new tree has been rendered: this.emit( '_render', vtree ); return vtree; } // EXPORTS // var _$render_541 = __render_541; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_520 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; var __linear_520 = _$d3Scale_909.scaleLinear; // TODO: remove /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$merge_870 = require( '@stdlib/utils/merge' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$instanceOf_75 = require( '@stdlib/assert/instance-of' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$isDefined_517 = require( './accessors/is_defined.js' ); */; /* removed: var _$defaults_518 = require( './defaults.json' ); */; // VARIABLES // var __debug_520 = _$browser_913( 'rug:main' ); var __PRIVATE_PROPS_520 = [ '_autoRender', '_color', '_data', '_isDefined', '_label', '_opacity', '_orientation', '_scale', '_size' ]; // MAIN // /** * Rug constructor. * * @constructor * @param {Options} [options] - constructor options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @param {(string|Function)} [options.color="#aaa"] - color * @param {ArrayLike} [options.data=[]] - data * @param {Function} [options.isDefined] - predicate function indicating whether a datum is defined * @param {(string|Function)} [options.label] - label * @param {(number|Function)} [options.opacity=0.9] - opacity * @param {string} [options.orientation="bottom"] - orientation * @param {Function} [options.scale] - scale function * @param {NonNegativeInteger} [options.size=6] - tick (tassel) size * @throws {TypeError} options argument must be an object * @throws {TypeError} must provide valid options * @returns {Rug} Rug instance * * @example * var node = new Rug({ * 'data': [ 0.1, 0.2, 0.3 ] * }); * // returns */ function Rug( options ) { var self; var keys; var opts; var key; var i; if ( !_$instanceOf_75( this, Rug ) ) { if ( arguments.length ) { return new Rug( options ); } return new Rug(); } self = this; opts = _$copy_816( _$defaults_518 ); opts.isDefined = _$isDefined_517; opts.scale = __linear_520(); if ( arguments.length ) { if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. `options` argument must be an object. Value: `' + options + '`.' ); } opts = _$merge_870( opts, options ); } __debug_520( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_520.call( this ); for ( i = 0; i < __PRIVATE_PROPS_520.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_520[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } this.on( 'change', onChange ); this.on( '_render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { __debug_520( 'Received a change event.' ); if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle self.render(); } } /** * Re-emits a render event. * * @private */ function onRender() { var args; var i; __debug_520( 'Received a render event. Re-emitting...' ); args = new Array( arguments.length+1 ); args[ 0 ] = 'render'; for ( i = 0; i < arguments.length; i++ ) { args[ i+1 ] = arguments[ i ]; } self.emit.apply( self, args ); } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( Rug, __EventEmitter_520 ); /** * Rendering mode. If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Rug.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var node = new Rug({ * 'autoRender': true * }); * * var mode = node.autoRender; * // returns true */ _$defineProperty_825( Rug.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_522, 'get': _$get_521 }); /** * Tick color. When retrieved, the returned value is a color accessor. * * @name color * @memberof Rug.prototype * @type {(string|Function)} * @throws {TypeError} must be a primitive string or function * * @example * var node = new Rug({ * 'color': 'steelblue' * }); * * var color = node.color; * // returns */ _$defineProperty_825( Rug.prototype, 'color', { 'configurable': false, 'enumerable': true, 'set': _$set_524, 'get': _$get_523 }); /** * Data. * * @name data * @memberof Rug.prototype * @type {ArrayLike} * @throws {TypeError} must be array-like * @default [] * * @example * var node = new Rug({ * 'data': [ 0.1, 0.2, 0.3 ] * }); * * var data = node.data; * // returns [ 0.1, 0.2, 0.3 ] */ _$defineProperty_825( Rug.prototype, 'data', { 'configurable': false, 'enumerable': true, 'set': _$set_526, 'get': _$get_525 }); /** * Predicate function which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. * * @name isDefined * @memberof Rug.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var node = new Rug(); * * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * node.isDefined = isDefined; * * @example * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * var node = new Rug({ * 'isDefined': isDefined * }); * var fcn = node.isDefined; * // returns */ _$defineProperty_825( Rug.prototype, 'isDefined', { 'configurable': false, 'enumerable': true, 'set': _$set_528, 'get': _$get_527 }); /** * Tick label. When retrieved, the returned value is a label accessor. * * @name label * @memberof Rug.prototype * @type {(string|Function)} * @throws {TypeError} must be a primitive string or function * * @example * var node = new Rug({ * 'label': 'group-1' * }); * * var label = node.label; * // returns */ _$defineProperty_825( Rug.prototype, 'label', { 'configurable': false, 'enumerable': true, 'set': _$set_530, 'get': _$get_529 }); /** * Tick opacity. When retrieved, the returned value is an opacity accessor. * * @name opacity * @memberof Rug.prototype * @type {number} * @throws {TypeError} must be a number * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.9 * * @example * var node = new Rug({ * 'opacity': 0.5 * }); * * var opacity = node.opacity; * // returns */ _$defineProperty_825( Rug.prototype, 'opacity', { 'configurable': false, 'enumerable': true, 'set': _$set_532, 'get': _$get_531 }); /** * Rug orientation. * * @name orientation * @memberof Rug.prototype * @type {string} * @throws {TypeError} must be a supported orientation * * @example * var node = new Rug({ * 'orientation': 'left' * }); * * var orient = node.orientation; * // returns 'left' */ _$defineProperty_825( Rug.prototype, 'orientation', { 'configurable': false, 'enumerable': true, 'set': _$set_535, 'get': _$get_533 }); /** * Function to map values to x coordinate values. * * @name pos * @memberof Rug.prototype * @type {Function} * * @example * var node = new Rug(); * * var pos = node.pos; * // returns */ _$defineProperty_825( Rug.prototype, 'pos', { 'configurable': false, 'enumerable': true, 'get': _$get_536 }); /** * Scale function. * * @name scale * @memberof Rug.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * var node = new Rug({ * 'scale': function scale() {} * }); * * var fcn = node.scale; * // returns */ _$defineProperty_825( Rug.prototype, 'scale', { 'configurable': false, 'enumerable': true, 'set': _$set_538, 'get': _$get_537 }); /** * Tick (tassel) size. * * @name size * @memberof Rug.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 6 * * @example * var node = new Rug({ * 'size': 5 * }); * * var size = node.size; * // returns 5 */ _$defineProperty_825( Rug.prototype, 'size', { 'configurable': false, 'enumerable': true, 'set': _$set_540, 'get': _$get_539 }); /** * Renders a Virtual DOM tree. * * @name render * @memberof Rug.prototype * @type {Function} * @returns {VTree} virtual tree * * @example * var node = new Rug(); * * var out = node.render(); * // returns */ _$setReadOnly_827( Rug.prototype, 'render', _$render_541 ); // EXPORTS // var _$Rug_520 = Rug; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * SVG rug component. * * @module @stdlib/plot/components/svg/rug * * @example * var Rug = require( '@stdlib/plot/components/svg/rug' ); * * var node = new Rug({ * 'data': [ 0.1, 0.2, 0.3 ] * }); * // returns */ // MODULES // /* removed: var _$Rug_520 = require( './main.js' ); */; // EXPORTS // var _$Rug_519 = _$Rug_520; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$Annotations_329 = require( '@stdlib/plot/components/svg/annotations' ); */; /* removed: var _$ClipPath_435 = require( '@stdlib/plot/components/svg/clip-path' ); */; /* removed: var _$Canvas_416 = require( '@stdlib/plot/components/svg/canvas' ); */; /* removed: var _$Graph_458 = require( '@stdlib/plot/components/svg/graph' ); */; /* removed: var _$Title_581 = require( '@stdlib/plot/components/svg/title' ); */; /* removed: var _$Marks_474 = require( '@stdlib/plot/components/svg/marks' ); */; /* removed: var _$Background_399 = require( '@stdlib/plot/components/svg/background' ); */; /* removed: var _$Defs_451 = require( '@stdlib/plot/components/svg/defs' ); */; /* removed: var _$Axis_344 = require( '@stdlib/plot/components/svg/axis' ); */; /* removed: var _$Path_487 = require( '@stdlib/plot/components/svg/path' ); */; /* removed: var _$Symbols_548 = require( '@stdlib/plot/components/svg/symbols' ); */; /* removed: var _$Rug_519 = require( '@stdlib/plot/components/svg/rug' ); */; // VARIABLES // var __debug_709 = _$browser_913( 'plot:render:svg:init' ); // MAIN // /** * Initializes SVG components. * * @private * @param {Object} state - state */ function init( state ) { var svg = state.$.svg; __debug_709( 'Initializing components...' ); __debug_709( 'Initializing canvas component...' ); _$defineProperty_825( svg, 'canvas', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Canvas_416({ 'autoRender': false }) }); __debug_709( 'Initializing definitions component...' ); _$defineProperty_825( svg, 'defs', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Defs_451({ 'autoRender': false }) }); __debug_709( 'Initializing clipping path component...' ); _$defineProperty_825( svg, 'clipPath', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$ClipPath_435({ 'autoRender': false, 'id': state._clipPathId // eslint-disable-line no-underscore-dangle }) }); __debug_709( 'Initializing graph component...' ); _$defineProperty_825( svg, 'graph', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Graph_458({ 'autoRender': false }) }); __debug_709( 'Initializing annotations component...' ); _$defineProperty_825( svg, 'annotations', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Annotations_329({ 'autoRender': false }) }); __debug_709( 'Initializing title component...' ); _$defineProperty_825( svg, 'title', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Title_581({ 'autoRender': false }) }); __debug_709( 'Initializing background component...' ); _$defineProperty_825( svg, 'bkgd', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Background_399({ 'autoRender': false }) }); __debug_709( 'Initializing marks component...' ); _$defineProperty_825( svg, 'marks', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Marks_474({ 'autoRender': false, 'clipPathId': state._clipPathId // eslint-disable-line no-underscore-dangle }) }); __debug_709( 'Initializing path component...' ); _$defineProperty_825( svg, 'path', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Path_487({ 'autoRender': false }) }); __debug_709( 'Initializing symbols component...' ); _$defineProperty_825( svg, 'symbols', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Symbols_548({ 'autoRender': false }) }); __debug_709( 'Initializing x-axis rug component...' ); _$defineProperty_825( svg, 'xRug', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Rug_519({ 'autoRender': false }) }); __debug_709( 'Initializing y-axis rug component...' ); _$defineProperty_825( svg, 'yRug', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Rug_519({ 'autoRender': false }) }); __debug_709( 'Initializing x-axis component...' ); _$defineProperty_825( svg, 'xAxis', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Axis_344({ 'autoRender': false }) }); __debug_709( 'Initializing y-axis component...' ); _$defineProperty_825( svg, 'yAxis', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': new _$Axis_344({ 'autoRender': false }) }); __debug_709( 'All components initialized.' ); } // EXPORTS // var _$init_709 = init; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_715 = _$browser_913( 'plot:render:svg:sync' ); // MAIN // /** * Syncs SVG components with the current state. * * @private * @param {Object} state - state */ function sync( state ) { var svg = state.$.svg; __debug_715( 'Syncing...' ); __debug_715( 'Syncing canvas...' ); svg.canvas.width = state.width; svg.canvas.height = state.height; __debug_715( 'Syncing definitions...' ); // ... __debug_715( 'Syncing clipping path...' ); svg.clipPath.width = state.graphWidth; svg.clipPath.height = state.graphHeight; __debug_715( 'Syncing graph...' ); svg.graph.translateX = state.paddingLeft; svg.graph.translateY = state.paddingTop; __debug_715( 'Syncing annotations...' ); // ... __debug_715( 'Syncing title...' ); svg.title.text = state.title; __debug_715( 'Syncing background...' ); svg.bkgd.width = state.graphWidth; svg.bkgd.height = state.graphHeight; __debug_715( 'Syncing marks...' ); svg.marks.clipPathId = state._clipPathId; // eslint-disable-line no-underscore-dangle __debug_715( 'Syncing path...' ); svg.path.xScale = state.xScale; svg.path.yScale = state.yScale; // svg.path.isDefined = state.isDefined; // TODO __debug_715( 'Syncing symbols...' ); svg.symbols.xScale = state.xScale; svg.symbols.yScale = state.yScale; // svg.symbols.isDefined = state.isDefined; // TODO __debug_715( 'Syncing x-axis rug...' ); svg.xRug.scale = state.xScale; // svg.xRug.isDefined = state.isDefined; // TODO __debug_715( 'Syncing y-axis rug...' ); svg.yRug.scale = state.yScale; // svg.yRug.isDefined = state.isDefined; // TODO __debug_715( 'Syncing x-axis...' ); svg.xAxis.scale = state.xScale; svg.xAxis.label = state.xLabel; svg.xAxis.tickFormat = state.xTickFormat; svg.xAxis.numTicks = state.xNumTicks; svg.xAxis.orientation = state.xAxisOrient; __debug_715( 'Syncing y-axis...' ); svg.yAxis.scale = state.yScale; svg.yAxis.label = state.yLabel; svg.yAxis.tickFormat = state.yTickFormat; svg.yAxis.numTicks = state.yNumTicks; svg.yAxis.orientation = state.yAxisOrient; __debug_715( 'Sync complete.' ); } // EXPORTS // var _$sync_715 = sync; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$xAxisTransform_716 = require( './utils/x_axis_transform.js' ); */; /* removed: var _$yAxisTransform_718 = require( './utils/y_axis_transform.js' ); */; /* removed: var _$render_710 = require( './marks' ); */; /* removed: var _$init_709 = require( './init.js' ); */; /* removed: var _$sync_715 = require( './sync.js' ); */; // VARIABLES // var __debug_708 = _$browser_913( 'plot:render:svg:main' ); // MAIN // /** * Renders a virtual DOM tree. * * @private * @param {Object} state - state * @returns {VTree} virtual tree */ function __render_708( state ) { var annotations; var clipPath; var canvas; var title; var graph; var marks; var xAxis; var yAxis; var bkgd; var defs; var svg; svg = state.$.svg; // Lazily initialize... if ( !svg.canvas ) { __debug_708( 'Initializing components...' ); _$init_709( state ); } __debug_708( 'Syncing component states...' ); _$sync_715( state ); __debug_708( 'Rendering individual components...' ); __debug_708( 'Rendering annotations...' ); annotations = svg.annotations.render(); __debug_708( 'Rendering clip-path...' ); clipPath = svg.clipPath.render(); __debug_708( 'Rendering canvas...' ); canvas = svg.canvas.render(); __debug_708( 'Rendering graph...' ); graph = svg.graph.render(); __debug_708( 'Rendering title...' ); title = svg.title.render(); __debug_708( 'Rendering x-axis...' ); xAxis = svg.xAxis.render(); __debug_708( 'Rendering y-axis...' ); yAxis = svg.yAxis.render(); __debug_708( 'Rendering background...' ); bkgd = svg.bkgd.render(); __debug_708( 'Rendering definitions...' ); defs = svg.defs.render(); __debug_708( 'Rendering marks...' ); marks = _$render_710( state ); __debug_708( 'Updating rendered components...' ); __debug_708( 'Updating title...' ); title.properties.attributes.x = state.paddingLeft + ( state.graphWidth/2 ); title.properties.attributes.y = state.paddingTop / 2; __debug_708( 'Updating x-axis...' ); xAxis.properties.className += ' x'; xAxis.properties.attributes.transform = _$xAxisTransform_716( state.xAxisOrient, state.graphHeight ); // eslint-disable-line max-len __debug_708( 'Updating y-axis...' ); yAxis.properties.className += ' y'; yAxis.properties.attributes.transform = _$yAxisTransform_718( state.yAxisOrient, state.graphWidth ); // eslint-disable-line max-len __debug_708( 'Assembling virtual tree...' ); __debug_708( 'Inserting clip-path into definitions...' ); defs.children.push( clipPath ); defs.count += clipPath.count; __debug_708( 'Inserting background into graph...' ); graph.children.push( bkgd ); graph.count += bkgd.count; __debug_708( 'Inserting marks into graph...' ); graph.children.push( marks ); graph.count += marks.count; __debug_708( 'Inserting x-axis into graph...' ); graph.children.push( xAxis ); graph.count += xAxis.count; __debug_708( 'Inserting y-axis into graph...' ); graph.children.push( yAxis ); graph.count += yAxis.count; __debug_708( 'Inserting title into annotations...' ); annotations.children.push( title ); annotations.count += title.count; __debug_708( 'Inserting definitions into canvas...' ); canvas.children.push( defs ); canvas.count += defs.count; __debug_708( 'Inserting graph into canvas...' ); canvas.children.push( graph ); canvas.count += graph.count; __debug_708( 'Inserting annotations into canvas...' ); canvas.children.push( annotations ); canvas.count += annotations.count; return canvas; } // EXPORTS // var _$render_708 = __render_708; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Validates that an instance is in a valid state for rendering. * * @private * @param {Object} state - state * @throws {Error} must be in a valid state to render */ function __validate_720( state ) { /* eslint-disable no-underscore-dangle */ var x; var y; var i; x = state._xData; y = state._yData; if ( x.length !== y.length ) { throw new Error( 'invalid state. `x` and `y` are different lengths. `x` length: '+x.length+', `y` length: '+y.length+'.' ); } // TODO: will need to refactor to some degree to support `ndarray`-like `x` and `y` for ( i = 0; i < x.length; i++ ) { if ( x[ i ].length !== y[ i ].length ) { throw new Error( 'invalid state. Each `x[i]:y[i]` pair must be the same length. x['+i+'].length: '+x[i].length+', y['+i+'].length: '+y[i].length+'.' ); } } } // EXPORTS // var _$validate_720 = __validate_720; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$toHTML_930 = require( 'vdom-to-html' ); */; /* removed: var _$render_708 = require( './svg' ); */; /* removed: var _$validate_720 = require( './validate.js' ); */; // VARIABLES // var __debug_707 = _$browser_913( 'plot:render' ); // MAIN // /** * Renders a plot. * * @private * @param {string} [format] - render format * @returns {(VTree|string)} virtual tree or a string */ function __render_707( format ) { /* eslint-disable no-invalid-this */ var out; var tmp; var fmt; tmp = this.renderFormat; if ( arguments.length ) { // Temporarily set the render format: this.renderFormat = format; fmt = format; } else { fmt = tmp; } __debug_707( 'Validating render state...' ); _$validate_720( this ); __debug_707( 'Render format: %s.', this.renderFormat ); __debug_707( 'Rendering...' ); if ( this._engine === 'svg' ) { out = _$render_708( this ); // Default render format is virtual DOM. if ( fmt === 'html' ) { out = _$toHTML_930( out ); } this.emit( 'render', out ); } if ( arguments.length ) { // Restore the render format: this.renderFormat = tmp; } return out; } // EXPORTS // var _$render_707 = __render_707; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$view_725 = require( './view.js' ); */; // eslint-disable-line no-underscore-dangle // VARIABLES // var __debug_723 = _$browser_913( 'plot:view' ); // MAIN // /** * Generates a plot view. * * @private * @param {string} viewer - plot viewer */ function __view_723( viewer ) { /* eslint-disable no-invalid-this */ var tmp = this.viewer; if ( arguments.length ) { // Temporarily set the viewer: this.viewer = viewer; } __debug_723( 'Viewer: %s.', this.viewer ); __debug_723( 'Generating view...' ); _$view_725( this, this.viewer, this.render() ); if ( arguments.length ) { // Restore the viewer: this.viewer = tmp; } } // EXPORTS // var _$view_723 = __view_723; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; var __EventEmitter_596 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; var mergeFcn = _$merge_870.factory; /* removed: var _$minstd_805 = require( '@stdlib/random/base/minstd' ); */; /* removed: var _$view_725 = require( './view/view.js' ); */; /* removed: var _$defaults_593 = require( './defaults.js' ); */; // VARIABLES // var __debug_596 = _$browser_913( 'plot:main' ); var __PRIVATE_PROPS_596 = [ '_autoRender', '_autoView', '_colors', '_description', '_engine', '_height', '_isDefined', '_labels', '_lineOpacity', '_lineStyle', '_lineWidth', '_paddingBottom', '_paddingLeft', '_paddingRight', '_paddingTop', '_renderFormat', '_symbols', '_symbolsOpacity', '_symbolsSize', '_title', '_viewer', '_width', '_xAxisOrient', '_xData', '_xLabel', '_xMax', '_xMin', '_xNumTicks', '_xRug', '_xRugOpacity', '_xRugOrient', '_xRugSize', '_xScale', '_xTickFormat', '_yAxisOrient', '_yData', '_yLabel', '_yMax', '_yMin', '_yNumTicks', '_yRug', '_yRugOpacity', '_yRugOrient', '_yRugSize', '_yScale', '_yTickFormat' ]; // FUNCTIONS // var __merge_596 = mergeFcn({ 'extend': false }); // MAIN // /** * Plot constructor. * * @constructor * @param {Array} [x] - x-values * @param {Array} [y] - y-values * @param {Options} [options] - constructor options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event * @param {(string|StringArray)} [options.colors='category10'] - data colors * @param {string} [options.description=''] - plot description * @param {string} [options.engine='svg'] - plot engine * @param {PositiveNumber} [options.height=400] - plot height * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {(StringArray|EmptyArray)} [options.labels] - data labels * @param {(number|NumberArray)} [options.lineOpacity=0.9] - data line opacity * @param {(string|StringArray)} [options.lineStyle='-'] - data line style(s) * @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - data line width(s) * @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding * @param {NonNegativeInteger} [options.paddingLeft=90] - left padding * @param {NonNegativeInteger} [options.paddingRight=20] - right padding * @param {NonNegativeInteger} [options.paddingTop=80] - top padding * @param {string} [options.renderFormat='vdom'] - plot render format * @param {(string|StringArray)} [options.symbols='none'] - data symbols * @param {(number|NumberArray)} [options.symbolsOpacity=0.9] - symbols opacity * @param {(NonNegativeInteger|Array)} [options.symbolsSize=6] - symbols size * @param {string} [options.title=''] - plot title * @param {string} [options.viewer='none'] - plot viewer * @param {PositiveNumber} [options.width=400] - plot width * @param {Array} [options.x=[]] - x-values * @param {string} [options.xAxisOrient='bottom'] - x-axis orientation * @param {string} [options.xLabel='x'] - x-axis label * @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain * @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain * @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks * @param {(boolean|BooleanArray)} [options.xRug=false] - indicates whether to render a rug plot along the x-axis * @param {(string|StringArray)} [options.xRugOrient='bottom'] - x-axis rug orientation * @param {(number|NumberArray)} [options.xRugOpacity=0.1] - x-axis rug opacity * @param {(NonNegativeInteger|Array)} [options.xRugSize=6] - x-axis rug tick (tassel) size * @param {string} [options.xScale='linear'] - x-axis scale * @param {(string|null)} [options.xTickFormat=null] - x-axis tick format * @param {Array} [options.y=[]] - y-values * @param {string} [options.yAxisOrient='left'] - y-axis orientation * @param {string} [options.yLabel='y'] - y-axis label * @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain * @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain * @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks * @param {(boolean|BooleanArray)} [options.yRug=false] - indicates whether to render a rug plot along the y-axis * @param {(string|StringArray)} [options.yRugOrient='left'] - y-axis rug orientation * @param {(number|NumberArray)} [options.yRugOpacity=0.1] - y-axis rug opacity * @param {(NonNegativeInteger|Array)} [options.yRugSize=6] - y-axis rug tick (tassel) size * @param {string} [options.yScale='linear'] - y-axis scale * @param {(string|null)} [options.yTickFormat=null] - y-axis tick format * @throws {TypeError} must provide valid options * @returns {Plot} Plot instance * * @example * var plot = new Plot(); */ function Plot() { var options; var nargs; var keys; var self; var opts; var key; var i; nargs = arguments.length; if ( !(this instanceof Plot) ) { if ( nargs === 0 ) { return new Plot(); } if ( nargs === 1 ) { return new Plot( arguments[0] ); } if ( nargs === 2 ) { return new Plot( arguments[0], arguments[1] ); } return new Plot( arguments[0], arguments[1], arguments[2] ); } self = this; opts = _$defaults_593(); if ( nargs === 0 ) { options = {}; } else if ( nargs === 1 ) { options = arguments[ 0 ]; if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. Options argument must be an `object`. Value: `' + options + '`.' ); } } else if ( nargs === 2 ) { options = { 'x': arguments[ 0 ], 'y': arguments[ 1 ] }; } else if ( nargs > 2 ) { if ( !_$isPlainObject_153( arguments[2] ) ) { throw new TypeError( 'invalid argument. Options argument must be an `object`. Value: `' + arguments[2] + '`.' ); } options = _$copy_816( arguments[2] ); // avoid mutation options.x = arguments[ 0 ]; options.y = arguments[ 1 ]; } opts = __merge_596( opts, options ); __debug_596( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_596.call( this ); for ( i = 0; i < __PRIVATE_PROPS_596.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_596[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set a clipping path id: _$defineProperty_825( this, '_clipPathId', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': _$minstd_805().toString() // TODO: uuid }); // Initialize an internal cache for renderers... _$defineProperty_825( this, '$', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': {} }); _$defineProperty_825( this.$, 'svg', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': {} }); // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } // Add event listeners: this.on( 'change', onChange ); this.on( 'render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { /* eslint-disable no-underscore-dangle */ __debug_596( 'Received a change event.' ); if ( self._autoRender ) { self.render(); } } /** * Callback invoked upon receiving a render event. * * @private * @param {*} plot - rendered plot */ function onRender( plot ) { /* eslint-disable no-underscore-dangle */ __debug_596( 'Received a render event.' ); if ( self._autoView ) { __debug_596( 'Viewer: %s.', self._viewer ); __debug_596( 'Generating view...' ); _$view_725( self, self._viewer, plot ); } } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( Plot, __EventEmitter_596 ); /** * `x` values. * * @name x * @memberof Plot.prototype * @type {Array} * @throws {TypeError} must be an array * @default [] * * @example * var plot = new Plot(); * plot.x = [ [ 1417563950959, 1417563952959 ] ]; * * @example * var plot = new Plot({ * 'x': [ [ 1417563950959, 1417563952959 ] ] * }); * var x = plot.x; * // returns [ [ 1417563950959, 1417563952959 ] ] */ _$defineProperty_825( Plot.prototype, 'x', { 'configurable': false, 'enumerable': true, 'set': _$set_677, 'get': _$get_676 }); /** * `y` values. * * @name y * @memberof Plot.prototype * @type {Array} * @throws {TypeError} must be an array * @default [] * * @example * var plot = new Plot(); * plot.x = [ [ 1417563950959, 1417563952959 ] ]; * plot.y = [ [ 0.25, 0.23 ] ]; * * @example * var plot = new Plot({ * 'x': [ [ 1417563950959, 1417563952959 ] ], * 'y': [ [ 0.25, 0.23 ] ] * }); * var y = plot.y; * // returns [ [ 0.25, 0.23 ] ] */ _$defineProperty_825( Plot.prototype, 'y', { 'configurable': false, 'enumerable': true, 'set': _$set_706, 'get': _$get_705 }); /** * Data labels. * * @name labels * @memberof Plot.prototype * @type {(StringArray|EmptyArray)} * @throws {TypeError} must be either an array of strings or an empty array * @default [] * * @example * var plot = new Plot(); * plot.labels = [ 'beep', 'boop' ]; * * @example * var plot = new Plot({ * 'labels': [ 'beep', 'boop' ] * }); * var labels = plot.labels; * // returns [ 'beep', 'boop' ] */ _$defineProperty_825( Plot.prototype, 'labels', { 'configurable': false, 'enumerable': true, 'set': _$set_616, 'get': _$get_615 }); /** * Accessor which defines whether a datum is defined. * * ## Notes * * - This accessor is used to define how missing values are encoded. * - The default behavior is to ignore values which are `NaN`. * * @name isDefined * @memberof Plot.prototype * @type {Function} * @param {*} d - datum * @param {integer} i - index * @throws {TypeError} must be a function * * @example * var plot = new Plot(); * plot.isDefined = function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * * @example * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * var plot = new Plot({ * 'isDefined': isDefined * }); * var fcn = plot.isDefined; * // returns */ _$defineProperty_825( Plot.prototype, 'isDefined', { 'configurable': false, 'enumerable': true, 'set': _$set_614, 'get': _$get_613 }); /** * Data colors. When retrieved, the returned value is always an `array`. * * @name colors * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be either a string or an array of strings * @default 'category10' * * @example * var plot = new Plot(); * plot.colors = 'category20'; * * @example * var plot = new Plot({ * 'colors': 'category20' * }); * var colors = plot.colors; * // returns [...] */ _$defineProperty_825( Plot.prototype, 'colors', { 'configurable': false, 'enumerable': true, 'set': _$set_603, 'get': _$get_602 }); /** * Data line style(s). * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineStyle * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported line style * @default '-' * * @example * var plot = new Plot(); * plot.lineStyle = [ '-', 'none' ]; * * @example * var plot = new Plot({ * 'lineStyle': 'none' * }); * var lineStyle = plot.lineStyle; * // returns [ 'none' ] */ _$defineProperty_825( Plot.prototype, 'lineStyle', { 'configurable': false, 'enumerable': true, 'set': _$set_621, 'get': _$get_619 }); /** * Data line opacity. * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineOpacity * @memberof Plot.prototype * @type {(number|NumberArray)} * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @default '0.9' * * @example * var plot = new Plot(); * plot.lineOpacity = [ 1.0, 0.5 ]; * * @example * var plot = new Plot({ * 'lineOpacity': 0.5 * }); * var opacity = plot.lineOpacity; * // returns [ 0.5 ] */ _$defineProperty_825( Plot.prototype, 'lineOpacity', { 'configurable': false, 'enumerable': true, 'set': _$set_618, 'get': _$get_617 }); /** * Data line width. * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineWidth * @memberof Plot.prototype * @type {(NonNegativeInteger|NonNegativeIntegerArray)} * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @default 2 * * @example * var plot = new Plot(); * plot.lineWidth = 1; * * @example * var plot = new Plot({ * 'lineWidth': [ 1, 3 ] * }); * var width = plot.lineWidth; * // returns [ 1, 3 ] */ _$defineProperty_825( Plot.prototype, 'lineWidth', { 'configurable': false, 'enumerable': true, 'set': _$set_623, 'get': _$get_622 }); /** * Data symbols. When retrieved, the returned value is always an `array`. * * @name symbols * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported symbol * @default 'none' * * @example * var plot = new Plot(); * plot.symbols = [ 'open-circle', 'closed-circle' ]; * * @example * var plot = new Plot({ * 'symbols': 'closed-circle' * }); * var symbols = plot.symbols; * // returns [ 'closed-circle' ] */ _$defineProperty_825( Plot.prototype, 'symbols', { 'configurable': false, 'enumerable': true, 'set': _$set_640, 'get': _$get_639 }); /** * Symbols size. When retrieved, the returned value is always an `array`. * * @name symbolsSize * @memberof Plot.prototype * @type {(NonNegativeInteger|NonNegativeIntegerArray)} * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @default 6 * * @example * var plot = new Plot(); * plot.symbolsSize = 4; * * @example * var plot = new Plot({ * 'symbolsSize': [ 4, 6 ] * }); * var size = plot.symbolsSize; * // returns [ 4, 6 ] */ _$defineProperty_825( Plot.prototype, 'symbolsSize', { 'configurable': false, 'enumerable': true, 'set': _$set_638, 'get': _$get_637 }); /** * Symbols opacity. When retrieved, the returned value is always an `array`. * * @name symbolsOpacity * @memberof Plot.prototype * @type {(number|NumberArray)} * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.9 * * @example * var plot = new Plot(); * plot.symbolsOpacity = [ 0.2, 0.5 ]; * * @example * var plot = new Plot({ * 'symbolsOpacity': 0.2 * }); * var opacity = plot.symbolsOpacity; * // returns [ 0.2 ] */ _$defineProperty_825( Plot.prototype, 'symbolsOpacity', { 'configurable': false, 'enumerable': true, 'set': _$set_636, 'get': _$get_635 }); /** * Plot width. * * @name width * @memberof Plot.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 (px) * * @example * var plot = new Plot(); * plot.width = 100; * * @example * var plot = new Plot({ * 'width': 480 * }); * var width = plot.width; * // returns 480 */ _$defineProperty_825( Plot.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_648, 'get': _$get_647 }); /** * Plot height. * * @name height * @memberof Plot.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 (px) * * @example * var plot = new Plot(); * plot.height = 100; * * @example * var plot = new Plot({ * 'height': 360 * }); * var height = plot.height; * // returns 360 */ _$defineProperty_825( Plot.prototype, 'height', { 'configurable': false, 'enumerable': true, 'set': _$set_612, 'get': _$get_611 }); /** * Plot left padding. * * ## Notes * * - Typically used to create space for a left-oriented y-axis. * * @name paddingLeft * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 90 (px) * * @example * var plot = new Plot(); * plot.paddingLeft = 100; * * @example * var plot = new Plot({ * 'paddingLeft': 100 * }); * var padding = plot.paddingLeft; * // returns 100 */ _$defineProperty_825( Plot.prototype, 'paddingLeft', { 'configurable': false, 'enumerable': true, 'set': _$set_627, 'get': _$get_626 }); /** * Plot right padding. * * ## Notes * * - Typically used to create space for a right-oriented y-axis. * * @name paddingRight * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 20 (px) * * @example * var plot = new Plot(); * plot.paddingRight = 100; * * @example * var plot = new Plot({ * 'paddingRight': 100 * }); * var padding = plot.paddingRight; * // returns 100 */ _$defineProperty_825( Plot.prototype, 'paddingRight', { 'configurable': false, 'enumerable': true, 'set': _$set_629, 'get': _$get_628 }); /** * Plot top padding. * * ## Notes * * - Typically used to create space for a title or top-oriented x-axis. * * @name paddingTop * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 80 (px) * * @example * var plot = new Plot(); * plot.paddingTop = 100; * * @example * var plot = new Plot({ * 'paddingTop': 100 * }); * var padding = plot.paddingTop; * // returns 100 */ _$defineProperty_825( Plot.prototype, 'paddingTop', { 'configurable': false, 'enumerable': true, 'set': _$set_631, 'get': _$get_630 }); /** * Plot bottom padding. * * ## Notes * * - Typically used to create space for a bottom-oriented y-axis. * * @name paddingBottom * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 80 (px) * * @example * var plot = new Plot(); * plot.paddingBottom = 100; * * @example * var plot = new Plot({ * 'paddingBottom': 100 * }); * var padding = plot.paddingBottom; * // returns 100 */ _$defineProperty_825( Plot.prototype, 'paddingBottom', { 'configurable': false, 'enumerable': true, 'set': _$set_625, 'get': _$get_624 }); /** * Minimum value of the x-axis domain. * * ## Notes * * - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. * * @name xMin * @memberof Plot.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * @default null * * @example * var plot = new Plot(); * plot.xMin = -1.0; * * @example * var plot = new Plot({ * 'xMin': -10.0 * }); * var xmin = plot.xMin; * // returns -10.0 */ _$defineProperty_825( Plot.prototype, 'xMin', { 'configurable': false, 'enumerable': true, 'set': _$set_658, 'get': _$get_657 }); /** * Maximum value of the x-axis domain. * * ## Notes * * - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. * * @name xMax * @memberof Plot.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * @default null * * @example * var plot = new Plot(); * plot.xMax = 100.0; * * @example * var plot = new Plot({ * 'xMax': 10.0 * }); * var xmax = plot.xMax; * // returns 10.0 */ _$defineProperty_825( Plot.prototype, 'xMax', { 'configurable': false, 'enumerable': true, 'set': _$set_656, 'get': _$get_655 }); /** * Minimum value of the y-axis domain. * * ## Notes * * - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. * * @name yMin * @memberof Plot.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * @default null * * @example * var plot = new Plot(); * plot.yMin = -100.0; * * @example * var plot = new Plot({ * 'yMin': 3.14 * }); * var ymin = plot.yMin; * // returns 3.14 */ _$defineProperty_825( Plot.prototype, 'yMin', { 'configurable': false, 'enumerable': true, 'set': _$set_687, 'get': _$get_686 }); /** * Maximum value of the y-axis domain. * * ## Notes * * - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. * * @name yMax * @memberof Plot.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * @default null * * @example * var plot = new Plot(); * plot.yMax = 100.0; * * @example * var plot = new Plot({ * 'yMax': 31.4 * }); * var ymax = plot.yMax; * // returns 31.4 */ _$defineProperty_825( Plot.prototype, 'yMax', { 'configurable': false, 'enumerable': true, 'set': _$set_685, 'get': _$get_684 }); /** * Scale function for mapping values to a coordinate along the x-axis. When retrieved, the returned value is a scale function. * * @name xScale * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'linear' * * @example * var plot = new Plot(); * plot.xScale = 'time'; * * @example * var plot = new Plot({ * 'xScale': 'time' * }); * var scale = plot.xScale; * // returns */ _$defineProperty_825( Plot.prototype, 'xScale', { 'configurable': false, 'enumerable': true, 'get': _$get_672, 'set': _$set_673 }); /** * Scale function for mapping values to a coordinate along the y-axis. When retrieved, the returned value is a scale function. * * @name yScale * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'linear' * * @example * var plot = new Plot(); * plot.yScale = 'linear'; * * @example * var plot = new Plot({ * 'yScale': 'linear' * }); * var scale = plot.yScale; * // returns */ _$defineProperty_825( Plot.prototype, 'yScale', { 'configurable': false, 'enumerable': true, 'get': _$get_701, 'set': _$set_702 }); /** * x-axis tick format. * * ## Notes * * - When retrieved, if the value is not `null`, the returned value is a formatting function. * * @name xTickFormat * @memberof Plot.prototype * @type {(string|null)} * @throws {TypeError} must be a string primitive or null * @default null * * @example * var plot = new Plot(); * plot.xScale = 'time'; * plot.xTickFormat = '%H:%M'; * * @example * var plot = new Plot({ * 'xScale': 'time', * 'xTickFormat': '%H:%M' * }); * var fmt = plot.xTickFormat; * // returns */ _$defineProperty_825( Plot.prototype, 'xTickFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_675, 'get': _$get_674 }); /** * y-axis tick format. * * ## Notes * * - If the value is not `null`, when retrieved, the returned value is a formatting function. * * @name yTickFormat * @memberof Plot.prototype * @type {(string|null)} * @throws {TypeError} must be a string primitive or null * @default null * * @example * var plot = new Plot(); * plot.yTickFormat = '.0%'; * * @example * var plot = new Plot({ * 'yTickFormat': '.0%' * }); * var fmt = plot.yTickFormat; * // returns */ _$defineProperty_825( Plot.prototype, 'yTickFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_704, 'get': _$get_703 }); /** * Number of x-axis tick marks. * * @name xNumTicks * @memberof Plot.prototype * @type {(NonNegativeInteger|null)} * @throws {TypeError} must be a nonnegative integer or null * @default 5 * * @example * var plot = new Plot(); * plot.xNumTicks = 10; * * @example * var plot = new Plot({ * 'xNumTicks': 10 * }); * var ticks = plot.xNumTicks; * // returns 10 */ _$defineProperty_825( Plot.prototype, 'xNumTicks', { 'configurable': false, 'enumerable': true, 'set': _$set_660, 'get': _$get_659 }); /** * Number of y-axis tick marks. * * @name yNumTicks * @memberof Plot.prototype * @type {(NonNegativeInteger|null)} * @throws {TypeError} must be a nonnegative integer or null * @default 5 * * @example * var plot = new Plot(); * plot.yNumTicks = 10; * * @example * var plot = new Plot({ * 'yNumTicks': 10 * }); * var ticks = plot.yNumTicks; * // returns 10 */ _$defineProperty_825( Plot.prototype, 'yNumTicks', { 'configurable': false, 'enumerable': true, 'set': _$set_689, 'get': _$get_688 }); /** * x-axis orientation. * * @name xAxisOrient * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be either `'top'` or `'bottom'` * @default 'bottom' * * @example * var plot = new Plot(); * plot.xAxisOrient = 'bottom'; * * @example * var plot = new Plot({ * 'xAxisOrient': 'bottom' * }); * var orientation = plot.xAxisOrient; * // returns 'bottom' */ _$defineProperty_825( Plot.prototype, 'xAxisOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_651, 'get': _$get_649 }); /** * y-axis orientation. * * @name yAxisOrient * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be either `'left'` or `'right'` * @default 'left' * * @example * var plot = new Plot(); * plot.yAxisOrient = 'left'; * * @example * var plot = new Plot({ * 'yAxisOrient': 'left' * }); * var orientation = plot.yAxisOrient; * // returns 'left' */ _$defineProperty_825( Plot.prototype, 'yAxisOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_680, 'get': _$get_678 }); /** * Boolean flag(s) indicating whether to display a rug plot along the x-axis. When retrieved, the returned value is always an `array`. * * @name xRug * @memberof Plot.prototype * @type {(boolean|BooleanArray)} * @throws {TypeError} must be a boolean primitive or boolean array * @default false * * @example * var plot = new Plot({ * 'xRug': true * }); * * var bool = plot.xRug; * // returns [ true ] */ _$defineProperty_825( Plot.prototype, 'xRug', { 'configurable': false, 'enumerable': true, 'set': _$set_671, 'get': _$get_670 }); /** * Boolean flag(s) indicating whether to display a rug plot along the y-axis. When retrieved, the returned value is always an `array`. * * @name yRug * @memberof Plot.prototype * @type {(boolean|BooleanArray)} * @throws {TypeError} must be a boolean primitive or boolean array * @default false * * @example * var plot = new Plot({ * 'yRug': true * }); * * var bool = plot.yRug; * // returns [ true ] */ _$defineProperty_825( Plot.prototype, 'yRug', { 'configurable': false, 'enumerable': true, 'set': _$set_700, 'get': _$get_699 }); /** * x-axis rug orientation. When retrieved, the returned value is always an `array`. * * @name xRugOrient * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be a string or string array * @throws {TypeError} must be either `'top'` or `'bottom'` * @default 'bottom' * * @example * var plot = new Plot(); * plot.xRugOrient = [ 'bottom', 'top' ]; * * @example * var plot = new Plot({ * 'xRugOrient': 'bottom' * }); * var orientation = plot.xRugOrient; * // returns [ 'bottom' ] */ _$defineProperty_825( Plot.prototype, 'xRugOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_667, 'get': _$get_665 }); /** * y-axis rug orientation. When retrieved, the returned value is always an `array`. * * @name yRugOrient * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be a string or string array * @throws {TypeError} must be either `'left'` or `'right'` * @default 'left' * * @example * var plot = new Plot(); * plot.yRugOrient = [ 'right', 'left' ]; * * @example * var plot = new Plot({ * 'yRugOrient': 'left' * }); * var orientation = plot.yRugOrient; * // returns [ 'left' ] */ _$defineProperty_825( Plot.prototype, 'yRugOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_696, 'get': _$get_694 }); /** * x-axis rug opacity. When retrieved, the returned value is always an `array`. * * @name xRugOpacity * @memberof Plot.prototype * @type {(number|NumberArray)} * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.1 * * @example * var plot = new Plot(); * plot.xRugOpacity = [ 0.1, 0.5 ]; * * @example * var plot = new Plot({ * 'xRugOpacity': 0.1 * }); * var opacity = plot.xRugOpacity; * // returns [ 0.1 ] */ _$defineProperty_825( Plot.prototype, 'xRugOpacity', { 'configurable': false, 'enumerable': true, 'set': _$set_664, 'get': _$get_663 }); /** * y-axis rug opacity. When retrieved, the returned value is always an `array`. * * @name yRugOpacity * @memberof Plot.prototype * @type {(number|NumberArray)} * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @default 0.1 * * @example * var plot = new Plot(); * plot.yRugOpacity = [ 0.1, 0.5 ]; * * @example * var plot = new Plot({ * 'yRugOpacity': 0.1 * }); * var opacity = plot.yRugOpacity; * // returns [ 0.1 ] */ _$defineProperty_825( Plot.prototype, 'yRugOpacity', { 'configurable': false, 'enumerable': true, 'set': _$set_693, 'get': _$get_692 }); /** * x-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`. * * @name xRugSize * @memberof Plot.prototype * @type {(NonNegativeInteger|Array)} * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @default 6 * * @example * var plot = new Plot(); * plot.xRugSize = [ 4, 6 ]; * * @example * var plot = new Plot({ * 'xRugSize': 4 * }); * var size = plot.xRugSize; * // returns [ 4 ] */ _$defineProperty_825( Plot.prototype, 'xRugSize', { 'configurable': false, 'enumerable': true, 'set': _$set_669, 'get': _$get_668 }); /** * y-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`. * * @name yRugSize * @memberof Plot.prototype * @type {(NonNegativeInteger|Array)} * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @default 6 * * @example * var plot = new Plot(); * plot.yRugSize = [ 4, 6 ]; * * @example * var plot = new Plot({ * 'yRugSize': 4 * }); * var size = plot.yRugSize; * // returns [ 4 ] */ _$defineProperty_825( Plot.prototype, 'yRugSize', { 'configurable': false, 'enumerable': true, 'set': _$set_698, 'get': _$get_697 }); /** * Plot description. * * @name description * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '' * * @example * var plot = new Plot(); * plot.description = 'Average stock market index covering the last 100 years.'; * * @example * var plot = new Plot({ * 'description': 'A plot description.' * }); * var desc = plot.description; * // returns 'A plot description.' */ _$defineProperty_825( Plot.prototype, 'description', { 'configurable': false, 'enumerable': true, 'set': _$set_605, 'get': _$get_604 }); /** * Plot title. * * @name title * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '' * * @example * var plot = new Plot(); * plot.title = 'Time Series'; * * @example * var plot = new Plot({ * 'title': 'Time Series' * }); * var t = plot.title; * // returns 'Time Series' */ _$defineProperty_825( Plot.prototype, 'title', { 'configurable': false, 'enumerable': true, 'set': _$set_643, 'get': _$get_642 }); /** * x-axis label. * * @name xLabel * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'x' * * @example * var plot = new Plot(); * plot.xLabel = 'time'; * * @example * var plot = new Plot({ * 'xLabel': 'time' * }); * var xLabel = plot.xLabel; * // returns 'time' */ _$defineProperty_825( Plot.prototype, 'xLabel', { 'configurable': false, 'enumerable': true, 'set': _$set_654, 'get': _$get_653 }); /** * y-axis label. * * @name yLabel * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'y' * * @example * var plot = new Plot(); * plot.yLabel = 'value'; * * @example * var plot = new Plot({ * 'yLabel': 'value' * }); * var yLabel = plot.yLabel; * // returns 'value' */ _$defineProperty_825( Plot.prototype, 'yLabel', { 'configurable': false, 'enumerable': true, 'set': _$set_683, 'get': _$get_682 }); /** * Plot engine. * * @name engine * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized engine * @default 'svg' * * @example * var plot = new Plot(); * plot.engine = 'svg'; * * @example * var plot = new Plot({ * 'engine': 'svg' * }); * var engine = plot.engine; * // returns 'svg' */ _$defineProperty_825( Plot.prototype, 'engine', { 'configurable': false, 'enumerable': true, 'set': _$set_608, 'get': _$get_607 }); /** * Rendering mode. * * ## Notes * * - If `true`, an instance re-renders on each change event. * * @name autoRender * @memberof Plot.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var plot = new Plot({ * 'autoRender': true * }); * * var mode = plot.autoRender; * // returns true */ _$defineProperty_825( Plot.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_598, 'get': _$get_597 }); /** * Plot render format. * * @name renderFormat * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized format * @default 'vdom' * * @example * var plot = new Plot(); * plot.renderFormat = 'vdom'; * * @example * var plot = new Plot({ * 'renderFormat': 'html' * }); * var fmt = plot.renderFormat; * // returns 'html' */ _$defineProperty_825( Plot.prototype, 'renderFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_634, 'get': _$get_633 }); /** * Plot viewer. * * @name viewer * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized viewer * @default 'none' * * @example * var plot = new Plot(); * plot.viewer = 'none'; * * @example * var plot = new Plot({ * 'viewer': 'none' * }); * var viewer = plot.viewer; * // returns 'none' */ _$defineProperty_825( Plot.prototype, 'viewer', { 'configurable': false, 'enumerable': true, 'set': _$set_645, 'get': _$get_644 }); /** * Viewer mode. If `true`, an instance generates an updated view on each render event. * * @name autoView * @memberof Plot.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var plot = new Plot({ * 'autoView': false * }); * * var mode = plot.autoView; * // returns false */ _$defineProperty_825( Plot.prototype, 'autoView', { 'configurable': false, 'enumerable': true, 'set': _$set_600, 'get': _$get_599 }); /** * Expected graph width. * * @name graphWidth * @memberof Plot.prototype * @type {number} * * @example * var plot = new Plot({ * 'width': 100, * 'paddingLeft': 10, * 'paddingRight': 10 * }); * var width = plot.graphWidth; * // returns 80 */ _$defineProperty_825( Plot.prototype, 'graphWidth', { 'configurable': false, 'enumerable': true, 'get': _$get_610 }); /** * Expected graph height. * * @name graphHeight * @memberof Plot.prototype * @type {number} * * @example * var plot = new Plot({ * 'height': 100, * 'paddingTop': 10, * 'paddingBottom': 20 * }); * var height = plot.graphHeight; * // returns 70 */ _$defineProperty_825( Plot.prototype, 'graphHeight', { 'configurable': false, 'enumerable': true, 'get': _$get_609 }); /** * x-axis domain. * * @name xDomain * @memberof Plot.prototype * @type {Array} * * @example * var plot = new Plot({ * 'xMin': 0, * 'xMax': 100 * }); * var domain = plot.xDomain; * // returns [ 0, 100 ] */ _$defineProperty_825( Plot.prototype, 'xDomain', { 'configurable': false, 'enumerable': true, 'get': _$get_652 }); /** * y-axis domain. * * @name yDomain * @memberof Plot.prototype * @type {NumberArray} * * @example * var plot = new Plot({ * 'yMin': 0, * 'yMax': 100 * }); * var domain = plot.yDomain; * // returns [ 0, 100 ] */ _$defineProperty_825( Plot.prototype, 'yDomain', { 'configurable': false, 'enumerable': true, 'get': _$get_681 }); /** * x-axis range. * * @name xRange * @memberof Plot.prototype * @type {NumberArray} * * @example * var plot = new Plot({ * 'width': 100, * 'paddingLeft': 10, * 'paddingRight': 10 * }); * var range = plot.xRange; * // returns [ 0, 80 ] */ _$defineProperty_825( Plot.prototype, 'xRange', { 'configurable': false, 'enumerable': true, 'get': _$get_662 }); /** * y-axis range. * * @name yRange * @memberof Plot.prototype * @type {NumberArray} * * @example * var plot = new Plot({ * 'height': 100, * 'paddingTop': 10, * 'paddingBottom': 20 * }); * var range = plot.yRange; * // returns [ 70, 0 ] */ _$defineProperty_825( Plot.prototype, 'yRange', { 'configurable': false, 'enumerable': true, 'get': _$get_691 }); /** * Function to map values to x-axis coordinate values. * * @name xPos * @memberof Plot.prototype * @type {Function} * * @example * var plot = new Plot(); * var xPos = plot.xPos; * // returns */ _$defineProperty_825( Plot.prototype, 'xPos', { 'configurable': false, 'enumerable': true, 'get': _$get_661 }); /** * Function to map values to y-axis coordinate values. * * @name yPos * @memberof Plot.prototype * @type {Function} * * @example * var plot = new Plot(); * var yPos = plot.yPos; * // returns */ _$defineProperty_825( Plot.prototype, 'yPos', { 'configurable': false, 'enumerable': true, 'get': _$get_690 }); /** * Renders a plot. * * @name render * @memberof Plot.prototype * @type {Function} * @param {string} [format] - render format * @throws {TypeError} must provide a recognized format * @returns {(VTree|string)} virtual tree or string * * @example * var plot = new Plot(); * plot.x = [ [ 1, 2, 3 ] ]; * plot.y = [ [ 1, 0, 1 ] ]; * * var out = plot.render(); * * @example * var plot = new Plot(); * plot.x = [ [ 1, 2, 3 ] ]; * plot.y = [ [ 1, 0, 1 ] ]; * * var out = plot.render( 'html' ); */ _$setReadOnly_827( Plot.prototype, 'render', _$render_707 ); /** * Generates a plot view. * * @name view * @memberof Plot.prototype * @type {Function} * @param {string} [viewer] * @throws {TypeError} must provide a recognized viewer * * @example * var plot = new Plot(); * plot.x = [ [ 1, 2, 3 ] ]; * plot.y = [ [ 1, 0, 1 ] ]; * * plot.view( 'stdout' ); */ _$setReadOnly_827( Plot.prototype, 'view', _$view_723 ); // EXPORTS // var _$Plot_596 = Plot; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; /* removed: var _$Plot_596 = require( './main.js' ); */; // MAIN // /** * Returns a reusable function for generating plots. * * @param {Options} [options] - factory options * TODO * @throws {TypeError} must provide an object * @returns {Function} plot function * * @example * var opts = { * 'width': 600, * 'height': 400 * }; * var plot = factory( opts ); * var h1 = plot( [[1,2,3]], [[1,0,1]] ); * var h2 = plot( [[4,5,6]], [[0,1,0]] ); */ function __factory_594( options ) { var opts; if ( arguments.length ) { if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. `options` argument must be a plain object. Value: `' + options + '`' ); } opts = _$copy_816( options ); } else { opts = {}; } return plot; /** * Creates a plot. * * @private * @param {Array} [x] - x-values * @param {Array} [y] - y-values * @throws {TypeError} must provide valid options * @returns {Plot} plot instance */ function plot( x, y ) { if ( arguments.length === 2 ) { return new _$Plot_596( x, y, opts ); } return new _$Plot_596( opts ); } } // EXPORTS // var _$factory_594 = __factory_594; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a 2-dimensional plot. * * @module @stdlib/plot/ctor * * @example * var Plot = require( '@stdlib/plot/ctor' ); * * var x = [ 1, 2, 3 ]; * var y = [ 1, 0, 1 ]; * * var p = new Plot( [ x ], [ y ] ); * * @example * var Plot = require( '@stdlib/plot/ctor' ); * * var opts = { * 'width': 600, * 'height': 400 * }; * var myPlot = Plot.factory( opts ); * * var h1 = myPlot( [[1,2,3]], [[1,0,1]] ); * var h2 = myPlot( [[4,5,6]], [[0,1,0]] ); */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$Plot_596 = require( './main.js' ); */; /* removed: var _$factory_594 = require( './factory.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$Plot_596, 'factory', _$factory_594 ); // EXPORTS // var _$Plot_595 = _$Plot_596; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Plot. * * @module @stdlib/plot * * @example * var plot = require( '@stdlib/plot' ); * * var x = [ 1, 2, 3 ]; * var y = [ 1, 0, 1 ]; * * var plt = plot( [ x ], [ y ] ); */ // MODULES // /* removed: var _$Plot_595 = require( '@stdlib/plot/ctor' ); */; // EXPORTS // var _$plot_726 = _$Plot_595; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$f_134 = require( '@stdlib/assert/is-node-repl' ); */; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_257() { var isREPL; var o; isREPL = _$f_134(); o = {}; // Boolean indicating whether to re-render on a change event: o.autoRender = false; // Boolean indicating whether to generate an updated view on a render event: o.autoView = false; // Plot description: o.description = ''; // Rendering engine: o.engine = 'svg'; // Plot height: o.height = 400; // px // Data labels: o.labels = []; // Line opacity: o.lineOpacity = 0.9; // [0,1] // Line style: o.lineStyle = '-'; // Data line width(s): o.lineWidth = 2; // px // FIXME: padding props depend on orientation (may require using `null` to flag) // Bottom padding: o.paddingBottom = 80; // px // Left padding: o.paddingLeft = 90; // px // Right padding: o.paddingRight = 20; // px // Top padding: o.paddingTop = 80; // px // Render format: o.renderFormat = 'vdom'; // Plot title: o.title = ''; // Plot viewer: if ( isREPL ) { o.viewer = 'window'; } else { o.viewer = 'none'; } // Plot width: o.width = 400; // px // x-axis orientation: o.xAxisOrient = 'bottom'; // x-axis label: o.xLabel = 'x'; // Maximum value of x-axis domain: o.xMax = null; // Minimum value of x-axis domain: o.xMin = null; // Number of x-axis tick marks: o.xNumTicks = 5; // x-axis tick format: o.xTickFormat = null; // y-axis orientation: o.yAxisOrient = 'left'; // y-axis label: o.yLabel = 'y'; // Maximum value of y-axis domain: o.yMax = null; // Minimum value of y-axis domain: o.yMin = null; // Number of y-axis tick marks: o.yNumTicks = 5; // y-axis tick format: o.yTickFormat = null; return o; } // EXPORTS // var _$defaults_257 = __defaults_257; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_261 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_261 = _$browser_913( 'plot:base:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a boolean primitive */ function __set_261( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_261( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoRender ) { __debug_261( 'Current value: %s.', this._autoRender ); this._autoRender = bool; __debug_261( 'New Value: %s.', this._autoRender ); this.emit( 'change' ); } } // EXPORTS // var _$set_261 = __set_261; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_263 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_263 = _$browser_913( 'plot:base:set:auto-view' ); // MAIN // /** * Sets the viewing mode. * * @private * @param {boolean} bool - boolean indicating whether to generate an updated view on a render event * @throws {TypeError} must be a boolean primitive */ function __set_263( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_263( bool ) ) { throw new TypeError( 'invalid value. `autoView` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoView ) { __debug_263( 'Current value: %s.', this._autoView ); this._autoView = bool; __debug_263( 'New Value: %s.', this._autoView ); this.emit( 'change' ); } } // EXPORTS // var _$set_263 = __set_263; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_265 = _$isString_164.isPrimitive; // VARIABLES // var __debug_265 = _$browser_913( 'plot:base:set:description' ); // MAIN // /** * Sets the description. * * @private * @param {string} str - description * @throws {TypeError} must be a string primitive */ function __set_265( str ) { /* eslint-disable no-invalid-this */ if ( !__isString_265( str ) ) { throw new TypeError( 'invalid value. `description` must be a string. Value: `' + str + '.`' ); } if ( str !== this._description ) { __debug_265( 'Current value: %s.', this._description ); this._description = str; __debug_265( 'New value: %s.', this._description ); this.emit( 'change' ); } } // EXPORTS // var _$set_265 = __set_265; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$contains_33 = require( '@stdlib/assert/contains' ); */; /* removed: var _$engines_266 = require( './engines.json' ); */; // VARIABLES // var __debug_268 = _$browser_913( 'plot:base:set:engine' ); // MAIN // /** * Sets the engine. * * @private * @param {string} engine - engine * @throws {TypeError} must be a recognized engine */ function __set_268( engine ) { /* eslint-disable no-invalid-this */ if ( !_$contains_33( _$engines_266, engine ) ) { throw new TypeError( 'invalid value. `engine` must be one of `[' + _$engines_266.join( ', ' ) + ']`. Value: `' + engine + '.`' ); } if ( engine !== this._engine ) { __debug_268( 'Current value: %s.', this._engine ); this._engine = engine; __debug_268( 'New value: %s.', this._engine ); this.emit( 'change' ); } } // EXPORTS // var _$set_268 = __set_268; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the render engine. * * @private * @returns {string} engine */ function __get_267() { /* eslint-disable no-invalid-this */ return this._engine; } // EXPORTS // var _$get_267 = __get_267; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isPositiveNumber_272 = _$isPositiveNumber_159.isPrimitive; // VARIABLES // var __debug_272 = _$browser_913( 'plot:base:set:height' ); // MAIN // /** * Sets the height. * * @private * @param {PositiveNumber} height - height * @throws {TypeError} must be a positive number */ function __set_272( height ) { /* eslint-disable no-invalid-this */ if ( !__isPositiveNumber_272( height ) ) { throw new TypeError( 'invalid value. `height` must be a positive number. Value: `' + height + '.`' ); } if ( height !== this._height ) { __debug_272( 'Current value: %d.', this._height ); this._height = height; __debug_272( 'New Value: %d.', this._height ); this.emit( 'change' ); } } // EXPORTS // var _$set_272 = __set_272; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isEmptyArray_96 = require( '@stdlib/assert/is-empty-array' ); */; var __isStringArray_274 = _$isStringArray_163.primitives; // VARIABLES // var __debug_274 = _$browser_913( 'plot:base:set:labels' ); // MAIN // /** * Sets the data labels. * * @private * @param {(StringArray|EmptyArray)} labels - data labels * @throws {TypeError} must be either an array of strings or an empty array */ function __set_274( labels ) { /* eslint-disable no-invalid-this */ if ( !_$isEmptyArray_96( labels ) && !__isStringArray_274( labels ) ) { throw new TypeError( 'invalid value. `labels` must be either an array of strings or an empty array. Value: `' + labels + '.`' ); } __debug_274( 'Current value: %s.', JSON.stringify( this._labels ) ); this._labels = labels.slice(); __debug_274( 'New Value: %s.', JSON.stringify( this._labels ) ); this.emit( 'change' ); } // EXPORTS // var _$set_274 = __set_274; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNumber_276 = _$isNumber_143.isPrimitive; var __isNumberArray_276 = _$isNumberArray_142.primitives; // VARIABLES // var __debug_276 = _$browser_913( 'plot:base:set:line-opacity' ); // MAIN // /** * Sets the line opacity. * * @private * @param {(number|NumberArray)} v - opacity * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` */ function __set_276( v ) { /* eslint-disable no-invalid-this */ var isNum = __isNumber_276( v ); var i; if ( !isNum && !__isNumberArray_276( v ) ) { throw new TypeError( 'invalid value. `lineOpacity` must be a number or number array. Value: `' + v + '.`' ); } if ( isNum ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { throw new RangeError( 'invalid value. A `lineOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' ); } } __debug_276( 'Current value: %s.', JSON.stringify( this._lineOpacity ) ); this._lineOpacity = v; __debug_276( 'New Value: %s.', JSON.stringify( this._lineOpacity ) ); this.emit( 'change' ); } // EXPORTS // var _$set_276 = __set_276; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the line opacity. * * @private * @returns {NumberArray} line opacity */ function __get_275() { /* eslint-disable no-invalid-this */ return this._lineOpacity.slice(); } // EXPORTS // var _$get_275 = __get_275; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_279 = _$isString_164.isPrimitive; var __isStringArray_279 = _$isStringArray_163.primitives; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$line_styles_278 = require( './line_styles.json' ); */; // VARIABLES // var __debug_279 = _$browser_913( 'plot:base:set:line-style' ); // MAIN // /** * Sets the line style(s). * * @private * @param {(string|StringArray)} v - line style(s) * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported line style */ function __set_279( v ) { /* eslint-disable no-invalid-this */ var isStr = __isString_279( v ); var i; if ( !isStr && !__isStringArray_279( v ) ) { throw new TypeError( 'invalid value. `lineStyle` must be a string or a string array. Value: `'+v+'.`' ); } if ( isStr ) { v = [ v ]; } else { v = v.slice(); } for ( i = 0; i < v.length; i++ ) { if ( _$indexOf_843( _$line_styles_278, v[i] ) === -1 ) { throw new Error( 'invalid value. Unsupported/unrecognized line style. Must be one of `['+_$line_styles_278.join(',')+']`. Value: `'+v[i]+'`.' ); } } __debug_279( 'Current value: %s.', JSON.stringify( this._lineStyle ) ); this._lineStyle = v; __debug_279( 'New Value: %s.', JSON.stringify( this._lineStyle ) ); this.emit( 'change' ); } // EXPORTS // var _$set_279 = __set_279; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the line style(s). * * @private * @returns {StringArray} line style(s) */ function __get_277() { /* eslint-disable no-invalid-this */ return this._lineStyle.slice(); } // EXPORTS // var _$get_277 = __get_277; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_281 = _$isNonNegativeInteger_136.isPrimitive; var __isNonNegativeIntegerArray_281 = _$isNonNegativeIntegerArray_135.primitives; // VARIABLES // var __debug_281 = _$browser_913( 'plot:base:set:line-width' ); // MAIN // /** * Sets the line width(s). * * @private * @param {(NonNegativeInteger|Array)} v - width * @throws {TypeError} must be a nonnegative integer or nonnegative integer array */ function __set_281( v ) { /* eslint-disable no-invalid-this */ var isInt = __isNonNegativeInteger_281( v ); if ( !isInt && !__isNonNegativeIntegerArray_281( v ) ) { throw new TypeError( 'invalid value. `lineWidth` must be a nonnegative integer or nonnegative integer array. Value: `' + v + '.`' ); } if ( isInt ) { v = [ v ]; } else { v = v.slice(); } __debug_281( 'Current value: %s.', JSON.stringify( this._lineWidth ) ); this._lineWidth = v; __debug_281( 'New Value: %s.', JSON.stringify( this._lineWidth ) ); this.emit( 'change' ); } // EXPORTS // var _$set_281 = __set_281; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the line width. * * @private * @returns {Array} line width(s) */ function __get_280() { /* eslint-disable no-invalid-this */ return this._lineWidth.slice(); } // EXPORTS // var _$get_280 = __get_280; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_283 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_283 = _$browser_913( 'plot:base:set:padding-bottom' ); // MAIN // /** * Sets the bottom padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_283( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_283( padding ) ) { throw new TypeError( 'invalid value. `paddingBottom` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingBottom ) { __debug_283( 'Current value: %d.', this._paddingBottom ); this._paddingBottom = padding; __debug_283( 'New value: %d.', this._paddingBottom ); this.emit( 'change' ); } } // EXPORTS // var _$set_283 = __set_283; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_285 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_285 = _$browser_913( 'plot:base:set:padding-left' ); // MAIN // /** * Sets the left padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_285( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_285( padding ) ) { throw new TypeError( 'invalid value. `paddingLeft` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingLeft ) { __debug_285( 'Current value: %d.', this._paddingLeft ); this._paddingLeft = padding; __debug_285( 'New value: %d.', this._paddingLeft ); this.emit( 'change' ); } } // EXPORTS // var _$set_285 = __set_285; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_287 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_287 = _$browser_913( 'plot:base:set:padding-right' ); // MAIN // /** * Sets the right padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_287( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_287( padding ) ) { throw new TypeError( 'invalid value. `paddingRight` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingRight ) { __debug_287( 'Current value: %d.', this._paddingRight ); this._paddingRight = padding; __debug_287( 'New value: %d.', this._paddingRight ); this.emit( 'change' ); } } // EXPORTS // var _$set_287 = __set_287; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isNonNegativeInteger_289 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_289 = _$browser_913( 'plot:base:set:padding-top' ); // MAIN // /** * Sets the top padding. * * @private * @param {NonNegativeInteger} padding - padding * @throws {TypeError} must be a nonnegative integer */ function __set_289( padding ) { /* eslint-disable no-invalid-this */ if ( !__isNonNegativeInteger_289( padding ) ) { throw new TypeError( 'invalid value. `paddingTop` must be a nonnegative integer. Value: `' + padding + '.`' ); } if ( padding !== this._paddingTop ) { __debug_289( 'Current value: %d.', this._paddingTop ); this._paddingTop = padding; __debug_289( 'New value: %d.', this._paddingTop ); this.emit( 'change' ); } } // EXPORTS // var _$set_289 = __set_289; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_324 = _$browser_913( 'plot:base:render' ); // MAIN // /** * Renders a plot. * * @private * @param {string} [format] - render format * @returns {(VTree|string)} virtual tree or a string */ function __render_324( format ) { /* eslint-disable no-invalid-this */ var out; var tmp; var fmt; tmp = this.renderFormat; if ( arguments.length ) { // Temporarily set the render format: this.renderFormat = format; fmt = format; } else { fmt = tmp; } __debug_324( 'Render format: %s.', this.renderFormat ); __debug_324( 'Rendering...' ); out = this._render( fmt ); this.emit( 'render', out ); if ( arguments.length ) { // Restore the render format: this.renderFormat = tmp; } return out; } // EXPORTS // var _$render_324 = __render_324; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Placeholder `render` function. * * @private * @param {string} fmt - render format * @throws {Error} must be implemented by descendant classes */ function __render_325() { throw new Error( 'method not implemented.' ); } // EXPORTS // var _$render_325 = __render_325; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$formats_290 = require( './formats.json' ); */; // VARIABLES // var __debug_292 = _$browser_913( 'plot:base:set:render-format' ); // MAIN // /** * Sets the render format. * * @private * @param {string} format - format * @throws {TypeError} must be a recognized render format */ function __set_292( format ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$formats_290, format ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported `format`. Must be one of `[' + _$formats_290.join( ', ' ) + ']`. Value: `' + format + '.`' ); } if ( format !== this._renderFormat ) { __debug_292( 'Current value: %s.', this._renderFormat ); this._renderFormat = format; __debug_292( 'New value: %s.', this._renderFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_292 = __set_292; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_294 = _$isString_164.isPrimitive; // VARIABLES // var __debug_294 = _$browser_913( 'plot:base:set:title' ); // MAIN // /** * Sets the title. * * @private * @param {string} str - title * @throws {TypeError} must be a string primitive */ function __set_294( str ) { /* eslint-disable no-invalid-this */ if ( !__isString_294( str ) ) { throw new TypeError( 'invalid value. `title` must be a string. Value: `' + str + '.`' ); } if ( str !== this._title ) { __debug_294( 'Current value: %s.', this._title ); this._title = str; __debug_294( 'New value: %s.', this._title ); this.emit( 'change' ); } } // EXPORTS // var _$set_294 = __set_294; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$viewers_297 = require( './viewers.json' ); */; // VARIABLES // var __debug_296 = _$browser_913( 'plot:base:set:viewer' ); // MAIN // /** * Sets the viewer. * * @private * @param {string} viewer - viewer * @throws {TypeError} must be a recognized viewer */ function __set_296( viewer ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$viewers_297, viewer ) === -1 ) { throw new TypeError( 'invalid value. Unrecognized/unsupported `viewer`. Value: `' + viewer + '.`' ); } if ( viewer !== this._viewer ) { __debug_296( 'Current value: %s.', this._viewer ); this._viewer = viewer; __debug_296( 'New value: %s.', this._viewer ); this.emit( 'change' ); } } // EXPORTS // var _$set_296 = __set_296; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isPositiveNumber_299 = _$isPositiveNumber_159.isPrimitive; // VARIABLES // var __debug_299 = _$browser_913( 'plot:base:set:width' ); // MAIN // /** * Sets the width. * * @private * @param {PositiveNumber} width - width * @throws {TypeError} must be a positive number */ function __set_299( width ) { /* eslint-disable no-invalid-this */ if ( !__isPositiveNumber_299( width ) ) { throw new TypeError( 'invalid value. `width` must be a positive number. Value: `' + width + '.`' ); } if ( width !== this._width ) { __debug_299( 'Current value: %d.', this._width ); this._width = width; __debug_299( 'New value: %d.', this._width ); this.emit( 'change' ); } } // EXPORTS // var _$set_299 = __set_299; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_301 = require( './orientations.json' ); */; // VARIABLES // var __debug_302 = _$browser_913( 'plot:base:set:x-axis-orient' ); // MAIN // /** * Sets the x-axis orientation. * * @private * @param {string} orientation - axis orientation * @throws {TypeError} must be either `'bottom'` or `'top'` */ function __set_302( orientation ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$orientations_301, orientation ) === -1 ) { throw new TypeError( 'invalid value. `xAxisOrient` must be one of `[' + _$orientations_301.join( ', ' ) + ']`. Value: `' + orientation + '.`' ); } if ( orientation !== this._xAxisOrient ) { __debug_302( 'Current value: %s.', this._xAxisOrient ); this._xAxisOrient = orientation; __debug_302( 'New value: %s.', this._xAxisOrient ); this.emit( 'change' ); } } // EXPORTS // var _$set_302 = __set_302; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_305 = _$isString_164.isPrimitive; // VARIABLES // var __debug_305 = _$browser_913( 'plot:base:set:x-label' ); // MAIN // /** * Sets the x-axis label. * * @private * @param {string} label - axis label * @throws {TypeError} must be a string primitive */ function __set_305( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_305( label ) ) { throw new TypeError( 'invalid value. `xLabel` must be a string. Value: `' + label + '.`' ); } if ( label !== this._xLabel ) { __debug_305( 'Current value: %s.', this._xLabel ); this._xLabel = label; __debug_305( 'New value: %s.', this._xLabel ); this.emit( 'change' ); } } // EXPORTS // var _$set_305 = __set_305; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNonNegativeInteger_307 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_307 = _$browser_913( 'plot:base:set:x-num-ticks' ); // MAIN // /** * Sets the number of x-axis tick marks. * * @private * @param {(NonNegativeInteger|null)} ticks - number of ticks * @throws {TypeError} must be a nonnegative integer or null */ function __set_307( ticks ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( ticks ) && !__isNonNegativeInteger_307( ticks ) ) { throw new TypeError( 'invalid value. `xNumTicks` must be a nonnegative integer or null. Value: `' + ticks + '.`' ); } if ( ticks !== this._xNumTicks ) { __debug_307( 'Current value: %d.', this._xNumTicks ); this._xNumTicks = ticks; __debug_307( 'New value: %d.', this._xNumTicks ); this.emit( 'change' ); } } // EXPORTS // var _$set_307 = __set_307; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_308 = _$browser_913( 'plot:base:x-pos' ); // MAIN // /** * Returns a function to map values to x-axis coordinate values. * * @private * @returns {Function} map function */ function __get_308() { /* eslint-disable no-invalid-this */ var scale = this.xScale; return xPos; /** * Maps a value to a x-axis coordinate value. * * @private * @param {number} d - datum * @returns {number} pixel value */ function xPos( d ) { var px = scale( d ); __debug_308( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_308 = __get_308; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isString_311 = _$isString_164.isPrimitive; // VARIABLES // var __debug_311 = _$browser_913( 'plot:base:set:x-tick-format' ); // MAIN // /** * Sets the x-axis tick format. * * @private * @param {(string|null)} fmt - axis tick format * @throws {TypeError} must be a string primitive */ function __set_311( fmt ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( fmt ) && !__isString_311( fmt ) ) { throw new TypeError( 'invalid value. `xTickFormat` must be a string or null. Value: `' + fmt + '.`' ); } if ( fmt !== this._xTickFormat ) { __debug_311( 'Current value: %s.', this._xTickFormat ); this._xTickFormat = fmt; __debug_311( 'New value: %s.', this._xTickFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_311 = __set_311; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$indexOf_843 = require( '@stdlib/utils/index-of' ); */; /* removed: var _$orientations_313 = require( './orientations.json' ); */; // VARIABLES // var __debug_314 = _$browser_913( 'plot:base:set:y-axis-orient' ); // MAIN // /** * Sets the y-axis orientation. * * @private * @param {string} orientation - axis orientation * @throws {TypeError} must be either `'left'` or `'right'` */ function __set_314( orientation ) { /* eslint-disable no-invalid-this */ if ( _$indexOf_843( _$orientations_313, orientation ) === -1 ) { throw new TypeError( 'invalid value. `yAxisOrient` must be one of `[' + _$orientations_313.join( ', ' ) + ']`. Value: `' + orientation + '.`' ); } if ( orientation !== this._yAxisOrient ) { __debug_314( 'Current value: %s.', this._yAxisOrient ); this._yAxisOrient = orientation; __debug_314( 'New value: %s.', this._yAxisOrient ); this.emit( 'change' ); } } // EXPORTS // var _$set_314 = __set_314; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_317 = _$isString_164.isPrimitive; // VARIABLES // var __debug_317 = _$browser_913( 'plot:base:set:y-label' ); // MAIN // /** * Sets the y-axis label. * * @private * @param {string} label - axis label * @throws {TypeError} must be a string primitive */ function __set_317( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_317( label ) ) { throw new TypeError( 'invalid value. `yLabel` must be a string. Value: `' + label + '.`' ); } if ( label !== this._yLabel ) { __debug_317( 'Current value: %s.', this._yLabel ); this._yLabel = label; __debug_317( 'New value: %s.', this._yLabel ); this.emit( 'change' ); } } // EXPORTS // var _$set_317 = __set_317; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isNonNegativeInteger_319 = _$isNonNegativeInteger_136.isPrimitive; // VARIABLES // var __debug_319 = _$browser_913( 'plot:base:set:y-num-ticks' ); // MAIN // /** * Sets the number of y-axis tick marks. * * @private * @param {(NonNegativeInteger|null)} ticks - number of ticks * @throws {TypeError} must be a nonnegative integer or null */ function __set_319( ticks ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( ticks ) && !__isNonNegativeInteger_319( ticks ) ) { throw new TypeError( 'invalid value. `yNumTicks` must be a nonnegative integer or null. Value: `' + ticks + '.`' ); } if ( ticks !== this._yNumTicks ) { __debug_319( 'Current value: %d.', this._yNumTicks ); this._yNumTicks = ticks; __debug_319( 'New value: %d.', this._yNumTicks ); this.emit( 'change' ); } } // EXPORTS // var _$set_319 = __set_319; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_320 = _$browser_913( 'plot:base:y-pos' ); // MAIN // /** * Returns a function to map values to y-axis coordinate values. * * @private * @returns {Function} map function */ function __get_320() { /* eslint-disable no-invalid-this */ var scale = this.yScale; return yPos; /** * Maps a value to a y-axis coordinate value. * * @private * @param {number} d - datum * @returns {number} pixel value */ function yPos( d ) { var px = scale( d ); __debug_320( 'Value: %d => Pixel: %d.', d, px ); return px; } } // EXPORTS // var _$get_320 = __get_320; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; var __isString_323 = _$isString_164.isPrimitive; // VARIABLES // var __debug_323 = _$browser_913( 'plot:base:set:y-tick-format' ); // MAIN // /** * Sets the y-axis tick format. * * @private * @param {(string|null)} fmt - axis tick format * @throws {TypeError} must be a string primitive or null */ function __set_323( fmt ) { /* eslint-disable no-invalid-this */ if ( !_$isNull_140( fmt ) && !__isString_323( fmt ) ) { throw new TypeError( 'invalid value. `yTickFormat` must be a string or null. Value: `' + fmt + '.`' ); } if ( fmt !== this._yTickFormat ) { __debug_323( 'Current value: %s.', this._yTickFormat ); this._yTickFormat = fmt; __debug_323( 'New value: %s.', this._yTickFormat ); this.emit( 'change' ); } } // EXPORTS // var _$set_323 = __set_323; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __format_322 = _$d3Format_906.format; // TODO: remove /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // MAIN // /** * Returns the y-axis tick format. * * @private * @returns {(Function|null)} format function or null */ function __get_322() { /* eslint-disable no-invalid-this */ if ( _$isNull_140( this._yTickFormat ) ) { return this._yTickFormat; } return __format_322( this._yTickFormat ); } // EXPORTS // var _$get_322 = __get_322; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$view_328 = require( './view.js' ); */; // VARIABLES // var __debug_326 = _$browser_913( 'plot:base:view' ); // MAIN // /** * Generates a plot view. * * @private * @param {string} viewer - plot viewer */ function __view_326( viewer ) { /* eslint-disable no-invalid-this */ var tmp = this.viewer; if ( arguments.length ) { // Temporarily set the viewer: this.viewer = viewer; } __debug_326( 'Viewer: %s.', this.viewer ); __debug_326( 'Generating view...' ); _$view_328( this, this.viewer, this.render() ); if ( arguments.length ) { // Restore the viewer: this.viewer = tmp; } } // EXPORTS // var _$view_326 = __view_326; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_259 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; var __mergeFcn_259 = _$merge_870.factory; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$setReadOnly_827 = require( '@stdlib/utils/define-read-only-property' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$minstd_805 = require( '@stdlib/random/base/minstd' ); */; /* removed: var _$defaults_257 = require( './defaults.js' ); */; /* removed: var _$view_326 = require( './view' ); */; // VARIABLES // var __debug_259 = _$browser_913( 'plot:base:main' ); var __PRIVATE_PROPS_259 = [ '_autoRender', '_autoView', '_description', '_engine', '_height', '_isDefined', '_labels', '_lineOpacity', '_lineStyle', '_lineWidth', '_paddingBottom', '_paddingLeft', '_paddingRight', '_paddingTop', '_renderFormat', '_title', '_viewer', '_width', '_xAxisOrient', '_xData', '_xLabel', '_xMax', '_xMin', '_xNumTicks', '_xScale', '_xTickFormat', '_yAxisOrient', '_yData', '_yLabel', '_yMax', '_yMin', '_yNumTicks', '_yScale', '_yTickFormat' ]; // FUNCTIONS // var __merge_259 = __mergeFcn_259({ 'extend': false }); // MAIN // /** * Base plot constructor. * * @constructor * @param {Array} [x] - x values * @param {Array} [y] - y values * @param {Options} [options] - constructor options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event * @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event * @param {string} [options.description=''] - description * @param {string} [options.engine='svg'] - render engine * @param {PositiveNumber} [options.height=400] - plot height * @param {(StringArray|EmptyArray)} [options.labels] - data labels * @param {(number|NumberArray)} [options.lineOpacity=0.9] - line opacity * @param {(string|StringArray)} [options.lineStyle='-'] - line style(s) * @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - line width(s) * @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding * @param {NonNegativeInteger} [options.paddingLeft=90] - left padding * @param {NonNegativeInteger} [options.paddingRight=20] - right padding * @param {NonNegativeInteger} [options.paddingTop=80] - top padding * @param {string} [options.renderFormat='vdom'] - render format * @param {string} [options.title=''] - title * @param {string} [options.viewer='none'] - viewer * @param {PositiveNumber} [options.width=400] - plot width * @param {string} [options.xAxisOrient='bottom'] - x-axis orientation * @param {string} [options.xLabel='x'] - x-axis label * @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain * @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain * @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks * @param {(string|null)} [options.xTickFormat=null] - x-axis tick format * @param {string} [options.yAxisOrient='left'] - y-axis orientation * @param {string} [options.yLabel='y'] - y-axis label * @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain * @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain * @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks * @param {(string|null)} [options.yTickFormat=null] - y-axis tick format * @throws {TypeError} must provide valid options * @returns {Plot} Plot instance * * @example * var plot = new Plot(); */ function __Plot_259() { var options; var nargs; var keys; var self; var opts; var key; var i; nargs = arguments.length; if ( !(this instanceof __Plot_259) ) { if ( nargs === 0 ) { return new __Plot_259(); } if ( nargs === 1 ) { return new __Plot_259( arguments[0] ); } if ( nargs === 2 ) { return new __Plot_259( arguments[0], arguments[1] ); } return new __Plot_259( arguments[0], arguments[1], arguments[2] ); } self = this; opts = _$defaults_257(); if ( nargs === 0 ) { options = {}; } else if ( nargs === 1 ) { options = arguments[ 0 ]; if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. Options argument must be an `object`. Value: `' + options + '`.' ); } } else if ( nargs === 2 ) { options = {}; } else if ( nargs > 2 ) { if ( !_$isPlainObject_153( arguments[ 2 ] ) ) { throw new TypeError( 'invalid argument. Options argument must be an `object`. Value: `' + arguments[2] + '`.' ); } options = _$copy_816( arguments[ 2 ] ); // avoid mutation } opts = __merge_259( opts, options ); __debug_259( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_259.call( this ); for ( i = 0; i < __PRIVATE_PROPS_259.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_259[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set a clipping path id: _$defineProperty_825( this, '_clipPathId', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': _$minstd_805().toString() // TODO: uuid }); // Initialize an internal cache for renderers... _$defineProperty_825( this, '$', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': {} }); _$defineProperty_825( this.$, 'svg', { 'configurable': false, 'enumerable': false, 'writable': false, 'value': {} }); // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } // Add event listeners: this.on( 'change', onChange ); this.on( 'render', onRender ); return this; /** * Callback invoked upon receiving a change event. * * @private */ function onChange() { /* eslint-disable no-underscore-dangle */ __debug_259( 'Received a change event.' ); if ( self._autoRender ) { self.render(); } } /** * Callback invoked upon receiving a render event. * * @private * @param {*} plot - rendered plot */ function onRender( plot ) { /* eslint-disable no-underscore-dangle */ __debug_259( 'Received a render event.' ); if ( self._autoView ) { __debug_259( 'Viewer: %s.', self._viewer ); __debug_259( 'Generating view...' ); _$view_326( self, self._viewer, plot ); } } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( __Plot_259, __EventEmitter_259 ); /** * Rendering mode. * * ## Notes * * - If `true`, an instance re-renders on each `'change'` event. * * @name autoRender * @memberof Plot.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default true * * @example * var plot = new Plot({ * 'autoRender': true * }); * * var mode = plot.autoRender; * // returns true */ _$defineProperty_825( __Plot_259.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_261, 'get': _$get_260 }); /** * Viewer mode. * * ## Notes * * - If `true`, an instance generates an updated view on each render event. * * @name autoView * @memberof Plot.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var plot = new Plot({ * 'autoView': false * }); * * var mode = plot.autoView; * // returns false */ _$defineProperty_825( __Plot_259.prototype, 'autoView', { 'configurable': false, 'enumerable': true, 'set': _$set_263, 'get': _$get_262 }); /** * Plot description. * * @name description * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '' * * @example * var plot = new Plot(); * plot.description = 'A plot description.'; * * @example * var plot = new Plot({ * 'description': 'A plot description.' * }); * var desc = plot.description; * // returns 'A plot description.' */ _$defineProperty_825( __Plot_259.prototype, 'description', { 'configurable': false, 'enumerable': true, 'set': _$set_265, 'get': _$get_264 }); /** * Render engine. * * @name engine * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized engine * @default 'svg' * * @example * var plot = new Plot(); * plot.engine = 'svg'; * * @example * var plot = new Plot({ * 'engine': 'svg' * }); * var engine = plot.engine; * // returns 'svg' */ _$defineProperty_825( __Plot_259.prototype, 'engine', { 'configurable': false, 'enumerable': true, 'set': _$set_268, 'get': _$get_267 }); /** * Expected graph height. * * @name graphHeight * @memberof Plot.prototype * @type {number} * * @example * var plot = new Plot({ * 'height': 100, * 'paddingTop': 10, * 'paddingBottom': 20 * }); * var height = plot.graphHeight; * // returns 70 */ _$defineProperty_825( __Plot_259.prototype, 'graphHeight', { 'configurable': false, 'enumerable': true, 'get': _$get_269 }); /** * Expected graph width. * * @name graphWidth * @memberof Plot.prototype * @type {number} * * @example * var plot = new Plot({ * 'width': 100, * 'paddingLeft': 10, * 'paddingRight': 10 * }); * var width = plot.graphWidth; * // returns 80 */ _$defineProperty_825( __Plot_259.prototype, 'graphWidth', { 'configurable': false, 'enumerable': true, 'get': _$get_270 }); /** * Plot height. * * @name height * @memberof Plot.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 (px) * * @example * var plot = new Plot(); * plot.height = 100; * * @example * var plot = new Plot({ * 'height': 360 * }); * var height = plot.height; * // returns 360 */ _$defineProperty_825( __Plot_259.prototype, 'height', { 'configurable': false, 'enumerable': true, 'set': _$set_272, 'get': _$get_271 }); /** * Data labels. * * @name labels * @memberof Plot.prototype * @type {(StringArray|EmptyArray)} * @throws {TypeError} must be either an array of strings or an empty array * @default [] * * @example * var plot = new Plot(); * plot.labels = [ 'beep', 'boop' ]; * * @example * var plot = new Plot({ * 'labels': [ 'beep', 'boop' ] * }); * var labels = plot.labels; * // returns [ 'beep', 'boop' ] */ _$defineProperty_825( __Plot_259.prototype, 'labels', { 'configurable': false, 'enumerable': true, 'set': _$set_274, 'get': _$get_273 }); /** * Line opacity. * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineOpacity * @memberof Plot.prototype * @type {(number|NumberArray)} * @throws {TypeError} must be a number or number array * @throws {RangeError} must be a number on the interval `[0,1]` * @default '0.9' * * @example * var plot = new Plot(); * plot.lineOpacity = [ 1.0, 0.5 ]; * * @example * var plot = new Plot({ * 'lineOpacity': 0.5 * }); * var opacity = plot.lineOpacity; * // returns [ 0.5 ] */ _$defineProperty_825( __Plot_259.prototype, 'lineOpacity', { 'configurable': false, 'enumerable': true, 'set': _$set_276, 'get': _$get_275 }); /** * Line style(s). * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineStyle * @memberof Plot.prototype * @type {(string|StringArray)} * @throws {TypeError} must be a string or string array * @throws {Error} must be a supported line style * @default '-' * * @example * var plot = new Plot(); * plot.lineStyle = [ '-', 'none' ]; * * @example * var plot = new Plot({ * 'lineStyle': 'none' * }); * var lineStyle = plot.lineStyle; * // returns [ 'none' ] */ _$defineProperty_825( __Plot_259.prototype, 'lineStyle', { 'configurable': false, 'enumerable': true, 'set': _$set_279, 'get': _$get_277 }); /** * Line width. * * ## Notes * * - When retrieved, the returned value is always an `array`. * * @name lineWidth * @memberof Plot.prototype * @type {(NonNegativeInteger|NonNegativeIntegerArray)} * @throws {TypeError} must be a nonnegative integer or nonnegative integer array * @default 2 * * @example * var plot = new Plot(); * plot.lineWidth = 1; * * @example * var plot = new Plot({ * 'lineWidth': [ 1, 3 ] * }); * var width = plot.lineWidth; * // returns [ 1, 3 ] */ _$defineProperty_825( __Plot_259.prototype, 'lineWidth', { 'configurable': false, 'enumerable': true, 'set': _$set_281, 'get': _$get_280 }); /** * Plot bottom padding. * * ## Notes * * - Typically used to create space for a bottom-oriented y-axis. * * @name paddingBottom * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 80 (px) * * @example * var plot = new Plot(); * plot.paddingBottom = 100; * * @example * var plot = new Plot({ * 'paddingBottom': 100 * }); * var padding = plot.paddingBottom; * // returns 100 */ _$defineProperty_825( __Plot_259.prototype, 'paddingBottom', { 'configurable': false, 'enumerable': true, 'set': _$set_283, 'get': _$get_282 }); /** * Plot left padding. * * ## Notes * * - Typically used to create space for a left-oriented y-axis. * * @name paddingLeft * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 90 (px) * * @example * var plot = new Plot(); * plot.paddingLeft = 100; * * @example * var plot = new Plot({ * 'paddingLeft': 100 * }); * var padding = plot.paddingLeft; * // returns 100 */ _$defineProperty_825( __Plot_259.prototype, 'paddingLeft', { 'configurable': false, 'enumerable': true, 'set': _$set_285, 'get': _$get_284 }); /** * Plot right padding. * * ## Notes * * - Typically used to create space for a right-oriented y-axis. * * @name paddingRight * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 20 (px) * * @example * var plot = new Plot(); * plot.paddingRight = 100; * * @example * var plot = new Plot({ * 'paddingRight': 100 * }); * var padding = plot.paddingRight; * // returns 100 */ _$defineProperty_825( __Plot_259.prototype, 'paddingRight', { 'configurable': false, 'enumerable': true, 'set': _$set_287, 'get': _$get_286 }); /** * Plot top padding. * * ## Notes * * - Typically used to create space for a title or top-oriented x-axis. * * @name paddingTop * @memberof Plot.prototype * @type {NonNegativeInteger} * @throws {TypeError} must be a nonnegative integer * @default 80 (px) * * @example * var plot = new Plot(); * plot.paddingTop = 100; * * @example * var plot = new Plot({ * 'paddingTop': 100 * }); * var padding = plot.paddingTop; * // returns 100 */ _$defineProperty_825( __Plot_259.prototype, 'paddingTop', { 'configurable': false, 'enumerable': true, 'set': _$set_289, 'get': _$get_288 }); /** * Renders a plot. * * @name render * @memberof Plot.prototype * @type {Function} * @param {string} [format] - render format * @throws {TypeError} must provide a recognized format * @returns {(VTree|string)} virtual tree or string * * @example * var plot = new Plot(); * var out = plot.render(); * * @example * var plot = new Plot(); * var out = plot.render( 'html' ); */ _$setReadOnly_827( __Plot_259.prototype, 'render', _$render_324 ); /** * Renders a plot. * * ## Notes * * - This method **should** be implemented by descendants. * * @private * @name _render * @memberof Plot.prototype * @type {Function} * @param {string} format - render format * @returns {(VTree|string)} rendered plot */ _$setReadOnly_827( __Plot_259.prototype, '_render', _$render_325 ); /** * Render format. * * @name renderFormat * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized format * @default 'vdom' * * @example * var plot = new Plot(); * plot.renderFormat = 'vdom'; * * @example * var plot = new Plot({ * 'renderFormat': 'html' * }); * var fmt = plot.renderFormat; * // returns 'html' */ _$defineProperty_825( __Plot_259.prototype, 'renderFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_292, 'get': _$get_291 }); /** * Plot title. * * @name title * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '' * * @example * var plot = new Plot(); * plot.title = 'Plot'; * * @example * var plot = new Plot({ * 'title': 'Plot' * }); * var t = plot.title; * // returns 'Plot' */ _$defineProperty_825( __Plot_259.prototype, 'title', { 'configurable': false, 'enumerable': true, 'set': _$set_294, 'get': _$get_293 }); /** * Plot viewer. * * @name viewer * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a recognized viewer * @default 'none' * * @example * var plot = new Plot(); * plot.viewer = 'none'; * * @example * var plot = new Plot({ * 'viewer': 'none' * }); * var viewer = plot.viewer; * // returns 'none' */ _$defineProperty_825( __Plot_259.prototype, 'viewer', { 'configurable': false, 'enumerable': true, 'set': _$set_296, 'get': _$get_295 }); /** * Plot width. * * @name width * @memberof Plot.prototype * @type {PositiveNumber} * @throws {TypeError} must be a positive number * @default 400 (px) * * @example * var plot = new Plot(); * plot.width = 100; * * @example * var plot = new Plot({ * 'width': 480 * }); * var width = plot.width; * // returns 480 */ _$defineProperty_825( __Plot_259.prototype, 'width', { 'configurable': false, 'enumerable': true, 'set': _$set_299, 'get': _$get_298 }); /** * x-axis orientation. * * @name xAxisOrient * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be either `'top'` or `'bottom'` * @default 'bottom' * * @example * var plot = new Plot(); * plot.xAxisOrient = 'bottom'; * * @example * var plot = new Plot({ * 'xAxisOrient': 'bottom' * }); * var orientation = plot.xAxisOrient; * // returns 'bottom' */ _$defineProperty_825( __Plot_259.prototype, 'xAxisOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_302, 'get': _$get_300 }); /** * x-axis domain. * * @name xDomain * @memberof Plot.prototype * @type {Array} * * @example * var plot = new Plot({ * 'xMin': 0, * 'xMax': 100 * }); * var domain = plot.xDomain; * // returns [ 0, 100 ] */ _$defineProperty_825( __Plot_259.prototype, 'xDomain', { 'configurable': false, 'enumerable': true, 'get': _$get_303 }); /** * x-axis label. * * @name xLabel * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'x' * * @example * var plot = new Plot(); * plot.xLabel = 'time'; * * @example * var plot = new Plot({ * 'xLabel': 'time' * }); * var xLabel = plot.xLabel; * // returns 'time' */ _$defineProperty_825( __Plot_259.prototype, 'xLabel', { 'configurable': false, 'enumerable': true, 'set': _$set_305, 'get': _$get_304 }); /** * Number of x-axis tick marks. * * @name xNumTicks * @memberof Plot.prototype * @type {(NonNegativeInteger|null)} * @throws {TypeError} must be a nonnegative integer or null * @default 5 * * @example * var plot = new Plot(); * plot.xNumTicks = 10; * * @example * var plot = new Plot({ * 'xNumTicks': 10 * }); * var ticks = plot.xNumTicks; * // returns 10 */ _$defineProperty_825( __Plot_259.prototype, 'xNumTicks', { 'configurable': false, 'enumerable': true, 'set': _$set_307, 'get': _$get_306 }); /** * Function to map values to x-axis coordinate values. * * @name xPos * @memberof Plot.prototype * @type {Function} * * @example * var plot = new Plot(); * var xPos = plot.xPos; * // returns */ _$defineProperty_825( __Plot_259.prototype, 'xPos', { 'configurable': false, 'enumerable': true, 'get': _$get_308 }); /** * x-axis range. * * @name xRange * @memberof Plot.prototype * @type {NumberArray} * * @example * var plot = new Plot({ * 'width': 100, * 'paddingLeft': 10, * 'paddingRight': 10 * }); * var range = plot.xRange; * // returns [ 0, 80 ] */ _$defineProperty_825( __Plot_259.prototype, 'xRange', { 'configurable': false, 'enumerable': true, 'get': _$get_309 }); /** * x-axis tick format. * * ## Notes * * - When retrieved, if the value is not `null`, the returned value is a formatting function. * * @name xTickFormat * @memberof Plot.prototype * @type {(string|null)} * @throws {TypeError} must be a string primitive or null * @default null * * @example * var plot = new Plot(); * plot.xScale = 'time'; * plot.xTickFormat = '%H:%M'; * * @example * var plot = new Plot({ * 'xScale': 'time', * 'xTickFormat': '%H:%M' * }); * var fmt = plot.xTickFormat; * // returns */ _$defineProperty_825( __Plot_259.prototype, 'xTickFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_311, 'get': _$get_310 }); /** * y-axis orientation. * * @name yAxisOrient * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be either `'left'` or `'right'` * @default 'left' * * @example * var plot = new Plot(); * plot.yAxisOrient = 'left'; * * @example * var plot = new Plot({ * 'yAxisOrient': 'left' * }); * var orientation = plot.yAxisOrient; * // returns 'left' */ _$defineProperty_825( __Plot_259.prototype, 'yAxisOrient', { 'configurable': false, 'enumerable': true, 'set': _$set_314, 'get': _$get_312 }); /** * y-axis domain. * * @name yDomain * @memberof Plot.prototype * @type {Array} * * @example * var plot = new Plot({ * 'yMin': 0, * 'yMax': 100 * }); * var domain = plot.yDomain; * // returns [ 0, 100 ] */ _$defineProperty_825( __Plot_259.prototype, 'yDomain', { 'configurable': false, 'enumerable': true, 'get': _$get_315 }); /** * y-axis label. * * @name yLabel * @memberof Plot.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default 'y' * * @example * var plot = new Plot(); * plot.yLabel = 'value'; * * @example * var plot = new Plot({ * 'yLabel': 'value' * }); * var yLabel = plot.yLabel; * // returns 'value' */ _$defineProperty_825( __Plot_259.prototype, 'yLabel', { 'configurable': false, 'enumerable': true, 'set': _$set_317, 'get': _$get_316 }); /** * Number of y-axis tick marks. * * @name yNumTicks * @memberof Plot.prototype * @type {(NonNegativeInteger|null)} * @throws {TypeError} must be a nonnegative integer or null * @default 5 * * @example * var plot = new Plot(); * plot.yNumTicks = 10; * * @example * var plot = new Plot({ * 'yNumTicks': 10 * }); * var ticks = plot.yNumTicks; * // returns 10 */ _$defineProperty_825( __Plot_259.prototype, 'yNumTicks', { 'configurable': false, 'enumerable': true, 'set': _$set_319, 'get': _$get_318 }); /** * Function to map values to y-axis coordinate values. * * @name yPos * @memberof Plot.prototype * @type {Function} * * @example * var plot = new Plot(); * var yPos = plot.yPos; * // returns */ _$defineProperty_825( __Plot_259.prototype, 'yPos', { 'configurable': false, 'enumerable': true, 'get': _$get_320 }); /** * y-axis range. * * @name yRange * @memberof Plot.prototype * @type {NumberArray} * * @example * var plot = new Plot({ * 'height': 100, * 'paddingTop': 10, * 'paddingBottom': 20 * }); * var range = plot.yRange; * // returns [ 70, 0 ] */ _$defineProperty_825( __Plot_259.prototype, 'yRange', { 'configurable': false, 'enumerable': true, 'get': _$get_321 }); /** * y-axis tick format. * * ## Notes * * - If the value is not `null`, when retrieved, the returned value is a formatting function. * * @name yTickFormat * @memberof Plot.prototype * @type {(string|null)} * @throws {TypeError} must be a string primitive or null * @default null * * @example * var plot = new Plot(); * plot.yTickFormat = '.0%'; * * @example * var plot = new Plot({ * 'yTickFormat': '.0%' * }); * var fmt = plot.yTickFormat; * // returns */ _$defineProperty_825( __Plot_259.prototype, 'yTickFormat', { 'configurable': false, 'enumerable': true, 'set': _$set_323, 'get': _$get_322 }); /** * Generates a plot view. * * @name view * @memberof Plot.prototype * @type {Function} * @param {string} [viewer] - viewer * @throws {TypeError} must provide a recognized viewer * * @example * var plot = new Plot(); * plot.x = [ [ 1, 2, 3 ] ]; * plot.view( 'stdout' ); */ _$setReadOnly_827( __Plot_259.prototype, 'view', _$view_326 ); // EXPORTS // var _$Plot_259 = __Plot_259; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Base constructor for a 2-dimensional plot. * * @module @stdlib/plot/base/ctor * * @example * var Plot = require( '@stdlib/plot/base/ctor' ); * * var plot = new Plot(); */ // MODULES // /* removed: var _$Plot_259 = require( './main.js' ); */; // EXPORTS // var _$Plot_258 = _$Plot_259; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Maximum double-precision floating-point number. * * @module @stdlib/constants/math/float64-max * @type {number} * * @example * var FLOAT64_MAX = require( '@stdlib/constants/math/float64-max' ); * // returns 1.7976931348623157e+308 */ // MAIN // /** * Maximum double-precision floating-point number. * * ## Notes * * The maximum is given by * * ```tex * 2^{1023} (2 - 2^{-52}) * ``` * * @constant * @type {number} * @default 1.7976931348623157e+308 * @see [IEEE 754]{@link http://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MAX = 1.7976931348623157e+308; // EXPORTS // var _$FLOAT64_MAX_203 = FLOAT64_MAX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isnan_727 = _$isnan_128.isPrimitive; // VARIABLES // var __debug_727 = _$browser_913( 'sparkline:accessor:is-defined' ); // MAIN // /** * Accessor function which determines whether a datum is defined. * * @private * @param {number} d - datum * @param {integer} i - index * @returns {boolean} boolean indicating whether a datum is defined */ function __isDefined_727( d ) { var bool = !__isnan_727( d ); __debug_727( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); return bool; } // EXPORTS // var _$isDefined_727 = __isDefined_727; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_MAX_203 = require( '@stdlib/constants/math/float64-max' ); */; /* removed: var _$isDefined_727 = require( './accessors/is_defined.js' ); */; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_728() { var out = {}; // Boolean indicating whether to re-render on a `change` event: out.autoRender = false; // Data buffer size: out.bufferSize = _$FLOAT64_MAX_203; // Sparkline data: out.data = []; // Sparkline description: out.description = ''; // Accessor indicating whether a datum is defined: out.isDefined = _$isDefined_727; // Data label: out.label = ''; return out; } // EXPORTS // var _$defaults_728 = __defaults_728; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_732 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_732 = _$browser_913( 'sparkline:set:auto-render' ); // MAIN // /** * Sets the rendering mode. * * @private * @param {boolean} bool - boolean indicating whether to re-render on a change event * @throws {TypeError} must be a boolean primitive */ function __set_732( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_732( bool ) ) { throw new TypeError( 'invalid value. `autoRender` must be a boolean primitive. Value: `' + bool + '.`' ); } if ( bool !== this._autoRender ) { __debug_732( 'Current value: %d.', this._autoRender ); this._autoRender = bool; __debug_732( 'New Value: %d.', this._autoRender ); this.emit( 'change' ); } } // EXPORTS // var _$set_732 = __set_732; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the rendering mode. * * @private * @returns {boolean} rendering mode */ function __get_731() { /* eslint-disable no-invalid-this */ return this._autoRender; } // EXPORTS // var _$get_731 = __get_731; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isPositiveInteger_734 = _$isPositiveInteger_155.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; /* removed: var _$FLOAT64_MAX_203 = require( '@stdlib/constants/math/float64-max' ); */; // VARIABLES // var __debug_734 = _$browser_913( 'sparkline:set:buffer-size' ); // MAIN // /** * Sets the data buffer size. * * @param {(PositiveInteger|null)} size - data buffer size * @throws {TypeError} must be a positive integer or null * @throws {RangeError} must be greater than or equal to the number of data elements */ function __set_734( size ) { /* eslint-disable no-invalid-this */ var FLG = _$isNull_140( size ); if ( !__isPositiveInteger_734( size ) && !FLG ) { throw new TypeError( 'invalid value. `bufferSize` must be a positive integer or null. Value: `' + size + '`.' ); } if ( FLG ) { size = _$FLOAT64_MAX_203; } if ( this._data && size < this._data.length ) { throw new RangeError( 'invalid value. `bufferSize` size is smaller than the number of data elements. Number of elements: `'+ this._data.length + '`. Value: `' + size + '`.' ); } if ( size !== this._bufferSize ) { __debug_734( 'Current value: %s.', this._bufferSize ); this._bufferSize = size; __debug_734( 'New value: %s.', this._bufferSize ); this.emit( 'change' ); } } // EXPORTS // var _$set_734 = __set_734; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data buffer size. * * @private * @returns {number} data buffer size */ function __get_733() { /* eslint-disable no-invalid-this */ return this._bufferSize; } // EXPORTS // var _$get_733 = __get_733; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Tests if a value is ndarray-like. * * @param {*} v - value to test * @returns {boolean} boolean indicating if a value is ndarray-like * * @example * var ctor = require( '@stdlib/ndarray/ctor' ); * * var ndarray = ctor( 'generic', 2 ); * var arr = ndarray( [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); * * var bool = isndarrayLike( arr ); * // returns true * * bool = isndarrayLike( [] ); * // returns false */ function isndarrayLike( v ) { return ( v !== null && typeof v === 'object' && typeof v.data === 'object' && typeof v.shape === 'object' && typeof v.strides === 'object' && typeof v.offset === 'number' && typeof v.order === 'string' && typeof v.ndims === 'number' && typeof v.dtype === 'string' && typeof v.length === 'number' && typeof v.flags === 'object' && typeof v.get === 'function' && typeof v.set === 'function' ); } // EXPORTS // var _$isndarrayLike_133 = isndarrayLike; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a value is ndarray-like. * * @module @stdlib/assert/is-ndarray-like * * @example * var ctor = require( '@stdlib/ndarray/ctor' ); * var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); * * var ndarray = ctor( 'generic', 2 ); * * var arr = ndarray( [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); * * var bool = isndarrayLike( arr ); * // returns true * * bool = isndarrayLike( [] ); * // returns false */ // MODULES // /* removed: var _$isndarrayLike_133 = require( './main.js' ); */; // EXPORTS // var _$isndarrayLike_132 = _$isndarrayLike_133; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isCollection_94 = require( '@stdlib/assert/is-collection' ); */; /* removed: var _$isndarrayLike_132 = require( '@stdlib/assert/is-ndarray-like' ); */; // VARIABLES // var __debug_736 = _$browser_913( 'sparkline:set:data' ); // MAIN // /** * Sets the sparkline data. * * @private * @param {(Collection|ndarrayLike)} data - sparkline data * @throws {TypeError} must be an array-like object or an ndarray * @throws {RangeError} length must not exceed maximum data buffer size */ function __set_736( data ) { /* eslint-disable no-invalid-this */ var FLG; var i; FLG = _$isndarrayLike_132( data ) && typeof data.iget === 'function'; if ( !_$isCollection_94( data ) && !FLG ) { throw new TypeError( 'invalid value. `data` must be an array-like object or an ndarray. Value: `' + data + '`.' ); } if ( data.length > this._bufferSize ) { throw new RangeError( 'invalid value. `data` length exceeds maximum data buffer size. Buffer size: `' + this._bufferSize + '`. Length: `' + data.length + '`.' ); } __debug_736( 'Current value: %s.', JSON.stringify( this._data ) ); this._data = []; if ( FLG ) { for ( i = 0; i < data.length; i++ ) { this._data.push( data.iget( i ) ); } } else { for ( i = 0; i < data.length; i++ ) { this._data.push( data[ i ] ); } } __debug_736( 'New value: %s.', JSON.stringify( this._data ) ); this.emit( 'change' ); } // EXPORTS // var _$set_736 = __set_736; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns sparkline data. * * @private * @returns {Array} sparkline data */ function __get_735() { /* eslint-disable no-invalid-this */ return this._data.slice(); } // EXPORTS // var _$get_735 = __get_735; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_738 = _$isString_164.isPrimitive; // VARIABLES // var __debug_738 = _$browser_913( 'plot:set:description' ); // MAIN // /** * Sets the description. * * @private * @param {string} str - description * @throws {TypeError} must be a string primitive * @returns {void} */ function __set_738( str ) { /* eslint-disable no-invalid-this */ if ( !__isString_738( str ) ) { throw new TypeError( 'invalid value. `description` must be a string. Value: `' + str + '.`' ); } if ( str !== this._description ) { __debug_738( 'Current value: %s.', this._description ); this._description = str; __debug_738( 'New value: %s.', this._description ); this.emit( 'change' ); } } // EXPORTS // var _$set_738 = __set_738; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the description. * * @private * @returns {string} description */ function __get_737() { /* eslint-disable no-invalid-this */ return this._description; } // EXPORTS // var _$get_737 = __get_737; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // VARIABLES // var __debug_740 = _$browser_913( 'sparkline:set:is-defined' ); // MAIN // /** * Sets the accessor for defined values. * * @private * @param {Function} fcn - accessor * @throws {TypeError} must be a function * @returns {void} */ function __set_740( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `isDefined` must be a function. Value: `' + fcn + '.`' ); } if ( fcn !== this._isDefined ) { __debug_740( 'Current value: %s.', this._isDefined ); this._isDefined = fcn; __debug_740( 'New Value: %s.', this._isDefined ); this.emit( 'change' ); } } // EXPORTS // var _$set_740 = __set_740; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the accessor for defined values. * * @private * @returns {Function} accessor */ function __get_739() { /* eslint-disable no-invalid-this */ return this._isDefined; } // EXPORTS // var _$get_739 = __get_739; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isString_742 = _$isString_164.isPrimitive; // VARIABLES // var __debug_742 = _$browser_913( 'sparkline:set:label' ); // MAIN // /** * Sets the data label. * * @private * @param {string} label - data label * @throws {TypeError} must be a string * @returns {void} */ function __set_742( label ) { /* eslint-disable no-invalid-this */ if ( !__isString_742( label ) ) { throw new TypeError( 'invalid value. `label` must be a string. Value: `' + label + '.`' ); } if ( label !== this._label ) { __debug_742( 'Current value: %s.', this._label ); this._label = label; __debug_742( 'New Value: %s.', this._label ); this.emit( 'change' ); } } // EXPORTS // var _$set_742 = __set_742; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the data label. * * @private * @returns {string} label */ function __get_741() { /* eslint-disable no-invalid-this */ return this._label; } // EXPORTS // var _$get_741 = __get_741; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_743 = _$browser_913( 'sparkline:push' ); // MAIN // /** * Appends data. * * @private * @param {*} datum - data to append * @returns {Sparkline} class instance */ function push( datum ) { /* eslint-disable no-invalid-this */ __debug_743( 'Current value: %s.', JSON.stringify( this._data ) ); if ( this._data.length >= this._bufferSize ) { this._data.shift(); } this._data.push( datum ); __debug_743( 'New value: %s.', JSON.stringify( this._data ) ); this.emit( 'change' ); return this; } // EXPORTS // var _$push_743 = push; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; // VARIABLES // var __debug_744 = _$browser_913( 'sparkline:render' ); // MAIN // /** * Renders a sparkline. * * @private * @returns {*} rendered sparkline */ function __render_744() { /* eslint-disable no-invalid-this */ var out; __debug_744( 'Rendering...' ); out = this._render(); this.emit( 'render', out ); return out; } // EXPORTS // var _$render_744 = __render_744; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Placeholder `render` function. * * @private * @throws {Error} must be implemented by descendant classes */ function __render_745() { throw new Error( 'method not implemented.' ); } // EXPORTS // var _$render_745 = __render_745; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Serializes a sparkline as a string. * * @private * @returns {string} serialized sparkline */ function __toString_746() { // eslint-disable-line stdlib/no-redeclare /* eslint-disable no-invalid-this */ return this.render(); } // EXPORTS // var _$toString_746 = __toString_746; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __EventEmitter_730 = _$EventEmitter_917.EventEmitter; /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; var __mergeFcn_730 = _$merge_870.factory; /* removed: var _$defaults_728 = require( './defaults.js' ); */; // VARIABLES // var __debug_730 = _$browser_913( 'sparkline:main' ); var __merge_730 = __mergeFcn_730({ 'extend': false }); // List of private properties (note: keep in alphabetical order): var __PRIVATE_PROPS_730 = [ '_autoRender', '_bufferSize', '_data', '_description', '_isDefined', '_labels' ]; // MAIN // /** * Sparkline constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - sparkline data * @param {Options} [options] - sparkline options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - sparkline description * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @throws {TypeError} must provide valid options * @returns {Sparkline} sparkline instance * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = Sparkline( data ); * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * var opts = { * 'data': data * }; * var chart = Sparkline( opts ); */ function Sparkline() { var options; var nargs; var opts; var keys; var self; var key; var i; nargs = arguments.length; if ( !(this instanceof Sparkline) ) { if ( nargs === 0 ) { return new Sparkline(); } if ( nargs === 1 ) { return new Sparkline( arguments[ 0 ] ); } return new Sparkline( arguments[ 0 ], arguments[ 1 ] ); } self = this; opts = _$defaults_728(); if ( nargs === 0 ) { options = {}; } else if ( nargs === 1 ) { if ( _$isArrayLike_81( arguments[ 0 ] ) ) { options = { 'data': arguments[ 0 ] }; } else { options = arguments[ 0 ]; if ( !_$isPlainObject_153( options ) ) { throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); } } } else { if ( !_$isPlainObject_153( arguments[ 1 ] ) ) { throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + arguments[ 1 ] + '`.' ); } options = arguments[ 1 ]; options.data = arguments[ 0 ]; } opts = __merge_730( opts, options ); __debug_730( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); __EventEmitter_730.call( this ); for ( i = 0; i < __PRIVATE_PROPS_730.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_730[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set options... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } // Add event listeners: this.on( 'change', onChange ); this.on( 'render', onRender ); return this; /** * Callback invoked upon receiving a `change` event. * * @private */ function onChange() { /* eslint-disable no-underscore-dangle */ __debug_730( 'Received a change event.' ); if ( self._autoRender ) { self.render(); } } /** * Callback invoked upon receiving a `render` event. * * @private * @param {*} chart - rendered chart */ function onRender() { __debug_730( 'Received a render event.' ); } } /* * Inherit from the `EventEmitter` prototype. */ _$inherit_846( Sparkline, __EventEmitter_730 ); /** * Rendering mode. * * ## Notes * * - If `true`, an instance re-renders on each `change` event. * * @name autoRender * @memberof Sparkline.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var chart = new Sparkline({ * 'autoRender': true * }); * * var mode = chart.autoRender; * // returns true */ _$defineProperty_825( Sparkline.prototype, 'autoRender', { 'configurable': false, 'enumerable': true, 'set': _$set_732, 'get': _$get_731 }); /** * Size of data buffer. * * @name bufferSize * @memberof Sparkline.prototype * @type {(PositiveInteger|null)} * @throws {TypeError} must be a positive integer or null * @throws {RangeError} must be greater than or equal to the number of data elements * * @example * var chart = new Sparkline(); * chart.bufferSize = 20; * * @example * var chart = new Sparkline({ * 'bufferSize': 25 * }); * var size = chart.bufferSize; * // returns 25 */ _$defineProperty_825( Sparkline.prototype, 'bufferSize', { 'configurable': false, 'enumerable': true, 'set': _$set_734, 'get': _$get_733 }); /** * Sparkline data. * * @name data * @memberof Sparkline.prototype * @type {(ArrayLikeObject|ndarrayLike)} * @throws {TypeError} must be an array-like object or an ndarray * @throws {RangeError} length must not exceed maximum data buffer size * * @example * var chart = new Sparkline(); * chart.data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; * * @example * var data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; * var chart = new Sparkline({ * 'data': data * }); * var d = chart.data; * // returns [ 1.0, 0.0, 3.14, 2.0, 5.0 ] */ _$defineProperty_825( Sparkline.prototype, 'data', { 'configurable': false, 'enumerable': true, 'set': _$set_736, 'get': _$get_735 }); /** * Sparkline description. * * @name description * @memberof Sparkline.prototype * @type {string} * @throws {TypeError} must be a string primitive * @default '' * * @example * var chart = new Sparkline(); * chart.description = 'Average daily stock market index for the past year.'; * * @example * var chart = new Sparkline({ * 'description': 'A description.' * }); * var desc = chart.description; * // returns 'A description.' */ _$defineProperty_825( Sparkline.prototype, 'description', { 'configurable': false, 'enumerable': true, 'set': _$set_738, 'get': _$get_737 }); /** * Accessor which defines whether a datum is defined. * * ## Notes * * - This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. * * @name isDefined * @memberof Sparkline.prototype * @type {Function} * @param {*} d - datum * @param {integer} i - index * @throws {TypeError} must be a function * * @example * var chart = new Sparkline(); * chart.isDefined = function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * * @example * function isDefined( d ) { * // Check for `NaN`: * return ( d === d ); * } * var chart = new Sparkline({ * 'isDefined': isDefined * }); * var fcn = chart.isDefined; * // returns */ _$defineProperty_825( Sparkline.prototype, 'isDefined', { 'configurable': false, 'enumerable': true, 'set': _$set_740, 'get': _$get_739 }); /** * Data label. * * @name label * @memberof Sparkline.prototype * @type {string} * @throws {TypeError} must be a string * @default '' * * @example * var chart = new Sparkline(); * chart.label = 'beep'; * * @example * var chart = new Sparkline({ * 'label': 'beep' * }); * var label = chart.label; * // returns 'beep' */ _$defineProperty_825( Sparkline.prototype, 'label', { 'configurable': false, 'enumerable': true, 'set': _$set_742, 'get': _$get_741 }); /** * Appends data. * * @name push * @memberof Sparkline.prototype * @type {Function} * @param {*} datum - data to append * @returns {Sparkline} chart instance * * @example * var data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; * * var chart = new Sparkline({ * 'data': data * }); * * chart.push( 6.0 ).push( -3.14 ).push( -1.0 ); */ Sparkline.prototype.push = _$push_743; /** * Renders a sparkline. * * @name render * @memberof Sparkline.prototype * @type {Function} * @returns {string} rendered sparkline */ Sparkline.prototype.render = _$render_744; /** * Renders a sparkline. * * ## Notes * * - This method **should** be implemented by descendants. * * @private * @name _render * @memberof Sparkline.prototype * @type {Function} * @returns {string} rendered sparkline */ Sparkline.prototype._render = _$render_745; /** * Serializes a sparkline as a string. * * @name toString * @memberof Sparkline.prototype * @type {Function} * @returns {string} serialized sparkline */ Sparkline.prototype.toString = _$toString_746; // TODO: stub `toJSON` method, which, similar to `render`, should be implemented by descendants, as will be chart type specific // EXPORTS // var _$Sparkline_730 = Sparkline; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Base class for sparklines. * * @module @stdlib/plot/sparklines/base/ctor * * @example * var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); * * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = Sparkline( data ); */ // MODULES // /* removed: var _$Sparkline_730 = require( './main.js' ); */; // EXPORTS // var _$Sparkline_729 = _$Sparkline_730; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var __isString_882 = _$isString_164.isPrimitive; var __isStringArray_882 = _$isStringArray_163.primitives; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; // MAIN // /** * Returns a partial object copy containing only specified keys. If a key does not exist as an own property in a source object, the key is ignored. * * @param {Object} obj - source object * @param {(string|StringArray)} keys - keys to copy * @throws {TypeError} first argument must be an object * @throws {TypeError} second argument must be either a string or an array of strings * @returns {Object} new object * * @example * var obj1 = { * 'a': 1, * 'b': 2 * }; * * var obj2 = pick( obj1, 'b' ); * // returns { 'b': 2 } */ function pick( obj, keys ) { var out; var key; var i; if ( typeof obj !== 'object' || obj === null ) { throw new TypeError( 'invalid argument. First argument must be an object. Value: `'+obj+'`.' ); } out = {}; if ( __isString_882( keys ) ) { if ( _$hasOwnProp_55( obj, keys ) ) { out[ keys ] = obj[ keys ]; } return out; } if ( __isStringArray_882( keys ) ) { for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; if ( _$hasOwnProp_55( obj, key ) ) { out[ key ] = obj[ key ]; } } return out; } throw new TypeError( 'invalid argument. Second argument must be either a string primitive or an array of string primitives. Value: `'+keys+'`.' ); } // EXPORTS // var _$pick_882 = pick; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a partial object copy containing only specified keys. * * @module @stdlib/utils/pick * * @example * var pick = require( '@stdlib/utils/pick' ); * * var obj1 = { * 'a': 1, * 'b': 2 * }; * * var obj2 = pick( obj1, 'b' ); * // returns { 'b': 2 } */ // MODULES // /* removed: var _$pick_882 = require( './pick.js' ); */; // EXPORTS // var _$pick_881 = _$pick_882; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_757() { var out = {}; // Boolean indicating whether to encode infinite values: out.infinities = false; // Chart type: out.type = 'column'; // Maximum value of the y-axis domain: out.yMax = null; // Minimum value of the y-axis domain: out.yMin = null; return out; } // EXPORTS // var _$defaults_757 = __defaults_757; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_761 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_761 = _$browser_913( 'sparkline:unicode:set:infinities' ); // MAIN // /** * Sets a flag indicating whether to encode infinite values. * * @private * @param {boolean} bool - boolean flag * @throws {TypeError} must be a boolean primitive */ function __set_761( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_761( bool ) ) { throw new TypeError( 'invalid value. `infinities` must be a boolean primitive. Value: `' + bool + '`.' ); } if ( bool !== this._infinities ) { __debug_761( 'Current value: %s.', this._infinities ); this._infinities = bool; __debug_761( 'New value: %s.', this._infinities ); this.emit( 'change' ); } } // EXPORTS // var _$set_761 = __set_761; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a flag indicating whether to encode infinite values. * * @private * @returns {boolean} boolean indicating whether to encode infinite values */ function __get_750() { /* eslint-disable no-invalid-this */ return this._infinities; } // EXPORTS // var _$get_750 = __get_750; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a flag indicating whether to encode infinite values. * * @private * @returns {boolean} boolean indicating whether to encode infinite values */ function __get_760() { /* eslint-disable no-invalid-this */ return this._infinities; } // EXPORTS // var _$get_760 = __get_760; var _$chart_types_762=[ "column", "line", "tristate", "up-down", "win-loss" ] /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$contains_33 = require( '@stdlib/assert/contains' ); */; /* removed: var _$chart_types_762 = require( './chart_types.json' ); */; // VARIABLES // var __debug_764 = _$browser_913( 'sparkline:unicode:set:type' ); // MAIN // /** * Sets the sparkline chart type. * * @private * @param {string} type - chart type * @throws {TypeError} must be a supported chart type */ function __set_764( type ) { /* eslint-disable no-invalid-this */ if ( !_$contains_33( _$chart_types_762, type ) ) { throw new TypeError( 'invalid value. `type` must be one of `[' + _$chart_types_762.join( ', ' ) + ']`. Value: `' + type + '`.' ); } if ( type !== this._type ) { __debug_764( 'Current value: %s.', this._type ); this._type = type; __debug_764( 'New value: %s.', this._type ); this.emit( 'change' ); } } // EXPORTS // var _$set_764 = __set_764; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the sparkline chart type. * * @private * @returns {string} sparkline chart type */ function __get_763() { /* eslint-disable no-invalid-this */ return this._type; } // EXPORTS // var _$get_763 = __get_763; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Tests if a numeric value is finite. * * @param {number} x - value to test * @returns {boolean} boolean indicating whether the value is finite * * @example * var bool = isfinite( 5.0 ); * // returns true * * @example * var bool = isfinite( -2.0e64 ); * // returns true * * @example * var bool = isfinite( Infinity ); * // returns false * * @example * var bool = isfinite( -Infinity ); * // returns false */ function isfinite( x ) { return ( // NaN check (x !== x ): x === x && // +-infinity check: x > _$FLOAT64_NINF_206 && x < _$FLOAT64_PINF_207 ); } // EXPORTS // var _$isfinite_219 = isfinite; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a numeric value is finite. * * @module @stdlib/math/base/assert/is-finite * * @example * var isfinite = require( '@stdlib/math/base/assert/is-finite' ); * * var bool = isfinite( 5.0 ); * // returns true * * bool = isfinite( -2.0e64 ); * // returns true * * bool = isfinite( Infinity ); * // returns false * * bool = isfinite( -Infinity ); * // returns false */ // MODULES // /* removed: var _$isfinite_219 = require( './is_finite.js' ); */; // EXPORTS // var _$isfinite_218 = _$isfinite_219; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable stdlib/no-redeclare */ 'use strict'; // MODULES // var __isNumber_107 = _$isNumber_143.isPrimitive; /* removed: var _$isfinite_218 = require( '@stdlib/math/base/assert/is-finite' ); */; // MAIN // /** * Tests if a value is a number primitive having a finite value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number primitive having a finite value * * @example * var bool = isFinite( -3.0 ); * // returns true * * @example * var bool = isFinite( new Number( -3.0 ) ); * // returns false */ function __isFinite_107( value ) { return ( __isNumber_107( value ) && _$isfinite_218( value ) ); } // EXPORTS // var _$isFinite_107 = __isFinite_107; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable stdlib/no-redeclare */ 'use strict'; // MODULES // var __isNumber_106 = _$isNumber_143.isObject; /* removed: var _$isfinite_218 = require( '@stdlib/math/base/assert/is-finite' ); */; // MAIN // /** * Tests if a value is a number object having a finite value. * * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a number object having a finite value * * @example * var bool = isFinite( 3.0 ); * // returns false * * @example * var bool = isFinite( new Number( 3.0 ) ); * // returns true */ function __isFinite_106( value ) { return ( __isNumber_106( value ) && _$isfinite_218( value.valueOf() ) ); } // EXPORTS // var _$isFinite_106 = __isFinite_106; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable stdlib/no-redeclare */ 'use strict'; // MODULES // /* removed: var _$isFinite_107 = require( './primitive.js' ); */; /* removed: var _$isFinite_106 = require( './object.js' ); */; // MAIN // /** * Tests if a value is a finite number. * * @param {*} value - value to test * @returns {boolean} boolean indicating whether a value is a finite number * * @example * var bool = isFinite( 5.0 ); * // returns true * * @example * var bool = isFinite( new Number( 5.0 ) ); * // returns true * * @example * var bool = isFinite( 1.0/0.0 ); * // returns false * * @example * var bool = isFinite( null ); * // returns false */ function __isFinite_105( value ) { return ( _$isFinite_107( value ) || _$isFinite_106( value ) ); } // EXPORTS // var _$isFinite_105 = __isFinite_105; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* eslint-disable stdlib/no-redeclare */ 'use strict'; /** * Test if a value is a finite number. * * @module @stdlib/assert/is-finite * * @example * var isFinite = require( '@stdlib/assert/is-finite' ); * * var bool = isFinite( 5.0 ); * // returns true * * bool = isFinite( new Number( 5.0 ) ); * // returns true * * bool = isFinite( 1.0/0.0 ); * // returns false * * bool = isFinite( null ); * // returns false * * @example * var isFinite = require( '@stdlib/assert/is-finite' ).isPrimitive; * * var bool = isFinite( -3.0 ); * // returns true * * bool = isFinite( new Number( -3.0 ) ); * // returns false * * @example * var isFinite = require( '@stdlib/assert/is-finite' ).isObject; * * var bool = isFinite( 3.0 ); * // returns false * * bool = isFinite( new Number( 3.0 ) ); * // returns true */ // MODULES // /* removed: var _$setNonEnumerableReadOnly_820 = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); */; /* removed: var _$isFinite_105 = require( './main.js' ); */; /* removed: var _$isFinite_107 = require( './primitive.js' ); */; /* removed: var _$isFinite_106 = require( './object.js' ); */; // MAIN // _$setNonEnumerableReadOnly_820( _$isFinite_105, 'isPrimitive', _$isFinite_107 ); _$setNonEnumerableReadOnly_820( _$isFinite_105, 'isObject', _$isFinite_106 ); // EXPORTS // var _$isFinite_104 = _$isFinite_105; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var isFiniteNumber = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_766 = _$browser_913( 'sparkline:unicode:set:y-max' ); // MAIN // /** * Sets the maximum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} max - maximum value * @throws {TypeError} must be a finite number primitive or null */ function __set_766( max ) { /* eslint-disable no-invalid-this */ if ( !isFiniteNumber( max ) && !_$isNull_140( max ) ) { throw new TypeError( 'invalid value. `yMax` must be a finite number primitive or null. Value: `' + max + '`.' ); } if ( max !== this._yMax ) { __debug_766( 'Current value: %s.', this._yMax ); this._yMax = max; __debug_766( 'New value: %s.', this._yMax ); this.emit( 'change' ); } } // EXPORTS // var _$set_766 = __set_766; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the maximum value of the y-axis domain. * * @private * @returns {(FiniteNumber|null)} maximum value of the y-axis domain */ function __get_752() { /* eslint-disable no-invalid-this */ var max; var len; var d; var i; if ( this._yMax === null ) { len = this._data.length; max = _$FLOAT64_NINF_206; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_PINF_207 && d > max ) { max = d; } } return max; } return this._yMax; } // EXPORTS // var _$get_752 = __get_752; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the maximum value of the y-axis domain. * * @private * @returns {(FiniteNumber|null)} maximum value of the y-axis domain */ function __get_765() { /* eslint-disable no-invalid-this */ var max; var len; var d; var i; if ( this._yMax === null ) { len = this._data.length; max = _$FLOAT64_NINF_206; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_PINF_207 && d > max ) { max = d; } } return max; } return this._yMax; } // EXPORTS // var _$get_765 = __get_765; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isFiniteNumber_768 = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_768 = _$browser_913( 'sparkline:unicode:set:y-min' ); // MAIN // /** * Sets the minimum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} min - minimum value * @throws {TypeError} must be a finite number primitive or null */ function __set_768( min ) { /* eslint-disable no-invalid-this */ if ( !__isFiniteNumber_768( min ) && !_$isNull_140( min ) ) { throw new TypeError( 'invalid value. `yMin` must be a finite number primitive or null. Value: `' + min + '`.' ); } if ( min !== this._yMin ) { __debug_768( 'Current value: %s.', this._yMin ); this._yMin = min; __debug_768( 'New value: %s.', this._yMin ); this.emit( 'change' ); } } // EXPORTS // var _$set_768 = __set_768; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the minimum value of the y-axis domain. * * @private * @returns {number} minimum value of the y-axis domain */ function __get_754() { /* eslint-disable no-invalid-this */ var min; var len; var d; var i; if ( this._yMin === null ) { len = this._data.length; min = _$FLOAT64_PINF_207; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_NINF_206 && d < min ) { min = d; } } return min; } return this._yMin; } // EXPORTS // var _$get_754 = __get_754; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the minimum value of the y-axis domain. * * @private * @returns {number} minimum value of the y-axis domain */ function __get_767() { /* eslint-disable no-invalid-this */ var min; var len; var d; var i; if ( this._yMin === null ) { len = this._data.length; min = _$FLOAT64_PINF_207; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_NINF_206 && d < min ) { min = d; } } return min; } return this._yMin; } // EXPORTS // var _$get_767 = __get_767; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_747() { var out = {}; // Boolean indicating whether to encode infinite values: out.infinities = false; // Maximum value of the y-axis domain: out.yMax = null; // Minimum value of the y-axis domain: out.yMin = null; return out; } // EXPORTS // var _$defaults_747 = __defaults_747; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_751 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_751 = _$browser_913( 'sparkline:column-chart:unicode:set:infinities' ); // MAIN // /** * Sets a flag indicating whether to encode infinite values. * * @private * @param {boolean} bool - boolean flag * @throws {TypeError} must be a boolean primitive */ function __set_751( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_751( bool ) ) { throw new TypeError( 'invalid value. `infinities` must be a boolean primitive. Value: `' + bool + '`.' ); } if ( bool !== this._infinities ) { __debug_751( 'Current value: %s.', this._infinities ); this._infinities = bool; __debug_751( 'New value: %s.', this._infinities ); this.emit( 'change' ); } } // EXPORTS // var _$set_751 = __set_751; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isFiniteNumber_753 = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_753 = _$browser_913( 'sparkline:column-chart:unicode:set:y-max' ); // MAIN // /** * Sets the maximum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} max - maximum value * @throws {TypeError} must be a finite number primitive or null */ function __set_753( max ) { /* eslint-disable no-invalid-this */ if ( !__isFiniteNumber_753( max ) && !_$isNull_140( max ) ) { throw new TypeError( 'invalid value. `yMax` must be a finite number primitive or null. Value: `' + max + '`.' ); } if ( max !== this._yMax ) { __debug_753( 'Current value: %s.', this._yMax ); this._yMax = max; __debug_753( 'New value: %s.', this._yMax ); this.emit( 'change' ); } } // EXPORTS // var _$set_753 = __set_753; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isFiniteNumber_755 = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_755 = _$browser_913( 'sparkline:column-chart:unicode:set:y-min' ); // MAIN // /** * Sets the minimum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} min - minimum value * @throws {TypeError} must be a finite number primitive or null */ function __set_755( min ) { /* eslint-disable no-invalid-this */ if ( !__isFiniteNumber_755( min ) && !_$isNull_140( min ) ) { throw new TypeError( 'invalid value. `yMin` must be a finite number primitive or null. Value: `' + min + '`.' ); } if ( min !== this._yMin ) { __debug_755( 'Current value: %s.', this._yMin ); this._yMin = min; __debug_755( 'New value: %s.', this._yMin ); this.emit( 'change' ); } } // EXPORTS // var _$set_755 = __set_755; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Computes the absolute value of `x`. * * @param {number} x - input value * @returns {number} absolute value * * @example * var v = abs( -1.0 ); * // returns 1.0 * * @example * var v = abs( 2.0 ); * // returns 2.0 * * @example * var v = abs( 0.0 ); * // returns 0.0 * * @example * var v = abs( -0.0 ); * // returns 0.0 * * @example * var v = abs( NaN ); * // returns NaN */ function abs( x ) { if ( x < 0.0 ) { return -x; } if ( x === 0.0 ) { return 0.0; // handle negative zero } return x; } // EXPORTS // var _$abs_226 = abs; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Compute an absolute value. * * @module @stdlib/math/base/special/abs * * @example * var abs = require( '@stdlib/math/base/special/abs' ); * * var v = abs( -1.0 ); * // returns 1.0 * * v = abs( 2.0 ); * // returns 2.0 * * v = abs( 0.0 ); * // returns 0.0 * * v = abs( -0.0 ); * // returns 0.0 * * v = abs( NaN ); * // returns NaN */ // MODULES // /* removed: var _$abs_226 = require( './abs.js' ); */; // EXPORTS // var _$abs_227 = _$abs_226; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: implementation /** * Rounds a numeric value to the nearest integer. * * @param {number} x - input value * @returns {number} function value * * @example * var v = round( -4.2 ); * // returns -4.0 * * @example * var v = round( -4.5 ); * // returns -4.0 * * @example * var v = round( -4.6 ); * // returns -5.0 * * @example * var v = round( 9.99999 ); * // returns 10.0 * * @example * var v = round( 9.5 ); * // returns 10.0 * * @example * var v = round( 9.2 ); * // returns 9.0 * * @example * var v = round( 0.0 ); * // returns 0.0 * * @example * var v = round( -0.0 ); * // returns -0.0 * * @example * var v = round( Infinity ); * // returns Infinity * * @example * var v = round( -Infinity ); * // returns -Infinity * * @example * var v = round( NaN ); * // returns NaN */ var round = Math.round; // eslint-disable-line stdlib/no-builtin-math // EXPORTS // var _$round_239 = round; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // TODO: implementation /** * Round a numeric value to the nearest integer. * * @module @stdlib/math/base/special/round * * @example * var round = require( '@stdlib/math/base/special/round' ); * * var v = round( -4.2 ); * // returns -4.0 * * v = round( -4.5 ); * // returns -4.0 * * v = round( -4.6 ); * // returns -5.0 * * v = round( 9.99999 ); * // returns 10.0 * * v = round( 9.5 ); * // returns 10.0 * * v = round( 9.2 ); * // returns 9.0 * * v = round( 0.0 ); * // returns 0.0 * * v = round( -0.0 ); * // returns -0.0 * * v = round( Infinity ); * // returns Infinity * * v = round( -Infinity ); * // returns -Infinity * * v = round( NaN ); * // returns NaN */ // MODULES // /* removed: var _$round_239 = require( './round.js' ); */; // EXPORTS // var _$round_238 = _$round_239; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$abs_227 = require( '@stdlib/math/base/special/abs' ); */; /* removed: var _$round_238 = require( '@stdlib/math/base/special/round' ); */; /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // VARIABLES // // See [Block Elements]{@link https://en.wikipedia.org/wiki/Block_Elements}. var UNICODE_BLOCK_ELEMENTS = [ '▁', // U+2581, lower 1/8 '▂', // U+2582, lower 2/8 '▃', // U+2583, lower 3/8 '▄', // U+2584, lower 4/8 '▅', // U+2585, lower 5/8 '▆', // U+2586, lower 6/8 '▇', // U+2587, lower 7/8 '█' // U+2588, full block ]; var UNICODE_INF = '∞'; // U+221E var MISSING_VALUE = ' '; // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_756() { /* eslint-disable no-invalid-this */ var blocks; var range; var str; var min; var max; var len; var idx; var d; var v; var n; var i; len = this._data.length; if ( len === 0 ) { return ''; } min = this.yMin; max = this.yMax; range = _$abs_227( max-min ); // Check if data is constant... if ( range === 0.0 ) { // If `max` is `0`, encode each finite datum as the smallest block glyph... if ( max === 0.0 ) { blocks = [ UNICODE_BLOCK_ELEMENTS[ 0 ] ]; } // Otherwise, encode each finite datum as a mid-sized block glyph... else { blocks = [ UNICODE_BLOCK_ELEMENTS[ 3 ] ]; } } else { blocks = UNICODE_BLOCK_ELEMENTS; } // Generate the sparkline chart, assigning a glyph to each datum... n = blocks.length - 1; str = ''; // TODO: color encoding: one color for both pos and neg or two colors for separate colors // TODO: negative values diff color (red) for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._infinities && ( d === _$FLOAT64_PINF_207 || d === _$FLOAT64_NINF_206 ) ) { str += UNICODE_INF; continue; } if ( !this._isDefined( d, i ) || d === _$FLOAT64_PINF_207 || d === _$FLOAT64_NINF_206 ) { str += MISSING_VALUE; continue; } // Normalize the datum (aka feature scaling): if ( range ) { v = ( d-min ) / range; } else { v = 0.0; } // Determine the glyph index: idx = _$round_238( v*n ); if ( idx < 0 ) { idx = 0; } else if ( idx > n ) { idx = n; } // Add the glyph to the chart: str += blocks[ idx ]; } return str; } // EXPORTS // var _$render_756 = __render_756; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; var __mergeFcn_749 = _$merge_870.factory; /* removed: var _$pick_881 = require( '@stdlib/utils/pick' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; /* removed: var _$defaults_747 = require( './defaults.js' ); */; // VARIABLES // var __debug_749 = _$browser_913( 'sparkline:column-chart:unicode:main' ); var __merge_749 = __mergeFcn_749({ 'extend': false }); // List of private properties (note: keep in alphabetical order): var __PRIVATE_PROPS_749 = [ '_infinities', '_yMax', '_yMin' ]; // List of options properties (note: keep in alphabetical order): var OPTIONS_PROPS = [ 'infinities', 'yMax', 'yMin' ]; // MAIN // /** * Unicode sparkline column chart constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain * @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain * @throws {TypeError} must provide valid options * @returns {ColumnChart} chart instance * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new ColumnChart( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * var opts = { * 'data': data * }; * var chart = new ColumnChart( opts ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ function ColumnChart() { var options; var nargs; var opts; var keys; var key; var i; nargs = arguments.length; if ( !(this instanceof ColumnChart) ) { if ( nargs === 0 ) { return new ColumnChart(); } if ( nargs === 1 ) { return new ColumnChart( arguments[ 0 ] ); } return new ColumnChart( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } // Extract chart-specific options... opts = _$defaults_747(); if ( nargs === 1 && !_$isArrayLike_81( arguments[ 0 ] ) ) { options = arguments[ 0 ]; } else if ( nargs === 2 ) { options = arguments[ 1 ]; } else { options = {}; } opts = __merge_749( opts, _$pick_881( options, OPTIONS_PROPS ) ); __debug_749( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); // Initialize private chart-specific properties... for ( i = 0; i < __PRIVATE_PROPS_749.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_749[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set chart-specific properties... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( ColumnChart, _$Sparkline_729 ); /** * Boolean indicating whether to encode infinite values. * * @name infinities * @memberof ColumnChart.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var chart = new ColumnChart(); * chart.infinities = true; * * @example * var chart = new ColumnChart({ * 'infinities': true * }); * var bool = chart.infinities; * // returns true */ _$defineProperty_825( ColumnChart.prototype, 'infinities', { 'configurable': false, 'enumerable': true, 'set': _$set_751, 'get': _$get_750 }); /** * Maximum value of the y-axis domain. * * @name yMax * @memberof ColumnChart.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new ColumnChart(); * chart.yMax = 100.0; * * @example * var chart = new ColumnChart({ * 'yMax': 314.0 * }); * var ymax = chart.yMax; * // returns 314.0 */ _$defineProperty_825( ColumnChart.prototype, 'yMax', { 'configurable': false, 'enumerable': true, 'set': _$set_753, 'get': _$get_752 }); /** * Minimum value of the y-axis domain. * * @name yMin * @memberof ColumnChart.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new ColumnChart(); * chart.yMin = -100.0; * * @example * var chart = new ColumnChart({ * 'yMin': 3.14 * }); * var ymin = chart.yMin; * // returns 3.14 */ _$defineProperty_825( ColumnChart.prototype, 'yMin', { 'configurable': false, 'enumerable': true, 'set': _$set_755, 'get': _$get_754 }); /** * Renders a sparkline column chart. * * @private * @name _render * @memberof ColumnChart.prototype * @type {Function} * @returns {string} rendered sparkline column chart * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new ColumnChart( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ ColumnChart.prototype._render = _$render_756; // eslint-disable-line no-underscore-dangle // EXPORTS // var _$ColumnChart_749 = ColumnChart; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline column chart. * * @module @stdlib/plot/sparklines/unicode/column * * @example * var columnChart = require( '@stdlib/plot/sparklines/unicode/column' ); * * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = columnChart( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ // MODULES // /* removed: var _$ColumnChart_749 = require( './main.js' ); */; // EXPORTS // var _$columnChart_748 = _$ColumnChart_749; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MAIN // /** * Returns default options. * * @private * @returns {Object} default options */ function __defaults_770() { var out = {}; // Boolean indicating whether to encode infinite values: out.infinities = false; // Maximum value of the y-axis domain: out.yMax = null; // Minimum value of the y-axis domain: out.yMin = null; return out; } // EXPORTS // var _$defaults_770 = __defaults_770; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isBoolean_774 = _$isBoolean_86.isPrimitive; // VARIABLES // var __debug_774 = _$browser_913( 'sparkline:line-chart:unicode:set:infinities' ); // MAIN // /** * Sets a flag indicating whether to encode infinite values. * * @private * @param {boolean} bool - boolean flag * @throws {TypeError} must be a boolean primitive */ function __set_774( bool ) { /* eslint-disable no-invalid-this */ if ( !__isBoolean_774( bool ) ) { throw new TypeError( 'invalid value. `infinities` must be a boolean primitive. Value: `' + bool + '`.' ); } if ( bool !== this._infinities ) { __debug_774( 'Current value: %s.', this._infinities ); this._infinities = bool; __debug_774( 'New value: %s.', this._infinities ); this.emit( 'change' ); } } // EXPORTS // var _$set_774 = __set_774; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns a flag indicating whether to encode infinite values. * * @private * @returns {boolean} boolean indicating whether to encode infinite values */ function __get_773() { /* eslint-disable no-invalid-this */ return this._infinities; } // EXPORTS // var _$get_773 = __get_773; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isFiniteNumber_776 = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_776 = _$browser_913( 'sparkline:line-chart:unicode:set:y-max' ); // MAIN // /** * Sets the maximum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} max - maximum value * @throws {TypeError} must be a finite number primitive or null */ function __set_776( max ) { /* eslint-disable no-invalid-this */ if ( !__isFiniteNumber_776( max ) && !_$isNull_140( max ) ) { throw new TypeError( 'invalid value. `yMax` must be a finite number primitive or null. Value: `' + max + '`.' ); } if ( max !== this._yMax ) { __debug_776( 'Current value: %s.', this._yMax ); this._yMax = max; __debug_776( 'New value: %s.', this._yMax ); this.emit( 'change' ); } } // EXPORTS // var _$set_776 = __set_776; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the maximum value of the y-axis domain. * * @private * @returns {(FiniteNumber|null)} maximum value of the y-axis domain */ function __get_775() { /* eslint-disable no-invalid-this */ var max; var len; var d; var i; if ( this._yMax === null ) { len = this._data.length; max = _$FLOAT64_NINF_206; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_PINF_207 && d > max ) { max = d; } } return max; } return this._yMax; } // EXPORTS // var _$get_775 = __get_775; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; var __isFiniteNumber_778 = _$isFinite_104.isPrimitive; /* removed: var _$isNull_140 = require( '@stdlib/assert/is-null' ); */; // VARIABLES // var __debug_778 = _$browser_913( 'sparkline:line-chart:unicode:set:y-min' ); // MAIN // /** * Sets the minimum value of the y-axis domain. * * @private * @param {(FiniteNumber|null)} min - minimum value * @throws {TypeError} must be a finite number primitive or null */ function __set_778( min ) { /* eslint-disable no-invalid-this */ if ( !__isFiniteNumber_778( min ) && !_$isNull_140( min ) ) { throw new TypeError( 'invalid value. `yMin` must be a finite number primitive or null. Value: `' + min + '`.' ); } if ( min !== this._yMin ) { __debug_778( 'Current value: %s.', this._yMin ); this._yMin = min; __debug_778( 'New value: %s.', this._yMin ); this.emit( 'change' ); } } // EXPORTS // var _$set_778 = __set_778; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Returns the minimum value of the y-axis domain. * * @private * @returns {number} minimum value of the y-axis domain */ function __get_777() { /* eslint-disable no-invalid-this */ var min; var len; var d; var i; if ( this._yMin === null ) { len = this._data.length; min = _$FLOAT64_PINF_207; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._isDefined( d ) && d !== _$FLOAT64_NINF_206 && d < min ) { min = d; } } return min; } return this._yMin; } // EXPORTS // var _$get_777 = __get_777; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$abs_227 = require( '@stdlib/math/base/special/abs' ); */; /* removed: var _$round_238 = require( '@stdlib/math/base/special/round' ); */; /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // VARIABLES // // See [Braille Patterns]{@link https://en.wikipedia.org/wiki/Braille_Patterns}. var UNICODE_BRAILLE_ELEMENTS = [ [ '⣀', '⡠', '⡐', '⡈' ], // U+28C0, U+2860, U+2850, U+2848 [ '⢄', '⠤', '⠔', '⠌' ], // U+2884, U+2824, U+2814, U+2802 [ '⢂', '⠢', '⠒', '⠊' ], // U+2882, U+2822, U+2812, U+280A [ '⢁', '⠡', '⠑', '⠉' ] // U+2881, U+2821, U+2811, U+2809 ]; var __UNICODE_INF_779 = '∞'; // U+221E var __MISSING_VALUE_779 = ' '; // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_779() { /* eslint-disable no-invalid-this */ var glyphs; var range; var str; var min; var max; var len; var idx; var FLG; var d; var v; var n; var i; var j; len = this._data.length; if ( len === 0 ) { return ''; } min = this.yMin; max = this.yMax; range = _$abs_227( max-min ); // Check if data is constant... if ( range === 0.0 ) { // If `max` is `0`, encode each finite datum as the lowest Braille glyph... if ( max === 0.0 ) { glyphs = [ [ UNICODE_BRAILLE_ELEMENTS[0][0] ] ]; } // Otherwise, encode each finite datum as a mid-sized Braille glyph... else { glyphs = [ [ UNICODE_BRAILLE_ELEMENTS[2][2] ] ]; } } else { glyphs = UNICODE_BRAILLE_ELEMENTS; } // Assign each datum to a bin... idx = new Array( len ); FLG = new Array( len ); n = glyphs.length - 1; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( !this._isDefined( d, i ) || d === _$FLOAT64_PINF_207 || d === _$FLOAT64_NINF_206 ) { FLG[ i ] = true; continue; } // Normalize the datum (aka feature scaling): if ( range ) { v = ( d-min ) / range; } else { v = 0.0; } // Determine the bin index: j = _$round_238( v*n ); if ( j < 0 ) { j = 0; } else if ( j > n ) { j = n; } idx[ i ] = j; } // TODO: color encoding: one color for both pos and neg or two colors for separate colors // TODO: negative values diff color (red) // For each datum, we peek ahead to determine if the next value is greater than or less than the current value. The magnitude of the difference determines the glyph slope. str = ''; for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( this._infinities && ( d === _$FLOAT64_PINF_207 || d === _$FLOAT64_NINF_206 ) ) { str += __UNICODE_INF_779; continue; } if ( FLG[ i ] ) { str += __MISSING_VALUE_779; continue; } if ( i === len-1 ) { // The final glyph is flat, as the next value is unknown... j = idx[ i ]; str += glyphs[ j ][ j ]; break; } j = i + 1; n = this._data[ j ]; if ( n === _$FLOAT64_PINF_207 ) { j = 3; // highest bin } else if ( n === _$FLOAT64_NINF_206 ) { j = 0; // lowest bin } else if ( FLG[ j ] ) { j = idx[ i ]; // same bin, as no slope can be inferred from a missing value } else { j = idx[ j ]; // slope toward the next value's bin } str += glyphs[ idx[i] ][ j ]; } return str; } // EXPORTS // var _$render_779 = __render_779; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; var __mergeFcn_772 = _$merge_870.factory; /* removed: var _$pick_881 = require( '@stdlib/utils/pick' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; /* removed: var _$defaults_770 = require( './defaults.js' ); */; // VARIABLES // var __debug_772 = _$browser_913( 'sparkline:line-chart:unicode:main' ); var __merge_772 = __mergeFcn_772({ 'extend': false }); // List of private properties (note: keep in alphabetical order): var __PRIVATE_PROPS_772 = [ '_infinities', '_yMax', '_yMin' ]; // List of options properties (note: keep in alphabetical order): var __OPTIONS_PROPS_772 = [ 'infinities', 'yMax', 'yMin' ]; // MAIN // /** * Unicode sparkline line chart constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain * @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain * @throws {TypeError} must provide valid options * @returns {LineChart} chart instance * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new LineChart( data ); * * var str = chart.render(); * // returns '⡈⠑⠢⠔⠒⠒⠒' * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * var opts = { * 'data': data * }; * var chart = new LineChart( opts ); * * var str = chart.render(); * // returns '⡈⠑⠢⠔⠒⠒⠒' */ function LineChart() { var options; var nargs; var opts; var keys; var key; var i; nargs = arguments.length; if ( !(this instanceof LineChart) ) { if ( nargs === 0 ) { return new LineChart(); } if ( nargs === 1 ) { return new LineChart( arguments[ 0 ] ); } return new LineChart( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } // Extract chart-specific options... opts = _$defaults_770(); if ( nargs === 1 && !_$isArrayLike_81( arguments[ 0 ] ) ) { options = arguments[ 0 ]; } else if ( nargs === 2 ) { options = arguments[ 1 ]; } else { options = {}; } opts = __merge_772( opts, _$pick_881( options, __OPTIONS_PROPS_772 ) ); __debug_772( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); // Initialize private chart-specific properties... for ( i = 0; i < __PRIVATE_PROPS_772.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_772[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set chart-specific properties... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( LineChart, _$Sparkline_729 ); /** * Boolean indicating whether to encode infinite values. * * @name infinities * @memberof LineChart.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var chart = new LineChart(); * chart.infinities = true; * * @example * var chart = new LineChart({ * 'infinities': true * }); * var bool = chart.infinities; * // returns true */ _$defineProperty_825( LineChart.prototype, 'infinities', { 'configurable': false, 'enumerable': true, 'set': _$set_774, 'get': _$get_773 }); /** * Maximum value of the y-axis domain. * * @name yMax * @memberof LineChart.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new LineChart(); * chart.yMax = 100.0; * * @example * var chart = new LineChart({ * 'yMax': 314.0 * }); * var ymax = chart.yMax; * // returns 314.0 */ _$defineProperty_825( LineChart.prototype, 'yMax', { 'configurable': false, 'enumerable': true, 'set': _$set_776, 'get': _$get_775 }); /** * Minimum value of the y-axis domain. * * @name yMin * @memberof LineChart.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new LineChart(); * chart.yMin = -100.0; * * @example * var chart = new LineChart({ * 'yMin': 3.14 * }); * var ymin = chart.yMin; * // returns 3.14 */ _$defineProperty_825( LineChart.prototype, 'yMin', { 'configurable': false, 'enumerable': true, 'set': _$set_778, 'get': _$get_777 }); /** * Renders a sparkline line chart. * * @private * @name _render * @memberof LineChart.prototype * @type {Function} * @returns {string} rendered sparkline line chart * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new LineChart( data ); * * var str = chart.render(); * // returns '⡈⠑⠢⠔⠒⠒⠒' */ LineChart.prototype._render = _$render_779; // eslint-disable-line no-underscore-dangle // EXPORTS // var _$LineChart_772 = LineChart; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline line chart. * * @module @stdlib/plot/sparklines/unicode/line * * @example * var lineChart = require( '@stdlib/plot/sparklines/unicode/line' ); * * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = lineChart( data ); * * var str = chart.render(); * // returns '⡈⠑⠢⠔⠒⠒⠒' */ // MODULES // /* removed: var _$LineChart_772 = require( './main.js' ); */; // EXPORTS // var _$lineChart_771 = _$LineChart_772; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // // See [Block Elements]{@link https://en.wikipedia.org/wiki/Block_Elements}. var UPPER_BLOCK = '▀'; // U+2580 var LOWER_BLOCK = '▄'; // U+2584 var MIDDLE = '─'; // U+2500 var __MISSING_VALUE_782 = ' '; // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_782() { /* eslint-disable no-invalid-this */ var str; var len; var d; var i; len = this._data.length; if ( len === 0 ) { return ''; } // Generate the sparkline chart, assigning a glyph to each datum... str = ''; // TODO: color encoding: one color for both pos and neg or two colors for separate colors // TODO: "loss" values diff color (red) for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( !this._isDefined( d, i ) ) { str += __MISSING_VALUE_782; } else if ( d < 0.0 ) { str += LOWER_BLOCK; } else if ( d === 0.0 ) { str += MIDDLE; } else { str += UPPER_BLOCK; } } return str; } // EXPORTS // var _$render_782 = __render_782; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; // MAIN // /** * Unicode sparkline tristate chart constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @throws {TypeError} must provide valid options * @returns {TristateChart} chart instance * * @example * var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; * * var chart = new TristateChart( data ); * * var str = chart.render(); * // returns '▄▀──▀▄▄▀' * * @example * var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; * var opts = { * 'data': data * }; * var chart = new TristateChart( opts ); * * var str = chart.render(); * // returns '▄▀──▀▄▄▀' */ function TristateChart() { var nargs; nargs = arguments.length; if ( !(this instanceof TristateChart) ) { if ( nargs === 0 ) { return new TristateChart(); } if ( nargs === 1 ) { return new TristateChart( arguments[ 0 ] ); } return new TristateChart( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( TristateChart, _$Sparkline_729 ); /** * Renders a sparkline tristate chart. * * @private * @name _render * @memberof TristateChart.prototype * @type {Function} * @returns {string} rendered sparkline tristate chart * * @example * var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; * * var chart = new TristateChart( data ); * * var str = chart.render(); * // returns '▄▀──▀▄▄▀' */ TristateChart.prototype._render = _$render_782; // eslint-disable-line no-underscore-dangle // EXPORTS // var _$TristateChart_781 = TristateChart; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline tristate chart. * * @module @stdlib/plot/sparklines/unicode/tristate * * @example * var tristateChart = require( '@stdlib/plot/sparklines/unicode/tristate' ); * * var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; * * var chart = tristateChart( data ); * * var str = chart.render(); * // returns '▄▀──▀▄▄▀' */ // MODULES // /* removed: var _$TristateChart_781 = require( './main.js' ); */; // EXPORTS // var _$tristateChart_780 = _$TristateChart_781; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // var UP = '↑'; // U+2191 var DOWN = '↓'; // U+2193 var __MISSING_VALUE_785 = ' '; // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_785() { /* eslint-disable no-invalid-this */ var str; var len; var d; var i; len = this._data.length; if ( len === 0 ) { return ''; } // Generate the sparkline chart, assigning a glyph to each datum... str = ''; // TODO: "down" values diff color (red) (?) // TODO: specify bkgd color for streaks of a given length (?) for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( !this._isDefined( d, i ) ) { str += __MISSING_VALUE_785; } else if ( d === 1 ) { str += UP; } else if ( d === -1 ) { str += DOWN; } else { str += __MISSING_VALUE_785; } } return str; } // EXPORTS // var _$render_785 = __render_785; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; // MAIN // /** * Unicode sparkline up/down chart constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @throws {TypeError} must provide valid options * @returns {UpDownChart} chart instance * * @example * var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; * * var chart = new UpDownChart( data ); * * var str = chart.render(); * // returns '↓↑↑↑↑↓↓↑' * * @example * var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; * var opts = { * 'data': data * }; * var chart = new UpDownChart( opts ); * * var str = chart.render(); * // returns '↓↑↑↑↑↓↓↑' */ function UpDownChart() { var nargs; nargs = arguments.length; if ( !(this instanceof UpDownChart) ) { if ( nargs === 0 ) { return new UpDownChart(); } if ( nargs === 1 ) { return new UpDownChart( arguments[ 0 ] ); } return new UpDownChart( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( UpDownChart, _$Sparkline_729 ); /** * Renders a sparkline up/down chart. * * @private * @name _render * @memberof UpDownChart.prototype * @type {Function} * @returns {string} rendered sparkline up/down chart * * @example * var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; * * var chart = new UpDownChart( data ); * * var str = chart.render(); * // returns '↓↑↑↑↑↓↓↑' */ UpDownChart.prototype._render = _$render_785; // eslint-disable-line no-underscore-dangle // EXPORTS // var _$UpDownChart_784 = UpDownChart; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline up/down chart. * * @module @stdlib/plot/sparklines/unicode/up-down * * @example * var updownChart = require( '@stdlib/plot/sparklines/unicode/up-down' ); * * var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; * * var chart = updownChart( data ); * * var str = chart.render(); * // returns '↓↑↑↑↑↓↓↑' */ // MODULES // /* removed: var _$UpDownChart_784 = require( './main.js' ); */; // EXPORTS // var _$updownChart_783 = _$UpDownChart_784; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // VARIABLES // // See [box-drawing characters]{@link https://en.wikipedia.org/wiki/Box-drawing_character}. var HOME_WIN = [ '└', // U+2514 '┴' // U+2534 ]; var HOME_LOSS = [ '┌', // U+250C '┬' // U+252C ]; var AWAY_WIN = '╵'; // U+2575 var AWAY_LOSS = '╷'; // U+2577 var __MISSING_VALUE_788 = ' '; // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_788() { /* eslint-disable no-invalid-this */ var str; var len; var py; var d; var i; len = this._data.length; if ( len === 0 ) { return ''; } // Generate the sparkline chart, assigning a glyph to each datum... str = ''; // TODO: "loss" values diff color (red) (?) // TODO: specify bkgd color for streaks of a given length (?) for ( i = 0; i < len; i++ ) { d = this._data[ i ]; if ( !this._isDefined( d, i ) ) { str += __MISSING_VALUE_788; } else if ( d === 2 ) { if ( py === 2 || py === -2 ) { str += HOME_WIN[ 1 ]; } else { str += HOME_WIN[ 0 ]; } } else if ( d === 1 ) { str += AWAY_WIN; } else if ( d === -1 ) { str += AWAY_LOSS; } else if ( d === -2 ) { if ( py === 2 || py === -2 ) { str += HOME_LOSS[ 1 ]; } else { str += HOME_LOSS[ 0 ]; } } else { str += __MISSING_VALUE_788; } py = d; // save the current data value to allow look-back } return str; } // EXPORTS // var _$render_788 = __render_788; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; // MAIN // /** * Unicode sparkline win/loss chart constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @throws {TypeError} must provide valid options * @returns {WinLossChart} chart instance * * @example * var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; * * var chart = new WinLossChart( data ); * * var str = chart.render(); * // returns '┌╵└┴╵╷╷╵' * * @example * var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; * var opts = { * 'data': data * }; * var chart = new WinLossChart( opts ); * * var str = chart.render(); * // returns '┌╵└┴╵╷╷╵' */ function WinLossChart() { var nargs; nargs = arguments.length; if ( !(this instanceof WinLossChart) ) { if ( nargs === 0 ) { return new WinLossChart(); } if ( nargs === 1 ) { return new WinLossChart( arguments[ 0 ] ); } return new WinLossChart( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( WinLossChart, _$Sparkline_729 ); /** * Renders a sparkline win/loss chart. * * @private * @name _render * @memberof WinLossChart.prototype * @type {Function} * @returns {string} rendered sparkline win/loss chart * * @example * var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; * * var chart = new WinLossChart( data ); * * var str = chart.render(); * // returns '┌╵└┴╵╷╷╵' */ WinLossChart.prototype._render = _$render_788; // eslint-disable-line no-underscore-dangle // EXPORTS // var _$WinLossChart_787 = WinLossChart; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline win/loss chart. * * @module @stdlib/plot/sparklines/unicode/win-loss * * @example * var winlossChart = require( '@stdlib/plot/sparklines/unicode/win-loss' ); * * var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; * * var chart = winlossChart( data ); * * var str = chart.render(); * // returns '┌╵└┴╵╷╷╵' */ // MODULES // /* removed: var _$WinLossChart_787 = require( './main.js' ); */; // EXPORTS // var _$winlossChart_786 = _$WinLossChart_787; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$columnChart_748 = require( '@stdlib/plot/sparklines/unicode/column' ); */; /* removed: var _$lineChart_771 = require( '@stdlib/plot/sparklines/unicode/line' ); */; /* removed: var _$tristateChart_780 = require( '@stdlib/plot/sparklines/unicode/tristate' ); */; /* removed: var _$updownChart_783 = require( '@stdlib/plot/sparklines/unicode/up-down' ); */; /* removed: var _$winlossChart_786 = require( '@stdlib/plot/sparklines/unicode/win-loss' ); */; // VARIABLES // var __debug_769 = _$browser_913( 'sparkline:unicode:render' ); // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_769() { /* eslint-disable no-invalid-this */ var out; __debug_769( 'Rendering...' ); switch ( this._type ) { // eslint-disable-line default-case case 'column': out = _$columnChart_748.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle break; case 'line': out = _$lineChart_771.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle break; case 'tristate': out = _$tristateChart_780.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle break; case 'up-down': out = _$updownChart_783.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle break; case 'win-loss': out = _$winlossChart_786.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle break; } this.emit( 'render', out ); return out; } // EXPORTS // var _$render_769 = __render_769; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$browser_913 = require( 'debug' ); */; /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$keys_860 = require( '@stdlib/utils/keys' ); */; /* removed: var _$isArrayLike_81 = require( '@stdlib/assert/is-array-like' ); */; var __mergeFcn_759 = _$merge_870.factory; /* removed: var _$pick_881 = require( '@stdlib/utils/pick' ); */; /* removed: var _$inherit_846 = require( '@stdlib/utils/inherit' ); */; /* removed: var _$Sparkline_729 = require( '@stdlib/plot/sparklines/base/ctor' ); */; /* removed: var _$defaults_757 = require( './defaults.js' ); */; // VARIABLES // var __debug_759 = _$browser_913( 'sparkline:unicode:main' ); var __merge_759 = __mergeFcn_759({ 'extend': false }); // List of private properties (note: keep in alphabetical order): var __PRIVATE_PROPS_759 = [ '_infinities', '_type', '_yMax', '_yMin' ]; // List of options properties (note: keep in alphabetical order): var __OPTIONS_PROPS_759 = [ 'infinities', 'type', 'yMax', 'yMin' ]; // MAIN // /** * Unicode sparkline constructor. * * @constructor * @param {(ArrayLike|ndarrayLike)} [data] - chart data * @param {Options} [options] - chart options * @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event * @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size * @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data * @param {string} [options.description=''] - chart description * @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values * @param {Function} [options.isDefined] - accessor indicating whether a datum is defined * @param {string} [options.label] - data label * @param {string} [options.type='column'] - chart type * @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain * @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain * @throws {TypeError} must provide valid options * @returns {UnicodeSparkline} chart instance * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new UnicodeSparkline( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * var opts = { * 'data': data * }; * var chart = new UnicodeSparkline( opts ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ function UnicodeSparkline() { var options; var nargs; var opts; var keys; var key; var i; nargs = arguments.length; if ( !(this instanceof UnicodeSparkline) ) { if ( nargs === 0 ) { return new UnicodeSparkline(); } if ( nargs === 1 ) { return new UnicodeSparkline( arguments[ 0 ] ); } return new UnicodeSparkline( arguments[ 0 ], arguments[ 1 ] ); } // Invoke parent constructor... if ( nargs === 0 ) { _$Sparkline_729.call( this ); } else if ( nargs === 1 ) { _$Sparkline_729.call( this, arguments[ 0 ] ); } else { _$Sparkline_729.call( this, arguments[ 0 ], arguments[ 1 ] ); } // Extract chart-specific options... opts = _$defaults_757(); if ( nargs === 1 && !_$isArrayLike_81( arguments[ 0 ] ) ) { options = arguments[ 0 ]; } else if ( nargs === 2 ) { options = arguments[ 1 ]; } else { options = {}; } opts = __merge_759( opts, _$pick_881( options, __OPTIONS_PROPS_759 ) ); __debug_759( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); // Initialize private chart-specific properties... for ( i = 0; i < __PRIVATE_PROPS_759.length; i++ ) { _$defineProperty_825( this, __PRIVATE_PROPS_759[i], { 'configurable': false, 'enumerable': false, 'writable': true, 'value': null }); } // Set chart-specific properties... keys = _$keys_860( opts ); for ( i = 0; i < keys.length; i++ ) { key = keys[ i ]; this[ key ] = opts[ key ]; } return this; } /* * Inherit from the `Sparkline` prototype. */ _$inherit_846( UnicodeSparkline, _$Sparkline_729 ); /** * Boolean indicating whether to encode infinite values. * * @name infinities * @memberof UnicodeSparkline.prototype * @type {boolean} * @throws {TypeError} must be a boolean primitive * @default false * * @example * var chart = new UnicodeSparkline(); * chart.infinities = true; * * @example * var chart = new UnicodeSparkline({ * 'infinities': true * }); * var bool = chart.infinities; * // returns true */ _$defineProperty_825( UnicodeSparkline.prototype, 'infinities', { 'configurable': false, 'enumerable': true, 'set': _$set_761, 'get': _$get_760 }); /** * Sparkline chart type. * * @name types * @memberof UnicodeSparkline.prototype * @type {string} * @throws {TypeError} must be a supported chart type * @default 'column' * * @example * var chart = new UnicodeSparkline(); * chart.type = 'win-loss'; * * @example * var chart = new UnicodeSparkline({ * 'type': 'win-loss' * }); * var type = chart.type; * // returns 'win-loss' */ _$defineProperty_825( UnicodeSparkline.prototype, 'type', { 'configurable': false, 'enumerable': true, 'set': _$set_764, 'get': _$get_763 }); /** * Maximum value of the y-axis domain. * * @name yMax * @memberof UnicodeSparkline.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new UnicodeSparkline(); * chart.yMax = 100.0; * * @example * var chart = new UnicodeSparkline({ * 'yMax': 314.0 * }); * var ymax = chart.yMax; * // returns 314.0 */ _$defineProperty_825( UnicodeSparkline.prototype, 'yMax', { 'configurable': false, 'enumerable': true, 'set': _$set_766, 'get': _$get_765 }); /** * Minimum value of the y-axis domain. * * @name yMin * @memberof UnicodeSparkline.prototype * @type {(FiniteNumber|null)} * @throws {TypeError} must be a finite number primitive or null * * @example * var chart = new UnicodeSparkline(); * chart.yMin = -100.0; * * @example * var chart = new UnicodeSparkline({ * 'yMin': 3.14 * }); * var ymin = chart.yMin; * // returns 3.14 */ _$defineProperty_825( UnicodeSparkline.prototype, 'yMin', { 'configurable': false, 'enumerable': true, 'set': _$set_768, 'get': _$get_767 }); /** * Renders a sparkline chart. * * @name render * @memberof UnicodeSparkline.prototype * @type {Function} * @returns {string} rendered sparkline chart * * @example * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = new UnicodeSparkline( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ UnicodeSparkline.prototype.render = _$render_769; // EXPORTS // var _$UnicodeSparkline_759 = UnicodeSparkline; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a Unicode sparkline. * * @module @stdlib/plot/sparklines/unicode * * @example * var sparkline = require( '@stdlib/plot/sparklines/unicode' ); * * var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; * * var chart = sparkline( data ); * * var str = chart.render(); * // returns '▁█▅▃▆▆▅' */ // MODULES // /* removed: var _$UnicodeSparkline_759 = require( './main.js' ); */; // EXPORTS // var _$sparkline_758 = _$UnicodeSparkline_759; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * `x`-value accessor function. * * @private * @param {number} x - input value * @returns {number} input value * * @example * var v = xValue( 5.0 ); * // returns 5.0 */ function xValue( x ) { return x; } // EXPORTS // var _$xValue_802 = xValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * `y`-value accessor function. * * @private * @param {number} y - input value * @returns {number} input value * * @example * var v = yValue( 5.0 ); * // returns 5.0 */ function yValue( y ) { return y; } // EXPORTS // var _$yValue_803 = yValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; // MAIN // /** * Tests if a numeric value is infinite. * * @param {number} x - value to test * @returns {boolean} boolean indicating whether the value is infinite * * @example * var bool = isInfinite( Infinity ); * // returns true * * @example * var bool = isInfinite( -Infinity ); * // returns true * * @example * var bool = isInfinite( 5.0 ); * // returns false * * @example * var bool = isInfinite( NaN ); * // returns false */ function isInfinite( x ) { return (x === _$FLOAT64_PINF_207 || x === _$FLOAT64_NINF_206); } // EXPORTS // var _$isInfinite_221 = isInfinite; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Test if a numeric value is infinite. * * @module @stdlib/math/base/assert/is-infinite * * @example * var isInfinite = require( '@stdlib/math/base/assert/is-infinite' ); * * var bool = isInfinite( Infinity ); * // returns true * * bool = isInfinite( -Infinity ); * // returns true * * bool = isInfinite( 5.0 ); * // returns false * * bool = isInfinite( NaN ); * // returns false */ // MODULES // /* removed: var _$isInfinite_221 = require( './is_infinite.js' ); */; // EXPORTS // var _$isInfinite_220 = _$isInfinite_221; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; /* removed: var _$round_238 = require( '@stdlib/math/base/special/round' ); */; /* removed: var _$isInfinite_220 = require( '@stdlib/math/base/assert/is-infinite' ); */; // MAIN // /** * Formats data to a standard representation. This is required for non-deterministic accessors. * * @private * @param {(Array|TypedArray)} data - data to standardize * @param {Function} getValue - accessor function * @returns {ObjectArray} standardized data * * @example * var data = [{'y':5.0},{'y':3.0},{'y':2.0}]; * function yValue( d ) { * return d.y; * } * var arr = formatData( data, yValue ); * // returns [ 5.0, 3.0, 2.0 ] */ function formatData( data, getValue ) { var out; var d; var i; // TODO: add support for `ndarray`-like interfaces out = new Array( data.length ); for ( i = 0; i < data.length; i++ ) { d = getValue( data[ i ], i ); if ( _$isnan_224( d ) || _$isInfinite_220( d ) ) { continue; } out[ i ] = _$round_238( d ); } return out; } // EXPORTS // var _$formatData_790 = formatData; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isPlainObject_153 = require( '@stdlib/assert/is-plain-object' ); */; /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; /* removed: var _$isTypedArray_171 = require( '@stdlib/assert/is-typed-array' ); */; var __isPositiveInteger_801 = _$isPositiveInteger_155.isPrimitive; /* removed: var _$hasOwnProp_55 = require( '@stdlib/assert/has-own-property' ); */; // MAIN // /** * Validates function options. * * @private * @param {Options} opts - function options * @param {(Array|TypedArray)} [opts.x] - chart data * @param {(Array|TypedArray)} [opts.y] - chart data * @param {Function} [opts.xValue] - x-value accessor * @param {Function} [opts.yValue] - y-value accessor * @param {PositiveInteger} leafDigits - number of digits to display as leafs * @returns {(Error|null)} error or null * * @example * var opts = { * 'x': [ 23, 11, 137, 58 ], * 'y': [ 21, 11, 39, 80 ] * }; * var err = validate( opts ); * if ( err ) { * throw err; * } */ function __validate_801( opts ) { if ( !_$isPlainObject_153( opts ) ) { return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' ); } if ( _$hasOwnProp_55( opts, 'x' ) ) { if ( !_$isArray_83( opts.x ) && !_$isTypedArray_171( opts.x ) ) { return new TypeError( 'invalid option. `x` option must be an array or typed array. Option: `' + opts.x + '`.' ); } } if ( _$hasOwnProp_55( opts, 'xValue' ) ) { if ( !_$isFunction_112( opts.xValue ) ) { return new TypeError( 'invalid option. `xValue` option must be a function. Option: `' + opts.xValue + '`.' ); } } if ( _$hasOwnProp_55( opts, 'y' ) ) { if ( !_$isArray_83( opts.y ) && !_$isTypedArray_171( opts.y ) ) { return new TypeError( 'invalid option. `y` option must be an array or typed array. Option: `' + opts.y + '`.' ); } } if ( _$hasOwnProp_55( opts, 'yValue' ) ) { if ( !_$isFunction_112( opts.yValue ) ) { return new TypeError( 'invalid option. `yValue` option must be a function. Option: `' + opts.yValue + '`.' ); } } if ( _$hasOwnProp_55( opts, 'leafDigits' ) ) { if ( !__isPositiveInteger_801( opts.leafDigits ) ) { return new TypeError( 'invalid option. `leafDigits` option must be a positive integer. Option: `' + opts.leafDigits + '`.' ); } } return null; } // EXPORTS // var _$validate_801 = __validate_801; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // MAIN // /** * Sets the x-value accessor. * * @private * @param {Function} fcn - accessor function * @throws {TypeError} must be a function */ function setXValue( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `xValue` must be a function. Value: `' + fcn + '`.' ); } this._xValue = fcn; } // EXPORTS // var _$setXValue_798 = setXValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the x-value accessor. * * @private * @returns {Function} x-value accessor */ function getXValue() { /* eslint-disable no-invalid-this */ return this._xValue; } // EXPORTS // var _$getXValue_792 = getXValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isFunction_112 = require( '@stdlib/assert/is-function' ); */; // MAIN // /** * Sets the y-value accessor. * * @private * @param {Function} fcn - accessor function * @throws {TypeError} must be a function */ function setYValue( fcn ) { /* eslint-disable no-invalid-this */ if ( !_$isFunction_112( fcn ) ) { throw new TypeError( 'invalid value. `yValue` must be a function. Value: `' + fcn + '`.' ); } this._yValue = fcn; } // EXPORTS // var _$setYValue_800 = setYValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Returns the y-value accessor. * * @private * @returns {Function} y-value accessor */ function getYValue() { /* eslint-disable no-invalid-this */ return this._yValue; } // EXPORTS // var _$getYValue_794 = getYValue; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isTypedArray_171 = require( '@stdlib/assert/is-typed-array' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; /* removed: var _$formatData_790 = require( './format_data.js' ); */; // MAIN // /** * Sets the first chart data. * * @private * @param {(Array|TypedArray)} x - data * @throws {TypeError} must be an array or typed array */ function setX( x ) { /* eslint-disable no-invalid-this */ if ( !_$isArray_83( x ) && !_$isTypedArray_171( x ) ) { throw new TypeError( 'invalid value. Must be an array or typed array. Value: `' + x + '`.' ); } this._x = _$formatData_790( x, this._xValue ); } // EXPORTS // var _$setX_797 = setX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; // MAIN // /** * Returns first chart data. * * @private * @returns {(Array|TypedArray)} first stem-and-leaf data */ function getX() { /* eslint-disable no-invalid-this */ return _$copy_816( this._x ); } // EXPORTS // var _$getX_791 = getX; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$isTypedArray_171 = require( '@stdlib/assert/is-typed-array' ); */; /* removed: var _$isArray_83 = require( '@stdlib/assert/is-array' ); */; /* removed: var _$formatData_790 = require( './format_data.js' ); */; // MAIN // /** * Sets the second chart data. * * @private * @param {(Array|TypedArray)} y - data * @throws {TypeError} must be an array or typed array */ function setY( y ) { /* eslint-disable no-invalid-this */ if ( !_$isArray_83( y ) && !_$isTypedArray_171( y ) ) { throw new TypeError( 'invalid value. Must be an array or typed array. Value: `' + y + '`.' ); } this._y = _$formatData_790( y, this._yValue ); } // EXPORTS // var _$setY_799 = setY; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$copy_816 = require( '@stdlib/utils/copy' ); */; // MAIN // /** * Returns second chart data. * * @private * @returns {(Array|TypedArray)} second stem-and-leaf data */ function getY() { /* eslint-disable no-invalid-this */ return _$copy_816( this._y ); } // EXPORTS // var _$getY_793 = getY; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The bias of a double-precision floating-point number's exponent. * * @module @stdlib/constants/math/float64-exponent-bias * @type {integer32} * * @example * var FLOAT64_EXPONENT_BIAS = require( '@stdlib/constants/math/float64-exponent-bias' ); * // returns 1023 */ // MAIN // /** * Bias of a double-precision floating-point number's exponent. * * ## Notes * * The bias can be computed via * * ```tex * \mathrm{bias} = 2^{k-1} - 1 * ``` * * where \\(k\\) is the number of bits in the exponent; here, \\(k = 11\\). * * @constant * @type {integer32} * @default 1023 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_EXPONENT_BIAS = 1023|0; // asm type annotation // EXPORTS // var _$FLOAT64_EXPONENT_BIAS_198 = FLOAT64_EXPONENT_BIAS; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The maximum biased base 2 exponent for a double-precision floating-point number. * * @module @stdlib/constants/math/float64-max-base2-exponent * @type {integer32} * * @example * var FLOAT64_MAX_BASE2_EXPONENT = require( '@stdlib/constants/math/float64-max-base2-exponent' ); * // returns 1023 */ // MAIN // /** * The maximum biased base 2 exponent for a double-precision floating-point number. * * ```text * 11111111110 => 2046 - BIAS = 1023 * ``` * * where `BIAS = 1023`. * * @constant * @type {integer32} * @default 1023 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MAX_BASE2_EXPONENT = 1023|0; // asm type annotation // EXPORTS // var _$FLOAT64_MAX_BASE2_EXPONENT_202 = FLOAT64_MAX_BASE2_EXPONENT; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The maximum biased base 2 exponent for a subnormal double-precision floating-point number. * * @module @stdlib/constants/math/float64-max-base2-exponent-subnormal * @type {integer32} * * @example * var FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL = require( '@stdlib/constants/math/float64-max-base2-exponent-subnormal' ); * // returns -1023 */ // MAIN // /** * The maximum biased base 2 exponent for a subnormal double-precision floating-point number. * * ```text * 00000000000 => 0 - BIAS = -1023 * ``` * * where `BIAS = 1023`. * * @constant * @type {integer32} * @default -1023 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL = -1023|0; // asm type annotation // EXPORTS // var _$FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL_201 = FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The minimum biased base 2 exponent for a subnormal double-precision floating-point number. * * @module @stdlib/constants/math/float64-min-base2-exponent-subnormal * @type {integer32} * * @example * var FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL = require( '@stdlib/constants/math/float64-min-base2-exponent-subnormal' ); * // returns -1074 */ // MAIN // /** * The minimum biased base 2 exponent for a subnormal double-precision floating-point number. * * ```text * -(BIAS+(52-1)) = -(1023+51) = -1074 * ``` * * where `BIAS = 1023` and `52` is the number of digits in the significand. * * @constant * @type {integer32} * @default -1074 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL = -1074|0; // asm type annotation // EXPORTS // var _$FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL_205 = FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_26 = require( '@stdlib/array/uint8' ); */; /* removed: var _$ctor_20 = require( '@stdlib/array/uint16' ); */; // MAIN // var ctors = { 'uint16': _$ctor_20, 'uint8': _$ctor_26 }; // EXPORTS // var _$ctors_125 = ctors; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctors_125 = require( './ctors.js' ); */; // VARIABLES // var __bool_127; // FUNCTIONS // /** * Returns a boolean indicating if an environment is little endian. * * @private * @returns {boolean} boolean indicating if an environment is little endian * * @example * var bool = isLittleEndian(); * // returns */ function isLittleEndian() { var uint16view; var uint8view; uint16view = new _$ctors_125[ 'uint16' ]( 1 ); /* * Set the uint16 view to a value having distinguishable lower and higher order words. * * 4660 => 0x1234 => 0x12 0x34 => '00010010 00110100' => (0x12,0x34) == (18,52) */ uint16view[ 0 ] = 0x1234; // Create a uint8 view on top of the uint16 buffer: uint8view = new _$ctors_125[ 'uint8' ]( uint16view.buffer ); // If little endian, the least significant byte will be first... return ( uint8view[ 0 ] === 0x34 ); } // MAIN // __bool_127 = isLittleEndian(); // EXPORTS // var _$bool_127 = __bool_127; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a boolean indicating if an environment is little endian. * * @module @stdlib/assert/is-little-endian * * @example * var IS_LITTLE_ENDIAN = require( '@stdlib/assert/is-little-endian' ); * * var bool = IS_LITTLE_ENDIAN; * // returns */ // MODULES // /* removed: var _$bool_127 = require( './main.js' ); */; // EXPORTS // var _$IS_LITTLE_ENDIAN_126 = _$bool_127; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$IS_LITTLE_ENDIAN_126 = require( '@stdlib/assert/is-little-endian' ); */; // MAIN // var indices; var HIGH; var LOW; if ( _$IS_LITTLE_ENDIAN_126 === true ) { HIGH = 1; // second index LOW = 0; // first index } else { HIGH = 0; // first index LOW = 1; // second index } indices = { 'HIGH': HIGH, 'LOW': LOW }; // EXPORTS // var _$indices_245 = indices; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$IS_LITTLE_ENDIAN_126 = require( '@stdlib/assert/is-little-endian' ); */; // MAIN // var __indices_254; var __HIGH_254; var __LOW_254; if ( _$IS_LITTLE_ENDIAN_126 === true ) { __HIGH_254 = 1; // second index __LOW_254 = 0; // first index } else { __HIGH_254 = 0; // first index __LOW_254 = 1; // second index } __indices_254 = { 'HIGH': __HIGH_254, 'LOW': __LOW_254 }; // EXPORTS // var _$indices_254 = __indices_254; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; /* removed: var _$indices_254 = require( './indices.js' ); */; // VARIABLES // var FLOAT64_VIEW = new _$ctor_5( 1 ); var UINT32_VIEW = new _$ctor_23( FLOAT64_VIEW.buffer ); var __HIGH_256 = _$indices_254.HIGH; var __LOW_256 = _$indices_254.LOW; // MAIN // /** * Splits a floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer). * * ## Notes * * ```text * float64 (64 bits) * f := fraction (significand/mantissa) (52 bits) * e := exponent (11 bits) * s := sign bit (1 bit) * * |-------- -------- -------- -------- -------- -------- -------- --------| * | Float64 | * |-------- -------- -------- -------- -------- -------- -------- --------| * | Uint32 | Uint32 | * |-------- -------- -------- -------- -------- -------- -------- --------| * ``` * * If little endian (more significant bits last): * * ```text * <-- lower higher --> * | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 | * ``` * * If big endian (more significant bits first): * * ```text * <-- higher lower --> * |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 | * ``` * * In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first. * * * ## References * * - [Open Group][1] * * [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm * * * @private * @param {(Array|TypedArray|Object)} out - output array * @param {number} x - input value * @returns {(Array|TypedArray|Object)} output array * * @example * var Uint32Array = require( '@stdlib/array/uint32' ); * * var out = new Uint32Array( 2 ); * * var w = toWords( out, 3.14e201 ); * // returns [ 1774486211, 2479577218 ] * * var bool = ( w === out ); * // returns true */ function toWords( out, x ) { FLOAT64_VIEW[ 0 ] = x; out[ 0 ] = UINT32_VIEW[ __HIGH_256 ]; out[ 1 ] = UINT32_VIEW[ __LOW_256 ]; return out; } // EXPORTS // var _$toWords_256 = toWords; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$toWords_256 = require( './to_words.js' ); */; // MAIN // /** * Splits a floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer). * * @param {(Array|TypedArray|Object)} [out] - output array * @param {number} x - input value * @returns {(Array|TypedArray|Object)} output array * * @example * var w = toWords( 3.14e201 ); * // returns [ 1774486211, 2479577218 ] * * @example * var Uint32Array = require( '@stdlib/array/uint32' ); * * var out = new Uint32Array( 2 ); * * var w = toWords( out, 3.14e201 ); * // returns [ 1774486211, 2479577218 ] * * var bool = ( w === out ); * // returns true */ function __toWords_255( out, x ) { if ( arguments.length === 1 ) { return _$toWords_256( [ 0, 0 ], out ); } return _$toWords_256( out, x ); } // EXPORTS // var _$toWords_255 = __toWords_255; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Split a floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer). * * @module @stdlib/number/float64/base/to-words * * @example * var toWords = require( '@stdlib/number/float64/base/to-words' ); * * var w = toWords( 3.14e201 ); * // returns [ 1774486211, 2479577218 ] * * @example * var Uint32Array = require( '@stdlib/array/uint32' ); * var toWords = require( '@stdlib/number/float64/base/to-words' ); * * var out = new Uint32Array( 2 ); * * var w = toWords( out, 3.14e201 ); * // returns [ 1774486211, 2479577218 ] * * var bool = ( w === out ); * // returns true */ // MODULES // /* removed: var _$toWords_255 = require( './main.js' ); */; // EXPORTS // var _$toWords_253 = _$toWords_255; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$IS_LITTLE_ENDIAN_126 = require( '@stdlib/assert/is-little-endian' ); */; // MAIN // var __HIGH_247; if ( _$IS_LITTLE_ENDIAN_126 === true ) { __HIGH_247 = 1; // second index } else { __HIGH_247 = 0; // first index } // EXPORTS // var _$HIGH_247 = __HIGH_247; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; /* removed: var _$HIGH_247 = require( './high.js' ); */; // VARIABLES // var __FLOAT64_VIEW_249 = new _$ctor_5( 1 ); var __UINT32_VIEW_249 = new _$ctor_23( __FLOAT64_VIEW_249.buffer ); // MAIN // /** * Returns an unsigned 32-bit integer corresponding to the more significant 32 bits of a double-precision floating-point number. * * ## Notes * * ```text * float64 (64 bits) * f := fraction (significand/mantissa) (52 bits) * e := exponent (11 bits) * s := sign bit (1 bit) * * |-------- -------- -------- -------- -------- -------- -------- --------| * | Float64 | * |-------- -------- -------- -------- -------- -------- -------- --------| * | Uint32 | Uint32 | * |-------- -------- -------- -------- -------- -------- -------- --------| * ``` * * If little endian (more significant bits last): * * ```text * <-- lower higher --> * | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 | * ``` * * If big endian (more significant bits first): * * ```text * <-- higher lower --> * |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 | * ``` * * In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first. * * * ## References * * - [Open Group][1] * * [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm * * @param {number} x - input value * @returns {uinteger32} higher order word * * @example * var w = getHighWord( 3.14e201 ); // => 01101001110001001000001011000011 * // returns 1774486211 */ function getHighWord( x ) { __FLOAT64_VIEW_249[ 0 ] = x; return __UINT32_VIEW_249[ _$HIGH_247 ]; } // EXPORTS // var _$getHighWord_249 = getHighWord; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return an unsigned 32-bit integer corresponding to the more significant 32 bits of a double-precision floating-point number. * * @module @stdlib/number/float64/base/get-high-word * * @example * var getHighWord = require( '@stdlib/number/float64/base/get-high-word' ); * * var w = getHighWord( 3.14e201 ); // => 01101001110001001000001011000011 * // returns 1774486211 */ // MODULES // /* removed: var _$getHighWord_249 = require( './main.js' ); */; // EXPORTS // var _$getHighWord_248 = _$getHighWord_249; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$ctor_23 = require( '@stdlib/array/uint32' ); */; /* removed: var _$ctor_5 = require( '@stdlib/array/float64' ); */; /* removed: var _$indices_245 = require( './indices.js' ); */; // VARIABLES // var __FLOAT64_VIEW_246 = new _$ctor_5( 1 ); var __UINT32_VIEW_246 = new _$ctor_23( __FLOAT64_VIEW_246.buffer ); var __HIGH_246 = _$indices_245.HIGH; var __LOW_246 = _$indices_245.LOW; // MAIN // /** * Creates a double-precision floating-point number from a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer). * * ## Notes * * ```text * float64 (64 bits) * f := fraction (significand/mantissa) (52 bits) * e := exponent (11 bits) * s := sign bit (1 bit) * * |-------- -------- -------- -------- -------- -------- -------- --------| * | Float64 | * |-------- -------- -------- -------- -------- -------- -------- --------| * | Uint32 | Uint32 | * |-------- -------- -------- -------- -------- -------- -------- --------| * ``` * * If little endian (more significant bits last): * * ```text * <-- lower higher --> * | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 | * ``` * * If big endian (more significant bits first): * * ```text * <-- higher lower --> * |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 | * ``` * * * In which Uint32 should we place the higher order bits? If little endian, the second; if big endian, the first. * * * ## References * * - [Open Group][1] * * [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm * * @param {uinteger32} high - higher order word (unsigned 32-bit integer) * @param {uinteger32} low - lower order word (unsigned 32-bit integer) * @returns {number} floating-point number * * @example * var v = fromWords( 1774486211, 2479577218 ); * // returns 3.14e201 * * @example * var v = fromWords( 3221823995, 1413754136 ); * // returns -3.141592653589793 * * @example * var v = fromWords( 0, 0 ); * // returns 0.0 * * @example * var v = fromWords( 2147483648, 0 ); * // returns -0.0 * * @example * var v = fromWords( 2146959360, 0 ); * // returns NaN * * @example * var v = fromWords( 2146435072, 0 ); * // returns Infinity * * @example * var v = fromWords( 4293918720, 0 ); * // returns -Infinity */ function fromWords( high, low ) { __UINT32_VIEW_246[ __HIGH_246 ] = high; __UINT32_VIEW_246[ __LOW_246 ] = low; return __FLOAT64_VIEW_246[ 0 ]; } // EXPORTS // var _$fromWords_246 = fromWords; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Create a double-precision floating-point number from a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer). * * @module @stdlib/number/float64/base/from-words * * @example * var fromWords = require( '@stdlib/number/float64/base/from-words' ); * * var v = fromWords( 1774486211, 2479577218 ); * // returns 3.14e201 * * v = fromWords( 3221823995, 1413754136 ); * // returns -3.141592653589793 * * v = fromWords( 0, 0 ); * // returns 0.0 * * v = fromWords( 2147483648, 0 ); * // returns -0.0 * * v = fromWords( 2146959360, 0 ); * // returns NaN * * v = fromWords( 2146435072, 0 ); * // returns Infinity * * v = fromWords( 4293918720, 0 ); * // returns -Infinity */ // MODULES // /* removed: var _$fromWords_246 = require( './main.js' ); */; // EXPORTS // var _$fromWords_244 = _$fromWords_246; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$toWords_253 = require( '@stdlib/number/float64/base/to-words' ); */; /* removed: var _$getHighWord_248 = require( '@stdlib/number/float64/base/get-high-word' ); */; /* removed: var _$fromWords_244 = require( '@stdlib/number/float64/base/from-words' ); */; // VARIABLES // // 10000000000000000000000000000000 => 2147483648 => 0x80000000 var SIGN_MASK = 0x80000000>>>0; // asm type annotation // 01111111111111111111111111111111 => 2147483647 => 0x7fffffff var MAGNITUDE_MASK = 0x7fffffff|0; // asm type annotation // High/low words workspace: var WORDS = [ 0, 0 ]; // WARNING: not thread safe // MAIN // /** * Returns a double-precision floating-point number with the magnitude of `x` and the sign of `y`. * * @param {number} x - number from which to derive a magnitude * @param {number} y - number from which to derive a sign * @returns {number} a double-precision floating-point number * * @example * var z = copysign( -3.14, 10.0 ); * // returns 3.14 * * @example * var z = copysign( 3.14, -1.0 ); * // returns -3.14 * * @example * var z = copysign( 1.0, -0.0 ); * // returns -1.0 * * @example * var z = copysign( -3.14, -0.0 ); * // returns -3.14 * * @example * var z = copysign( -0.0, 1.0 ); * // returns 0.0 */ function copysign( x, y ) { var hx; var hy; // Split `x` into higher and lower order words: _$toWords_253( WORDS, x ); hx = WORDS[ 0 ]; // Turn off the sign bit of `x`: hx &= MAGNITUDE_MASK; // Extract the higher order word from `y`: hy = _$getHighWord_248( y ); // Leave only the sign bit of `y` turned on: hy &= SIGN_MASK; // Copy the sign bit of `y` to `x`: hx |= hy; // Return a new value having the same magnitude as `x`, but with the sign of `y`: return _$fromWords_244( hx, WORDS[ 1 ] ); } // EXPORTS // var _$copysign_228 = copysign; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a double-precision floating-point number with the magnitude of `x` and the sign of `y`. * * @module @stdlib/math/base/special/copysign * * @example * var copysign = require( '@stdlib/math/base/special/copysign' ); * * var z = copysign( -3.14, 10.0 ); * // returns 3.14 * * z = copysign( 3.14, -1.0 ); * // returns -3.14 * * z = copysign( 1.0, -0.0 ); * // returns -1.0 * * z = copysign( -3.14, -0.0 ); * // returns -3.14 * * z = copysign( -0.0, 1.0 ); * // returns 0.0 */ // MODULES // /* removed: var _$copysign_228 = require( './copysign.js' ); */; // EXPORTS // var _$copysign_229 = _$copysign_228; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Smallest positive double-precision floating-point normal number. * * @module @stdlib/constants/math/float64-smallest-normal * @type {number} * * @example * var FLOAT64_SMALLEST_NORMAL = require( '@stdlib/constants/math/float64-smallest-normal' ); * // returns 2.2250738585072014e-308 */ // MAIN // /** * The smallest positive double-precision floating-point normal number. * * ## Notes * * The number has the value * * ```tex * \frac{1}{2^{1023-1}} * ``` * * which corresponds to the bit sequence * * ```binarystring * 0 00000000001 00000000000000000000 00000000000000000000000000000000 * ``` * * @constant * @type {number} * @default 2.2250738585072014e-308 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_SMALLEST_NORMAL = 2.2250738585072014e-308; // EXPORTS // var _$FLOAT64_SMALLEST_NORMAL_208 = FLOAT64_SMALLEST_NORMAL; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$FLOAT64_SMALLEST_NORMAL_208 = require( '@stdlib/constants/math/float64-smallest-normal' ); */; /* removed: var _$isInfinite_220 = require( '@stdlib/math/base/assert/is-infinite' ); */; /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; /* removed: var _$abs_227 = require( '@stdlib/math/base/special/abs' ); */; // VARIABLES // // (1<<52) var SCALAR = 4503599627370496; // MAIN // /** * Returns a normal number `y` and exponent `exp` satisfying \\(x = y \cdot 2^\mathrm{exp}\\). * * @private * @param {(Array|TypedArray|Object)} out - output array * @param {number} x - input value * @returns {(Array|TypedArray|Object)} output array * * @example * var pow = require( '@stdlib/math/base/special/pow' ); * * var out = normalize( new Array( 2 ), 3.14e-319 ); * // returns [ 1.4141234400356668e-303, -52 ] * * var y = out[ 0 ]; * var exp = out[ 1 ]; * * var bool = ( y*pow(2.0,exp) === 3.14e-319 ); * // returns true * * @example * var out = normalize( new Array( 2 ), 0.0 ); * // returns [ 0.0, 0 ]; * * @example * var out = normalize( new Array( 2 ), Infinity ); * // returns [ Infinity, 0 ] * * @example * var out = normalize( new Array( 2 ), -Infinity ); * // returns [ -Infinity, 0 ] * * @example * var out = normalize( new Array( 2 ), NaN ); * // returns [ NaN, 0 ] */ function normalize( out, x ) { if ( _$isnan_224( x ) || _$isInfinite_220( x ) ) { out[ 0 ] = x; out[ 1 ] = 0; return out; } if ( x !== 0.0 && _$abs_227( x ) < _$FLOAT64_SMALLEST_NORMAL_208 ) { out[ 0 ] = x * SCALAR; out[ 1 ] = -52; return out; } out[ 0 ] = x; out[ 1 ] = 0; return out; } // EXPORTS // var _$normalize_252 = normalize; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$normalize_252 = require( './normalize.js' ); */; // MAIN // /** * Returns a normal number `y` and exponent `exp` satisfying \\(x = y \cdot 2^\mathrm{exp}\\). * * @param {(Array|TypedArray|Object)} [out] - output array * @param {number} x - input value * @returns {(Array|TypedArray|Object)} output array * * @example * var pow = require( '@stdlib/math/base/special/pow' ); * * var out = normalize( new Array( 2 ), 3.14e-319 ); * // returns [ 1.4141234400356668e-303, -52 ] * * var y = out[ 0 ]; * var exp = out[ 1 ]; * * var bool = ( y*pow(2.0,exp) === 3.14e-319 ); * // returns true * * @example * var Float64Array = require( '@stdlib/array/float64' ); * var pow = require( '@stdlib/math/base/special/pow' ); * * var out = new Float64Array( 2 ); * * var v = normalize( out, 3.14e-319 ); * // returns [ 1.4141234400356668e-303, -52 ] * * var bool = ( v === out ); * // returns true * * @example * var out = normalize( new Array( 2 ), 0.0 ); * // returns [ 0.0, 0 ] * * @example * var out = normalize( new Array( 2 ), Infinity ); * // returns [ Infinity, 0 ] * * @example * var out = normalize( new Array( 2 ), -Infinity ); * // returns [ -Infinity, 0 ] * * @example * var out = normalize( new Array( 2 ), NaN ); * // returns [ NaN, 0 ] */ function __normalize_251( out, x ) { if ( arguments.length === 1 ) { return _$normalize_252( [ 0.0, 0 ], out ); } return _$normalize_252( out, x ); } // EXPORTS // var _$normalize_251 = __normalize_251; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return a normal number `y` and exponent `exp` satisfying \\(x = y \cdot 2^\mathrm{exp}\\). * * @module @stdlib/number/float64/base/normalize * * @example * var normalize = require( '@stdlib/number/float64/base/normalize' ); * var pow = require( '@stdlib/math/base/special/pow' ); * * var out = normalize( 3.14e-319 ); * // returns [ 1.4141234400356668e-303, -52 ] * * var y = out[ 0 ]; * var exp = out[ 1 ]; * * var bool = ( y*pow(2.0,exp) === 3.14e-319 ); * // returns true * * @example * var Float64Array = require( '@stdlib/array/float64' ); * var normalize = require( '@stdlib/number/float64/base/normalize' ); * * var out = new Float64Array( 2 ); * * var v = normalize( out, 3.14e-319 ); * // returns [ 1.4141234400356668e-303, -52 ] * * var bool = ( v === out ); * // returns true */ // MODULES // /* removed: var _$normalize_251 = require( './main.js' ); */; // EXPORTS // var _$normalize_250 = _$normalize_251; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * High word mask for the exponent of a double-precision floating-point number. * * @module @stdlib/constants/math/float64-high-word-exponent-mask * @type {uinteger32} * * @example * var FLOAT64_HIGH_WORD_EXPONENT_MASK = require( '@stdlib/constants/math/float64-high-word-exponent-mask' ); * // returns 2146435072 */ // MAIN // /** * High word mask for the exponent of a double-precision floating-point number. * * ## Notes * * The high word mask for the exponent of a double-precision floating-point number is an unsigned 32-bit integer with the value \\( 2146435072 \\), which corresponds to the bit sequence * * ```binarystring * 0 11111111111 00000000000000000000 * ``` * * @constant * @type {uinteger32} * @default 0x7ff00000 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_HIGH_WORD_EXPONENT_MASK = 0x7ff00000; // EXPORTS // var _$FLOAT64_HIGH_WORD_EXPONENT_MASK_199 = FLOAT64_HIGH_WORD_EXPONENT_MASK; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$getHighWord_248 = require( '@stdlib/number/float64/base/get-high-word' ); */; /* removed: var _$FLOAT64_HIGH_WORD_EXPONENT_MASK_199 = require( '@stdlib/constants/math/float64-high-word-exponent-mask' ); */; /* removed: var _$FLOAT64_EXPONENT_BIAS_198 = require( '@stdlib/constants/math/float64-exponent-bias' ); */; // MAIN // /** * Returns an integer corresponding to the unbiased exponent of a double-precision floating-point number. * * @param {number} x - input value * @returns {integer32} unbiased exponent * * @example * var exp = exponent( 3.14e-307 ); // => 2**-1019 ~ 1e-307 * // returns -1019 * * @example * var exp = exponent( -3.14 ); * // returns 1 * * @example * var exp = exponent( 0.0 ); * // returns -1023 * * @example * var exp = exponent( NaN ); * // returns 1024 */ function exponent( x ) { // Extract from the input value a higher order word (unsigned 32-bit integer) which contains the exponent: var high = _$getHighWord_248( x ); // Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction: high = ( high & _$FLOAT64_HIGH_WORD_EXPONENT_MASK_199 ) >>> 20; // Remove the bias and return: return (high - _$FLOAT64_EXPONENT_BIAS_198)|0; // asm type annotation } // EXPORTS // var _$exponent_243 = exponent; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Return an integer corresponding to the unbiased exponent of a double-precision floating-point number. * * @module @stdlib/number/float64/base/exponent * * @example * var exponent = require( '@stdlib/number/float64/base/exponent' ); * * var exp = exponent( 3.14e-307 ); // => 2**-1019 ~ 1e-307 * // returns -1019 * * exp = exponent( -3.14 ); * // returns 1 * * exp = exponent( 0.0 ); * // returns -1023 * * exp = exponent( NaN ); * // returns 1024 */ // MODULES // /* removed: var _$exponent_243 = require( './main.js' ); */; // EXPORTS // var _$exponent_242 = _$exponent_243; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // NOTES // /* * => ldexp: load exponent (see [The Open Group]{@link http://pubs.opengroup.org/onlinepubs/9699919799/functions/ldexp.html} and [cppreference]{@link http://en.cppreference.com/w/c/numeric/math/ldexp}). */ // MODULES // /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$FLOAT64_NINF_206 = require( '@stdlib/constants/math/float64-ninf' ); */; /* removed: var _$FLOAT64_EXPONENT_BIAS_198 = require( '@stdlib/constants/math/float64-exponent-bias' ); */; /* removed: var _$FLOAT64_MAX_BASE2_EXPONENT_202 = require( '@stdlib/constants/math/float64-max-base2-exponent' ); */; /* removed: var _$FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL_201 = require( '@stdlib/constants/math/float64-max-base2-exponent-subnormal' ); */; /* removed: var _$FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL_205 = require( '@stdlib/constants/math/float64-min-base2-exponent-subnormal' ); */; /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; /* removed: var _$isInfinite_220 = require( '@stdlib/math/base/assert/is-infinite' ); */; /* removed: var _$copysign_229 = require( '@stdlib/math/base/special/copysign' ); */; /* removed: var _$normalize_250 = require( '@stdlib/number/float64/base/normalize' ); */; /* removed: var _$exponent_242 = require( '@stdlib/number/float64/base/exponent' ); */; /* removed: var _$toWords_253 = require( '@stdlib/number/float64/base/to-words' ); */; /* removed: var _$fromWords_244 = require( '@stdlib/number/float64/base/from-words' ); */; // VARIABLES // // 1/(1<<52) = 1/(2**52) = 1/4503599627370496 var TWO52_INV = 2.220446049250313e-16; // Exponent all 0s: 1 00000000000 11111111111111111111 => 2148532223 var CLEAR_EXP_MASK = 0x800fffff>>>0; // asm type annotation // Normalization workspace: var FRAC = [ 0.0, 0.0 ]; // WARNING: not thread safe // High/low words workspace: var __WORDS_237 = [ 0, 0 ]; // WARNING: not thread safe // MAIN // /** * Multiplies a double-precision floating-point number by an integer power of two. * * @param {number} frac - fraction * @param {integer} exp - exponent * @returns {number} double-precision floating-point number * * @example * var x = ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8 * // returns 4.0 * * @example * var x = ldexp( 4.0, -2 ); // => 4 * 2^(-2) = 4 * (1/4) * // returns 1.0 * * @example * var x = ldexp( 0.0, 20 ); * // returns 0.0 * * @example * var x = ldexp( -0.0, 39 ); * // returns -0.0 * * @example * var x = ldexp( NaN, -101 ); * // returns NaN * * @example * var x = ldexp( Infinity, 11 ); * // returns Infinity * * @example * var x = ldexp( -Infinity, -118 ); * // returns -Infinity */ function ldexp( frac, exp ) { var high; var m; if ( frac === 0.0 || // handles +-0 _$isnan_224( frac ) || _$isInfinite_220( frac ) ) { return frac; } // Normalize the input fraction: _$normalize_250( FRAC, frac ); frac = FRAC[ 0 ]; exp += FRAC[ 1 ]; // Extract the exponent from `frac` and add it to `exp`: exp += _$exponent_242( frac ); // Check for underflow/overflow... if ( exp < _$FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL_205 ) { return _$copysign_229( 0.0, frac ); } if ( exp > _$FLOAT64_MAX_BASE2_EXPONENT_202 ) { if ( frac < 0.0 ) { return _$FLOAT64_NINF_206; } return _$FLOAT64_PINF_207; } // Check for a subnormal and scale accordingly to retain precision... if ( exp <= _$FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL_201 ) { exp += 52; m = TWO52_INV; } else { m = 1.0; } // Split the fraction into higher and lower order words: _$toWords_253( __WORDS_237, frac ); high = __WORDS_237[ 0 ]; // Clear the exponent bits within the higher order word: high &= CLEAR_EXP_MASK; // Set the exponent bits to the new exponent: high |= ((exp+_$FLOAT64_EXPONENT_BIAS_198) << 20); // Create a new floating-point number: return m * _$fromWords_244( high, __WORDS_237[ 1 ] ); } // EXPORTS // var _$ldexp_237 = ldexp; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Multiply a double-precision floating-point number by an integer power of two. * * @module @stdlib/math/base/special/ldexp * * @example * var ldexp = require( '@stdlib/math/base/special/ldexp' ); * * var x = ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8 * // returns 4.0 * * x = ldexp( 4.0, -2 ); // => 4 * 2^(-2) = 4 * (1/4) * // returns 1.0 * * x = ldexp( 0.0, 20 ); * // returns 0.0 * * x = ldexp( -0.0, 39 ); * // returns -0.0 * * x = ldexp( NaN, -101 ); * // returns NaN * * x = ldexp( Infinity, 11 ); * // returns Infinity * * x = ldexp( -Infinity, -118 ); * // returns -Infinity */ // MODULES // /* removed: var _$ldexp_237 = require( './ldexp.js' ); */; // EXPORTS // var _$ldexp_236 = _$ldexp_237; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The maximum base 10 exponent for a double-precision floating-point number. * * @module @stdlib/constants/math/float64-max-base10-exponent * @type {integer32} * * @example * var FLOAT64_MAX_BASE10_EXPONENT = require( '@stdlib/constants/math/float64-max-base10-exponent' ); * // returns 308 */ // MAIN // /** * The maximum base 10 exponent for a double-precision floating-point number. * * @constant * @type {integer32} * @default 308 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MAX_BASE10_EXPONENT = 308|0; // asm type annotation // EXPORTS // var _$FLOAT64_MAX_BASE10_EXPONENT_200 = FLOAT64_MAX_BASE10_EXPONENT; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * The minimum base 10 exponent for a normal double-precision floating-point number. * * @module @stdlib/constants/math/float64-min-base10-exponent * @type {integer32} * * @example * var FLOAT64_MIN_BASE10_EXPONENT = require( '@stdlib/constants/math/float64-min-base10-exponent' ); * // returns -308 */ // MAIN // /** * The minimum base 10 exponent for a normal double-precision floating-point number. * * ```text * 2^-1022 = 2.2250738585072014e-308 => -308 * ``` * * @constant * @type {integer32} * @default -308 * @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985} */ var FLOAT64_MIN_BASE10_EXPONENT = -308|0; // asm type annotation // EXPORTS // var _$FLOAT64_MIN_BASE10_EXPONENT_204 = FLOAT64_MIN_BASE10_EXPONENT; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* This is a generated file. Do not edit directly. */ 'use strict'; // MAIN // /** * Evaluates a polynomial. * * ## Notes * * - The implementation uses [Horner's rule][horners-method] for efficient computation. * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * * * @private * @param {number} x - value at which to evaluate the polynomial * @returns {number} evaluated polynomial */ function evalpoly( x ) { if ( x === 0.0 ) { return 2394.2374120738828; } return 2394.2374120738828 + (x * (406.7172899368727 + (x * (11.745273255434405 + (x * 0.040996251979858706))))); // eslint-disable-line max-len } // EXPORTS // var _$evalpoly_232 = evalpoly; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ /* This is a generated file. Do not edit directly. */ 'use strict'; // MAIN // /** * Evaluates a polynomial. * * ## Notes * * - The implementation uses [Horner's rule][horners-method] for efficient computation. * * [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method * * * @private * @param {number} x - value at which to evaluate the polynomial * @returns {number} evaluated polynomial */ function __evalpoly_233( x ) { if ( x === 0.0 ) { return 2079.608192860019; } return 2079.608192860019 + (x * (1272.0927117834513 + (x * (85.09361608493066 + (x * 1.0))))); // eslint-disable-line max-len } // EXPORTS // var _$evalpoly_233 = __evalpoly_233; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. * * * ## Notice * * The original C code, long comment, copyright, license, and constants are from [Cephes]{@link http://www.netlib.org/cephes}. The implementation follows the original, but has been modified for JavaScript. * * ```text * Copyright 1984, 1991, 2000 by Stephen L. Moshier * * Some software in this archive may be from the book _Methods and Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) or from the Cephes Mathematical Library, a commercial product. In either event, it is copyrighted by the author. What you see here may be used freely but it comes with no support or guarantee. * * Stephen L. Moshier * moshier@na-net.ornl.gov * ``` */ 'use strict'; // MODULES // /* removed: var _$floor_235 = require( '@stdlib/math/base/special/floor' ); */; /* removed: var _$ldexp_236 = require( '@stdlib/math/base/special/ldexp' ); */; /* removed: var _$isnan_224 = require( '@stdlib/math/base/assert/is-nan' ); */; /* removed: var _$FLOAT64_MAX_BASE10_EXPONENT_200 = require( '@stdlib/constants/math/float64-max-base10-exponent' ); */; /* removed: var _$FLOAT64_MIN_BASE10_EXPONENT_204 = require( '@stdlib/constants/math/float64-min-base10-exponent' ); */; /* removed: var _$FLOAT64_PINF_207 = require( '@stdlib/constants/math/float64-pinf' ); */; /* removed: var _$evalpoly_232 = require( './polyval_p.js' ); */; /* removed: var _$evalpoly_233 = require( './polyval_q.js' ); */; // VARIABLES // var LOG210 = 3.32192809488736234787e0; var LG102A = 3.01025390625000000000e-1; var LG102B = 4.60503898119521373889e-6; // MAIN // /** * Returns `10` raised to the `x` power. * * ## Method * * - Range reduction is accomplished by expressing the argument as \\( 10^x = 2^n 10^f \\), with \\( |f| < 0.5 log_{10}(2) \\). The Pade' form * * ```tex * 1 + 2x \frac{P(x^2)}{Q(x^2) - P(x^2)} * ``` * * is used to approximate \\( 10^f \\). * * * ## Notes * * - Relative error: * * | arithmetic | domain | # trials | peak | rms | * |:----------:|:-----------:|:--------:|:-------:|:-------:| * | IEEE | -307,+307 | 30000 | 2.2e-16 | 5.5e-17 | * * * @param {number} x - input value * @returns {number} function value * * @example * var v = exp10( 3.0 ); * // returns 1000.0 * * @example * var v = exp10( -9.0 ); * // returns 1.0e-9 * * @example * var v = exp10( 0.0 ); * // returns 1.0 * * @example * var v = exp10( NaN ); * // returns NaN */ function exp10( x ) { var px; var xx; var n; if ( _$isnan_224( x ) ) { return x; } if ( x > _$FLOAT64_MAX_BASE10_EXPONENT_200 ) { return _$FLOAT64_PINF_207; } if ( x < _$FLOAT64_MIN_BASE10_EXPONENT_204 ) { return 0.0; } // Express 10^x = 10^g 2^n = 10^g 10^( n log10(2) ) = 10^( g + n log10(2) ) px = _$floor_235( (LOG210*x) + 0.5 ); n = px; x -= px * LG102A; x -= px * LG102B; // Rational approximation for exponential of the fractional part: 10^x = 1 + 2x P(x^2)/( Q(x^2) - P(x^2) ) xx = x * x; px = x * _$evalpoly_232( xx ); x = px / ( _$evalpoly_233( xx ) - px ); x = 1.0 + _$ldexp_236( x, 1 ); // Multiply by power of 2: return _$ldexp_236( x, n ); } // EXPORTS // var _$exp10_230 = exp10; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Evaluate the base `10` exponential function. * * @module @stdlib/math/base/special/exp10 * * @example * var exp10 = require( '@stdlib/math/base/special/exp10' ); * * var v = exp10( 3.0 ); * // returns 1000.0 * * v = exp10( -9.0 ); * // returns 1.0e-9 * * v = exp10( 0.0 ); * // returns 1.0 * * v = exp10( NaN ); * // returns NaN */ // MODULES // /* removed: var _$exp10_230 = require( './exp10.js' ); */; // EXPORTS // var _$exp10_231 = _$exp10_230; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$floor_235 = require( '@stdlib/math/base/special/floor' ); */; /* removed: var _$exp10_231 = require( '@stdlib/math/base/special/exp10' ); */; // FUNCTIONS // /** * Comparator function to sort numeric array in ascending order. * * @private * @param {number} a - first number * @param {number} b - second number * @returns {number} a - b * * @example * var arr = [ 3, 1, 2, 5, 4 ]; * var sorted = arr.sort( ascending ); * // returns [ 1, 2, 3, 4, 5 ] */ function ascending( a, b ) { return a - b; } /** * Comparator function to sort object data array in ascending order. * * @private * @param {Object} a - first data object * @param {Object} b - second data object * @returns {number} a.val - b.val * * @example * var arr = [ * { 'val': 2, 'class': 'x' }, * { 'val': 3, 'class': 'y' }, * { 'val': 7, 'class': 'y' }, * { 'val': 2, 'class': 'x' }, * ]; * var sorted = arr.sort( ascending2 ); * // returns [...] */ function ascending2( a, b ) { return a.val - b.val; } /** * Generates a sequence of whitespace characters. * * @private * @param {integer} n - number of characters * @returns {string} sequence of whitespace characters * * @example * var str = spaces( 3 ); * // returns ' ' */ function spaces( n ) { return new Array( n ).join( ' ' ); } /** * Create string representation of stem-and-leaf plot for a single data vector. * * @private * @param {(Array|TypedArray)} x - input data * @param {PositiveInteger} interval - 10**leafDigits * @returns {string} chart representation */ function constructSingleDisplay( x, interval ) { var stemWidth; var leafWidth; var lastStem; var chrs; var len; var str; var stm; var lf; var i; var v; var n; x.sort( ascending ); len = x.length; stm = new Array( len ); lf = new Array( len ); stemWidth = 0; leafWidth = 0; for ( i = 0; i < len; i++ ) { stm[ i ] = _$floor_235( x[ i ] / interval ); chrs = stm[ i ].toString().length; if ( chrs > stemWidth ) { stemWidth = chrs; } lf[ i ] = x[ i ] % interval; chrs = lf[ i ].toString().length; if ( chrs > leafWidth ) { leafWidth = chrs; } } str = ''; for ( i = 0; i < len; i++ ) { while ( lastStem < stm[ i ] ) { lastStem += 1; str += '\n'; n = lastStem.toString().length - 1; str += ' ' + lastStem + spaces( stemWidth - n ); str += ' | '; } if ( stm[ i ] !== lastStem ) { str += '\n'; v = stm[ i ].toString(); n = v.length - 1; str += ' ' + v + spaces( stemWidth - n ); str += ' | '; } v = lf[ i ].toString(); n = v.length; str += v + spaces( leafWidth - n ) + ' '; lastStem = stm[ i ]; } return str; } /** * Create string representation of stem-and-leaf plot for two data vectors. * * @private * @param {(Array|TypedArray)} x - first input data * @param {(Array|TypedArray)} y - second input data * @param {PositiveInteger} interval - 10**leafDigits * @returns {string} chart representation */ function constructDoubleDisplay( x, y, interval ) { var xLeafWidth; var yLeafWidth; var stemWidth; var lastStem; var nSpaces; var lines; var line; var lmax; var chrs; var data; var arr; var lfs; var len; var stm; var i; var v; var n; data = []; for ( i = 0; i < x.length; i++ ) { v = { 'val': x[ i ], 'class': 'x' }; data.push( v ); } for ( i = 0; i < y.length; i++ ) { v = { 'val': y[ i ], 'class': 'y' }; data.push( v ); } len = data.length; data.sort( ascending2 ); stemWidth = 0; xLeafWidth = 0; yLeafWidth = 0; stm = new Array( len ); lfs = new Array( len ); for ( i = 0; i < len; i++ ) { stm[ i ] = _$floor_235( data[ i ].val / interval ); chrs = stm[ i ].toString().length; if ( chrs > stemWidth ) { stemWidth = chrs; } if ( data[i].class === 'x' ) { lfs[ i ] = data[ i ].val % interval; chrs = lfs[ i ].toString().length; if ( chrs > xLeafWidth ) { xLeafWidth = chrs; } } else if ( data[i].class === 'y' ) { lfs[ i ] = data[ i ].val % interval; chrs = lfs[ i ].toString().length; if ( chrs > yLeafWidth ) { yLeafWidth = chrs; } } } lines = []; line = ''; for ( i = 0; i < len; i++ ) { while ( lastStem < stm[ i ] ) { lines.push( line ); lastStem += 1; n = lastStem.toString().length - 1; line = '& | ' + spaces( stemWidth - n ) + lastStem + ' | '; } if ( stm[ i ] !== lastStem ) { if ( line ) { lines.push( line ); } v = stm[ i ].toString(); n = v.length - 1; line = '& | '; line += spaces( stemWidth - n ) + v; line += ' | '; } v = lfs[ i ].toString(); n = v.length; if ( data[i].class === 'x' ) { line = v + spaces( xLeafWidth - n ) + ' ' + line; } else if ( data[i].class === 'y' ) { line = line + v + spaces( xLeafWidth - n ) + ' '; } lastStem = stm[ i ]; } // Align lines... lmax = 0; for ( i = 0; i < lines.length; i++ ) { v = lines[ i ].indexOf( '|' ); if ( v > lmax ) { lmax = v; } } for ( i = 0; i < lines.length; i++ ) { arr = lines[ i ].split( '&', 2 ); nSpaces = lmax - arr[ 0 ].length; arr[ 0 ] = spaces( nSpaces ) + arr[ 0 ]; lines[ i ] = arr[ 0 ] + arr[ 1 ]; } return lines.join( '\n' ); } // MAIN // /** * Renders a chart. * * @private * @returns {string} rendered chart */ function __render_796() { /* eslint-disable no-invalid-this */ var interval; var digits; var ret; var x; var y; x = this._x; y = this._y; digits = this._leafDigits; interval = _$exp10_231( digits ); if ( x.length && y.length ) { ret = constructDoubleDisplay( x, y, interval ); } else if ( x.length && !y.length ) { ret = constructSingleDisplay( x, interval ); } else if ( y.length && !x.length ) { ret = constructSingleDisplay( y, interval ); } ret += '\n\n'; ret += 'Legend: '; ret += '\n X | Y => ' + interval + ' * X + Y\n'; return ret; } // EXPORTS // var _$render_796 = __render_796; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // /* removed: var _$defineProperty_825 = require( '@stdlib/utils/define-property' ); */; /* removed: var _$xValue_802 = require( './x_value.js' ); */; /* removed: var _$yValue_803 = require( './y_value.js' ); */; /* removed: var _$formatData_790 = require( './format_data.js' ); */; /* removed: var _$validate_801 = require( './validate.js' ); */; // MAIN // /** * Creates a stem-and-leaf plot. * * @constructor * @param {Options} [options] - steam-and-leaf options * @param {(Array|TypedArray)} [options.x] - first input data * @param {(Array|TypedArray)} [options.y] - second input data * @param {Function} [options.xValue] - x-value accessor * @param {Function} [options.yValue] - y-value accessor * @param {PositiveInteger} [options.leafDigits=1] - number of digits to display as leafs * @returns {StemLeaf} chart instance */ function StemLeaf( options ) { var opts; var err; if ( !(this instanceof StemLeaf) ) { if ( arguments.length ) { return new StemLeaf( options ); } return new StemLeaf(); } if ( arguments.length ) { opts = options; err = _$validate_801( opts ); if ( err ) { throw err; } } else { opts = {}; } _$defineProperty_825( this, '_x', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': [] }); _$defineProperty_825( this, '_xValue', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': _$xValue_802 }); _$defineProperty_825( this, '_y', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': [] }); _$defineProperty_825( this, '_yValue', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': _$yValue_803 }); _$defineProperty_825( this, '_leafDigits', { 'configurable': false, 'enumerable': false, 'writable': true, 'value': 1 }); if ( opts.xValue !== void 0 ) { this._xValue = opts.xValue; } if ( opts.yValue !== void 0 ) { this._yValue = opts.yValue; } if ( opts.x !== void 0 ) { this._x = _$formatData_790( opts.x, this._yValue ); } if ( opts.y !== void 0 ) { this._y = _$formatData_790( opts.y, this._yValue ); } if ( opts.leafDigits !== void 0 ) { this._leafDigits = opts.leafDigits; } return this; } /** * `x`-value accessor. * * @name xValue * @memberof StemLeaf.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * function xValue( d ) { * return d.y; * } * var chart = new StemLeaf(); * chart.xValue = xValue; * * @example * function xValue( d ) { * return d.y; * } * var chart = new StemLeaf({ * 'xValue': xValue * }); * var fcn = chart.xValue; * var bool = ( fcn === xValue ); * // returns true */ _$defineProperty_825( StemLeaf.prototype, 'xValue', { 'configurable': false, 'enumerable': true, 'set': _$setXValue_798, 'get': _$getXValue_792 }); /** * `y`-value accessor. * * @name yValue * @memberof StemLeaf.prototype * @type {Function} * @throws {TypeError} must be a function * * @example * function yValue( d ) { * return d.y; * } * var chart = new StemLeaf(); * chart.yValue = yValue; * * @example * function yValue( d ) { * return d.y; * } * var chart = new StemLeaf({ * 'yValue': yValue * }); * var fcn = chart.yValue; * var bool = ( fcn === yValue ); * // returns true */ _$defineProperty_825( StemLeaf.prototype, 'yValue', { 'configurable': false, 'enumerable': true, 'set': _$setYValue_800, 'get': _$getYValue_794 }); /** * First stem-and-leaf data. * * @name x * @memberof StemLeaf.prototype * @type {(Array|TypedArray)} * @throws {TypeError} must be an array or typed array * * @example * var chart = new StemLeaf(); * chart.x = [ 1.0, 0.0, 8.0, 2.0, 5.0 ]; * * @example * var x = [ 1.0, 0.0, 9.0, 2.0, 5.0 ]; * var chart = new StemLeaf({ * 'x': x * }); * var d = chart.x; * // returns [...] */ _$defineProperty_825( StemLeaf.prototype, 'x', { 'configurable': false, 'enumerable': true, 'set': _$setX_797, 'get': _$getX_791 }); /** * Second stem-and-leaf data. * * @name y * @memberof StemLeaf.prototype * @type {(Array|TypedArray)} * @throws {TypeError} must be an array or typed array * * @example * var chart = new StemLeaf(); * chart.y = [ 1.0, 0.0, 8.0, 2.0, 5.0 ]; * * @example * var y = [ 1.0, 0.0, 9.0, 2.0, 5.0 ]; * var chart = new StemLeaf({ * 'y': y * }); * var d = chart.y; * // returns [...] */ _$defineProperty_825( StemLeaf.prototype, 'y', { 'configurable': false, 'enumerable': true, 'set': _$setY_799, 'get': _$getY_793 }); /** * Renders a stem-and-leaf plot. * * @memberof StemLeaf.prototype * @function render * @returns {string} rendered stem-and-leaf display */ StemLeaf.prototype.render = _$render_796; // EXPORTS // var _$StemLeaf_789 = StemLeaf; /** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; /** * Stem-and-Leaf Plot. * * @module @stdlib/plot/unicode/stemleaf * * @example * var StemLeaf = require( '@stdlib/plot/unicode/stemleaf' ); */ // MODULES // /* removed: var _$StemLeaf_789 = require( './ctor.js' ); */; // EXPORTS // var _$StemLeaf_795 = _$StemLeaf_789; "use strict"; /* removed: var _$setReadOnly_827 = require('@stdlib/utils/define-read-only-property'); */; var ns = {}; _$setReadOnly_827(ns,'plot',_$plot_726); _$setReadOnly_827(ns,'ctor',_$Plot_258); _$setReadOnly_827(ns,'annotations',_$Annotations_329); _$setReadOnly_827(ns,'axis',_$Axis_344); _$setReadOnly_827(ns,'background',_$Background_399); _$setReadOnly_827(ns,'canvas',_$Canvas_416); _$setReadOnly_827(ns,'clipPath',_$ClipPath_435); _$setReadOnly_827(ns,'defs',_$Defs_451); _$setReadOnly_827(ns,'graph',_$Graph_458); _$setReadOnly_827(ns,'marks',_$Marks_474); _$setReadOnly_827(ns,'path',_$Path_487); _$setReadOnly_827(ns,'rug',_$Rug_519); _$setReadOnly_827(ns,'symbols',_$Symbols_548); _$setReadOnly_827(ns,'title',_$Title_581); _$setReadOnly_827(ns,'Plot',_$Plot_595); _$setReadOnly_827(ns,'SparklineBase',_$Sparkline_729); _$setReadOnly_827(ns,'UnicodeSparkline',_$sparkline_758); _$setReadOnly_827(ns,'UnicodeColumnChartSparkline',_$columnChart_748); _$setReadOnly_827(ns,'UnicodeLineChartSparkline',_$lineChart_771); _$setReadOnly_827(ns,'UnicodeTristateChartSparkline',_$tristateChart_780); _$setReadOnly_827(ns,'UnicodeUpDownChartSparkline',_$updownChart_783); _$setReadOnly_827(ns,'UnicodeWinLossChartSparkline',_$winlossChart_786); _$setReadOnly_827(ns,'stemleaf',_$StemLeaf_795); var _$ns_949 = ns; return _$ns_949; });