Skip to content

Instantly share code, notes, and snippets.

@dribnet
Last active August 3, 2022 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dribnet/4604762079c0bacac872664f015939ff to your computer and use it in GitHub Desktop.
Save dribnet/4604762079c0bacac872664f015939ff to your computer and use it in GitHub Desktop.
p5 svg examples
license: mit
height: 960

Sample SVG Drawer

Instructions:

  • Mouse Drag
  • x clears the screen.
  • s to save an the current screen
<head>
<script src="p5js_1.4.0.js"></script>
<script src="p5js-svg-1.3.1.js"></script>
<script language="javascript" type="text/javascript" src="svg1.js"></script>
</head>
<body style="background-color:white">
<div id="canvasContainer"></div><p>
<pre>
</pre>
</body>
(function () {
'use strict';
function toString(obj) {
if (!obj) {
return obj
}
if (typeof obj === 'string') {
return obj
}
return obj + '';
}
class ImageUtils {
/**
* Convert svg dataurl to canvas element
*
* @private
*/
async svg2canvas(svgDataURL, width, height) {
const svgImage = await new Promise((resolve) => {
var svgImage = new Image();
svgImage.onload = function() {
resolve(svgImage);
};
svgImage.src = svgDataURL;
});
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
ctx.drawImage(svgImage, 0, 0);
return canvas;
}
toDataURL(svgNode, width, height, type, encoderOptions, options) {
var xml = new XMLSerializer().serializeToString(svgNode);
// documentMode is an IE-only property
// http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
// http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript
var isIE = document.documentMode;
if (isIE) {
// This is patch from canvas2svg
// IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly
var xmlns = /xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi;
if(xmlns.test(xml)) {
xml = xml.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink');
}
}
if (!options) {
options = {};
}
var SVGDataURL = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(xml);
if (type === "image/svg+xml" || !type) {
if (options.async) {
return Promise.resolve(SVGDataURL)
}
return SVGDataURL;
}
if (type === "image/jpeg" || type === "image/png") {
if (!options.async) {
throw new Error('svgcanvas: options.async must be set to true if type is image/jpeg | image/png')
}
return (async () => {
const canvas = await this.svg2canvas(SVGDataURL, width, height);
const dataUrl = canvas.toDataURL(type, encoderOptions);
canvas.remove();
return dataUrl;
})()
}
throw new Error('svgcanvas: Unknown type for toDataURL, please use image/jpeg | image/png | image/svg+xml.');
}
getImageData(svgNode, width, height, sx, sy, sw, sh, options) {
if (!options) {
options = {};
}
if (!options.async) {
throw new Error('svgcanvas: options.async must be set to true for getImageData')
}
const svgDataURL = this.toDataURL(svgNode, width, height, 'image/svg+xml');
return (async () => {
const canvas = await this.svg2canvas(svgDataURL, width, height);
const ctx = canvas.getContext('2d');
const imageData = ctx.getImageData(sx, sy, sw, sh);
canvas.remove();
return imageData;
})()
}
}
const utils = new ImageUtils();
/*!!
* SVGCanvas v2.0.3
* Draw on SVG using Canvas's 2D Context API.
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Author:
* Kerry Liu
* Zeno Zeng
*
* Copyright (c) 2014 Gliffy Inc.
* Copyright (c) 2021 Zeno Zeng
*/
var Context = (function () {
var STYLES, Context, CanvasGradient, CanvasPattern, namedEntities;
//helper function to format a string
function format(str, args) {
var keys = Object.keys(args), i;
for (i=0; i<keys.length; i++) {
str = str.replace(new RegExp("\\{" + keys[i] + "\\}", "gi"), args[keys[i]]);
}
return str;
}
//helper function that generates a random string
function randomString(holder) {
var chars, randomstring, i;
if (!holder) {
throw new Error("cannot create a random attribute name for an undefined object");
}
chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
randomstring = "";
do {
randomstring = "";
for (i = 0; i < 12; i++) {
randomstring += chars[Math.floor(Math.random() * chars.length)];
}
} while (holder[randomstring]);
return randomstring;
}
//helper function to map named to numbered entities
function createNamedToNumberedLookup(items, radix) {
var i, entity, lookup = {}, base10;
items = items.split(',');
radix = radix || 10;
// Map from named to numbered entities.
for (i = 0; i < items.length; i += 2) {
entity = '&' + items[i + 1] + ';';
base10 = parseInt(items[i], radix);
lookup[entity] = '&#'+base10+';';
}
//FF and IE need to create a regex from hex values ie &nbsp; == \xa0
lookup["\\xa0"] = '&#160;';
return lookup;
}
//helper function to map canvas-textAlign to svg-textAnchor
function getTextAnchor(textAlign) {
//TODO: support rtl languages
var mapping = {"left":"start", "right":"end", "center":"middle", "start":"start", "end":"end"};
return mapping[textAlign] || mapping.start;
}
//helper function to map canvas-textBaseline to svg-dominantBaseline
function getDominantBaseline(textBaseline) {
//INFO: not supported in all browsers
var mapping = {"alphabetic": "alphabetic", "hanging": "hanging", "top":"text-before-edge", "bottom":"text-after-edge", "middle":"central"};
return mapping[textBaseline] || mapping.alphabetic;
}
// Unpack entities lookup where the numbers are in radix 32 to reduce the size
// entity mapping courtesy of tinymce
namedEntities = createNamedToNumberedLookup(
'50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +
'5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +
'5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +
'5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +
'68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +
'6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +
'6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +
'75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +
'7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +
'7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +
'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +
'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +
't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +
'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +
'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +
'81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +
'8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +
'8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +
'8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +
'8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +
'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +
'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +
'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +
'80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +
'811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);
//Some basic mappings for attributes and default values.
STYLES = {
"strokeStyle":{
svgAttr : "stroke", //corresponding svg attribute
canvas : "#000000", //canvas default
svg : "none", //svg default
apply : "stroke" //apply on stroke() or fill()
},
"fillStyle":{
svgAttr : "fill",
canvas : "#000000",
svg : null, //svg default is black, but we need to special case this to handle canvas stroke without fill
apply : "fill"
},
"lineCap":{
svgAttr : "stroke-linecap",
canvas : "butt",
svg : "butt",
apply : "stroke"
},
"lineJoin":{
svgAttr : "stroke-linejoin",
canvas : "miter",
svg : "miter",
apply : "stroke"
},
"miterLimit":{
svgAttr : "stroke-miterlimit",
canvas : 10,
svg : 4,
apply : "stroke"
},
"lineWidth":{
svgAttr : "stroke-width",
canvas : 1,
svg : 1,
apply : "stroke"
},
"globalAlpha": {
svgAttr : "opacity",
canvas : 1,
svg : 1,
apply : "fill stroke"
},
"font":{
//font converts to multiple svg attributes, there is custom logic for this
canvas : "10px sans-serif"
},
"shadowColor":{
canvas : "#000000"
},
"shadowOffsetX":{
canvas : 0
},
"shadowOffsetY":{
canvas : 0
},
"shadowBlur":{
canvas : 0
},
"textAlign":{
canvas : "start"
},
"textBaseline":{
canvas : "alphabetic"
},
"lineDash" : {
svgAttr : "stroke-dasharray",
canvas : [],
svg : null,
apply : "stroke"
}
};
/**
*
* @param gradientNode - reference to the gradient
* @constructor
*/
CanvasGradient = function (gradientNode, ctx) {
this.__root = gradientNode;
this.__ctx = ctx;
};
/**
* Adds a color stop to the gradient root
*/
CanvasGradient.prototype.addColorStop = function (offset, color) {
var stop = this.__ctx.__createElement("stop"), regex, matches;
stop.setAttribute("offset", offset);
if (toString(color).indexOf("rgba") !== -1) {
//separate alpha value, since webkit can't handle it
regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi;
matches = regex.exec(color);
stop.setAttribute("stop-color", format("rgb({r},{g},{b})", {r:matches[1], g:matches[2], b:matches[3]}));
stop.setAttribute("stop-opacity", matches[4]);
} else {
stop.setAttribute("stop-color", toString(color));
}
this.__root.appendChild(stop);
};
CanvasPattern = function (pattern, ctx) {
this.__root = pattern;
this.__ctx = ctx;
};
/**
* The mock canvas context
* @param o - options include:
* ctx - existing Context2D to wrap around
* width - width of your canvas (defaults to 500)
* height - height of your canvas (defaults to 500)
* enableMirroring - enables canvas mirroring (get image data) (defaults to false)
* document - the document object (defaults to the current document)
*/
Context = function (o) {
var defaultOptions = { width:500, height:500, enableMirroring : false}, options;
// keep support for this way of calling Context: new Context(width, height)
if (arguments.length > 1) {
options = defaultOptions;
options.width = arguments[0];
options.height = arguments[1];
} else if ( !o ) {
options = defaultOptions;
} else {
options = o;
}
if (!(this instanceof Context)) {
//did someone call this without new?
return new Context(options);
}
//setup options
this.width = options.width || defaultOptions.width;
this.height = options.height || defaultOptions.height;
this.enableMirroring = options.enableMirroring !== undefined ? options.enableMirroring : defaultOptions.enableMirroring;
this.canvas = this; ///point back to this instance!
this.__document = options.document || document;
// allow passing in an existing context to wrap around
// if a context is passed in, we know a canvas already exist
if (options.ctx) {
this.__ctx = options.ctx;
} else {
this.__canvas = this.__document.createElement("canvas");
this.__ctx = this.__canvas.getContext("2d");
}
this.__setDefaultStyles();
this.__styleStack = [this.__getStyleState()];
this.__groupStack = [];
//the root svg element
this.__root = this.__document.createElementNS("http://www.w3.org/2000/svg", "svg");
this.__root.setAttribute("version", 1.1);
this.__root.setAttribute("xmlns", "http://www.w3.org/2000/svg");
this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
this.__root.setAttribute("width", this.width);
this.__root.setAttribute("height", this.height);
//make sure we don't generate the same ids in defs
this.__ids = {};
//defs tag
this.__defs = this.__document.createElementNS("http://www.w3.org/2000/svg", "defs");
this.__root.appendChild(this.__defs);
//also add a group child. the svg element can't use the transform attribute
this.__currentElement = this.__document.createElementNS("http://www.w3.org/2000/svg", "g");
this.__root.appendChild(this.__currentElement);
// init transformation matrix
this.resetTransform();
this.__options = options;
this.__id = Math.random().toString(16).substring(2, 8);
this.__debug(`new`, o);
};
/**
* Log
*
* @private
*/
Context.prototype.__debug = function(...data) {
if (!this.__options.debug) {
return
}
console.debug(`svgcanvas#${this.__id}:`, ...data);
};
/**
* Creates the specified svg element
* @private
*/
Context.prototype.__createElement = function (elementName, properties, resetFill) {
if (typeof properties === "undefined") {
properties = {};
}
var element = this.__document.createElementNS("http://www.w3.org/2000/svg", elementName),
keys = Object.keys(properties), i, key;
if (resetFill) {
//if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black.
element.setAttribute("fill", "none");
element.setAttribute("stroke", "none");
}
for (i=0; i<keys.length; i++) {
key = keys[i];
element.setAttribute(key, properties[key]);
}
return element;
};
/**
* Applies default canvas styles to the context
* @private
*/
Context.prototype.__setDefaultStyles = function () {
//default 2d canvas context properties see:http://www.w3.org/TR/2dcontext/
var keys = Object.keys(STYLES), i, key;
for (i=0; i<keys.length; i++) {
key = keys[i];
this[key] = STYLES[key].canvas;
}
};
/**
* Applies styles on restore
* @param styleState
* @private
*/
Context.prototype.__applyStyleState = function (styleState) {
var keys = Object.keys(styleState), i, key;
for (i=0; i<keys.length; i++) {
key = keys[i];
this[key] = styleState[key];
}
};
/**
* Gets the current style state
* @return {Object}
* @private
*/
Context.prototype.__getStyleState = function () {
var i, styleState = {}, keys = Object.keys(STYLES), key;
for (i=0; i<keys.length; i++) {
key = keys[i];
styleState[key] = this[key];
}
return styleState;
};
/**
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform
*/
Context.prototype.__applyTransformation = function (element, matrix) {
const {a, b, c, d, e, f} = matrix || this.getTransform();
element.setAttribute('transform', `matrix(${a} ${b} ${c} ${d} ${e} ${f})`);
};
/**
* Apples the current styles to the current SVG element. On "ctx.fill" or "ctx.stroke"
* @param type
* @private
*/
Context.prototype.__applyStyleToCurrentElement = function (type) {
var currentElement = this.__currentElement;
var currentStyleGroup = this.__currentElementsToStyle;
if (currentStyleGroup) {
currentElement.setAttribute(type, "");
currentElement = currentStyleGroup.element;
currentStyleGroup.children.forEach(function (node) {
node.setAttribute(type, "");
});
}
var keys = Object.keys(STYLES), i, style, value, regex, matches, id, nodeIndex, node;
for (i = 0; i < keys.length; i++) {
style = STYLES[keys[i]];
value = this[keys[i]];
if (style.apply) {
//is this a gradient or pattern?
if (value instanceof CanvasPattern) {
//pattern
if (value.__ctx) {
//copy over defs
for(nodeIndex = 0; nodeIndex < value.__ctx.__defs.childNodes.length; nodeIndex++){
node = value.__ctx.__defs.childNodes[nodeIndex];
id = node.getAttribute("id");
this.__ids[id] = id;
this.__defs.appendChild(node);
}
}
currentElement.setAttribute(style.apply, format("url(#{id})", {id:value.__root.getAttribute("id")}));
}
else if (value instanceof CanvasGradient) {
//gradient
currentElement.setAttribute(style.apply, format("url(#{id})", {id:value.__root.getAttribute("id")}));
} else if (style.apply.indexOf(type)!==-1 && style.svg !== value) {
if ((style.svgAttr === "stroke" || style.svgAttr === "fill") && value.indexOf("rgba") !== -1) {
//separate alpha value, since illustrator can't handle it
regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi;
matches = regex.exec(value);
currentElement.setAttribute(style.svgAttr, format("rgb({r},{g},{b})", {r:matches[1], g:matches[2], b:matches[3]}));
//should take globalAlpha here
var opacity = matches[4];
var globalAlpha = this.globalAlpha;
if (globalAlpha != null) {
opacity *= globalAlpha;
}
currentElement.setAttribute(style.svgAttr+"-opacity", opacity);
} else {
var attr = style.svgAttr;
if (keys[i] === 'globalAlpha') {
attr = type+'-'+style.svgAttr;
if (currentElement.getAttribute(attr)) {
//fill-opacity or stroke-opacity has already been set by stroke or fill.
continue;
}
}
//otherwise only update attribute if right type, and not svg default
currentElement.setAttribute(attr, value);
}
}
}
}
};
/**
* Will return the closest group or svg node. May return the current element.
* @private
*/
Context.prototype.__closestGroupOrSvg = function (node) {
node = node || this.__currentElement;
if (node.nodeName === "g" || node.nodeName === "svg") {
return node;
} else {
return this.__closestGroupOrSvg(node.parentNode);
}
};
/**
* Returns the serialized value of the svg so far
* @param fixNamedEntities - Standalone SVG doesn't support named entities, which document.createTextNode encodes.
* If true, we attempt to find all named entities and encode it as a numeric entity.
* @return serialized svg
*/
Context.prototype.getSerializedSvg = function (fixNamedEntities) {
var serialized = new XMLSerializer().serializeToString(this.__root),
keys, i, key, value, regexp, xmlns;
//IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly
xmlns = /xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi;
if (xmlns.test(serialized)) {
serialized = serialized.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink');
}
if (fixNamedEntities) {
keys = Object.keys(namedEntities);
//loop over each named entity and replace with the proper equivalent.
for (i=0; i<keys.length; i++) {
key = keys[i];
value = namedEntities[key];
regexp = new RegExp(key, "gi");
if (regexp.test(serialized)) {
serialized = serialized.replace(regexp, value);
}
}
}
return serialized;
};
/**
* Returns the root svg
* @return
*/
Context.prototype.getSvg = function () {
return this.__root;
};
/**
* Will generate a group tag.
*/
Context.prototype.save = function () {
var group = this.__createElement("g");
var parent = this.__closestGroupOrSvg();
this.__groupStack.push(parent);
parent.appendChild(group);
this.__currentElement = group;
const style = this.__getStyleState();
this.__debug('save style', style);
this.__styleStack.push(style);
if (!this.__transformMatrixStack) {
this.__transformMatrixStack = [];
}
this.__transformMatrixStack.push(this.getTransform());
};
/**
* Sets current element to parent, or just root if already root
*/
Context.prototype.restore = function () {
this.__currentElement = this.__groupStack.pop();
this.__currentElementsToStyle = null;
//Clearing canvas will make the poped group invalid, currentElement is set to the root group node.
if (!this.__currentElement) {
this.__currentElement = this.__root.childNodes[1];
}
var state = this.__styleStack.pop();
this.__debug('restore style', state);
this.__applyStyleState(state);
if (this.__transformMatrixStack && this.__transformMatrixStack.length > 0) {
this.setTransform(this.__transformMatrixStack.pop());
}
};
/**
* Create a new Path Element
*/
Context.prototype.beginPath = function () {
var path, parent;
// Note that there is only one current default path, it is not part of the drawing state.
// See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path
this.__currentDefaultPath = "";
this.__currentPosition = {};
path = this.__createElement("path", {}, true);
parent = this.__closestGroupOrSvg();
parent.appendChild(path);
this.__currentElement = path;
};
/**
* Helper function to apply currentDefaultPath to current path element
* @private
*/
Context.prototype.__applyCurrentDefaultPath = function () {
var currentElement = this.__currentElement;
if (currentElement.nodeName === "path") {
currentElement.setAttribute("d", this.__currentDefaultPath);
} else {
console.error("Attempted to apply path command to node", currentElement.nodeName);
}
};
/**
* Helper function to add path command
* @private
*/
Context.prototype.__addPathCommand = function (command) {
this.__currentDefaultPath += " ";
this.__currentDefaultPath += command;
};
/**
* Adds the move command to the current path element,
* if the currentPathElement is not empty create a new path element
*/
Context.prototype.moveTo = function (x,y) {
if (this.__currentElement.nodeName !== "path") {
this.beginPath();
}
// creates a new subpath with the given point
this.__currentPosition = {x: x, y: y};
this.__addPathCommand(format("M {x} {y}", {
x: this.__matrixTransform(x, y).x,
y: this.__matrixTransform(x, y).y
}));
};
/**
* Closes the current path
*/
Context.prototype.closePath = function () {
if (this.__currentDefaultPath) {
this.__addPathCommand("Z");
}
};
/**
* Adds a line to command
*/
Context.prototype.lineTo = function (x, y) {
this.__currentPosition = {x: x, y: y};
if (this.__currentDefaultPath.indexOf('M') > -1) {
this.__addPathCommand(format("L {x} {y}", {
x: this.__matrixTransform(x, y).x,
y: this.__matrixTransform(x, y).y
}));
} else {
this.__addPathCommand(format("M {x} {y}", {
x: this.__matrixTransform(x, y).x,
y: this.__matrixTransform(x, y).y
}));
}
};
/**
* Add a bezier command
*/
Context.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
this.__currentPosition = {x: x, y: y};
this.__addPathCommand(format("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",
{
cp1x: this.__matrixTransform(cp1x, cp1y).x,
cp1y: this.__matrixTransform(cp1x, cp1y).y,
cp2x: this.__matrixTransform(cp2x, cp2y).x,
cp2y: this.__matrixTransform(cp2x, cp2y).y,
x: this.__matrixTransform(x, y).x,
y: this.__matrixTransform(x, y).y
}));
};
/**
* Adds a quadratic curve to command
*/
Context.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
this.__currentPosition = {x: x, y: y};
this.__addPathCommand(format("Q {cpx} {cpy} {x} {y}", {
cpx: this.__matrixTransform(cpx, cpy).x,
cpy: this.__matrixTransform(cpx, cpy).y,
x: this.__matrixTransform(x, y).x,
y: this.__matrixTransform(x, y).y
}));
};
/**
* Return a new normalized vector of given vector
*/
var normalize = function (vector) {
var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
return [vector[0] / len, vector[1] / len];
};
/**
* Adds the arcTo to the current path
*
* @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto
*/
Context.prototype.arcTo = function (x1, y1, x2, y2, radius) {
// Let the point (x0, y0) be the last point in the subpath.
var x0 = this.__currentPosition && this.__currentPosition.x;
var y0 = this.__currentPosition && this.__currentPosition.y;
// First ensure there is a subpath for (x1, y1).
if (typeof x0 == "undefined" || typeof y0 == "undefined") {
return;
}
// Negative values for radius must cause the implementation to throw an IndexSizeError exception.
if (radius < 0) {
throw new Error("IndexSizeError: The radius provided (" + radius + ") is negative.");
}
// If the point (x0, y0) is equal to the point (x1, y1),
// or if the point (x1, y1) is equal to the point (x2, y2),
// or if the radius radius is zero,
// then the method must add the point (x1, y1) to the subpath,
// and connect that point to the previous point (x0, y0) by a straight line.
if (((x0 === x1) && (y0 === y1))
|| ((x1 === x2) && (y1 === y2))
|| (radius === 0)) {
this.lineTo(x1, y1);
return;
}
// Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line,
// then the method must add the point (x1, y1) to the subpath,
// and connect that point to the previous point (x0, y0) by a straight line.
var unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]);
var unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]);
if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) {
this.lineTo(x1, y1);
return;
}
// Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius,
// and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1),
// and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2).
// The points at which this circle touches these two lines are called the start and end tangent points respectively.
// note that both vectors are unit vectors, so the length is 1
var cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]);
var theta = Math.acos(Math.abs(cos));
// Calculate origin
var unit_vec_p1_origin = normalize([
unit_vec_p1_p0[0] + unit_vec_p1_p2[0],
unit_vec_p1_p0[1] + unit_vec_p1_p2[1]
]);
var len_p1_origin = radius / Math.sin(theta / 2);
var x = x1 + len_p1_origin * unit_vec_p1_origin[0];
var y = y1 + len_p1_origin * unit_vec_p1_origin[1];
// Calculate start angle and end angle
// rotate 90deg clockwise (note that y axis points to its down)
var unit_vec_origin_start_tangent = [
-unit_vec_p1_p0[1],
unit_vec_p1_p0[0]
];
// rotate 90deg counter clockwise (note that y axis points to its down)
var unit_vec_origin_end_tangent = [
unit_vec_p1_p2[1],
-unit_vec_p1_p2[0]
];
var getAngle = function (vector) {
// get angle (clockwise) between vector and (1, 0)
var x = vector[0];
var y = vector[1];
if (y >= 0) { // note that y axis points to its down
return Math.acos(x);
} else {
return -Math.acos(x);
}
};
var startAngle = getAngle(unit_vec_origin_start_tangent);
var endAngle = getAngle(unit_vec_origin_end_tangent);
// Connect the point (x0, y0) to the start tangent point by a straight line
this.lineTo(x + unit_vec_origin_start_tangent[0] * radius,
y + unit_vec_origin_start_tangent[1] * radius);
// Connect the start tangent point to the end tangent point by arc
// and adding the end tangent point to the subpath.
this.arc(x, y, radius, startAngle, endAngle);
};
/**
* Sets the stroke property on the current element
*/
Context.prototype.stroke = function () {
if (this.__currentElement.nodeName === "path") {
this.__currentElement.setAttribute("paint-order", "fill stroke markers");
}
this.__applyCurrentDefaultPath();
this.__applyStyleToCurrentElement("stroke");
};
/**
* Sets fill properties on the current element
*/
Context.prototype.fill = function () {
if (this.__currentElement.nodeName === "path") {
this.__currentElement.setAttribute("paint-order", "stroke fill markers");
}
this.__applyCurrentDefaultPath();
this.__applyStyleToCurrentElement("fill");
};
/**
* Adds a rectangle to the path.
*/
Context.prototype.rect = function (x, y, width, height) {
if (this.__currentElement.nodeName !== "path") {
this.beginPath();
}
this.moveTo(x, y);
this.lineTo(x+width, y);
this.lineTo(x+width, y+height);
this.lineTo(x, y+height);
this.lineTo(x, y);
this.closePath();
};
/**
* adds a rectangle element
*/
Context.prototype.fillRect = function (x, y, width, height) {
let {a, b, c, d, e, f} = this.getTransform();
if (JSON.stringify([a, b, c, d, e, f]) === JSON.stringify([1, 0, 0, 1, 0, 0])) {
//clear entire canvas
if (x === 0 && y === 0 && width === this.width && height === this.height) {
this.__clearCanvas();
}
}
var rect, parent;
rect = this.__createElement("rect", {
x : x,
y : y,
width : width,
height : height
}, true);
parent = this.__closestGroupOrSvg();
parent.appendChild(rect);
this.__currentElement = rect;
this.__applyTransformation(rect);
this.__applyStyleToCurrentElement("fill");
};
/**
* Draws a rectangle with no fill
* @param x
* @param y
* @param width
* @param height
*/
Context.prototype.strokeRect = function (x, y, width, height) {
var rect, parent;
rect = this.__createElement("rect", {
x : x,
y : y,
width : width,
height : height
}, true);
parent = this.__closestGroupOrSvg();
parent.appendChild(rect);
this.__currentElement = rect;
this.__applyTransformation(rect);
this.__applyStyleToCurrentElement("stroke");
};
/**
* Clear entire canvas:
* 1. save current transforms
* 2. remove all the childNodes of the root g element
*/
Context.prototype.__clearCanvas = function () {
var rootGroup = this.__root.childNodes[1];
this.__root.removeChild(rootGroup);
this.__currentElement = this.__document.createElementNS("http://www.w3.org/2000/svg", "g");
this.__root.appendChild(this.__currentElement);
//reset __groupStack as all the child group nodes are all removed.
this.__groupStack = [];
};
/**
* "Clears" a canvas by just drawing a white rectangle in the current group.
*/
Context.prototype.clearRect = function (x, y, width, height) {
let {a, b, c, d, e, f} = this.getTransform();
if (JSON.stringify([a, b, c, d, e, f]) === JSON.stringify([1, 0, 0, 1, 0, 0])) {
//clear entire canvas
if (x === 0 && y === 0 && width === this.width && height === this.height) {
this.__clearCanvas();
return;
}
}
var rect, parent = this.__closestGroupOrSvg();
rect = this.__createElement("rect", {
x : x,
y : y,
width : width,
height : height,
fill : "#FFFFFF"
}, true);
this.__applyTransformation(rect);
parent.appendChild(rect);
};
/**
* Adds a linear gradient to a defs tag.
* Returns a canvas gradient object that has a reference to it's parent def
*/
Context.prototype.createLinearGradient = function (x1, y1, x2, y2) {
var grad = this.__createElement("linearGradient", {
id : randomString(this.__ids),
x1 : x1+"px",
x2 : x2+"px",
y1 : y1+"px",
y2 : y2+"px",
"gradientUnits" : "userSpaceOnUse"
}, false);
this.__defs.appendChild(grad);
return new CanvasGradient(grad, this);
};
/**
* Adds a radial gradient to a defs tag.
* Returns a canvas gradient object that has a reference to it's parent def
*/
Context.prototype.createRadialGradient = function (x0, y0, r0, x1, y1, r1) {
var grad = this.__createElement("radialGradient", {
id : randomString(this.__ids),
cx : x1+"px",
cy : y1+"px",
r : r1+"px",
fx : x0+"px",
fy : y0+"px",
"gradientUnits" : "userSpaceOnUse"
}, false);
this.__defs.appendChild(grad);
return new CanvasGradient(grad, this);
};
/**
* Parses the font string and returns svg mapping
* @private
*/
Context.prototype.__parseFont = function () {
var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i;
var fontPart = regex.exec( this.font );
var data = {
style : fontPart[1] || 'normal',
size : fontPart[4] || '10px',
family : fontPart[6] || 'sans-serif',
weight: fontPart[3] || 'normal',
decoration : fontPart[2] || 'normal',
href : null
};
//canvas doesn't support underline natively, but we can pass this attribute
if (this.__fontUnderline === "underline") {
data.decoration = "underline";
}
//canvas also doesn't support linking, but we can pass this as well
if (this.__fontHref) {
data.href = this.__fontHref;
}
return data;
};
/**
* Helper to link text fragments
* @param font
* @param element
* @return {*}
* @private
*/
Context.prototype.__wrapTextLink = function (font, element) {
if (font.href) {
var a = this.__createElement("a");
a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", font.href);
a.appendChild(element);
return a;
}
return element;
};
/**
* Fills or strokes text
* @param text
* @param x
* @param y
* @param action - stroke or fill
* @private
*/
Context.prototype.__applyText = function (text, x, y, action) {
var font = this.__parseFont(),
parent = this.__closestGroupOrSvg(),
textElement = this.__createElement("text", {
"font-family" : font.family,
"font-size" : font.size,
"font-style" : font.style,
"font-weight" : font.weight,
"text-decoration" : font.decoration,
"x" : x,
"y" : y,
"text-anchor": getTextAnchor(this.textAlign),
"dominant-baseline": getDominantBaseline(this.textBaseline)
}, true);
textElement.appendChild(this.__document.createTextNode(text));
this.__currentElement = textElement;
this.__applyTransformation(textElement);
this.__applyStyleToCurrentElement(action);
parent.appendChild(this.__wrapTextLink(font,textElement));
};
/**
* Creates a text element
* @param text
* @param x
* @param y
*/
Context.prototype.fillText = function (text, x, y) {
this.__applyText(text, x, y, "fill");
};
/**
* Strokes text
* @param text
* @param x
* @param y
*/
Context.prototype.strokeText = function (text, x, y) {
this.__applyText(text, x, y, "stroke");
};
/**
* No need to implement this for svg.
* @param text
* @return {TextMetrics}
*/
Context.prototype.measureText = function (text) {
this.__ctx.font = this.font;
return this.__ctx.measureText(text);
};
/**
* Arc command!
*/
Context.prototype.arc = function (x, y, radius, startAngle, endAngle, counterClockwise) {
// in canvas no circle is drawn if no angle is provided.
if (startAngle === endAngle) {
return;
}
startAngle = startAngle % (2*Math.PI);
endAngle = endAngle % (2*Math.PI);
if (startAngle === endAngle) {
//circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle)
endAngle = ((endAngle + (2*Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2*Math.PI);
}
var endX = x+radius*Math.cos(endAngle),
endY = y+radius*Math.sin(endAngle),
startX = x+radius*Math.cos(startAngle),
startY = y+radius*Math.sin(startAngle),
sweepFlag = counterClockwise ? 0 : 1,
largeArcFlag = 0,
diff = endAngle - startAngle;
// https://github.com/gliffy/canvas2svg/issues/4
if (diff < 0) {
diff += 2*Math.PI;
}
if (counterClockwise) {
largeArcFlag = diff > Math.PI ? 0 : 1;
} else {
largeArcFlag = diff > Math.PI ? 1 : 0;
}
this.lineTo(startX, startY);
this.__addPathCommand(format("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",
{
rx:radius,
ry:radius,
xAxisRotation:0,
largeArcFlag:largeArcFlag,
sweepFlag:sweepFlag,
endX: this.__matrixTransform(endX, endY).x,
endY: this.__matrixTransform(endX, endY).y
}));
this.__currentPosition = {x: endX, y: endY};
};
/**
* Generates a ClipPath from the clip command.
*/
Context.prototype.clip = function () {
var group = this.__closestGroupOrSvg(),
clipPath = this.__createElement("clipPath"),
id = randomString(this.__ids),
newGroup = this.__createElement("g");
this.__applyCurrentDefaultPath();
group.removeChild(this.__currentElement);
clipPath.setAttribute("id", id);
clipPath.appendChild(this.__currentElement);
this.__defs.appendChild(clipPath);
//set the clip path to this group
group.setAttribute("clip-path", format("url(#{id})", {id:id}));
//clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations
// to this path
group.appendChild(newGroup);
this.__currentElement = newGroup;
};
/**
* Draws a canvas, image or mock context to this canvas.
* Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support.
* http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage
*/
Context.prototype.drawImage = function () {
//convert arguments to a real array
var args = Array.prototype.slice.call(arguments),
image=args[0],
dx, dy, dw, dh, sx=0, sy=0, sw, sh, parent, svg, defs, group,
svgImage, canvas, context, id;
if (args.length === 3) {
dx = args[1];
dy = args[2];
sw = image.width;
sh = image.height;
dw = sw;
dh = sh;
} else if (args.length === 5) {
dx = args[1];
dy = args[2];
dw = args[3];
dh = args[4];
sw = image.width;
sh = image.height;
} else if (args.length === 9) {
sx = args[1];
sy = args[2];
sw = args[3];
sh = args[4];
dx = args[5];
dy = args[6];
dw = args[7];
dh = args[8];
} else {
throw new Error("Invalid number of arguments passed to drawImage: " + arguments.length);
}
parent = this.__closestGroupOrSvg();
const matrix = this.getTransform().translate(dx, dy);
if (image instanceof Context) {
//canvas2svg mock canvas context. In the future we may want to clone nodes instead.
//also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.
svg = image.getSvg().cloneNode(true);
if (svg.childNodes && svg.childNodes.length > 1) {
defs = svg.childNodes[0];
while(defs.childNodes.length) {
id = defs.childNodes[0].getAttribute("id");
this.__ids[id] = id;
this.__defs.appendChild(defs.childNodes[0]);
}
group = svg.childNodes[1];
if (group) {
this.__applyTransformation(group, matrix);
parent.appendChild(group);
}
}
} else if (image.nodeName === "CANVAS" || image.nodeName === "IMG") {
//canvas or image
svgImage = this.__createElement("image");
svgImage.setAttribute("width", dw);
svgImage.setAttribute("height", dh);
svgImage.setAttribute("preserveAspectRatio", "none");
if (sx || sy || sw !== image.width || sh !== image.height) {
//crop the image using a temporary canvas
canvas = this.__document.createElement("canvas");
canvas.width = dw;
canvas.height = dh;
context = canvas.getContext("2d");
context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);
image = canvas;
}
this.__applyTransformation(svgImage, matrix);
svgImage.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href",
image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src"));
parent.appendChild(svgImage);
}
};
/**
* Generates a pattern tag
*/
Context.prototype.createPattern = function (image, repetition) {
var pattern = this.__document.createElementNS("http://www.w3.org/2000/svg", "pattern"), id = randomString(this.__ids),
img;
pattern.setAttribute("id", id);
pattern.setAttribute("width", image.width);
pattern.setAttribute("height", image.height);
// We want the pattern sizing to be absolute, and not relative
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Patterns
// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/patternUnits
pattern.setAttribute("patternUnits", "userSpaceOnUse");
if (image.nodeName === "CANVAS" || image.nodeName === "IMG") {
img = this.__document.createElementNS("http://www.w3.org/2000/svg", "image");
img.setAttribute("width", image.width);
img.setAttribute("height", image.height);
img.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href",
image.nodeName === "CANVAS" ? image.toDataURL() : image.getAttribute("src"));
pattern.appendChild(img);
this.__defs.appendChild(pattern);
} else if (image instanceof Context) {
pattern.appendChild(image.__root.childNodes[1]);
this.__defs.appendChild(pattern);
}
return new CanvasPattern(pattern, this);
};
Context.prototype.setLineDash = function (dashArray) {
if (dashArray && dashArray.length > 0) {
this.lineDash = dashArray.join(",");
} else {
this.lineDash = null;
}
};
/**
* SetTransform changes the current transformation matrix to
* the matrix given by the arguments as described below.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform
*/
Context.prototype.setTransform = function (a, b, c, d, e, f) {
if (a instanceof DOMMatrix) {
this.__transformMatrix = new DOMMatrix([a.a, a.b, a.c, a.d, a.e, a.f]);
} else {
this.__transformMatrix = new DOMMatrix([a, b, c, d, e, f]);
}
};
/**
* GetTransform Returns a copy of the current transformation matrix,
* as a newly created DOMMAtrix Object
*
* @returns A DOMMatrix Object
*/
Context.prototype.getTransform = function () {
let {a, b, c, d, e, f} = this.__transformMatrix;
return new DOMMatrix([a, b, c, d, e, f]);
};
/**
* ResetTransform resets the current transformation matrix to the identity matrix
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/resetTransform
*/
Context.prototype.resetTransform = function () {
this.setTransform(1, 0, 0, 1, 0, 0);
};
/**
* Add the scaling transformation described by the arguments to the current transformation matrix.
*
* @param x The x argument represents the scale factor in the horizontal direction
* @param y The y argument represents the scale factor in the vertical direction.
* @see https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-scale
*/
Context.prototype.scale = function (x, y) {
if (y === undefined) {
y = x;
}
// If either of the arguments are infinite or NaN, then return.
if (isNaN(x) || isNaN(y) || !isFinite(x) || !isFinite(y)) {
return
}
let matrix = this.getTransform().scale(x, y);
this.setTransform(matrix);
};
/**
* Rotate adds a rotation to the transformation matrix.
*
* @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/rotate
* @see https://www.w3.org/TR/css-transforms-1
*/
Context.prototype.rotate = function (angle) {
let matrix = this.getTransform().multiply(new DOMMatrix([
Math.cos(angle),
Math.sin(angle),
-Math.sin(angle),
Math.cos(angle),
0,
0
]));
this.setTransform(matrix);
};
/**
* Translate adds a translation transformation to the current matrix.
*
* @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.
* @param y Distance to move in the vertical direction. Positive values are down, and negative are up.
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/translate
*/
Context.prototype.translate = function (x, y) {
const matrix = this.getTransform().translate(x, y);
this.setTransform(matrix);
};
/**
* Transform multiplies the current transformation with the matrix described by the arguments of this method.
* This lets you scale, rotate, translate (move), and skew the context.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform
*/
Context.prototype.transform = function (a, b, c, d, e, f) {
const matrix = this.getTransform().multiply(new DOMMatrix([a, b, c, d, e, f]));
this.setTransform(matrix);
};
Context.prototype.__matrixTransform = function(x, y) {
return new DOMPoint(x, y).matrixTransform(this.__transformMatrix)
};
/**
*
* @param {*} sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.
* @param {*} sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.
* @param {*} sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.
* @param {*} sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.
* @param {Boolean} options.async Will return a Promise<ImageData> if true, must be set to true
* @returns An ImageData object containing the image data for the rectangle of the canvas specified. The coordinates of the rectangle's top-left corner are (sx, sy), while the coordinates of the bottom corner are (sx + sw, sy + sh).
*/
Context.prototype.getImageData = function(sx, sy, sw, sh, options) {
return utils.getImageData(this.getSvg(), this.width, this.height, sx, sy, sw, sh, options);
};
/**
* Not yet implemented
*/
Context.prototype.drawFocusRing = function () {};
Context.prototype.createImageData = function () {};
Context.prototype.putImageData = function () {};
Context.prototype.globalCompositeOperation = function () {};
return Context;
}());
function SVGCanvasElement(options) {
this.ctx = new Context(options);
this.svg = this.ctx.__root;
// sync attributes to svg
var svg = this.svg;
var _this = this;
var wrapper = document.createElement('div');
wrapper.style.display = 'inline-block';
wrapper.appendChild(svg);
this.wrapper = wrapper;
Object.defineProperty(this, 'className', {
get: function() {
return wrapper.getAttribute('class') || '';
},
set: function(val) {
return wrapper.setAttribute('class', val);
}
});
["width", "height"].forEach(function(prop) {
Object.defineProperty(_this, prop, {
get: function() {
return svg.getAttribute(prop) | 0;
},
set: function(val) {
if (isNaN(val) || (typeof val === "undefined")) {
return;
}
_this.ctx[prop] = val;
svg.setAttribute(prop, val);
return wrapper[prop] = val;
}
});
});
["style", "id"].forEach(function(prop) {
Object.defineProperty(_this, prop, {
get: function() {
return wrapper[prop];
},
set: function(val) {
if (typeof val !== "undefined") {
return wrapper[prop] = val;
}
}
});
});
["getBoundingClientRect"].forEach(function(fn) {
_this[fn] = function() {
return svg[fn]();
};
});
}
SVGCanvasElement.prototype.getContext = function(type) {
if (type !== '2d') {
throw new Error('Unsupported type of context for SVGCanvas');
}
return this.ctx;
};
// you should always use URL.revokeObjectURL after your work done
SVGCanvasElement.prototype.toObjectURL = function() {
var data = new XMLSerializer().serializeToString(this.svg);
var svg = new Blob([data], {type: 'image/svg+xml;charset=utf-8'});
return URL.createObjectURL(svg);
};
/**
* toDataURL returns a data URI containing a representation of the image in the format specified by the type parameter.
*
* @param {String} type A DOMString indicating the image format. The default type is image/svg+xml; this image format will be also used if the specified type is not supported.
* @param {Number} encoderOptions A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
* @param {Boolean} options.async Will return a Promise<String> if true, must be set to true if type is not image/svg+xml
*/
SVGCanvasElement.prototype.toDataURL = function(type, encoderOptions, options) {
return utils.toDataURL(this.svg, this.width, this.height, type, encoderOptions, options)
};
SVGCanvasElement.prototype.addEventListener = function() {
return this.svg.addEventListener.apply(this.svg, arguments);
};
// will return wrapper element: <div><svg></svg></div>
SVGCanvasElement.prototype.getElement = function() {
return this.wrapper;
};
var Element$1 = SVGCanvasElement;
const DEBUG = false;
function RendererSVG(p5) {
/**
* @namespace RendererSVG
* @constructor
* @param {Element} elt canvas element to be replaced
* @param {p5} pInst p5 Instance
* @param {Bool} isMainCanvas
*/
function RendererSVG(elt, pInst, isMainCanvas) {
var svgCanvas = new Element$1({debug: DEBUG});
var svg = svgCanvas.svg;
// replace <canvas> with <svg> and copy id, className
var parent = elt.parentNode;
var id = elt.id;
var className = elt.className;
parent.replaceChild(svgCanvas.getElement(), elt);
svgCanvas.id = id;
svgCanvas.className = className;
elt = svgCanvas; // our fake <canvas>
elt.parentNode = {
// fake parentNode.removeChild so that noCanvas will work
removeChild: function(element) {
if (element === elt) {
var wrapper = svgCanvas.getElement();
wrapper.parentNode.removeChild(wrapper);
}
}
};
const pInstProxy = new Proxy(pInst, {
get: function(target, prop) {
if (prop === '_pixelDensity') {
// 1 is OK for SVG
return 1;
}
return target[prop];
}
});
p5.Renderer2D.call(this, elt, pInstProxy, isMainCanvas);
this.isSVG = true;
this.svg = svg;
return this;
}
RendererSVG.prototype = Object.create(p5.Renderer2D.prototype);
RendererSVG.prototype._applyDefaults = function() {
p5.Renderer2D.prototype._applyDefaults.call(this);
this.drawingContext.lineWidth = 1;
};
RendererSVG.prototype.resize = function(w, h) {
if (!w || !h) {
return;
}
if (this.width !== w || this.height !== h) {
// canvas will be cleared if its size changed
// so, we do same thing for SVG
// note that at first this.width and this.height is undefined
this.drawingContext.__clearCanvas();
}
p5.Renderer2D.prototype.resize.call(this, w, h);
// For scale, crop
// see also: http://sarasoueidan.com/blog/svg-coordinate-systems/
this.svg.setAttribute('viewBox', [0, 0, w, h].join(' '));
};
/**
* Append a element to current SVG Graphics
*
* @function appendChild
* @memberof RendererSVG.prototype
* @param {SVGElement|Element} element
*/
RendererSVG.prototype.appendChild = function(element) {
if (element && element.elt) {
element = element.elt;
}
var g = this.drawingContext.__closestGroupOrSvg();
g.appendChild(element);
};
/**
* Draw an image or SVG to current SVG Graphics
*
* FIXME: sx, sy, sWidth, sHeight
*
* @function image
* @memberof RendererSVG.prototype
* @param {p5.Graphics|SVGGraphics|SVGElement|Element} image
* @param {Number} x
* @param {Number} y
* @param {Number} width
* @param {Number} height
*/
RendererSVG.prototype.image = function(img, sx, sy, sWidth, sHeight, x, y, w, h) {
if (!img) {
throw new Error('Invalid image: ' + img);
}
var elt = img._renderer && img._renderer.svg; // handle SVG Graphics
elt = elt || (img.elt && img.elt.nodeName && (img.elt.nodeName.toLowerCase() === 'svg') && img.elt); // SVGElement
elt = elt || (img.nodeName && (img.nodeName.toLowerCase() == 'svg') && img); // <svg>
if (elt) {
// it's <svg> element, let's handle it
elt = elt.cloneNode(true);
elt.setAttribute('width', w);
elt.setAttribute('height', h);
elt.setAttribute('x', x);
elt.setAttribute('y', y);
if (sx || sy || sWidth || sHeight) {
sWidth /= this._pInst._pixelDensity;
sHeight /= this._pInst._pixelDensity;
elt.setAttribute('viewBox', [sx, sy, sWidth, sHeight].join(', '));
}
this.appendChild(elt);
} else {
p5.Renderer2D.prototype.image.apply(this, arguments);
}
};
/**
* @method parent
* @return {p5.Element}
*
* @see https://github.com/zenozeng/p5.js-svg/issues/187
*/
RendererSVG.prototype.parent = function() {
const $this = {
elt: this.elt.getElement()
};
return p5.Element.prototype.parent.apply($this, arguments);
};
RendererSVG.prototype.loadPixels = async function() {
const pixelsState = this._pixelsState; // if called by p5.Image
const pd = pixelsState._pixelDensity;
const w = this.width * pd;
const h = this.height * pd;
const imageData = await this.drawingContext.getImageData(0, 0, w, h, {async: true});
pixelsState._setProperty('imageData', imageData);
pixelsState._setProperty('pixels', imageData.data);
};
p5.RendererSVG = RendererSVG;
}
var constants = {
SVG: 'svg'
};
function Rendering(p5) {
// patch p5.Graphics for SVG
var _graphics = p5.Graphics;
p5.Graphics = function(w, h, renderer, pInst) {
const isSVG = renderer === constants.SVG;
_graphics.apply(this, [w, h, isSVG ? p5.P2D : renderer, pInst]);
if (isSVG) {
// replace <canvas> with <svg>
var c = this._renderer.elt;
this._renderer = new p5.RendererSVG(c, this, false); // replace renderer
c = this._renderer.elt;
this.elt = c; // replace this.elt
// do default again
this._renderer.resize(w, h);
this._renderer._applyDefaults();
}
return this;
};
p5.Graphics.prototype = _graphics.prototype;
/**
* Patched version of createCanvas
*
* use createCanvas(100, 100, SVG) to create SVG canvas.
*
* Creates a SVG element in the document, and sets its width and
* height in pixels. This method should be called only once at
* the start of setup.
* @function createCanvas
* @memberof p5.prototype
* @param {Number} width - Width (in px) for SVG Element
* @param {Number} height - Height (in px) for SVG Element
* @return {Graphics}
*/
var _createCanvas = p5.prototype.createCanvas;
p5.prototype.createCanvas = function(w, h, renderer) {
var graphics = _createCanvas.apply(this, arguments);
if (renderer === constants.SVG) {
var c = graphics.canvas;
this._setProperty('_renderer', new p5.RendererSVG(c, this, true));
this._isdefaultGraphics = true;
this._renderer.resize(w, h);
this._renderer._applyDefaults();
}
return this._renderer;
};
p5.prototype.createGraphics = function(w, h, renderer) {
return new p5.Graphics(w, h, renderer, this);
};
}
function IO(p5) {
/**
* Convert SVG Element to jpeg / png data url
*
* @private
* @param {SVGElement} svg SVG Element
* @param {String} mine Mine
* @param {Function} callback
*/
var svg2img = function(svg, mine, callback) {
svg = (new XMLSerializer()).serializeToString(svg);
svg = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg);
if (mine == 'image/svg+xml') {
callback(null, svg);
return;
}
var img = new Image();
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
img.onload = function() {
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL(mine);
callback(null, dataURL);
};
img.src = svg;
};
/**
* Get SVG frame, and convert to target type
*
* @private
* @param {Object} options
* @param {SVGElement} options.svg SVG Element, defaults to current svg element
* @param {String} options.filename
* @param {String} options.ext Extension: 'svg' or 'jpg' or 'jpeg' or 'png'
* @param {Function} options.callback
*/
p5.prototype._makeSVGFrame = function(options) {
var filename = options.filename || 'untitled';
var ext = options.extension;
ext = ext || this._checkFileExtension(filename, ext)[1];
var regexp = new RegExp('\\.' + ext + '$');
filename = filename.replace(regexp, '');
if (ext === '') {
ext = 'svg';
}
var mine = {
png: 'image/png',
jpeg: 'image/jpeg',
jpg: 'image/jpeg',
svg: 'image/svg+xml'
}[ext];
if (!mine) {
throw new Error('Fail to getFrame, invalid extension: ' + ext + ', please use png | jpeg | jpg | svg.');
}
var svg = options.svg || this._renderer.svg;
svg2img(svg, mine, function(err, dataURL) {
var downloadMime = 'image/octet-stream';
dataURL = dataURL.replace(mine, downloadMime);
options.callback(err, {
imageData: dataURL,
filename: filename,
ext: ext
});
});
};
/**
* Save the current SVG as an image. In Safari, will open the
* image in the window and the user must provide their own
* filename on save-as. Other browsers will either save the
* file immediately, or prompt the user with a dialogue window.
*
* @function saveSVG
* @memberof p5.prototype
* @param {Graphics|Element|SVGElement} [svg] Source to save
* @param {String} [filename]
* @param {String} [extension] Extension: 'svg' or 'jpg' or 'jpeg' or 'png'
*/
p5.prototype.saveSVG = function() {
// don't use slice on arguments because it prevents optimizations
var args = arguments;
args = [args[0], args[1], args[2]];
var svg;
if (args[0] instanceof p5.Graphics) {
svg = args[0]._renderer.svg;
args.shift();
}
if (args[0] && args[0].elt) {
svg = args[0].elt;
args.shift();
}
if (typeof args[0] == 'object') {
svg = args[0];
args.shift();
}
var filename = args[0];
var ext = args[1];
var p = this;
this._makeSVGFrame({
svg: svg,
filename: filename,
extension: ext,
callback: function(err, frame) {
p.downloadFile(frame.imageData, frame.filename, frame.ext);
}
});
};
/**
* Extends p5's saveFrames with SVG support
*
* @function saveFrames
* @memberof p5.prototype
* @param {String} filename filename
* @param {String} extension Extension: 'svg' or 'jpg' or 'jpeg' or 'png'
* @param {Number} duration duration
* @param {Number} fps fps
* @param {Function} callback callback
*/
var _saveFrames = p5.prototype.saveFrames;
p5.prototype.saveFrames = function(filename, extension, duration, fps, callback) {
var args = arguments;
if (!this._renderer.svg) {
_saveFrames.apply(this, args);
return;
}
duration = duration || 3;
duration = p5.prototype.constrain(duration, 0, 15);
duration = duration * 1000;
fps = fps || 15;
fps = p5.prototype.constrain(fps, 0, 22);
var count = 0;
var frames = [];
var pending = 0;
var p = this;
var frameFactory = setInterval(function () {
(function(count) {
pending++;
p._makeSVGFrame({
filename: filename + count,
extension: extension,
callback: function(err, frame) {
frames[count] = frame;
pending--;
}
});
})(count);
count++;
}, 1000 / fps);
var done = function() {
if (pending > 0) {
setTimeout(function() {
done();
}, 10);
return;
}
if (callback) {
callback(frames);
} else {
frames.forEach(function(f) {
p.downloadFile(f.imageData, f.filename, f.ext);
});
}
};
setTimeout(function () {
clearInterval(frameFactory);
done();
}, duration + 0.01);
};
/**
* Extends p5's save method with SVG support
*
* @function save
* @memberof p5.prototype
* @param {Graphics|Element|SVGElement} [source] Source to save
* @param {String} [filename] filename
*/
var _save = p5.prototype.save;
p5.prototype.save = function() {
var args = arguments;
args = [args[0], args[1]];
var svg;
if (args[0] instanceof p5.Graphics) {
var svgcanvas = args[0].elt;
svg = svgcanvas.svg;
args.shift();
}
if (args[0] && args[0].elt) {
svg = args[0].elt;
args.shift();
}
if (typeof args[0] == 'object') {
svg = args[0];
args.shift();
}
svg = svg || (this._renderer && this._renderer.svg);
var filename = args[0];
var supportedExtensions = ['jpeg', 'png', 'jpg', 'svg', ''];
var ext = this._checkFileExtension(filename, '')[1];
var useSVG = svg && svg.nodeName && svg.nodeName.toLowerCase() === 'svg' && supportedExtensions.indexOf(ext) > -1;
if (useSVG) {
this.saveSVG(svg, filename);
} else {
return _save.apply(this, arguments);
}
};
/**
* Custom get in p5.svg (handles http and dataurl)
* @private
*/
p5.prototype._svg_get = function(path, successCallback, failureCallback) {
if (path.indexOf('data:') === 0) {
if (path.indexOf(',') === -1) {
failureCallback(new Error('Fail to parse dataurl: ' + path));
return;
}
var svg = path.split(',').pop();
// force request to dataurl to be async
// so that it won't make preload mess
setTimeout(function() {
if (path.indexOf(';base64,') > -1) {
svg = atob(svg);
} else {
svg = decodeURIComponent(svg);
}
successCallback(svg);
}, 1);
return svg;
} else {
this.httpGet(path, successCallback);
return null;
}
};
/**
* loadSVG (like loadImage, but will return SVGElement)
*
* @function loadSVG
* @memberof p5.prototype
* @returns {p5.SVGElement}
*/
p5.prototype.loadSVG = function(path, successCallback, failureCallback) {
var div = document.createElement('div');
var element = new p5.SVGElement(div);
this._incrementPreload();
new Promise((resolve, reject) => {
this._svg_get(path, function(svg) {
div.innerHTML = svg;
svg = div.querySelector('svg');
if (!svg) {
reject('Fail to create <svg>.');
return;
}
element.elt = svg;
resolve(element);
}, reject);
}).then((v) => {
successCallback && successCallback(v);
}).catch((e) => {
failureCallback && failureCallback(e);
}).finally(() => {
this._decrementPreload();
});
return element;
};
p5.prototype.getDataURL = function() {
return this._renderer.elt.toDataURL('image/svg+xml');
};
}
function Element(p5) {
/**
* Returns an Array of SVGElements of current SVG Graphics matching given selector
*
* @function querySVG
* @memberof p5.prototype
* @param {String} selector CSS selector for query
* @returns {SVGElement[]}
*/
p5.prototype.querySVG = function(selector) {
var svg = this._renderer && this._renderer.svg;
if (!svg) {
return null;
}
return p5.SVGElement.prototype.query.call({elt: svg}, selector);
};
/**
* @namespace SVGElement
* @constructor
* @param {Element} element
*/
function SVGElement(element) {
if (!element) {
return null;
}
return p5.Element.apply(this, arguments);
}
SVGElement.prototype = Object.create(p5.Element.prototype);
/**
* Returns an Array of children of current SVG Element matching given selector
*
* @function query
* @memberof SVGElement.prototype
* @param {String} selector CSS selector for query
* @returns {SVGElement[]}
*/
SVGElement.prototype.query = function(selector) {
var elements = this.elt.querySelectorAll(selector);
var objects = [];
for (var i = 0; i < elements.length; i++) {
objects[i] = new SVGElement(elements[i]);
}
return objects;
};
/**
* Append a new child to current element.
*
* @function append
* @memberof SVGElement.prototype
* @param {SVGElement|Element} element
*/
SVGElement.prototype.append = function(element) {
var elt = element.elt || element;
this.elt.appendChild(elt);
return this;
};
/**
* Apply different attribute operation based on arguments.length
* <ul>
* <li>setAttribute(name, value)</li>
* <li>setAttributeNS(namespace, name, value)</li>
* <li>getAttribute(name)</li>
* </ul>
*
* @function attribute
* @memberof SVGElement.prototype
*/
SVGElement.prototype.attribute = function() {
var args = arguments;
if (args.length === 3) {
this.elt.setAttributeNS.apply(this.elt, args);
}
if (args.length === 2) {
this.elt.setAttribute.apply(this.elt, args);
}
if (args.length === 1) {
return this.elt.getAttribute.apply(this.elt, args);
}
return this;
};
/**
* Apply filter on current element.
* If called multiple times,
* these filters will be chained together and combine to a bigger SVG filter.
*
* @function filter
* @memberof SVGElement.prototype
* @param {String} filter BLUR, GRAY, INVERT, THRESHOLD, OPAQUE, ERODE, DILATE (defined in p5's constants)
* @param {Any} argument Argument for that filter
*/
SVGElement.prototype._filter = function(filter, arg, defs) {
p5.SVGFilters.apply(this, filter, arg, defs);
return this;
};
/**
* Create SVGElement
*
* @function create
* @memberof SVGElement
* @param {String} nodeName
* @param {Object} [attributes] Attributes for the element
* @return {SVGElement}
*/
SVGElement.create = function(nodeName, attributes) {
attributes = attributes || {};
var elt = document.createElementNS('http://www.w3.org/2000/svg', nodeName);
Object.keys(attributes).forEach(function(k) {
elt.setAttribute(k, attributes[k]);
});
return new SVGElement(elt);
};
/**
* Get parentNode.
* If selector not given, returns parentNode.
* Otherwise, will look up all ancestors,
* and return closest element matching given selector,
* or return null if not found.
*
* @function parentNode
* @memberof SVGElement.prototype
* @param {String} [selector] CSS Selector
* @return {SVGElement}
*/
SVGElement.prototype.parentNode = function(selector) {
if (!selector) {
return new SVGElement(this.elt.parentNode);
}
var elt = this;
while (elt) {
elt = this.parentNode();
if (elt && elt.matches(selector)) {
return elt;
}
}
return null;
};
p5.SVGElement = SVGElement;
}
function P5SVGFilters(p5) {
var SVGFilters = function() {};
var SVGElement = p5.SVGElement;
var generateID = function() {
return Date.now().toString() + Math.random().toString().replace(/0\./, '');
};
// @private
// We have to build a filter for each element
// the `filter: f1 f2` and svg param is not supported by many browsers
// so we can just modify the filter def to do so
SVGFilters.apply = function(svgElement, func, arg, defs) {
// get filters
var filters = svgElement.attribute('data-p5-svg-filters') || '[]';
filters = JSON.parse(filters);
if (func) {
filters.push([func, arg]);
}
svgElement.attribute('data-p5-svg-filters', JSON.stringify(filters));
if (filters.length === 0) {
svgElement.attribute('filter', null);
return;
}
// generate filters chain
filters = filters.map(function(filter, index) {
var inGraphics = index === 0 ? 'SourceGraphic' : ('result-' + (index - 1));
var resultGraphics = 'result-' + index;
return SVGFilters[filter[0]].call(null, inGraphics, resultGraphics, filter[1]);
});
// get filter id for this element or create one
var filterid = svgElement.attribute('data-p5-svg-filter-id');
if (!filterid) {
filterid = 'p5-svg-' + generateID();
svgElement.attribute('data-p5-svg-filter-id', filterid);
}
// Note that when filters is [], we will remove filter attr
// So, here, we write this attr every time
svgElement.attribute('filter', 'url(#' + filterid + ')');
// create <filter>
var filter = SVGElement.create('filter', {id: filterid});
filters.forEach(function(elt) {
if (!Array.isArray(elt)) {
elt = [elt];
}
elt.forEach(function(elt) {
filter.append(elt);
});
});
// get defs
var oldfilter = defs.querySelectorAll('#' + filterid)[0];
if (!oldfilter) {
defs.appendChild(filter.elt);
} else {
oldfilter.elt.parentNode.replaceChild(filter.elt, oldfilter);
}
};
SVGFilters.blur = function(inGraphics, resultGraphics, val) {
return SVGElement.create('feGaussianBlur', {
stdDeviation: val,
in: inGraphics,
result: resultGraphics,
'color-interpolation-filters': 'sRGB'
});
};
// See also: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement
// See also: http://stackoverflow.com/questions/21977929/match-colors-in-fecolormatrix-filter
SVGFilters.colorMatrix = function(inGraphics, resultGraphics, matrix) {
return SVGElement.create('feColorMatrix', {
type: 'matrix',
values: matrix.join(' '),
'color-interpolation-filters': 'sRGB',
in: inGraphics,
result: resultGraphics
});
};
// Here we use CIE luminance for RGB
SVGFilters.gray = function(inGraphics, resultGraphics) {
var matrix = [
0.2126, 0.7152, 0.0722, 0, 0, // R'
0.2126, 0.7152, 0.0722, 0, 0, // G'
0.2126, 0.7152, 0.0722, 0, 0, // B'
0, 0, 0, 1, 0 // A'
];
return SVGFilters.colorMatrix(inGraphics, resultGraphics, matrix);
};
SVGFilters.threshold = function(inGraphics, resultGraphics, val) {
var elements = [];
elements.push(SVGFilters.gray(inGraphics, resultGraphics + '-tmp'));
var componentTransfer = SVGElement.create('feComponentTransfer', {
'in': resultGraphics + '-tmp',
result: resultGraphics
});
var thresh = Math.floor(val * 255);
['R', 'G', 'B'].forEach(function(channel) {
// Note that original value is from 0 to 1
var func = SVGElement.create('feFunc' + channel, {
type: 'linear',
slope: 255, // all non-zero * 255
intercept: (thresh - 1) * -1
});
componentTransfer.append(func);
});
elements.push(componentTransfer);
return elements;
};
SVGFilters.invert = function(inGraphics, resultGraphics) {
var matrix = [
-1, 0, 0, 0, 1,
0, -1, 0, 0, 1,
0, 0, -1, 0, 1,
0, 0, 0, 1, 0
];
return SVGFilters.colorMatrix(inGraphics, resultGraphics, matrix);
};
SVGFilters.opaque = function(inGraphics, resultGraphics) {
var matrix = [
1, 0, 0, 0, 0, // original R
0, 1, 0, 0, 0, // original G
0, 0, 1, 0, 0, // original B
0, 0, 0, 0, 1 // set A to 1
];
return SVGFilters.colorMatrix(inGraphics, resultGraphics, matrix);
};
/**
* Generate discrete table values based on the given color map function
*
* @private
* @param {Function} fn - Function to map channel values (val ∈ [0, 255])
* @see http://www.w3.org/TR/SVG/filters.html#feComponentTransferElement
*/
SVGFilters._discreteTableValues = function(fn) {
var table = [];
for (var val = 0; val < 256; val++) {
var newval = fn(val);
table.push(newval / 255); // map to ∈ [0, 1]
}
return table;
};
/**
* Limits each channel of the image to the number of colors specified as
* the parameter. The parameter can be set to values between 2 and 255, but
* results are most noticeable in the lower ranges.
*
* Adapted from p5's Filters.posterize
*/
SVGFilters.posterize = function(inGraphics, resultGraphics, level) {
level = parseInt(level, 10);
if ((level < 2) || (level > 255)) {
throw new Error(
'Level must be greater than 2 and less than 255 for posterize'
);
}
var tableValues = SVGFilters._discreteTableValues(function(val) {
return (((val * level) >> 8) * 255) / (level - 1);
});
var componentTransfer = SVGElement.create('feComponentTransfer', {
'in': inGraphics,
result: resultGraphics,
'color-interpolation-filters': 'sRGB'
});
['R', 'G', 'B'].forEach(function(channel) {
var func = SVGElement.create('feFunc' + channel, {
type: 'discrete',
tableValues: tableValues.join(' ')
});
componentTransfer.append(func);
});
return componentTransfer;
};
SVGFilters._blendOffset = function(inGraphics, resultGraphics, mode) {
var elements = [];
[
['left', -1, 0],
['right', 1, 0],
['up', 0, -1],
['down', 0, 1]
].forEach(function(neighbor) {
elements.push(SVGElement.create('feOffset', {
'in': inGraphics,
result: resultGraphics + '-' + neighbor[0],
dx: neighbor[1],
dy: neighbor[2]
}));
});
[
[null, inGraphics],
[resultGraphics + '-left', resultGraphics + '-tmp-0'],
[resultGraphics + '-right', resultGraphics + '-tmp-1'],
[resultGraphics + '-up', resultGraphics + '-tmp-2'],
[resultGraphics + '-down', resultGraphics + '-tmp-3']
].forEach(function(layer, i, layers) {
if (i === 0) {
return;
}
elements.push(SVGElement.create('feBlend', {
'in': layers[i - 1][1],
in2: layer[0],
result: layer[1],
mode: mode
}));
});
return elements;
};
/**
* Increases the bright areas in an image
*
* Will create 4 offset layer and blend them using darken mode
*/
SVGFilters.erode = function(inGraphics, resultGraphics) {
return SVGFilters._blendOffset(inGraphics, resultGraphics, 'darken');
};
SVGFilters.dilate = function(inGraphics, resultGraphics) {
return SVGFilters._blendOffset(inGraphics, resultGraphics, 'lighten');
};
p5.SVGFilters = SVGFilters;
return SVGFilters;
}
// SVG Filter
function Filters(p5) {
var _filter = p5.prototype.filter;
var SVGFilters = P5SVGFilters(p5);
/**
* Register a custom SVG Filter
*
* @function registerSVGFilter
* @memberof p5.prototype
* @param {String} name Name for Custom SVG filter
* @param {Function} filterFunction filterFunction(inGraphicsName, resultGraphicsName, value)
* should return SVGElement or Array of SVGElement.
* @example
* registerSVGFilter('myblur', function(inGraphicsName, resultGraphicsName, value) {
* return SVGElement.create('feGaussianBlur', {
* stdDeviation: val,
* in: inGraphics,
* result: resultGraphics,
* 'color-interpolation-filters': 'sRGB'
* });
* });
* filter('myblur', 5);
*/
p5.prototype.registerSVGFilter = function(name, fn) {
SVGFilters[name] = fn;
};
p5.prototype.filter = function(operation, value) {
var svg = this._renderer.svg;
if (svg) {
const ctx = this._renderer.drawingContext;
const defs = ctx.__root.querySelectorAll('defs')[0];
const rootGroup = ctx.__root.childNodes[1];
// move nodes to a new <g>
let g = p5.SVGElement.create('g');
while (rootGroup.childNodes.length > 0) {
g.elt.appendChild(rootGroup.childNodes[0]);
}
rootGroup.appendChild(g.elt);
// apply filter
g._filter(operation, value, defs);
// create new <g> so that new element won't be influenced by the filter
g = p5.SVGElement.create('g');
rootGroup.appendChild(g.elt);
ctx.__currentElement = g.elt;
} else {
_filter.apply(this, arguments);
}
};
}
function Image$1(p5) {
p5.prototype.loadPixels = function(...args) {
p5._validateParameters('loadPixels', args);
return this._renderer.loadPixels();
};
}
function init(p5) {
/**
* @namespace p5
*/
RendererSVG(p5);
Rendering(p5);
IO(p5);
Element(p5);
Filters(p5);
Image$1(p5);
// attach constants to p5 instance
Object.keys(constants).forEach(function(k) {
p5.prototype[k] = constants[k];
});
}
if (typeof window.p5 !== 'undefined') {
init(window.p5);
}
return init;
}());
//# sourceMappingURL=p5.svg.js.map
This file has been truncated, but you can view the full file.
/*! p5.js v1.4.0 June 29, 2021 */
(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.p5 = f();
}
})(function() {
var define, module, exports;
return (function() {
function r(e, n, t) {
function o(i, f) {
if (!n[i]) {
if (!e[i]) {
var c = 'function' == typeof require && require;
if (!f && c) return c(i, !0);
if (u) return u(i, !0);
var a = new Error("Cannot find module '" + i + "'");
throw ((a.code = 'MODULE_NOT_FOUND'), a);
}
var p = (n[i] = { exports: {} });
e[i][0].call(
p.exports,
function(r) {
var n = e[i][1][r];
return o(n || r);
},
p,
p.exports,
r,
e,
n,
t
);
}
return n[i].exports;
}
for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++)
o(t[i]);
return o;
}
return r;
})()(
{
1: [
function(_dereq_, module, exports) {
module.exports = {
p5: {
describe: {
name: 'describe',
params: [
{
name: 'text',
description: '<p>description of the canvas</p>\n',
type: 'String'
},
{
name: 'display',
description: '<p>either LABEL or FALLBACK</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
describeElement: {
name: 'describeElement',
params: [
{
name: 'name',
description: '<p>name of the element</p>\n',
type: 'String'
},
{
name: 'text',
description: '<p>description of the element</p>\n',
type: 'String'
},
{
name: 'display',
description: '<p>either LABEL or FALLBACK</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
textOutput: {
name: 'textOutput',
params: [
{
name: 'display',
description: '<p>either FALLBACK or LABEL</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
gridOutput: {
name: 'gridOutput',
params: [
{
name: 'display',
description: '<p>either FALLBACK or LABEL</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
alpha: {
name: 'alpha',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
blue: {
name: 'blue',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
brightness: {
name: 'brightness',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
color: {
name: 'color',
class: 'p5',
module: 'Color',
overloads: [
{
params: [
{
name: 'gray',
description:
'<p>number specifying value between white and black.</p>\n',
type: 'Number'
},
{
name: 'alpha',
description:
'<p>alpha value relative to current color range\n (default is 0-255)</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
]
},
{
params: [
{
name: 'color',
description: '',
type: 'p5.Color'
}
]
}
]
},
green: {
name: 'green',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
hue: {
name: 'hue',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
lerpColor: {
name: 'lerpColor',
params: [
{
name: 'c1',
description: '<p>interpolate from this color</p>\n',
type: 'p5.Color'
},
{
name: 'c2',
description: '<p>interpolate to this color</p>\n',
type: 'p5.Color'
},
{
name: 'amt',
description: '<p>number between 0 and 1</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Color'
},
lightness: {
name: 'lightness',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
red: {
name: 'red',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
saturation: {
name: 'saturation',
params: [
{
name: 'color',
description:
'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n or CSS color</p>\n',
type: 'p5.Color|Number[]|String'
}
],
class: 'p5',
module: 'Color'
},
background: {
name: 'background',
class: 'p5',
module: 'Color',
overloads: [
{
params: [
{
name: 'color',
description:
'<p>any value created by the <a href="#/p5/color">color()</a> function</p>\n',
type: 'p5.Color'
}
],
chainable: 1
},
{
params: [
{
name: 'colorstring',
description:
'<p>color string, possible formats include: integer\n rgb() or rgba(), percentage rgb() or rgba(),\n 3-digit hex, 6-digit hex</p>\n',
type: 'String'
},
{
name: 'a',
description:
'<p>opacity of the background relative to current\n color range (default is 0-255)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'gray',
description: '<p>specifies a value between white and black</p>\n',
type: 'Number'
},
{
name: 'a',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description:
'<p>red or hue value (depending on the current color\n mode)</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value (depending on the current\n color mode)</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value (depending on the current\n color mode)</p>\n',
type: 'Number'
},
{
name: 'a',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red, green, blue\n and alpha components of the color</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'image',
description:
'<p>image created with <a href="#/p5/loadImage">loadImage()</a> or <a href="#/p5/createImage">createImage()</a>,\n to set as background\n (must be same size as the sketch window)</p>\n',
type: 'p5.Image'
},
{
name: 'a',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
}
]
},
clear: {
name: 'clear',
class: 'p5',
module: 'Color'
},
colorMode: {
name: 'colorMode',
class: 'p5',
module: 'Color',
overloads: [
{
params: [
{
name: 'mode',
description:
'<p>either RGB, HSB or HSL, corresponding to\n Red/Green/Blue and Hue/Saturation/Brightness\n (or Lightness)</p>\n',
type: 'Constant'
},
{
name: 'max',
description: '<p>range for all values</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'mode',
description: '',
type: 'Constant'
},
{
name: 'max1',
description:
'<p>range for the red or hue depending on the\n current color mode</p>\n',
type: 'Number'
},
{
name: 'max2',
description:
'<p>range for the green or saturation depending\n on the current color mode</p>\n',
type: 'Number'
},
{
name: 'max3',
description:
'<p>range for the blue or brightness/lightness\n depending on the current color mode</p>\n',
type: 'Number'
},
{
name: 'maxA',
description: '<p>range for the alpha</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
}
]
},
fill: {
name: 'fill',
class: 'p5',
module: 'Color',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: [
{
name: 'gray',
description: '<p>a gray value</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>the fill color</p>\n',
type: 'p5.Color'
}
],
chainable: 1
}
]
},
noFill: {
name: 'noFill',
class: 'p5',
module: 'Color'
},
noStroke: {
name: 'noStroke',
class: 'p5',
module: 'Color'
},
stroke: {
name: 'stroke',
class: 'p5',
module: 'Color',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: [
{
name: 'gray',
description: '<p>a gray value</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>the stroke color</p>\n',
type: 'p5.Color'
}
],
chainable: 1
}
]
},
erase: {
name: 'erase',
params: [
{
name: 'strengthFill',
description:
"<p>A number (0-255) for the strength of erasing for a shape's fill.\n This will default to 255 when no argument is given, which\n is full strength.</p>\n",
type: 'Number',
optional: true
},
{
name: 'strengthStroke',
description:
"<p>A number (0-255) for the strength of erasing for a shape's stroke.\n This will default to 255 when no argument is given, which\n is full strength.</p>\n",
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Color'
},
noErase: {
name: 'noErase',
class: 'p5',
module: 'Color'
},
arc: {
name: 'arc',
params: [
{
name: 'x',
description: "<p>x-coordinate of the arc's ellipse</p>\n",
type: 'Number'
},
{
name: 'y',
description: "<p>y-coordinate of the arc's ellipse</p>\n",
type: 'Number'
},
{
name: 'w',
description: "<p>width of the arc's ellipse by default</p>\n",
type: 'Number'
},
{
name: 'h',
description: "<p>height of the arc's ellipse by default</p>\n",
type: 'Number'
},
{
name: 'start',
description: '<p>angle to start the arc, specified in radians</p>\n',
type: 'Number'
},
{
name: 'stop',
description: '<p>angle to stop the arc, specified in radians</p>\n',
type: 'Number'
},
{
name: 'mode',
description:
'<p>optional parameter to determine the way of drawing\n the arc. either CHORD, PIE or OPEN</p>\n',
type: 'Constant',
optional: true
},
{
name: 'detail',
description:
"<p>optional parameter for WebGL mode only. This is to\n specify the number of vertices that makes up the\n perimeter of the arc. Default value is 25. Won't\n draw a stroke for a detail of more than 50.</p>\n",
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
ellipse: {
name: 'ellipse',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the center of ellipse.</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the center of ellipse.</p>\n',
type: 'Number'
},
{
name: 'w',
description: '<p>width of the ellipse.</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height of the ellipse.</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'w',
description: '',
type: 'Number'
},
{
name: 'h',
description: '',
type: 'Number'
},
{
name: 'detail',
description:
"<p>optional parameter for WebGL mode only. This is to\n specify the number of vertices that makes up the\n perimeter of the ellipse. Default value is 25. Won't\n draw a stroke for a detail of more than 50.</p>\n",
type: 'Integer',
optional: true
}
]
}
]
},
circle: {
name: 'circle',
params: [
{
name: 'x',
description: '<p>x-coordinate of the centre of the circle.</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the centre of the circle.</p>\n',
type: 'Number'
},
{
name: 'd',
description: '<p>diameter of the circle.</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
line: {
name: 'line',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x1',
description: '<p>the x-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'y1',
description: '<p>the y-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>the x-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>the y-coordinate of the second point</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x1',
description: '',
type: 'Number'
},
{
name: 'y1',
description: '',
type: 'Number'
},
{
name: 'z1',
description: '<p>the z-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description: '<p>the z-coordinate of the second point</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
point: {
name: 'point',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x-coordinate</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>the y-coordinate</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>the z-coordinate (for WebGL mode)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'coordinate_vector',
description: '<p>the coordinate vector</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
}
]
},
quad: {
name: 'quad',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x1',
description: '<p>the x-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'y1',
description: '<p>the y-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>the x-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>the y-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>the x-coordinate of the third point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>the y-coordinate of the third point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '<p>the x-coordinate of the fourth point</p>\n',
type: 'Number'
},
{
name: 'y4',
description: '<p>the y-coordinate of the fourth point</p>\n',
type: 'Number'
},
{
name: 'detailX',
description: '<p>number of segments in the x-direction</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description: '<p>number of segments in the y-direction</p>\n',
type: 'Integer',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'x1',
description: '',
type: 'Number'
},
{
name: 'y1',
description: '',
type: 'Number'
},
{
name: 'z1',
description: '<p>the z-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description: '<p>the z-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '',
type: 'Number'
},
{
name: 'y3',
description: '',
type: 'Number'
},
{
name: 'z3',
description: '<p>the z-coordinate of the third point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '',
type: 'Number'
},
{
name: 'y4',
description: '',
type: 'Number'
},
{
name: 'z4',
description: '<p>the z-coordinate of the fourth point</p>\n',
type: 'Number'
},
{
name: 'detailX',
description: '',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description: '',
type: 'Integer',
optional: true
}
],
chainable: 1
}
]
},
rect: {
name: 'rect',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the rectangle.</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the rectangle.</p>\n',
type: 'Number'
},
{
name: 'w',
description: '<p>width of the rectangle.</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height of the rectangle.</p>\n',
type: 'Number',
optional: true
},
{
name: 'tl',
description: '<p>optional radius of top-left corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'tr',
description: '<p>optional radius of top-right corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'br',
description: '<p>optional radius of bottom-right corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'bl',
description: '<p>optional radius of bottom-left corner.</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'w',
description: '',
type: 'Number'
},
{
name: 'h',
description: '',
type: 'Number'
},
{
name: 'detailX',
description:
'<p>number of segments in the x-direction (for WebGL mode)</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>number of segments in the y-direction (for WebGL mode)</p>\n',
type: 'Integer',
optional: true
}
],
chainable: 1
}
]
},
square: {
name: 'square',
params: [
{
name: 'x',
description: '<p>x-coordinate of the square.</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the square.</p>\n',
type: 'Number'
},
{
name: 's',
description: '<p>side size of the square.</p>\n',
type: 'Number'
},
{
name: 'tl',
description: '<p>optional radius of top-left corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'tr',
description: '<p>optional radius of top-right corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'br',
description: '<p>optional radius of bottom-right corner.</p>\n',
type: 'Number',
optional: true
},
{
name: 'bl',
description: '<p>optional radius of bottom-left corner.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
triangle: {
name: 'triangle',
params: [
{
name: 'x1',
description: '<p>x-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'y1',
description: '<p>y-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>x-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>y-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>x-coordinate of the third point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>y-coordinate of the third point</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
ellipseMode: {
name: 'ellipseMode',
params: [
{
name: 'mode',
description: '<p>either CENTER, RADIUS, CORNER, or CORNERS</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Shape'
},
noSmooth: {
name: 'noSmooth',
class: 'p5',
module: 'Shape'
},
rectMode: {
name: 'rectMode',
params: [
{
name: 'mode',
description: '<p>either CORNER, CORNERS, CENTER, or RADIUS</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Shape'
},
smooth: {
name: 'smooth',
class: 'p5',
module: 'Shape'
},
strokeCap: {
name: 'strokeCap',
params: [
{
name: 'cap',
description: '<p>either ROUND, SQUARE or PROJECT</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Shape'
},
strokeJoin: {
name: 'strokeJoin',
params: [
{
name: 'join',
description: '<p>either MITER, BEVEL, ROUND</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Shape'
},
strokeWeight: {
name: 'strokeWeight',
params: [
{
name: 'weight',
description: '<p>the weight of the stroke (in pixels)</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
bezier: {
name: 'bezier',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x1',
description: '<p>x-coordinate for the first anchor point</p>\n',
type: 'Number'
},
{
name: 'y1',
description: '<p>y-coordinate for the first anchor point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>x-coordinate for the first control point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>y-coordinate for the first control point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>x-coordinate for the second control point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>y-coordinate for the second control point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '<p>x-coordinate for the second anchor point</p>\n',
type: 'Number'
},
{
name: 'y4',
description: '<p>y-coordinate for the second anchor point</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x1',
description: '',
type: 'Number'
},
{
name: 'y1',
description: '',
type: 'Number'
},
{
name: 'z1',
description: '<p>z-coordinate for the first anchor point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description: '<p>z-coordinate for the first control point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '',
type: 'Number'
},
{
name: 'y3',
description: '',
type: 'Number'
},
{
name: 'z3',
description: '<p>z-coordinate for the second control point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '',
type: 'Number'
},
{
name: 'y4',
description: '',
type: 'Number'
},
{
name: 'z4',
description: '<p>z-coordinate for the second anchor point</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
bezierDetail: {
name: 'bezierDetail',
params: [
{
name: 'detail',
description: '<p>resolution of the curves</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
bezierPoint: {
name: 'bezierPoint',
params: [
{
name: 'a',
description: '<p>coordinate of first point on the curve</p>\n',
type: 'Number'
},
{
name: 'b',
description: '<p>coordinate of first control point</p>\n',
type: 'Number'
},
{
name: 'c',
description: '<p>coordinate of second control point</p>\n',
type: 'Number'
},
{
name: 'd',
description: '<p>coordinate of second point on the curve</p>\n',
type: 'Number'
},
{
name: 't',
description: '<p>value between 0 and 1</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
bezierTangent: {
name: 'bezierTangent',
params: [
{
name: 'a',
description: '<p>coordinate of first point on the curve</p>\n',
type: 'Number'
},
{
name: 'b',
description: '<p>coordinate of first control point</p>\n',
type: 'Number'
},
{
name: 'c',
description: '<p>coordinate of second control point</p>\n',
type: 'Number'
},
{
name: 'd',
description: '<p>coordinate of second point on the curve</p>\n',
type: 'Number'
},
{
name: 't',
description: '<p>value between 0 and 1</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
curve: {
name: 'curve',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x1',
description:
'<p>x-coordinate for the beginning control point</p>\n',
type: 'Number'
},
{
name: 'y1',
description:
'<p>y-coordinate for the beginning control point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>x-coordinate for the first point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>y-coordinate for the first point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>x-coordinate for the second point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>y-coordinate for the second point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '<p>x-coordinate for the ending control point</p>\n',
type: 'Number'
},
{
name: 'y4',
description: '<p>y-coordinate for the ending control point</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x1',
description: '',
type: 'Number'
},
{
name: 'y1',
description: '',
type: 'Number'
},
{
name: 'z1',
description:
'<p>z-coordinate for the beginning control point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description: '<p>z-coordinate for the first point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '',
type: 'Number'
},
{
name: 'y3',
description: '',
type: 'Number'
},
{
name: 'z3',
description: '<p>z-coordinate for the second point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '',
type: 'Number'
},
{
name: 'y4',
description: '',
type: 'Number'
},
{
name: 'z4',
description: '<p>z-coordinate for the ending control point</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
curveDetail: {
name: 'curveDetail',
params: [
{
name: 'resolution',
description: '<p>resolution of the curves</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
curveTightness: {
name: 'curveTightness',
params: [
{
name: 'amount',
description:
'<p>amount of deformation from the original vertices</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
curvePoint: {
name: 'curvePoint',
params: [
{
name: 'a',
description: '<p>coordinate of first control point of the curve</p>\n',
type: 'Number'
},
{
name: 'b',
description: '<p>coordinate of first point</p>\n',
type: 'Number'
},
{
name: 'c',
description: '<p>coordinate of second point</p>\n',
type: 'Number'
},
{
name: 'd',
description: '<p>coordinate of second control point</p>\n',
type: 'Number'
},
{
name: 't',
description: '<p>value between 0 and 1</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
curveTangent: {
name: 'curveTangent',
params: [
{
name: 'a',
description: '<p>coordinate of first control point</p>\n',
type: 'Number'
},
{
name: 'b',
description: '<p>coordinate of first point on the curve</p>\n',
type: 'Number'
},
{
name: 'c',
description: '<p>coordinate of second point on the curve</p>\n',
type: 'Number'
},
{
name: 'd',
description: '<p>coordinate of second conrol point</p>\n',
type: 'Number'
},
{
name: 't',
description: '<p>value between 0 and 1</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Shape'
},
beginContour: {
name: 'beginContour',
class: 'p5',
module: 'Shape'
},
beginShape: {
name: 'beginShape',
params: [
{
name: 'kind',
description:
'<p>either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\n TRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
bezierVertex: {
name: 'bezierVertex',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x2',
description: '<p>x-coordinate for the first control point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>y-coordinate for the first control point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>x-coordinate for the second control point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>y-coordinate for the second control point</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '<p>x-coordinate for the anchor point</p>\n',
type: 'Number'
},
{
name: 'y4',
description: '<p>y-coordinate for the anchor point</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description:
'<p>z-coordinate for the first control point (for WebGL mode)</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '',
type: 'Number'
},
{
name: 'y3',
description: '',
type: 'Number'
},
{
name: 'z3',
description:
'<p>z-coordinate for the second control point (for WebGL mode)</p>\n',
type: 'Number'
},
{
name: 'x4',
description: '',
type: 'Number'
},
{
name: 'y4',
description: '',
type: 'Number'
},
{
name: 'z4',
description:
'<p>z-coordinate for the anchor point (for WebGL mode)</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
curveVertex: {
name: 'curveVertex',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the vertex</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the vertex</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '<p>z-coordinate of the vertex (for WebGL mode)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
}
]
},
endContour: {
name: 'endContour',
class: 'p5',
module: 'Shape'
},
endShape: {
name: 'endShape',
params: [
{
name: 'mode',
description: '<p>use CLOSE to close the shape</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
quadraticVertex: {
name: 'quadraticVertex',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'cx',
description: '<p>x-coordinate for the control point</p>\n',
type: 'Number'
},
{
name: 'cy',
description: '<p>y-coordinate for the control point</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '<p>x-coordinate for the anchor point</p>\n',
type: 'Number'
},
{
name: 'y3',
description: '<p>y-coordinate for the anchor point</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'cx',
description: '',
type: 'Number'
},
{
name: 'cy',
description: '',
type: 'Number'
},
{
name: 'cz',
description:
'<p>z-coordinate for the control point (for WebGL mode)</p>\n',
type: 'Number'
},
{
name: 'x3',
description: '',
type: 'Number'
},
{
name: 'y3',
description: '',
type: 'Number'
},
{
name: 'z3',
description:
'<p>z-coordinate for the anchor point (for WebGL mode)</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
vertex: {
name: 'vertex',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the vertex</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the vertex</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description:
'<p>z-coordinate of the vertex.\n Defaults to 0 if not specified.</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number',
optional: true
},
{
name: 'u',
description: "<p>the vertex's texture u-coordinate</p>\n",
type: 'Number'
},
{
name: 'v',
description: "<p>the vertex's texture v-coordinate</p>\n",
type: 'Number'
}
],
chainable: 1
}
]
},
normal: {
name: 'normal',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'vector',
description: '<p>A p5.Vector representing the vertex normal.</p>\n',
type: 'Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '<p>The x component of the vertex normal.</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>The y component of the vertex normal.</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>The z component of the vertex normal.</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
VERSION: {
name: 'VERSION',
class: 'p5',
module: 'Constants'
},
P2D: {
name: 'P2D',
class: 'p5',
module: 'Constants'
},
WEBGL: {
name: 'WEBGL',
class: 'p5',
module: 'Constants'
},
ARROW: {
name: 'ARROW',
class: 'p5',
module: 'Constants'
},
CROSS: {
name: 'CROSS',
class: 'p5',
module: 'Constants'
},
HAND: {
name: 'HAND',
class: 'p5',
module: 'Constants'
},
MOVE: {
name: 'MOVE',
class: 'p5',
module: 'Constants'
},
TEXT: {
name: 'TEXT',
class: 'p5',
module: 'Constants'
},
WAIT: {
name: 'WAIT',
class: 'p5',
module: 'Constants'
},
HALF_PI: {
name: 'HALF_PI',
class: 'p5',
module: 'Constants'
},
PI: {
name: 'PI',
class: 'p5',
module: 'Constants'
},
QUARTER_PI: {
name: 'QUARTER_PI',
class: 'p5',
module: 'Constants'
},
TAU: {
name: 'TAU',
class: 'p5',
module: 'Constants'
},
TWO_PI: {
name: 'TWO_PI',
class: 'p5',
module: 'Constants'
},
DEGREES: {
name: 'DEGREES',
class: 'p5',
module: 'Constants'
},
RADIANS: {
name: 'RADIANS',
class: 'p5',
module: 'Constants'
},
CORNER: {
name: 'CORNER',
class: 'p5',
module: 'Constants'
},
CORNERS: {
name: 'CORNERS',
class: 'p5',
module: 'Constants'
},
RADIUS: {
name: 'RADIUS',
class: 'p5',
module: 'Constants'
},
RIGHT: {
name: 'RIGHT',
class: 'p5',
module: 'Constants'
},
LEFT: {
name: 'LEFT',
class: 'p5',
module: 'Constants'
},
CENTER: {
name: 'CENTER',
class: 'p5',
module: 'Constants'
},
TOP: {
name: 'TOP',
class: 'p5',
module: 'Constants'
},
BOTTOM: {
name: 'BOTTOM',
class: 'p5',
module: 'Constants'
},
BASELINE: {
name: 'BASELINE',
class: 'p5',
module: 'Constants'
},
POINTS: {
name: 'POINTS',
class: 'p5',
module: 'Constants'
},
LINES: {
name: 'LINES',
class: 'p5',
module: 'Constants'
},
LINE_STRIP: {
name: 'LINE_STRIP',
class: 'p5',
module: 'Constants'
},
LINE_LOOP: {
name: 'LINE_LOOP',
class: 'p5',
module: 'Constants'
},
TRIANGLES: {
name: 'TRIANGLES',
class: 'p5',
module: 'Constants'
},
TRIANGLE_FAN: {
name: 'TRIANGLE_FAN',
class: 'p5',
module: 'Constants'
},
TRIANGLE_STRIP: {
name: 'TRIANGLE_STRIP',
class: 'p5',
module: 'Constants'
},
QUADS: {
name: 'QUADS',
class: 'p5',
module: 'Constants'
},
QUAD_STRIP: {
name: 'QUAD_STRIP',
class: 'p5',
module: 'Constants'
},
TESS: {
name: 'TESS',
class: 'p5',
module: 'Constants'
},
CLOSE: {
name: 'CLOSE',
class: 'p5',
module: 'Constants'
},
OPEN: {
name: 'OPEN',
class: 'p5',
module: 'Constants'
},
CHORD: {
name: 'CHORD',
class: 'p5',
module: 'Constants'
},
PIE: {
name: 'PIE',
class: 'p5',
module: 'Constants'
},
PROJECT: {
name: 'PROJECT',
class: 'p5',
module: 'Constants'
},
SQUARE: {
name: 'SQUARE',
class: 'p5',
module: 'Constants'
},
ROUND: {
name: 'ROUND',
class: 'p5',
module: 'Constants'
},
BEVEL: {
name: 'BEVEL',
class: 'p5',
module: 'Constants'
},
MITER: {
name: 'MITER',
class: 'p5',
module: 'Constants'
},
RGB: {
name: 'RGB',
class: 'p5',
module: 'Constants'
},
HSB: {
name: 'HSB',
class: 'p5',
module: 'Constants'
},
HSL: {
name: 'HSL',
class: 'p5',
module: 'Constants'
},
AUTO: {
name: 'AUTO',
class: 'p5',
module: 'Constants'
},
ALT: {
name: 'ALT',
class: 'p5',
module: 'Constants'
},
BACKSPACE: {
name: 'BACKSPACE',
class: 'p5',
module: 'Constants'
},
CONTROL: {
name: 'CONTROL',
class: 'p5',
module: 'Constants'
},
DELETE: {
name: 'DELETE',
class: 'p5',
module: 'Constants'
},
DOWN_ARROW: {
name: 'DOWN_ARROW',
class: 'p5',
module: 'Constants'
},
ENTER: {
name: 'ENTER',
class: 'p5',
module: 'Constants'
},
ESCAPE: {
name: 'ESCAPE',
class: 'p5',
module: 'Constants'
},
LEFT_ARROW: {
name: 'LEFT_ARROW',
class: 'p5',
module: 'Constants'
},
OPTION: {
name: 'OPTION',
class: 'p5',
module: 'Constants'
},
RETURN: {
name: 'RETURN',
class: 'p5',
module: 'Constants'
},
RIGHT_ARROW: {
name: 'RIGHT_ARROW',
class: 'p5',
module: 'Constants'
},
SHIFT: {
name: 'SHIFT',
class: 'p5',
module: 'Constants'
},
TAB: {
name: 'TAB',
class: 'p5',
module: 'Constants'
},
UP_ARROW: {
name: 'UP_ARROW',
class: 'p5',
module: 'Constants'
},
BLEND: {
name: 'BLEND',
class: 'p5',
module: 'Constants'
},
REMOVE: {
name: 'REMOVE',
class: 'p5',
module: 'Constants'
},
ADD: {
name: 'ADD',
class: 'p5',
module: 'Constants'
},
DARKEST: {
name: 'DARKEST',
class: 'p5',
module: 'Constants'
},
LIGHTEST: {
name: 'LIGHTEST',
class: 'p5',
module: 'Constants'
},
DIFFERENCE: {
name: 'DIFFERENCE',
class: 'p5',
module: 'Constants'
},
SUBTRACT: {
name: 'SUBTRACT',
class: 'p5',
module: 'Constants'
},
EXCLUSION: {
name: 'EXCLUSION',
class: 'p5',
module: 'Constants'
},
MULTIPLY: {
name: 'MULTIPLY',
class: 'p5',
module: 'Constants'
},
SCREEN: {
name: 'SCREEN',
class: 'p5',
module: 'Constants'
},
REPLACE: {
name: 'REPLACE',
class: 'p5',
module: 'Constants'
},
OVERLAY: {
name: 'OVERLAY',
class: 'p5',
module: 'Constants'
},
HARD_LIGHT: {
name: 'HARD_LIGHT',
class: 'p5',
module: 'Constants'
},
SOFT_LIGHT: {
name: 'SOFT_LIGHT',
class: 'p5',
module: 'Constants'
},
DODGE: {
name: 'DODGE',
class: 'p5',
module: 'Constants'
},
BURN: {
name: 'BURN',
class: 'p5',
module: 'Constants'
},
THRESHOLD: {
name: 'THRESHOLD',
class: 'p5',
module: 'Constants'
},
GRAY: {
name: 'GRAY',
class: 'p5',
module: 'Constants'
},
OPAQUE: {
name: 'OPAQUE',
class: 'p5',
module: 'Constants'
},
INVERT: {
name: 'INVERT',
class: 'p5',
module: 'Constants'
},
POSTERIZE: {
name: 'POSTERIZE',
class: 'p5',
module: 'Constants'
},
DILATE: {
name: 'DILATE',
class: 'p5',
module: 'Constants'
},
ERODE: {
name: 'ERODE',
class: 'p5',
module: 'Constants'
},
BLUR: {
name: 'BLUR',
class: 'p5',
module: 'Constants'
},
NORMAL: {
name: 'NORMAL',
class: 'p5',
module: 'Constants'
},
ITALIC: {
name: 'ITALIC',
class: 'p5',
module: 'Constants'
},
BOLD: {
name: 'BOLD',
class: 'p5',
module: 'Constants'
},
BOLDITALIC: {
name: 'BOLDITALIC',
class: 'p5',
module: 'Constants'
},
CHAR: {
name: 'CHAR',
class: 'p5',
module: 'Constants'
},
WORD: {
name: 'WORD',
class: 'p5',
module: 'Constants'
},
LINEAR: {
name: 'LINEAR',
class: 'p5',
module: 'Constants'
},
QUADRATIC: {
name: 'QUADRATIC',
class: 'p5',
module: 'Constants'
},
BEZIER: {
name: 'BEZIER',
class: 'p5',
module: 'Constants'
},
CURVE: {
name: 'CURVE',
class: 'p5',
module: 'Constants'
},
STROKE: {
name: 'STROKE',
class: 'p5',
module: 'Constants'
},
FILL: {
name: 'FILL',
class: 'p5',
module: 'Constants'
},
TEXTURE: {
name: 'TEXTURE',
class: 'p5',
module: 'Constants'
},
IMMEDIATE: {
name: 'IMMEDIATE',
class: 'p5',
module: 'Constants'
},
IMAGE: {
name: 'IMAGE',
class: 'p5',
module: 'Constants'
},
NEAREST: {
name: 'NEAREST',
class: 'p5',
module: 'Constants'
},
REPEAT: {
name: 'REPEAT',
class: 'p5',
module: 'Constants'
},
CLAMP: {
name: 'CLAMP',
class: 'p5',
module: 'Constants'
},
MIRROR: {
name: 'MIRROR',
class: 'p5',
module: 'Constants'
},
LANDSCAPE: {
name: 'LANDSCAPE',
class: 'p5',
module: 'Constants'
},
PORTRAIT: {
name: 'PORTRAIT',
class: 'p5',
module: 'Constants'
},
GRID: {
name: 'GRID',
class: 'p5',
module: 'Constants'
},
AXES: {
name: 'AXES',
class: 'p5',
module: 'Constants'
},
LABEL: {
name: 'LABEL',
class: 'p5',
module: 'Constants'
},
FALLBACK: {
name: 'FALLBACK',
class: 'p5',
module: 'Constants'
},
print: {
name: 'print',
params: [
{
name: 'contents',
description:
'<p>any combination of Number, String, Object, Boolean,\n Array to print</p>\n',
type: 'Any'
}
],
class: 'p5',
module: 'Environment'
},
frameCount: {
name: 'frameCount',
class: 'p5',
module: 'Environment'
},
deltaTime: {
name: 'deltaTime',
class: 'p5',
module: 'Environment'
},
focused: {
name: 'focused',
class: 'p5',
module: 'Environment'
},
cursor: {
name: 'cursor',
params: [
{
name: 'type',
description:
"<p>Built-In: either ARROW, CROSS, HAND, MOVE, TEXT and WAIT\n Native CSS properties: 'grab', 'progress', 'cell' etc.\n External: path for cursor's images\n (Allowed File extensions: .cur, .gif, .jpg, .jpeg, .png)\n For more information on Native CSS cursors and url visit:\n <a href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/cursor\">https://developer.mozilla.org/en-US/docs/Web/CSS/cursor</a></p>\n",
type: 'String|Constant'
},
{
name: 'x',
description:
'<p>the horizontal active spot of the cursor (must be less than 32)</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description:
'<p>the vertical active spot of the cursor (must be less than 32)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
frameRate: {
name: 'frameRate',
class: 'p5',
module: 'Environment',
overloads: [
{
params: [
{
name: 'fps',
description:
'<p>number of frames to be displayed every second</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: []
}
]
},
noCursor: {
name: 'noCursor',
class: 'p5',
module: 'Environment'
},
displayWidth: {
name: 'displayWidth',
class: 'p5',
module: 'Environment'
},
displayHeight: {
name: 'displayHeight',
class: 'p5',
module: 'Environment'
},
windowWidth: {
name: 'windowWidth',
class: 'p5',
module: 'Environment'
},
windowHeight: {
name: 'windowHeight',
class: 'p5',
module: 'Environment'
},
windowResized: {
name: 'windowResized',
params: [
{
name: 'event',
description: '<p>optional Event callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
width: {
name: 'width',
class: 'p5',
module: 'Environment'
},
height: {
name: 'height',
class: 'p5',
module: 'Environment'
},
fullscreen: {
name: 'fullscreen',
params: [
{
name: 'val',
description:
'<p>whether the sketch should be in fullscreen mode\nor not</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Environment'
},
pixelDensity: {
name: 'pixelDensity',
class: 'p5',
module: 'Environment',
overloads: [
{
params: [
{
name: 'val',
description: '<p>whether or how much the sketch should scale</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: []
}
]
},
displayDensity: {
name: 'displayDensity',
class: 'p5',
module: 'Environment'
},
getURL: {
name: 'getURL',
class: 'p5',
module: 'Environment'
},
getURLPath: {
name: 'getURLPath',
class: 'p5',
module: 'Environment'
},
getURLParams: {
name: 'getURLParams',
class: 'p5',
module: 'Environment'
},
preload: {
name: 'preload',
class: 'p5',
module: 'Structure'
},
setup: {
name: 'setup',
class: 'p5',
module: 'Structure'
},
draw: {
name: 'draw',
class: 'p5',
module: 'Structure'
},
remove: {
name: 'remove',
class: 'p5',
module: 'Structure'
},
disableFriendlyErrors: {
name: 'disableFriendlyErrors',
class: 'p5',
module: 'Structure'
},
let: {
name: 'let',
class: 'p5',
module: 'Foundation'
},
const: {
name: 'const',
class: 'p5',
module: 'Foundation'
},
'===': {
name: '===',
class: 'p5',
module: 'Foundation'
},
'>': {
name: '>',
class: 'p5',
module: 'Foundation'
},
'>=': {
name: '>=',
class: 'p5',
module: 'Foundation'
},
'<': {
name: '<',
class: 'p5',
module: 'Foundation'
},
'<=': {
name: '<=',
class: 'p5',
module: 'Foundation'
},
'if-else': {
name: 'if-else',
class: 'p5',
module: 'Foundation'
},
function: {
name: 'function',
class: 'p5',
module: 'Foundation'
},
return: {
name: 'return',
class: 'p5',
module: 'Foundation'
},
boolean: {
name: 'boolean',
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String|Boolean|Number|Array'
}
],
class: 'p5',
module: 'Data'
},
string: {
name: 'string',
class: 'p5',
module: 'Foundation'
},
number: {
name: 'number',
class: 'p5',
module: 'Foundation'
},
object: {
name: 'object',
class: 'p5',
module: 'Foundation'
},
class: {
name: 'class',
class: 'p5',
module: 'Foundation'
},
for: {
name: 'for',
class: 'p5',
module: 'Foundation'
},
while: {
name: 'while',
class: 'p5',
module: 'Foundation'
},
createCanvas: {
name: 'createCanvas',
params: [
{
name: 'w',
description: '<p>width of the canvas</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height of the canvas</p>\n',
type: 'Number'
},
{
name: 'renderer',
description: '<p>either P2D or WEBGL</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Rendering'
},
resizeCanvas: {
name: 'resizeCanvas',
params: [
{
name: 'w',
description: '<p>width of the canvas</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height of the canvas</p>\n',
type: 'Number'
},
{
name: 'noRedraw',
description: "<p>don't redraw the canvas immediately</p>\n",
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Rendering'
},
noCanvas: {
name: 'noCanvas',
class: 'p5',
module: 'Rendering'
},
createGraphics: {
name: 'createGraphics',
params: [
{
name: 'w',
description: '<p>width of the offscreen graphics buffer</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height of the offscreen graphics buffer</p>\n',
type: 'Number'
},
{
name: 'renderer',
description:
'<p>either P2D or WEBGL\n undefined defaults to p2d</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Rendering'
},
blendMode: {
name: 'blendMode',
params: [
{
name: 'mode',
description:
'<p>blend mode to set for canvas.\n either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,\n EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD, REMOVE or SUBTRACT</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Rendering'
},
drawingContext: {
name: 'drawingContext',
class: 'p5',
module: 'Rendering'
},
noLoop: {
name: 'noLoop',
class: 'p5',
module: 'Structure'
},
loop: {
name: 'loop',
class: 'p5',
module: 'Structure'
},
isLooping: {
name: 'isLooping',
class: 'p5',
module: 'Structure'
},
push: {
name: 'push',
class: 'p5',
module: 'Structure'
},
pop: {
name: 'pop',
class: 'p5',
module: 'Structure'
},
redraw: {
name: 'redraw',
params: [
{
name: 'n',
description: '<p>Redraw for n-times. The default value is 1.</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Structure'
},
p5: {
name: 'p5',
params: [
{
name: 'sketch',
description: '<p>a function containing a p5.js sketch</p>\n',
type: 'Object'
},
{
name: 'node',
description:
'<p>ID or pointer to HTML DOM node to contain sketch in</p>\n',
type: 'String|Object'
}
],
class: 'p5',
module: 'Structure'
},
applyMatrix: {
name: 'applyMatrix',
params: [
{
name: 'a',
description:
'<p>numbers which define the 2x3 matrix to be multiplied, or an array of numbers</p>\n',
type: 'Number|Array'
},
{
name: 'b',
description:
'<p>numbers which define the 2x3 matrix to be multiplied</p>\n',
type: 'Number'
},
{
name: 'c',
description:
'<p>numbers which define the 2x3 matrix to be multiplied</p>\n',
type: 'Number'
},
{
name: 'd',
description:
'<p>numbers which define the 2x3 matrix to be multiplied</p>\n',
type: 'Number'
},
{
name: 'e',
description:
'<p>numbers which define the 2x3 matrix to be multiplied</p>\n',
type: 'Number'
},
{
name: 'f',
description:
'<p>numbers which define the 2x3 matrix to be multiplied</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
resetMatrix: {
name: 'resetMatrix',
class: 'p5',
module: 'Transform'
},
rotate: {
name: 'rotate',
params: [
{
name: 'angle',
description:
'<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n',
type: 'Number'
},
{
name: 'axis',
description: '<p>(in 3d) the axis to rotate around</p>\n',
type: 'p5.Vector|Number[]',
optional: true
}
],
class: 'p5',
module: 'Transform'
},
rotateX: {
name: 'rotateX',
params: [
{
name: 'angle',
description:
'<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
rotateY: {
name: 'rotateY',
params: [
{
name: 'angle',
description:
'<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
rotateZ: {
name: 'rotateZ',
params: [
{
name: 'angle',
description:
'<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
scale: {
name: 'scale',
class: 'p5',
module: 'Transform',
overloads: [
{
params: [
{
name: 's',
description:
'<p>percent to scale the object, or percentage to\n scale the object in the x-axis if multiple arguments\n are given</p>\n',
type: 'Number|p5.Vector|Number[]'
},
{
name: 'y',
description: '<p>percent to scale the object in the y-axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description:
'<p>percent to scale the object in the z-axis (webgl only)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'scales',
description: '<p>per-axis percents to scale the object</p>\n',
type: 'p5.Vector|Number[]'
}
],
chainable: 1
}
]
},
shearX: {
name: 'shearX',
params: [
{
name: 'angle',
description:
'<p>angle of shear specified in radians or degrees,\n depending on current angleMode</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
shearY: {
name: 'shearY',
params: [
{
name: 'angle',
description:
'<p>angle of shear specified in radians or degrees,\n depending on current angleMode</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Transform'
},
translate: {
name: 'translate',
class: 'p5',
module: 'Transform',
overloads: [
{
params: [
{
name: 'x',
description: '<p>left/right translation</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>up/down translation</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>forward/backward translation (webgl only)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'vector',
description: '<p>the vector to translate by</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
}
]
},
storeItem: {
name: 'storeItem',
params: [
{
name: 'key',
description: '',
type: 'String'
},
{
name: 'value',
description: '',
type: 'String|Number|Object|Boolean|p5.Color|p5.Vector'
}
],
class: 'p5',
module: 'Data'
},
getItem: {
name: 'getItem',
params: [
{
name: 'key',
description:
'<p>name that you wish to use to store in local storage</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
clearStorage: {
name: 'clearStorage',
class: 'p5',
module: 'Data'
},
removeItem: {
name: 'removeItem',
params: [
{
name: 'key',
description: '',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
createStringDict: {
name: 'createStringDict',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'key',
description: '',
type: 'String'
},
{
name: 'value',
description: '',
type: 'String'
}
]
},
{
params: [
{
name: 'object',
description: '<p>object</p>\n',
type: 'Object'
}
]
}
]
},
createNumberDict: {
name: 'createNumberDict',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'key',
description: '',
type: 'Number'
},
{
name: 'value',
description: '',
type: 'Number'
}
]
},
{
params: [
{
name: 'object',
description: '<p>object</p>\n',
type: 'Object'
}
]
}
]
},
select: {
name: 'select',
params: [
{
name: 'selectors',
description: '<p>CSS selector string of element to search for</p>\n',
type: 'String'
},
{
name: 'container',
description:
'<p>CSS selector string, <a href="#/p5.Element">p5.Element</a>, or\n HTML element to search within</p>\n',
type: 'String|p5.Element|HTMLElement',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
selectAll: {
name: 'selectAll',
params: [
{
name: 'selectors',
description: '<p>CSS selector string of elements to search for</p>\n',
type: 'String'
},
{
name: 'container',
description:
'<p>CSS selector string, <a href="#/p5.Element">p5.Element</a>\n , or HTML element to search within</p>\n',
type: 'String|p5.Element|HTMLElement',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
removeElements: {
name: 'removeElements',
class: 'p5',
module: 'DOM'
},
changed: {
name: 'changed',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when the value of\n an element changes.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5',
module: 'DOM'
},
input: {
name: 'input',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when any user input is\n detected within the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5',
module: 'DOM'
},
createDiv: {
name: 'createDiv',
params: [
{
name: 'html',
description: '<p>inner HTML for element created</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createP: {
name: 'createP',
params: [
{
name: 'html',
description: '<p>inner HTML for element created</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createSpan: {
name: 'createSpan',
params: [
{
name: 'html',
description: '<p>inner HTML for element created</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createImg: {
name: 'createImg',
class: 'p5',
module: 'DOM',
overloads: [
{
params: [
{
name: 'src',
description: '<p>src path or url for image</p>\n',
type: 'String'
},
{
name: 'alt',
description:
'<p><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#Attributes">alternate text</a> to be used if image does not load. You can use also an empty string (<code>""</code>) if that an image is not intended to be viewed.</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'src',
description: '',
type: 'String'
},
{
name: 'alt',
description: '',
type: 'String'
},
{
name: 'crossOrigin',
description:
'<p><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes">crossOrigin property</a> of the <code>img</code> element; use either \'anonymous\' or \'use-credentials\' to retrieve the image with cross-origin access (for later use with <code>canvas</code>. if an empty string(<code>""</code>) is passed, CORS is not used</p>\n',
type: 'String'
},
{
name: 'successCallback',
description:
'<p>callback to be called once image data is loaded with the <a href="#/p5.Element">p5.Element</a> as argument</p>\n',
type: 'Function',
optional: true
}
]
}
]
},
createA: {
name: 'createA',
params: [
{
name: 'href',
description: '<p>url of page to link to</p>\n',
type: 'String'
},
{
name: 'html',
description: '<p>inner html of link element to display</p>\n',
type: 'String'
},
{
name: 'target',
description:
'<p>target where new link should open,\n could be _blank, _self, _parent, _top.</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createSlider: {
name: 'createSlider',
params: [
{
name: 'min',
description: '<p>minimum value of the slider</p>\n',
type: 'Number'
},
{
name: 'max',
description: '<p>maximum value of the slider</p>\n',
type: 'Number'
},
{
name: 'value',
description: '<p>default value of the slider</p>\n',
type: 'Number',
optional: true
},
{
name: 'step',
description:
'<p>step size for each tick of the slider (if step is set to 0, the slider will move continuously from the minimum to the maximum value)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createButton: {
name: 'createButton',
params: [
{
name: 'label',
description: '<p>label displayed on the button</p>\n',
type: 'String'
},
{
name: 'value',
description: '<p>value of the button</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createCheckbox: {
name: 'createCheckbox',
params: [
{
name: 'label',
description: '<p>label displayed after checkbox</p>\n',
type: 'String',
optional: true
},
{
name: 'value',
description:
'<p>value of the checkbox; checked is true, unchecked is false</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createSelect: {
name: 'createSelect',
class: 'p5',
module: 'DOM',
overloads: [
{
params: [
{
name: 'multiple',
description:
'<p>true if dropdown should support multiple selections</p>\n',
type: 'Boolean',
optional: true
}
]
},
{
params: [
{
name: 'existing',
description: '<p>DOM select element</p>\n',
type: 'Object'
}
]
}
]
},
createRadio: {
name: 'createRadio',
class: 'p5',
module: 'DOM',
overloads: [
{
params: [
{
name: 'containerElement',
description:
'<p>An container HTML Element either a div\nor span inside which all existing radio inputs will be considered as options.</p>\n',
type: 'Object'
},
{
name: 'name',
description: '<p>A name parameter for each Input Element.</p>\n',
type: 'String',
optional: true
}
]
},
{
params: [
{
name: 'name',
description: '',
type: 'String'
}
]
},
{
params: []
}
]
},
createColorPicker: {
name: 'createColorPicker',
params: [
{
name: 'value',
description: '<p>default color of element</p>\n',
type: 'String|p5.Color',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createInput: {
name: 'createInput',
class: 'p5',
module: 'DOM',
overloads: [
{
params: [
{
name: 'value',
description: '<p>default value of the input box</p>\n',
type: 'String'
},
{
name: 'type',
description:
'<p>type of text, ie text, password etc. Defaults to text.\n Needs a value to be specified first.</p>\n',
type: 'String',
optional: true
}
]
},
{
params: [
{
name: 'value',
description: '',
type: 'String',
optional: true
}
]
}
]
},
createFileInput: {
name: 'createFileInput',
params: [
{
name: 'callback',
description: '<p>callback function for when a file is loaded</p>\n',
type: 'Function'
},
{
name: 'multiple',
description:
'<p>optional, to allow multiple files to be selected</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createVideo: {
name: 'createVideo',
params: [
{
name: 'src',
description:
'<p>path to a video file, or array of paths for\n supporting different browsers</p>\n',
type: 'String|String[]'
},
{
name: 'callback',
description:
"<p>callback function to be called upon\n 'canplaythrough' event fire, that is, when the\n browser can play the media, and estimates that\n enough data has been loaded to play the media\n up to its end without having to stop for\n further buffering of content</p>\n",
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createAudio: {
name: 'createAudio',
params: [
{
name: 'src',
description:
'<p>path to an audio file, or array of paths\n for supporting different browsers</p>\n',
type: 'String|String[]',
optional: true
},
{
name: 'callback',
description:
"<p>callback function to be called upon\n 'canplaythrough' event fire, that is, when the\n browser can play the media, and estimates that\n enough data has been loaded to play the media\n up to its end without having to stop for\n further buffering of content</p>\n",
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
VIDEO: {
name: 'VIDEO',
class: 'p5',
module: 'DOM'
},
AUDIO: {
name: 'AUDIO',
class: 'p5',
module: 'DOM'
},
createCapture: {
name: 'createCapture',
params: [
{
name: 'type',
description:
'<p>type of capture, either VIDEO or\n AUDIO if none specified, default both,\n or a Constraints object</p>\n',
type: 'String|Constant|Object'
},
{
name: 'callback',
description:
'<p>function to be called once\n stream has loaded</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
createElement: {
name: 'createElement',
params: [
{
name: 'tag',
description: '<p>tag for the new element</p>\n',
type: 'String'
},
{
name: 'content',
description: '<p>html content to be inserted into the element</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'DOM'
},
deviceOrientation: {
name: 'deviceOrientation',
class: 'p5',
module: 'Events'
},
accelerationX: {
name: 'accelerationX',
class: 'p5',
module: 'Events'
},
accelerationY: {
name: 'accelerationY',
class: 'p5',
module: 'Events'
},
accelerationZ: {
name: 'accelerationZ',
class: 'p5',
module: 'Events'
},
pAccelerationX: {
name: 'pAccelerationX',
class: 'p5',
module: 'Events'
},
pAccelerationY: {
name: 'pAccelerationY',
class: 'p5',
module: 'Events'
},
pAccelerationZ: {
name: 'pAccelerationZ',
class: 'p5',
module: 'Events'
},
rotationX: {
name: 'rotationX',
class: 'p5',
module: 'Events'
},
rotationY: {
name: 'rotationY',
class: 'p5',
module: 'Events'
},
rotationZ: {
name: 'rotationZ',
class: 'p5',
module: 'Events'
},
pRotationX: {
name: 'pRotationX',
class: 'p5',
module: 'Events'
},
pRotationY: {
name: 'pRotationY',
class: 'p5',
module: 'Events'
},
pRotationZ: {
name: 'pRotationZ',
class: 'p5',
module: 'Events'
},
turnAxis: {
name: 'turnAxis',
class: 'p5',
module: 'Events'
},
setMoveThreshold: {
name: 'setMoveThreshold',
params: [
{
name: 'value',
description: '<p>The threshold value</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Events'
},
setShakeThreshold: {
name: 'setShakeThreshold',
params: [
{
name: 'value',
description: '<p>The threshold value</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Events'
},
deviceMoved: {
name: 'deviceMoved',
class: 'p5',
module: 'Events'
},
deviceTurned: {
name: 'deviceTurned',
class: 'p5',
module: 'Events'
},
deviceShaken: {
name: 'deviceShaken',
class: 'p5',
module: 'Events'
},
keyIsPressed: {
name: 'keyIsPressed',
class: 'p5',
module: 'Events'
},
key: {
name: 'key',
class: 'p5',
module: 'Events'
},
keyCode: {
name: 'keyCode',
class: 'p5',
module: 'Events'
},
keyPressed: {
name: 'keyPressed',
params: [
{
name: 'event',
description: '<p>optional KeyboardEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
keyReleased: {
name: 'keyReleased',
params: [
{
name: 'event',
description: '<p>optional KeyboardEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
keyTyped: {
name: 'keyTyped',
params: [
{
name: 'event',
description: '<p>optional KeyboardEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
keyIsDown: {
name: 'keyIsDown',
params: [
{
name: 'code',
description: '<p>The key to check for.</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Events'
},
movedX: {
name: 'movedX',
class: 'p5',
module: 'Events'
},
movedY: {
name: 'movedY',
class: 'p5',
module: 'Events'
},
mouseX: {
name: 'mouseX',
class: 'p5',
module: 'Events'
},
mouseY: {
name: 'mouseY',
class: 'p5',
module: 'Events'
},
pmouseX: {
name: 'pmouseX',
class: 'p5',
module: 'Events'
},
pmouseY: {
name: 'pmouseY',
class: 'p5',
module: 'Events'
},
winMouseX: {
name: 'winMouseX',
class: 'p5',
module: 'Events'
},
winMouseY: {
name: 'winMouseY',
class: 'p5',
module: 'Events'
},
pwinMouseX: {
name: 'pwinMouseX',
class: 'p5',
module: 'Events'
},
pwinMouseY: {
name: 'pwinMouseY',
class: 'p5',
module: 'Events'
},
mouseButton: {
name: 'mouseButton',
class: 'p5',
module: 'Events'
},
mouseIsPressed: {
name: 'mouseIsPressed',
class: 'p5',
module: 'Events'
},
mouseMoved: {
name: 'mouseMoved',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
mouseDragged: {
name: 'mouseDragged',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
mousePressed: {
name: 'mousePressed',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
mouseReleased: {
name: 'mouseReleased',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
mouseClicked: {
name: 'mouseClicked',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
doubleClicked: {
name: 'doubleClicked',
params: [
{
name: 'event',
description: '<p>optional MouseEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
mouseWheel: {
name: 'mouseWheel',
params: [
{
name: 'event',
description: '<p>optional WheelEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
requestPointerLock: {
name: 'requestPointerLock',
class: 'p5',
module: 'Events'
},
exitPointerLock: {
name: 'exitPointerLock',
class: 'p5',
module: 'Events'
},
touches: {
name: 'touches',
class: 'p5',
module: 'Events'
},
touchStarted: {
name: 'touchStarted',
params: [
{
name: 'event',
description: '<p>optional TouchEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
touchMoved: {
name: 'touchMoved',
params: [
{
name: 'event',
description: '<p>optional TouchEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
touchEnded: {
name: 'touchEnded',
params: [
{
name: 'event',
description: '<p>optional TouchEvent callback argument.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5',
module: 'Events'
},
createImage: {
name: 'createImage',
params: [
{
name: 'width',
description: '<p>width in pixels</p>\n',
type: 'Integer'
},
{
name: 'height',
description: '<p>height in pixels</p>\n',
type: 'Integer'
}
],
class: 'p5',
module: 'Image'
},
saveCanvas: {
name: 'saveCanvas',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'selectedCanvas',
description:
'<p>a variable\n representing a specific html5 canvas (optional)</p>\n',
type: 'p5.Element|HTMLCanvasElement'
},
{
name: 'filename',
description: '',
type: 'String',
optional: true
},
{
name: 'extension',
description: "<p>'jpg' or 'png'</p>\n",
type: 'String',
optional: true
}
]
},
{
params: [
{
name: 'filename',
description: '',
type: 'String',
optional: true
},
{
name: 'extension',
description: '',
type: 'String',
optional: true
}
]
}
]
},
saveFrames: {
name: 'saveFrames',
params: [
{
name: 'filename',
description: '',
type: 'String'
},
{
name: 'extension',
description: "<p>'jpg' or 'png'</p>\n",
type: 'String'
},
{
name: 'duration',
description: '<p>Duration in seconds to save the frames for.</p>\n',
type: 'Number'
},
{
name: 'framerate',
description: '<p>Framerate to save the frames in.</p>\n',
type: 'Number'
},
{
name: 'callback',
description:
'<p>A callback function that will be executed\n to handle the image data. This function\n should accept an array as argument. The\n array will contain the specified number of\n frames of objects. Each object has three\n properties: imageData - an\n image/octet-stream, filename and extension.</p>\n',
type: 'Function(Array)',
optional: true
}
],
class: 'p5',
module: 'Image'
},
loadImage: {
name: 'loadImage',
params: [
{
name: 'path',
description: '<p>Path of the image to be loaded</p>\n',
type: 'String'
},
{
name: 'successCallback',
description:
'<p>Function to be called once\n the image is loaded. Will be passed the\n <a href="#/p5.Image">p5.Image</a>.</p>\n',
type: 'function(p5.Image)',
optional: true
},
{
name: 'failureCallback',
description:
'<p>called with event error if\n the image fails to load.</p>\n',
type: 'Function(Event)',
optional: true
}
],
class: 'p5',
module: 'Image'
},
image: {
name: 'image',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'img',
description: '<p>the image to display</p>\n',
type: 'p5.Image|p5.Element'
},
{
name: 'x',
description:
'<p>the x-coordinate of the top-left corner of the image</p>\n',
type: 'Number'
},
{
name: 'y',
description:
'<p>the y-coordinate of the top-left corner of the image</p>\n',
type: 'Number'
},
{
name: 'width',
description: '<p>the width to draw the image</p>\n',
type: 'Number',
optional: true
},
{
name: 'height',
description: '<p>the height to draw the image</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'img',
description: '',
type: 'p5.Image|p5.Element'
},
{
name: 'dx',
description:
'<p>the x-coordinate of the destination\n rectangle in which to draw the source image</p>\n',
type: 'Number'
},
{
name: 'dy',
description:
'<p>the y-coordinate of the destination\n rectangle in which to draw the source image</p>\n',
type: 'Number'
},
{
name: 'dWidth',
description: '<p>the width of the destination rectangle</p>\n',
type: 'Number'
},
{
name: 'dHeight',
description: '<p>the height of the destination rectangle</p>\n',
type: 'Number'
},
{
name: 'sx',
description:
'<p>the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n',
type: 'Number'
},
{
name: 'sy',
description:
'<p>the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n',
type: 'Number'
},
{
name: 'sWidth',
description:
'<p>the width of the subsection of the\n source image to draw into the destination\n rectangle</p>\n',
type: 'Number',
optional: true
},
{
name: 'sHeight',
description:
'<p>the height of the subsection of the\n source image to draw into the destination rectangle</p>\n',
type: 'Number',
optional: true
}
]
}
]
},
tint: {
name: 'tint',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'gray',
description: '<p>a gray value</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
]
},
{
params: [
{
name: 'color',
description: '<p>the tint color</p>\n',
type: 'p5.Color'
}
]
}
]
},
noTint: {
name: 'noTint',
class: 'p5',
module: 'Image'
},
imageMode: {
name: 'imageMode',
params: [
{
name: 'mode',
description: '<p>either CORNER, CORNERS, or CENTER</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Image'
},
pixels: {
name: 'pixels',
class: 'p5',
module: 'Image'
},
blend: {
name: 'blend',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'srcImage',
description: '<p>source image</p>\n',
type: 'p5.Image'
},
{
name: 'sx',
description:
"<p>X coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sy',
description:
"<p>Y coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sw',
description: '<p>source image width</p>\n',
type: 'Integer'
},
{
name: 'sh',
description: '<p>source image height</p>\n',
type: 'Integer'
},
{
name: 'dx',
description:
"<p>X coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dy',
description:
"<p>Y coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dw',
description: '<p>destination image width</p>\n',
type: 'Integer'
},
{
name: 'dh',
description: '<p>destination image height</p>\n',
type: 'Integer'
},
{
name: 'blendMode',
description:
'<p>the blend mode. either\n BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.</p>\n',
type: 'Constant'
}
]
},
{
params: [
{
name: 'sx',
description: '',
type: 'Integer'
},
{
name: 'sy',
description: '',
type: 'Integer'
},
{
name: 'sw',
description: '',
type: 'Integer'
},
{
name: 'sh',
description: '',
type: 'Integer'
},
{
name: 'dx',
description: '',
type: 'Integer'
},
{
name: 'dy',
description: '',
type: 'Integer'
},
{
name: 'dw',
description: '',
type: 'Integer'
},
{
name: 'dh',
description: '',
type: 'Integer'
},
{
name: 'blendMode',
description: '',
type: 'Constant'
}
]
}
]
},
copy: {
name: 'copy',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'srcImage',
description: '<p>source image</p>\n',
type: 'p5.Image|p5.Element'
},
{
name: 'sx',
description:
"<p>X coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sy',
description:
"<p>Y coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sw',
description: '<p>source image width</p>\n',
type: 'Integer'
},
{
name: 'sh',
description: '<p>source image height</p>\n',
type: 'Integer'
},
{
name: 'dx',
description:
"<p>X coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dy',
description:
"<p>Y coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dw',
description: '<p>destination image width</p>\n',
type: 'Integer'
},
{
name: 'dh',
description: '<p>destination image height</p>\n',
type: 'Integer'
}
]
},
{
params: [
{
name: 'sx',
description: '',
type: 'Integer'
},
{
name: 'sy',
description: '',
type: 'Integer'
},
{
name: 'sw',
description: '',
type: 'Integer'
},
{
name: 'sh',
description: '',
type: 'Integer'
},
{
name: 'dx',
description: '',
type: 'Integer'
},
{
name: 'dy',
description: '',
type: 'Integer'
},
{
name: 'dw',
description: '',
type: 'Integer'
},
{
name: 'dh',
description: '',
type: 'Integer'
}
]
}
]
},
filter: {
name: 'filter',
params: [
{
name: 'filterType',
description:
'<p>either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, BLUR, ERODE, DILATE or BLUR.\n See Filters.js for docs on\n each available filter</p>\n',
type: 'Constant'
},
{
name: 'filterParam',
description:
'<p>an optional parameter unique\n to each filter, see above</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Image'
},
get: {
name: 'get',
class: 'p5',
module: 'Image',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'w',
description: '<p>width</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height</p>\n',
type: 'Number'
}
]
},
{
params: []
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
}
]
}
]
},
loadPixels: {
name: 'loadPixels',
class: 'p5',
module: 'Image'
},
set: {
name: 'set',
params: [
{
name: 'x',
description: '<p>x-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'c',
description:
'<p>insert a grayscale value | a pixel array |\n a <a href="#/p5.Color">p5.Color</a> object | a <a href="#/p5.Image">p5.Image</a> to copy</p>\n',
type: 'Number|Number[]|Object'
}
],
class: 'p5',
module: 'Image'
},
updatePixels: {
name: 'updatePixels',
params: [
{
name: 'x',
description:
'<p>x-coordinate of the upper-left corner of region\n to update</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description:
'<p>y-coordinate of the upper-left corner of region\n to update</p>\n',
type: 'Number',
optional: true
},
{
name: 'w',
description: '<p>width of region to update</p>\n',
type: 'Number',
optional: true
},
{
name: 'h',
description: '<p>height of region to update</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Image'
},
loadJSON: {
name: 'loadJSON',
class: 'p5',
module: 'IO',
overloads: [
{
params: [
{
name: 'path',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'jsonpOptions',
description: '<p>options object for jsonp related settings</p>\n',
type: 'Object',
optional: true
},
{
name: 'datatype',
description: '<p>"json" or "jsonp"</p>\n',
type: 'String',
optional: true
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/loadJSON">loadJSON()</a> completes, data is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'datatype',
description: '',
type: 'String'
},
{
name: 'callback',
description: '',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'callback',
description: '',
type: 'Function'
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
}
]
},
loadStrings: {
name: 'loadStrings',
params: [
{
name: 'filename',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>function to be executed after <a href="#/p5/loadStrings">loadStrings()</a>\n completes, Array is passed in as first\n argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'IO'
},
loadTable: {
name: 'loadTable',
params: [
{
name: 'filename',
description: '<p>name of the file or URL to load</p>\n',
type: 'String'
},
{
name: 'extension',
description:
'<p>parse the table by comma-separated values "csv", semicolon-separated\n values "ssv", or tab-separated values "tsv"</p>\n',
type: 'String',
optional: true
},
{
name: 'header',
description: '<p>"header" to indicate table has header row</p>\n',
type: 'String',
optional: true
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/loadTable">loadTable()</a> completes. On success, the\n <a href="#/p5.Table">Table</a> object is passed in as the\n first argument.</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'IO'
},
loadXML: {
name: 'loadXML',
params: [
{
name: 'filename',
description: '<p>name of the file or URL to load</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>function to be executed after <a href="#/p5/loadXML">loadXML()</a>\n completes, XML object is passed in as\n first argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'IO'
},
loadBytes: {
name: 'loadBytes',
params: [
{
name: 'file',
description: '<p>name of the file or URL to load</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>function to be executed after <a href="#/p5/loadBytes">loadBytes()</a>\n completes</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if there\n is an error</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'IO'
},
httpGet: {
name: 'httpGet',
class: 'p5',
module: 'IO',
overloads: [
{
params: [
{
name: 'path',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'datatype',
description:
'<p>"json", "jsonp", "binary", "arrayBuffer",\n "xml", or "text"</p>\n',
type: 'String',
optional: true
},
{
name: 'data',
description: '<p>param data passed sent with request</p>\n',
type: 'Object|Boolean',
optional: true
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/httpGet">httpGet()</a> completes, data is passed in\n as first argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'data',
description: '',
type: 'Object|Boolean'
},
{
name: 'callback',
description: '',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'callback',
description: '',
type: 'Function'
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
}
]
},
httpPost: {
name: 'httpPost',
class: 'p5',
module: 'IO',
overloads: [
{
params: [
{
name: 'path',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'datatype',
description:
'<p>"json", "jsonp", "xml", or "text".\n If omitted, <a href="#/p5/httpPost">httpPost()</a> will guess.</p>\n',
type: 'String',
optional: true
},
{
name: 'data',
description: '<p>param data passed sent with request</p>\n',
type: 'Object|Boolean',
optional: true
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/httpPost">httpPost()</a> completes, data is passed in\n as first argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'data',
description: '',
type: 'Object|Boolean'
},
{
name: 'callback',
description: '',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'callback',
description: '',
type: 'Function'
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
}
]
},
httpDo: {
name: 'httpDo',
class: 'p5',
module: 'IO',
overloads: [
{
params: [
{
name: 'path',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'method',
description:
'<p>either "GET", "POST", or "PUT",\n defaults to "GET"</p>\n',
type: 'String',
optional: true
},
{
name: 'datatype',
description: '<p>"json", "jsonp", "xml", or "text"</p>\n',
type: 'String',
optional: true
},
{
name: 'data',
description: '<p>param data passed sent with request</p>\n',
type: 'Object',
optional: true
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/httpGet">httpGet()</a> completes, data is passed in\n as first argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n',
type: 'Function',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'options',
description:
'<p>Request object options as documented in the\n "fetch" API\n<a href="https://developer.mozilla.org/en/docs/Web/API/Fetch_API">reference</a></p>\n',
type: 'Object'
},
{
name: 'callback',
description: '',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description: '',
type: 'Function',
optional: true
}
]
}
]
},
createWriter: {
name: 'createWriter',
params: [
{
name: 'name',
description: '<p>name of the file to be created</p>\n',
type: 'String'
},
{
name: 'extension',
description: '',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'IO'
},
save: {
name: 'save',
params: [
{
name: 'objectOrFilename',
description:
'<p>If filename is provided, will\n save canvas as an image with\n either png or jpg extension\n depending on the filename.\n If object is provided, will\n save depending on the object\n and filename (see examples\n above).</p>\n',
type: 'Object|String',
optional: true
},
{
name: 'filename',
description:
'<p>If an object is provided as the first\n parameter, then the second parameter\n indicates the filename,\n and should include an appropriate\n file extension (see examples above).</p>\n',
type: 'String',
optional: true
},
{
name: 'options',
description:
'<p>Additional options depend on\n filetype. For example, when saving JSON,\n <code>true</code> indicates that the\n output will be optimized for filesize,\n rather than readability.</p>\n',
type: 'Boolean|String',
optional: true
}
],
class: 'p5',
module: 'IO'
},
saveJSON: {
name: 'saveJSON',
params: [
{
name: 'json',
description: '',
type: 'Array|Object'
},
{
name: 'filename',
description: '',
type: 'String'
},
{
name: 'optimize',
description:
'<p>If true, removes line breaks\n and spaces from the output\n file to optimize filesize\n (but not readability).</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'IO'
},
saveStrings: {
name: 'saveStrings',
params: [
{
name: 'list',
description: '<p>string array to be written</p>\n',
type: 'String[]'
},
{
name: 'filename',
description: '<p>filename for output</p>\n',
type: 'String'
},
{
name: 'extension',
description: "<p>the filename's extension</p>\n",
type: 'String',
optional: true
},
{
name: 'isCRLF',
description: '<p>if true, change line-break to CRLF</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'IO'
},
saveTable: {
name: 'saveTable',
params: [
{
name: 'Table',
description:
'<p>the <a href="#/p5.Table">Table</a> object to save to a file</p>\n',
type: 'p5.Table'
},
{
name: 'filename',
description: '<p>the filename to which the Table should be saved</p>\n',
type: 'String'
},
{
name: 'options',
description: '<p>can be one of "tsv", "csv", or "html"</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'IO'
},
abs: {
name: 'abs',
params: [
{
name: 'n',
description: '<p>number to compute</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
ceil: {
name: 'ceil',
params: [
{
name: 'n',
description: '<p>number to round up</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
constrain: {
name: 'constrain',
params: [
{
name: 'n',
description: '<p>number to constrain</p>\n',
type: 'Number'
},
{
name: 'low',
description: '<p>minimum limit</p>\n',
type: 'Number'
},
{
name: 'high',
description: '<p>maximum limit</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
dist: {
name: 'dist',
class: 'p5',
module: 'Math',
overloads: [
{
params: [
{
name: 'x1',
description: '<p>x-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'y1',
description: '<p>y-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '<p>x-coordinate of the second point</p>\n',
type: 'Number'
},
{
name: 'y2',
description: '<p>y-coordinate of the second point</p>\n',
type: 'Number'
}
]
},
{
params: [
{
name: 'x1',
description: '',
type: 'Number'
},
{
name: 'y1',
description: '',
type: 'Number'
},
{
name: 'z1',
description: '<p>z-coordinate of the first point</p>\n',
type: 'Number'
},
{
name: 'x2',
description: '',
type: 'Number'
},
{
name: 'y2',
description: '',
type: 'Number'
},
{
name: 'z2',
description: '<p>z-coordinate of the second point</p>\n',
type: 'Number'
}
]
}
]
},
exp: {
name: 'exp',
params: [
{
name: 'n',
description: '<p>exponent to raise</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
floor: {
name: 'floor',
params: [
{
name: 'n',
description: '<p>number to round down</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
lerp: {
name: 'lerp',
params: [
{
name: 'start',
description: '<p>first value</p>\n',
type: 'Number'
},
{
name: 'stop',
description: '<p>second value</p>\n',
type: 'Number'
},
{
name: 'amt',
description: '<p>number</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
log: {
name: 'log',
params: [
{
name: 'n',
description: '<p>number greater than 0</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
mag: {
name: 'mag',
params: [
{
name: 'a',
description: '<p>first value</p>\n',
type: 'Number'
},
{
name: 'b',
description: '<p>second value</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
map: {
name: 'map',
params: [
{
name: 'value',
description: '<p>the incoming value to be converted</p>\n',
type: 'Number'
},
{
name: 'start1',
description: "<p>lower bound of the value's current range</p>\n",
type: 'Number'
},
{
name: 'stop1',
description: "<p>upper bound of the value's current range</p>\n",
type: 'Number'
},
{
name: 'start2',
description: "<p>lower bound of the value's target range</p>\n",
type: 'Number'
},
{
name: 'stop2',
description: "<p>upper bound of the value's target range</p>\n",
type: 'Number'
},
{
name: 'withinBounds',
description: '<p>constrain the value to the newly mapped range</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Math'
},
max: {
name: 'max',
class: 'p5',
module: 'Math',
overloads: [
{
params: [
{
name: 'n0',
description: '<p>Number to compare</p>\n',
type: 'Number'
},
{
name: 'n1',
description: '<p>Number to compare</p>\n',
type: 'Number'
}
]
},
{
params: [
{
name: 'nums',
description: '<p>Numbers to compare</p>\n',
type: 'Number[]'
}
]
}
]
},
min: {
name: 'min',
class: 'p5',
module: 'Math',
overloads: [
{
params: [
{
name: 'n0',
description: '<p>Number to compare</p>\n',
type: 'Number'
},
{
name: 'n1',
description: '<p>Number to compare</p>\n',
type: 'Number'
}
]
},
{
params: [
{
name: 'nums',
description: '<p>Numbers to compare</p>\n',
type: 'Number[]'
}
]
}
]
},
norm: {
name: 'norm',
params: [
{
name: 'value',
description: '<p>incoming value to be normalized</p>\n',
type: 'Number'
},
{
name: 'start',
description: "<p>lower bound of the value's current range</p>\n",
type: 'Number'
},
{
name: 'stop',
description: "<p>upper bound of the value's current range</p>\n",
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
pow: {
name: 'pow',
params: [
{
name: 'n',
description: '<p>base of the exponential expression</p>\n',
type: 'Number'
},
{
name: 'e',
description: '<p>power by which to raise the base</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
round: {
name: 'round',
params: [
{
name: 'n',
description: '<p>number to round</p>\n',
type: 'Number'
},
{
name: 'decimals',
description:
'<p>number of decimal places to round to, default is 0</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Math'
},
sq: {
name: 'sq',
params: [
{
name: 'n',
description: '<p>number to square</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
sqrt: {
name: 'sqrt',
params: [
{
name: 'n',
description: '<p>non-negative number to square root</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
fract: {
name: 'fract',
params: [
{
name: 'num',
description:
'<p>Number whose fractional part needs to be found out</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
createVector: {
name: 'createVector',
params: [
{
name: 'x',
description: '<p>x component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description: '<p>y component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>z component of the vector</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Math'
},
noise: {
name: 'noise',
params: [
{
name: 'x',
description: '<p>x-coordinate in noise space</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate in noise space</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>z-coordinate in noise space</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Math'
},
noiseDetail: {
name: 'noiseDetail',
params: [
{
name: 'lod',
description: '<p>number of octaves to be used by the noise</p>\n',
type: 'Number'
},
{
name: 'falloff',
description: '<p>falloff factor for each octave</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
noiseSeed: {
name: 'noiseSeed',
params: [
{
name: 'seed',
description: '<p>the seed value</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
randomSeed: {
name: 'randomSeed',
params: [
{
name: 'seed',
description: '<p>the seed value</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
random: {
name: 'random',
class: 'p5',
module: 'Math',
overloads: [
{
params: [
{
name: 'min',
description: '<p>the lower bound (inclusive)</p>\n',
type: 'Number',
optional: true
},
{
name: 'max',
description: '<p>the upper bound (exclusive)</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'choices',
description: '<p>the array to choose from</p>\n',
type: 'Array'
}
]
}
]
},
randomGaussian: {
name: 'randomGaussian',
params: [
{
name: 'mean',
description: '<p>the mean</p>\n',
type: 'Number',
optional: true
},
{
name: 'sd',
description: '<p>the standard deviation</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Math'
},
acos: {
name: 'acos',
params: [
{
name: 'value',
description: '<p>the value whose arc cosine is to be returned</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
asin: {
name: 'asin',
params: [
{
name: 'value',
description: '<p>the value whose arc sine is to be returned</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
atan: {
name: 'atan',
params: [
{
name: 'value',
description: '<p>the value whose arc tangent is to be returned</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
atan2: {
name: 'atan2',
params: [
{
name: 'y',
description: '<p>y-coordinate of the point</p>\n',
type: 'Number'
},
{
name: 'x',
description: '<p>x-coordinate of the point</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
cos: {
name: 'cos',
params: [
{
name: 'angle',
description: '<p>the angle</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
sin: {
name: 'sin',
params: [
{
name: 'angle',
description: '<p>the angle</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
tan: {
name: 'tan',
params: [
{
name: 'angle',
description: '<p>the angle</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
degrees: {
name: 'degrees',
params: [
{
name: 'radians',
description: '<p>the radians value to convert to degrees</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
radians: {
name: 'radians',
params: [
{
name: 'degrees',
description: '<p>the degree value to convert to radians</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Math'
},
angleMode: {
name: 'angleMode',
params: [
{
name: 'mode',
description: '<p>either RADIANS or DEGREES</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Math'
},
textAlign: {
name: 'textAlign',
class: 'p5',
module: 'Typography',
overloads: [
{
params: [
{
name: 'horizAlign',
description:
'<p>horizontal alignment, either LEFT,\n CENTER, or RIGHT</p>\n',
type: 'Constant'
},
{
name: 'vertAlign',
description:
'<p>vertical alignment, either TOP,\n BOTTOM, CENTER, or BASELINE</p>\n',
type: 'Constant',
optional: true
}
],
chainable: 1
},
{
params: []
}
]
},
textLeading: {
name: 'textLeading',
class: 'p5',
module: 'Typography',
overloads: [
{
params: [
{
name: 'leading',
description:
'<p>the size in pixels for spacing between lines</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: []
}
]
},
textSize: {
name: 'textSize',
class: 'p5',
module: 'Typography',
overloads: [
{
params: [
{
name: 'theSize',
description: '<p>the size of the letters in units of pixels</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: []
}
]
},
textStyle: {
name: 'textStyle',
class: 'p5',
module: 'Typography',
overloads: [
{
params: [
{
name: 'theStyle',
description:
'<p>styling for text, either NORMAL,\n ITALIC, BOLD or BOLDITALIC</p>\n',
type: 'Constant'
}
],
chainable: 1
},
{
params: []
}
]
},
textWidth: {
name: 'textWidth',
params: [
{
name: 'theText',
description: '<p>the String of characters to measure</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Typography'
},
textAscent: {
name: 'textAscent',
class: 'p5',
module: 'Typography'
},
textDescent: {
name: 'textDescent',
class: 'p5',
module: 'Typography'
},
textWrap: {
name: 'textWrap',
params: [
{
name: 'wrapStyle',
description: '<p>text wrapping style, either WORD or CHAR</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Typography'
},
loadFont: {
name: 'loadFont',
params: [
{
name: 'path',
description: '<p>name of the file or url to load</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>function to be executed after\n <a href="#/p5/loadFont">loadFont()</a> completes</p>\n',
type: 'Function',
optional: true
},
{
name: 'onError',
description:
'<p>function to be executed if\n an error occurs</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'Typography'
},
text: {
name: 'text',
params: [
{
name: 'str',
description:
'<p>the alphanumeric\n symbols to be displayed</p>\n',
type: 'String|Object|Array|Number|Boolean'
},
{
name: 'x',
description: '<p>x-coordinate of text</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of text</p>\n',
type: 'Number'
},
{
name: 'x2',
description:
'<p>by default, the width of the text box,\n see <a href="#/p5/rectMode">rectMode()</a> for more info</p>\n',
type: 'Number',
optional: true
},
{
name: 'y2',
description:
'<p>by default, the height of the text box,\n see <a href="#/p5/rectMode">rectMode()</a> for more info</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Typography'
},
textFont: {
name: 'textFont',
class: 'p5',
module: 'Typography',
overloads: [
{
params: []
},
{
params: [
{
name: 'font',
description:
'<p>a font loaded via <a href="#/p5/loadFont">loadFont()</a>,\nor a String representing a <a href="https://mzl.la/2dOw8WD">web safe font</a>\n(a font that is generally available across all systems)</p>\n',
type: 'Object|String'
},
{
name: 'size',
description: '<p>the font size to use</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
}
]
},
append: {
name: 'append',
params: [
{
name: 'array',
description: '<p>Array to append</p>\n',
type: 'Array'
},
{
name: 'value',
description: '<p>to be added to the Array</p>\n',
type: 'Any'
}
],
class: 'p5',
module: 'Data'
},
arrayCopy: {
name: 'arrayCopy',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'src',
description: '<p>the source Array</p>\n',
type: 'Array'
},
{
name: 'srcPosition',
description: '<p>starting position in the source Array</p>\n',
type: 'Integer'
},
{
name: 'dst',
description: '<p>the destination Array</p>\n',
type: 'Array'
},
{
name: 'dstPosition',
description: '<p>starting position in the destination Array</p>\n',
type: 'Integer'
},
{
name: 'length',
description: '<p>number of Array elements to be copied</p>\n',
type: 'Integer'
}
]
},
{
params: [
{
name: 'src',
description: '',
type: 'Array'
},
{
name: 'dst',
description: '',
type: 'Array'
},
{
name: 'length',
description: '',
type: 'Integer',
optional: true
}
]
}
]
},
concat: {
name: 'concat',
params: [
{
name: 'a',
description: '<p>first Array to concatenate</p>\n',
type: 'Array'
},
{
name: 'b',
description: '<p>second Array to concatenate</p>\n',
type: 'Array'
}
],
class: 'p5',
module: 'Data'
},
reverse: {
name: 'reverse',
params: [
{
name: 'list',
description: '<p>Array to reverse</p>\n',
type: 'Array'
}
],
class: 'p5',
module: 'Data'
},
shorten: {
name: 'shorten',
params: [
{
name: 'list',
description: '<p>Array to shorten</p>\n',
type: 'Array'
}
],
class: 'p5',
module: 'Data'
},
shuffle: {
name: 'shuffle',
params: [
{
name: 'array',
description: '<p>Array to shuffle</p>\n',
type: 'Array'
},
{
name: 'bool',
description: '<p>modify passed array</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Data'
},
sort: {
name: 'sort',
params: [
{
name: 'list',
description: '<p>Array to sort</p>\n',
type: 'Array'
},
{
name: 'count',
description: '<p>number of elements to sort, starting from 0</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Data'
},
splice: {
name: 'splice',
params: [
{
name: 'list',
description: '<p>Array to splice into</p>\n',
type: 'Array'
},
{
name: 'value',
description: '<p>value to be spliced in</p>\n',
type: 'Any'
},
{
name: 'position',
description: '<p>in the array from which to insert data</p>\n',
type: 'Integer'
}
],
class: 'p5',
module: 'Data'
},
subset: {
name: 'subset',
params: [
{
name: 'list',
description: '<p>Array to extract from</p>\n',
type: 'Array'
},
{
name: 'start',
description: '<p>position to begin</p>\n',
type: 'Integer'
},
{
name: 'count',
description: '<p>number of values to extract</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Data'
},
float: {
name: 'float',
params: [
{
name: 'str',
description: '<p>float string to parse</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
int: {
name: 'int',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String|Boolean|Number'
},
{
name: 'radix',
description: '<p>the radix to convert to (default: 10)</p>\n',
type: 'Integer',
optional: true
}
]
},
{
params: [
{
name: 'ns',
description: '<p>values to parse</p>\n',
type: 'Array'
},
{
name: 'radix',
description: '',
type: 'Integer',
optional: true
}
]
}
]
},
str: {
name: 'str',
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String|Boolean|Number|Array'
}
],
class: 'p5',
module: 'Data'
},
byte: {
name: 'byte',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String|Boolean|Number'
}
]
},
{
params: [
{
name: 'ns',
description: '<p>values to parse</p>\n',
type: 'Array'
}
]
}
]
},
char: {
name: 'char',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String|Number'
}
]
},
{
params: [
{
name: 'ns',
description: '<p>values to parse</p>\n',
type: 'Array'
}
]
}
]
},
unchar: {
name: 'unchar',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'ns',
description: '<p>values to parse</p>\n',
type: 'Array'
}
]
}
]
},
hex: {
name: 'hex',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'Number'
},
{
name: 'digits',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'ns',
description: '<p>array of values to parse</p>\n',
type: 'Number[]'
},
{
name: 'digits',
description: '',
type: 'Number',
optional: true
}
]
}
]
},
unhex: {
name: 'unhex',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'n',
description: '<p>value to parse</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'ns',
description: '<p>values to parse</p>\n',
type: 'Array'
}
]
}
]
},
join: {
name: 'join',
params: [
{
name: 'list',
description: '<p>array of Strings to be joined</p>\n',
type: 'Array'
},
{
name: 'separator',
description: '<p>String to be placed between each item</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
match: {
name: 'match',
params: [
{
name: 'str',
description: '<p>the String to be searched</p>\n',
type: 'String'
},
{
name: 'regexp',
description: '<p>the regexp to be used for matching</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
matchAll: {
name: 'matchAll',
params: [
{
name: 'str',
description: '<p>the String to be searched</p>\n',
type: 'String'
},
{
name: 'regexp',
description: '<p>the regexp to be used for matching</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
nf: {
name: 'nf',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'num',
description: '<p>the Number to format</p>\n',
type: 'Number|String'
},
{
name: 'left',
description:
'<p>number of digits to the left of the\n decimal point</p>\n',
type: 'Integer|String',
optional: true
},
{
name: 'right',
description:
'<p>number of digits to the right of the\n decimal point</p>\n',
type: 'Integer|String',
optional: true
}
]
},
{
params: [
{
name: 'nums',
description: '<p>the Numbers to format</p>\n',
type: 'Array'
},
{
name: 'left',
description: '',
type: 'Integer|String',
optional: true
},
{
name: 'right',
description: '',
type: 'Integer|String',
optional: true
}
]
}
]
},
nfc: {
name: 'nfc',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'num',
description: '<p>the Number to format</p>\n',
type: 'Number|String'
},
{
name: 'right',
description:
'<p>number of digits to the right of the\n decimal point</p>\n',
type: 'Integer|String',
optional: true
}
]
},
{
params: [
{
name: 'nums',
description: '<p>the Numbers to format</p>\n',
type: 'Array'
},
{
name: 'right',
description: '',
type: 'Integer|String',
optional: true
}
]
}
]
},
nfp: {
name: 'nfp',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'num',
description: '<p>the Number to format</p>\n',
type: 'Number'
},
{
name: 'left',
description:
'<p>number of digits to the left of the decimal\n point</p>\n',
type: 'Integer',
optional: true
},
{
name: 'right',
description:
'<p>number of digits to the right of the\n decimal point</p>\n',
type: 'Integer',
optional: true
}
]
},
{
params: [
{
name: 'nums',
description: '<p>the Numbers to format</p>\n',
type: 'Number[]'
},
{
name: 'left',
description: '',
type: 'Integer',
optional: true
},
{
name: 'right',
description: '',
type: 'Integer',
optional: true
}
]
}
]
},
nfs: {
name: 'nfs',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'num',
description: '<p>the Number to format</p>\n',
type: 'Number'
},
{
name: 'left',
description:
'<p>number of digits to the left of the decimal\n point</p>\n',
type: 'Integer',
optional: true
},
{
name: 'right',
description:
'<p>number of digits to the right of the\n decimal point</p>\n',
type: 'Integer',
optional: true
}
]
},
{
params: [
{
name: 'nums',
description: '<p>the Numbers to format</p>\n',
type: 'Array'
},
{
name: 'left',
description: '',
type: 'Integer',
optional: true
},
{
name: 'right',
description: '',
type: 'Integer',
optional: true
}
]
}
]
},
split: {
name: 'split',
params: [
{
name: 'value',
description: '<p>the String to be split</p>\n',
type: 'String'
},
{
name: 'delim',
description: '<p>the String used to separate the data</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Data'
},
splitTokens: {
name: 'splitTokens',
params: [
{
name: 'value',
description: '<p>the String to be split</p>\n',
type: 'String'
},
{
name: 'delim',
description:
'<p>list of individual Strings that will be used as\n separators</p>\n',
type: 'String',
optional: true
}
],
class: 'p5',
module: 'Data'
},
trim: {
name: 'trim',
class: 'p5',
module: 'Data',
overloads: [
{
params: [
{
name: 'str',
description: '<p>a String to be trimmed</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'strs',
description: '<p>an Array of Strings to be trimmed</p>\n',
type: 'Array'
}
]
}
]
},
day: {
name: 'day',
class: 'p5',
module: 'IO'
},
hour: {
name: 'hour',
class: 'p5',
module: 'IO'
},
minute: {
name: 'minute',
class: 'p5',
module: 'IO'
},
millis: {
name: 'millis',
class: 'p5',
module: 'IO'
},
month: {
name: 'month',
class: 'p5',
module: 'IO'
},
second: {
name: 'second',
class: 'p5',
module: 'IO'
},
year: {
name: 'year',
class: 'p5',
module: 'IO'
},
plane: {
name: 'plane',
params: [
{
name: 'width',
description: '<p>width of the plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'height',
description: '<p>height of the plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>Optional number of triangle\n subdivisions in x-dimension</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>Optional number of triangle\n subdivisions in y-dimension</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
box: {
name: 'box',
params: [
{
name: 'width',
description: '<p>width of the box</p>\n',
type: 'Number',
optional: true
},
{
name: 'Height',
description: '<p>height of the box</p>\n',
type: 'Number',
optional: true
},
{
name: 'depth',
description: '<p>depth of the box</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>Optional number of triangle\n subdivisions in x-dimension</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>Optional number of triangle\n subdivisions in y-dimension</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
sphere: {
name: 'sphere',
params: [
{
name: 'radius',
description: '<p>radius of circle</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description: '<p>optional number of subdivisions in x-dimension</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description: '<p>optional number of subdivisions in y-dimension</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
cylinder: {
name: 'cylinder',
params: [
{
name: 'radius',
description: '<p>radius of the surface</p>\n',
type: 'Number',
optional: true
},
{
name: 'height',
description: '<p>height of the cylinder</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>number of subdivisions in x-dimension;\n default is 24</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>number of subdivisions in y-dimension;\n default is 1</p>\n',
type: 'Integer',
optional: true
},
{
name: 'bottomCap',
description: '<p>whether to draw the bottom of the cylinder</p>\n',
type: 'Boolean',
optional: true
},
{
name: 'topCap',
description: '<p>whether to draw the top of the cylinder</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
cone: {
name: 'cone',
params: [
{
name: 'radius',
description: '<p>radius of the bottom surface</p>\n',
type: 'Number',
optional: true
},
{
name: 'height',
description: '<p>height of the cone</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>number of segments,\n the more segments the smoother geometry\n default is 24</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>number of segments,\n the more segments the smoother geometry\n default is 1</p>\n',
type: 'Integer',
optional: true
},
{
name: 'cap',
description: '<p>whether to draw the base of the cone</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
ellipsoid: {
name: 'ellipsoid',
params: [
{
name: 'radiusx',
description: '<p>x-radius of ellipsoid</p>\n',
type: 'Number',
optional: true
},
{
name: 'radiusy',
description: '<p>y-radius of ellipsoid</p>\n',
type: 'Number',
optional: true
},
{
name: 'radiusz',
description: '<p>z-radius of ellipsoid</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>number of segments,\n the more segments the smoother geometry\n default is 24. Avoid detail number above\n 150, it may crash the browser.</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>number of segments,\n the more segments the smoother geometry\n default is 16. Avoid detail number above\n 150, it may crash the browser.</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
torus: {
name: 'torus',
params: [
{
name: 'radius',
description: '<p>radius of the whole ring</p>\n',
type: 'Number',
optional: true
},
{
name: 'tubeRadius',
description: '<p>radius of the tube</p>\n',
type: 'Number',
optional: true
},
{
name: 'detailX',
description:
'<p>number of segments in x-dimension,\n the more segments the smoother geometry\n default is 24</p>\n',
type: 'Integer',
optional: true
},
{
name: 'detailY',
description:
'<p>number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16</p>\n',
type: 'Integer',
optional: true
}
],
class: 'p5',
module: 'Shape'
},
orbitControl: {
name: 'orbitControl',
params: [
{
name: 'sensitivityX',
description: '<p>sensitivity to mouse movement along X axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'sensitivityY',
description: '<p>sensitivity to mouse movement along Y axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'sensitivityZ',
description: '<p>sensitivity to scroll movement along Z axis</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
debugMode: {
name: 'debugMode',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: []
},
{
params: [
{
name: 'mode',
description: '<p>either GRID or AXES</p>\n',
type: 'Constant'
}
]
},
{
params: [
{
name: 'mode',
description: '',
type: 'Constant'
},
{
name: 'gridSize',
description: '<p>size of one side of the grid</p>\n',
type: 'Number',
optional: true
},
{
name: 'gridDivisions',
description: '<p>number of divisions in the grid</p>\n',
type: 'Number',
optional: true
},
{
name: 'xOff',
description: '<p>X axis offset from origin (0,0,0)</p>\n',
type: 'Number',
optional: true
},
{
name: 'yOff',
description: '<p>Y axis offset from origin (0,0,0)</p>\n',
type: 'Number',
optional: true
},
{
name: 'zOff',
description: '<p>Z axis offset from origin (0,0,0)</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'mode',
description: '',
type: 'Constant'
},
{
name: 'axesSize',
description: '<p>size of axes icon</p>\n',
type: 'Number',
optional: true
},
{
name: 'xOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'yOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'zOff',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'gridSize',
description: '',
type: 'Number',
optional: true
},
{
name: 'gridDivisions',
description: '',
type: 'Number',
optional: true
},
{
name: 'gridXOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'gridYOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'gridZOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'axesSize',
description: '',
type: 'Number',
optional: true
},
{
name: 'axesXOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'axesYOff',
description: '',
type: 'Number',
optional: true
},
{
name: 'axesZOff',
description: '',
type: 'Number',
optional: true
}
]
}
]
},
noDebugMode: {
name: 'noDebugMode',
class: 'p5',
module: 'Lights, Camera'
},
ambientLight: {
name: 'ambientLight',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '<p>the alpha value</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: [
{
name: 'gray',
description: '<p>a gray value</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>the ambient light color</p>\n',
type: 'p5.Color'
}
],
chainable: 1
}
]
},
specularColor: {
name: 'specularColor',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>a color string</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: [
{
name: 'gray',
description: '<p>a gray value</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'values',
description:
'<p>an array containing the red,green,blue &\n and alpha components of the color</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>the ambient light color</p>\n',
type: 'p5.Color'
}
],
chainable: 1
}
]
},
directionalLight: {
name: 'directionalLight',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value (depending on the current\ncolor mode),</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>green or saturation value</p>\n',
type: 'Number'
},
{
name: 'v3',
description: '<p>blue or brightness value</p>\n',
type: 'Number'
},
{
name: 'position',
description: '<p>the direction of the light</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description:
'<p>color Array, CSS color string,\n or <a href="#/p5.Color">p5.Color</a> value</p>\n',
type: 'Number[]|String|p5.Color'
},
{
name: 'x',
description: '<p>x axis direction</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y axis direction</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>z axis direction</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '',
type: 'Number[]|String|p5.Color'
},
{
name: 'position',
description: '',
type: 'p5.Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description: '',
type: 'Number'
},
{
name: 'v2',
description: '',
type: 'Number'
},
{
name: 'v3',
description: '',
type: 'Number'
},
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number'
}
],
chainable: 1
}
]
},
pointLight: {
name: 'pointLight',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value (depending on the current\ncolor mode),</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>green or saturation value</p>\n',
type: 'Number'
},
{
name: 'v3',
description: '<p>blue or brightness value</p>\n',
type: 'Number'
},
{
name: 'x',
description: '<p>x axis position</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y axis position</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>z axis position</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description: '',
type: 'Number'
},
{
name: 'v2',
description: '',
type: 'Number'
},
{
name: 'v3',
description: '',
type: 'Number'
},
{
name: 'position',
description: '<p>the position of the light</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description:
'<p>color Array, CSS color string,\nor <a href="#/p5.Color">p5.Color</a> value</p>\n',
type: 'Number[]|String|p5.Color'
},
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '',
type: 'Number[]|String|p5.Color'
},
{
name: 'position',
description: '',
type: 'p5.Vector'
}
],
chainable: 1
}
]
},
lights: {
name: 'lights',
class: 'p5',
module: 'Lights, Camera'
},
lightFalloff: {
name: 'lightFalloff',
params: [
{
name: 'constant',
description: '<p>constant value for determining falloff</p>\n',
type: 'Number'
},
{
name: 'linear',
description: '<p>linear value for determining falloff</p>\n',
type: 'Number'
},
{
name: 'quadratic',
description: '<p>quadratic value for determining falloff</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Lights, Camera'
},
spotLight: {
name: 'spotLight',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>red or hue value (depending on the current\ncolor mode),</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>green or saturation value</p>\n',
type: 'Number'
},
{
name: 'v3',
description: '<p>blue or brightness value</p>\n',
type: 'Number'
},
{
name: 'x',
description: '<p>x axis position</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y axis position</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>z axis position</p>\n',
type: 'Number'
},
{
name: 'rx',
description: '<p>x axis direction of light</p>\n',
type: 'Number'
},
{
name: 'ry',
description: '<p>y axis direction of light</p>\n',
type: 'Number'
},
{
name: 'rz',
description: '<p>z axis direction of light</p>\n',
type: 'Number'
},
{
name: 'angle',
description:
'<p>optional parameter for angle. Defaults to PI/3</p>\n',
type: 'Number',
optional: true
},
{
name: 'conc',
description:
'<p>optional parameter for concentration. Defaults to 100</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description:
'<p>color Array, CSS color string,\nor <a href="#/p5.Color">p5.Color</a> value</p>\n',
type: 'Number[]|String|p5.Color'
},
{
name: 'position',
description: '<p>the position of the light</p>\n',
type: 'p5.Vector'
},
{
name: 'direction',
description: '<p>the direction of the light</p>\n',
type: 'p5.Vector'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'v1',
description: '',
type: 'Number'
},
{
name: 'v2',
description: '',
type: 'Number'
},
{
name: 'v3',
description: '',
type: 'Number'
},
{
name: 'position',
description: '',
type: 'p5.Vector'
},
{
name: 'direction',
description: '',
type: 'p5.Vector'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'color',
description: '',
type: 'Number[]|String|p5.Color'
},
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number'
},
{
name: 'direction',
description: '',
type: 'p5.Vector'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'color',
description: '',
type: 'Number[]|String|p5.Color'
},
{
name: 'position',
description: '',
type: 'p5.Vector'
},
{
name: 'rx',
description: '',
type: 'Number'
},
{
name: 'ry',
description: '',
type: 'Number'
},
{
name: 'rz',
description: '',
type: 'Number'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'v1',
description: '',
type: 'Number'
},
{
name: 'v2',
description: '',
type: 'Number'
},
{
name: 'v3',
description: '',
type: 'Number'
},
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number'
},
{
name: 'direction',
description: '',
type: 'p5.Vector'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'v1',
description: '',
type: 'Number'
},
{
name: 'v2',
description: '',
type: 'Number'
},
{
name: 'v3',
description: '',
type: 'Number'
},
{
name: 'position',
description: '',
type: 'p5.Vector'
},
{
name: 'rx',
description: '',
type: 'Number'
},
{
name: 'ry',
description: '',
type: 'Number'
},
{
name: 'rz',
description: '',
type: 'Number'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'color',
description: '',
type: 'Number[]|String|p5.Color'
},
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number'
},
{
name: 'rx',
description: '',
type: 'Number'
},
{
name: 'ry',
description: '',
type: 'Number'
},
{
name: 'rz',
description: '',
type: 'Number'
},
{
name: 'angle',
description: '',
type: 'Number',
optional: true
},
{
name: 'conc',
description: '',
type: 'Number',
optional: true
}
]
}
]
},
noLights: {
name: 'noLights',
class: 'p5',
module: 'Lights, Camera'
},
loadModel: {
name: 'loadModel',
class: 'p5',
module: 'Shape',
overloads: [
{
params: [
{
name: 'path',
description: '<p>Path of the model to be loaded</p>\n',
type: 'String'
},
{
name: 'normalize',
description:
'<p>If true, scale the model to a\n standardized size when loading</p>\n',
type: 'Boolean'
},
{
name: 'successCallback',
description:
'<p>Function to be called\n once the model is loaded. Will be passed\n the 3D model object.</p>\n',
type: 'function(p5.Geometry)',
optional: true
},
{
name: 'failureCallback',
description:
'<p>called with event error if\n the model fails to load.</p>\n',
type: 'Function(Event)',
optional: true
},
{
name: 'fileType',
description:
'<p>The file extension of the model\n (<code>.stl</code>, <code>.obj</code>).</p>\n',
type: 'String',
optional: true
}
]
},
{
params: [
{
name: 'path',
description: '',
type: 'String'
},
{
name: 'successCallback',
description: '',
type: 'function(p5.Geometry)',
optional: true
},
{
name: 'failureCallback',
description: '',
type: 'Function(Event)',
optional: true
},
{
name: 'fileType',
description: '',
type: 'String',
optional: true
}
]
}
]
},
model: {
name: 'model',
params: [
{
name: 'model',
description: '<p>Loaded 3d model to be rendered</p>\n',
type: 'p5.Geometry'
}
],
class: 'p5',
module: 'Shape'
},
loadShader: {
name: 'loadShader',
params: [
{
name: 'vertFilename',
description:
'<p>path to file containing vertex shader\nsource code</p>\n',
type: 'String'
},
{
name: 'fragFilename',
description:
'<p>path to file containing fragment shader\nsource code</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>callback to be executed after loadShader\ncompletes. On success, the Shader object is passed as the first argument.</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
createShader: {
name: 'createShader',
params: [
{
name: 'vertSrc',
description: '<p>source code for the vertex shader</p>\n',
type: 'String'
},
{
name: 'fragSrc',
description: '<p>source code for the fragment shader</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'Lights, Camera'
},
shader: {
name: 'shader',
params: [
{
name: 's',
description:
'<p>the desired <a href="#/p5.Shader">p5.Shader</a> to use for rendering\nshapes.</p>\n',
type: 'p5.Shader',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
resetShader: {
name: 'resetShader',
class: 'p5',
module: 'Lights, Camera'
},
texture: {
name: 'texture',
params: [
{
name: 'tex',
description:
'<p>2-dimensional graphics\n to render as texture</p>\n',
type: 'p5.Image|p5.MediaElement|p5.Graphics'
}
],
class: 'p5',
module: 'Lights, Camera'
},
textureMode: {
name: 'textureMode',
params: [
{
name: 'mode',
description: '<p>either IMAGE or NORMAL</p>\n',
type: 'Constant'
}
],
class: 'p5',
module: 'Lights, Camera'
},
textureWrap: {
name: 'textureWrap',
params: [
{
name: 'wrapX',
description: '<p>either CLAMP, REPEAT, or MIRROR</p>\n',
type: 'Constant'
},
{
name: 'wrapY',
description: '<p>either CLAMP, REPEAT, or MIRROR</p>\n',
type: 'Constant',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
normalMaterial: {
name: 'normalMaterial',
class: 'p5',
module: 'Lights, Camera'
},
ambientMaterial: {
name: 'ambientMaterial',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>gray value, red or hue value\n (depending on the current color mode),</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>green or saturation value</p>\n',
type: 'Number',
optional: true
},
{
name: 'v3',
description: '<p>blue or brightness value</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>color, color Array, or CSS color string</p>\n',
type: 'Number[]|String|p5.Color'
}
],
chainable: 1
}
]
},
emissiveMaterial: {
name: 'emissiveMaterial',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'v1',
description:
'<p>gray value, red or hue value\n (depending on the current color mode),</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>green or saturation value</p>\n',
type: 'Number',
optional: true
},
{
name: 'v3',
description: '<p>blue or brightness value</p>\n',
type: 'Number',
optional: true
},
{
name: 'a',
description: '<p>opacity</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>color, color Array, or CSS color string</p>\n',
type: 'Number[]|String|p5.Color'
}
],
chainable: 1
}
]
},
specularMaterial: {
name: 'specularMaterial',
class: 'p5',
module: 'Lights, Camera',
overloads: [
{
params: [
{
name: 'gray',
description:
'<p>number specifying value between white and black.</p>\n',
type: 'Number'
},
{
name: 'alpha',
description:
'<p>alpha value relative to current color range\n (default is 0-255)</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description:
'<p>red or hue value relative to\n the current color range</p>\n',
type: 'Number'
},
{
name: 'v2',
description:
'<p>green or saturation value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'v3',
description:
'<p>blue or brightness value\n relative to the current color range</p>\n',
type: 'Number'
},
{
name: 'alpha',
description: '',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'color',
description: '<p>color Array, or CSS color string</p>\n',
type: 'Number[]|String|p5.Color'
}
],
chainable: 1
}
]
},
shininess: {
name: 'shininess',
params: [
{
name: 'shine',
description:
'<p>Degree of Shininess.\n Defaults to 1.</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'Lights, Camera'
},
camera: {
name: 'camera',
params: [
{
name: 'x',
description: '<p>camera position value on x axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description: '<p>camera position value on y axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>camera position value on z axis</p>\n',
type: 'Number',
optional: true
},
{
name: 'centerX',
description: '<p>x coordinate representing center of the sketch</p>\n',
type: 'Number',
optional: true
},
{
name: 'centerY',
description: '<p>y coordinate representing center of the sketch</p>\n',
type: 'Number',
optional: true
},
{
name: 'centerZ',
description: '<p>z coordinate representing center of the sketch</p>\n',
type: 'Number',
optional: true
},
{
name: 'upX',
description: "<p>x component of direction 'up' from camera</p>\n",
type: 'Number',
optional: true
},
{
name: 'upY',
description: "<p>y component of direction 'up' from camera</p>\n",
type: 'Number',
optional: true
},
{
name: 'upZ',
description: "<p>z component of direction 'up' from camera</p>\n",
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
perspective: {
name: 'perspective',
params: [
{
name: 'fovy',
description:
'<p>camera frustum vertical field of view,\n from bottom to top of view, in <a href="#/p5/angleMode">angleMode</a> units</p>\n',
type: 'Number',
optional: true
},
{
name: 'aspect',
description: '<p>camera frustum aspect ratio</p>\n',
type: 'Number',
optional: true
},
{
name: 'near',
description: '<p>frustum near plane length</p>\n',
type: 'Number',
optional: true
},
{
name: 'far',
description: '<p>frustum far plane length</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
ortho: {
name: 'ortho',
params: [
{
name: 'left',
description: '<p>camera frustum left plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'right',
description: '<p>camera frustum right plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'bottom',
description: '<p>camera frustum bottom plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'top',
description: '<p>camera frustum top plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'near',
description: '<p>camera frustum near plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'far',
description: '<p>camera frustum far plane</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
frustum: {
name: 'frustum',
params: [
{
name: 'left',
description: '<p>camera frustum left plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'right',
description: '<p>camera frustum right plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'bottom',
description: '<p>camera frustum bottom plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'top',
description: '<p>camera frustum top plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'near',
description: '<p>camera frustum near plane</p>\n',
type: 'Number',
optional: true
},
{
name: 'far',
description: '<p>camera frustum far plane</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'Lights, Camera'
},
createCamera: {
name: 'createCamera',
class: 'p5',
module: 'Lights, Camera'
},
setCamera: {
name: 'setCamera',
params: [
{
name: 'cam',
description: '<p>p5.Camera object</p>\n',
type: 'p5.Camera'
}
],
class: 'p5',
module: 'Lights, Camera'
},
setAttributes: {
name: 'setAttributes',
class: 'p5',
module: 'Rendering',
overloads: [
{
params: [
{
name: 'key',
description: '<p>Name of attribute</p>\n',
type: 'String'
},
{
name: 'value',
description: '<p>New value of named attribute</p>\n',
type: 'Boolean'
}
]
},
{
params: [
{
name: 'obj',
description: '<p>object with key-value pairs</p>\n',
type: 'Object'
}
]
}
]
},
getAudioContext: {
name: 'getAudioContext',
class: 'p5',
module: 'p5.sound'
},
userStartAudio: {
params: [
{
name: 'element(s)',
description:
'<p>This argument can be an Element,\n Selector String, NodeList, p5.Element,\n jQuery Element, or an Array of any of those.</p>\n',
type: 'Element|Array',
optional: true
},
{
name: 'callback',
description:
'<p>Callback to invoke when the AudioContext\n has started</p>\n',
type: 'Function',
optional: true
}
],
name: 'userStartAudio',
class: 'p5',
module: 'p5.sound'
},
getOutputVolume: {
name: 'getOutputVolume',
class: 'p5',
module: 'p5.sound'
},
outputVolume: {
name: 'outputVolume',
params: [
{
name: 'volume',
description:
'<p>Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator</p>\n',
type: 'Number|Object'
},
{
name: 'rampTime',
description: '<p>Fade for t seconds</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>Schedule this event to happen at\n t seconds in the future</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5',
module: 'p5.sound'
},
soundOut: {
name: 'soundOut',
class: 'p5',
module: 'p5.sound'
},
sampleRate: {
name: 'sampleRate',
class: 'p5',
module: 'p5.sound'
},
freqToMidi: {
name: 'freqToMidi',
params: [
{
name: 'frequency',
description:
'<p>A freqeuncy, for example, the "A"\n above Middle C is 440Hz</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'p5.sound'
},
midiToFreq: {
name: 'midiToFreq',
params: [
{
name: 'midiNote',
description: '<p>The number of a MIDI note</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'p5.sound'
},
soundFormats: {
name: 'soundFormats',
params: [
{
name: 'formats',
description: "<p>i.e. 'mp3', 'wav', 'ogg'</p>\n",
type: 'String',
optional: true,
multiple: true
}
],
class: 'p5',
module: 'p5.sound'
},
saveSound: {
name: 'saveSound',
params: [
{
name: 'soundFile',
description: '<p>p5.SoundFile that you wish to save</p>\n',
type: 'p5.SoundFile'
},
{
name: 'fileName',
description: '<p>name of the resulting .wav file.</p>\n',
type: 'String'
}
],
class: 'p5',
module: 'p5.sound'
},
loadSound: {
name: 'loadSound',
params: [
{
name: 'path',
description:
"<p>Path to the sound file, or an array with\n paths to soundfiles in multiple formats\n i.e. ['sound.ogg', 'sound.mp3'].\n Alternately, accepts an object: either\n from the HTML5 File API, or a p5.File.</p>\n",
type: 'String|Array'
},
{
name: 'successCallback',
description: '<p>Name of a function to call once file loads</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>Name of a function to call if there is\n an error loading the file.</p>\n',
type: 'Function',
optional: true
},
{
name: 'whileLoading',
description:
'<p>Name of a function to call while file is loading.\n This function will receive the percentage loaded\n so far, from 0.0 to 1.0.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'p5.sound'
},
createConvolver: {
name: 'createConvolver',
params: [
{
name: 'path',
description: '<p>path to a sound file</p>\n',
type: 'String'
},
{
name: 'callback',
description:
'<p>function to call if loading is successful.\n The object will be passed in as the argument\n to the callback function.</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>function to call if loading is not successful.\n A custom error will be passed in as the argument\n to the callback function.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5',
module: 'p5.sound'
},
setBPM: {
name: 'setBPM',
params: [
{
name: 'BPM',
description: '<p>Beats Per Minute</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>Seconds from now</p>\n',
type: 'Number'
}
],
class: 'p5',
module: 'p5.sound'
}
},
'p5.Color': {
toString: {
name: 'toString',
params: [
{
name: 'format',
description:
"<p>How the color string will be formatted.\nLeaving this empty formats the string as rgba(r, g, b, a).\n'#rgb' '#rgba' '#rrggbb' and '#rrggbbaa' format as hexadecimal color codes.\n'rgb' 'hsb' and 'hsl' return the color formatted in the specified color mode.\n'rgba' 'hsba' and 'hsla' are the same as above but with alpha channels.\n'rgb%' 'hsb%' 'hsl%' 'rgba%' 'hsba%' and 'hsla%' format as percentages.</p>\n",
type: 'String',
optional: true
}
],
class: 'p5.Color',
module: 'Color'
},
setRed: {
name: 'setRed',
params: [
{
name: 'red',
description: '<p>the new red value</p>\n',
type: 'Number'
}
],
class: 'p5.Color',
module: 'Color'
},
setGreen: {
name: 'setGreen',
params: [
{
name: 'green',
description: '<p>the new green value</p>\n',
type: 'Number'
}
],
class: 'p5.Color',
module: 'Color'
},
setBlue: {
name: 'setBlue',
params: [
{
name: 'blue',
description: '<p>the new blue value</p>\n',
type: 'Number'
}
],
class: 'p5.Color',
module: 'Color'
},
setAlpha: {
name: 'setAlpha',
params: [
{
name: 'alpha',
description: '<p>the new alpha value</p>\n',
type: 'Number'
}
],
class: 'p5.Color',
module: 'Color'
}
},
'p5.Element': {
elt: {
name: 'elt',
class: 'p5.Element',
module: 'DOM'
},
parent: {
name: 'parent',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: [
{
name: 'parent',
description:
'<p>the ID, DOM node, or <a href="#/p5.Element">p5.Element</a>\n of desired parent element</p>\n',
type: 'String|p5.Element|Object'
}
],
chainable: 1
},
{
params: []
}
]
},
id: {
name: 'id',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: [
{
name: 'id',
description: '<p>ID of the element</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: []
}
]
},
class: {
name: 'class',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: [
{
name: 'class',
description: '<p>class to add</p>\n',
type: 'String'
}
],
chainable: 1
},
{
params: []
}
]
},
mousePressed: {
name: 'mousePressed',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when mouse is\n pressed over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
doubleClicked: {
name: 'doubleClicked',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when mouse is\n double clicked over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseWheel: {
name: 'mouseWheel',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when mouse is\n scrolled over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseReleased: {
name: 'mouseReleased',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when mouse is\n released over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseClicked: {
name: 'mouseClicked',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when mouse is\n clicked over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseMoved: {
name: 'mouseMoved',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a mouse moves\n over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseOver: {
name: 'mouseOver',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a mouse moves\n onto the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
mouseOut: {
name: 'mouseOut',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a mouse\n moves off of an element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
touchStarted: {
name: 'touchStarted',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a touch\n starts over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
touchMoved: {
name: 'touchMoved',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a touch moves over\n the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
touchEnded: {
name: 'touchEnded',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a touch ends\n over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
dragOver: {
name: 'dragOver',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a file is\n dragged over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
dragLeave: {
name: 'dragLeave',
params: [
{
name: 'fxn',
description:
'<p>function to be fired when a file is\n dragged off the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n',
type: 'Function|Boolean'
}
],
class: 'p5.Element',
module: 'DOM'
},
addClass: {
name: 'addClass',
params: [
{
name: 'class',
description: '<p>name of class to add</p>\n',
type: 'String'
}
],
class: 'p5.Element',
module: 'DOM'
},
removeClass: {
name: 'removeClass',
params: [
{
name: 'class',
description: '<p>name of class to remove</p>\n',
type: 'String'
}
],
class: 'p5.Element',
module: 'DOM'
},
hasClass: {
name: 'hasClass',
params: [
{
name: 'c',
description: '<p>class name of class to check</p>\n',
type: 'String'
}
],
class: 'p5.Element',
module: 'DOM'
},
toggleClass: {
name: 'toggleClass',
params: [
{
name: 'c',
description: '<p>class name to toggle</p>\n',
type: 'String'
}
],
class: 'p5.Element',
module: 'DOM'
},
child: {
name: 'child',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'child',
description:
'<p>the ID, DOM node, or <a href="#/p5.Element">p5.Element</a>\n to add to the current element</p>\n',
type: 'String|p5.Element',
optional: true
}
],
chainable: 1
}
]
},
center: {
name: 'center',
params: [
{
name: 'align',
description:
"<p>passing 'vertical', 'horizontal' aligns element accordingly</p>\n",
type: 'String',
optional: true
}
],
class: 'p5.Element',
module: 'DOM'
},
html: {
name: 'html',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'html',
description: '<p>the HTML to be placed inside the element</p>\n',
type: 'String',
optional: true
},
{
name: 'append',
description: '<p>whether to append HTML to existing</p>\n',
type: 'Boolean',
optional: true
}
],
chainable: 1
}
]
},
position: {
name: 'position',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'x',
description:
'<p>x-position relative to upper left of window (optional)</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description:
'<p>y-position relative to upper left of window (optional)</p>\n',
type: 'Number',
optional: true
},
{
name: 'positionType',
description:
'<p>it can be static, fixed, relative, sticky, initial or inherit (optional)</p>\n',
type: 'String'
}
],
chainable: 1
}
]
},
style: {
name: 'style',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: [
{
name: 'property',
description: '<p>property to be set</p>\n',
type: 'String'
}
]
},
{
params: [
{
name: 'property',
description: '',
type: 'String'
},
{
name: 'value',
description: '<p>value to assign to property</p>\n',
type: 'String|p5.Color'
}
],
chainable: 1
}
]
},
attribute: {
name: 'attribute',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'attr',
description: '<p>attribute to set</p>\n',
type: 'String'
},
{
name: 'value',
description: '<p>value to assign to attribute</p>\n',
type: 'String'
}
],
chainable: 1
}
]
},
removeAttribute: {
name: 'removeAttribute',
params: [
{
name: 'attr',
description: '<p>attribute to remove</p>\n',
type: 'String'
}
],
class: 'p5.Element',
module: 'DOM'
},
value: {
name: 'value',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'value',
description: '',
type: 'String|Number'
}
],
chainable: 1
}
]
},
show: {
name: 'show',
class: 'p5.Element',
module: 'DOM'
},
hide: {
name: 'hide',
class: 'p5.Element',
module: 'DOM'
},
size: {
name: 'size',
class: 'p5.Element',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'w',
description:
'<p>width of the element, either AUTO, or a number</p>\n',
type: 'Number|Constant'
},
{
name: 'h',
description:
'<p>height of the element, either AUTO, or a number</p>\n',
type: 'Number|Constant',
optional: true
}
],
chainable: 1
}
]
},
remove: {
name: 'remove',
class: 'p5.Element',
module: 'DOM'
},
drop: {
name: 'drop',
params: [
{
name: 'callback',
description:
'<p>callback to receive loaded file, called for each file dropped.</p>\n',
type: 'Function'
},
{
name: 'fxn',
description:
'<p>callback triggered once when files are dropped with the drop event.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5.Element',
module: 'DOM'
}
},
'p5.Graphics': {
reset: {
name: 'reset',
class: 'p5.Graphics',
module: 'Rendering'
},
remove: {
name: 'remove',
class: 'p5.Graphics',
module: 'Rendering'
}
},
JSON: {
stringify: {
name: 'stringify',
params: [
{
name: 'object',
description:
'<p>:Javascript object that you would like to convert to JSON</p>\n',
type: 'Object'
}
],
class: 'JSON',
module: 'Foundation'
}
},
console: {
log: {
name: 'log',
params: [
{
name: 'message',
description:
'<p>:Message that you would like to print to the console</p>\n',
type: 'String|Expression|Object'
}
],
class: 'console',
module: 'Foundation'
}
},
'p5.TypedDict': {
size: {
name: 'size',
class: 'p5.TypedDict',
module: 'Data'
},
hasKey: {
name: 'hasKey',
params: [
{
name: 'key',
description: '<p>that you want to look up</p>\n',
type: 'Number|String'
}
],
class: 'p5.TypedDict',
module: 'Data'
},
get: {
name: 'get',
params: [
{
name: 'the',
description: '<p>key you want to access</p>\n',
type: 'Number|String'
}
],
class: 'p5.TypedDict',
module: 'Data'
},
set: {
name: 'set',
params: [
{
name: 'key',
description: '',
type: 'Number|String'
},
{
name: 'value',
description: '',
type: 'Number|String'
}
],
class: 'p5.TypedDict',
module: 'Data'
},
create: {
name: 'create',
class: 'p5.TypedDict',
module: 'Data',
overloads: [
{
params: [
{
name: 'key',
description: '',
type: 'Number|String'
},
{
name: 'value',
description: '',
type: 'Number|String'
}
]
},
{
params: [
{
name: 'obj',
description: '<p>key/value pair</p>\n',
type: 'Object'
}
]
}
]
},
clear: {
name: 'clear',
class: 'p5.TypedDict',
module: 'Data'
},
remove: {
name: 'remove',
params: [
{
name: 'key',
description: '<p>for the pair to remove</p>\n',
type: 'Number|String'
}
],
class: 'p5.TypedDict',
module: 'Data'
},
print: {
name: 'print',
class: 'p5.TypedDict',
module: 'Data'
},
saveTable: {
name: 'saveTable',
class: 'p5.TypedDict',
module: 'Data'
},
saveJSON: {
name: 'saveJSON',
class: 'p5.TypedDict',
module: 'Data'
}
},
'p5.NumberDict': {
add: {
name: 'add',
params: [
{
name: 'Key',
description: '<p>for the value you wish to add to</p>\n',
type: 'Number'
},
{
name: 'Number',
description: '<p>to add to the value</p>\n',
type: 'Number'
}
],
class: 'p5.NumberDict',
module: 'Data'
},
sub: {
name: 'sub',
params: [
{
name: 'Key',
description: '<p>for the value you wish to subtract from</p>\n',
type: 'Number'
},
{
name: 'Number',
description: '<p>to subtract from the value</p>\n',
type: 'Number'
}
],
class: 'p5.NumberDict',
module: 'Data'
},
mult: {
name: 'mult',
params: [
{
name: 'Key',
description: '<p>for value you wish to multiply</p>\n',
type: 'Number'
},
{
name: 'Amount',
description: '<p>to multiply the value by</p>\n',
type: 'Number'
}
],
class: 'p5.NumberDict',
module: 'Data'
},
div: {
name: 'div',
params: [
{
name: 'Key',
description: '<p>for value you wish to divide</p>\n',
type: 'Number'
},
{
name: 'Amount',
description: '<p>to divide the value by</p>\n',
type: 'Number'
}
],
class: 'p5.NumberDict',
module: 'Data'
},
minValue: {
name: 'minValue',
class: 'p5.NumberDict',
module: 'Data'
},
maxValue: {
name: 'maxValue',
class: 'p5.NumberDict',
module: 'Data'
},
minKey: {
name: 'minKey',
class: 'p5.NumberDict',
module: 'Data'
},
maxKey: {
name: 'maxKey',
class: 'p5.NumberDict',
module: 'Data'
}
},
'p5.MediaElement': {
src: {
name: 'src',
class: 'p5.MediaElement',
module: 'DOM'
},
play: {
name: 'play',
class: 'p5.MediaElement',
module: 'DOM'
},
stop: {
name: 'stop',
class: 'p5.MediaElement',
module: 'DOM'
},
pause: {
name: 'pause',
class: 'p5.MediaElement',
module: 'DOM'
},
loop: {
name: 'loop',
class: 'p5.MediaElement',
module: 'DOM'
},
noLoop: {
name: 'noLoop',
class: 'p5.MediaElement',
module: 'DOM'
},
autoplay: {
name: 'autoplay',
params: [
{
name: 'shouldAutoplay',
description: '<p>whether the element should autoplay</p>\n',
type: 'Boolean'
}
],
class: 'p5.MediaElement',
module: 'DOM'
},
volume: {
name: 'volume',
class: 'p5.MediaElement',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'val',
description: '<p>volume between 0.0 and 1.0</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
speed: {
name: 'speed',
class: 'p5.MediaElement',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'speed',
description: '<p>speed multiplier for element playback</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
time: {
name: 'time',
class: 'p5.MediaElement',
module: 'DOM',
overloads: [
{
params: []
},
{
params: [
{
name: 'time',
description: '<p>time to jump to (in seconds)</p>\n',
type: 'Number'
}
],
chainable: 1
}
]
},
duration: {
name: 'duration',
class: 'p5.MediaElement',
module: 'DOM'
},
onended: {
name: 'onended',
params: [
{
name: 'callback',
description:
'<p>function to call when the\n soundfile has ended. The\n media element will be passed\n in as the argument to the\n callback.</p>\n',
type: 'Function'
}
],
class: 'p5.MediaElement',
module: 'DOM'
},
connect: {
name: 'connect',
params: [
{
name: 'audioNode',
description:
'<p>AudioNode from the Web Audio API,\nor an object from the p5.sound library</p>\n',
type: 'AudioNode|Object'
}
],
class: 'p5.MediaElement',
module: 'DOM'
},
disconnect: {
name: 'disconnect',
class: 'p5.MediaElement',
module: 'DOM'
},
showControls: {
name: 'showControls',
class: 'p5.MediaElement',
module: 'DOM'
},
hideControls: {
name: 'hideControls',
class: 'p5.MediaElement',
module: 'DOM'
},
addCue: {
name: 'addCue',
params: [
{
name: 'time',
description:
"<p>Time in seconds, relative to this media\n element's playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.</p>\n",
type: 'Number'
},
{
name: 'callback',
description:
'<p>Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.</p>\n',
type: 'Function'
},
{
name: 'value',
description:
'<p>An object to be passed as the\n second parameter to the\n callback function.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.MediaElement',
module: 'DOM'
},
removeCue: {
name: 'removeCue',
params: [
{
name: 'id',
description: '<p>ID of the cue, as returned by addCue</p>\n',
type: 'Number'
}
],
class: 'p5.MediaElement',
module: 'DOM'
},
clearCues: {
name: 'clearCues',
params: [
{
name: 'id',
description: '<p>ID of the cue, as returned by addCue</p>\n',
type: 'Number'
}
],
class: 'p5.MediaElement',
module: 'DOM'
}
},
'p5.File': {
file: {
name: 'file',
class: 'p5.File',
module: 'DOM'
},
type: {
name: 'type',
class: 'p5.File',
module: 'DOM'
},
subtype: {
name: 'subtype',
class: 'p5.File',
module: 'DOM'
},
name: {
name: 'name',
class: 'p5.File',
module: 'DOM'
},
size: {
name: 'size',
class: 'p5.File',
module: 'DOM'
},
data: {
name: 'data',
class: 'p5.File',
module: 'DOM'
}
},
'p5.Image': {
width: {
name: 'width',
class: 'p5.Image',
module: 'Image'
},
height: {
name: 'height',
class: 'p5.Image',
module: 'Image'
},
pixels: {
name: 'pixels',
class: 'p5.Image',
module: 'Image'
},
loadPixels: {
name: 'loadPixels',
class: 'p5.Image',
module: 'Image'
},
updatePixels: {
name: 'updatePixels',
class: 'p5.Image',
module: 'Image',
overloads: [
{
params: [
{
name: 'x',
description:
'<p>x-offset of the target update area for the\n underlying canvas</p>\n',
type: 'Integer'
},
{
name: 'y',
description:
'<p>y-offset of the target update area for the\n underlying canvas</p>\n',
type: 'Integer'
},
{
name: 'w',
description:
'<p>height of the target update area for the\n underlying canvas</p>\n',
type: 'Integer'
},
{
name: 'h',
description:
'<p>height of the target update area for the\n underlying canvas</p>\n',
type: 'Integer'
}
]
},
{
params: []
}
]
},
get: {
name: 'get',
class: 'p5.Image',
module: 'Image',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'w',
description: '<p>width</p>\n',
type: 'Number'
},
{
name: 'h',
description: '<p>height</p>\n',
type: 'Number'
}
]
},
{
params: []
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
}
]
}
]
},
set: {
name: 'set',
params: [
{
name: 'x',
description: '<p>x-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-coordinate of the pixel</p>\n',
type: 'Number'
},
{
name: 'a',
description:
'<p>grayscale value | pixel array |\n a <a href="#/p5.Color">p5.Color</a> | image to copy</p>\n',
type: 'Number|Number[]|Object'
}
],
class: 'p5.Image',
module: 'Image'
},
resize: {
name: 'resize',
params: [
{
name: 'width',
description: '<p>the resized image width</p>\n',
type: 'Number'
},
{
name: 'height',
description: '<p>the resized image height</p>\n',
type: 'Number'
}
],
class: 'p5.Image',
module: 'Image'
},
copy: {
name: 'copy',
class: 'p5.Image',
module: 'Image',
overloads: [
{
params: [
{
name: 'srcImage',
description: '<p>source image</p>\n',
type: 'p5.Image|p5.Element'
},
{
name: 'sx',
description:
"<p>X coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sy',
description:
"<p>Y coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sw',
description: '<p>source image width</p>\n',
type: 'Integer'
},
{
name: 'sh',
description: '<p>source image height</p>\n',
type: 'Integer'
},
{
name: 'dx',
description:
"<p>X coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dy',
description:
"<p>Y coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dw',
description: '<p>destination image width</p>\n',
type: 'Integer'
},
{
name: 'dh',
description: '<p>destination image height</p>\n',
type: 'Integer'
}
]
},
{
params: [
{
name: 'sx',
description: '',
type: 'Integer'
},
{
name: 'sy',
description: '',
type: 'Integer'
},
{
name: 'sw',
description: '',
type: 'Integer'
},
{
name: 'sh',
description: '',
type: 'Integer'
},
{
name: 'dx',
description: '',
type: 'Integer'
},
{
name: 'dy',
description: '',
type: 'Integer'
},
{
name: 'dw',
description: '',
type: 'Integer'
},
{
name: 'dh',
description: '',
type: 'Integer'
}
]
}
]
},
mask: {
name: 'mask',
params: [
{
name: 'srcImage',
description: '<p>source image</p>\n',
type: 'p5.Image'
}
],
class: 'p5.Image',
module: 'Image'
},
filter: {
name: 'filter',
params: [
{
name: 'filterType',
description:
'<p>either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, ERODE, DILATE or BLUR.\n See Filters.js for docs on\n each available filter</p>\n',
type: 'Constant'
},
{
name: 'filterParam',
description:
'<p>an optional parameter unique\n to each filter, see above</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Image',
module: 'Image'
},
blend: {
name: 'blend',
class: 'p5.Image',
module: 'Image',
overloads: [
{
params: [
{
name: 'srcImage',
description: '<p>source image</p>\n',
type: 'p5.Image'
},
{
name: 'sx',
description:
"<p>X coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sy',
description:
"<p>Y coordinate of the source's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'sw',
description: '<p>source image width</p>\n',
type: 'Integer'
},
{
name: 'sh',
description: '<p>source image height</p>\n',
type: 'Integer'
},
{
name: 'dx',
description:
"<p>X coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dy',
description:
"<p>Y coordinate of the destination's upper left corner</p>\n",
type: 'Integer'
},
{
name: 'dw',
description: '<p>destination image width</p>\n',
type: 'Integer'
},
{
name: 'dh',
description: '<p>destination image height</p>\n',
type: 'Integer'
},
{
name: 'blendMode',
description:
'<p>the blend mode. either\n BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.</p>\n<p>Available blend modes are: normal | multiply | screen | overlay |\n darken | lighten | color-dodge | color-burn | hard-light |\n soft-light | difference | exclusion | hue | saturation |\n color | luminosity</p>\n<p><a href="http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/">http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/</a></p>\n',
type: 'Constant'
}
]
},
{
params: [
{
name: 'sx',
description: '',
type: 'Integer'
},
{
name: 'sy',
description: '',
type: 'Integer'
},
{
name: 'sw',
description: '',
type: 'Integer'
},
{
name: 'sh',
description: '',
type: 'Integer'
},
{
name: 'dx',
description: '',
type: 'Integer'
},
{
name: 'dy',
description: '',
type: 'Integer'
},
{
name: 'dw',
description: '',
type: 'Integer'
},
{
name: 'dh',
description: '',
type: 'Integer'
},
{
name: 'blendMode',
description: '',
type: 'Constant'
}
]
}
]
},
save: {
name: 'save',
params: [
{
name: 'filename',
description: '<p>give your file a name</p>\n',
type: 'String'
},
{
name: 'extension',
description: "<p>'png' or 'jpg'</p>\n",
type: 'String'
}
],
class: 'p5.Image',
module: 'Image'
},
reset: {
name: 'reset',
class: 'p5.Image',
module: 'Image'
},
getCurrentFrame: {
name: 'getCurrentFrame',
class: 'p5.Image',
module: 'Image'
},
setFrame: {
name: 'setFrame',
params: [
{
name: 'index',
description:
'<p>the index for the frame that should be displayed</p>\n',
type: 'Number'
}
],
class: 'p5.Image',
module: 'Image'
},
numFrames: {
name: 'numFrames',
class: 'p5.Image',
module: 'Image'
},
play: {
name: 'play',
class: 'p5.Image',
module: 'Image'
},
pause: {
name: 'pause',
class: 'p5.Image',
module: 'Image'
},
delay: {
name: 'delay',
params: [
{
name: 'd',
description:
'<p>the amount in milliseconds to delay between switching frames</p>\n',
type: 'Number'
},
{
name: 'index',
description:
'<p>the index of the frame that should have the new delay value {optional}</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Image',
module: 'Image'
}
},
'p5.PrintWriter': {
write: {
name: 'write',
params: [
{
name: 'data',
description: '<p>all data to be written by the PrintWriter</p>\n',
type: 'Array'
}
],
class: 'p5.PrintWriter',
module: 'IO'
},
print: {
name: 'print',
params: [
{
name: 'data',
description: '<p>all data to be printed by the PrintWriter</p>\n',
type: 'Array'
}
],
class: 'p5.PrintWriter',
module: 'IO'
},
clear: {
name: 'clear',
class: 'p5.PrintWriter',
module: 'IO'
},
close: {
name: 'close',
class: 'p5.PrintWriter',
module: 'IO'
}
},
'p5.Table': {
columns: {
name: 'columns',
class: 'p5.Table',
module: 'IO'
},
rows: {
name: 'rows',
class: 'p5.Table',
module: 'IO'
},
addRow: {
name: 'addRow',
params: [
{
name: 'row',
description: '<p>row to be added to the table</p>\n',
type: 'p5.TableRow',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
removeRow: {
name: 'removeRow',
params: [
{
name: 'id',
description: '<p>ID number of the row to remove</p>\n',
type: 'Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
getRow: {
name: 'getRow',
params: [
{
name: 'rowID',
description: '<p>ID number of the row to get</p>\n',
type: 'Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
getRows: {
name: 'getRows',
class: 'p5.Table',
module: 'IO'
},
findRow: {
name: 'findRow',
params: [
{
name: 'value',
description: '<p>The value to match</p>\n',
type: 'String'
},
{
name: 'column',
description:
'<p>ID number or title of the\n column to search</p>\n',
type: 'Integer|String'
}
],
class: 'p5.Table',
module: 'IO'
},
findRows: {
name: 'findRows',
params: [
{
name: 'value',
description: '<p>The value to match</p>\n',
type: 'String'
},
{
name: 'column',
description:
'<p>ID number or title of the\n column to search</p>\n',
type: 'Integer|String'
}
],
class: 'p5.Table',
module: 'IO'
},
matchRow: {
name: 'matchRow',
params: [
{
name: 'regexp',
description: '<p>The regular expression to match</p>\n',
type: 'String|RegExp'
},
{
name: 'column',
description:
'<p>The column ID (number) or\n title (string)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
matchRows: {
name: 'matchRows',
params: [
{
name: 'regexp',
description: '<p>The regular expression to match</p>\n',
type: 'String'
},
{
name: 'column',
description:
'<p>The column ID (number) or\n title (string)</p>\n',
type: 'String|Integer',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
getColumn: {
name: 'getColumn',
params: [
{
name: 'column',
description: '<p>String or Number of the column to return</p>\n',
type: 'String|Number'
}
],
class: 'p5.Table',
module: 'IO'
},
clearRows: {
name: 'clearRows',
class: 'p5.Table',
module: 'IO'
},
addColumn: {
name: 'addColumn',
params: [
{
name: 'title',
description: '<p>title of the given column</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
getColumnCount: {
name: 'getColumnCount',
class: 'p5.Table',
module: 'IO'
},
getRowCount: {
name: 'getRowCount',
class: 'p5.Table',
module: 'IO'
},
removeTokens: {
name: 'removeTokens',
params: [
{
name: 'chars',
description: '<p>String listing characters to be removed</p>\n',
type: 'String'
},
{
name: 'column',
description:
'<p>Column ID (number)\n or name (string)</p>\n',
type: 'String|Integer',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
trim: {
name: 'trim',
params: [
{
name: 'column',
description:
'<p>Column ID (number)\n or name (string)</p>\n',
type: 'String|Integer',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
removeColumn: {
name: 'removeColumn',
params: [
{
name: 'column',
description: '<p>columnName (string) or ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
set: {
name: 'set',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>column ID (Number)\n or title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description: '<p>value to assign</p>\n',
type: 'String|Number'
}
],
class: 'p5.Table',
module: 'IO'
},
setNum: {
name: 'setNum',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>column ID (Number)\n or title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description: '<p>value to assign</p>\n',
type: 'Number'
}
],
class: 'p5.Table',
module: 'IO'
},
setString: {
name: 'setString',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>column ID (Number)\n or title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description: '<p>value to assign</p>\n',
type: 'String'
}
],
class: 'p5.Table',
module: 'IO'
},
get: {
name: 'get',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
getNum: {
name: 'getNum',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
getString: {
name: 'getString',
params: [
{
name: 'row',
description: '<p>row ID</p>\n',
type: 'Integer'
},
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.Table',
module: 'IO'
},
getObject: {
name: 'getObject',
params: [
{
name: 'headerColumn',
description:
'<p>Name of the column which should be used to\n title each row object (optional)</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.Table',
module: 'IO'
},
getArray: {
name: 'getArray',
class: 'p5.Table',
module: 'IO'
}
},
'p5.TableRow': {
set: {
name: 'set',
params: [
{
name: 'column',
description:
'<p>Column ID (Number)\n or Title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description: '<p>The value to be stored</p>\n',
type: 'String|Number'
}
],
class: 'p5.TableRow',
module: 'IO'
},
setNum: {
name: 'setNum',
params: [
{
name: 'column',
description:
'<p>Column ID (Number)\n or Title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description:
'<p>The value to be stored\n as a Float</p>\n',
type: 'Number|String'
}
],
class: 'p5.TableRow',
module: 'IO'
},
setString: {
name: 'setString',
params: [
{
name: 'column',
description:
'<p>Column ID (Number)\n or Title (String)</p>\n',
type: 'String|Integer'
},
{
name: 'value',
description:
'<p>The value to be stored\n as a String</p>\n',
type: 'String|Number|Boolean|Object'
}
],
class: 'p5.TableRow',
module: 'IO'
},
get: {
name: 'get',
params: [
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.TableRow',
module: 'IO'
},
getNum: {
name: 'getNum',
params: [
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.TableRow',
module: 'IO'
},
getString: {
name: 'getString',
params: [
{
name: 'column',
description:
'<p>columnName (string) or\n ID (number)</p>\n',
type: 'String|Integer'
}
],
class: 'p5.TableRow',
module: 'IO'
}
},
'p5.XML': {
getParent: {
name: 'getParent',
class: 'p5.XML',
module: 'IO'
},
getName: {
name: 'getName',
class: 'p5.XML',
module: 'IO'
},
setName: {
name: 'setName',
params: [
{
name: 'the',
description: '<p>new name of the node</p>\n',
type: 'String'
}
],
class: 'p5.XML',
module: 'IO'
},
hasChildren: {
name: 'hasChildren',
class: 'p5.XML',
module: 'IO'
},
listChildren: {
name: 'listChildren',
class: 'p5.XML',
module: 'IO'
},
getChildren: {
name: 'getChildren',
params: [
{
name: 'name',
description: '<p>element name</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.XML',
module: 'IO'
},
getChild: {
name: 'getChild',
params: [
{
name: 'name',
description: '<p>element name or index</p>\n',
type: 'String|Integer'
}
],
class: 'p5.XML',
module: 'IO'
},
addChild: {
name: 'addChild',
params: [
{
name: 'node',
description:
'<p>a <a href="#/p5.XML">p5.XML</a> Object which will be the child to be added</p>\n',
type: 'p5.XML'
}
],
class: 'p5.XML',
module: 'IO'
},
removeChild: {
name: 'removeChild',
params: [
{
name: 'name',
description: '<p>element name or index</p>\n',
type: 'String|Integer'
}
],
class: 'p5.XML',
module: 'IO'
},
getAttributeCount: {
name: 'getAttributeCount',
class: 'p5.XML',
module: 'IO'
},
listAttributes: {
name: 'listAttributes',
class: 'p5.XML',
module: 'IO'
},
hasAttribute: {
name: 'hasAttribute',
params: [
{
name: 'the',
description: '<p>attribute to be checked</p>\n',
type: 'String'
}
],
class: 'p5.XML',
module: 'IO'
},
getNum: {
name: 'getNum',
params: [
{
name: 'name',
description: '<p>the non-null full name of the attribute</p>\n',
type: 'String'
},
{
name: 'defaultValue',
description: '<p>the default value of the attribute</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.XML',
module: 'IO'
},
getString: {
name: 'getString',
params: [
{
name: 'name',
description: '<p>the non-null full name of the attribute</p>\n',
type: 'String'
},
{
name: 'defaultValue',
description: '<p>the default value of the attribute</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.XML',
module: 'IO'
},
setAttribute: {
name: 'setAttribute',
params: [
{
name: 'name',
description: '<p>the full name of the attribute</p>\n',
type: 'String'
},
{
name: 'value',
description: '<p>the value of the attribute</p>\n',
type: 'Number|String|Boolean'
}
],
class: 'p5.XML',
module: 'IO'
},
getContent: {
name: 'getContent',
params: [
{
name: 'defaultValue',
description: '<p>value returned if no content is found</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.XML',
module: 'IO'
},
setContent: {
name: 'setContent',
params: [
{
name: 'text',
description: '<p>the new content</p>\n',
type: 'String'
}
],
class: 'p5.XML',
module: 'IO'
},
serialize: {
name: 'serialize',
class: 'p5.XML',
module: 'IO'
}
},
'p5.Vector': {
x: {
name: 'x',
class: 'p5.Vector',
module: 'Math'
},
y: {
name: 'y',
class: 'p5.Vector',
module: 'Math'
},
z: {
name: 'z',
class: 'p5.Vector',
module: 'Math'
},
toString: {
name: 'toString',
class: 'p5.Vector',
module: 'Math'
},
set: {
name: 'set',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description: '<p>the y component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>the z component of the vector</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>the vector to set</p>\n',
type: 'p5.Vector|Number[]'
}
],
chainable: 1
}
]
},
copy: {
name: 'copy',
class: 'p5.Vector',
module: 'Math'
},
add: {
name: 'add',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component of the vector to be added</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>the y component of the vector to be added</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>the z component of the vector to be added</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>the vector to add</p>\n',
type: 'p5.Vector|Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description:
'<p>a <a href="#/p5.Vector">p5.Vector</a> to add</p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description:
'<p>a <a href="#/p5.Vector">p5.Vector</a> to add</p>\n',
type: 'p5.Vector'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
rem: {
name: 'rem',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component of divisor vector</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>the y component of divisor vector</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>the z component of divisor vector</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>divisor vector</p>\n',
type: 'p5.Vector | Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description:
'<p>dividend <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description: '<p>divisor <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
],
static: 1
},
{
params: [
{
name: 'v1',
description: '',
type: 'p5.Vector'
},
{
name: 'v2',
description: '',
type: 'p5.Vector'
}
],
static: 1
}
]
},
sub: {
name: 'sub',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component of the vector to subtract</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>the y component of the vector to subtract</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>the z component of the vector to subtract</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'value',
description: '<p>the vector to subtract</p>\n',
type: 'p5.Vector|Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description:
'<p>a <a href="#/p5.Vector">p5.Vector</a> to subtract from</p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description:
'<p>a <a href="#/p5.Vector">p5.Vector</a> to subtract</p>\n',
type: 'p5.Vector'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
mult: {
name: 'mult',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'n',
description: '<p>The number to multiply with the vector</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description:
'<p>The number to multiply with the x component of the vector</p>\n',
type: 'Number'
},
{
name: 'y',
description:
'<p>The number to multiply with the y component of the vector</p>\n',
type: 'Number'
},
{
name: 'z',
description:
'<p>The number to multiply with the z component of the vector</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'arr',
description:
'<p>The array to multiply with the components of the vector</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'v',
description:
'<p>The vector to multiply with the components of the original vector</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v',
description: '',
type: 'p5.Vector'
},
{
name: 'n',
description: '',
type: 'Number'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v0',
description: '',
type: 'p5.Vector'
},
{
name: 'v1',
description: '',
type: 'p5.Vector'
},
{
name: 'target',
description: '',
type: 'p5.Vector',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v0',
description: '',
type: 'p5.Vector'
},
{
name: 'arr',
description: '',
type: 'Number[]'
},
{
name: 'target',
description: '',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
div: {
name: 'div',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'n',
description: '<p>The number to divide the vector by</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description:
'<p>The number to divide with the x component of the vector</p>\n',
type: 'Number'
},
{
name: 'y',
description:
'<p>The number to divide with the y component of the vector</p>\n',
type: 'Number'
},
{
name: 'z',
description:
'<p>The number to divide with the z component of the vector</p>\n',
type: 'Number',
optional: true
}
],
chainable: 1
},
{
params: [
{
name: 'arr',
description:
'<p>The array to divide the components of the vector by</p>\n',
type: 'Number[]'
}
],
chainable: 1
},
{
params: [
{
name: 'v',
description:
'<p>The vector to divide the components of the original vector by</p>\n',
type: 'p5.Vector'
}
],
chainable: 1
},
{
params: [
{
name: 'x',
description: '',
type: 'Number'
},
{
name: 'y',
description: '',
type: 'Number'
},
{
name: 'z',
description: '',
type: 'Number',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v',
description: '',
type: 'p5.Vector'
},
{
name: 'n',
description: '',
type: 'Number'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v0',
description: '',
type: 'p5.Vector'
},
{
name: 'v1',
description: '',
type: 'p5.Vector'
},
{
name: 'target',
description: '',
type: 'p5.Vector',
optional: true
}
],
static: 1
},
{
params: [
{
name: 'v0',
description: '',
type: 'p5.Vector'
},
{
name: 'arr',
description: '',
type: 'Number[]'
},
{
name: 'target',
description: '',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
mag: {
name: 'mag',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: []
},
{
params: [
{
name: 'vecT',
description: '<p>the vector to return the magnitude of</p>\n',
type: 'p5.Vector'
}
],
static: 1
}
]
},
magSq: {
name: 'magSq',
class: 'p5.Vector',
module: 'Math'
},
dot: {
name: 'dot',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>x component of the vector</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>z component of the vector</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'value',
description:
'<p>value component of the vector or a <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
]
},
{
params: [
{
name: 'v1',
description:
'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description:
'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
],
static: 1
}
]
},
cross: {
name: 'cross',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'v',
description:
'<p><a href="#/p5.Vector">p5.Vector</a> to be crossed</p>\n',
type: 'p5.Vector'
}
]
},
{
params: [
{
name: 'v1',
description:
'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description:
'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
],
static: 1
}
]
},
dist: {
name: 'dist',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'v',
description:
'<p>the x, y, and z coordinates of a <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
]
},
{
params: [
{
name: 'v1',
description:
'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
},
{
name: 'v2',
description:
'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
],
static: 1
}
]
},
normalize: {
name: 'normalize',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: []
},
{
params: [
{
name: 'v',
description: '<p>the vector to normalize</p>\n',
type: 'p5.Vector'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
limit: {
name: 'limit',
params: [
{
name: 'max',
description: '<p>the maximum magnitude for the vector</p>\n',
type: 'Number'
}
],
class: 'p5.Vector',
module: 'Math'
},
setMag: {
name: 'setMag',
params: [
{
name: 'len',
description: '<p>the new length for this vector</p>\n',
type: 'Number'
}
],
class: 'p5.Vector',
module: 'Math'
},
heading: {
name: 'heading',
class: 'p5.Vector',
module: 'Math'
},
setHeading: {
name: 'setHeading',
params: [
{
name: 'angle',
description: '<p>the angle of rotation</p>\n',
type: 'Number'
}
],
class: 'p5.Vector',
module: 'Math'
},
rotate: {
name: 'rotate',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'angle',
description: '<p>the angle of rotation</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'v',
description: '',
type: 'p5.Vector'
},
{
name: 'angle',
description: '',
type: 'Number'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
angleBetween: {
name: 'angleBetween',
params: [
{
name: 'value',
description:
'<p>the x, y, and z components of a <a href="#/p5.Vector">p5.Vector</a></p>\n',
type: 'p5.Vector'
}
],
class: 'p5.Vector',
module: 'Math'
},
lerp: {
name: 'lerp',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>the y component</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>the z component</p>\n',
type: 'Number'
},
{
name: 'amt',
description:
'<p>the amount of interpolation; some value between 0.0\n (old vector) and 1.0 (new vector). 0.9 is very near\n the new vector. 0.5 is halfway in between.</p>\n',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'v',
description:
'<p>the <a href="#/p5.Vector">p5.Vector</a> to lerp to</p>\n',
type: 'p5.Vector'
},
{
name: 'amt',
description: '',
type: 'Number'
}
],
chainable: 1
},
{
params: [
{
name: 'v1',
description: '',
type: 'p5.Vector'
},
{
name: 'v2',
description: '',
type: 'p5.Vector'
},
{
name: 'amt',
description: '',
type: 'Number'
},
{
name: 'target',
description: '<p>the vector to receive the result</p>\n',
type: 'p5.Vector',
optional: true
}
],
static: 1
}
]
},
reflect: {
name: 'reflect',
params: [
{
name: 'surfaceNormal',
description:
'<p>the <a href="#/p5.Vector">p5.Vector</a> to reflect about, will be normalized by this method</p>\n',
type: 'p5.Vector'
}
],
class: 'p5.Vector',
module: 'Math'
},
array: {
name: 'array',
class: 'p5.Vector',
module: 'Math'
},
equals: {
name: 'equals',
class: 'p5.Vector',
module: 'Math',
overloads: [
{
params: [
{
name: 'x',
description: '<p>the x component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'y',
description: '<p>the y component of the vector</p>\n',
type: 'Number',
optional: true
},
{
name: 'z',
description: '<p>the z component of the vector</p>\n',
type: 'Number',
optional: true
}
]
},
{
params: [
{
name: 'value',
description: '<p>the vector to compare</p>\n',
type: 'p5.Vector|Array'
}
]
}
]
},
fromAngle: {
name: 'fromAngle',
params: [
{
name: 'angle',
description:
'<p>the desired angle, in radians (unaffected by <a href="#/p5/angleMode">angleMode</a>)</p>\n',
type: 'Number'
},
{
name: 'length',
description: '<p>the length of the new vector (defaults to 1)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Vector',
module: 'Math'
},
fromAngles: {
name: 'fromAngles',
params: [
{
name: 'theta',
description: '<p>the polar angle, in radians (zero is up)</p>\n',
type: 'Number'
},
{
name: 'phi',
description:
'<p>the azimuthal angle, in radians\n (zero is out of the screen)</p>\n',
type: 'Number'
},
{
name: 'length',
description: '<p>the length of the new vector (defaults to 1)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Vector',
module: 'Math'
},
random2D: {
name: 'random2D',
class: 'p5.Vector',
module: 'Math'
},
random3D: {
name: 'random3D',
class: 'p5.Vector',
module: 'Math'
}
},
'p5.Font': {
font: {
name: 'font',
class: 'p5.Font',
module: 'Typography'
},
textBounds: {
name: 'textBounds',
params: [
{
name: 'line',
description: '<p>a line of text</p>\n',
type: 'String'
},
{
name: 'x',
description: '<p>x-position</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-position</p>\n',
type: 'Number'
},
{
name: 'fontSize',
description: '<p>font size to use (optional) Default is 12.</p>\n',
type: 'Number',
optional: true
},
{
name: 'options',
description:
"<p>opentype options (optional)\n opentype fonts contains alignment and baseline options.\n Default is 'LEFT' and 'alphabetic'</p>\n",
type: 'Object',
optional: true
}
],
class: 'p5.Font',
module: 'Typography'
},
textToPoints: {
name: 'textToPoints',
params: [
{
name: 'txt',
description: '<p>a line of text</p>\n',
type: 'String'
},
{
name: 'x',
description: '<p>x-position</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y-position</p>\n',
type: 'Number'
},
{
name: 'fontSize',
description: '<p>font size to use (optional)</p>\n',
type: 'Number'
},
{
name: 'options',
description:
'<p>an (optional) object that can contain:</p>\n<p><br>sampleFactor - the ratio of path-length to number of samples\n(default=.1); higher values yield more points and are therefore\nmore precise</p>\n<p><br>simplifyThreshold - if set to a non-zero value, collinear points will be\nbe removed from the polygon; the value represents the threshold angle to use\nwhen determining whether two edges are collinear</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.Font',
module: 'Typography'
}
},
'p5.Camera': {
eyeX: {
name: 'eyeX',
class: 'p5.Camera',
module: 'Lights, Camera'
},
eyeY: {
name: 'eyeY',
class: 'p5.Camera',
module: 'Lights, Camera'
},
eyeZ: {
name: 'eyeZ',
class: 'p5.Camera',
module: 'Lights, Camera'
},
centerX: {
name: 'centerX',
class: 'p5.Camera',
module: 'Lights, Camera'
},
centerY: {
name: 'centerY',
class: 'p5.Camera',
module: 'Lights, Camera'
},
centerZ: {
name: 'centerZ',
class: 'p5.Camera',
module: 'Lights, Camera'
},
upX: {
name: 'upX',
class: 'p5.Camera',
module: 'Lights, Camera'
},
upY: {
name: 'upY',
class: 'p5.Camera',
module: 'Lights, Camera'
},
upZ: {
name: 'upZ',
class: 'p5.Camera',
module: 'Lights, Camera'
},
perspective: {
name: 'perspective',
class: 'p5.Camera',
module: 'Lights, Camera'
},
ortho: {
name: 'ortho',
class: 'p5.Camera',
module: 'Lights, Camera'
},
frustum: {
name: 'frustum',
class: 'p5.Camera',
module: 'Lights, Camera'
},
pan: {
name: 'pan',
params: [
{
name: 'angle',
description:
'<p>amount to rotate camera in current\n<a href="#/p5/angleMode">angleMode</a> units.\nGreater than 0 values rotate counterclockwise (to the left).</p>\n',
type: 'Number'
}
],
class: 'p5.Camera',
module: 'Lights, Camera'
},
tilt: {
name: 'tilt',
params: [
{
name: 'angle',
description:
'<p>amount to rotate camera in current\n<a href="#/p5/angleMode">angleMode</a> units.\nGreater than 0 values rotate counterclockwise (to the left).</p>\n',
type: 'Number'
}
],
class: 'p5.Camera',
module: 'Lights, Camera'
},
lookAt: {
name: 'lookAt',
params: [
{
name: 'x',
description: '<p>x position of a point in world space</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y position of a point in world space</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>z position of a point in world space</p>\n',
type: 'Number'
}
],
class: 'p5.Camera',
module: 'Lights, Camera'
},
camera: {
name: 'camera',
class: 'p5.Camera',
module: 'Lights, Camera'
},
move: {
name: 'move',
params: [
{
name: 'x',
description: "<p>amount to move along camera's left-right axis</p>\n",
type: 'Number'
},
{
name: 'y',
description: "<p>amount to move along camera's up-down axis</p>\n",
type: 'Number'
},
{
name: 'z',
description:
"<p>amount to move along camera's forward-backward axis</p>\n",
type: 'Number'
}
],
class: 'p5.Camera',
module: 'Lights, Camera'
},
setPosition: {
name: 'setPosition',
params: [
{
name: 'x',
description: '<p>x position of a point in world space</p>\n',
type: 'Number'
},
{
name: 'y',
description: '<p>y position of a point in world space</p>\n',
type: 'Number'
},
{
name: 'z',
description: '<p>z position of a point in world space</p>\n',
type: 'Number'
}
],
class: 'p5.Camera',
module: 'Lights, Camera'
}
},
'p5.Geometry': {
computeFaces: {
name: 'computeFaces',
class: 'p5.Geometry',
module: 'Shape'
},
computeNormals: {
name: 'computeNormals',
class: 'p5.Geometry',
module: 'Shape'
},
averageNormals: {
name: 'averageNormals',
class: 'p5.Geometry',
module: 'Shape'
},
averagePoleNormals: {
name: 'averagePoleNormals',
class: 'p5.Geometry',
module: 'Shape'
},
normalize: {
name: 'normalize',
class: 'p5.Geometry',
module: 'Shape'
}
},
'p5.Shader': {
setUniform: {
name: 'setUniform',
params: [
{
name: 'uniformName',
description: '<p>the name of the uniform in the\nshader program</p>\n',
type: 'String'
},
{
name: 'data',
description:
'<p>the data to be associated\nwith that uniform; type varies (could be a single numerical value, array,\nmatrix, or texture / sampler reference)</p>\n',
type: 'Object|Number|Boolean|Number[]'
}
],
class: 'p5.Shader',
module: 'Lights, Camera'
}
},
'p5.SoundFile': {
isLoaded: {
name: 'isLoaded',
class: 'p5.SoundFile',
module: 'p5.sound'
},
play: {
name: 'play',
params: [
{
name: 'startTime',
description:
'<p>(optional) schedule playback to start (in seconds from now).</p>\n',
type: 'Number',
optional: true
},
{
name: 'rate',
description: '<p>(optional) playback rate</p>\n',
type: 'Number',
optional: true
},
{
name: 'amp',
description:
'<p>(optional) amplitude (volume)\n of playback</p>\n',
type: 'Number',
optional: true
},
{
name: 'cueStart',
description: '<p>(optional) cue start time in seconds</p>\n',
type: 'Number',
optional: true
},
{
name: 'duration',
description: '<p>(optional) duration of playback in seconds</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
playMode: {
name: 'playMode',
params: [
{
name: 'str',
description: "<p>'restart' or 'sustain' or 'untilDone'</p>\n",
type: 'String'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
pause: {
name: 'pause',
params: [
{
name: 'startTime',
description:
'<p>(optional) schedule event to occur\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
loop: {
name: 'loop',
params: [
{
name: 'startTime',
description:
'<p>(optional) schedule event to occur\n seconds from now</p>\n',
type: 'Number',
optional: true
},
{
name: 'rate',
description: '<p>(optional) playback rate</p>\n',
type: 'Number',
optional: true
},
{
name: 'amp',
description: '<p>(optional) playback volume</p>\n',
type: 'Number',
optional: true
},
{
name: 'cueLoopStart',
description: '<p>(optional) startTime in seconds</p>\n',
type: 'Number',
optional: true
},
{
name: 'duration',
description: '<p>(optional) loop duration in seconds</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
setLoop: {
name: 'setLoop',
params: [
{
name: 'Boolean',
description: '<p>set looping to true or false</p>\n',
type: 'Boolean'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
isLooping: {
name: 'isLooping',
class: 'p5.SoundFile',
module: 'p5.sound'
},
isPlaying: {
name: 'isPlaying',
class: 'p5.SoundFile',
module: 'p5.sound'
},
isPaused: {
name: 'isPaused',
class: 'p5.SoundFile',
module: 'p5.sound'
},
stop: {
name: 'stop',
params: [
{
name: 'startTime',
description:
'<p>(optional) schedule event to occur\n in seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
pan: {
name: 'pan',
params: [
{
name: 'panValue',
description: '<p>Set the stereo panner</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
getPan: {
name: 'getPan',
class: 'p5.SoundFile',
module: 'p5.sound'
},
rate: {
name: 'rate',
params: [
{
name: 'playbackRate',
description:
'<p>Set the playback rate. 1.0 is normal,\n .5 is half-speed, 2.0 is twice as fast.\n Values less than zero play backwards.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
setVolume: {
name: 'setVolume',
params: [
{
name: 'volume',
description:
'<p>Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator</p>\n',
type: 'Number|Object'
},
{
name: 'rampTime',
description: '<p>Fade for t seconds</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>Schedule this event to happen at\n t seconds in the future</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
duration: {
name: 'duration',
class: 'p5.SoundFile',
module: 'p5.sound'
},
currentTime: {
name: 'currentTime',
class: 'p5.SoundFile',
module: 'p5.sound'
},
jump: {
name: 'jump',
params: [
{
name: 'cueTime',
description: '<p>cueTime of the soundFile in seconds.</p>\n',
type: 'Number'
},
{
name: 'duration',
description: '<p>duration in seconds.</p>\n',
type: 'Number'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
channels: {
name: 'channels',
class: 'p5.SoundFile',
module: 'p5.sound'
},
sampleRate: {
name: 'sampleRate',
class: 'p5.SoundFile',
module: 'p5.sound'
},
frames: {
name: 'frames',
class: 'p5.SoundFile',
module: 'p5.sound'
},
getPeaks: {
name: 'getPeaks',
params: [
{
name: 'length',
description:
'<p>length is the size of the returned array.\n Larger length results in more precision.\n Defaults to 5*width of the browser window.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
reverseBuffer: {
name: 'reverseBuffer',
class: 'p5.SoundFile',
module: 'p5.sound'
},
onended: {
name: 'onended',
params: [
{
name: 'callback',
description:
'<p>function to call when the\n soundfile has ended.</p>\n',
type: 'Function'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'object',
description: '<p>Audio object that accepts an input</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.SoundFile',
module: 'p5.sound'
},
setPath: {
name: 'setPath',
params: [
{
name: 'path',
description: '<p>path to audio file</p>\n',
type: 'String'
},
{
name: 'callback',
description: '<p>Callback</p>\n',
type: 'Function'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
setBuffer: {
name: 'setBuffer',
params: [
{
name: 'buf',
description:
'<p>Array of Float32 Array(s). 2 Float32 Arrays\n will create a stereo source. 1 will create\n a mono source.</p>\n',
type: 'Array'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
addCue: {
name: 'addCue',
params: [
{
name: 'time',
description:
"<p>Time in seconds, relative to this media\n element's playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.</p>\n",
type: 'Number'
},
{
name: 'callback',
description:
'<p>Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.</p>\n',
type: 'Function'
},
{
name: 'value',
description:
'<p>An object to be passed as the\n second parameter to the\n callback function.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
removeCue: {
name: 'removeCue',
params: [
{
name: 'id',
description: '<p>ID of the cue, as returned by addCue</p>\n',
type: 'Number'
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
clearCues: {
name: 'clearCues',
class: 'p5.SoundFile',
module: 'p5.sound'
},
save: {
name: 'save',
params: [
{
name: 'fileName',
description: '<p>name of the resulting .wav file.</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.SoundFile',
module: 'p5.sound'
},
getBlob: {
name: 'getBlob',
class: 'p5.SoundFile',
module: 'p5.sound'
}
},
'p5.Amplitude': {
setInput: {
name: 'setInput',
params: [
{
name: 'snd',
description:
'<p>set the sound source\n (optional, defaults to\n main output)</p>\n',
type: 'SoundObject|undefined',
optional: true
},
{
name: 'smoothing',
description:
'<p>a range between 0.0 and 1.0\n to smooth amplitude readings</p>\n',
type: 'Number|undefined',
optional: true
}
],
class: 'p5.Amplitude',
module: 'p5.sound'
},
getLevel: {
name: 'getLevel',
params: [
{
name: 'channel',
description:
'<p>Optionally return only channel 0 (left) or 1 (right)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Amplitude',
module: 'p5.sound'
},
toggleNormalize: {
name: 'toggleNormalize',
params: [
{
name: 'boolean',
description: '<p>set normalize to true (1) or false (0)</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5.Amplitude',
module: 'p5.sound'
},
smooth: {
name: 'smooth',
params: [
{
name: 'set',
description: '<p>smoothing from 0.0 <= 1</p>\n',
type: 'Number'
}
],
class: 'p5.Amplitude',
module: 'p5.sound'
}
},
'p5.FFT': {
setInput: {
name: 'setInput',
params: [
{
name: 'source',
description: '<p>p5.sound object (or web audio API source node)</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
waveform: {
name: 'waveform',
params: [
{
name: 'bins',
description:
'<p>Must be a power of two between\n 16 and 1024. Defaults to 1024.</p>\n',
type: 'Number',
optional: true
},
{
name: 'precision',
description:
'<p>If any value is provided, will return results\n in a Float32 Array which is more precise\n than a regular array.</p>\n',
type: 'String',
optional: true
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
analyze: {
name: 'analyze',
params: [
{
name: 'bins',
description:
'<p>Must be a power of two between\n 16 and 1024. Defaults to 1024.</p>\n',
type: 'Number',
optional: true
},
{
name: 'scale',
description:
'<p>If "dB," returns decibel\n float measurements between\n -140 and 0 (max).\n Otherwise returns integers from 0-255.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
getEnergy: {
name: 'getEnergy',
params: [
{
name: 'frequency1',
description:
'<p>Will return a value representing\n energy at this frequency. Alternately,\n the strings "bass", "lowMid" "mid",\n "highMid", and "treble" will return\n predefined frequency ranges.</p>\n',
type: 'Number|String'
},
{
name: 'frequency2',
description:
'<p>If a second frequency is given,\n will return average amount of\n energy that exists between the\n two frequencies.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
getCentroid: {
name: 'getCentroid',
class: 'p5.FFT',
module: 'p5.sound'
},
smooth: {
name: 'smooth',
params: [
{
name: 'smoothing',
description:
'<p>0.0 < smoothing < 1.0.\n Defaults to 0.8.</p>\n',
type: 'Number'
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
linAverages: {
name: 'linAverages',
params: [
{
name: 'N',
description: '<p>Number of returned frequency groups</p>\n',
type: 'Number'
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
logAverages: {
name: 'logAverages',
params: [
{
name: 'octaveBands',
description: '<p>Array of Octave Bands objects for grouping</p>\n',
type: 'Array'
}
],
class: 'p5.FFT',
module: 'p5.sound'
},
getOctaveBands: {
name: 'getOctaveBands',
params: [
{
name: 'N',
description:
'<p>Specifies the 1/N type of generated octave bands</p>\n',
type: 'Number'
},
{
name: 'fCtr0',
description: '<p>Minimum central frequency for the lowest band</p>\n',
type: 'Number'
}
],
class: 'p5.FFT',
module: 'p5.sound'
}
},
'p5.Oscillator': {
start: {
name: 'start',
params: [
{
name: 'time',
description: '<p>startTime in seconds from now.</p>\n',
type: 'Number',
optional: true
},
{
name: 'frequency',
description: '<p>frequency in Hz.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
stop: {
name: 'stop',
params: [
{
name: 'secondsFromNow',
description: '<p>Time, in seconds from now.</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'vol',
description:
'<p>between 0 and 1.0\n or a modulating signal/oscillator</p>\n',
type: 'Number|Object'
},
{
name: 'rampTime',
description: '<p>create a fade that lasts rampTime</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
getAmp: {
name: 'getAmp',
class: 'p5.Oscillator',
module: 'p5.sound'
},
freq: {
name: 'freq',
params: [
{
name: 'Frequency',
description:
'<p>Frequency in Hz\n or modulating signal/oscillator</p>\n',
type: 'Number|Object'
},
{
name: 'rampTime',
description: '<p>Ramp time (in seconds)</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>Schedule this event to happen\n at x seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
getFreq: {
name: 'getFreq',
class: 'p5.Oscillator',
module: 'p5.sound'
},
setType: {
name: 'setType',
params: [
{
name: 'type',
description: "<p>'sine', 'triangle', 'sawtooth' or 'square'.</p>\n",
type: 'String'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
getType: {
name: 'getType',
class: 'p5.Oscillator',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '<p>A p5.sound or Web Audio object</p>\n',
type: 'Object'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.Oscillator',
module: 'p5.sound'
},
pan: {
name: 'pan',
params: [
{
name: 'panning',
description: '<p>Number between -1 and 1</p>\n',
type: 'Number'
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
getPan: {
name: 'getPan',
class: 'p5.Oscillator',
module: 'p5.sound'
},
phase: {
name: 'phase',
params: [
{
name: 'phase',
description: '<p>float between 0.0 and 1.0</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
add: {
name: 'add',
params: [
{
name: 'number',
description: '<p>Constant number to add</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
mult: {
name: 'mult',
params: [
{
name: 'number',
description: '<p>Constant number to multiply</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
},
scale: {
name: 'scale',
params: [
{
name: 'inMin',
description: '<p>input range minumum</p>\n',
type: 'Number'
},
{
name: 'inMax',
description: '<p>input range maximum</p>\n',
type: 'Number'
},
{
name: 'outMin',
description: '<p>input range minumum</p>\n',
type: 'Number'
},
{
name: 'outMax',
description: '<p>input range maximum</p>\n',
type: 'Number'
}
],
class: 'p5.Oscillator',
module: 'p5.sound'
}
},
'p5.Envelope': {
attackTime: {
name: 'attackTime',
class: 'p5.Envelope',
module: 'p5.sound'
},
attackLevel: {
name: 'attackLevel',
class: 'p5.Envelope',
module: 'p5.sound'
},
decayTime: {
name: 'decayTime',
class: 'p5.Envelope',
module: 'p5.sound'
},
decayLevel: {
name: 'decayLevel',
class: 'p5.Envelope',
module: 'p5.sound'
},
releaseTime: {
name: 'releaseTime',
class: 'p5.Envelope',
module: 'p5.sound'
},
releaseLevel: {
name: 'releaseLevel',
class: 'p5.Envelope',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'attackTime',
description:
'<p>Time (in seconds) before level\n reaches attackLevel</p>\n',
type: 'Number'
},
{
name: 'attackLevel',
description:
'<p>Typically an amplitude between\n 0.0 and 1.0</p>\n',
type: 'Number'
},
{
name: 'decayTime',
description: '<p>Time</p>\n',
type: 'Number'
},
{
name: 'decayLevel',
description:
'<p>Amplitude (In a standard ADSR envelope,\n decayLevel = sustainLevel)</p>\n',
type: 'Number'
},
{
name: 'releaseTime',
description: '<p>Release Time (in seconds)</p>\n',
type: 'Number'
},
{
name: 'releaseLevel',
description: '<p>Amplitude</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
setADSR: {
name: 'setADSR',
params: [
{
name: 'attackTime',
description:
'<p>Time (in seconds before envelope\n reaches Attack Level</p>\n',
type: 'Number'
},
{
name: 'decayTime',
description:
'<p>Time (in seconds) before envelope\n reaches Decay/Sustain Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'susRatio',
description:
'<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using <code>setRange</code>),\n then decayLevel would increase proportionally, to become 0.5.</p>\n',
type: 'Number',
optional: true
},
{
name: 'releaseTime',
description: '<p>Time in seconds from now (defaults to 0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
setRange: {
name: 'setRange',
params: [
{
name: 'aLevel',
description: '<p>attack level (defaults to 1)</p>\n',
type: 'Number'
},
{
name: 'rLevel',
description: '<p>release level (defaults to 0)</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
setInput: {
name: 'setInput',
params: [
{
name: 'inputs',
description:
'<p>A p5.sound object or\n Web Audio Param.</p>\n',
type: 'Object',
optional: true,
multiple: true
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
setExp: {
name: 'setExp',
params: [
{
name: 'isExp',
description: '<p>true is exponential, false is linear</p>\n',
type: 'Boolean'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
play: {
name: 'play',
params: [
{
name: 'unit',
description:
'<p>A p5.sound object or\n Web Audio Param.</p>\n',
type: 'Object'
},
{
name: 'startTime',
description: '<p>time from now (in seconds) at which to play</p>\n',
type: 'Number',
optional: true
},
{
name: 'sustainTime',
description: '<p>time to sustain before releasing the envelope</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
triggerAttack: {
name: 'triggerAttack',
params: [
{
name: 'unit',
description: '<p>p5.sound Object or Web Audio Param</p>\n',
type: 'Object'
},
{
name: 'secondsFromNow',
description: '<p>time from now (in seconds)</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
triggerRelease: {
name: 'triggerRelease',
params: [
{
name: 'unit',
description: '<p>p5.sound Object or Web Audio Param</p>\n',
type: 'Object'
},
{
name: 'secondsFromNow',
description: '<p>time to trigger the release</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
ramp: {
name: 'ramp',
params: [
{
name: 'unit',
description: '<p>p5.sound Object or Web Audio Param</p>\n',
type: 'Object'
},
{
name: 'secondsFromNow',
description: '<p>When to trigger the ramp</p>\n',
type: 'Number'
},
{
name: 'v',
description: '<p>Target value</p>\n',
type: 'Number'
},
{
name: 'v2',
description: '<p>Second target value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
add: {
name: 'add',
params: [
{
name: 'number',
description: '<p>Constant number to add</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
mult: {
name: 'mult',
params: [
{
name: 'number',
description: '<p>Constant number to multiply</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
},
scale: {
name: 'scale',
params: [
{
name: 'inMin',
description: '<p>input range minumum</p>\n',
type: 'Number'
},
{
name: 'inMax',
description: '<p>input range maximum</p>\n',
type: 'Number'
},
{
name: 'outMin',
description: '<p>input range minumum</p>\n',
type: 'Number'
},
{
name: 'outMax',
description: '<p>input range maximum</p>\n',
type: 'Number'
}
],
class: 'p5.Envelope',
module: 'p5.sound'
}
},
'p5.Noise': {
setType: {
name: 'setType',
params: [
{
name: 'type',
description: "<p>'white', 'pink' or 'brown'</p>\n",
type: 'String',
optional: true
}
],
class: 'p5.Noise',
module: 'p5.sound'
}
},
'p5.Pulse': {
width: {
name: 'width',
params: [
{
name: 'width',
description:
'<p>Width between the pulses (0 to 1.0,\n defaults to 0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Pulse',
module: 'p5.sound'
}
},
'p5.AudioIn': {
input: {
name: 'input',
class: 'p5.AudioIn',
module: 'p5.sound'
},
output: {
name: 'output',
class: 'p5.AudioIn',
module: 'p5.sound'
},
stream: {
name: 'stream',
class: 'p5.AudioIn',
module: 'p5.sound'
},
mediaStream: {
name: 'mediaStream',
class: 'p5.AudioIn',
module: 'p5.sound'
},
currentSource: {
name: 'currentSource',
class: 'p5.AudioIn',
module: 'p5.sound'
},
enabled: {
name: 'enabled',
class: 'p5.AudioIn',
module: 'p5.sound'
},
amplitude: {
name: 'amplitude',
class: 'p5.AudioIn',
module: 'p5.sound'
},
start: {
name: 'start',
params: [
{
name: 'successCallback',
description:
'<p>Name of a function to call on\n success.</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>Name of a function to call if\n there was an error. For example,\n some browsers do not support\n getUserMedia.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
},
stop: {
name: 'stop',
class: 'p5.AudioIn',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description:
'<p>An object that accepts audio input,\n such as an FFT</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.AudioIn',
module: 'p5.sound'
},
getLevel: {
name: 'getLevel',
params: [
{
name: 'smoothing',
description:
'<p>Smoothing is 0.0 by default.\n Smooths values based on previous values.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'vol',
description: '<p>between 0 and 1.0</p>\n',
type: 'Number'
},
{
name: 'time',
description: '<p>ramp time (optional)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
},
getSources: {
name: 'getSources',
params: [
{
name: 'successCallback',
description:
'<p>This callback function handles the sources when they\n have been enumerated. The callback function\n receives the deviceList array as its only argument</p>\n',
type: 'Function',
optional: true
},
{
name: 'errorCallback',
description:
'<p>This optional callback receives the error\n message as its argument.</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
},
setSource: {
name: 'setSource',
params: [
{
name: 'num',
description: '<p>position of input source in the array</p>\n',
type: 'Number'
}
],
class: 'p5.AudioIn',
module: 'p5.sound'
}
},
'p5.Effect': {
amp: {
name: 'amp',
params: [
{
name: 'vol',
description: '<p>amplitude between 0 and 1.0</p>\n',
type: 'Number',
optional: true
},
{
name: 'rampTime',
description: '<p>create a fade that lasts until rampTime</p>\n',
type: 'Number',
optional: true
},
{
name: 'tFromNow',
description:
'<p>schedule this event to happen in tFromNow seconds</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Effect',
module: 'p5.sound'
},
chain: {
name: 'chain',
params: [
{
name: 'arguments',
description: '<p>Chain together multiple sound objects</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.Effect',
module: 'p5.sound'
},
drywet: {
name: 'drywet',
params: [
{
name: 'fade',
description: '<p>The desired drywet value (0 - 1.0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Effect',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '',
type: 'Object'
}
],
class: 'p5.Effect',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.Effect',
module: 'p5.sound'
}
},
'p5.Filter': {
biquadFilter: {
name: 'biquadFilter',
class: 'p5.Filter',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'Signal',
description: '<p>An object that outputs audio</p>\n',
type: 'Object'
},
{
name: 'freq',
description: '<p>Frequency in Hz, from 10 to 22050</p>\n',
type: 'Number',
optional: true
},
{
name: 'res',
description:
'<p>Resonance/Width of the filter frequency\n from 0.001 to 1000</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Filter',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'freq',
description: '<p>Frequency in Hz, from 10 to 22050</p>\n',
type: 'Number',
optional: true
},
{
name: 'res',
description: '<p>Resonance (Q) from 0.001 to 1000</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Filter',
module: 'p5.sound'
},
freq: {
name: 'freq',
params: [
{
name: 'freq',
description: '<p>Filter Frequency</p>\n',
type: 'Number'
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Filter',
module: 'p5.sound'
},
res: {
name: 'res',
params: [
{
name: 'res',
description:
'<p>Resonance/Width of filter freq\n from 0.001 to 1000</p>\n',
type: 'Number'
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Filter',
module: 'p5.sound'
},
gain: {
name: 'gain',
params: [
{
name: 'gain',
description: '',
type: 'Number'
}
],
class: 'p5.Filter',
module: 'p5.sound'
},
toggle: {
name: 'toggle',
class: 'p5.Filter',
module: 'p5.sound'
},
setType: {
name: 'setType',
params: [
{
name: 't',
description: '',
type: 'String'
}
],
class: 'p5.Filter',
module: 'p5.sound'
}
},
'p5.EQ': {
bands: {
name: 'bands',
class: 'p5.EQ',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'src',
description: '<p>Audio source</p>\n',
type: 'Object'
}
],
class: 'p5.EQ',
module: 'p5.sound'
}
},
'p5.Panner3D': {
panner: {
name: 'panner',
class: 'p5.Panner3D',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'src',
description: '<p>Input source</p>\n',
type: 'Object'
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'xVal',
description: '',
type: 'Number'
},
{
name: 'yVal',
description: '',
type: 'Number'
},
{
name: 'zVal',
description: '',
type: 'Number'
},
{
name: 'time',
description: '',
type: 'Number'
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
},
positionX: {
name: 'positionX',
class: 'p5.Panner3D',
module: 'p5.sound'
},
positionY: {
name: 'positionY',
class: 'p5.Panner3D',
module: 'p5.sound'
},
positionZ: {
name: 'positionZ',
class: 'p5.Panner3D',
module: 'p5.sound'
},
orient: {
name: 'orient',
params: [
{
name: 'xVal',
description: '',
type: 'Number'
},
{
name: 'yVal',
description: '',
type: 'Number'
},
{
name: 'zVal',
description: '',
type: 'Number'
},
{
name: 'time',
description: '',
type: 'Number'
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
},
orientX: {
name: 'orientX',
class: 'p5.Panner3D',
module: 'p5.sound'
},
orientY: {
name: 'orientY',
class: 'p5.Panner3D',
module: 'p5.sound'
},
orientZ: {
name: 'orientZ',
class: 'p5.Panner3D',
module: 'p5.sound'
},
setFalloff: {
name: 'setFalloff',
params: [
{
name: 'maxDistance',
description: '',
type: 'Number',
optional: true
},
{
name: 'rolloffFactor',
description: '',
type: 'Number',
optional: true
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
},
maxDist: {
name: 'maxDist',
params: [
{
name: 'maxDistance',
description: '',
type: 'Number'
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
},
rollof: {
name: 'rollof',
params: [
{
name: 'rolloffFactor',
description: '',
type: 'Number'
}
],
class: 'p5.Panner3D',
module: 'p5.sound'
}
},
'p5.Delay': {
leftDelay: {
name: 'leftDelay',
class: 'p5.Delay',
module: 'p5.sound'
},
rightDelay: {
name: 'rightDelay',
class: 'p5.Delay',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'Signal',
description: '<p>An object that outputs audio</p>\n',
type: 'Object'
},
{
name: 'delayTime',
description:
'<p>Time (in seconds) of the delay/echo.\n Some browsers limit delayTime to\n 1 second.</p>\n',
type: 'Number',
optional: true
},
{
name: 'feedback',
description:
'<p>sends the delay back through itself\n in a loop that decreases in volume\n each time.</p>\n',
type: 'Number',
optional: true
},
{
name: 'lowPass',
description:
'<p>Cutoff frequency. Only frequencies\n below the lowPass will be part of the\n delay.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
delayTime: {
name: 'delayTime',
params: [
{
name: 'delayTime',
description: '<p>Time (in seconds) of the delay</p>\n',
type: 'Number'
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
feedback: {
name: 'feedback',
params: [
{
name: 'feedback',
description:
'<p>0.0 to 1.0, or an object such as an\n Oscillator that can be used to\n modulate this param</p>\n',
type: 'Number|Object'
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
filter: {
name: 'filter',
params: [
{
name: 'cutoffFreq',
description:
'<p>A lowpass filter will cut off any\n frequencies higher than the filter frequency.</p>\n',
type: 'Number|Object'
},
{
name: 'res',
description:
'<p>Resonance of the filter frequency\n cutoff, or an object (i.e. a p5.Oscillator)\n that can be used to modulate this parameter.\n High numbers (i.e. 15) will produce a resonance,\n low numbers (i.e. .2) will produce a slope.</p>\n',
type: 'Number|Object'
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
setType: {
name: 'setType',
params: [
{
name: 'type',
description: "<p>'pingPong' (1) or 'default' (0)</p>\n",
type: 'String|Number'
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'volume',
description: '<p>amplitude between 0 and 1.0</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>create a fade that lasts rampTime</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '',
type: 'Object'
}
],
class: 'p5.Delay',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.Delay',
module: 'p5.sound'
}
},
'p5.Reverb': {
process: {
name: 'process',
params: [
{
name: 'src',
description:
'<p>p5.sound / Web Audio object with a sound\n output.</p>\n',
type: 'Object'
},
{
name: 'seconds',
description:
'<p>Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.</p>\n',
type: 'Number',
optional: true
},
{
name: 'decayRate',
description:
'<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n',
type: 'Number',
optional: true
},
{
name: 'reverse',
description: '<p>Play the reverb backwards or forwards.</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5.Reverb',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'seconds',
description:
'<p>Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.</p>\n',
type: 'Number',
optional: true
},
{
name: 'decayRate',
description:
'<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n',
type: 'Number',
optional: true
},
{
name: 'reverse',
description: '<p>Play the reverb backwards or forwards.</p>\n',
type: 'Boolean',
optional: true
}
],
class: 'p5.Reverb',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'volume',
description: '<p>amplitude between 0 and 1.0</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>create a fade that lasts rampTime</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Reverb',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '',
type: 'Object'
}
],
class: 'p5.Reverb',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.Reverb',
module: 'p5.sound'
}
},
'p5.Convolver': {
convolverNode: {
name: 'convolverNode',
class: 'p5.Convolver',
module: 'p5.sound'
},
impulses: {
name: 'impulses',
class: 'p5.Convolver',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'src',
description:
'<p>p5.sound / Web Audio object with a sound\n output.</p>\n',
type: 'Object'
}
],
class: 'p5.Convolver',
module: 'p5.sound'
},
addImpulse: {
name: 'addImpulse',
params: [
{
name: 'path',
description: '<p>path to a sound file</p>\n',
type: 'String'
},
{
name: 'callback',
description: '<p>function (optional)</p>\n',
type: 'Function'
},
{
name: 'errorCallback',
description: '<p>function (optional)</p>\n',
type: 'Function'
}
],
class: 'p5.Convolver',
module: 'p5.sound'
},
resetImpulse: {
name: 'resetImpulse',
params: [
{
name: 'path',
description: '<p>path to a sound file</p>\n',
type: 'String'
},
{
name: 'callback',
description: '<p>function (optional)</p>\n',
type: 'Function'
},
{
name: 'errorCallback',
description: '<p>function (optional)</p>\n',
type: 'Function'
}
],
class: 'p5.Convolver',
module: 'p5.sound'
},
toggleImpulse: {
name: 'toggleImpulse',
params: [
{
name: 'id',
description:
'<p>Identify the impulse by its original filename\n (String), or by its position in the\n <code>.impulses</code> Array (Number).</p>\n',
type: 'String|Number'
}
],
class: 'p5.Convolver',
module: 'p5.sound'
}
},
'p5.Phrase': {
sequence: {
name: 'sequence',
class: 'p5.Phrase',
module: 'p5.sound'
}
},
'p5.Part': {
setBPM: {
name: 'setBPM',
params: [
{
name: 'BPM',
description: '<p>Beats Per Minute</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>Seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Part',
module: 'p5.sound'
},
getBPM: {
name: 'getBPM',
class: 'p5.Part',
module: 'p5.sound'
},
start: {
name: 'start',
params: [
{
name: 'time',
description: '<p>seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Part',
module: 'p5.sound'
},
loop: {
name: 'loop',
params: [
{
name: 'time',
description: '<p>seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Part',
module: 'p5.sound'
},
noLoop: {
name: 'noLoop',
class: 'p5.Part',
module: 'p5.sound'
},
stop: {
name: 'stop',
params: [
{
name: 'time',
description: '<p>seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Part',
module: 'p5.sound'
},
pause: {
name: 'pause',
params: [
{
name: 'time',
description: '<p>seconds from now</p>\n',
type: 'Number'
}
],
class: 'p5.Part',
module: 'p5.sound'
},
addPhrase: {
name: 'addPhrase',
params: [
{
name: 'phrase',
description: '<p>reference to a p5.Phrase</p>\n',
type: 'p5.Phrase'
}
],
class: 'p5.Part',
module: 'p5.sound'
},
removePhrase: {
name: 'removePhrase',
params: [
{
name: 'phraseName',
description: '',
type: 'String'
}
],
class: 'p5.Part',
module: 'p5.sound'
},
getPhrase: {
name: 'getPhrase',
params: [
{
name: 'phraseName',
description: '',
type: 'String'
}
],
class: 'p5.Part',
module: 'p5.sound'
},
replaceSequence: {
name: 'replaceSequence',
params: [
{
name: 'phraseName',
description: '',
type: 'String'
},
{
name: 'sequence',
description:
'<p>Array of values to pass into the callback\n at each step of the phrase.</p>\n',
type: 'Array'
}
],
class: 'p5.Part',
module: 'p5.sound'
},
onStep: {
name: 'onStep',
params: [
{
name: 'callback',
description:
'<p>The name of the callback\n you want to fire\n on every beat/tatum.</p>\n',
type: 'Function'
}
],
class: 'p5.Part',
module: 'p5.sound'
}
},
'p5.Score': {
start: {
name: 'start',
class: 'p5.Score',
module: 'p5.sound'
},
stop: {
name: 'stop',
class: 'p5.Score',
module: 'p5.sound'
},
pause: {
name: 'pause',
class: 'p5.Score',
module: 'p5.sound'
},
loop: {
name: 'loop',
class: 'p5.Score',
module: 'p5.sound'
},
noLoop: {
name: 'noLoop',
class: 'p5.Score',
module: 'p5.sound'
},
setBPM: {
name: 'setBPM',
params: [
{
name: 'BPM',
description: '<p>Beats Per Minute</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>Seconds from now</p>\n',
type: 'Number'
}
],
class: 'p5.Score',
module: 'p5.sound'
}
},
'p5.SoundLoop': {
bpm: {
name: 'bpm',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
timeSignature: {
name: 'timeSignature',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
interval: {
name: 'interval',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
iterations: {
name: 'iterations',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
musicalTimeMode: {
name: 'musicalTimeMode',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
maxIterations: {
name: 'maxIterations',
class: 'p5.SoundLoop',
module: 'p5.sound'
},
start: {
name: 'start',
params: [
{
name: 'timeFromNow',
description: '<p>schedule a starting time</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundLoop',
module: 'p5.sound'
},
stop: {
name: 'stop',
params: [
{
name: 'timeFromNow',
description: '<p>schedule a stopping time</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundLoop',
module: 'p5.sound'
},
pause: {
name: 'pause',
params: [
{
name: 'timeFromNow',
description: '<p>schedule a pausing time</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundLoop',
module: 'p5.sound'
},
syncedStart: {
name: 'syncedStart',
params: [
{
name: 'otherLoop',
description: '<p>a p5.SoundLoop to sync with</p>\n',
type: 'Object'
},
{
name: 'timeFromNow',
description:
'<p>Start the loops in sync after timeFromNow seconds</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.SoundLoop',
module: 'p5.sound'
}
},
'p5.Compressor': {
compressor: {
name: 'compressor',
class: 'p5.Compressor',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'src',
description: '<p>Sound source to be connected</p>\n',
type: 'Object'
},
{
name: 'attack',
description:
'<p>The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n',
type: 'Number',
optional: true
},
{
name: 'knee',
description:
'<p>A decibel value representing the range above the\n threshold where the curve smoothly transitions to the "ratio" portion.\n default = 30, range 0 - 40</p>\n',
type: 'Number',
optional: true
},
{
name: 'ratio',
description:
'<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n',
type: 'Number',
optional: true
},
{
name: 'threshold',
description:
'<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n',
type: 'Number',
optional: true
},
{
name: 'release',
description:
'<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'attack',
description:
'<p>The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n',
type: 'Number'
},
{
name: 'knee',
description:
'<p>A decibel value representing the range above the\n threshold where the curve smoothly transitions to the "ratio" portion.\n default = 30, range 0 - 40</p>\n',
type: 'Number'
},
{
name: 'ratio',
description:
'<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n',
type: 'Number'
},
{
name: 'threshold',
description:
'<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n',
type: 'Number'
},
{
name: 'release',
description:
'<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n',
type: 'Number'
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
attack: {
name: 'attack',
params: [
{
name: 'attack',
description:
'<p>Attack is the amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n',
type: 'Number',
optional: true
},
{
name: 'time',
description:
'<p>Assign time value to schedule the change in value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
knee: {
name: 'knee',
params: [
{
name: 'knee',
description:
'<p>A decibel value representing the range above the\n threshold where the curve smoothly transitions to the "ratio" portion.\n default = 30, range 0 - 40</p>\n',
type: 'Number',
optional: true
},
{
name: 'time',
description:
'<p>Assign time value to schedule the change in value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
ratio: {
name: 'ratio',
params: [
{
name: 'ratio',
description:
'<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n',
type: 'Number',
optional: true
},
{
name: 'time',
description:
'<p>Assign time value to schedule the change in value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
threshold: {
name: 'threshold',
params: [
{
name: 'threshold',
description:
'<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n',
type: 'Number'
},
{
name: 'time',
description:
'<p>Assign time value to schedule the change in value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
release: {
name: 'release',
params: [
{
name: 'release',
description:
'<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n',
type: 'Number'
},
{
name: 'time',
description:
'<p>Assign time value to schedule the change in value</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Compressor',
module: 'p5.sound'
},
reduction: {
name: 'reduction',
class: 'p5.Compressor',
module: 'p5.sound'
}
},
'p5.PeakDetect': {
isDetected: {
name: 'isDetected',
class: 'p5.PeakDetect',
module: 'p5.sound'
},
update: {
name: 'update',
params: [
{
name: 'fftObject',
description: '<p>A p5.FFT object</p>\n',
type: 'p5.FFT'
}
],
class: 'p5.PeakDetect',
module: 'p5.sound'
},
onPeak: {
name: 'onPeak',
params: [
{
name: 'callback',
description:
'<p>Name of a function that will\n be called when a peak is\n detected.</p>\n',
type: 'Function'
},
{
name: 'val',
description:
'<p>Optional value to pass\n into the function when\n a peak is detected.</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.PeakDetect',
module: 'p5.sound'
}
},
'p5.SoundRecorder': {
setInput: {
name: 'setInput',
params: [
{
name: 'unit',
description:
'<p>p5.sound object or a web audio unit\n that outputs sound</p>\n',
type: 'Object',
optional: true
}
],
class: 'p5.SoundRecorder',
module: 'p5.sound'
},
record: {
name: 'record',
params: [
{
name: 'soundFile',
description: '<p>p5.SoundFile</p>\n',
type: 'p5.SoundFile'
},
{
name: 'duration',
description: '<p>Time (in seconds)</p>\n',
type: 'Number',
optional: true
},
{
name: 'callback',
description:
'<p>The name of a function that will be\n called once the recording completes</p>\n',
type: 'Function',
optional: true
}
],
class: 'p5.SoundRecorder',
module: 'p5.sound'
},
stop: {
name: 'stop',
class: 'p5.SoundRecorder',
module: 'p5.sound'
}
},
'p5.Distortion': {
WaveShaperNode: {
name: 'WaveShaperNode',
class: 'p5.Distortion',
module: 'p5.sound'
},
process: {
name: 'process',
params: [
{
name: 'amount',
description:
'<p>Unbounded distortion amount.\n Normal values range from 0-1.</p>\n',
type: 'Number',
optional: true,
optdefault: '0.25'
},
{
name: 'oversample',
description: "<p>'none', '2x', or '4x'.</p>\n",
type: 'String',
optional: true,
optdefault: "'none'"
}
],
class: 'p5.Distortion',
module: 'p5.sound'
},
set: {
name: 'set',
params: [
{
name: 'amount',
description:
'<p>Unbounded distortion amount.\n Normal values range from 0-1.</p>\n',
type: 'Number',
optional: true,
optdefault: '0.25'
},
{
name: 'oversample',
description: "<p>'none', '2x', or '4x'.</p>\n",
type: 'String',
optional: true,
optdefault: "'none'"
}
],
class: 'p5.Distortion',
module: 'p5.sound'
},
getAmount: {
name: 'getAmount',
class: 'p5.Distortion',
module: 'p5.sound'
},
getOversample: {
name: 'getOversample',
class: 'p5.Distortion',
module: 'p5.sound'
}
},
'p5.Gain': {
setInput: {
name: 'setInput',
params: [
{
name: 'src',
description:
'<p>p5.sound / Web Audio object with a sound\n output.</p>\n',
type: 'Object'
}
],
class: 'p5.Gain',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '',
type: 'Object'
}
],
class: 'p5.Gain',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.Gain',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'volume',
description: '<p>amplitude between 0 and 1.0</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>create a fade that lasts rampTime</p>\n',
type: 'Number',
optional: true
},
{
name: 'timeFromNow',
description:
'<p>schedule this event to happen\n seconds from now</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.Gain',
module: 'p5.sound'
}
},
'p5.AudioVoice': {
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '',
type: 'Object'
}
],
class: 'p5.AudioVoice',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.AudioVoice',
module: 'p5.sound'
}
},
'p5.MonoSynth': {
attack: {
name: 'attack',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
decay: {
name: 'decay',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
sustain: {
name: 'sustain',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
release: {
name: 'release',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
play: {
name: 'play',
params: [
{
name: 'note',
description:
'<p>the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format ("C4", "Eb3"...etc")\n See <a href = "https://github.com/Tonejs/Tone.js/wiki/Instruments">\n Tone</a>. Defaults to 440 hz.</p>\n',
type: 'String | Number'
},
{
name: 'velocity',
description:
'<p>velocity of the note to play (ranging from 0 to 1)</p>\n',
type: 'Number',
optional: true
},
{
name: 'secondsFromNow',
description: '<p>time from now (in seconds) at which to play</p>\n',
type: 'Number',
optional: true
},
{
name: 'sustainTime',
description:
'<p>time to sustain before releasing the envelope. Defaults to 0.15 seconds.</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.MonoSynth',
module: 'p5.sound'
},
triggerAttack: {
params: [
{
name: 'note',
description:
'<p>the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format ("C4", "Eb3"...etc")\n See <a href = "https://github.com/Tonejs/Tone.js/wiki/Instruments">\n Tone</a>. Defaults to 440 hz</p>\n',
type: 'String | Number'
},
{
name: 'velocity',
description:
'<p>velocity of the note to play (ranging from 0 to 1)</p>\n',
type: 'Number',
optional: true
},
{
name: 'secondsFromNow',
description: '<p>time from now (in seconds) at which to play</p>\n',
type: 'Number',
optional: true
}
],
name: 'triggerAttack',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
triggerRelease: {
params: [
{
name: 'secondsFromNow',
description: '<p>time to trigger the release</p>\n',
type: 'Number'
}
],
name: 'triggerRelease',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
setADSR: {
name: 'setADSR',
params: [
{
name: 'attackTime',
description:
'<p>Time (in seconds before envelope\n reaches Attack Level</p>\n',
type: 'Number'
},
{
name: 'decayTime',
description:
'<p>Time (in seconds) before envelope\n reaches Decay/Sustain Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'susRatio',
description:
'<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using <code>setRange</code>),\n then decayLevel would increase proportionally, to become 0.5.</p>\n',
type: 'Number',
optional: true
},
{
name: 'releaseTime',
description: '<p>Time in seconds from now (defaults to 0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.MonoSynth',
module: 'p5.sound'
},
amp: {
name: 'amp',
params: [
{
name: 'vol',
description: '<p>desired volume</p>\n',
type: 'Number'
},
{
name: 'rampTime',
description: '<p>Time to reach new volume</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.MonoSynth',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '<p>A p5.sound or Web Audio object</p>\n',
type: 'Object'
}
],
class: 'p5.MonoSynth',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.MonoSynth',
module: 'p5.sound'
},
dispose: {
name: 'dispose',
class: 'p5.MonoSynth',
module: 'p5.sound'
}
},
'p5.PolySynth': {
notes: {
name: 'notes',
class: 'p5.PolySynth',
module: 'p5.sound'
},
polyvalue: {
name: 'polyvalue',
class: 'p5.PolySynth',
module: 'p5.sound'
},
AudioVoice: {
name: 'AudioVoice',
class: 'p5.PolySynth',
module: 'p5.sound'
},
play: {
name: 'play',
params: [
{
name: 'note',
description:
'<p>midi note to play (ranging from 0 to 127 - 60 being a middle C)</p>\n',
type: 'Number',
optional: true
},
{
name: 'velocity',
description:
'<p>velocity of the note to play (ranging from 0 to 1)</p>\n',
type: 'Number',
optional: true
},
{
name: 'secondsFromNow',
description: '<p>time from now (in seconds) at which to play</p>\n',
type: 'Number',
optional: true
},
{
name: 'sustainTime',
description: '<p>time to sustain before releasing the envelope</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
noteADSR: {
name: 'noteADSR',
params: [
{
name: 'note',
description: '<p>Midi note on which ADSR should be set.</p>\n',
type: 'Number',
optional: true
},
{
name: 'attackTime',
description:
'<p>Time (in seconds before envelope\n reaches Attack Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'decayTime',
description:
'<p>Time (in seconds) before envelope\n reaches Decay/Sustain Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'susRatio',
description:
'<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using <code>setRange</code>),\n then decayLevel would increase proportionally, to become 0.5.</p>\n',
type: 'Number',
optional: true
},
{
name: 'releaseTime',
description: '<p>Time in seconds from now (defaults to 0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
setADSR: {
name: 'setADSR',
params: [
{
name: 'attackTime',
description:
'<p>Time (in seconds before envelope\n reaches Attack Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'decayTime',
description:
'<p>Time (in seconds) before envelope\n reaches Decay/Sustain Level</p>\n',
type: 'Number',
optional: true
},
{
name: 'susRatio',
description:
'<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using <code>setRange</code>),\n then decayLevel would increase proportionally, to become 0.5.</p>\n',
type: 'Number',
optional: true
},
{
name: 'releaseTime',
description: '<p>Time in seconds from now (defaults to 0)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
noteAttack: {
name: 'noteAttack',
params: [
{
name: 'note',
description: '<p>midi note on which attack should be triggered.</p>\n',
type: 'Number',
optional: true
},
{
name: 'velocity',
description:
'<p>velocity of the note to play (ranging from 0 to 1)/</p>\n',
type: 'Number',
optional: true
},
{
name: 'secondsFromNow',
description: '<p>time from now (in seconds)</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
noteRelease: {
name: 'noteRelease',
params: [
{
name: 'note',
description:
'<p>midi note on which attack should be triggered.\n If no value is provided, all notes will be released.</p>\n',
type: 'Number',
optional: true
},
{
name: 'secondsFromNow',
description: '<p>time to trigger the release</p>\n',
type: 'Number',
optional: true
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
connect: {
name: 'connect',
params: [
{
name: 'unit',
description: '<p>A p5.sound or Web Audio object</p>\n',
type: 'Object'
}
],
class: 'p5.PolySynth',
module: 'p5.sound'
},
disconnect: {
name: 'disconnect',
class: 'p5.PolySynth',
module: 'p5.sound'
},
dispose: {
name: 'dispose',
class: 'p5.PolySynth',
module: 'p5.sound'
}
}
};
},
{}
],
2: [
function(_dereq_, module, exports) {
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
module.exports = _arrayWithHoles;
},
{}
],
3: [
function(_dereq_, module, exports) {
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
module.exports = _arrayWithoutHoles;
},
{}
],
4: [
function(_dereq_, module, exports) {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
module.exports = _assertThisInitialized;
},
{}
],
5: [
function(_dereq_, module, exports) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
module.exports = _classCallCheck;
},
{}
],
6: [
function(_dereq_, module, exports) {
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
module.exports = _createClass;
},
{}
],
7: [
function(_dereq_, module, exports) {
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
module.exports = _defineProperty;
},
{}
],
8: [
function(_dereq_, module, exports) {
function _getPrototypeOf(o) {
module.exports = _getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
module.exports = _getPrototypeOf;
},
{}
],
9: [
function(_dereq_, module, exports) {
var setPrototypeOf = _dereq_('./setPrototypeOf');
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) setPrototypeOf(subClass, superClass);
}
module.exports = _inherits;
},
{ './setPrototypeOf': 16 }
],
10: [
function(_dereq_, module, exports) {
function _iterableToArray(iter) {
if (
Symbol.iterator in Object(iter) ||
Object.prototype.toString.call(iter) === '[object Arguments]'
)
return Array.from(iter);
}
module.exports = _iterableToArray;
},
{}
],
11: [
function(_dereq_, module, exports) {
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (
var _i = arr[Symbol.iterator](), _s;
!(_n = (_s = _i.next()).done);
_n = true
) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i['return'] != null) _i['return']();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
module.exports = _iterableToArrayLimit;
},
{}
],
12: [
function(_dereq_, module, exports) {
function _nonIterableRest() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
}
module.exports = _nonIterableRest;
},
{}
],
13: [
function(_dereq_, module, exports) {
function _nonIterableSpread() {
throw new TypeError('Invalid attempt to spread non-iterable instance');
}
module.exports = _nonIterableSpread;
},
{}
],
14: [
function(_dereq_, module, exports) {
var defineProperty = _dereq_('./defineProperty');
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
defineProperty(target, key, source[key]);
});
}
return target;
}
module.exports = _objectSpread;
},
{ './defineProperty': 7 }
],
15: [
function(_dereq_, module, exports) {
var _typeof = _dereq_('../helpers/typeof');
var assertThisInitialized = _dereq_('./assertThisInitialized');
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return assertThisInitialized(self);
}
module.exports = _possibleConstructorReturn;
},
{ '../helpers/typeof': 19, './assertThisInitialized': 4 }
],
16: [
function(_dereq_, module, exports) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf;
},
{}
],
17: [
function(_dereq_, module, exports) {
var arrayWithHoles = _dereq_('./arrayWithHoles');
var iterableToArrayLimit = _dereq_('./iterableToArrayLimit');
var nonIterableRest = _dereq_('./nonIterableRest');
function _slicedToArray(arr, i) {
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
}
module.exports = _slicedToArray;
},
{ './arrayWithHoles': 2, './iterableToArrayLimit': 11, './nonIterableRest': 12 }
],
18: [
function(_dereq_, module, exports) {
var arrayWithoutHoles = _dereq_('./arrayWithoutHoles');
var iterableToArray = _dereq_('./iterableToArray');
var nonIterableSpread = _dereq_('./nonIterableSpread');
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
}
module.exports = _toConsumableArray;
},
{ './arrayWithoutHoles': 3, './iterableToArray': 10, './nonIterableSpread': 13 }
],
19: [
function(_dereq_, module, exports) {
function _typeof2(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof2 = function _typeof2(obj) {
return typeof obj;
};
} else {
_typeof2 = function _typeof2(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof2(obj);
}
function _typeof(obj) {
if (typeof Symbol === 'function' && _typeof2(Symbol.iterator) === 'symbol') {
module.exports = _typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
module.exports = _typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: _typeof2(obj);
};
}
return _typeof(obj);
}
module.exports = _typeof;
},
{}
],
20: [
function(_dereq_, module, exports) {
'use strict';
exports.byteLength = byteLength;
exports.toByteArray = toByteArray;
exports.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('');
}
},
{}
],
21: [function(_dereq_, module, exports) {}, {}],
22: [
function(_dereq_, module, exports) {
(function(Buffer) {
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
'use strict';
var base64 = _dereq_('base64-js');
var ieee754 = _dereq_('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 '<Buffer ' + str + '>';
};
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 base64.fromByteArray(buf);
} else {
return base64.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 += hexSliceLookupTable[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.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.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.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.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.4028234663852886e38,
-3.4028234663852886e38
);
}
ieee754.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.7976931348623157e308,
-1.7976931348623157e308
);
}
ieee754.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 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 base64.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
}
// Create lookup table for `toString('hex')`
// See: https://github.com/feross/buffer/issues/219
var hexSliceLookupTable = (function() {
var alphabet = '0123456789abcdef';
var table = new Array(256);
for (var i = 0; i < 16; ++i) {
var i16 = i * 16;
for (var j = 0; j < 16; ++j) {
table[i16 + j] = alphabet[i] + alphabet[j];
}
}
return table;
})();
}.call(this, _dereq_('buffer').Buffer));
},
{ 'base64-js': 20, buffer: 22, ieee754: 255 }
],
23: [
function(_dereq_, module, exports) {
module.exports = function(it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
}
return it;
};
},
{}
],
24: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
module.exports = function(it) {
if (!isObject(it) && it !== null) {
throw TypeError("Can't set " + String(it) + ' as a prototype');
}
return it;
};
},
{ '../internals/is-object': 91 }
],
25: [
function(_dereq_, module, exports) {
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var create = _dereq_('../internals/object-create');
var definePropertyModule = _dereq_('../internals/object-define-property');
var UNSCOPABLES = wellKnownSymbol('unscopables');
var ArrayPrototype = Array.prototype;
// Array.prototype[@@unscopables]
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype[UNSCOPABLES] == undefined) {
definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
configurable: true,
value: create(null)
});
}
// add a key to Array.prototype[@@unscopables]
module.exports = function(key) {
ArrayPrototype[UNSCOPABLES][key] = true;
};
},
{
'../internals/object-create': 107,
'../internals/object-define-property': 109,
'../internals/well-known-symbol': 163
}
],
26: [
function(_dereq_, module, exports) {
'use strict';
var charAt = _dereq_('../internals/string-multibyte').charAt;
// `AdvanceStringIndex` abstract operation
// https://tc39.github.io/ecma262/#sec-advancestringindex
module.exports = function(S, index, unicode) {
return index + (unicode ? charAt(S, index).length : 1);
};
},
{ '../internals/string-multibyte': 140 }
],
27: [
function(_dereq_, module, exports) {
module.exports = function(it, Constructor, name) {
if (!(it instanceof Constructor)) {
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
}
return it;
};
},
{}
],
28: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
module.exports = function(it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
}
return it;
};
},
{ '../internals/is-object': 91 }
],
29: [
function(_dereq_, module, exports) {
module.exports =
typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
},
{}
],
30: [
function(_dereq_, module, exports) {
'use strict';
var NATIVE_ARRAY_BUFFER = _dereq_('../internals/array-buffer-native');
var DESCRIPTORS = _dereq_('../internals/descriptors');
var global = _dereq_('../internals/global');
var isObject = _dereq_('../internals/is-object');
var has = _dereq_('../internals/has');
var classof = _dereq_('../internals/classof');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var redefine = _dereq_('../internals/redefine');
var defineProperty = _dereq_('../internals/object-define-property').f;
var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var uid = _dereq_('../internals/uid');
var Int8Array = global.Int8Array;
var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
var Uint8ClampedArray = global.Uint8ClampedArray;
var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
var TypedArray = Int8Array && getPrototypeOf(Int8Array);
var TypedArrayPrototype =
Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
var ObjectPrototype = Object.prototype;
var isPrototypeOf = ObjectPrototype.isPrototypeOf;
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
var NATIVE_ARRAY_BUFFER_VIEWS =
NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
var TYPED_ARRAY_TAG_REQIRED = false;
var NAME;
var TypedArrayConstructorsList = {
Int8Array: 1,
Uint8Array: 1,
Uint8ClampedArray: 1,
Int16Array: 2,
Uint16Array: 2,
Int32Array: 4,
Uint32Array: 4,
Float32Array: 4,
Float64Array: 8
};
var isView = function isView(it) {
var klass = classof(it);
return klass === 'DataView' || has(TypedArrayConstructorsList, klass);
};
var isTypedArray = function(it) {
return isObject(it) && has(TypedArrayConstructorsList, classof(it));
};
var aTypedArray = function(it) {
if (isTypedArray(it)) return it;
throw TypeError('Target is not a typed array');
};
var aTypedArrayConstructor = function(C) {
if (setPrototypeOf) {
if (isPrototypeOf.call(TypedArray, C)) return C;
} else
for (var ARRAY in TypedArrayConstructorsList)
if (has(TypedArrayConstructorsList, NAME)) {
var TypedArrayConstructor = global[ARRAY];
if (
TypedArrayConstructor &&
(C === TypedArrayConstructor ||
isPrototypeOf.call(TypedArrayConstructor, C))
) {
return C;
}
}
throw TypeError('Target is not a typed array constructor');
};
var exportTypedArrayMethod = function(KEY, property, forced) {
if (!DESCRIPTORS) return;
if (forced)
for (var ARRAY in TypedArrayConstructorsList) {
var TypedArrayConstructor = global[ARRAY];
if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
delete TypedArrayConstructor.prototype[KEY];
}
}
if (!TypedArrayPrototype[KEY] || forced) {
redefine(
TypedArrayPrototype,
KEY,
forced
? property
: (NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY]) || property
);
}
};
var exportTypedArrayStaticMethod = function(KEY, property, forced) {
var ARRAY, TypedArrayConstructor;
if (!DESCRIPTORS) return;
if (setPrototypeOf) {
if (forced)
for (ARRAY in TypedArrayConstructorsList) {
TypedArrayConstructor = global[ARRAY];
if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
delete TypedArrayConstructor[KEY];
}
}
if (!TypedArray[KEY] || forced) {
// V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
try {
return redefine(
TypedArray,
KEY,
forced
? property
: (NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY]) || property
);
} catch (error) {
/* empty */
}
} else return;
}
for (ARRAY in TypedArrayConstructorsList) {
TypedArrayConstructor = global[ARRAY];
if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
redefine(TypedArrayConstructor, KEY, property);
}
}
};
for (NAME in TypedArrayConstructorsList) {
if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false;
}
// WebKit bug - typed arrays constructors prototype is Object.prototype
if (
!NATIVE_ARRAY_BUFFER_VIEWS ||
typeof TypedArray != 'function' ||
TypedArray === Function.prototype
) {
// eslint-disable-next-line no-shadow
TypedArray = function TypedArray() {
throw TypeError('Incorrect invocation');
};
if (NATIVE_ARRAY_BUFFER_VIEWS)
for (NAME in TypedArrayConstructorsList) {
if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
}
}
if (
!NATIVE_ARRAY_BUFFER_VIEWS ||
!TypedArrayPrototype ||
TypedArrayPrototype === ObjectPrototype
) {
TypedArrayPrototype = TypedArray.prototype;
if (NATIVE_ARRAY_BUFFER_VIEWS)
for (NAME in TypedArrayConstructorsList) {
if (global[NAME])
setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
}
}
// WebKit bug - one more object in Uint8ClampedArray prototype chain
if (
NATIVE_ARRAY_BUFFER_VIEWS &&
getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype
) {
setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
}
if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
TYPED_ARRAY_TAG_REQIRED = true;
defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
get: function() {
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
}
});
for (NAME in TypedArrayConstructorsList)
if (global[NAME]) {
createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
}
}
module.exports = {
NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
aTypedArray: aTypedArray,
aTypedArrayConstructor: aTypedArrayConstructor,
exportTypedArrayMethod: exportTypedArrayMethod,
exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
isView: isView,
isTypedArray: isTypedArray,
TypedArray: TypedArray,
TypedArrayPrototype: TypedArrayPrototype
};
},
{
'../internals/array-buffer-native': 29,
'../internals/classof': 47,
'../internals/create-non-enumerable-property': 55,
'../internals/descriptors': 60,
'../internals/global': 76,
'../internals/has': 77,
'../internals/is-object': 91,
'../internals/object-define-property': 109,
'../internals/object-get-prototype-of': 114,
'../internals/object-set-prototype-of': 118,
'../internals/redefine': 125,
'../internals/uid': 160,
'../internals/well-known-symbol': 163
}
],
31: [
function(_dereq_, module, exports) {
'use strict';
var global = _dereq_('../internals/global');
var DESCRIPTORS = _dereq_('../internals/descriptors');
var NATIVE_ARRAY_BUFFER = _dereq_('../internals/array-buffer-native');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var redefineAll = _dereq_('../internals/redefine-all');
var fails = _dereq_('../internals/fails');
var anInstance = _dereq_('../internals/an-instance');
var toInteger = _dereq_('../internals/to-integer');
var toLength = _dereq_('../internals/to-length');
var toIndex = _dereq_('../internals/to-index');
var IEEE754 = _dereq_('../internals/ieee754');
var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
var getOwnPropertyNames = _dereq_('../internals/object-get-own-property-names').f;
var defineProperty = _dereq_('../internals/object-define-property').f;
var arrayFill = _dereq_('../internals/array-fill');
var setToStringTag = _dereq_('../internals/set-to-string-tag');
var InternalStateModule = _dereq_('../internals/internal-state');
var getInternalState = InternalStateModule.get;
var setInternalState = InternalStateModule.set;
var ARRAY_BUFFER = 'ArrayBuffer';
var DATA_VIEW = 'DataView';
var PROTOTYPE = 'prototype';
var WRONG_LENGTH = 'Wrong length';
var WRONG_INDEX = 'Wrong index';
var NativeArrayBuffer = global[ARRAY_BUFFER];
var $ArrayBuffer = NativeArrayBuffer;
var $DataView = global[DATA_VIEW];
var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
var ObjectPrototype = Object.prototype;
var RangeError = global.RangeError;
var packIEEE754 = IEEE754.pack;
var unpackIEEE754 = IEEE754.unpack;
var packInt8 = function(number) {
return [number & 0xff];
};
var packInt16 = function(number) {
return [number & 0xff, (number >> 8) & 0xff];
};
var packInt32 = function(number) {
return [
number & 0xff,
(number >> 8) & 0xff,
(number >> 16) & 0xff,
(number >> 24) & 0xff
];
};
var unpackInt32 = function(buffer) {
return (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
};
var packFloat32 = function(number) {
return packIEEE754(number, 23, 4);
};
var packFloat64 = function(number) {
return packIEEE754(number, 52, 8);
};
var addGetter = function(Constructor, key) {
defineProperty(Constructor[PROTOTYPE], key, {
get: function() {
return getInternalState(this)[key];
}
});
};
var get = function(view, count, index, isLittleEndian) {
var intIndex = toIndex(index);
var store = getInternalState(view);
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
var bytes = getInternalState(store.buffer).bytes;
var start = intIndex + store.byteOffset;
var pack = bytes.slice(start, start + count);
return isLittleEndian ? pack : pack.reverse();
};
var set = function(view, count, index, conversion, value, isLittleEndian) {
var intIndex = toIndex(index);
var store = getInternalState(view);
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
var bytes = getInternalState(store.buffer).bytes;
var start = intIndex + store.byteOffset;
var pack = conversion(+value);
for (var i = 0; i < count; i++)
bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
};
if (!NATIVE_ARRAY_BUFFER) {
$ArrayBuffer = function ArrayBuffer(length) {
anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
var byteLength = toIndex(length);
setInternalState(this, {
bytes: arrayFill.call(new Array(byteLength), 0),
byteLength: byteLength
});
if (!DESCRIPTORS) this.byteLength = byteLength;
};
$DataView = function DataView(buffer, byteOffset, byteLength) {
anInstance(this, $DataView, DATA_VIEW);
anInstance(buffer, $ArrayBuffer, DATA_VIEW);
var bufferLength = getInternalState(buffer).byteLength;
var offset = toInteger(byteOffset);
if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
byteLength =
byteLength === undefined ? bufferLength - offset : toLength(byteLength);
if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
setInternalState(this, {
buffer: buffer,
byteLength: byteLength,
byteOffset: offset
});
if (!DESCRIPTORS) {
this.buffer = buffer;
this.byteLength = byteLength;
this.byteOffset = offset;
}
};
if (DESCRIPTORS) {
addGetter($ArrayBuffer, 'byteLength');
addGetter($DataView, 'buffer');
addGetter($DataView, 'byteLength');
addGetter($DataView, 'byteOffset');
}
redefineAll($DataView[PROTOTYPE], {
getInt8: function getInt8(byteOffset) {
return (get(this, 1, byteOffset)[0] << 24) >> 24;
},
getUint8: function getUint8(byteOffset) {
return get(this, 1, byteOffset)[0];
},
getInt16: function getInt16(byteOffset /* , littleEndian */) {
var bytes = get(
this,
2,
byteOffset,
arguments.length > 1 ? arguments[1] : undefined
);
return (((bytes[1] << 8) | bytes[0]) << 16) >> 16;
},
getUint16: function getUint16(byteOffset /* , littleEndian */) {
var bytes = get(
this,
2,
byteOffset,
arguments.length > 1 ? arguments[1] : undefined
);
return (bytes[1] << 8) | bytes[0];
},
getInt32: function getInt32(byteOffset /* , littleEndian */) {
return unpackInt32(
get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)
);
},
getUint32: function getUint32(byteOffset /* , littleEndian */) {
return (
unpackInt32(
get(
this,
4,
byteOffset,
arguments.length > 1 ? arguments[1] : undefined
)
) >>> 0
);
},
getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
return unpackIEEE754(
get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined),
23
);
},
getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
return unpackIEEE754(
get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined),
52
);
},
setInt8: function setInt8(byteOffset, value) {
set(this, 1, byteOffset, packInt8, value);
},
setUint8: function setUint8(byteOffset, value) {
set(this, 1, byteOffset, packInt8, value);
},
setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
set(
this,
2,
byteOffset,
packInt16,
value,
arguments.length > 2 ? arguments[2] : undefined
);
},
setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
set(
this,
2,
byteOffset,
packInt16,
value,
arguments.length > 2 ? arguments[2] : undefined
);
},
setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
set(
this,
4,
byteOffset,
packInt32,
value,
arguments.length > 2 ? arguments[2] : undefined
);
},
setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
set(
this,
4,
byteOffset,
packInt32,
value,
arguments.length > 2 ? arguments[2] : undefined
);
},
setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
set(
this,
4,
byteOffset,
packFloat32,
value,
arguments.length > 2 ? arguments[2] : undefined
);
},
setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
set(
this,
8,
byteOffset,
packFloat64,
value,
arguments.length > 2 ? arguments[2] : undefined
);
}
});
} else {
if (
!fails(function() {
NativeArrayBuffer(1);
}) ||
!fails(function() {
new NativeArrayBuffer(-1); // eslint-disable-line no-new
}) ||
fails(function() {
new NativeArrayBuffer(); // eslint-disable-line no-new
new NativeArrayBuffer(1.5); // eslint-disable-line no-new
new NativeArrayBuffer(NaN); // eslint-disable-line no-new
return NativeArrayBuffer.name != ARRAY_BUFFER;
})
) {
$ArrayBuffer = function ArrayBuffer(length) {
anInstance(this, $ArrayBuffer);
return new NativeArrayBuffer(toIndex(length));
};
var ArrayBufferPrototype = ($ArrayBuffer[PROTOTYPE] =
NativeArrayBuffer[PROTOTYPE]);
for (
var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key;
keys.length > j;
) {
if (!((key = keys[j++]) in $ArrayBuffer)) {
createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
}
}
ArrayBufferPrototype.constructor = $ArrayBuffer;
}
// WebKit bug - the same parent prototype for typed arrays and data view
if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
setPrototypeOf($DataViewPrototype, ObjectPrototype);
}
// iOS Safari 7.x bug
var testView = new $DataView(new $ArrayBuffer(2));
var nativeSetInt8 = $DataViewPrototype.setInt8;
testView.setInt8(0, 2147483648);
testView.setInt8(1, 2147483649);
if (testView.getInt8(0) || !testView.getInt8(1))
redefineAll(
$DataViewPrototype,
{
setInt8: function setInt8(byteOffset, value) {
nativeSetInt8.call(this, byteOffset, (value << 24) >> 24);
},
setUint8: function setUint8(byteOffset, value) {
nativeSetInt8.call(this, byteOffset, (value << 24) >> 24);
}
},
{ unsafe: true }
);
}
setToStringTag($ArrayBuffer, ARRAY_BUFFER);
setToStringTag($DataView, DATA_VIEW);
module.exports = {
ArrayBuffer: $ArrayBuffer,
DataView: $DataView
};
},
{
'../internals/an-instance': 27,
'../internals/array-buffer-native': 29,
'../internals/array-fill': 33,
'../internals/create-non-enumerable-property': 55,
'../internals/descriptors': 60,
'../internals/fails': 68,
'../internals/global': 76,
'../internals/ieee754': 82,
'../internals/internal-state': 87,
'../internals/object-define-property': 109,
'../internals/object-get-own-property-names': 112,
'../internals/object-get-prototype-of': 114,
'../internals/object-set-prototype-of': 118,
'../internals/redefine-all': 124,
'../internals/set-to-string-tag': 134,
'../internals/to-index': 148,
'../internals/to-integer': 150,
'../internals/to-length': 151
}
],
32: [
function(_dereq_, module, exports) {
'use strict';
var toObject = _dereq_('../internals/to-object');
var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
var toLength = _dereq_('../internals/to-length');
var min = Math.min;
// `Array.prototype.copyWithin` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.copywithin
module.exports =
[].copyWithin ||
function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
var O = toObject(this);
var len = toLength(O.length);
var to = toAbsoluteIndex(target, len);
var from = toAbsoluteIndex(start, len);
var end = arguments.length > 2 ? arguments[2] : undefined;
var count = min(
(end === undefined ? len : toAbsoluteIndex(end, len)) - from,
len - to
);
var inc = 1;
if (from < to && to < from + count) {
inc = -1;
from += count - 1;
to += count - 1;
}
while (count-- > 0) {
if (from in O) O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
}
return O;
};
},
{
'../internals/to-absolute-index': 147,
'../internals/to-length': 151,
'../internals/to-object': 152
}
],
33: [
function(_dereq_, module, exports) {
'use strict';
var toObject = _dereq_('../internals/to-object');
var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
var toLength = _dereq_('../internals/to-length');
// `Array.prototype.fill` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.fill
module.exports = function fill(value /* , start = 0, end = @length */) {
var O = toObject(this);
var length = toLength(O.length);
var argumentsLength = arguments.length;
var index = toAbsoluteIndex(
argumentsLength > 1 ? arguments[1] : undefined,
length
);
var end = argumentsLength > 2 ? arguments[2] : undefined;
var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
while (endPos > index) O[index++] = value;
return O;
};
},
{
'../internals/to-absolute-index': 147,
'../internals/to-length': 151,
'../internals/to-object': 152
}
],
34: [
function(_dereq_, module, exports) {
'use strict';
var $forEach = _dereq_('../internals/array-iteration').forEach;
var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
var arrayMethodUsesToLength = _dereq_('../internals/array-method-uses-to-length');
var STRICT_METHOD = arrayMethodIsStrict('forEach');
var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
// `Array.prototype.forEach` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
module.exports =
!STRICT_METHOD || !USES_TO_LENGTH
? function forEach(callbackfn /* , thisArg */) {
return $forEach(
this,
callbackfn,
arguments.length > 1 ? arguments[1] : undefined
);
}
: [].forEach;
},
{
'../internals/array-iteration': 37,
'../internals/array-method-is-strict': 40,
'../internals/array-method-uses-to-length': 41
}
],
35: [
function(_dereq_, module, exports) {
'use strict';
var bind = _dereq_('../internals/function-bind-context');
var toObject = _dereq_('../internals/to-object');
var callWithSafeIterationClosing = _dereq_(
'../internals/call-with-safe-iteration-closing'
);
var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
var toLength = _dereq_('../internals/to-length');
var createProperty = _dereq_('../internals/create-property');
var getIteratorMethod = _dereq_('../internals/get-iterator-method');
// `Array.from` method implementation
// https://tc39.github.io/ecma262/#sec-array.from
module.exports = function from(
arrayLike /* , mapfn = undefined, thisArg = undefined */
) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var argumentsLength = arguments.length;
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var iteratorMethod = getIteratorMethod(O);
var index = 0;
var length, result, step, iterator, next, value;
if (mapping)
mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
// if the target is not iterable or it's an array with the default iterator - use a simple case
if (
iteratorMethod != undefined &&
!(C == Array && isArrayIteratorMethod(iteratorMethod))
) {
iterator = iteratorMethod.call(O);
next = iterator.next;
result = new C();
for (; !(step = next.call(iterator)).done; index++) {
value = mapping
? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
: step.value;
createProperty(result, index, value);
}
} else {
length = toLength(O.length);
result = new C(length);
for (; length > index; index++) {
value = mapping ? mapfn(O[index], index) : O[index];
createProperty(result, index, value);
}
}
result.length = index;
return result;
};
},
{
'../internals/call-with-safe-iteration-closing': 44,
'../internals/create-property': 57,
'../internals/function-bind-context': 71,
'../internals/get-iterator-method': 74,
'../internals/is-array-iterator-method': 88,
'../internals/to-length': 151,
'../internals/to-object': 152
}
],
36: [
function(_dereq_, module, exports) {
var toIndexedObject = _dereq_('../internals/to-indexed-object');
var toLength = _dereq_('../internals/to-length');
var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function(IS_INCLUDES) {
return function($this, el, fromIndex) {
var O = toIndexedObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el)
while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
}
else
for (; length > index; index++) {
if ((IS_INCLUDES || index in O) && O[index] === el)
return IS_INCLUDES || index || 0;
}
return !IS_INCLUDES && -1;
};
};
module.exports = {
// `Array.prototype.includes` method
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
includes: createMethod(true),
// `Array.prototype.indexOf` method
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
indexOf: createMethod(false)
};
},
{
'../internals/to-absolute-index': 147,
'../internals/to-indexed-object': 149,
'../internals/to-length': 151
}
],
37: [
function(_dereq_, module, exports) {
var bind = _dereq_('../internals/function-bind-context');
var IndexedObject = _dereq_('../internals/indexed-object');
var toObject = _dereq_('../internals/to-object');
var toLength = _dereq_('../internals/to-length');
var arraySpeciesCreate = _dereq_('../internals/array-species-create');
var push = [].push;
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
var createMethod = function(TYPE) {
var IS_MAP = TYPE == 1;
var IS_FILTER = TYPE == 2;
var IS_SOME = TYPE == 3;
var IS_EVERY = TYPE == 4;
var IS_FIND_INDEX = TYPE == 6;
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function($this, callbackfn, that, specificCreate) {
var O = toObject($this);
var self = IndexedObject(O);
var boundFunction = bind(callbackfn, that, 3);
var length = toLength(self.length);
var index = 0;
var create = specificCreate || arraySpeciesCreate;
var target = IS_MAP
? create($this, length)
: IS_FILTER ? create($this, 0) : undefined;
var value, result;
for (; length > index; index++)
if (NO_HOLES || index in self) {
value = self[index];
result = boundFunction(value, index, O);
if (TYPE) {
if (IS_MAP) target[index] = result;
else if (result)
// map
switch (TYPE) {
case 3:
return true; // some
case 5:
return value; // find
case 6:
return index; // findIndex
case 2:
push.call(target, value); // filter
}
else if (IS_EVERY) return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
};
};
module.exports = {
// `Array.prototype.forEach` method
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
forEach: createMethod(0),
// `Array.prototype.map` method
// https://tc39.github.io/ecma262/#sec-array.prototype.map
map: createMethod(1),
// `Array.prototype.filter` method
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
filter: createMethod(2),
// `Array.prototype.some` method
// https://tc39.github.io/ecma262/#sec-array.prototype.some
some: createMethod(3),
// `Array.prototype.every` method
// https://tc39.github.io/ecma262/#sec-array.prototype.every
every: createMethod(4),
// `Array.prototype.find` method
// https://tc39.github.io/ecma262/#sec-array.prototype.find
find: createMethod(5),
// `Array.prototype.findIndex` method
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
findIndex: createMethod(6)
};
},
{
'../internals/array-species-create': 43,
'../internals/function-bind-context': 71,
'../internals/indexed-object': 83,
'../internals/to-length': 151,
'../internals/to-object': 152
}
],
38: [
function(_dereq_, module, exports) {
'use strict';
var toIndexedObject = _dereq_('../internals/to-indexed-object');
var toInteger = _dereq_('../internals/to-integer');
var toLength = _dereq_('../internals/to-length');
var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
var arrayMethodUsesToLength = _dereq_('../internals/array-method-uses-to-length');
var min = Math.min;
var nativeLastIndexOf = [].lastIndexOf;
var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
// For preventing possible almost infinite loop in non-standard implementations, test the forward version of the method
var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', {
ACCESSORS: true,
1: 0
});
var FORCED = NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH;
// `Array.prototype.lastIndexOf` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
module.exports = FORCED
? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
// convert -0 to +0
if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
var O = toIndexedObject(this);
var length = toLength(O.length);
var index = length - 1;
if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
if (index < 0) index = length + index;
for (; index >= 0; index--)
if (index in O && O[index] === searchElement) return index || 0;
return -1;
}
: nativeLastIndexOf;
},
{
'../internals/array-method-is-strict': 40,
'../internals/array-method-uses-to-length': 41,
'../internals/to-indexed-object': 149,
'../internals/to-integer': 150,
'../internals/to-length': 151
}
],
39: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var V8_VERSION = _dereq_('../internals/engine-v8-version');
var SPECIES = wellKnownSymbol('species');
module.exports = function(METHOD_NAME) {
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/677
return (
V8_VERSION >= 51 ||
!fails(function() {
var array = [];
var constructor = (array.constructor = {});
constructor[SPECIES] = function() {
return { foo: 1 };
};
return array[METHOD_NAME](Boolean).foo !== 1;
})
);
};
},
{
'../internals/engine-v8-version': 65,
'../internals/fails': 68,
'../internals/well-known-symbol': 163
}
],
40: [
function(_dereq_, module, exports) {
'use strict';
var fails = _dereq_('../internals/fails');
module.exports = function(METHOD_NAME, argument) {
var method = [][METHOD_NAME];
return (
!!method &&
fails(function() {
// eslint-disable-next-line no-useless-call,no-throw-literal
method.call(
null,
argument ||
function() {
throw 1;
},
1
);
})
);
};
},
{ '../internals/fails': 68 }
],
41: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var fails = _dereq_('../internals/fails');
var has = _dereq_('../internals/has');
var defineProperty = Object.defineProperty;
var cache = {};
var thrower = function(it) {
throw it;
};
module.exports = function(METHOD_NAME, options) {
if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
if (!options) options = {};
var method = [][METHOD_NAME];
var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
var argument0 = has(options, 0) ? options[0] : thrower;
var argument1 = has(options, 1) ? options[1] : undefined;
return (cache[METHOD_NAME] =
!!method &&
!fails(function() {
if (ACCESSORS && !DESCRIPTORS) return true;
var O = { length: -1 };
if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });
else O[1] = 1;
method.call(O, argument0, argument1);
}));
};
},
{ '../internals/descriptors': 60, '../internals/fails': 68, '../internals/has': 77 }
],
42: [
function(_dereq_, module, exports) {
var aFunction = _dereq_('../internals/a-function');
var toObject = _dereq_('../internals/to-object');
var IndexedObject = _dereq_('../internals/indexed-object');
var toLength = _dereq_('../internals/to-length');
// `Array.prototype.{ reduce, reduceRight }` methods implementation
var createMethod = function(IS_RIGHT) {
return function(that, callbackfn, argumentsLength, memo) {
aFunction(callbackfn);
var O = toObject(that);
var self = IndexedObject(O);
var length = toLength(O.length);
var index = IS_RIGHT ? length - 1 : 0;
var i = IS_RIGHT ? -1 : 1;
if (argumentsLength < 2)
while (true) {
if (index in self) {
memo = self[index];
index += i;
break;
}
index += i;
if (IS_RIGHT ? index < 0 : length <= index) {
throw TypeError('Reduce of empty array with no initial value');
}
}
for (; IS_RIGHT ? index >= 0 : length > index; index += i)
if (index in self) {
memo = callbackfn(memo, self[index], index, O);
}
return memo;
};
};
module.exports = {
// `Array.prototype.reduce` method
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
left: createMethod(false),
// `Array.prototype.reduceRight` method
// https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
right: createMethod(true)
};
},
{
'../internals/a-function': 23,
'../internals/indexed-object': 83,
'../internals/to-length': 151,
'../internals/to-object': 152
}
],
43: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
var isArray = _dereq_('../internals/is-array');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var SPECIES = wellKnownSymbol('species');
// `ArraySpeciesCreate` abstract operation
// https://tc39.github.io/ecma262/#sec-arrayspeciescreate
module.exports = function(originalArray, length) {
var C;
if (isArray(originalArray)) {
C = originalArray.constructor;
// cross-realm fallback
if (typeof C == 'function' && (C === Array || isArray(C.prototype)))
C = undefined;
else if (isObject(C)) {
C = C[SPECIES];
if (C === null) C = undefined;
}
}
return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
};
},
{
'../internals/is-array': 89,
'../internals/is-object': 91,
'../internals/well-known-symbol': 163
}
],
44: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
// call something on iterator step with safe closing on error
module.exports = function(iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
var returnMethod = iterator['return'];
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
throw error;
}
};
},
{ '../internals/an-object': 28 }
],
45: [
function(_dereq_, module, exports) {
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function() {
return { done: !!called++ };
},
return: function() {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function() {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function() {
throw 2;
});
} catch (error) {
/* empty */
}
module.exports = function(exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function() {
return {
next: function() {
return { done: (ITERATION_SUPPORT = true) };
}
};
};
exec(object);
} catch (error) {
/* empty */
}
return ITERATION_SUPPORT;
};
},
{ '../internals/well-known-symbol': 163 }
],
46: [
function(_dereq_, module, exports) {
var toString = {}.toString;
module.exports = function(it) {
return toString.call(it).slice(8, -1);
};
},
{}
],
47: [
function(_dereq_, module, exports) {
var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
var classofRaw = _dereq_('../internals/classof-raw');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS =
classofRaw(
(function() {
return arguments;
})()
) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function(it, key) {
try {
return it[key];
} catch (error) {
/* empty */
}
};
// getting tag from ES6+ `Object.prototype.toString`
module.exports = TO_STRING_TAG_SUPPORT
? classofRaw
: function(it) {
var O, tag, result;
return it === undefined
? 'Undefined'
: it === null
? 'Null'
: // @@toStringTag case
typeof (tag = tryGet((O = Object(it)), TO_STRING_TAG)) == 'string'
? tag
: // builtinTag case
CORRECT_ARGUMENTS
? classofRaw(O)
: // ES3 arguments fallback
(result = classofRaw(O)) == 'Object' &&
typeof O.callee == 'function'
? 'Arguments'
: result;
};
},
{
'../internals/classof-raw': 46,
'../internals/to-string-tag-support': 156,
'../internals/well-known-symbol': 163
}
],
48: [
function(_dereq_, module, exports) {
'use strict';
var defineProperty = _dereq_('../internals/object-define-property').f;
var create = _dereq_('../internals/object-create');
var redefineAll = _dereq_('../internals/redefine-all');
var bind = _dereq_('../internals/function-bind-context');
var anInstance = _dereq_('../internals/an-instance');
var iterate = _dereq_('../internals/iterate');
var defineIterator = _dereq_('../internals/define-iterator');
var setSpecies = _dereq_('../internals/set-species');
var DESCRIPTORS = _dereq_('../internals/descriptors');
var fastKey = _dereq_('../internals/internal-metadata').fastKey;
var InternalStateModule = _dereq_('../internals/internal-state');
var setInternalState = InternalStateModule.set;
var internalStateGetterFor = InternalStateModule.getterFor;
module.exports = {
getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
var C = wrapper(function(that, iterable) {
anInstance(that, C, CONSTRUCTOR_NAME);
setInternalState(that, {
type: CONSTRUCTOR_NAME,
index: create(null),
first: undefined,
last: undefined,
size: 0
});
if (!DESCRIPTORS) that.size = 0;
if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
});
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
var define = function(that, key, value) {
var state = getInternalState(that);
var entry = getEntry(that, key);
var previous, index;
// change existing entry
if (entry) {
entry.value = value;
// create new entry
} else {
state.last = entry = {
index: (index = fastKey(key, true)),
key: key,
value: value,
previous: (previous = state.last),
next: undefined,
removed: false
};
if (!state.first) state.first = entry;
if (previous) previous.next = entry;
if (DESCRIPTORS) state.size++;
else that.size++;
// add to index
if (index !== 'F') state.index[index] = entry;
}
return that;
};
var getEntry = function(that, key) {
var state = getInternalState(that);
// fast case
var index = fastKey(key);
var entry;
if (index !== 'F') return state.index[index];
// frozen object case
for (entry = state.first; entry; entry = entry.next) {
if (entry.key == key) return entry;
}
};
redefineAll(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear() {
var that = this;
var state = getInternalState(that);
var data = state.index;
var entry = state.first;
while (entry) {
entry.removed = true;
if (entry.previous) entry.previous = entry.previous.next = undefined;
delete data[entry.index];
entry = entry.next;
}
state.first = state.last = undefined;
if (DESCRIPTORS) state.size = 0;
else that.size = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
delete: function(key) {
var that = this;
var state = getInternalState(that);
var entry = getEntry(that, key);
if (entry) {
var next = entry.next;
var prev = entry.previous;
delete state.index[entry.index];
entry.removed = true;
if (prev) prev.next = next;
if (next) next.previous = prev;
if (state.first == entry) state.first = next;
if (state.last == entry) state.last = prev;
if (DESCRIPTORS) state.size--;
else that.size--;
}
return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /* , that = undefined */) {
var state = getInternalState(this);
var boundFunction = bind(
callbackfn,
arguments.length > 1 ? arguments[1] : undefined,
3
);
var entry;
while ((entry = entry ? entry.next : state.first)) {
boundFunction(entry.value, entry.key, this);
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key) {
return !!getEntry(this, key);
}
});
redefineAll(
C.prototype,
IS_MAP
? {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key) {
var entry = getEntry(this, key);
return entry && entry.value;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value) {
return define(this, key === 0 ? 0 : key, value);
}
}
: {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value) {
return define(this, (value = value === 0 ? 0 : value), value);
}
}
);
if (DESCRIPTORS)
defineProperty(C.prototype, 'size', {
get: function() {
return getInternalState(this).size;
}
});
return C;
},
setStrong: function(C, CONSTRUCTOR_NAME, IS_MAP) {
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
defineIterator(
C,
CONSTRUCTOR_NAME,
function(iterated, kind) {
setInternalState(this, {
type: ITERATOR_NAME,
target: iterated,
state: getInternalCollectionState(iterated),
kind: kind,
last: undefined
});
},
function() {
var state = getInternalIteratorState(this);
var kind = state.kind;
var entry = state.last;
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
// get next entry
if (
!state.target ||
!(state.last = entry = entry ? entry.next : state.state.first)
) {
// or finish the iteration
state.target = undefined;
return { value: undefined, done: true };
}
// return step by kind
if (kind == 'keys') return { value: entry.key, done: false };
if (kind == 'values') return { value: entry.value, done: false };
return { value: [entry.key, entry.value], done: false };
},
IS_MAP ? 'entries' : 'values',
!IS_MAP,
true
);
// add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(CONSTRUCTOR_NAME);
}
};
},
{
'../internals/an-instance': 27,
'../internals/define-iterator': 58,
'../internals/descriptors': 60,
'../internals/function-bind-context': 71,
'../internals/internal-metadata': 86,
'../internals/internal-state': 87,
'../internals/iterate': 94,
'../internals/object-create': 107,
'../internals/object-define-property': 109,
'../internals/redefine-all': 124,
'../internals/set-species': 133
}
],
49: [
function(_dereq_, module, exports) {
'use strict';
var $ = _dereq_('../internals/export');
var global = _dereq_('../internals/global');
var isForced = _dereq_('../internals/is-forced');
var redefine = _dereq_('../internals/redefine');
var InternalMetadataModule = _dereq_('../internals/internal-metadata');
var iterate = _dereq_('../internals/iterate');
var anInstance = _dereq_('../internals/an-instance');
var isObject = _dereq_('../internals/is-object');
var fails = _dereq_('../internals/fails');
var checkCorrectnessOfIteration = _dereq_(
'../internals/check-correctness-of-iteration'
);
var setToStringTag = _dereq_('../internals/set-to-string-tag');
var inheritIfRequired = _dereq_('../internals/inherit-if-required');
module.exports = function(CONSTRUCTOR_NAME, wrapper, common) {
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
var ADDER = IS_MAP ? 'set' : 'add';
var NativeConstructor = global[CONSTRUCTOR_NAME];
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
var Constructor = NativeConstructor;
var exported = {};
var fixMethod = function(KEY) {
var nativeMethod = NativePrototype[KEY];
redefine(
NativePrototype,
KEY,
KEY == 'add'
? function add(value) {
nativeMethod.call(this, value === 0 ? 0 : value);
return this;
}
: KEY == 'delete'
? function(key) {
return IS_WEAK && !isObject(key)
? false
: nativeMethod.call(this, key === 0 ? 0 : key);
}
: KEY == 'get'
? function get(key) {
return IS_WEAK && !isObject(key)
? undefined
: nativeMethod.call(this, key === 0 ? 0 : key);
}
: KEY == 'has'
? function has(key) {
return IS_WEAK && !isObject(key)
? false
: nativeMethod.call(this, key === 0 ? 0 : key);
}
: function set(key, value) {
nativeMethod.call(this, key === 0 ? 0 : key, value);
return this;
}
);
};
// eslint-disable-next-line max-len
if (
isForced(
CONSTRUCTOR_NAME,
typeof NativeConstructor != 'function' ||
!(
IS_WEAK ||
(NativePrototype.forEach &&
!fails(function() {
new NativeConstructor().entries().next();
}))
)
)
) {
// create collection constructor
Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
InternalMetadataModule.REQUIRED = true;
} else if (isForced(CONSTRUCTOR_NAME, true)) {
var instance = new Constructor();
// early implementations not supports chaining
var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
// V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
var THROWS_ON_PRIMITIVES = fails(function() {
instance.has(1);
});
// most early implementations doesn't supports iterables, most modern - not close it correctly
// eslint-disable-next-line no-new
var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function(iterable) {
new NativeConstructor(iterable);
});
// for early implementations -0 and +0 not the same
var BUGGY_ZERO =
!IS_WEAK &&
fails(function() {
// V8 ~ Chromium 42- fails only with 5+ elements
var $instance = new NativeConstructor();
var index = 5;
while (index--) $instance[ADDER](index, index);
return !$instance.has(-0);
});
if (!ACCEPT_ITERABLES) {
Constructor = wrapper(function(dummy, iterable) {
anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP);
return that;
});
Constructor.prototype = NativePrototype;
NativePrototype.constructor = Constructor;
}
if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
// weak collections should not contains .clear method
if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
}
exported[CONSTRUCTOR_NAME] = Constructor;
$({ global: true, forced: Constructor != NativeConstructor }, exported);
setToStringTag(Constructor, CONSTRUCTOR_NAME);
if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
return Constructor;
};
},
{
'../internals/an-instance': 27,
'../internals/check-correctness-of-iteration': 45,
'../internals/export': 67,
'../internals/fails': 68,
'../internals/global': 76,
'../internals/inherit-if-required': 84,
'../internals/internal-metadata': 86,
'../internals/is-forced': 90,
'../internals/is-object': 91,
'../internals/iterate': 94,
'../internals/redefine': 125,
'../internals/set-to-string-tag': 134
}
],
50: [
function(_dereq_, module, exports) {
var has = _dereq_('../internals/has');
var ownKeys = _dereq_('../internals/own-keys');
var getOwnPropertyDescriptorModule = _dereq_(
'../internals/object-get-own-property-descriptor'
);
var definePropertyModule = _dereq_('../internals/object-define-property');
module.exports = function(target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has(target, key))
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
},
{
'../internals/has': 77,
'../internals/object-define-property': 109,
'../internals/object-get-own-property-descriptor': 110,
'../internals/own-keys': 120
}
],
51: [
function(_dereq_, module, exports) {
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var MATCH = wellKnownSymbol('match');
module.exports = function(METHOD_NAME) {
var regexp = /./;
try {
'/./'[METHOD_NAME](regexp);
} catch (e) {
try {
regexp[MATCH] = false;
return '/./'[METHOD_NAME](regexp);
} catch (f) {
/* empty */
}
}
return false;
};
},
{ '../internals/well-known-symbol': 163 }
],
52: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
module.exports = !fails(function() {
function F() {
/* empty */
}
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
},
{ '../internals/fails': 68 }
],
53: [
function(_dereq_, module, exports) {
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
var quot = /"/g;
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
// https://tc39.github.io/ecma262/#sec-createhtml
module.exports = function(string, tag, attribute, value) {
var S = String(requireObjectCoercible(string));
var p1 = '<' + tag;
if (attribute !== '')
p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
return p1 + '>' + S + '</' + tag + '>';
};
},
{ '../internals/require-object-coercible': 130 }
],
54: [
function(_dereq_, module, exports) {
'use strict';
var IteratorPrototype = _dereq_('../internals/iterators-core').IteratorPrototype;
var create = _dereq_('../internals/object-create');
var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
var setToStringTag = _dereq_('../internals/set-to-string-tag');
var Iterators = _dereq_('../internals/iterators');
var returnThis = function() {
return this;
};
module.exports = function(IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create(IteratorPrototype, {
next: createPropertyDescriptor(1, next)
});
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
Iterators[TO_STRING_TAG] = returnThis;
return IteratorConstructor;
};
},
{
'../internals/create-property-descriptor': 56,
'../internals/iterators': 96,
'../internals/iterators-core': 95,
'../internals/object-create': 107,
'../internals/set-to-string-tag': 134
}
],
55: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var definePropertyModule = _dereq_('../internals/object-define-property');
var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
module.exports = DESCRIPTORS
? function(object, key, value) {
return definePropertyModule.f(
object,
key,
createPropertyDescriptor(1, value)
);
}
: function(object, key, value) {
object[key] = value;
return object;
};
},
{
'../internals/create-property-descriptor': 56,
'../internals/descriptors': 60,
'../internals/object-define-property': 109
}
],
56: [
function(_dereq_, module, exports) {
module.exports = function(bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
},
{}
],
57: [
function(_dereq_, module, exports) {
'use strict';
var toPrimitive = _dereq_('../internals/to-primitive');
var definePropertyModule = _dereq_('../internals/object-define-property');
var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
module.exports = function(object, key, value) {
var propertyKey = toPrimitive(key);
if (propertyKey in object)
definePropertyModule.f(
object,
propertyKey,
createPropertyDescriptor(0, value)
);
else object[propertyKey] = value;
};
},
{
'../internals/create-property-descriptor': 56,
'../internals/object-define-property': 109,
'../internals/to-primitive': 155
}
],
58: [
function(_dereq_, module, exports) {
'use strict';
var $ = _dereq_('../internals/export');
var createIteratorConstructor = _dereq_(
'../internals/create-iterator-constructor'
);
var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
var setToStringTag = _dereq_('../internals/set-to-string-tag');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var redefine = _dereq_('../internals/redefine');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var IS_PURE = _dereq_('../internals/is-pure');
var Iterators = _dereq_('../internals/iterators');
var IteratorsCore = _dereq_('../internals/iterators-core');
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis = function() {
return this;
};
module.exports = function(
Iterable,
NAME,
IteratorConstructor,
next,
DEFAULT,
IS_SET,
FORCED
) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function(KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
return IterablePrototype[KIND];
switch (KIND) {
case KEYS:
return function keys() {
return new IteratorConstructor(this, KIND);
};
case VALUES:
return function values() {
return new IteratorConstructor(this, KIND);
};
case ENTRIES:
return function entries() {
return new IteratorConstructor(this, KIND);
};
}
return function() {
return new IteratorConstructor(this);
};
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator =
IterablePrototype[ITERATOR] ||
IterablePrototype['@@iterator'] ||
(DEFAULT && IterablePrototype[DEFAULT]);
var defaultIterator =
(!BUGGY_SAFARI_ITERATORS && nativeIterator) || getIterationMethod(DEFAULT);
var anyNativeIterator =
NAME == 'Array'
? IterablePrototype.entries || nativeIterator
: nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
// fix native
if (anyNativeIterator) {
CurrentIteratorPrototype = getPrototypeOf(
anyNativeIterator.call(new Iterable())
);
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
if (
!IS_PURE &&
getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype
) {
if (setPrototypeOf) {
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
createNonEnumerableProperty(
CurrentIteratorPrototype,
ITERATOR,
returnThis
);
}
}
// Set @@toStringTag to native iterators
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() {
return nativeIterator.call(this);
};
}
// define iterator
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
}
Iterators[NAME] = defaultIterator;
// export additional methods
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED)
for (KEY in methods) {
if (
BUGGY_SAFARI_ITERATORS ||
INCORRECT_VALUES_NAME ||
!(KEY in IterablePrototype)
) {
redefine(IterablePrototype, KEY, methods[KEY]);
}
}
else
$(
{
target: NAME,
proto: true,
forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
},
methods
);
}
return methods;
};
},
{
'../internals/create-iterator-constructor': 54,
'../internals/create-non-enumerable-property': 55,
'../internals/export': 67,
'../internals/is-pure': 92,
'../internals/iterators': 96,
'../internals/iterators-core': 95,
'../internals/object-get-prototype-of': 114,
'../internals/object-set-prototype-of': 118,
'../internals/redefine': 125,
'../internals/set-to-string-tag': 134,
'../internals/well-known-symbol': 163
}
],
59: [
function(_dereq_, module, exports) {
var path = _dereq_('../internals/path');
var has = _dereq_('../internals/has');
var wrappedWellKnownSymbolModule = _dereq_(
'../internals/well-known-symbol-wrapped'
);
var defineProperty = _dereq_('../internals/object-define-property').f;
module.exports = function(NAME) {
var Symbol = path.Symbol || (path.Symbol = {});
if (!has(Symbol, NAME))
defineProperty(Symbol, NAME, {
value: wrappedWellKnownSymbolModule.f(NAME)
});
};
},
{
'../internals/has': 77,
'../internals/object-define-property': 109,
'../internals/path': 121,
'../internals/well-known-symbol-wrapped': 162
}
],
60: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function() {
return (
Object.defineProperty({}, 1, {
get: function() {
return 7;
}
})[1] != 7
);
});
},
{ '../internals/fails': 68 }
],
61: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var isObject = _dereq_('../internals/is-object');
var document = global.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document) && isObject(document.createElement);
module.exports = function(it) {
return EXISTS ? document.createElement(it) : {};
};
},
{ '../internals/global': 76, '../internals/is-object': 91 }
],
62: [
function(_dereq_, module, exports) {
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
module.exports = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
},
{}
],
63: [
function(_dereq_, module, exports) {
var userAgent = _dereq_('../internals/engine-user-agent');
module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
},
{ '../internals/engine-user-agent': 64 }
],
64: [
function(_dereq_, module, exports) {
var getBuiltIn = _dereq_('../internals/get-built-in');
module.exports = getBuiltIn('navigator', 'userAgent') || '';
},
{ '../internals/get-built-in': 73 }
],
65: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var userAgent = _dereq_('../internals/engine-user-agent');
var process = global.process;
var versions = process && process.versions;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
version = match[0] + match[1];
} else if (userAgent) {
match = userAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent.match(/Chrome\/(\d+)/);
if (match) version = match[1];
}
}
module.exports = version && +version;
},
{ '../internals/engine-user-agent': 64, '../internals/global': 76 }
],
66: [
function(_dereq_, module, exports) {
// IE8- don't enum bug keys
module.exports = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
},
{}
],
67: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var getOwnPropertyDescriptor = _dereq_(
'../internals/object-get-own-property-descriptor'
).f;
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var redefine = _dereq_('../internals/redefine');
var setGlobal = _dereq_('../internals/set-global');
var copyConstructorProperties = _dereq_(
'../internals/copy-constructor-properties'
);
var isForced = _dereq_('../internals/is-forced');
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
module.exports = function(options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global;
} else if (STATIC) {
target = global[TARGET] || setGlobal(TARGET, {});
} else {
target = (global[TARGET] || {}).prototype;
}
if (target)
for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(
GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key,
options.forced
);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
},
{
'../internals/copy-constructor-properties': 50,
'../internals/create-non-enumerable-property': 55,
'../internals/global': 76,
'../internals/is-forced': 90,
'../internals/object-get-own-property-descriptor': 110,
'../internals/redefine': 125,
'../internals/set-global': 132
}
],
68: [
function(_dereq_, module, exports) {
module.exports = function(exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
},
{}
],
69: [
function(_dereq_, module, exports) {
'use strict';
// TODO: Remove from `core-js@4` since it's moved to entry points
_dereq_('../modules/es.regexp.exec');
var redefine = _dereq_('../internals/redefine');
var fails = _dereq_('../internals/fails');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var regexpExec = _dereq_('../internals/regexp-exec');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var SPECIES = wellKnownSymbol('species');
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function() {
// #replace needs built-in support for named groups.
// #match works fine because it just return the exec results, even if it has
// a "grops" property.
var re = /./;
re.exec = function() {
var result = [];
result.groups = { a: '7' };
return result;
};
return ''.replace(re, '$<a>') !== '7';
});
// IE <= 11 replaces $0 with the whole match, as if it was $&
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
var REPLACE_KEEPS_$0 = (function() {
return 'a'.replace(/./, '$0') === '$0';
})();
var REPLACE = wellKnownSymbol('replace');
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function() {
if (/./[REPLACE]) {
return /./[REPLACE]('a', '$0') === '';
}
return false;
})();
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function() {
var re = /(?:)/;
var originalExec = re.exec;
re.exec = function() {
return originalExec.apply(this, arguments);
};
var result = 'ab'.split(re);
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
});
module.exports = function(KEY, length, exec, sham) {
var SYMBOL = wellKnownSymbol(KEY);
var DELEGATES_TO_SYMBOL = !fails(function() {
// String methods call symbol-named RegEp methods
var O = {};
O[SYMBOL] = function() {
return 7;
};
return ''[KEY](O) != 7;
});
var DELEGATES_TO_EXEC =
DELEGATES_TO_SYMBOL &&
!fails(function() {
// Symbol-named RegExp methods call .exec
var execCalled = false;
var re = /a/;
if (KEY === 'split') {
// We can't use real regex here since it causes deoptimization
// and serious performance degradation in V8
// https://github.com/zloirock/core-js/issues/306
re = {};
// RegExp[@@split] doesn't call the regex's exec method, but first creates
// a new one. We need to return the patched regex when creating the new one.
re.constructor = {};
re.constructor[SPECIES] = function() {
return re;
};
re.flags = '';
re[SYMBOL] = /./[SYMBOL];
}
re.exec = function() {
execCalled = true;
return null;
};
re[SYMBOL]('');
return !execCalled;
});
if (
!DELEGATES_TO_SYMBOL ||
!DELEGATES_TO_EXEC ||
(KEY === 'replace' &&
!(
REPLACE_SUPPORTS_NAMED_GROUPS &&
REPLACE_KEEPS_$0 &&
!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
)) ||
(KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
) {
var nativeRegExpMethod = /./[SYMBOL];
var methods = exec(
SYMBOL,
''[KEY],
function(nativeMethod, regexp, str, arg2, forceStringMethod) {
if (regexp.exec === regexpExec) {
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
// The native String method already delegates to @@method (this
// polyfilled function), leasing to infinite recursion.
// We avoid it by directly calling the native @@method method.
return {
done: true,
value: nativeRegExpMethod.call(regexp, str, arg2)
};
}
return { done: true, value: nativeMethod.call(str, regexp, arg2) };
}
return { done: false };
},
{
REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
}
);
var stringMethod = methods[0];
var regexMethod = methods[1];
redefine(String.prototype, KEY, stringMethod);
redefine(
RegExp.prototype,
SYMBOL,
length == 2
? // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
function(string, arg) {
return regexMethod.call(string, this, arg);
}
: // 21.2.5.6 RegExp.prototype[@@match](string)
// 21.2.5.9 RegExp.prototype[@@search](string)
function(string) {
return regexMethod.call(string, this);
}
);
}
if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
};
},
{
'../internals/create-non-enumerable-property': 55,
'../internals/fails': 68,
'../internals/redefine': 125,
'../internals/regexp-exec': 127,
'../internals/well-known-symbol': 163,
'../modules/es.regexp.exec': 196
}
],
70: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
module.exports = !fails(function() {
return Object.isExtensible(Object.preventExtensions({}));
});
},
{ '../internals/fails': 68 }
],
71: [
function(_dereq_, module, exports) {
var aFunction = _dereq_('../internals/a-function');
// optional / simple context binding
module.exports = function(fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0:
return function() {
return fn.call(that);
};
case 1:
return function(a) {
return fn.call(that, a);
};
case 2:
return function(a, b) {
return fn.call(that, a, b);
};
case 3:
return function(a, b, c) {
return fn.call(that, a, b, c);
};
}
return function(/* ...args */) {
return fn.apply(that, arguments);
};
};
},
{ '../internals/a-function': 23 }
],
72: [
function(_dereq_, module, exports) {
'use strict';
var aFunction = _dereq_('../internals/a-function');
var isObject = _dereq_('../internals/is-object');
var slice = [].slice;
var factories = {};
var construct = function(C, argsLength, args) {
if (!(argsLength in factories)) {
for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
// eslint-disable-next-line no-new-func
factories[argsLength] = Function(
'C,a',
'return new C(' + list.join(',') + ')'
);
}
return factories[argsLength](C, args);
};
// `Function.prototype.bind` method implementation
// https://tc39.github.io/ecma262/#sec-function.prototype.bind
module.exports =
Function.bind ||
function bind(that /* , ...args */) {
var fn = aFunction(this);
var partArgs = slice.call(arguments, 1);
var boundFunction = function bound(/* args... */) {
var args = partArgs.concat(slice.call(arguments));
return this instanceof boundFunction
? construct(fn, args.length, args)
: fn.apply(that, args);
};
if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
return boundFunction;
};
},
{ '../internals/a-function': 23, '../internals/is-object': 91 }
],
73: [
function(_dereq_, module, exports) {
var path = _dereq_('../internals/path');
var global = _dereq_('../internals/global');
var aFunction = function(variable) {
return typeof variable == 'function' ? variable : undefined;
};
module.exports = function(namespace, method) {
return arguments.length < 2
? aFunction(path[namespace]) || aFunction(global[namespace])
: (path[namespace] && path[namespace][method]) ||
(global[namespace] && global[namespace][method]);
};
},
{ '../internals/global': 76, '../internals/path': 121 }
],
74: [
function(_dereq_, module, exports) {
var classof = _dereq_('../internals/classof');
var Iterators = _dereq_('../internals/iterators');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function(it) {
if (it != undefined)
return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
};
},
{
'../internals/classof': 47,
'../internals/iterators': 96,
'../internals/well-known-symbol': 163
}
],
75: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var getIteratorMethod = _dereq_('../internals/get-iterator-method');
module.exports = function(it) {
var iteratorMethod = getIteratorMethod(it);
if (typeof iteratorMethod != 'function') {
throw TypeError(String(it) + ' is not iterable');
}
return anObject(iteratorMethod.call(it));
};
},
{ '../internals/an-object': 28, '../internals/get-iterator-method': 74 }
],
76: [
function(_dereq_, module, exports) {
(function(global) {
var check = function(it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
// eslint-disable-next-line no-undef
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
check(typeof self == 'object' && self) ||
check(typeof global == 'object' && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
}.call(
this,
typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined' ? window : {}
));
},
{}
],
77: [
function(_dereq_, module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key) {
return hasOwnProperty.call(it, key);
};
},
{}
],
78: [
function(_dereq_, module, exports) {
module.exports = {};
},
{}
],
79: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
module.exports = function(a, b) {
var console = global.console;
if (console && console.error) {
arguments.length === 1 ? console.error(a) : console.error(a, b);
}
};
},
{ '../internals/global': 76 }
],
80: [
function(_dereq_, module, exports) {
var getBuiltIn = _dereq_('../internals/get-built-in');
module.exports = getBuiltIn('document', 'documentElement');
},
{ '../internals/get-built-in': 73 }
],
81: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var fails = _dereq_('../internals/fails');
var createElement = _dereq_('../internals/document-create-element');
// Thank's IE8 for his funny defineProperty
module.exports =
!DESCRIPTORS &&
!fails(function() {
return (
Object.defineProperty(createElement('div'), 'a', {
get: function() {
return 7;
}
}).a != 7
);
});
},
{
'../internals/descriptors': 60,
'../internals/document-create-element': 61,
'../internals/fails': 68
}
],
82: [
function(_dereq_, module, exports) {
// IEEE754 conversions based on https://github.com/feross/ieee754
// eslint-disable-next-line no-shadow-restricted-names
var Infinity = 1 / 0;
var abs = Math.abs;
var pow = Math.pow;
var floor = Math.floor;
var log = Math.log;
var LN2 = Math.LN2;
var pack = function(number, mantissaLength, bytes) {
var buffer = new Array(bytes);
var exponentLength = bytes * 8 - mantissaLength - 1;
var eMax = (1 << exponentLength) - 1;
var eBias = eMax >> 1;
var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
var sign = number < 0 || (number === 0 && 1 / number < 0) ? 1 : 0;
var index = 0;
var exponent, mantissa, c;
number = abs(number);
// eslint-disable-next-line no-self-compare
if (number != number || number === Infinity) {
// eslint-disable-next-line no-self-compare
mantissa = number != number ? 1 : 0;
exponent = eMax;
} else {
exponent = floor(log(number) / LN2);
if (number * (c = pow(2, -exponent)) < 1) {
exponent--;
c *= 2;
}
if (exponent + eBias >= 1) {
number += rt / c;
} else {
number += rt * pow(2, 1 - eBias);
}
if (number * c >= 2) {
exponent++;
c /= 2;
}
if (exponent + eBias >= eMax) {
mantissa = 0;
exponent = eMax;
} else if (exponent + eBias >= 1) {
mantissa = (number * c - 1) * pow(2, mantissaLength);
exponent = exponent + eBias;
} else {
mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
exponent = 0;
}
}
for (
;
mantissaLength >= 8;
buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8
);
exponent = (exponent << mantissaLength) | mantissa;
exponentLength += mantissaLength;
for (
;
exponentLength > 0;
buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8
);
buffer[--index] |= sign * 128;
return buffer;
};
var unpack = function(buffer, mantissaLength) {
var bytes = buffer.length;
var exponentLength = bytes * 8 - mantissaLength - 1;
var eMax = (1 << exponentLength) - 1;
var eBias = eMax >> 1;
var nBits = exponentLength - 7;
var index = bytes - 1;
var sign = buffer[index--];
var exponent = sign & 127;
var mantissa;
sign >>= 7;
for (
;
nBits > 0;
exponent = exponent * 256 + buffer[index], index--, nBits -= 8
);
mantissa = exponent & ((1 << -nBits) - 1);
exponent >>= -nBits;
nBits += mantissaLength;
for (
;
nBits > 0;
mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8
);
if (exponent === 0) {
exponent = 1 - eBias;
} else if (exponent === eMax) {
return mantissa ? NaN : sign ? -Infinity : Infinity;
} else {
mantissa = mantissa + pow(2, mantissaLength);
exponent = exponent - eBias;
}
return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
};
module.exports = {
pack: pack,
unpack: unpack
};
},
{}
],
83: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
var classof = _dereq_('../internals/classof-raw');
var split = ''.split;
// fallback for non-array-like ES3 and non-enumerable old V8 strings
module.exports = fails(function() {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
})
? function(it) {
return classof(it) == 'String' ? split.call(it, '') : Object(it);
}
: Object;
},
{ '../internals/classof-raw': 46, '../internals/fails': 68 }
],
84: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
// makes subclassing work correct for wrapped built-ins
module.exports = function($this, dummy, Wrapper) {
var NewTarget, NewTargetPrototype;
if (
// it can work only with native `setPrototypeOf`
setPrototypeOf &&
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
typeof (NewTarget = dummy.constructor) == 'function' &&
NewTarget !== Wrapper &&
isObject((NewTargetPrototype = NewTarget.prototype)) &&
NewTargetPrototype !== Wrapper.prototype
)
setPrototypeOf($this, NewTargetPrototype);
return $this;
};
},
{ '../internals/is-object': 91, '../internals/object-set-prototype-of': 118 }
],
85: [
function(_dereq_, module, exports) {
var store = _dereq_('../internals/shared-store');
var functionToString = Function.toString;
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
if (typeof store.inspectSource != 'function') {
store.inspectSource = function(it) {
return functionToString.call(it);
};
}
module.exports = store.inspectSource;
},
{ '../internals/shared-store': 136 }
],
86: [
function(_dereq_, module, exports) {
var hiddenKeys = _dereq_('../internals/hidden-keys');
var isObject = _dereq_('../internals/is-object');
var has = _dereq_('../internals/has');
var defineProperty = _dereq_('../internals/object-define-property').f;
var uid = _dereq_('../internals/uid');
var FREEZING = _dereq_('../internals/freezing');
var METADATA = uid('meta');
var id = 0;
var isExtensible =
Object.isExtensible ||
function() {
return true;
};
var setMetadata = function(it) {
defineProperty(it, METADATA, {
value: {
objectID: 'O' + ++id, // object ID
weakData: {} // weak collections IDs
}
});
};
var fastKey = function(it, create) {
// return a primitive with prefix
if (!isObject(it))
return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, METADATA)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return 'F';
// not necessary to add metadata
if (!create) return 'E';
// add missing metadata
setMetadata(it);
// return object ID
}
return it[METADATA].objectID;
};
var getWeakData = function(it, create) {
if (!has(it, METADATA)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return true;
// not necessary to add metadata
if (!create) return false;
// add missing metadata
setMetadata(it);
// return the store of weak collections IDs
}
return it[METADATA].weakData;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it) {
if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA))
setMetadata(it);
return it;
};
var meta = (module.exports = {
REQUIRED: false,
fastKey: fastKey,
getWeakData: getWeakData,
onFreeze: onFreeze
});
hiddenKeys[METADATA] = true;
},
{
'../internals/freezing': 70,
'../internals/has': 77,
'../internals/hidden-keys': 78,
'../internals/is-object': 91,
'../internals/object-define-property': 109,
'../internals/uid': 160
}
],
87: [
function(_dereq_, module, exports) {
var NATIVE_WEAK_MAP = _dereq_('../internals/native-weak-map');
var global = _dereq_('../internals/global');
var isObject = _dereq_('../internals/is-object');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var objectHas = _dereq_('../internals/has');
var sharedKey = _dereq_('../internals/shared-key');
var hiddenKeys = _dereq_('../internals/hidden-keys');
var WeakMap = global.WeakMap;
var set, get, has;
var enforce = function(it) {
return has(it) ? get(it) : set(it, {});
};
var getterFor = function(TYPE) {
return function(it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
}
return state;
};
};
if (NATIVE_WEAK_MAP) {
var store = new WeakMap();
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function(it, metadata) {
wmset.call(store, it, metadata);
return metadata;
};
get = function(it) {
return wmget.call(store, it) || {};
};
has = function(it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function(it, metadata) {
createNonEnumerableProperty(it, STATE, metadata);
return metadata;
};
get = function(it) {
return objectHas(it, STATE) ? it[STATE] : {};
};
has = function(it) {
return objectHas(it, STATE);
};
}
module.exports = {
set: set,
get: get,
has: has,
enforce: enforce,
getterFor: getterFor
};
},
{
'../internals/create-non-enumerable-property': 55,
'../internals/global': 76,
'../internals/has': 77,
'../internals/hidden-keys': 78,
'../internals/is-object': 91,
'../internals/native-weak-map': 102,
'../internals/shared-key': 135
}
],
88: [
function(_dereq_, module, exports) {
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var Iterators = _dereq_('../internals/iterators');
var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;
// check on default Array iterator
module.exports = function(it) {
return (
it !== undefined &&
(Iterators.Array === it || ArrayPrototype[ITERATOR] === it)
);
};
},
{ '../internals/iterators': 96, '../internals/well-known-symbol': 163 }
],
89: [
function(_dereq_, module, exports) {
var classof = _dereq_('../internals/classof-raw');
// `IsArray` abstract operation
// https://tc39.github.io/ecma262/#sec-isarray
module.exports =
Array.isArray ||
function isArray(arg) {
return classof(arg) == 'Array';
};
},
{ '../internals/classof-raw': 46 }
],
90: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
var replacement = /#|\.prototype\./;
var isForced = function(feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL
? true
: value == NATIVE
? false
: typeof detection == 'function' ? fails(detection) : !!detection;
};
var normalize = (isForced.normalize = function(string) {
return String(string)
.replace(replacement, '.')
.toLowerCase();
});
var data = (isForced.data = {});
var NATIVE = (isForced.NATIVE = 'N');
var POLYFILL = (isForced.POLYFILL = 'P');
module.exports = isForced;
},
{ '../internals/fails': 68 }
],
91: [
function(_dereq_, module, exports) {
module.exports = function(it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
},
{}
],
92: [
function(_dereq_, module, exports) {
module.exports = false;
},
{}
],
93: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
var classof = _dereq_('../internals/classof-raw');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var MATCH = wellKnownSymbol('match');
// `IsRegExp` abstract operation
// https://tc39.github.io/ecma262/#sec-isregexp
module.exports = function(it) {
var isRegExp;
return (
isObject(it) &&
((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp')
);
};
},
{
'../internals/classof-raw': 46,
'../internals/is-object': 91,
'../internals/well-known-symbol': 163
}
],
94: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
var toLength = _dereq_('../internals/to-length');
var bind = _dereq_('../internals/function-bind-context');
var getIteratorMethod = _dereq_('../internals/get-iterator-method');
var callWithSafeIterationClosing = _dereq_(
'../internals/call-with-safe-iteration-closing'
);
var Result = function(stopped, result) {
this.stopped = stopped;
this.result = result;
};
var iterate = (module.exports = function(
iterable,
fn,
that,
AS_ENTRIES,
IS_ITERATOR
) {
var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
var iterator, iterFn, index, length, result, next, step;
if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (
index = 0, length = toLength(iterable.length);
length > index;
index++
) {
result = AS_ENTRIES
? boundFunction(anObject((step = iterable[index]))[0], step[1])
: boundFunction(iterable[index]);
if (result && result instanceof Result) return result;
}
return new Result(false);
}
iterator = iterFn.call(iterable);
}
next = iterator.next;
while (!(step = next.call(iterator)).done) {
result = callWithSafeIterationClosing(
iterator,
boundFunction,
step.value,
AS_ENTRIES
);
if (typeof result == 'object' && result && result instanceof Result)
return result;
}
return new Result(false);
});
iterate.stop = function(result) {
return new Result(true, result);
};
},
{
'../internals/an-object': 28,
'../internals/call-with-safe-iteration-closing': 44,
'../internals/function-bind-context': 71,
'../internals/get-iterator-method': 74,
'../internals/is-array-iterator-method': 88,
'../internals/to-length': 151
}
],
95: [
function(_dereq_, module, exports) {
'use strict';
var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var has = _dereq_('../internals/has');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var IS_PURE = _dereq_('../internals/is-pure');
var ITERATOR = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;
var returnThis = function() {
return this;
};
// `%IteratorPrototype%` object
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf(
getPrototypeOf(arrayIterator)
);
if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
IteratorPrototype = PrototypeOfArrayIteratorPrototype;
}
}
if (IteratorPrototype == undefined) IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
}
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
},
{
'../internals/create-non-enumerable-property': 55,
'../internals/has': 77,
'../internals/is-pure': 92,
'../internals/object-get-prototype-of': 114,
'../internals/well-known-symbol': 163
}
],
96: [
function(_dereq_, module, exports) {
arguments[4][78][0].apply(exports, arguments);
},
{ dup: 78 }
],
97: [
function(_dereq_, module, exports) {
// `Math.sign` method implementation
// https://tc39.github.io/ecma262/#sec-math.sign
module.exports =
Math.sign ||
function sign(x) {
// eslint-disable-next-line no-self-compare
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
},
{}
],
98: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var getOwnPropertyDescriptor = _dereq_(
'../internals/object-get-own-property-descriptor'
).f;
var classof = _dereq_('../internals/classof-raw');
var macrotask = _dereq_('../internals/task').set;
var IS_IOS = _dereq_('../internals/engine-is-ios');
var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
var Promise = global.Promise;
var IS_NODE = classof(process) == 'process';
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
var flush, head, last, notify, toggle, node, promise, then;
// modern engines have queueMicrotask method
if (!queueMicrotask) {
flush = function() {
var parent, fn;
if (IS_NODE && (parent = process.domain)) parent.exit();
while (head) {
fn = head.fn;
head = head.next;
try {
fn();
} catch (error) {
if (head) notify();
else last = undefined;
throw error;
}
}
last = undefined;
if (parent) parent.enter();
};
// Node.js
if (IS_NODE) {
notify = function() {
process.nextTick(flush);
};
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
} else if (MutationObserver && !IS_IOS) {
toggle = true;
node = document.createTextNode('');
new MutationObserver(flush).observe(node, { characterData: true });
notify = function() {
node.data = toggle = !toggle;
};
// environments with maybe non-completely correct, but existent Promise
} else if (Promise && Promise.resolve) {
// Promise.resolve without an argument throws an error in LG WebOS 2
promise = Promise.resolve(undefined);
then = promise.then;
notify = function() {
then.call(promise, flush);
};
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessag
// - onreadystatechange
// - setTimeout
} else {
notify = function() {
// strange IE + webpack dev server bug - use .call(global)
macrotask.call(global, flush);
};
}
}
module.exports =
queueMicrotask ||
function(fn) {
var task = { fn: fn, next: undefined };
if (last) last.next = task;
if (!head) {
head = task;
notify();
}
last = task;
};
},
{
'../internals/classof-raw': 46,
'../internals/engine-is-ios': 63,
'../internals/global': 76,
'../internals/object-get-own-property-descriptor': 110,
'../internals/task': 145
}
],
99: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
module.exports = global.Promise;
},
{ '../internals/global': 76 }
],
100: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
module.exports =
!!Object.getOwnPropertySymbols &&
!fails(function() {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
},
{ '../internals/fails': 68 }
],
101: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var IS_PURE = _dereq_('../internals/is-pure');
var ITERATOR = wellKnownSymbol('iterator');
module.exports = !fails(function() {
var url = new URL('b?a=1&b=2&c=3', 'http://a');
var searchParams = url.searchParams;
var result = '';
url.pathname = 'c%20d';
searchParams.forEach(function(value, key) {
searchParams['delete']('b');
result += key + value;
});
return (
(IS_PURE && !url.toJSON) ||
!searchParams.sort ||
url.href !== 'http://a/c%20d?a=1&c=3' ||
searchParams.get('c') !== '3' ||
String(new URLSearchParams('?a=1')) !== 'a=1' ||
!searchParams[ITERATOR] ||
// throws in Edge
new URL('https://a@b').username !== 'a' ||
new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' ||
// not punycoded in Edge
new URL('http://тест').host !== 'xn--e1aybc' ||
// not escaped in Chrome 62-
new URL('http://a#б').hash !== '#%D0%B1' ||
// fails in Chrome 66-
result !== 'a1c3' ||
// throws in Safari
new URL('http://x', undefined).host !== 'x'
);
});
},
{
'../internals/fails': 68,
'../internals/is-pure': 92,
'../internals/well-known-symbol': 163
}
],
102: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var inspectSource = _dereq_('../internals/inspect-source');
var WeakMap = global.WeakMap;
module.exports =
typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
},
{ '../internals/global': 76, '../internals/inspect-source': 85 }
],
103: [
function(_dereq_, module, exports) {
'use strict';
var aFunction = _dereq_('../internals/a-function');
var PromiseCapability = function(C) {
var resolve, reject;
this.promise = new C(function($$resolve, $$reject) {
if (resolve !== undefined || reject !== undefined)
throw TypeError('Bad Promise constructor');
resolve = $$resolve;
reject = $$reject;
});
this.resolve = aFunction(resolve);
this.reject = aFunction(reject);
};
// 25.4.1.5 NewPromiseCapability(C)
module.exports.f = function(C) {
return new PromiseCapability(C);
};
},
{ '../internals/a-function': 23 }
],
104: [
function(_dereq_, module, exports) {
var isRegExp = _dereq_('../internals/is-regexp');
module.exports = function(it) {
if (isRegExp(it)) {
throw TypeError("The method doesn't accept regular expressions");
}
return it;
};
},
{ '../internals/is-regexp': 93 }
],
105: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var globalIsFinite = global.isFinite;
// `Number.isFinite` method
// https://tc39.github.io/ecma262/#sec-number.isfinite
module.exports =
Number.isFinite ||
function isFinite(it) {
return typeof it == 'number' && globalIsFinite(it);
};
},
{ '../internals/global': 76 }
],
106: [
function(_dereq_, module, exports) {
'use strict';
var DESCRIPTORS = _dereq_('../internals/descriptors');
var fails = _dereq_('../internals/fails');
var objectKeys = _dereq_('../internals/object-keys');
var getOwnPropertySymbolsModule = _dereq_(
'../internals/object-get-own-property-symbols'
);
var propertyIsEnumerableModule = _dereq_(
'../internals/object-property-is-enumerable'
);
var toObject = _dereq_('../internals/to-object');
var IndexedObject = _dereq_('../internals/indexed-object');
var nativeAssign = Object.assign;
var defineProperty = Object.defineProperty;
// `Object.assign` method
// https://tc39.github.io/ecma262/#sec-object.assign
module.exports =
!nativeAssign ||
fails(function() {
// should have correct order of operations (Edge bug)
if (
DESCRIPTORS &&
nativeAssign(
{ b: 1 },
nativeAssign(
defineProperty({}, 'a', {
enumerable: true,
get: function() {
defineProperty(this, 'b', {
value: 3,
enumerable: false
});
}
}),
{ b: 2 }
)
).b !== 1
)
return true;
// should work with symbols and should have deterministic property order (V8 bug)
var A = {};
var B = {};
// eslint-disable-next-line no-undef
var symbol = Symbol();
var alphabet = 'abcdefghijklmnopqrst';
A[symbol] = 7;
alphabet.split('').forEach(function(chr) {
B[chr] = chr;
});
return (
nativeAssign({}, A)[symbol] != 7 ||
objectKeys(nativeAssign({}, B)).join('') != alphabet
);
})
? function assign(target, source) {
// eslint-disable-line no-unused-vars
var T = toObject(target);
var argumentsLength = arguments.length;
var index = 1;
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
var propertyIsEnumerable = propertyIsEnumerableModule.f;
while (argumentsLength > index) {
var S = IndexedObject(arguments[index++]);
var keys = getOwnPropertySymbols
? objectKeys(S).concat(getOwnPropertySymbols(S))
: objectKeys(S);
var length = keys.length;
var j = 0;
var key;
while (length > j) {
key = keys[j++];
if (!DESCRIPTORS || propertyIsEnumerable.call(S, key))
T[key] = S[key];
}
}
return T;
}
: nativeAssign;
},
{
'../internals/descriptors': 60,
'../internals/fails': 68,
'../internals/indexed-object': 83,
'../internals/object-get-own-property-symbols': 113,
'../internals/object-keys': 116,
'../internals/object-property-is-enumerable': 117,
'../internals/to-object': 152
}
],
107: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var defineProperties = _dereq_('../internals/object-define-properties');
var enumBugKeys = _dereq_('../internals/enum-bug-keys');
var hiddenKeys = _dereq_('../internals/hidden-keys');
var html = _dereq_('../internals/html');
var documentCreateElement = _dereq_('../internals/document-create-element');
var sharedKey = _dereq_('../internals/shared-key');
var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO = sharedKey('IE_PROTO');
var EmptyConstructor = function() {
/* empty */
};
var scriptTag = function(content) {
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function(activeXDocument) {
activeXDocument.write(scriptTag(''));
activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
activeXDocument = null; // avoid memory leak
return temp;
};
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function() {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};
// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function() {
try {
/* global ActiveXObject */
activeXDocument = document.domain && new ActiveXObject('htmlfile');
} catch (error) {
/* ignore */
}
NullProtoObject = activeXDocument
? NullProtoObjectViaActiveX(activeXDocument)
: NullProtoObjectViaIFrame();
var length = enumBugKeys.length;
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
return NullProtoObject();
};
hiddenKeys[IE_PROTO] = true;
// `Object.create` method
// https://tc39.github.io/ecma262/#sec-object.create
module.exports =
Object.create ||
function create(O, Properties) {
var result;
if (O !== null) {
EmptyConstructor[PROTOTYPE] = anObject(O);
result = new EmptyConstructor();
EmptyConstructor[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = NullProtoObject();
return Properties === undefined
? result
: defineProperties(result, Properties);
};
},
{
'../internals/an-object': 28,
'../internals/document-create-element': 61,
'../internals/enum-bug-keys': 66,
'../internals/hidden-keys': 78,
'../internals/html': 80,
'../internals/object-define-properties': 108,
'../internals/shared-key': 135
}
],
108: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var definePropertyModule = _dereq_('../internals/object-define-property');
var anObject = _dereq_('../internals/an-object');
var objectKeys = _dereq_('../internals/object-keys');
// `Object.defineProperties` method
// https://tc39.github.io/ecma262/#sec-object.defineproperties
module.exports = DESCRIPTORS
? Object.defineProperties
: function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index)
definePropertyModule.f(O, (key = keys[index++]), Properties[key]);
return O;
};
},
{
'../internals/an-object': 28,
'../internals/descriptors': 60,
'../internals/object-define-property': 109,
'../internals/object-keys': 116
}
],
109: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
var anObject = _dereq_('../internals/an-object');
var toPrimitive = _dereq_('../internals/to-primitive');
var nativeDefineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.github.io/ecma262/#sec-object.defineproperty
exports.f = DESCRIPTORS
? nativeDefineProperty
: function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE)
try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) {
/* empty */
}
if ('get' in Attributes || 'set' in Attributes)
throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
},
{
'../internals/an-object': 28,
'../internals/descriptors': 60,
'../internals/ie8-dom-define': 81,
'../internals/to-primitive': 155
}
],
110: [
function(_dereq_, module, exports) {
var DESCRIPTORS = _dereq_('../internals/descriptors');
var propertyIsEnumerableModule = _dereq_(
'../internals/object-property-is-enumerable'
);
var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
var toIndexedObject = _dereq_('../internals/to-indexed-object');
var toPrimitive = _dereq_('../internals/to-primitive');
var has = _dereq_('../internals/has');
var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS
? nativeGetOwnPropertyDescriptor
: function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE)
try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) {
/* empty */
}
if (has(O, P))
return createPropertyDescriptor(
!propertyIsEnumerableModule.f.call(O, P),
O[P]
);
};
},
{
'../internals/create-property-descriptor': 56,
'../internals/descriptors': 60,
'../internals/has': 77,
'../internals/ie8-dom-define': 81,
'../internals/object-property-is-enumerable': 117,
'../internals/to-indexed-object': 149,
'../internals/to-primitive': 155
}
],
111: [
function(_dereq_, module, exports) {
var toIndexedObject = _dereq_('../internals/to-indexed-object');
var nativeGetOwnPropertyNames = _dereq_(
'../internals/object-get-own-property-names'
).f;
var toString = {}.toString;
var windowNames =
typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window)
: [];
var getWindowNames = function(it) {
try {
return nativeGetOwnPropertyNames(it);
} catch (error) {
return windowNames.slice();
}
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]'
? getWindowNames(it)
: nativeGetOwnPropertyNames(toIndexedObject(it));
};
},
{
'../internals/object-get-own-property-names': 112,
'../internals/to-indexed-object': 149
}
],
112: [
function(_dereq_, module, exports) {
var internalObjectKeys = _dereq_('../internals/object-keys-internal');
var enumBugKeys = _dereq_('../internals/enum-bug-keys');
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
exports.f =
Object.getOwnPropertyNames ||
function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
},
{ '../internals/enum-bug-keys': 66, '../internals/object-keys-internal': 115 }
],
113: [
function(_dereq_, module, exports) {
exports.f = Object.getOwnPropertySymbols;
},
{}
],
114: [
function(_dereq_, module, exports) {
var has = _dereq_('../internals/has');
var toObject = _dereq_('../internals/to-object');
var sharedKey = _dereq_('../internals/shared-key');
var CORRECT_PROTOTYPE_GETTER = _dereq_('../internals/correct-prototype-getter');
var IE_PROTO = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;
// `Object.getPrototypeOf` method
// https://tc39.github.io/ecma262/#sec-object.getprototypeof
module.exports = CORRECT_PROTOTYPE_GETTER
? Object.getPrototypeOf
: function(O) {
O = toObject(O);
if (has(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
}
return O instanceof Object ? ObjectPrototype : null;
};
},
{
'../internals/correct-prototype-getter': 52,
'../internals/has': 77,
'../internals/shared-key': 135,
'../internals/to-object': 152
}
],
115: [
function(_dereq_, module, exports) {
var has = _dereq_('../internals/has');
var toIndexedObject = _dereq_('../internals/to-indexed-object');
var indexOf = _dereq_('../internals/array-includes').indexOf;
var hiddenKeys = _dereq_('../internals/hidden-keys');
module.exports = function(object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i)
if (has(O, (key = names[i++]))) {
~indexOf(result, key) || result.push(key);
}
return result;
};
},
{
'../internals/array-includes': 36,
'../internals/has': 77,
'../internals/hidden-keys': 78,
'../internals/to-indexed-object': 149
}
],
116: [
function(_dereq_, module, exports) {
var internalObjectKeys = _dereq_('../internals/object-keys-internal');
var enumBugKeys = _dereq_('../internals/enum-bug-keys');
// `Object.keys` method
// https://tc39.github.io/ecma262/#sec-object.keys
module.exports =
Object.keys ||
function keys(O) {
return internalObjectKeys(O, enumBugKeys);
};
},
{ '../internals/enum-bug-keys': 66, '../internals/object-keys-internal': 115 }
],
117: [
function(_dereq_, module, exports) {
'use strict';
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG =
getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
exports.f = NASHORN_BUG
? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
}
: nativePropertyIsEnumerable;
},
{}
],
118: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var aPossiblePrototype = _dereq_('../internals/a-possible-prototype');
// `Object.setPrototypeOf` method
// https://tc39.github.io/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
module.exports =
Object.setPrototypeOf ||
('__proto__' in {}
? (function() {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__')
.set;
setter.call(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) {
/* empty */
}
return function setPrototypeOf(O, proto) {
anObject(O);
aPossiblePrototype(proto);
if (CORRECT_SETTER) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
})()
: undefined);
},
{ '../internals/a-possible-prototype': 24, '../internals/an-object': 28 }
],
119: [
function(_dereq_, module, exports) {
'use strict';
var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
var classof = _dereq_('../internals/classof');
// `Object.prototype.toString` method implementation
// https://tc39.github.io/ecma262/#sec-object.prototype.tostring
module.exports = TO_STRING_TAG_SUPPORT
? {}.toString
: function toString() {
return '[object ' + classof(this) + ']';
};
},
{ '../internals/classof': 47, '../internals/to-string-tag-support': 156 }
],
120: [
function(_dereq_, module, exports) {
var getBuiltIn = _dereq_('../internals/get-built-in');
var getOwnPropertyNamesModule = _dereq_(
'../internals/object-get-own-property-names'
);
var getOwnPropertySymbolsModule = _dereq_(
'../internals/object-get-own-property-symbols'
);
var anObject = _dereq_('../internals/an-object');
// all object keys, includes non-enumerable and symbols
module.exports =
getBuiltIn('Reflect', 'ownKeys') ||
function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
},
{
'../internals/an-object': 28,
'../internals/get-built-in': 73,
'../internals/object-get-own-property-names': 112,
'../internals/object-get-own-property-symbols': 113
}
],
121: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
module.exports = global;
},
{ '../internals/global': 76 }
],
122: [
function(_dereq_, module, exports) {
module.exports = function(exec) {
try {
return { error: false, value: exec() };
} catch (error) {
return { error: true, value: error };
}
};
},
{}
],
123: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var isObject = _dereq_('../internals/is-object');
var newPromiseCapability = _dereq_('../internals/new-promise-capability');
module.exports = function(C, x) {
anObject(C);
if (isObject(x) && x.constructor === C) return x;
var promiseCapability = newPromiseCapability.f(C);
var resolve = promiseCapability.resolve;
resolve(x);
return promiseCapability.promise;
};
},
{
'../internals/an-object': 28,
'../internals/is-object': 91,
'../internals/new-promise-capability': 103
}
],
124: [
function(_dereq_, module, exports) {
var redefine = _dereq_('../internals/redefine');
module.exports = function(target, src, options) {
for (var key in src) redefine(target, key, src[key], options);
return target;
};
},
{ '../internals/redefine': 125 }
],
125: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
var has = _dereq_('../internals/has');
var setGlobal = _dereq_('../internals/set-global');
var inspectSource = _dereq_('../internals/inspect-source');
var InternalStateModule = _dereq_('../internals/internal-state');
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(String).split('String');
(module.exports = function(O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
if (typeof value == 'function') {
if (typeof key == 'string' && !has(value, 'name'))
createNonEnumerableProperty(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(
typeof key == 'string' ? key : ''
);
}
if (O === global) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else createNonEnumerableProperty(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return (
(typeof this == 'function' && getInternalState(this).source) ||
inspectSource(this)
);
});
},
{
'../internals/create-non-enumerable-property': 55,
'../internals/global': 76,
'../internals/has': 77,
'../internals/inspect-source': 85,
'../internals/internal-state': 87,
'../internals/set-global': 132
}
],
126: [
function(_dereq_, module, exports) {
var classof = _dereq_('./classof-raw');
var regexpExec = _dereq_('./regexp-exec');
// `RegExpExec` abstract operation
// https://tc39.github.io/ecma262/#sec-regexpexec
module.exports = function(R, S) {
var exec = R.exec;
if (typeof exec === 'function') {
var result = exec.call(R, S);
if (typeof result !== 'object') {
throw TypeError(
'RegExp exec method returned something other than an Object or null'
);
}
return result;
}
if (classof(R) !== 'RegExp') {
throw TypeError('RegExp#exec called on incompatible receiver');
}
return regexpExec.call(R, S);
};
},
{ './classof-raw': 46, './regexp-exec': 127 }
],
127: [
function(_dereq_, module, exports) {
'use strict';
var regexpFlags = _dereq_('./regexp-flags');
var stickyHelpers = _dereq_('./regexp-sticky-helpers');
var nativeExec = RegExp.prototype.exec;
// This always refers to the native implementation, because the
// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
// which loads this file before patching the method.
var nativeReplace = String.prototype.replace;
var patchedExec = nativeExec;
var UPDATES_LAST_INDEX_WRONG = (function() {
var re1 = /a/;
var re2 = /b*/g;
nativeExec.call(re1, 'a');
nativeExec.call(re2, 'a');
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
})();
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
// nonparticipating capturing group, copied from es5-shim's String#split patch.
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
if (PATCH) {
patchedExec = function exec(str) {
var re = this;
var lastIndex, reCopy, match, i;
var sticky = UNSUPPORTED_Y && re.sticky;
var flags = regexpFlags.call(re);
var source = re.source;
var charsAdded = 0;
var strCopy = str;
if (sticky) {
flags = flags.replace('y', '');
if (flags.indexOf('g') === -1) {
flags += 'g';
}
strCopy = String(str).slice(re.lastIndex);
// Support anchored sticky behavior.
if (
re.lastIndex > 0 &&
(!re.multiline || (re.multiline && str[re.lastIndex - 1] !== '\n'))
) {
source = '(?: ' + source + ')';
strCopy = ' ' + strCopy;
charsAdded++;
}
// ^(? + rx + ) is needed, in combination with some str slicing, to
// simulate the 'y' flag.
reCopy = new RegExp('^(?:' + source + ')', flags);
}
if (NPCG_INCLUDED) {
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
}
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
match = nativeExec.call(sticky ? reCopy : re, strCopy);
if (sticky) {
if (match) {
match.input = match.input.slice(charsAdded);
match[0] = match[0].slice(charsAdded);
match.index = re.lastIndex;
re.lastIndex += match[0].length;
} else re.lastIndex = 0;
} else if (UPDATES_LAST_INDEX_WRONG && match) {
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
}
if (NPCG_INCLUDED && match && match.length > 1) {
// Fix browsers whose `exec` methods don't consistently return `undefined`
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
nativeReplace.call(match[0], reCopy, function() {
for (i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined) match[i] = undefined;
}
});
}
return match;
};
}
module.exports = patchedExec;
},
{ './regexp-flags': 128, './regexp-sticky-helpers': 129 }
],
128: [
function(_dereq_, module, exports) {
'use strict';
var anObject = _dereq_('../internals/an-object');
// `RegExp.prototype.flags` getter implementation
// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
module.exports = function() {
var that = anObject(this);
var result = '';
if (that.global) result += 'g';
if (that.ignoreCase) result += 'i';
if (that.multiline) result += 'm';
if (that.dotAll) result += 's';
if (that.unicode) result += 'u';
if (that.sticky) result += 'y';
return result;
};
},
{ '../internals/an-object': 28 }
],
129: [
function(_dereq_, module, exports) {
'use strict';
var fails = _dereq_('./fails');
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
// so we use an intermediate function.
function RE(s, f) {
return RegExp(s, f);
}
exports.UNSUPPORTED_Y = fails(function() {
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
var re = RE('a', 'y');
re.lastIndex = 2;
return re.exec('abcd') != null;
});
exports.BROKEN_CARET = fails(function() {
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
var re = RE('^r', 'gy');
re.lastIndex = 2;
return re.exec('str') != null;
});
},
{ './fails': 68 }
],
130: [
function(_dereq_, module, exports) {
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
module.exports = function(it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
},
{}
],
131: [
function(_dereq_, module, exports) {
// `SameValue` abstract operation
// https://tc39.github.io/ecma262/#sec-samevalue
module.exports =
Object.is ||
function is(x, y) {
// eslint-disable-next-line no-self-compare
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
},
{}
],
132: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var createNonEnumerableProperty = _dereq_(
'../internals/create-non-enumerable-property'
);
module.exports = function(key, value) {
try {
createNonEnumerableProperty(global, key, value);
} catch (error) {
global[key] = value;
}
return value;
};
},
{ '../internals/create-non-enumerable-property': 55, '../internals/global': 76 }
],
133: [
function(_dereq_, module, exports) {
'use strict';
var getBuiltIn = _dereq_('../internals/get-built-in');
var definePropertyModule = _dereq_('../internals/object-define-property');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var DESCRIPTORS = _dereq_('../internals/descriptors');
var SPECIES = wellKnownSymbol('species');
module.exports = function(CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
var defineProperty = definePropertyModule.f;
if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
defineProperty(Constructor, SPECIES, {
configurable: true,
get: function() {
return this;
}
});
}
};
},
{
'../internals/descriptors': 60,
'../internals/get-built-in': 73,
'../internals/object-define-property': 109,
'../internals/well-known-symbol': 163
}
],
134: [
function(_dereq_, module, exports) {
var defineProperty = _dereq_('../internals/object-define-property').f;
var has = _dereq_('../internals/has');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
module.exports = function(it, TAG, STATIC) {
if (it && !has((it = STATIC ? it : it.prototype), TO_STRING_TAG)) {
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
}
};
},
{
'../internals/has': 77,
'../internals/object-define-property': 109,
'../internals/well-known-symbol': 163
}
],
135: [
function(_dereq_, module, exports) {
var shared = _dereq_('../internals/shared');
var uid = _dereq_('../internals/uid');
var keys = shared('keys');
module.exports = function(key) {
return keys[key] || (keys[key] = uid(key));
};
},
{ '../internals/shared': 137, '../internals/uid': 160 }
],
136: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var setGlobal = _dereq_('../internals/set-global');
var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});
module.exports = store;
},
{ '../internals/global': 76, '../internals/set-global': 132 }
],
137: [
function(_dereq_, module, exports) {
var IS_PURE = _dereq_('../internals/is-pure');
var store = _dereq_('../internals/shared-store');
(module.exports = function(key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.6.5',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
});
},
{ '../internals/is-pure': 92, '../internals/shared-store': 136 }
],
138: [
function(_dereq_, module, exports) {
var anObject = _dereq_('../internals/an-object');
var aFunction = _dereq_('../internals/a-function');
var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
var SPECIES = wellKnownSymbol('species');
// `SpeciesConstructor` abstract operation
// https://tc39.github.io/ecma262/#sec-speciesconstructor
module.exports = function(O, defaultConstructor) {
var C = anObject(O).constructor;
var S;
return C === undefined || (S = anObject(C)[SPECIES]) == undefined
? defaultConstructor
: aFunction(S);
};
},
{
'../internals/a-function': 23,
'../internals/an-object': 28,
'../internals/well-known-symbol': 163
}
],
139: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
// check the existence of a method, lowercase
// of a tag and escaping quotes in arguments
module.exports = function(METHOD_NAME) {
return fails(function() {
var test = ''[METHOD_NAME]('"');
return test !== test.toLowerCase() || test.split('"').length > 3;
});
};
},
{ '../internals/fails': 68 }
],
140: [
function(_dereq_, module, exports) {
var toInteger = _dereq_('../internals/to-integer');
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
// `String.prototype.{ codePointAt, at }` methods implementation
var createMethod = function(CONVERT_TO_STRING) {
return function($this, pos) {
var S = String(requireObjectCoercible($this));
var position = toInteger(pos);
var size = S.length;
var first, second;
if (position < 0 || position >= size)
return CONVERT_TO_STRING ? '' : undefined;
first = S.charCodeAt(position);
return first < 0xd800 ||
first > 0xdbff ||
position + 1 === size ||
(second = S.charCodeAt(position + 1)) < 0xdc00 ||
second > 0xdfff
? CONVERT_TO_STRING ? S.charAt(position) : first
: CONVERT_TO_STRING
? S.slice(position, position + 2)
: ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;
};
};
module.exports = {
// `String.prototype.codePointAt` method
// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
codeAt: createMethod(false),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: createMethod(true)
};
},
{ '../internals/require-object-coercible': 130, '../internals/to-integer': 150 }
],
141: [
function(_dereq_, module, exports) {
'use strict';
// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
var base = 36;
var tMin = 1;
var tMax = 26;
var skew = 38;
var damp = 700;
var initialBias = 72;
var initialN = 128; // 0x80
var delimiter = '-'; // '\x2D'
var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
var baseMinusTMin = base - tMin;
var floor = Math.floor;
var stringFromCharCode = String.fromCharCode;
/**
* Creates an array containing the numeric code points of each Unicode
* character in the string. While JavaScript uses UCS-2 internally,
* this function will convert a pair of surrogate halves (each of which
* UCS-2 exposes as separate characters) into a single code point,
* matching UTF-16.
*/
var ucs2decode = function(string) {
var output = [];
var counter = 0;
var length = string.length;
while (counter < length) {
var value = string.charCodeAt(counter++);
if (value >= 0xd800 && value <= 0xdbff && counter < length) {
// It's a high surrogate, and there is a next character.
var extra = string.charCodeAt(counter++);
if ((extra & 0xfc00) == 0xdc00) {
// Low surrogate.
output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
} else {
// It's an unmatched surrogate; only append this code unit, in case the
// next code unit is the high surrogate of a surrogate pair.
output.push(value);
counter--;
}
} else {
output.push(value);
}
}
return output;
};
/**
* Converts a digit/integer into a basic code point.
*/
var digitToBasic = function(digit) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26);
};
/**
* Bias adaptation function as per section 3.4 of RFC 3492.
* https://tools.ietf.org/html/rfc3492#section-3.4
*/
var adapt = function(delta, numPoints, firstTime) {
var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (; delta > (baseMinusTMin * tMax) >> 1; k += base) {
delta = floor(delta / baseMinusTMin);
}
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};
/**
* Converts a string of Unicode symbols (e.g. a domain name label) to a
* Punycode string of ASCII-only symbols.
*/
// eslint-disable-next-line max-statements
var encode = function(input) {
var output = [];
// Convert the input in UCS-2 to an array of Unicode code points.
input = ucs2decode(input);
// Cache the length.
var inputLength = input.length;
// Initialize the state.
var n = initialN;
var delta = 0;
var bias = initialBias;
var i, currentValue;
// Handle the basic code points.
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue < 0x80) {
output.push(stringFromCharCode(currentValue));
}
}
var basicLength = output.length; // number of basic code points.
var handledCPCount = basicLength; // number of code points that have been handled;
// Finish the basic string with a delimiter unless it's empty.
if (basicLength) {
output.push(delimiter);
}
// Main encoding loop:
while (handledCPCount < inputLength) {
// All non-basic code points < n have been handled already. Find the next larger one:
var m = maxInt;
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue >= n && currentValue < m) {
m = currentValue;
}
}
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
var handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
throw RangeError(OVERFLOW_ERROR);
}
delta += (m - n) * handledCPCountPlusOne;
n = m;
for (i = 0; i < input.length; i++) {
currentValue = input[i];
if (currentValue < n && ++delta > maxInt) {
throw RangeError(OVERFLOW_ERROR);
}
if (currentValue == n) {
// Represent delta as a generalized variable-length integer.
var q = delta;
for (var k = base /* no condition */; ; k += base) {
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
if (q < t) break;
var qMinusT = q - t;
var baseMinusT = base - t;
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
q = floor(qMinusT / baseMinusT);
}
output.push(stringFromCharCode(digitToBasic(q)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
delta = 0;
++handledCPCount;
}
}
++delta;
++n;
}
return output.join('');
};
module.exports = function(input) {
var encoded = [];
var labels = input
.toLowerCase()
.replace(regexSeparators, '\u002E')
.split('.');
var i, label;
for (i = 0; i < labels.length; i++) {
label = labels[i];
encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
}
return encoded.join('.');
};
},
{}
],
142: [
function(_dereq_, module, exports) {
'use strict';
var toInteger = _dereq_('../internals/to-integer');
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
// `String.prototype.repeat` method implementation
// https://tc39.github.io/ecma262/#sec-string.prototype.repeat
module.exports =
''.repeat ||
function repeat(count) {
var str = String(requireObjectCoercible(this));
var result = '';
var n = toInteger(count);
if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
return result;
};
},
{ '../internals/require-object-coercible': 130, '../internals/to-integer': 150 }
],
143: [
function(_dereq_, module, exports) {
var fails = _dereq_('../internals/fails');
var whitespaces = _dereq_('../internals/whitespaces');
var non = '\u200B\u0085\u180E';
// check that a method works with the correct list
// of whitespaces and has a correct name
module.exports = function(METHOD_NAME) {
return fails(function() {
return (
!!whitespaces[METHOD_NAME]() ||
non[METHOD_NAME]() != non ||
whitespaces[METHOD_NAME].name !== METHOD_NAME
);
});
};
},
{ '../internals/fails': 68, '../internals/whitespaces': 164 }
],
144: [
function(_dereq_, module, exports) {
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
var whitespaces = _dereq_('../internals/whitespaces');
var whitespace = '[' + whitespaces + ']';
var ltrim = RegExp('^' + whitespace + whitespace + '*');
var rtrim = RegExp(whitespace + whitespace + '*$');
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
var createMethod = function(TYPE) {
return function($this) {
var string = String(requireObjectCoercible($this));
if (TYPE & 1) string = string.replace(ltrim, '');
if (TYPE & 2) string = string.replace(rtrim, '');
return string;
};
};
module.exports = {
// `String.prototype.{ trimLeft, trimStart }` methods
// https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
start: createMethod(1),
// `String.prototype.{ trimRight, trimEnd }` methods
// https://tc39.github.io/ecma262/#sec-string.prototype.trimend
end: createMethod(2),
// `String.prototype.trim` method
// https://tc39.github.io/ecma262/#sec-string.prototype.trim
trim: createMethod(3)
};
},
{ '../internals/require-object-coercible': 130, '../internals/whitespaces': 164 }
],
145: [
function(_dereq_, module, exports) {
var global = _dereq_('../internals/global');
var fails = _dereq_('../internals/fails');
var classof = _dereq_('../internals/classof-raw');
var bind = _dereq_('../internals/function-bind-context');
var html = _dereq_('../internals/html');
var createElement = _dereq_('../internals/document-create-element');
var IS_IOS = _dereq_('../internals/engine-is-ios');
var location = global.location;
var set = global.setImmediate;
var clear = global.clearImmediate;
var process = global.process;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
var run = function(id) {
// eslint-disable-next-line no-prototype-builtins
if (queue.hasOwnProperty(id)) {
var fn = queue[id];
delete queue[id];
fn();
}
};
var runner = function(id) {
return function() {
run(id);
};
};
var listener = function(event) {
run(event.data);
};
var post = function(id) {
// old engines have not location.origin
global.postMessage(id + '', location.protocol + '//' + location.host);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set || !clear) {
set = function setImmediate(fn) {
var args = [];
var i = 1;
while (arguments.length > i) args.push(arguments[i++]);
queue[++counter] = function() {
// eslint-disable-next-line no-new-func
(typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
};
defer(counter);
return counter;
};
clear = function clearImmediate(id) {
delete queue[id];
};
// Node.js 0.8-
if (classof(process) == 'process') {
defer = function(id) {
process.nextTick(runner(id));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function(id) {
Dispatch.now(runner(id));
};
// Browsers with MessageChannel, includes WebWorkers
// except iOS - https://github.com/zloirock/core-js/issues/624
} else if (MessageChannel && !IS_IOS) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = listener;
defer = bind(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (
global.addEventListener &&
typeof postMessage == 'function' &&
!global.importScripts &&
!fails(post) &&
location.protocol !== 'file:'
) {
defer = post;
global.addEventListener('message', listener, false);
// IE8-
} else if (ONREADYSTATECHANGE in createElement('script')) {
defer = function(id) {
html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function() {
html.removeChild(this);
run(id);
};
};
// Rest old browsers
} else {
defer = function(id) {
setTimeout(runner(id), 0);
};
}
}
module.exports = {
set: set,
clear: clear
};
},
{
'../internals/classof-raw': 46,
'../internals/document-create-element': 61,
'../internals/engine-is-ios': 63,
'../internals/fails': 68,
'../internals/function-bind-context': 71,
'../internals/global': 76,
'../internals/html': 80
}
],
146: [
function(_dereq_, module, exports) {
var classof = _dereq_('../internals/classof-raw');
// `thisNumberValue` abstract operation
// https://tc39.github.io/ecma262/#sec-thisnumbervalue
module.exports = function(value) {
if (typeof value != 'number' && classof(value) != 'Number') {
throw TypeError('Incorrect invocation');
}
return +value;
};
},
{ '../internals/classof-raw': 46 }
],
147: [
function(_dereq_, module, exports) {
var toInteger = _dereq_('../internals/to-integer');
var max = Math.max;
var min = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
module.exports = function(index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min(integer, length);
};
},
{ '../internals/to-integer': 150 }
],
148: [
function(_dereq_, module, exports) {
var toInteger = _dereq_('../internals/to-integer');
var toLength = _dereq_('../internals/to-length');
// `ToIndex` abstract operation
// https://tc39.github.io/ecma262/#sec-toindex
module.exports = function(it) {
if (it === undefined) return 0;
var number = toInteger(it);
var length = toLength(number);
if (number !== length) throw RangeError('Wrong length or index');
return length;
};
},
{ '../internals/to-integer': 150, '../internals/to-length': 151 }
],
149: [
function(_dereq_, module, exports) {
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = _dereq_('../internals/indexed-object');
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
module.exports = function(it) {
return IndexedObject(requireObjectCoercible(it));
};
},
{ '../internals/indexed-object': 83, '../internals/require-object-coercible': 130 }
],
150: [
function(_dereq_, module, exports) {
var ceil = Math.ceil;
var floor = Math.floor;
// `ToInteger` abstract operation
// https://tc39.github.io/ecma262/#sec-tointeger
module.exports = function(argument) {
return isNaN((argument = +argument))
? 0
: (argument > 0 ? floor : ceil)(argument);
};
},
{}
],
151: [
function(_dereq_, module, exports) {
var toInteger = _dereq_('../internals/to-integer');
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.github.io/ecma262/#sec-tolength
module.exports = function(argument) {
return argument > 0 ? min(toInteger(argument), 0x1fffffffffffff) : 0; // 2 ** 53 - 1 == 9007199254740991
};
},
{ '../internals/to-integer': 150 }
],
152: [
function(_dereq_, module, exports) {
var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function(argument) {
return Object(requireObjectCoercible(argument));
};
},
{ '../internals/require-object-coercible': 130 }
],
153: [
function(_dereq_, module, exports) {
var toPositiveInteger = _dereq_('../internals/to-positive-integer');
module.exports = function(it, BYTES) {
var offset = toPositiveInteger(it);
if (offset % BYTES) throw RangeError('Wrong offset');
return offset;
};
},
{ '../internals/to-positive-integer': 154 }
],
154: [
function(_dereq_, module, exports) {
var toInteger = _dereq_('../internals/to-integer');
module.exports = function(it) {
var result = toInteger(it);
if (result < 0) throw RangeError("The argument can't be less than 0");
return result;
};
},
{ '../internals/to-integer': 150 }
],
155: [
function(_dereq_, module, exports) {
var isObject = _dereq_('../internals/is-object');
// `ToPrimitive` abstract operation
// https://tc39.github.io/ecma262/#sec-toprimitive
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment