diff --git a/README.md b/README.md
index 64b32ad5009..6b787dd1b42 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ and publishing now, remix the starter example on:
```html
-
+
@@ -117,7 +117,7 @@ and publishing now, remix the starter example on:
```
With A-Frame's [entity-component
-architecture](https://aframe.io/docs/1.3.0/introduction/entity-component-system.html), we can drop in community
+architecture](https://aframe.io/docs/1.4.0/introduction/entity-component-system.html), we can drop in community
components from the ecosystem (e.g., ocean, physics) and plug them into our
objects straight from HTML:
@@ -126,10 +126,10 @@ objects straight from HTML:
```html
-
+
-
+
@@ -157,11 +157,11 @@ objects straight from HTML:
### Builds
-To use the latest stable build of A-Frame, include [`aframe.min.js`](https://aframe.io/releases/1.3.0/aframe.min.js):
+To use the latest stable build of A-Frame, include [`aframe.min.js`](https://aframe.io/releases/1.4.0/aframe.min.js):
```js
-
+
```
diff --git a/dist/aframe-master.js b/dist/aframe-master.js
index d073511df25..5970c965c4d 100644
--- a/dist/aframe-master.js
+++ b/dist/aframe-master.js
@@ -1,330 +1,849 @@
-(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.AFRAME = 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 {
+return /******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ "./node_modules/@ungap/custom-elements/index.js":
+/*!******************************************************!*\
+ !*** ./node_modules/@ungap/custom-elements/index.js ***!
+ \******************************************************/
+/***/ (() => {
+
+/*! (c) Andrea Giammarchi @webreflection ISC */
+(function () {
+ 'use strict';
+
+ var attributesObserver = function (whenDefined, MutationObserver) {
+ var attributeChanged = function attributeChanged(records) {
+ for (var i = 0, length = records.length; i < length; i++) {
+ dispatch(records[i]);
+ }
+ };
+ var dispatch = function dispatch(_ref) {
+ var target = _ref.target,
+ attributeName = _ref.attributeName,
+ oldValue = _ref.oldValue;
+ target.attributeChangedCallback(attributeName, oldValue, target.getAttribute(attributeName));
+ };
+ return function (target, is) {
+ var attributeFilter = target.constructor.observedAttributes;
+ if (attributeFilter) {
+ whenDefined(is).then(function () {
+ new MutationObserver(attributeChanged).observe(target, {
+ attributes: true,
+ attributeOldValue: true,
+ attributeFilter: attributeFilter
+ });
+ for (var i = 0, length = attributeFilter.length; i < length; i++) {
+ if (target.hasAttribute(attributeFilter[i])) dispatch({
+ target: target,
+ attributeName: attributeFilter[i],
+ oldValue: null
+ });
+ }
+ });
+ }
+ return target;
+ };
+ };
+ function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+ }
+ function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+ return arr2;
+ }
+ function _createForOfIteratorHelper(o, allowArrayLike) {
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
+ if (!it) {
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
+ if (it) o = it;
+ var i = 0;
+ var F = function () {};
+ return {
+ s: F,
+ n: function () {
+ if (i >= o.length) return {
+ done: true
+ };
+ return {
+ done: false,
+ value: o[i++]
+ };
+ },
+ e: function (e) {
+ throw e;
+ },
+ f: F
+ };
+ }
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+ var normalCompletion = true,
+ didErr = false,
+ err;
+ return {
+ s: function () {
+ it = it.call(o);
+ },
+ n: function () {
+ var step = it.next();
+ normalCompletion = step.done;
+ return step;
+ },
+ e: function (e) {
+ didErr = true;
+ err = e;
+ },
+ f: function () {
+ try {
+ if (!normalCompletion && it.return != null) it.return();
+ } finally {
+ if (didErr) throw err;
+ }
+ }
+ };
+ }
+
+ /*! (c) Andrea Giammarchi - ISC */
+ var TRUE = true,
+ FALSE = false,
+ QSA$1 = 'querySelectorAll';
+
+ /**
+ * Start observing a generic document or root element.
+ * @param {(node:Element, connected:boolean) => void} callback triggered per each dis/connected element
+ * @param {Document|Element} [root=document] by default, the global document to observe
+ * @param {Function} [MO=MutationObserver] by default, the global MutationObserver
+ * @param {string[]} [query=['*']] the selectors to use within nodes
+ * @returns {MutationObserver}
+ */
+ var notify = function notify(callback) {
+ var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
+ var MO = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MutationObserver;
+ var query = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ['*'];
+ var loop = function loop(nodes, selectors, added, removed, connected, pass) {
+ var _iterator = _createForOfIteratorHelper(nodes),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var node = _step.value;
+ if (pass || QSA$1 in node) {
+ if (connected) {
+ if (!added.has(node)) {
+ added.add(node);
+ removed["delete"](node);
+ callback(node, connected);
+ }
+ } else if (!removed.has(node)) {
+ removed.add(node);
+ added["delete"](node);
+ callback(node, connected);
+ }
+ if (!pass) loop(node[QSA$1](selectors), selectors, added, removed, connected, TRUE);
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ };
+ var mo = new MO(function (records) {
+ if (query.length) {
+ var selectors = query.join(',');
+ var added = new Set(),
+ removed = new Set();
+ var _iterator2 = _createForOfIteratorHelper(records),
+ _step2;
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var _step2$value = _step2.value,
+ addedNodes = _step2$value.addedNodes,
+ removedNodes = _step2$value.removedNodes;
+ loop(removedNodes, selectors, added, removed, FALSE, FALSE);
+ loop(addedNodes, selectors, added, removed, TRUE, FALSE);
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
+ }
+ });
+ var observe = mo.observe;
+ (mo.observe = function (node) {
+ return observe.call(mo, node, {
+ subtree: TRUE,
+ childList: TRUE
+ });
+ })(root);
+ return mo;
+ };
+ var QSA = 'querySelectorAll';
+ var _self$1 = self,
+ document$2 = _self$1.document,
+ Element$1 = _self$1.Element,
+ MutationObserver$2 = _self$1.MutationObserver,
+ Set$2 = _self$1.Set,
+ WeakMap$1 = _self$1.WeakMap;
+ var elements = function elements(element) {
+ return QSA in element;
+ };
+ var filter = [].filter;
+ var qsaObserver = function (options) {
+ var live = new WeakMap$1();
+ var drop = function drop(elements) {
+ for (var i = 0, length = elements.length; i < length; i++) {
+ live["delete"](elements[i]);
+ }
+ };
+ var flush = function flush() {
+ var records = observer.takeRecords();
+ for (var i = 0, length = records.length; i < length; i++) {
+ parse(filter.call(records[i].removedNodes, elements), false);
+ parse(filter.call(records[i].addedNodes, elements), true);
+ }
+ };
+ var matches = function matches(element) {
+ return element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
+ };
+ var notifier = function notifier(element, connected) {
+ var selectors;
+ if (connected) {
+ for (var q, m = matches(element), i = 0, length = query.length; i < length; i++) {
+ if (m.call(element, q = query[i])) {
+ if (!live.has(element)) live.set(element, new Set$2());
+ selectors = live.get(element);
+ if (!selectors.has(q)) {
+ selectors.add(q);
+ options.handle(element, connected, q);
+ }
+ }
+ }
+ } else if (live.has(element)) {
+ selectors = live.get(element);
+ live["delete"](element);
+ selectors.forEach(function (q) {
+ options.handle(element, connected, q);
+ });
+ }
+ };
+ var parse = function parse(elements) {
+ var connected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ for (var i = 0, length = elements.length; i < length; i++) {
+ notifier(elements[i], connected);
+ }
+ };
+ var query = options.query;
+ var root = options.root || document$2;
+ var observer = notify(notifier, root, MutationObserver$2, query);
+ var attachShadow = Element$1.prototype.attachShadow;
+ if (attachShadow) Element$1.prototype.attachShadow = function (init) {
+ var shadowRoot = attachShadow.call(this, init);
+ observer.observe(shadowRoot);
+ return shadowRoot;
+ };
+ if (query.length) parse(root[QSA](query));
+ return {
+ drop: drop,
+ flush: flush,
+ observer: observer,
+ parse: parse
+ };
+ };
+ var _self = self,
+ document$1 = _self.document,
+ Map = _self.Map,
+ MutationObserver$1 = _self.MutationObserver,
+ Object$1 = _self.Object,
+ Set$1 = _self.Set,
+ WeakMap = _self.WeakMap,
+ Element = _self.Element,
+ HTMLElement = _self.HTMLElement,
+ Node = _self.Node,
+ Error = _self.Error,
+ TypeError$1 = _self.TypeError,
+ Reflect = _self.Reflect;
+ var defineProperty = Object$1.defineProperty,
+ keys = Object$1.keys,
+ getOwnPropertyNames = Object$1.getOwnPropertyNames,
+ setPrototypeOf = Object$1.setPrototypeOf;
+ var legacy = !self.customElements;
+ var expando = function expando(element) {
+ var key = keys(element);
+ var value = [];
+ var length = key.length;
+ for (var i = 0; i < length; i++) {
+ value[i] = element[key[i]];
+ delete element[key[i]];
+ }
+ return function () {
+ for (var _i = 0; _i < length; _i++) {
+ element[key[_i]] = value[_i];
+ }
+ };
+ };
+ if (legacy) {
+ var HTMLBuiltIn = function HTMLBuiltIn() {
+ var constructor = this.constructor;
+ if (!classes.has(constructor)) throw new TypeError$1('Illegal constructor');
+ var is = classes.get(constructor);
+ if (override) return augment(override, is);
+ var element = createElement.call(document$1, is);
+ return augment(setPrototypeOf(element, constructor.prototype), is);
+ };
+ var createElement = document$1.createElement;
+ var classes = new Map();
+ var defined = new Map();
+ var prototypes = new Map();
+ var registry = new Map();
+ var query = [];
+ var handle = function handle(element, connected, selector) {
+ var proto = prototypes.get(selector);
+ if (connected && !proto.isPrototypeOf(element)) {
+ var redefine = expando(element);
+ override = setPrototypeOf(element, proto);
+ try {
+ new proto.constructor();
+ } finally {
+ override = null;
+ redefine();
+ }
+ }
+ var method = "".concat(connected ? '' : 'dis', "connectedCallback");
+ if (method in proto) element[method]();
+ };
+ var _qsaObserver = qsaObserver({
+ query: query,
+ handle: handle
+ }),
+ parse = _qsaObserver.parse;
+ var override = null;
+ var whenDefined = function whenDefined(name) {
+ if (!defined.has(name)) {
+ var _,
+ $ = new Promise(function ($) {
+ _ = $;
+ });
+ defined.set(name, {
+ $: $,
+ _: _
+ });
+ }
+ return defined.get(name).$;
+ };
+ var augment = attributesObserver(whenDefined, MutationObserver$1);
+ defineProperty(self, 'customElements', {
+ configurable: true,
+ value: {
+ define: function define(is, Class) {
+ if (registry.has(is)) throw new Error("the name \"".concat(is, "\" has already been used with this registry"));
+ classes.set(Class, is);
+ prototypes.set(is, Class.prototype);
+ registry.set(is, Class);
+ query.push(is);
+ whenDefined(is).then(function () {
+ parse(document$1.querySelectorAll(is));
+ });
+ defined.get(is)._(Class);
+ },
+ get: function get(is) {
+ return registry.get(is);
+ },
+ whenDefined: whenDefined
+ }
+ });
+ defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {
+ value: HTMLBuiltIn
+ });
+ defineProperty(self, 'HTMLElement', {
+ configurable: true,
+ value: HTMLBuiltIn
+ });
+ defineProperty(document$1, 'createElement', {
+ configurable: true,
+ value: function value(name, options) {
+ var is = options && options.is;
+ var Class = is ? registry.get(is) : registry.get(name);
+ return Class ? new Class() : createElement.call(document$1, name);
+ }
+ });
+ // in case ShadowDOM is used through a polyfill, to avoid issues
+ // with builtin extends within shadow roots
+ if (!('isConnected' in Node.prototype)) defineProperty(Node.prototype, 'isConnected', {
+ configurable: true,
+ get: function get() {
+ return !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED);
+ }
+ });
+ } else {
+ legacy = !self.customElements.get('extends-li');
+ if (legacy) {
+ try {
+ var LI = function LI() {
+ return self.Reflect.construct(HTMLLIElement, [], LI);
+ };
+ LI.prototype = HTMLLIElement.prototype;
+ var is = 'extends-li';
+ self.customElements.define('extends-li', LI, {
+ 'extends': 'li'
+ });
+ legacy = document$1.createElement('li', {
+ is: is
+ }).outerHTML.indexOf(is) < 0;
+ var _self$customElements = self.customElements,
+ get = _self$customElements.get,
+ _whenDefined = _self$customElements.whenDefined;
+ defineProperty(self.customElements, 'whenDefined', {
+ configurable: true,
+ value: function value(is) {
+ var _this = this;
+ return _whenDefined.call(this, is).then(function (Class) {
+ return Class || get.call(_this, is);
+ });
+ }
+ });
+ } catch (o_O) {}
+ }
+ }
+ if (legacy) {
+ var parseShadow = function parseShadow(element) {
+ var root = shadowRoots.get(element);
+ _parse(root.querySelectorAll(this), element.isConnected);
+ };
+ var customElements = self.customElements;
+ var _createElement = document$1.createElement;
+ var define = customElements.define,
+ _get = customElements.get,
+ upgrade = customElements.upgrade;
+ var _ref = Reflect || {
+ construct: function construct(HTMLElement) {
+ return HTMLElement.call(this);
+ }
+ },
+ construct = _ref.construct;
+ var shadowRoots = new WeakMap();
+ var shadows = new Set$1();
+ var _classes = new Map();
+ var _defined = new Map();
+ var _prototypes = new Map();
+ var _registry = new Map();
+ var shadowed = [];
+ var _query = [];
+ var getCE = function getCE(is) {
+ return _registry.get(is) || _get.call(customElements, is);
+ };
+ var _handle = function _handle(element, connected, selector) {
+ var proto = _prototypes.get(selector);
+ if (connected && !proto.isPrototypeOf(element)) {
+ var redefine = expando(element);
+ _override = setPrototypeOf(element, proto);
+ try {
+ new proto.constructor();
+ } finally {
+ _override = null;
+ redefine();
+ }
+ }
+ var method = "".concat(connected ? '' : 'dis', "connectedCallback");
+ if (method in proto) element[method]();
+ };
+ var _qsaObserver2 = qsaObserver({
+ query: _query,
+ handle: _handle
+ }),
+ _parse = _qsaObserver2.parse;
+ var _qsaObserver3 = qsaObserver({
+ query: shadowed,
+ handle: function handle(element, connected) {
+ if (shadowRoots.has(element)) {
+ if (connected) shadows.add(element);else shadows["delete"](element);
+ if (_query.length) parseShadow.call(_query, element);
+ }
+ }
+ }),
+ parseShadowed = _qsaObserver3.parse;
+ // qsaObserver also patches attachShadow
+ // be sure this runs *after* that
+ var attachShadow = Element.prototype.attachShadow;
+ if (attachShadow) Element.prototype.attachShadow = function (init) {
+ var root = attachShadow.call(this, init);
+ shadowRoots.set(this, root);
+ return root;
+ };
+ var _whenDefined2 = function _whenDefined2(name) {
+ if (!_defined.has(name)) {
+ var _,
+ $ = new Promise(function ($) {
+ _ = $;
+ });
+ _defined.set(name, {
+ $: $,
+ _: _
+ });
+ }
+ return _defined.get(name).$;
+ };
+ var _augment = attributesObserver(_whenDefined2, MutationObserver$1);
+ var _override = null;
+ getOwnPropertyNames(self).filter(function (k) {
+ return /^HTML.*Element$/.test(k);
+ }).forEach(function (k) {
+ var HTMLElement = self[k];
+ function HTMLBuiltIn() {
+ var constructor = this.constructor;
+ if (!_classes.has(constructor)) throw new TypeError$1('Illegal constructor');
+ var _classes$get = _classes.get(constructor),
+ is = _classes$get.is,
+ tag = _classes$get.tag;
+ if (is) {
+ if (_override) return _augment(_override, is);
+ var element = _createElement.call(document$1, tag);
+ element.setAttribute('is', is);
+ return _augment(setPrototypeOf(element, constructor.prototype), is);
+ } else return construct.call(this, HTMLElement, [], constructor);
+ }
+ defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {
+ value: HTMLBuiltIn
+ });
+ defineProperty(self, k, {
+ value: HTMLBuiltIn
+ });
+ });
+ defineProperty(document$1, 'createElement', {
+ configurable: true,
+ value: function value(name, options) {
+ var is = options && options.is;
+ if (is) {
+ var Class = _registry.get(is);
+ if (Class && _classes.get(Class).tag === name) return new Class();
+ }
+ var element = _createElement.call(document$1, name);
+ if (is) element.setAttribute('is', is);
+ return element;
+ }
+ });
+ defineProperty(customElements, 'get', {
+ configurable: true,
+ value: getCE
+ });
+ defineProperty(customElements, 'whenDefined', {
+ configurable: true,
+ value: _whenDefined2
+ });
+ defineProperty(customElements, 'upgrade', {
+ configurable: true,
+ value: function value(element) {
+ var is = element.getAttribute('is');
+ if (is) {
+ var _constructor = _registry.get(is);
+ if (_constructor) {
+ _augment(setPrototypeOf(element, _constructor.prototype), is);
+ // apparently unnecessary because this is handled by qsa observer
+ // if (element.isConnected && element.connectedCallback)
+ // element.connectedCallback();
+ return;
+ }
+ }
+ upgrade.call(customElements, element);
+ }
+ });
+ defineProperty(customElements, 'define', {
+ configurable: true,
+ value: function value(is, Class, options) {
+ if (getCE(is)) throw new Error("'".concat(is, "' has already been defined as a custom element"));
+ var selector;
+ var tag = options && options["extends"];
+ _classes.set(Class, tag ? {
+ is: is,
+ tag: tag
+ } : {
+ is: '',
+ tag: is
+ });
+ if (tag) {
+ selector = "".concat(tag, "[is=\"").concat(is, "\"]");
+ _prototypes.set(selector, Class.prototype);
+ _registry.set(is, Class);
+ _query.push(selector);
+ } else {
+ define.apply(customElements, arguments);
+ shadowed.push(selector = is);
+ }
+ _whenDefined2(is).then(function () {
+ if (tag) {
+ _parse(document$1.querySelectorAll(selector));
+ shadows.forEach(parseShadow, [selector]);
+ } else parseShadowed(document$1.querySelectorAll(selector));
+ });
+ _defined.get(is)._(Class);
+ }
+ });
+ }
+})();
-module.exports = anArray
+/***/ }),
+/***/ "./node_modules/an-array/index.js":
+/*!****************************************!*\
+ !*** ./node_modules/an-array/index.js ***!
+ \****************************************/
+/***/ ((module) => {
+
+var str = Object.prototype.toString;
+module.exports = anArray;
function anArray(arr) {
- return (
- arr.BYTES_PER_ELEMENT
- && str.call(arr.buffer) === '[object ArrayBuffer]'
- || Array.isArray(arr)
- )
+ return arr.BYTES_PER_ELEMENT && str.call(arr.buffer) === '[object ArrayBuffer]' || Array.isArray(arr);
}
-},{}],2:[function(require,module,exports){
+/***/ }),
+
+/***/ "./node_modules/as-number/index.js":
+/*!*****************************************!*\
+ !*** ./node_modules/as-number/index.js ***!
+ \*****************************************/
+/***/ ((module) => {
+
module.exports = function numtype(num, def) {
- return typeof num === 'number'
- ? num
- : (typeof def === 'number' ? def : 0)
-}
-},{}],3:[function(require,module,exports){
-'use strict'
+ return typeof num === 'number' ? num : typeof def === 'number' ? def : 0;
+};
+
+/***/ }),
-exports.byteLength = byteLength
-exports.toByteArray = toByteArray
-exports.fromByteArray = fromByteArray
+/***/ "./node_modules/base64-js/index.js":
+/*!*****************************************!*\
+ !*** ./node_modules/base64-js/index.js ***!
+ \*****************************************/
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
-var lookup = []
-var revLookup = []
-var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
-var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+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
+ 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
-
+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')
+ 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]
+ 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
+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
+ 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
+ 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
+ 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
+ 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
+ return arr;
}
-
-function tripletToBase64 (num) {
- return lookup[num >> 18 & 0x3F] +
- lookup[num >> 12 & 0x3F] +
- lookup[num >> 6 & 0x3F] +
- lookup[num & 0x3F]
+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 = []
+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))
+ tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
+ output.push(tripletToBase64(tmp));
}
- return output.join('')
+ 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
+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)))
+ 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] +
- '=='
- )
+ 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] +
- '='
- )
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
+ parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
}
-
- return parts.join('')
+ return parts.join('');
}
-},{}],4:[function(require,module,exports){
-'use strict';
-// For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
-
-module.exports = {
- // Create a tag with optional data attributes
- createLink: function(href, attributes) {
- var head = document.head || document.getElementsByTagName('head')[0];
- var link = document.createElement('link');
-
- link.href = href;
- link.rel = 'stylesheet';
-
- for (var key in attributes) {
- if ( ! attributes.hasOwnProperty(key)) {
- continue;
- }
- var value = attributes[key];
- link.setAttribute('data-' + key, value);
- }
+/***/ }),
- head.appendChild(link);
- },
- // Create a